コード例 #1
0
ファイル: MuJavaController.java プロジェクト: mffrias/TACO
 /**
  * Used in case the EXTRA_CHECK flag is on. In cases were two hashes are equal this method is
  * called so as to assure that it is not a false duplicate (equal hash but different file).
  * Returns true if files are equal or false if otherwise.
  */
 private boolean isFalseDuplicate(String originalFileName, File tempFile)
     throws IllegalStateException {
   File original = new File(originalFileName);
   try {
     if (!Files.equal(original, tempFile)) {
       log.error("FALSE DUPICATE");
       log.error("Original:" + original.getAbsolutePath());
       log.error("False duplicate:" + tempFile.getAbsolutePath());
       return true;
     }
     return false;
   } catch (IOException e) {
     return false;
     //			throw new IllegalStateException(
     //					"An error occured while opening files " + originalFileName
     //							+ " and " + tempFile.getName());
   }
 }
コード例 #2
0
 @Test
 public void createsPackageWithWarFromFilenameAndDefaultVersion() throws IOException {
   WarImporter importer = new WarImporter("(.+)", "1.0", false, null);
   FileSource source = new FileSource(WAR_WITH_MANIFEST);
   PackageInfo packageInfo = importer.preparePackage(source, DUMMY_IMPORT_CTX);
   // from the filename
   assertEquals("war-with-manifest.war", packageInfo.getApplicationName());
   assertEquals("1.0", packageInfo.getApplicationVersion());
   List<Deployable> deployables =
       importer.importEntities(packageInfo, DUMMY_IMPORT_CTX).getDeployables();
   assertEquals(1, deployables.size());
   assertTrue(format("Expected instance of %s", War.class), deployables.get(0) instanceof War);
   War War = (War) deployables.get(0);
   assertTrue(
       "Expected the files to contain the same bytes",
       Files.equal(source.getFile(), ((LocalFile) War.getFile()).getFile()));
   assertEquals("Applications/war-with-manifest.war/1.0/war-with-manifest.war", War.getId());
   assertEquals("war-with-manifest.war", War.getName());
 }