1 /**
2 * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation.
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 * @bug 8169925
27 * @summary Validate the license files deduplicated in the image
28 * @library /lib/testlibrary
29 * @modules jdk.compiler
30 * jdk.jlink
31 * @build CompilerUtils
32 * @run testng LegalFilePluginTest
33 */
34
35 import java.io.BufferedWriter;
36 import java.io.File;
37 import java.io.IOException;
38 import java.io.PrintWriter;
39 import java.io.StringWriter;
40 import java.io.UncheckedIOException;
41 import java.nio.file.FileVisitResult;
42 import java.nio.file.Files;
43 import java.nio.file.Path;
44 import java.nio.file.Paths;
45 import java.nio.file.SimpleFileVisitor;
46 import java.nio.file.attribute.BasicFileAttributes;
47 import java.util.ArrayList;
48 import java.util.HashMap;
49 import java.util.HashSet;
50 import java.util.List;
51 import java.util.Map;
52 import java.util.Set;
53 import java.util.spi.ToolProvider;
54 import java.util.stream.Collectors;
55 import java.util.stream.Stream;
56
57 import org.testng.annotations.BeforeTest;
58 import org.testng.annotations.DataProvider;
59 import org.testng.annotations.Test;
60
61 import static org.testng.Assert.*;
62
63 public class LegalFilePluginTest {
64 static final ToolProvider JMOD_TOOL = ToolProvider.findFirst("jmod")
65 .orElseThrow(() ->
66 new RuntimeException("jmod tool not found")
67 );
68
69 static final ToolProvider JLINK_TOOL = ToolProvider.findFirst("jlink")
70 .orElseThrow(() ->
71 new RuntimeException("jlink tool not found")
72 );
73
74 static final Path MODULE_PATH = Paths.get(System.getProperty("java.home"), "jmods");
75 static final Path SRC_DIR = Paths.get("src");
|
1 /**
2 * Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation.
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 * @bug 8169925
27 * @summary Validate the license files deduplicated in the image
28 * @library /test/lib
29 * @modules jdk.compiler
30 * jdk.jlink
31 * @build jdk.test.lib.compiler.CompilerUtils
32 * @run testng LegalFilePluginTest
33 */
34
35 import java.io.BufferedWriter;
36 import java.io.File;
37 import java.io.IOException;
38 import java.io.PrintWriter;
39 import java.io.StringWriter;
40 import java.io.UncheckedIOException;
41 import java.nio.file.FileVisitResult;
42 import java.nio.file.Files;
43 import java.nio.file.Path;
44 import java.nio.file.Paths;
45 import java.nio.file.SimpleFileVisitor;
46 import java.nio.file.attribute.BasicFileAttributes;
47 import java.util.ArrayList;
48 import java.util.HashMap;
49 import java.util.HashSet;
50 import java.util.List;
51 import java.util.Map;
52 import java.util.Set;
53 import java.util.spi.ToolProvider;
54 import java.util.stream.Collectors;
55 import java.util.stream.Stream;
56 import jdk.test.lib.compiler.CompilerUtils;
57
58 import org.testng.annotations.BeforeTest;
59 import org.testng.annotations.DataProvider;
60 import org.testng.annotations.Test;
61
62 import static org.testng.Assert.*;
63
64 public class LegalFilePluginTest {
65 static final ToolProvider JMOD_TOOL = ToolProvider.findFirst("jmod")
66 .orElseThrow(() ->
67 new RuntimeException("jmod tool not found")
68 );
69
70 static final ToolProvider JLINK_TOOL = ToolProvider.findFirst("jlink")
71 .orElseThrow(() ->
72 new RuntimeException("jlink tool not found")
73 );
74
75 static final Path MODULE_PATH = Paths.get(System.getProperty("java.home"), "jmods");
76 static final Path SRC_DIR = Paths.get("src");
|