Package org.hive2hive.core.model

Examples of org.hive2hive.core.model.UserProfile


        try {
          logger.trace("Decrypting user profile with 256-bit AES key from password. user id = '{}'",
              credentials.getUserId());
          EncryptedNetworkContent encrypted = (EncryptedNetworkContent) content;
          NetworkContent decrypted = H2HEncryptionUtil.decryptAES(encrypted, userProfileEncryptionKey);
          UserProfile userProfile = (UserProfile) decrypted;
          userProfile.setVersionKey(content.getVersionKey());
          userProfile.setBasedOnKey(content.getBasedOnKey());

          // cache user profile
          cachedUserProfile = userProfile;
          // provide loaded user profile
          entry.setUserProfile(userProfile);
View Full Code Here


    }
  }

  private static void checkIndexesAfterMoving(Path oldPath, Path newPath) throws GetFailedException,
      NoSessionException {
    UserProfile userProfileA = nodeA.getSession().getProfileManager()
        .getUserProfile(UUID.randomUUID().toString(), false);
    Index indexOldA = userProfileA.getFileByPath(oldPath);
    // should have been deleted
    Assert.assertNull(indexOldA);

    UserProfile userProfileB = nodeB.getSession().getProfileManager()
        .getUserProfile(UUID.randomUUID().toString(), false);
    Index indexOldB = userProfileB.getFileByPath(oldPath);
    // should have been deleted
    Assert.assertNull(indexOldB);

    Index indexNew = userProfileA.getFileByPath(newPath);
    // should have been created
View Full Code Here

    }
  }

  private static void checkIndexAfterTryingMoving(Path relativePath) throws GetFailedException,
      NoSessionException {
    UserProfile userProfileA = nodeA.getSession().getProfileManager()
        .getUserProfile(UUID.randomUUID().toString(), false);
    Index indexA = userProfileA.getFileByPath(relativePath);

    UserProfile userProfileB = nodeB.getSession().getProfileManager()
        .getUserProfile(UUID.randomUUID().toString(), false);
    Index indexB = userProfileB.getFileByPath(relativePath);

    // check if userA's content protection keys are other ones
    Assert.assertFalse(indexA.getProtectionKeys().getPrivate()
        .equals(userProfileA.getProtectionKeys().getPrivate()));
    Assert.assertFalse(indexA.getProtectionKeys().getPublic()
View Full Code Here

    }
  }

  private static void checkIndexAfterMoving(Path relativePathOld, Path relativePathNew)
      throws GetFailedException, NoSessionException {
    UserProfile userProfileA = nodeA.getSession().getProfileManager()
        .getUserProfile(UUID.randomUUID().toString(), false);
    Index oldIndexAtA = userProfileA.getFileByPath(relativePathOld);
    Index newIndexAtA = userProfileA.getFileByPath(relativePathNew);

    UserProfile userProfileB = nodeB.getSession().getProfileManager()
        .getUserProfile(UUID.randomUUID().toString(), false);
    Index oldIndexAtB = userProfileB.getFileByPath(relativePathOld);
    Index newIndexAtB = userProfileB.getFileByPath(relativePathNew);

    // check if old indexes have been removed
    Assert.assertNull(oldIndexAtA);
    Assert.assertNull(oldIndexAtB);
View Full Code Here

    }
  }

  private static void checkIndexAfterTryingToMove(Path relativePath) throws GetFailedException,
      NoSessionException {
    UserProfile userProfileA = nodeA.getSession().getProfileManager()
        .getUserProfile(UUID.randomUUID().toString(), false);
    Index indexAtA = userProfileA.getFileByPath(relativePath);

    UserProfile userProfileB = nodeB.getSession().getProfileManager()
        .getUserProfile(UUID.randomUUID().toString(), false);
    Index indexAtB = userProfileB.getFileByPath(relativePath);

    // check if userA's content protection keys are other ones
    Assert.assertFalse(indexAtA.getProtectionKeys().getPrivate()
        .equals(userProfileA.getProtectionKeys().getPrivate()));
    Assert.assertFalse(indexAtA.getProtectionKeys().getPublic()
View Full Code Here

    Assert.assertTrue(FileUtils.contentEquals(originalFile, synchronizedFile));
  }

  private static void checkFileIndex(Path relativePath, byte[] md5Hash) throws GetFailedException,
      NoSessionException {
    UserProfile userProfileA = nodeA.getSession().getProfileManager()
        .getUserProfile(UUID.randomUUID().toString(), false);
    FileIndex indexA = (FileIndex) userProfileA.getFileByPath(relativePath);

    UserProfile userProfileB = nodeB.getSession().getProfileManager()
        .getUserProfile(UUID.randomUUID().toString(), false);
    FileIndex indexB = (FileIndex) userProfileB.getFileByPath(relativePath);

    // check if index is file
    Assert.assertTrue(indexA.isFile());
    Assert.assertTrue(indexB.isFile());
View Full Code Here

    Assert.assertTrue(FileUtils.contentEquals(originalFile, synchronizedFile));
  }

  private static void checkFileIndex(Path relativePath, byte[] md5Hash) throws GetFailedException,
      NoSessionException {
    UserProfile userProfileA = network.get(0).getSession().getProfileManager()
        .getUserProfile(UUID.randomUUID().toString(), false);
    FileIndex indexA = (FileIndex) userProfileA.getFileByPath(relativePath);

    UserProfile userProfileB = network.get(1).getSession().getProfileManager()
        .getUserProfile(UUID.randomUUID().toString(), false);
    FileIndex indexB = (FileIndex) userProfileB.getFileByPath(relativePath);

    // check if index is file
    Assert.assertTrue(indexA.isFile());
    Assert.assertTrue(indexB.isFile());
View Full Code Here

    }
  }

  private static void checkIndex(File fileAtA, File fileAtB, boolean deleted) throws GetFailedException,
      NoSessionException {
    UserProfile userProfileA = network.get(0).getSession().getProfileManager()
        .getUserProfile(UUID.randomUUID().toString(), false);
    Path relativePathA = rootA.toPath().relativize(fileAtA.toPath());
    Index indexA = userProfileA.getFileByPath(relativePathA);

    UserProfile userProfileB = network.get(1).getSession().getProfileManager()
        .getUserProfile(UUID.randomUUID().toString(), false);
    Path relativePathB = rootB.toPath().relativize(fileAtB.toPath());
    Index indexB = userProfileB.getFileByPath(relativePathB);

    // in case of deletion verify removed index nodes
    if (deleted) {
      Assert.assertNull(indexA);
      Assert.assertNull(indexB);
View Full Code Here

    }
  }

  private static void checkIndex(Path relativePath, boolean deleted) throws GetFailedException,
      NoSessionException {
    UserProfile userProfileA = nodeA.getSession().getProfileManager()
        .getUserProfile(UUID.randomUUID().toString(), false);
    Index indexA = userProfileA.getFileByPath(relativePath);

    UserProfile userProfileB = nodeB.getSession().getProfileManager()
        .getUserProfile(UUID.randomUUID().toString(), false);
    Index indexB = userProfileB.getFileByPath(relativePath);

    // in case of deletion verify removed index nodes
    if (deleted) {
      Assert.assertNull(indexA);
      Assert.assertNull(indexB);
View Full Code Here

    }
  }

  private static void checkIndexes(File fileAtA, File fileAtB, File movedFile, boolean userA)
      throws GetFailedException, NoSessionException {
    UserProfile userProfileA = network.get(0).getSession().getProfileManager()
        .getUserProfile(UUID.randomUUID().toString(), false);
    Path relativePathA = rootA.toPath().relativize(fileAtA.toPath());
    Index indexA = userProfileA.getFileByPath(relativePathA);

    UserProfile userProfileB = network.get(1).getSession().getProfileManager()
        .getUserProfile(UUID.randomUUID().toString(), false);
    Path relativePathB = rootB.toPath().relativize(fileAtB.toPath());
    Index indexB = userProfileB.getFileByPath(relativePathB);

    // should have been deleted
    Assert.assertNull(indexA);
    Assert.assertNull(indexB);
View Full Code Here

TOP

Related Classes of org.hive2hive.core.model.UserProfile

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.