@@ -41,7 +41,6 @@ public class ITImagetool extends BaseTest {
4141 private static final String WDT_ARCHIVE = "archive.zip" ;
4242 private static final String WDT_VARIABLES = "domain.properties" ;
4343 private static final String WDT_MODEL = "simple-topology.yaml" ;
44- private static final String WDT_MODEL1 = "simple-topology1.yaml" ;
4544 private static final String WDT_MODEL2 = "simple-topology2.yaml" ;
4645 private static String oracleSupportUsername ;
4746 private static String oracleSupportPassword ;
@@ -143,7 +142,7 @@ public void test3CacheAddInstallerWLS() throws Exception {
143142 /**
144143 * create a WLS image with default WLS version.
145144 *
146- * @throws Exception
145+ * @throws Exception - if any error occurs
147146 */
148147 @ Test
149148 public void test4CreateWLSImg () throws Exception {
@@ -153,9 +152,8 @@ public void test4CreateWLSImg() throws Exception {
153152 String command = imagetool + " create --jdkVersion=" + JDK_VERSION + " --tag "
154153 + build_tag + ":" + testMethodName ;
155154 logger .info ("Executing command: " + command );
156- ExecResult result = ExecCommand .exec (command );
157- logger .info ("DEBUG: result.stdout=" + result .stdout ());
158- logger .info ("DEBUG: result.stderr=" + result .stderr ());
155+ ExecResult result = ExecCommand .exec (command , true );
156+ verifyExitValue (result , command );
159157
160158 // verify the docker image is created
161159 verifyDockerImages (testMethodName );
@@ -247,7 +245,8 @@ public void test8CreateWLSImgUseCache() throws Exception {
247245 + BASE_OS_IMG + ":" + BASE_OS_IMG_TAG + " --tag " + build_tag + ":" + testMethodName
248246 + " --version " + WLS_VERSION ;
249247 logger .info ("Executing command: " + command );
250- ExecCommand .exec (command , true );
248+ ExecResult result = ExecCommand .exec (command , true );
249+ verifyExitValue (result , command );
251250
252251 // verify the docker image is created
253252 verifyDockerImages (testMethodName );
@@ -265,10 +264,11 @@ public void test9UpdateWLSImg() throws Exception {
265264 String testMethodName = new Object () {}.getClass ().getEnclosingMethod ().getName ();
266265 logTestBegin (testMethodName );
267266
268- String command = imagetool + " update --fromImage imagetool :test8CreateWLSImgUseCache --tag "
267+ String command = imagetool + " update --fromImage " + build_tag + " :test8CreateWLSImgUseCache --tag "
269268 + build_tag + ":" + testMethodName + " --patches " + P27342434_ID ;
270269 logger .info ("Executing command: " + command );
271- ExecCommand .exec (command , true );
270+ ExecResult result = ExecCommand .exec (command , true );
271+ verifyExitValue (result , command );
272272
273273 // verify the docker image is created
274274 verifyDockerImages (testMethodName );
@@ -329,7 +329,8 @@ public void testACreateWLSImgUsingWDT() throws Exception {
329329 + wdtModel + " --wdtVariables " + wdtVariables ;
330330
331331 logger .info ("Executing command: " + command );
332- ExecCommand .exec (command , true );
332+ ExecResult result = ExecCommand .exec (command , true );
333+ verifyExitValue (result , command );
333334
334335 // verify the docker image is created
335336 verifyDockerImages (testMethodName );
@@ -363,7 +364,8 @@ public void testBCreateFMWImgFullInternetAccess() throws Exception {
363364 String command = imagetool + " create --version=" + WLS_VERSION + " --tag " + build_tag + ":" + testMethodName
364365 + " --latestPSU --user " + oracleSupportUsername + " --passwordEnv ORACLE_SUPPORT_PASSWORD --type fmw" ;
365366 logger .info ("Executing command: " + command );
366- ExecCommand .exec (command , true );
367+ ExecResult result = ExecCommand .exec (command , true );
368+ verifyExitValue (result , command );
367369
368370 // verify the docker image is created
369371 verifyDockerImages (testMethodName );
@@ -399,7 +401,8 @@ public void testCCreateFMWImgNonDefault() throws Exception {
399401 String command = imagetool + " create --jdkVersion " + JDK_VERSION_8u212 + " --version=" + WLS_VERSION_1221
400402 + " --tag " + build_tag + ":" + testMethodName + " --patches " + P22987840_ID + " --type fmw" ;
401403 logger .info ("Executing command: " + command );
402- ExecCommand .exec (command , true );
404+ ExecResult result = ExecCommand .exec (command , true );
405+ verifyExitValue (result , command );
403406
404407 // verify the docker image is created
405408 verifyDockerImages (testMethodName );
@@ -444,7 +447,7 @@ public void testDCreateJRFDomainImgUsingWDT() throws Exception {
444447
445448 String wdtArchive = getWDTResourcePath () + FS + WDT_ARCHIVE ;
446449 String wdtModel = getWDTResourcePath () + FS + WDT_MODEL1 ;
447- String tmpWdtModel = System . getProperty ( "java.io.tmpdir" ) + FS + WDT_MODEL1 ;
450+ String tmpWdtModel = wlsImgBldDir + FS + WDT_MODEL1 ;
448451
449452 // update wdt model file
450453 Path source = Paths .get (wdtModel );
@@ -463,7 +466,8 @@ public void testDCreateJRFDomainImgUsingWDT() throws Exception {
463466 + tmpWdtModel + " --wdtDomainType JRF --wdtRunRCU --type fmw" ;
464467
465468 logger .info ("Executing command: " + command );
466- ExecCommand .exec (command , true );
469+ ExecResult result = ExecCommand .exec (command , true );
470+ verifyExitValue (result , command );
467471
468472 // verify the docker image is created
469473 verifyDockerImages (testMethodName );
@@ -513,14 +517,20 @@ public void testECreateRestricedJRFDomainImgUsingWDT() throws Exception {
513517 + wdtModel + " --wdtDomainType RestrictedJRF --type fmw --wdtVariables " + wdtVariables ;
514518
515519 logger .info ("Executing command: " + command );
516- ExecCommand .exec (command , true );
520+ ExecResult result = ExecCommand .exec (command , true );
521+ verifyExitValue (result , command );
517522
518523 // verify the docker image is created
519524 verifyDockerImages (testMethodName );
520525
521526 logTestEnd (testMethodName );
522527 }
523528
529+ /**
530+ * create wls image using multiple WDT model files
531+ *
532+ * @throws Exception - if any error occurs
533+ */
524534 @ Test
525535 public void testFCreateWLSImgUsingMultiModels () throws Exception {
526536 String testMethodName = new Object () {}.getClass ().getEnclosingMethod ().getName ();
@@ -564,11 +574,47 @@ public void testFCreateWLSImgUsingMultiModels() throws Exception {
564574 + wdtModel + "," + wdtModel2 + " --wdtVariables " + wdtVariables ;
565575
566576 logger .info ("Executing command: " + command );
567- ExecCommand .exec (command , true );
577+ ExecResult result = ExecCommand .exec (command , true );
578+ verifyExitValue (result , command );
568579
569580 // verify the docker image is created
570581 verifyDockerImages (testMethodName );
571582
572583 logTestEnd (testMethodName );
573584 }
585+
586+ /**
587+ * create WLS image with additional build commands
588+ *
589+ * @throws Exception - if any error occurs
590+ */
591+ @ Test
592+ public void testGCreateWLSImgWithAdditionalBuildCommands () throws Exception {
593+ String testMethodName = new Object () {}.getClass ().getEnclosingMethod ().getName ();
594+ logTestBegin (testMethodName );
595+
596+ String imagename = build_tag + ":" + testMethodName ;
597+ String abcPath = getABCResourcePath () + FS + "multi-sections.txt" ;
598+ String command = imagetool + " create --jdkVersion=" + JDK_VERSION + " --tag "
599+ + imagename + " --additionalBuildCommands " + abcPath ;
600+ logger .info ("Executing command: " + command );
601+ ExecResult result = ExecCommand .exec (command , true );
602+ verifyExitValue (result , command );
603+
604+ // verify the docker image is created
605+ verifyDockerImages (testMethodName );
606+
607+ // verify the file created in [before-jdk-install] section
608+ verifyFileInImage (imagename , "/u01/jdk/beforeJDKInstall.txt" , "before-jdk-install" );
609+ // verify the file created in [after-jdk-install] section
610+ verifyFileInImage (imagename , "/u01/jdk/afterJDKInstall.txt" , "after-jdk-install" );
611+ // verify the file created in [before-fmw-install] section
612+ verifyFileInImage (imagename , "/u01/oracle/beforeFMWInstall.txt" , "before-fmw-install" );
613+ // verify the file created in [after-fmw-install] section
614+ verifyFileInImage (imagename , "/u01/oracle/afterFMWInstall.txt" , "after-fmw-install" );
615+ // verify the label is created as in [final-build-commands] section
616+ verifyLabelInImage (imagename , "final-build-commands:finalBuildCommands" );
617+
618+ logTestEnd (testMethodName );
619+ }
574620}
0 commit comments