< prev index next >

test/lib/jdk/test/lib/containers/docker/DockerRunOptions.java

Print this page

37     // more java options, but to be set AFTER the test Java options
38     public ArrayList<String> javaOptsAppended = new ArrayList<>();
39     public String classToRun;  // class or "-version"
40     public ArrayList<String> classParams = new ArrayList<>();
41 
42     public boolean tty = true;
43     public boolean removeContainerAfterUse = true;
44     public boolean appendTestJavaOptions = true;
45     public boolean retainChildStdout = false;
46 
47     /**
48      * Convenience constructor for most common use cases in testing.
49      * @param imageNameAndTag  a string representing name and tag for the
50      *        docker image to run, as "name:tag"
51      * @param javaCmd  a java command to run (e.g. /jdk/bin/java)
52      * @param classToRun  a class to run, or "-version"
53      * @param javaOpts  java options to use
54      *
55      * @return Default docker run options
56      */

57     public DockerRunOptions(String imageNameAndTag, String javaCmd,
58                             String classToRun, String... javaOpts) {
59         this.imageNameAndTag = imageNameAndTag;
60         this.command = javaCmd;
61         this.classToRun = classToRun;
62         this.addJavaOpts(javaOpts);
63         // always print hserr to stderr in the docker tests to avoid
64         // trouble accessing it after a crash in the container
65         this.addJavaOpts("-XX:+ErrorFileToStderr");
66     }
67 
68     public final DockerRunOptions addDockerOpts(String... opts) {
69         Collections.addAll(dockerOpts, opts);
70         return this;
71     }
72 
73     public final DockerRunOptions addJavaOpts(String... opts) {
74         Collections.addAll(javaOpts, opts);
75         return this;
76     }

37     // more java options, but to be set AFTER the test Java options
38     public ArrayList<String> javaOptsAppended = new ArrayList<>();
39     public String classToRun;  // class or "-version"
40     public ArrayList<String> classParams = new ArrayList<>();
41 
42     public boolean tty = true;
43     public boolean removeContainerAfterUse = true;
44     public boolean appendTestJavaOptions = true;
45     public boolean retainChildStdout = false;
46 
47     /**
48      * Convenience constructor for most common use cases in testing.
49      * @param imageNameAndTag  a string representing name and tag for the
50      *        docker image to run, as "name:tag"
51      * @param javaCmd  a java command to run (e.g. /jdk/bin/java)
52      * @param classToRun  a class to run, or "-version"
53      * @param javaOpts  java options to use
54      *
55      * @return Default docker run options
56      */
57     @SuppressWarnings("initialization")
58     public DockerRunOptions(String imageNameAndTag, String javaCmd,
59                             String classToRun, String... javaOpts) {
60         this.imageNameAndTag = imageNameAndTag;
61         this.command = javaCmd;
62         this.classToRun = classToRun;
63         this.addJavaOpts(javaOpts);
64         // always print hserr to stderr in the docker tests to avoid
65         // trouble accessing it after a crash in the container
66         this.addJavaOpts("-XX:+ErrorFileToStderr");
67     }
68 
69     public final DockerRunOptions addDockerOpts(String... opts) {
70         Collections.addAll(dockerOpts, opts);
71         return this;
72     }
73 
74     public final DockerRunOptions addJavaOpts(String... opts) {
75         Collections.addAll(javaOpts, opts);
76         return this;
77     }
< prev index next >