< prev index next >

test/testlibrary/com/oracle/java/testlibrary/DockerTestUtils.java

Print this page
rev 9061 : 8222888: [TESTBUG] docker/TestJFREvents.java fails due to "RuntimeException: JAVA_MAIN_CLASS_ is not defined"
Summary: Introduced unique environment variable
Reviewed-by: egahlin, lmesnik, sgehwolf

@@ -165,19 +165,19 @@
             .shouldContain("Successfully built");
     }
 
 
     /**
-     * Run Java inside the docker image with specified parameters and options.
+     * Build the docker command to run java inside a container
      *
      * @param DockerRunOptions optins for running docker
      *
-     * @return output of the run command
+     * @return command
      * @throws Exception
      */
-    public static OutputAnalyzer dockerRunJava(DockerRunOptions opts) throws Exception {
-        ArrayList<String> cmd = new ArrayList<>();
+    public static List<String> buildJavaCommand(DockerRunOptions opts) throws Exception {
+        List<String> cmd = new ArrayList<>();
 
         cmd.add("docker");
         cmd.add("run");
         if (opts.tty)
             cmd.add("--tty=true");

@@ -193,13 +193,24 @@
             Collections.addAll(cmd, Utils.getTestJavaOpts());
         }
 
         cmd.add(opts.classToRun);
         cmd.addAll(opts.classParams);
-        return execute(cmd);
+        return cmd;
     }
 
+    /**
+     * Run Java inside the docker image with specified parameters and options.
+     *
+     * @param DockerRunOptions optins for running docker
+     *
+     * @return output of the run command
+     * @throws Exception
+     */
+    public static OutputAnalyzer dockerRunJava(DockerRunOptions opts) throws Exception {
+        return execute(buildJavaCommand(opts));
+    }
 
      /**
      * Remove docker image
      *
      * @param DockerRunOptions optins for running docker
< prev index next >