18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 */
23
24 /**
25 * @test
26 * @library /lib/testlibrary
27 * @modules jdk.jartool/sun.tools.jar
28 * jdk.compiler
29 * @build ContainerTest CompilerUtils jdk.testlibrary.*
30 * @run testng ContainerTest
31 * @summary Starts a simple container that uses dynamic configurations
32 * and launches two applications in the same VM
33 */
34
35 import java.nio.file.Files;
36 import java.nio.file.Path;
37 import java.nio.file.Paths;
38
39 import static jdk.testlibrary.ProcessTools.*;
40
41 import org.testng.annotations.BeforeTest;
42 import org.testng.annotations.Test;
43 import static org.testng.Assert.*;
44
45 @Test
46 public class ContainerTest {
47
48 private static final String TEST_SRC = System.getProperty("test.src");
49
50 private static final Path SRC_DIR = Paths.get(TEST_SRC, "src");
51 private static final Path MODS_DIR = Paths.get("mods");
52
53 private static final Path MLIB_DIR = Paths.get("mlib");
54 private static final Path APPLIB_DIR = Paths.get("applib");
55
56 private static final String CONTAINER_MODULE = "container";
57 private static final String CONTAINER_MAIN_CLASS = "container.Main";
117 compiled = CompilerUtils.compile(SRC_DIR.resolve("app2"),
118 dir.resolve("app2"),
119 "-mp", dir.toString());
120 assertTrue(compiled);
121 }
122
123
124 @BeforeTest
125 public void setup() throws Exception {
126 buildContainer();
127 buildApp1();
128 buildApp2();
129 }
130
131 /**
132 * Launches the container
133 */
134 public void testContainer() throws Exception {
135
136 int exitValue
137 = executeTestJava("-mp", MLIB_DIR.toString(),
138 "-m", CONTAINER_MODULE)
139 .outputTo(System.out)
140 .errorTo(System.err)
141 .getExitValue();
142
143 assertTrue(exitValue == 0);
144 }
145
146 }
|
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 */
23
24 /**
25 * @test
26 * @library /lib/testlibrary
27 * @modules jdk.jartool/sun.tools.jar
28 * jdk.compiler
29 * @build ContainerTest CompilerUtils jdk.testlibrary.*
30 * @run testng ContainerTest
31 * @summary Starts a simple container that uses dynamic configurations
32 * and launches two applications in the same VM
33 */
34
35 import java.nio.file.Files;
36 import java.nio.file.Path;
37 import java.nio.file.Paths;
38 import java.util.Arrays;
39
40 import static jdk.testlibrary.ProcessTools.*;
41
42 import org.testng.annotations.BeforeTest;
43 import org.testng.annotations.Test;
44 import static org.testng.Assert.*;
45
46 @Test
47 public class ContainerTest {
48
49 private static final String TEST_SRC = System.getProperty("test.src");
50
51 private static final Path SRC_DIR = Paths.get(TEST_SRC, "src");
52 private static final Path MODS_DIR = Paths.get("mods");
53
54 private static final Path MLIB_DIR = Paths.get("mlib");
55 private static final Path APPLIB_DIR = Paths.get("applib");
56
57 private static final String CONTAINER_MODULE = "container";
58 private static final String CONTAINER_MAIN_CLASS = "container.Main";
118 compiled = CompilerUtils.compile(SRC_DIR.resolve("app2"),
119 dir.resolve("app2"),
120 "-mp", dir.toString());
121 assertTrue(compiled);
122 }
123
124
125 @BeforeTest
126 public void setup() throws Exception {
127 buildContainer();
128 buildApp1();
129 buildApp2();
130 }
131
132 /**
133 * Launches the container
134 */
135 public void testContainer() throws Exception {
136
137 int exitValue
138 = executeModularTest(CONTAINER_MODULE, null, null, null,
139 Arrays.asList(MLIB_DIR), null)
140 .getExitValue();
141
142 assertTrue(exitValue == 0);
143 }
144
145 }
|