@@ -41,7 +41,6 @@ public class ITImagetool extends BaseTest {
41
41
private static final String WDT_ARCHIVE = "archive.zip" ;
42
42
private static final String WDT_VARIABLES = "domain.properties" ;
43
43
private static final String WDT_MODEL = "simple-topology.yaml" ;
44
- private static final String WDT_MODEL1 = "simple-topology1.yaml" ;
45
44
private static final String WDT_MODEL2 = "simple-topology2.yaml" ;
46
45
private static String oracleSupportUsername ;
47
46
private static String oracleSupportPassword ;
@@ -143,7 +142,7 @@ public void test3CacheAddInstallerWLS() throws Exception {
143
142
/**
144
143
* create a WLS image with default WLS version.
145
144
*
146
- * @throws Exception
145
+ * @throws Exception - if any error occurs
147
146
*/
148
147
@ Test
149
148
public void test4CreateWLSImg () throws Exception {
@@ -153,9 +152,8 @@ public void test4CreateWLSImg() throws Exception {
153
152
String command = imagetool + " create --jdkVersion=" + JDK_VERSION + " --tag "
154
153
+ build_tag + ":" + testMethodName ;
155
154
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 );
159
157
160
158
// verify the docker image is created
161
159
verifyDockerImages (testMethodName );
@@ -247,7 +245,8 @@ public void test8CreateWLSImgUseCache() throws Exception {
247
245
+ BASE_OS_IMG + ":" + BASE_OS_IMG_TAG + " --tag " + build_tag + ":" + testMethodName
248
246
+ " --version " + WLS_VERSION ;
249
247
logger .info ("Executing command: " + command );
250
- ExecCommand .exec (command , true );
248
+ ExecResult result = ExecCommand .exec (command , true );
249
+ verifyExitValue (result , command );
251
250
252
251
// verify the docker image is created
253
252
verifyDockerImages (testMethodName );
@@ -265,10 +264,11 @@ public void test9UpdateWLSImg() throws Exception {
265
264
String testMethodName = new Object () {}.getClass ().getEnclosingMethod ().getName ();
266
265
logTestBegin (testMethodName );
267
266
268
- String command = imagetool + " update --fromImage imagetool :test8CreateWLSImgUseCache --tag "
267
+ String command = imagetool + " update --fromImage " + build_tag + " :test8CreateWLSImgUseCache --tag "
269
268
+ build_tag + ":" + testMethodName + " --patches " + P27342434_ID ;
270
269
logger .info ("Executing command: " + command );
271
- ExecCommand .exec (command , true );
270
+ ExecResult result = ExecCommand .exec (command , true );
271
+ verifyExitValue (result , command );
272
272
273
273
// verify the docker image is created
274
274
verifyDockerImages (testMethodName );
@@ -329,7 +329,8 @@ public void testACreateWLSImgUsingWDT() throws Exception {
329
329
+ wdtModel + " --wdtVariables " + wdtVariables ;
330
330
331
331
logger .info ("Executing command: " + command );
332
- ExecCommand .exec (command , true );
332
+ ExecResult result = ExecCommand .exec (command , true );
333
+ verifyExitValue (result , command );
333
334
334
335
// verify the docker image is created
335
336
verifyDockerImages (testMethodName );
@@ -363,7 +364,8 @@ public void testBCreateFMWImgFullInternetAccess() throws Exception {
363
364
String command = imagetool + " create --version=" + WLS_VERSION + " --tag " + build_tag + ":" + testMethodName
364
365
+ " --latestPSU --user " + oracleSupportUsername + " --passwordEnv ORACLE_SUPPORT_PASSWORD --type fmw" ;
365
366
logger .info ("Executing command: " + command );
366
- ExecCommand .exec (command , true );
367
+ ExecResult result = ExecCommand .exec (command , true );
368
+ verifyExitValue (result , command );
367
369
368
370
// verify the docker image is created
369
371
verifyDockerImages (testMethodName );
@@ -399,7 +401,8 @@ public void testCCreateFMWImgNonDefault() throws Exception {
399
401
String command = imagetool + " create --jdkVersion " + JDK_VERSION_8u212 + " --version=" + WLS_VERSION_1221
400
402
+ " --tag " + build_tag + ":" + testMethodName + " --patches " + P22987840_ID + " --type fmw" ;
401
403
logger .info ("Executing command: " + command );
402
- ExecCommand .exec (command , true );
404
+ ExecResult result = ExecCommand .exec (command , true );
405
+ verifyExitValue (result , command );
403
406
404
407
// verify the docker image is created
405
408
verifyDockerImages (testMethodName );
@@ -444,7 +447,7 @@ public void testDCreateJRFDomainImgUsingWDT() throws Exception {
444
447
445
448
String wdtArchive = getWDTResourcePath () + FS + WDT_ARCHIVE ;
446
449
String wdtModel = getWDTResourcePath () + FS + WDT_MODEL1 ;
447
- String tmpWdtModel = System . getProperty ( "java.io.tmpdir" ) + FS + WDT_MODEL1 ;
450
+ String tmpWdtModel = wlsImgBldDir + FS + WDT_MODEL1 ;
448
451
449
452
// update wdt model file
450
453
Path source = Paths .get (wdtModel );
@@ -463,7 +466,8 @@ public void testDCreateJRFDomainImgUsingWDT() throws Exception {
463
466
+ tmpWdtModel + " --wdtDomainType JRF --wdtRunRCU --type fmw" ;
464
467
465
468
logger .info ("Executing command: " + command );
466
- ExecCommand .exec (command , true );
469
+ ExecResult result = ExecCommand .exec (command , true );
470
+ verifyExitValue (result , command );
467
471
468
472
// verify the docker image is created
469
473
verifyDockerImages (testMethodName );
@@ -513,14 +517,20 @@ public void testECreateRestricedJRFDomainImgUsingWDT() throws Exception {
513
517
+ wdtModel + " --wdtDomainType RestrictedJRF --type fmw --wdtVariables " + wdtVariables ;
514
518
515
519
logger .info ("Executing command: " + command );
516
- ExecCommand .exec (command , true );
520
+ ExecResult result = ExecCommand .exec (command , true );
521
+ verifyExitValue (result , command );
517
522
518
523
// verify the docker image is created
519
524
verifyDockerImages (testMethodName );
520
525
521
526
logTestEnd (testMethodName );
522
527
}
523
528
529
+ /**
530
+ * create wls image using multiple WDT model files
531
+ *
532
+ * @throws Exception - if any error occurs
533
+ */
524
534
@ Test
525
535
public void testFCreateWLSImgUsingMultiModels () throws Exception {
526
536
String testMethodName = new Object () {}.getClass ().getEnclosingMethod ().getName ();
@@ -564,11 +574,47 @@ public void testFCreateWLSImgUsingMultiModels() throws Exception {
564
574
+ wdtModel + "," + wdtModel2 + " --wdtVariables " + wdtVariables ;
565
575
566
576
logger .info ("Executing command: " + command );
567
- ExecCommand .exec (command , true );
577
+ ExecResult result = ExecCommand .exec (command , true );
578
+ verifyExitValue (result , command );
568
579
569
580
// verify the docker image is created
570
581
verifyDockerImages (testMethodName );
571
582
572
583
logTestEnd (testMethodName );
573
584
}
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
+ }
574
620
}
0 commit comments