80 81 JarUtils.createJarFile( 82 Paths.get(CLIENT_JAR), 83 Paths.get(CLIENT_EXP)); 84 85 assertTrue(CompilerUtils.compile(Paths.get(TEST_SRC, "src", "mtest"), 86 Paths.get(MTEST_EXP), 87 "-cp", pathJoin(CLIENT_JAR, SERVER_JAR))); 88 89 JarUtils.createJarFile( 90 Paths.get(MTEST_JAR), 91 Paths.get(MTEST_EXP)); 92 } 93 94 /** 95 * Test the client, server and dummy application in different modules 96 * @throws Exception 97 */ 98 @Test 99 public void testAllInModule() throws Exception { 100 assertEquals(executeTestJava("-mp", pathJoin(MTEST_JAR, CLIENT_JAR, SERVER_JAR), 101 "-addmods", "mclient,mserver", 102 "-m", "mtest/" + DUMMY_MAIN) 103 .outputTo(System.out) 104 .errorTo(System.out) 105 .getExitValue(), 106 0); 107 } 108 109 /** 110 * Test the client and server in unnamed modules, 111 * while the dummy application is in automatic module 112 * @throws Exception 113 */ 114 @Test 115 public void testAppInModule() throws Exception { 116 assertEquals(executeTestJava("-mp", MTEST_JAR, 117 "-cp", pathJoin(CLIENT_JAR, SERVER_JAR), 118 "-m", "mtest/" + DUMMY_MAIN) 119 .outputTo(System.out) 120 .errorTo(System.out) 121 .getExitValue(), 122 0); 123 } 124 125 /** 126 * Test the client and server in automatic modules, 127 * while the dummy application is in unnamed module 128 * @throws Exception 129 */ 130 @Test 131 public void testAppInUnnamedModule() throws Exception { 132 assertEquals(executeTestJava("-mp", pathJoin(CLIENT_JAR, SERVER_JAR), 133 "-addmods", "mclient,mserver", 134 "-cp", MTEST_JAR, 135 DUMMY_MAIN) 136 .outputTo(System.out) 137 .errorTo(System.out) 138 .getExitValue(), 139 0); 140 } 141 142 /** 143 * Test the server and test application in automatic modules, 144 * with client in unnamed module 145 * @throws Exception 146 */ 147 @Test 148 public void testClientInUnamedModule() throws Exception { 149 assertEquals(executeTestJava("-mp", pathJoin(MTEST_JAR, SERVER_JAR), 150 "-addmods", "mserver", 151 "-cp", CLIENT_JAR, 152 "-m", "mtest/" + DUMMY_MAIN) 153 .outputTo(System.out) 154 .errorTo(System.out) 155 .getExitValue(), 156 0); 157 } 158 } 159 | 80 81 JarUtils.createJarFile( 82 Paths.get(CLIENT_JAR), 83 Paths.get(CLIENT_EXP)); 84 85 assertTrue(CompilerUtils.compile(Paths.get(TEST_SRC, "src", "mtest"), 86 Paths.get(MTEST_EXP), 87 "-cp", pathJoin(CLIENT_JAR, SERVER_JAR))); 88 89 JarUtils.createJarFile( 90 Paths.get(MTEST_JAR), 91 Paths.get(MTEST_EXP)); 92 } 93 94 /** 95 * Test the client, server and dummy application in different modules 96 * @throws Exception 97 */ 98 @Test 99 public void testAllInModule() throws Exception { 100 assertEquals(executeTestJava("--module-path", pathJoin(MTEST_JAR, CLIENT_JAR, SERVER_JAR), 101 "--add-modules", "mclient,mserver", 102 "-m", "mtest/" + DUMMY_MAIN) 103 .outputTo(System.out) 104 .errorTo(System.out) 105 .getExitValue(), 106 0); 107 } 108 109 /** 110 * Test the client and server in unnamed modules, 111 * while the dummy application is in automatic module 112 * @throws Exception 113 */ 114 @Test 115 public void testAppInModule() throws Exception { 116 assertEquals(executeTestJava("--module-path", MTEST_JAR, 117 "-cp", pathJoin(CLIENT_JAR, SERVER_JAR), 118 "-m", "mtest/" + DUMMY_MAIN) 119 .outputTo(System.out) 120 .errorTo(System.out) 121 .getExitValue(), 122 0); 123 } 124 125 /** 126 * Test the client and server in automatic modules, 127 * while the dummy application is in unnamed module 128 * @throws Exception 129 */ 130 @Test 131 public void testAppInUnnamedModule() throws Exception { 132 assertEquals(executeTestJava("--module-path", pathJoin(CLIENT_JAR, SERVER_JAR), 133 "--add-modules", "mclient,mserver", 134 "-cp", MTEST_JAR, 135 DUMMY_MAIN) 136 .outputTo(System.out) 137 .errorTo(System.out) 138 .getExitValue(), 139 0); 140 } 141 142 /** 143 * Test the server and test application in automatic modules, 144 * with client in unnamed module 145 * @throws Exception 146 */ 147 @Test 148 public void testClientInUnamedModule() throws Exception { 149 assertEquals(executeTestJava("--module-path", pathJoin(MTEST_JAR, SERVER_JAR), 150 "--add-modules", "mserver", 151 "-cp", CLIENT_JAR, 152 "-m", "mtest/" + DUMMY_MAIN) 153 .outputTo(System.out) 154 .errorTo(System.out) 155 .getExitValue(), 156 0); 157 } 158 } 159 |