< prev index next >

test/tools/jlink/plugins/FileCopierPluginTest.java

Print this page




  84 
  85         Map<String, String> conf = new HashMap<>();
  86         conf.put(FileCopierPlugin.NAME, builder.toString());
  87         plug.configure(conf);
  88         Pool pool = new PoolImpl();
  89         plug.visit(new PoolImpl(), pool);
  90         if (pool.getContent().size() != expected) {
  91             throw new AssertionError("Wrong number of added files");
  92         }
  93         for (ModuleData f : pool.getContent()) {
  94             if (!f.getType().equals(ModuleDataType.OTHER)) {
  95                 throw new AssertionError("Invalid type " + f.getType()
  96                         + " for file " + f.getPath());
  97             }
  98             if (f.stream() == null) {
  99                 throw new AssertionError("Null stream for file " + f.getPath());
 100             }
 101 
 102         }
 103         Path root = new File(".").toPath();
 104         DefaultImageBuilder imgbuilder = new DefaultImageBuilder(false,
 105                 root);
 106         imgbuilder.storeFiles(pool, "");
 107 
 108         if (lic.exists()) {
 109             File license = new File(root.toFile(), "LICENSE");
 110             if (!license.exists() || license.length() == 0) {
 111                 throw new AssertionError("Invalide license file "
 112                         + license.getAbsoluteFile());
 113             }
 114         }
 115 
 116         File sample1 = new File(root.toFile(), txt.getName());
 117         if (!sample1.exists() || sample1.length() == 0) {
 118             throw new AssertionError("Invalide sample1 file "
 119                     + sample1.getAbsoluteFile());
 120         }
 121         if (!new String(Files.readAllBytes(sample1.toPath())).equals(content)) {
 122             throw new AssertionError("Invalid Content in sample1");
 123         }
 124 
 125         File sample2 = new File(root.toFile(), target);
 126         if (!sample2.exists() || sample2.length() == 0) {




  84 
  85         Map<String, String> conf = new HashMap<>();
  86         conf.put(FileCopierPlugin.NAME, builder.toString());
  87         plug.configure(conf);
  88         Pool pool = new PoolImpl();
  89         plug.visit(new PoolImpl(), pool);
  90         if (pool.getContent().size() != expected) {
  91             throw new AssertionError("Wrong number of added files");
  92         }
  93         for (ModuleData f : pool.getContent()) {
  94             if (!f.getType().equals(ModuleDataType.OTHER)) {
  95                 throw new AssertionError("Invalid type " + f.getType()
  96                         + " for file " + f.getPath());
  97             }
  98             if (f.stream() == null) {
  99                 throw new AssertionError("Null stream for file " + f.getPath());
 100             }
 101 
 102         }
 103         Path root = new File(".").toPath();
 104         DefaultImageBuilder imgbuilder = new DefaultImageBuilder(root);
 105         imgbuilder.storeFiles(pool);

 106 
 107         if (lic.exists()) {
 108             File license = new File(root.toFile(), "LICENSE");
 109             if (!license.exists() || license.length() == 0) {
 110                 throw new AssertionError("Invalide license file "
 111                         + license.getAbsoluteFile());
 112             }
 113         }
 114 
 115         File sample1 = new File(root.toFile(), txt.getName());
 116         if (!sample1.exists() || sample1.length() == 0) {
 117             throw new AssertionError("Invalide sample1 file "
 118                     + sample1.getAbsoluteFile());
 119         }
 120         if (!new String(Files.readAllBytes(sample1.toPath())).equals(content)) {
 121             throw new AssertionError("Invalid Content in sample1");
 122         }
 123 
 124         File sample2 = new File(root.toFile(), target);
 125         if (!sample2.exists() || sample2.length() == 0) {


< prev index next >