@@ -521,7 +521,6 @@ private void verifyFDiscoverDomainWithRequiredArgument(String expectedModelFile)
521521 checkContents .add ("SourcePath: wlsdeploy/applications/simple-app.war" );
522522 verifyModelFileContents (expectedModelFile , checkContents );
523523 }
524-
525524 /**
526525 * test discoverDomain.sh with -model_file argument
527526 * @throws Exception - if any error occurs
@@ -534,7 +533,7 @@ void test18DiscoverDomainWithModelFile(TestInfo testInfo) throws Exception {
534533 Path discoveredArchive = getTestOutputPath (testInfo ).resolve ("discoveredArchive.zip" );
535534 Path discoveredModelFile = getTestOutputPath (testInfo ).resolve ("discoveredRestrictedJRFD1.yaml" );
536535 String cmd = discoverDomainScript + " -oracle_home " + mwhome_12213 + " -domain_home " +
537- domainParentDir + FS + "restrictedJRFD1 -archive_file " + discoveredArchive +
536+ domainParentDir + FS + "restrictedJRFD1 -archive_file " + discoveredArchive +
538537 " -model_file " + discoveredModelFile ;
539538 try (PrintWriter out = getTestMethodWriter (testInfo )) {
540539 CommandResult result = Runner .run (cmd , getTestMethodEnvironment (testInfo ), out );
@@ -925,7 +924,46 @@ void test30OnlineUpdateApp(TestInfo testInfo) throws Exception {
925924
926925
927926 }
927+ /**
928+ * test discoverDomain.sh that model can create a working domain
929+ * @throws Exception - if any error occurs
930+ */
931+ @ DisplayName ("Test 31: Discover domain and then create a new domain from the model" )
932+ @ Order (31 )
933+ @ Tag ("gate" )
934+ @ Test
935+ void test31DiscoverDomainWithModelFile (TestInfo testInfo ) throws Exception {
936+ Path discoveredArchive = getTestOutputPath (testInfo ).resolve ("discoveredArchive.zip" );
937+ Path discoveredModelFile = getTestOutputPath (testInfo ).resolve ("discoveredModel.yaml" );
938+ Path discoveredVariableFile = getTestOutputPath (testInfo ).resolve ("discoveredVariable.properties" );
939+ String cmd = discoverDomainScript + " -oracle_home " + mwhome_12213 + " -domain_home " +
940+ domainParentDir + FS + "domain2 -archive_file " + discoveredArchive +
941+ " -model_file " + discoveredModelFile + " -variable_file " + discoveredVariableFile ;
942+ try (PrintWriter out = getTestMethodWriter (testInfo )) {
943+ CommandResult result = Runner .run (cmd , getTestMethodEnvironment (testInfo ), out );
928944
945+ verifyResult (result , "discoverDomain.sh completed successfully" );
946+
947+ // verify model file
948+ verifyModelFile (discoveredModelFile .toString ());
949+
950+ String domainHome = domainParentDir + FS + "createDomainFromDiscover" ;
951+ cmd = createDomainScript + " -oracle_home " + mwhome_12213 + " -domain_home " +
952+ domainHome + " -archive_file " + discoveredArchive +
953+ " -model_file " + discoveredModelFile + " -variable_file " + getSampleVariableFile ();
954+ result = Runner .run (cmd , getTestMethodEnvironment (testInfo ), out );
955+
956+ verifyResult (result , "createDomain.sh completed successfully" );
957+
958+ setUpBootProperties (domainHome , "AdminServer" , "weblogic" , "welcome1" );
959+ Path adminServerOut = getTestOutputPath (testInfo ).resolve ("AdminServer.out" );
960+ boolean isServerUp = startAdminServer (domainHome , adminServerOut );
961+ if (!isServerUp ) {
962+ throw new Exception ("Admin server did not come up after createDomain from discoverDomain" );
963+ }
964+ stopAdminServer (domainHome );
965+ }
966+ }
929967
930968 private boolean startAdminServer (String domainHome , Path outputFile ) throws Exception {
931969 boolean isServerUp = false ;
0 commit comments