< prev index next >

test/tools/jlink/plugins/FileCopierPluginTest.java

Print this page




  96                 ResourcePoolEntry.Type.CLASS_OR_RESOURCE, getJavaBaseModuleInfo()));
  97         expected++;
  98         ResourcePool pool = plug.transform(
  99                 new ResourcePoolManager().resourcePool(),
 100                 poolMgr.resourcePoolBuilder());
 101         if (pool.entryCount() != expected) {
 102             throw new AssertionError("Wrong number of added files");
 103         }
 104         pool.entries().forEach(f -> {
 105             if (!f.type().equals(ResourcePoolEntry.Type.OTHER) &&
 106                 !f.type().equals(ResourcePoolEntry.Type.CLASS_OR_RESOURCE)) {
 107                 throw new AssertionError("Invalid type " + f.type()
 108                         + " for file " + f.path());
 109             }
 110             if (f.content() == null) {
 111                 throw new AssertionError("Null stream for file " + f.path());
 112             }
 113         });
 114         Path root = new File(".").toPath();
 115         DefaultImageBuilder imgbuilder = new DefaultImageBuilder(root);
 116         imgbuilder.storeFiles(pool);
 117 
 118         if (lic.exists()) {
 119             File license = new File(root.toFile(), "LICENSE.txt");
 120             if (!license.exists() || license.length() == 0) {
 121                 throw new AssertionError("Invalid license file "
 122                         + license.getAbsoluteFile());
 123             }
 124         }
 125 
 126         File sample1 = new File(root.toFile(), txt.getName());
 127         if (!sample1.exists() || sample1.length() == 0) {
 128             throw new AssertionError("Invalide sample1 file "
 129                     + sample1.getAbsoluteFile());
 130         }
 131         if (!new String(Files.readAllBytes(sample1.toPath())).equals(content)) {
 132             throw new AssertionError("Invalid Content in sample1");
 133         }
 134 
 135         File sample2 = new File(root.toFile(), target);
 136         if (!sample2.exists() || sample2.length() == 0) {




  96                 ResourcePoolEntry.Type.CLASS_OR_RESOURCE, getJavaBaseModuleInfo()));
  97         expected++;
  98         ResourcePool pool = plug.transform(
  99                 new ResourcePoolManager().resourcePool(),
 100                 poolMgr.resourcePoolBuilder());
 101         if (pool.entryCount() != expected) {
 102             throw new AssertionError("Wrong number of added files");
 103         }
 104         pool.entries().forEach(f -> {
 105             if (!f.type().equals(ResourcePoolEntry.Type.OTHER) &&
 106                 !f.type().equals(ResourcePoolEntry.Type.CLASS_OR_RESOURCE)) {
 107                 throw new AssertionError("Invalid type " + f.type()
 108                         + " for file " + f.path());
 109             }
 110             if (f.content() == null) {
 111                 throw new AssertionError("Null stream for file " + f.path());
 112             }
 113         });
 114         Path root = new File(".").toPath();
 115         DefaultImageBuilder imgbuilder = new DefaultImageBuilder(root);
 116         imgbuilder.storeFiles(Collections.emptySet(), pool);
 117 
 118         if (lic.exists()) {
 119             File license = new File(root.toFile(), "LICENSE.txt");
 120             if (!license.exists() || license.length() == 0) {
 121                 throw new AssertionError("Invalid license file "
 122                         + license.getAbsoluteFile());
 123             }
 124         }
 125 
 126         File sample1 = new File(root.toFile(), txt.getName());
 127         if (!sample1.exists() || sample1.length() == 0) {
 128             throw new AssertionError("Invalide sample1 file "
 129                     + sample1.getAbsoluteFile());
 130         }
 131         if (!new String(Files.readAllBytes(sample1.toPath())).equals(content)) {
 132             throw new AssertionError("Invalid Content in sample1");
 133         }
 134 
 135         File sample2 = new File(root.toFile(), target);
 136         if (!sample2.exists() || sample2.length() == 0) {


< prev index next >