Skip to content

Commit 6b24c31

Browse files
separate system test result files (#1347)
* separate system test result files * separate system test result files * correct continuation indent * correct continuation indent * correct continuation indent
1 parent 6dd2995 commit 6b24c31

File tree

1 file changed

+40
-28
lines changed
  • integration-tests/system-test/src/test/java/oracle/weblogic/deploy/integration

1 file changed

+40
-28
lines changed

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

Lines changed: 40 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,10 @@ private static Map<String,String> getTestMethodEnvironment(TestInfo testInfo) th
9393
}
9494

9595
private static PrintWriter getTestMethodWriter(TestInfo testInfo) throws IOException {
96+
return getTestMethodWriter(testInfo, "");
97+
}
98+
99+
private static PrintWriter getTestMethodWriter(TestInfo testInfo, String suffixName) throws IOException {
96100
if (!testInfo.getTestMethod().isPresent()) {
97101
throw new IllegalArgumentException("Method is not present in this context, and this method cannot be used");
98102
}
@@ -103,7 +107,8 @@ private static PrintWriter getTestMethodWriter(TestInfo testInfo) throws IOExcep
103107
logger.info("Test log: " + outputPath);
104108
return new PrintWriter(
105109
new BufferedWriter(new OutputStreamWriter(
106-
new FileOutputStream(outputPath.resolve(Paths.get(methodName + ".out")).toString()))), true);
110+
new FileOutputStream(outputPath.resolve(Paths.get(methodName +
111+
suffixName + ".out")).toString()))), true);
107112
}
108113

