Examples of FileVersion


Examples of org.hyperic.sigar.win32.FileVersion

        sb.append(val);
        println(sb.toString());
    }

    public void output(String exe) throws SigarException {
        FileVersion info = Win32.getFileVersion(exe);
        if (info == null) {
            return;
        }
        println("Version info for file '" + exe + "':");
        output("FileVersion", info.getFileVersion());
        output("ProductVersion", info.getProductVersion());
        for (Iterator it = info.getInfo().entrySet().iterator();
             it.hasNext();)
        {
            Map.Entry entry = (Map.Entry)it.next();
            output((String)entry.getKey(), (String)entry.getValue());
        }
View Full Code Here

Examples of org.syncany.database.FileVersion

    newDatabaseVersionHeader.setVectorClock(TestDatabaseUtil.createVectorClock("A5,C1"));
   
    newDatabaseVersion.setHeader(newDatabaseVersionHeader);
   
    PartialFileHistory newFileHistory = new PartialFileHistory(FileHistoryId.secureRandomFileId());
    FileVersion newFileVersion = new FileVersion();
   
    newFileVersion.setVersion(1L);
    newFileVersion.setPath("newfile");
    newFileVersion.setChecksum(FileChecksum.parseFileChecksum("aaaaaaaaaaaaaaaaaaaaab2b263ffa4cc48e282f"));
    newFileVersion.setLinkTarget(null);
    newFileVersion.setPosixPermissions("rwxrwxrwx");
    newFileVersion.setDosAttributes(null);
    newFileVersion.setStatus(FileStatus.NEW);
    newFileVersion.setLastModified(new Date());
    newFileVersion.setUpdated(new Date());
    newFileVersion.setSize(1L);
    newFileVersion.setType(FileType.FILE);

    newFileHistory.addFileVersion(newFileVersion);
    newDatabaseVersion.addFileHistory(newFileHistory);

    ChunkEntry newChunkEntry = new ChunkEntry(ChunkChecksum.parseChunkChecksum("aaaaaaaaaaaaaaaaaaaaab2b263ffa4cc48e282f"), 1);
View Full Code Here

Examples of org.syncany.database.FileVersion

  public void testCaptureFilePropertiesFromFileVersion() throws Exception {
    // Setup
    Config config = TestConfigUtil.createTestLocalConfig();
    FileVersionComparator versionComparator = new FileVersionComparator(config.getLocalDir(), config.getChunker().getChecksumAlgorithm());
   
    FileVersion fileVersion = new FileVersion();
    fileVersion.setVersion(3L);

    fileVersion.setChecksum(new FileChecksum(new byte[] { 0x11, 0x22, 0x33 }));
    fileVersion.setLastModified(new Date(123456789));
    fileVersion.setPath("folder/file");
    fileVersion.setSize(999*1024L);
    fileVersion.setLinkTarget(null);
    fileVersion.setStatus(FileStatus.CHANGED);
    fileVersion.setType(FileType.FILE);
   
    if (EnvironmentUtil.isWindows()) {
      fileVersion.setDosAttributes("rha-");
    }
    else if (EnvironmentUtil.isUnixLikeOperatingSystem()) {
      fileVersion.setPosixPermissions("rw-rw-r-x");
    }
   
    // Run
    FileProperties fileProperties = versionComparator.captureFileProperties(fileVersion);
   
View Full Code Here

Examples of org.syncany.database.FileVersion

    else if (EnvironmentUtil.isUnixLikeOperatingSystem()) {
      Files.setPosixFilePermissions(somefilePath, PosixFilePermissions.fromString("r--rwxrw-"));
    }
   
    // Create FileVersion
    FileVersion fileVersion = new FileVersion();
    fileVersion.setVersion(100L);

    fileVersion.setChecksum(new FileChecksum(new byte[] { 0x11, 0x22, 0x33 })); // << definitely differs
    fileVersion.setLastModified(new Date(1182196000));
    fileVersion.setPath("file1");
    fileVersion.setSize(130*1024L);
    fileVersion.setLinkTarget(null);
    fileVersion.setStatus(FileStatus.NEW);
    fileVersion.setType(FileType.FILE);
   
    if (EnvironmentUtil.isWindows()) {
      fileVersion.setDosAttributes("r-a-");
    }
    else if (EnvironmentUtil.isUnixLikeOperatingSystem()) {
      fileVersion.setPosixPermissions("r--rwxrw-");
    }
   
    // Run
    FileVersionComparison fileComparison = versionComparator.compare(fileVersion, somefile, null, true);
   
View Full Code Here

Examples of org.syncany.database.FileVersion

  protected Map<FileHistoryId, PartialFileHistory> createFileHistoriesFromResult(ResultSet resultSet) throws SQLException {
    Map<FileHistoryId, PartialFileHistory> fileHistories = new HashMap<FileHistoryId, PartialFileHistory>();;
    PartialFileHistory fileHistory = null;

    while (resultSet.next()) {
      FileVersion lastFileVersion = fileVersionDao.createFileVersionFromRow(resultSet);
      FileHistoryId fileHistoryId = FileHistoryId.parseFileId(resultSet.getString("filehistory_id"));
     
      // Old history (= same filehistory identifier)
      if (fileHistory != null && fileHistory.getFileHistoryId().equals(fileHistoryId)) { // Same history!
        fileHistory.addFileVersion(lastFileVersion);
View Full Code Here

Examples of org.syncany.database.FileVersion

    try (PreparedStatement preparedStatement = getStatement("filehistory.select.master.getFileHistoriesWithLastVersion.sql")) {
      try (ResultSet resultSet = preparedStatement.executeQuery()) {
        while (resultSet.next()) {
          FileHistoryId fileHistoryId = FileHistoryId.parseFileId(resultSet.getString("filehistory_id"));
          FileVersion lastFileVersion = fileVersionDao.createFileVersionFromRow(resultSet);
 
          PartialFileHistory fileHistory = new PartialFileHistory(fileHistoryId);
          fileHistory.addFileVersion(lastFileVersion);
 
          fileHistories.add(fileHistory);
View Full Code Here

Examples of org.syncany.database.FileVersion

      try (ResultSet resultSet = preparedStatement.executeQuery()) {
        while (resultSet.next()) {
          FileHistoryId purgeFileHistoryId = FileHistoryId.parseFileId(resultSet.getString("filehistory_id"));
         
          // Create max purge version with dummy values (mandatory for XML serialization)
          FileVersion maxPurgeFileVersion = new FileVersion();
         
          maxPurgeFileVersion.setFileHistoryId(purgeFileHistoryId);
          maxPurgeFileVersion.setVersion(resultSet.getLong("fileversion_maxpurgeversion"));
         
          maxPurgeFileVersion.setPath("");
          maxPurgeFileVersion.setType(FileType.FILE);
          maxPurgeFileVersion.setStatus(FileStatus.DELETED);
          maxPurgeFileVersion.setSize(0L);
          maxPurgeFileVersion.setLastModified(new Date());
 
          PartialFileHistory fileHistory = new PartialFileHistory(purgeFileHistoryId);
          fileHistory.addFileVersion(maxPurgeFileVersion);
 
          fileHistories.add(fileHistory);
View Full Code Here

Examples of org.syncany.database.FileVersion

   
    // - Create new version (delete folder)
    TestSqlDatabase sqlDatabaseA = new TestSqlDatabase(testConfigA);
    PartialFileHistory folderFileHistoryWithLastVersion = sqlDatabaseA.getFileHistoryWithLastVersion("new folder/some subfolder");

    FileVersion deletedFolderVersion = folderFileHistoryWithLastVersion.getLastVersion().clone();
    deletedFolderVersion.setStatus(FileStatus.DELETED);
    deletedFolderVersion.setVersion(deletedFolderVersion.getVersion()+1);
   
    PartialFileHistory deletedFolderVersionHistory = new PartialFileHistory(folderFileHistoryWithLastVersion.getFileHistoryId());
    deletedFolderVersionHistory.addFileVersion(deletedFolderVersion);
   
    DatabaseVersion winnersDatabaseVersion = TestDatabaseUtil.createDatabaseVersion(sqlDatabaseA.getLastDatabaseVersionHeader());   
View Full Code Here

Examples of org.syncany.database.FileVersion

  }
 
  @Test(expected = IllegalArgumentException.class)
  public void testFileHistoryAddFileVersionInvalidVersionNull() {
    PartialFileHistory fileHistory = new PartialFileHistory(FileHistoryId.parseFileId("1234"));
    fileHistory.addFileVersion(new FileVersion());
  }
View Full Code Here

Examples of org.syncany.database.FileVersion

    fileHistory.addFileVersion(new FileVersion());
  }
 
  @Test
  public void testFileHistoryGetVersionsNonEmpty() {
    FileVersion fileVersion = new FileVersion();
    fileVersion.setVersion(5L);
    fileVersion.setPath("/somepath");
   
    PartialFileHistory fileHistory = new PartialFileHistory(FileHistoryId.parseFileId("1234"));
    fileHistory.addFileVersion(fileVersion);
   
    assertNotNull(fileHistory.getLastVersion());
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.