equal
deleted
inserted
replaced
46 import jdk.tools.jlink.internal.plugins.asm.AsmGlobalPool; |
46 import jdk.tools.jlink.internal.plugins.asm.AsmGlobalPool; |
47 import jdk.tools.jlink.internal.plugins.asm.AsmModulePool; |
47 import jdk.tools.jlink.internal.plugins.asm.AsmModulePool; |
48 import jdk.tools.jlink.internal.plugins.asm.AsmPool.ResourceFile; |
48 import jdk.tools.jlink.internal.plugins.asm.AsmPool.ResourceFile; |
49 import jdk.tools.jlink.internal.plugins.asm.AsmPool.WritableResourcePool; |
49 import jdk.tools.jlink.internal.plugins.asm.AsmPool.WritableResourcePool; |
50 import jdk.tools.jlink.plugin.PluginException; |
50 import jdk.tools.jlink.plugin.PluginException; |
51 import jdk.tools.jlink.plugin.Pool; |
51 import jdk.tools.jlink.plugin.ModuleEntry; |
52 import jdk.tools.jlink.plugin.Pool.ModuleData; |
52 import jdk.tools.jlink.plugin.ModulePool; |
53 |
53 |
54 public class PackageMappingTest extends AsmPluginTestBase { |
54 public class PackageMappingTest extends AsmPluginTestBase { |
55 |
55 |
56 private final List<String> newFiles = Arrays.asList( |
56 private final List<String> newFiles = Arrays.asList( |
57 "/java.base/a1/bbb/c", |
57 "/java.base/a1/bbb/c", |
70 TestPlugin[] plugins = new TestPlugin[]{ |
70 TestPlugin[] plugins = new TestPlugin[]{ |
71 new PackageMappingPlugin(newFiles, false), |
71 new PackageMappingPlugin(newFiles, false), |
72 new PackageMappingPlugin(newFiles, true) |
72 new PackageMappingPlugin(newFiles, true) |
73 }; |
73 }; |
74 for (TestPlugin p : plugins) { |
74 for (TestPlugin p : plugins) { |
75 Pool pool = p.visit(getPool()); |
75 ModulePool pool = p.visit(getPool()); |
76 p.test(getPool(), pool); |
76 p.test(getPool(), pool); |
77 } |
77 } |
78 } |
78 } |
79 |
79 |
80 public class PackageMappingPlugin extends TestPlugin { |
80 public class PackageMappingPlugin extends TestPlugin { |
103 testMapPackageTwice(); |
103 testMapPackageTwice(); |
104 testPackageMapping(); |
104 testPackageMapping(); |
105 } |
105 } |
106 |
106 |
107 @Override |
107 @Override |
108 public void test(Pool inResources, Pool outResources) { |
108 public void test(ModulePool inResources, ModulePool outResources) { |
109 Set<String> in = getPools().getGlobalPool().getResourceFiles().stream() |
109 Set<String> in = getPools().getGlobalPool().getResourceFiles().stream() |
110 .map(ModuleData::getPath) |
110 .map(ModuleEntry::getPath) |
111 .collect(Collectors.toSet()); |
111 .collect(Collectors.toSet()); |
112 Set<String> out = extractResources(outResources).stream() |
112 Set<String> out = extractResources(outResources).stream() |
113 .map(ModuleData::getPath) |
113 .map(ModuleEntry::getPath) |
114 .collect(Collectors.toSet()); |
114 .collect(Collectors.toSet()); |
115 in.addAll(PackageMappingTest.this.newFiles); |
115 in.addAll(PackageMappingTest.this.newFiles); |
116 if (!Objects.equals(in, out)) { |
116 if (!Objects.equals(in, out)) { |
117 throw new AssertionError("Expected: " + in + ", got: " + outResources); |
117 throw new AssertionError("Expected: " + in + ", got: " + outResources); |
118 } |
118 } |