109114
/**
@@ -504,13 +509,13 @@ void test17DiscoverDomainWithRequiredArgument(TestInfo testInfo) throws Exceptio
504509
domainParentDir + FS + "restrictedJRFD1-discover17-18-19 -model_file " +
505510
getSampleModelFile("-constant") + " -archive_file " + getSampleArchiveFile() +
506511
" -domain_type RestrictedJRF";
507-
try (PrintWriter out = getTestMethodWriter(testInfo)) {
512+
try (PrintWriter out = getTestMethodWriter(testInfo, "CreateDomain")) {
508513
CommandResult result = Runner.run(cmd, getTestMethodEnvironment(testInfo), out);
509514
assertEquals(0, result.exitValue(), "Unexpected return code");
510515
discover17DomainCreated = true;
511516
}
512517

513-
try (PrintWriter out = getTestMethodWriter(testInfo)) {
518+
try (PrintWriter out = getTestMethodWriter(testInfo, "DiscoverDomain")) {
514519
Path discoveredModel = getTestOutputPath(testInfo).resolve("discoveredModel.yaml");
515520
Path discoveredArchive = getTestOutputPath(testInfo).resolve("discoveredArchive.zip");
516521
cmd = discoverDomainScript
@@ -618,7 +623,7 @@ private void verifyGDiscoverDomainWithVariableFile(String expectedModelFile) thr
618623
void test20DiscoverDomainJRFDomainType(TestInfo testInfo) throws Exception {
619624
assumeTrue(new JrfChecker(), "User specified skipping JRF tests");
620625
waitForDatabase();
621-
try (PrintWriter out = getTestMethodWriter(testInfo)) {
626+
try (PrintWriter out = getTestMethodWriter(testInfo, "CreateDomain")) {
622627
Path source = Paths.get(getSampleModelFile("2"));
623628
Path modelOut = getTestOutputPath(testInfo).resolve(SAMPLE_MODEL_FILE_PREFIX + "2.yaml");
624629
// create wdt model file to use in create, after substitution of DB host/ip
@@ -631,7 +636,7 @@ void test20DiscoverDomainJRFDomainType(TestInfo testInfo) throws Exception {
631636
CommandResult result = Runner.run(cmd, getTestMethodEnvironment(testInfo), out);
632637
assertEquals(0, result.exitValue(), "Unexpected return code");
633638
}
634-
try (PrintWriter out = getTestMethodWriter(testInfo)) {
639+
try (PrintWriter out = getTestMethodWriter(testInfo, "DiscoverDomain")) {
635640
Path discoveredArchive = getTestOutputPath(testInfo).resolve("discoveredArchive.zip");
636641
Path discoveredModelFile = getTestOutputPath(testInfo).resolve("discoveredJRFD1.yaml");
637642
String cmd = discoverDomainScript
@@ -672,7 +677,7 @@ private void verifyHDiscoverDomainJRFDomainType(String expectedModelFile) {
672677
@Test
673678
void test21UpdateDomain(TestInfo testInfo) throws Exception {
674679
assumeTrue(test11DomainCreated, "Skipping test 21 because dependent domain was not created");
675-
try (PrintWriter out = getTestMethodWriter(testInfo)) {
680+
try (PrintWriter out = getTestMethodWriter(testInfo, "UpdateDomain")) {
676681
Path source = Paths.get(getSampleVariableFile());
677682
Path variableFile = getTestOutputPath(testInfo).resolve(SAMPLE_VARIABLE_FILE);
678683

@@ -689,9 +694,10 @@ void test21UpdateDomain(TestInfo testInfo) throws Exception {
689694

690695
CommandResult result = Runner.run(cmd, getTestMethodEnvironment(testInfo), out);
691696
verifyResult(result, "updateDomain.sh completed successfully");
692-
697+
}
698+
try (PrintWriter out = getTestMethodWriter(testInfo, "GrepResults")) {
693699
// Expecting grep return code of 0. Grep will return 0 if found, and 1 if the requested text is not found.
694-
cmd = "grep -q '<max-dynamic-cluster-size>4</max-dynamic-cluster-size>' " + domainParentDir + FS +
700+
String cmd = "grep -q '<max-dynamic-cluster-size>4</max-dynamic-cluster-size>' " + domainParentDir + FS +
695701
"domain2" + FS + "config" + FS + "config.xml";
696702
CommandResult result2 = Runner.run(cmd, getTestMethodEnvironment(testInfo), out);
697703
assertEquals(0, result2.exitValue(), "config.xml does not appear to reflect the update");
@@ -840,19 +846,20 @@ void test28ValidateModelWithInvalidModelfile(TestInfo testInfo) throws Exception
840846
@Tag("gate")
841847
@Test
842848
void test29EncryptModel(TestInfo testInfo) throws Exception {
843-
try (PrintWriter out = getTestMethodWriter(testInfo)) {
844-
Path source = Paths.get(getSampleModelFile("-constant"));
845-
Path model = getTestOutputPath(testInfo).resolve(SAMPLE_MODEL_FILE_PREFIX + "-constant.yaml");
849+
Path source = Paths.get(getSampleModelFile("-constant"));
850+
Path model = getTestOutputPath(testInfo).resolve(SAMPLE_MODEL_FILE_PREFIX + "-constant.yaml");
851+
try (PrintWriter out = getTestMethodWriter(testInfo, "EncryptModel")) {
846852
Files.copy(source, model, StandardCopyOption.REPLACE_EXISTING);
847853

848854
String cmd = encryptModelScript
849855
+ " -oracle_home " + mwhome_12213
850856
+ " -model_file " + model + " < " + getResourcePath().resolve("passphrase.txt");
851857
CommandResult result = Runner.run(cmd, getTestMethodEnvironment(testInfo), out);
852858
verifyResult(result, "encryptModel.sh completed successfully");
853-
859+
}
860+
try (PrintWriter out = getTestMethodWriter(testInfo, "CreateDomain")) {
854861
// create the domain using -use_encryption
855-
cmd = createDomainScript
862+
String cmd = createDomainScript
856863
+ " -oracle_home " + mwhome_12213
857864
+ " -domain_home " + domainParentDir + FS + "domain10"
858865
+ " -model_file " + model
@@ -880,7 +887,7 @@ void test30OnlineUpdateApp(TestInfo testInfo) throws Exception {
880887
+ " -model_file " + getSampleModelFile("-onlinebase")
881888
+ " -archive_file " + getSampleArchiveFile();
882889

883-
try (PrintWriter out = getTestMethodWriter(testInfo)) {
890+
try (PrintWriter out = getTestMethodWriter(testInfo, "CreateDomain")) {
884891
CommandResult result = Runner.run(cmd, getTestMethodEnvironment(testInfo), out);
885892
assertEquals(0, result.exitValue(), "Unexpected return code");
886893
assertTrue(result.stdout().contains("createDomain.sh completed successfully"), "Create failed");
@@ -891,11 +898,11 @@ void test30OnlineUpdateApp(TestInfo testInfo) throws Exception {
891898
Path adminServerOut = getTestOutputPath(testInfo).resolve("admin-server.out");
892899
boolean isServerUp = startAdminServer(domainHome, adminServerOut);
893900

901+
Path source = Paths.get(getSampleModelFile("-untargetapp"));
902+
Path model = getTestOutputPath(testInfo).resolve(SAMPLE_MODEL_FILE_PREFIX + "-onlineUpdate.yaml");
894903
if (isServerUp) {
895-
try (PrintWriter out = getTestMethodWriter(testInfo)) {
904+
try (PrintWriter out = getTestMethodWriter(testInfo, "UpdateDomain-1")) {
896905
// update wdt model file
897-
Path source = Paths.get(getSampleModelFile("-untargetapp"));
898-
Path model = getTestOutputPath(testInfo).resolve(SAMPLE_MODEL_FILE_PREFIX + "-onlineUpdate.yaml");
899906
Files.copy(source, model, StandardCopyOption.REPLACE_EXISTING);
900907

901908
cmd = "echo welcome1 | "
@@ -910,7 +917,8 @@ void test30OnlineUpdateApp(TestInfo testInfo) throws Exception {
910917
assertEquals(0, result.exitValue(), "Unexpected return code for untargeting app");
911918
assertTrue(result.stdout().contains("<remove_app_from_deployment> <WLSDPLY-09339>"),
912919
"Update does not contains expected message WLSDPLY-09339");
913-
920+
}
921+
try (PrintWriter out = getTestMethodWriter(testInfo, "UpdateDomain-2")) {
914922
// Check result
915923
source = Paths.get(getSampleModelFile("-targetapp"));
916924
model = getTestOutputPath(testInfo).resolve(SAMPLE_MODEL_FILE_PREFIX + "-onlineUpdate.yaml");
@@ -923,14 +931,15 @@ void test30OnlineUpdateApp(TestInfo testInfo) throws Exception {
923931
+ " -model_file " + model
924932
+ " -archive_file " + getSampleArchiveFile()
925933
+ " -admin_url t3://localhost:7001 -admin_user weblogic";
926-
result = Runner.run(cmd, getTestMethodEnvironment(testInfo), out);
934+
CommandResult result = Runner.run(cmd, getTestMethodEnvironment(testInfo), out);
927935

928936
assertEquals(0, result.exitValue(), "Unexpected return code for targeting app");
929937
assertTrue(result.stdout().contains("<__deploy_app_online> <WLSDPLY-09316>"),
930938
"Update does not contains expected message WLSDPLY-09316");
931939
assertTrue(result.stdout().contains("<__start_app> <WLSDPLY-09313>"),
932940
"Update does not contains expected message WLSDPLY-09313");
933-
941+
}
942+
try (PrintWriter out = getTestMethodWriter(testInfo, "UpdateDomain-online")) {
934943
source = Paths.get(getSampleModelFile("-targetapp"));
935944
model = getTestOutputPath(testInfo).resolve(SAMPLE_MODEL_FILE_PREFIX + "-onlineUpdate.yaml");
936945
Files.copy(source, model, StandardCopyOption.REPLACE_EXISTING);
@@ -942,7 +951,7 @@ void test30OnlineUpdateApp(TestInfo testInfo) throws Exception {
942951
+ " -model_file " + model
943952
+ " -archive_file " + getUpdatedSampleArchiveFile()
944953
+ " -admin_url t3://localhost:7001 -admin_user weblogic";
945-
result = Runner.run(cmd, getTestMethodEnvironment(testInfo), out);
954+
CommandResult result = Runner.run(cmd, getTestMethodEnvironment(testInfo), out);
946955

947956
assertEquals(0, result.exitValue(), "Unexpected return code for updating domain with new archive");
948957
assertTrue(result.stdout().contains("<__stop_app> <WLSDPLY-09312>"),
@@ -979,7 +988,7 @@ void test31DiscoverDomainWithModelFile(TestInfo testInfo) throws Exception {
979988
+ " -model_file " + getSampleModelFile("-onlinebase")
980989
+ " -archive_file " + getSampleArchiveFile();
981990

982-
try (PrintWriter out = getTestMethodWriter(testInfo)) {
991+
try (PrintWriter out = getTestMethodWriter(testInfo, "CreateDomain")) {
983992
CommandResult result = Runner.run(cmd, getTestMethodEnvironment(testInfo), out);
984993
assertEquals(0, result.exitValue(), "Unexpected return code");
985994
}
@@ -989,19 +998,21 @@ void test31DiscoverDomainWithModelFile(TestInfo testInfo) throws Exception {
989998
cmd = discoverDomainScript + " -oracle_home " + mwhome_12213 + " -domain_home " +
990999
domainParentDir + FS + "domain2-discover31 -archive_file " + discoveredArchive +
9911000
" -model_file " + discoveredModelFile + " -variable_file " + discoveredVariableFile;
992-
try (PrintWriter out = getTestMethodWriter(testInfo)) {
1001+
try (PrintWriter out = getTestMethodWriter(testInfo, "DiscoverDomain")) {
9931002
CommandResult result = Runner.run(cmd, getTestMethodEnvironment(testInfo), out);
9941003

9951004
verifyResult(result, "discoverDomain.sh completed successfully");
9961005

9971006
// verify model file
9981007
verifyModelFile(discoveredModelFile.toString());
9991008

1009+
}
1010+
try (PrintWriter out = getTestMethodWriter(testInfo, "CreateDomainFromDiscover")) {
10001011
String domainHome = domainParentDir + FS + "createDomainFromDiscover";
10011012
cmd = createDomainScript + " -oracle_home " + mwhome_12213 + " -domain_home " +
10021013
domainHome + " -archive_file " + discoveredArchive +
10031014
" -model_file " + discoveredModelFile + " -variable_file " + getSampleVariableFile();
1004-
result = Runner.run(cmd, getTestMethodEnvironment(testInfo), out);
1015+
CommandResult result = Runner.run(cmd, getTestMethodEnvironment(testInfo), out);
10051016

10061017
verifyResult(result, "createDomain.sh completed successfully");
10071018

@@ -1025,9 +1036,9 @@ void test31DiscoverDomainWithModelFile(TestInfo testInfo) throws Exception {
10251036
@Test
10261037
void test32PrepareModel(TestInfo testInfo) throws Exception {
10271038

1028-
try (PrintWriter out = getTestMethodWriter(testInfo)) {
1039+
Path outputFiles = getTestOutputPath(testInfo);
1040+
try (PrintWriter out = getTestMethodWriter(testInfo, "PrepareModel")) {
10291041
String wkoModelFile = getSampleModelFile("-targetwko");
1030-
Path outputFiles = getTestOutputPath(testInfo);
10311042
String cmd = prepareModelScript
10321043
+ " -oracle_home " + mwhome_12213
10331044
+ " -output_dir " + outputFiles
@@ -1037,10 +1048,11 @@ void test32PrepareModel(TestInfo testInfo) throws Exception {
10371048
CommandResult result = Runner.run(cmd, getTestMethodEnvironment(testInfo), out);
10381049
// ListenPort differences warning
10391050
assertEquals(1, result.exitValue(), "Unexpected return code");
1040-
1051+
}
1052+
try (PrintWriter out = getTestMethodWriter(testInfo, "GrepResults")) {
10411053
// verify model file
10421054
String tempWkoModel = outputFiles + FS + "simple-topology-targetwko.yaml";
1043-
cmd = "grep \"PasswordEncrypted: '@@SECRET\" " + tempWkoModel;
1055+
String cmd = "grep \"PasswordEncrypted: '@@SECRET\" " + tempWkoModel;
10441056
CommandResult result2 = Runner.run(cmd, getTestMethodEnvironment(testInfo), out);
10451057
assertEquals(0, result2.exitValue(), "Missing JDBC Secret");
10461058
cmd = "grep -c 'Machine' " + tempWkoModel;

0 commit comments

Comments
 (0)