Package org.syncany.database.FileVersionComparator

Examples of org.syncany.database.FileVersionComparator.FileProperties


    else if (EnvironmentUtil.isUnixLikeOperatingSystem()) {
      Files.setPosixFilePermissions(somefilePath, PosixFilePermissions.fromString("rw-rw-r-x"));
    }
   
    // Run
    FileProperties fileProperties = versionComparator.captureFileProperties(somefile, null, true);
   
    // Test
    assertNotNull(fileProperties.getChecksum());
    assertEquals(1382196000, fileProperties.getLastModified());
    assertEquals("somefile", fileProperties.getRelativePath());
    assertEquals(100*1024, fileProperties.getSize());
    assertNull(fileProperties.getLinkTarget());
    assertTrue(fileProperties.exists());
    assertEquals(FileType.FILE, fileProperties.getType());

    if (EnvironmentUtil.isWindows()) {
      DosFileAttributes dosFileAttributes = FileUtil.dosAttrsFromString(fileProperties.getDosAttributes());
     
      assertFalse(dosFileAttributes.isArchive());
      assertFalse(dosFileAttributes.isHidden());
      assertFalse(dosFileAttributes.isReadOnly());
      assertFalse(dosFileAttributes.isSystem());
     
      assertNull(fileProperties.getPosixPermissions());
    }
    else if (EnvironmentUtil.isUnixLikeOperatingSystem()) {
      assertEquals("rw-rw-r-x", fileProperties.getPosixPermissions());
      assertNull(fileProperties.getDosAttributes());
   
   
    // Tear down
    TestConfigUtil.deleteTestLocalConfigAndData(config);
  }
View Full Code Here


    else if (EnvironmentUtil.isUnixLikeOperatingSystem()) {
      fileVersion.setPosixPermissions("rw-rw-r-x");
    }
   
    // Run
    FileProperties fileProperties = versionComparator.captureFileProperties(fileVersion);
   
    // Test
    assertEquals(new FileChecksum(new byte[] { 0x11, 0x22, 0x33 }), fileProperties.getChecksum());
    assertEquals(123456789, fileProperties.getLastModified());
    assertEquals("folder/file", fileProperties.getRelativePath());
    assertEquals(999*1024, fileProperties.getSize());
    assertNull(fileProperties.getLinkTarget());
    assertTrue(fileProperties.exists());
    assertEquals(FileType.FILE, fileProperties.getType());

    if (EnvironmentUtil.isWindows()) {
      DosFileAttributes dosFileAttributes = FileUtil.dosAttrsFromString(fileProperties.getDosAttributes());
     
      assertTrue(dosFileAttributes.isArchive());
      assertTrue(dosFileAttributes.isHidden());
      assertTrue(dosFileAttributes.isReadOnly());
      assertFalse(dosFileAttributes.isSystem());
     
      assertNull(fileProperties.getPosixPermissions());
    }
    else if (EnvironmentUtil.isUnixLikeOperatingSystem()) {
      assertEquals("rw-rw-r-x", fileProperties.getPosixPermissions());
      assertNull(fileProperties.getDosAttributes());
   
   
    // Tear down
    TestConfigUtil.deleteTestLocalConfigAndData(config);
  }
View Full Code Here

    byte[] expectedFileChecksum = TestFileUtil.createChecksum(expectedFile);
    byte[] actualFileChecksum = TestFileUtil.createChecksum(actualFile);
   
    assertArrayEquals("Files are not equal: Actual file checksum ("+StringUtil.toHex(actualFileChecksum)+") and expected file checksum ("+StringUtil.toHex(expectedFileChecksum)+") do not match.", expectedFileChecksum, actualFileChecksum);
   
    FileProperties actualFileProperties = fileVersionComparator.captureFileProperties(actualFile, null, true);
    FileProperties expectedFileProperties = fileVersionComparator.captureFileProperties(expectedFile, null, true);
   
    FileVersionComparison fileVersionComparison = fileVersionComparator.compare(expectedFileProperties, actualFileProperties, true);
   
    List<FileChange> allowedChangesList = new ArrayList<FileChange>(Arrays.asList(allowedChanges));
    allowedChangesList.add(FileChange.CHANGED_PATH);
View Full Code Here

      // 2. Create new file history/version
      PartialFileHistory fileHistory = createNewFileHistory(lastFileHistory);
      FileVersion fileVersion = createNewFileVersion(lastFileVersion, fileProperties);

      // 3. Compare new and last version
      FileProperties lastFileVersionProperties = fileVersionComparator.captureFileProperties(lastFileVersion);
      FileVersionComparison lastToNewFileVersionComparison = fileVersionComparator.compare(fileProperties, lastFileVersionProperties, true);

      boolean newVersionDiffersFromToLastVersion = !lastToNewFileVersionComparison.equals();

      if (newVersionDiffersFromToLastVersion) {
View Full Code Here

TOP

Related Classes of org.syncany.database.FileVersionComparator.FileProperties

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.