8 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
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 * @summary Test Multi-Release jar support in schemagen tool
27 * @library /test/lib
28 * @library /lib/testlibrary
29 * @modules jdk.compiler java.xml.ws
30 * @build jdk.test.lib.JDKToolFinder jdk.test.lib.JDKToolLauncher
31 * jdk.test.lib.process.OutputAnalyzer
32 * jdk.test.lib.process.ProcessTools
33 * jdk.test.lib.Utils
34 * CompilerUtils MultiReleaseJarTest
35 * @run testng MultiReleaseJarTest
36 */
37
38 import jdk.test.lib.JDKToolLauncher;
39 import jdk.test.lib.Utils;
40 import jdk.test.lib.process.OutputAnalyzer;
41 import jdk.test.lib.process.ProcessTools;
42 import org.testng.annotations.BeforeClass;
43 import org.testng.annotations.DataProvider;
44 import org.testng.annotations.Test;
45
46 import java.io.IOException;
47 import java.nio.file.Files;
48 import java.nio.file.Path;
49 import java.nio.file.Paths;
50 import java.util.stream.Stream;
51
52 import static org.testng.Assert.assertTrue;
53
54 public class MultiReleaseJarTest {
55 private static final int SUCCESS = 0;
56
57 @DataProvider(name = "jarFiles")
58 public Object[][] jarFiles() {
59 return new Object[][]{{"MV_BOTH.jar", 9},
98 return new String(Files.readAllBytes(file)).contains(pattern);
99 }
100
101 private OutputAnalyzer jar(String... args) throws Throwable {
102 JDKToolLauncher launcher = JDKToolLauncher.createUsingTestJDK("jar");
103 Stream.of(args).forEach(launcher::addToolArg);
104 return ProcessTools.executeCommand(launcher.getCommand());
105 }
106
107 private void compile() throws Throwable {
108 String[] vers = {"base", "v9", "v10"};
109 for (String ver : vers) {
110 Path classes = Paths.get("classes", ver);
111 Files.createDirectories(classes);
112 Path source = Paths.get(Utils.TEST_SRC,"data", "mr", ver);
113 assertTrue(CompilerUtils.compile(source, classes,
114 "--add-modules", "java.xml.ws"));
115 }
116 }
117 }
|
8 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
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 * @summary Test Multi-Release jar support in schemagen tool
27 * @library /test/lib
28 * @modules jdk.compiler java.xml.ws
29 * @build jdk.test.lib.JDKToolFinder jdk.test.lib.JDKToolLauncher
30 * jdk.test.lib.process.OutputAnalyzer
31 * jdk.test.lib.process.ProcessTools
32 * jdk.test.lib.Utils
33 * jdk.test.lib.compiler.CompilerUtils MultiReleaseJarTest
34 * @run testng MultiReleaseJarTest
35 */
36
37 import jdk.test.lib.JDKToolLauncher;
38 import jdk.test.lib.Utils;
39 import jdk.test.lib.compiler.CompilerUtils;
40 import jdk.test.lib.process.OutputAnalyzer;
41 import jdk.test.lib.process.ProcessTools;
42 import org.testng.annotations.BeforeClass;
43 import org.testng.annotations.DataProvider;
44 import org.testng.annotations.Test;
45
46 import java.io.IOException;
47 import java.nio.file.Files;
48 import java.nio.file.Path;
49 import java.nio.file.Paths;
50 import java.util.stream.Stream;
51
52 import static org.testng.Assert.assertTrue;
53
54 public class MultiReleaseJarTest {
55 private static final int SUCCESS = 0;
56
57 @DataProvider(name = "jarFiles")
58 public Object[][] jarFiles() {
59 return new Object[][]{{"MV_BOTH.jar", 9},
98 return new String(Files.readAllBytes(file)).contains(pattern);
99 }
100
101 private OutputAnalyzer jar(String... args) throws Throwable {
102 JDKToolLauncher launcher = JDKToolLauncher.createUsingTestJDK("jar");
103 Stream.of(args).forEach(launcher::addToolArg);
104 return ProcessTools.executeCommand(launcher.getCommand());
105 }
106
107 private void compile() throws Throwable {
108 String[] vers = {"base", "v9", "v10"};
109 for (String ver : vers) {
110 Path classes = Paths.get("classes", ver);
111 Files.createDirectories(classes);
112 Path source = Paths.get(Utils.TEST_SRC,"data", "mr", ver);
113 assertTrue(CompilerUtils.compile(source, classes,
114 "--add-modules", "java.xml.ws"));
115 }
116 }
117 }
118
|