@@ -243,6 +243,7 @@ static void staticUnprepare() throws Exception {
243243
244244 /**
245245 * Create the log directory in ./target (build folder), and open a new file using the test method's name.
246+ *
246247 * @param testInfo metadata from the test to be logged
247248 * @return an output file wrapped in a PrintWriter
248249 * @throws IOException if the PrintWriter fails to open the file
@@ -881,4 +882,59 @@ void createWlsImgWithAdditionalBuildCommands(TestInfo testInfo) throws Exception
881882 assertTrue (inspect .stdout ().contains ("final-build-commands:finalBuildCommands" ),
882883 tagName + " does not contain the expected label" );
883884 }
885+
886+ /**
887+ * Create a WLS image using Java Server JRE image as a base.
888+ * This tests that the JAVA_HOME is correctly identified and applied in the CREATE.
889+ *
890+ * @throws Exception - if any error occurs
891+ */
892+ @ Test
893+ @ Order (26 )
894+ @ Tag ("nightly" )
895+ @ DisplayName ("Create image with WLS using Java ServerJRE" )
896+ void createImageWithServerJRE (TestInfo testInfo ) throws Exception {
897+ String tagName = build_tag + ":" + getMethodName (testInfo );
898+ String command = new CreateCommand ()
899+ .tag (tagName )
900+ .fromImage ("container-registry.oracle.com/java/serverjre:8" )
901+ .build ();
902+
903+ try (PrintWriter out = getTestMethodWriter (testInfo )) {
904+ CommandResult result = Runner .run (command , out , logger );
905+ assertEquals (0 , result .exitValue (), "for command: " + command );
906+
907+ // verify the docker image is created
908+ String imageId = Runner .run ("docker images -q " + tagName , out , logger ).stdout ().trim ();
909+ assertFalse (imageId .isEmpty (), "Image was not created: " + tagName );
910+ }
911+ }
912+
913+ /**
914+ * Update the WLS image created in the previous test.
915+ * This tests that the JAVA_HOME is correctly identified and applied in the UPDATE.
916+ *
917+ * @throws Exception - if any error occurs
918+ */
919+ @ Test
920+ @ Order (27 )
921+ @ Tag ("nightly" )
922+ @ DisplayName ("Update image with WLS using Java ServerJRE" )
923+ void updateImageWithServerJRE (TestInfo testInfo ) throws Exception {
924+ String tagName = build_tag + ":" + getMethodName (testInfo );
925+ String command = new UpdateCommand ()
926+ .fromImage (build_tag + ":createImageWithServerJRE" )
927+ .tag (tagName )
928+ .patches (P27342434_ID )
929+ .build ();
930+
931+ try (PrintWriter out = getTestMethodWriter (testInfo )) {
932+ CommandResult result = Runner .run (command , out , logger );
933+ assertEquals (0 , result .exitValue (), "for command: " + command );
934+
935+ // verify the docker image is created
936+ String imageId = Runner .run ("docker images -q " + tagName , out , logger ).stdout ().trim ();
937+ assertFalse (imageId .isEmpty (), "Image was not created: " + tagName );
938+ }
939+ }
884940}
0 commit comments