private void compareBinaryFolder(String path, boolean res) throws BrutException, IOException {

    String tmp = "";
    if (res) {
      tmp = File.separatorChar + "res" + File.separatorChar;
    }

    Files.walkFileTree(
        Paths.get(sTestOrigDir.toPath() + tmp + path),
        new SimpleFileVisitor<Path>() {

          @Override
          public FileVisitResult visitFile(Path file, BasicFileAttributes attrs)
              throws IOException {

            // hacky fix - load test by changing name of control
            File control = file.toFile();
            File test = new File(file.toString().replace("testapp-orig", "testapp-new"));

            if (test.isFile()) {
              if (control.hashCode() != test.hashCode()) {
                sResult = false;
                return FileVisitResult.TERMINATE;
              }
            } else {
              sResult = false;
              return FileVisitResult.TERMINATE;
            }
            return FileVisitResult.CONTINUE;
          }
        });
  }
예제 #2
0
 @Parameters
 public static List<Object[]> data() {
   List<Object[]> params = new ArrayList<Object[]>();
   for (boolean singleThreaded : new boolean[] {true, false}) {
     for (boolean heapAllocated : new boolean[] {true, false}) {
       for (boolean saveIndex : new boolean[] {true, false}) {
         File dir = Files.createTempDir();
         HashStoreConfig config =
             new HashStoreConfig(dir)
                 .indexInitialCapacity(32)
                 .segmentSize(50)
                 .checkCrcs(true)
                 .heapAllocateIndex(heapAllocated)
                 .singleThreaded(singleThreaded)
                 .segmentDeletionDelay(0, TimeUnit.MILLISECONDS)
                 .saveIndexOnClose(saveIndex);
         params.add(new Object[] {config});
       }
     }
   }
   return params;
 }