Skip to content

Commit 701e35a

Browse files
added integration test for sample (#1200)
1 parent 324753e commit 701e35a

File tree

2 files changed

+43
-2
lines changed

2 files changed

+43
-2
lines changed

system-test/integration-tests/src/test/java/oracle/weblogic/deploy/integration/ITWdt.java

Lines changed: 40 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -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;

system-test/integration-tests/src/test/resources/domain.properties

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
# These variables are used for substitution in the WDT model file.
22
# Any port that will be exposed through Docker is put in this file.
33
# The sample Dockerfile will get the ports from this file and not the WDT model.
4+
AdminUserName=weblogic
5+
AdminPassword=welcome1
6+
SecurityConfig.NodeManagerUsername=weblogic
47
DOMAIN_NAME=domain1
58
ADMIN_PORT=7001
69
ADMIN_NAME=admin-server

0 commit comments

Comments
 (0)