Ejemplo n.º 1
0
  /**
   * Checks if the file paths in the md5sums file use only unix file separators (this test can only
   * fail on Windows)
   */
  public void testBuildDataWithFileSet() throws Exception {
    Processor processor =
        new Processor(
            new Console() {
              public void println(String s) {}
            },
            null);

    Project project = new Project();
    project.setCoreLoader(getClass().getClassLoader());
    project.init();

    FileSet fileset = new FileSet();
    fileset.setDir(new File(getClass().getResource("deb/data").toURI()));
    fileset.setIncludes("**/*");
    fileset.setProject(project);

    StringBuffer md5s = new StringBuffer();
    processor.buildData(
        new DataProducer[] {new FileSetDataProducer(fileset)},
        new File("target/data.tar"),
        md5s,
        "tar");

    assertTrue("empty md5 file", md5s.length() > 0);
    assertFalse("windows path separator found", md5s.indexOf("\\") != -1);
  }