Package org.hive2hive.core.network.data.download

Examples of org.hive2hive.core.network.data.download.DownloadManager


    File file = new File(root, fileName);
    FileUtils.writeStringToFile(file, NetworkTestUtil.randomString());

    PublicKeyManager publicKeyManager = new PublicKeyManager("user", EncryptionUtil.generateRSAKeyPair(),
        null);
    DownloadManager downloadManager = new DownloadManager(null, null, publicKeyManager, null);
    FileUtil.writePersistentMetaData(root.toPath(), publicKeyManager, downloadManager);
    PersistentMetaData persistentMetaData = FileUtil.readPersistentMetaData(root.toPath());
    Map<String, byte[]> fileTree = persistentMetaData.getFileTree();
    Assert.assertTrue(fileTree.containsKey(fileName));
  }
View Full Code Here


      KeyPair keyPair = EncryptionUtil.generateRSAKeyPair(H2HConstants.KEYLENGTH_USER_KEYS);
      UserCredentials userCredentials = generateRandomCredentials();
      UserProfileManager profileManager = new UserProfileManager(node.getDataManager(), userCredentials);
      PublicKeyManager keyManager = new PublicKeyManager(userCredentials.getUserId(), keyPair, node.getDataManager());
      IFileConfiguration config = FileConfiguration.createDefault();
      DownloadManager downloadManager = new DownloadManager(node.getDataManager(), node.getMessageManager(),
          keyManager, config);
      File root = new File(System.getProperty("java.io.tmpdir"), NetworkTestUtil.randomString());
      H2HSession session;
      session = new H2HSession(profileManager, keyManager, downloadManager, config, root.toPath());
      node.setSession(session);
View Full Code Here

    UserCredentials userCredentials = generateRandomCredentials();
    for (NetworkManager node : network) {
      UserProfileManager profileManager = new UserProfileManager(node.getDataManager(), userCredentials);
      PublicKeyManager keyManager = new PublicKeyManager(userCredentials.getUserId(), keyPair, node.getDataManager());
      IFileConfiguration config = FileConfiguration.createDefault();
      DownloadManager downloadManager = new DownloadManager(node.getDataManager(), node.getMessageManager(),
          keyManager, config);
      File root = new File(System.getProperty("java.io.tmpdir"), NetworkTestUtil.randomString());
      H2HSession session;
      session = new H2HSession(profileManager, keyManager, downloadManager, config, root.toPath());
      node.setSession(session);
View Full Code Here

    TestUserProfileTask userProfileTask = new TestUserProfileTask();
    KeyPair key = EncryptionUtil.generateRSAKeyPair(H2HConstants.KEYLENGTH_USER_KEYS);
    NetworkManager node = network.get(random.nextInt(networkSize));
    PublicKeyManager publicKeyManager = new PublicKeyManager(userId, key, node.getDataManager());
    node.setSession(new H2HSession(new UserProfileManager(node.getDataManager(), new UserCredentials(userId, "password",
        "pin")), publicKeyManager, new DownloadManager(node.getDataManager(), node.getMessageManager(),
        publicKeyManager, config), config, FileTestUtil.getTempDirectory().toPath()));

    SimpleGetUserProfileTaskContext context = new SimpleGetUserProfileTaskContext();

    SequentialProcess process = new SequentialProcess();
View Full Code Here

    TestUserProfileTask userProfileTask = new TestUserProfileTask();
    KeyPair key = EncryptionUtil.generateRSAKeyPair(H2HConstants.KEYLENGTH_USER_KEYS);
    NetworkManager node = network.get(random.nextInt(networkSize));
    PublicKeyManager publicKeyManager = new PublicKeyManager(userId, key, node.getDataManager());
    node.setSession(new H2HSession(new UserProfileManager(node.getDataManager(), new UserCredentials(userId, "password",
        "pin")), publicKeyManager, new DownloadManager(node.getDataManager(), node.getMessageManager(),
        publicKeyManager, config), config, FileTestUtil.getTempDirectory().toPath()));

    SimpleGetUserProfileTaskContext context = new SimpleGetUserProfileTaskContext();

    SequentialProcess process = new SequentialProcess();
View Full Code Here

    TestUserProfileTask userProfileTask = new TestUserProfileTask();
    KeyPair key = EncryptionUtil.generateRSAKeyPair(H2HConstants.KEYLENGTH_USER_KEYS);
    NetworkManager node = network.get(random.nextInt(networkSize));
    PublicKeyManager publicKeyManager = new PublicKeyManager(userId, key, node.getDataManager());
    node.setSession(new H2HSession(new UserProfileManager(node.getDataManager(), new UserCredentials(userId, "password",
        "pin")), publicKeyManager, new DownloadManager(node.getDataManager(), node.getMessageManager(),
        publicKeyManager, config), config, FileTestUtil.getTempDirectory().toPath()));

    SimpleGetUserProfileTaskContext context = new SimpleGetUserProfileTaskContext();

    SequentialProcess process = new SequentialProcess();
View Full Code Here

    TestUserProfileTask userProfileTask = new TestUserProfileTask();
    KeyPair key = EncryptionUtil.generateRSAKeyPair(H2HConstants.KEYLENGTH_USER_KEYS);
    NetworkManager node = network.get(random.nextInt(networkSize));
    PublicKeyManager publicKeyManager = new PublicKeyManager(userId, key, node.getDataManager());
    node.setSession(new H2HSession(new UserProfileManager(node.getDataManager(), new UserCredentials(userId, "password",
        "pin")), publicKeyManager, new DownloadManager(node.getDataManager(), node.getMessageManager(),
        publicKeyManager, config), config, FileTestUtil.getTempDirectory().toPath()));

    // IGetUserProfileTaskContext context = new SimpleGetUserProfileTaskContext();
    // HybridEncryptedContent encrypted = H2HEncryptionUtil.encryptHybrid(userProfileTask,
    // key.getPublic());
View Full Code Here

    String userId = NetworkTestUtil.randomString();
    NetworkManager node = network.get(random.nextInt(networkSize));
    KeyPair key = EncryptionUtil.generateRSAKeyPair(H2HConstants.KEYLENGTH_USER_KEYS);
    PublicKeyManager publicKeyManager = new PublicKeyManager(userId, key, node.getDataManager());
    node.setSession(new H2HSession(new UserProfileManager(node.getDataManager(), new UserCredentials(userId, "password",
        "pin")), publicKeyManager, new DownloadManager(node.getDataManager(), node.getMessageManager(),
        publicKeyManager, config), config, FileTestUtil.getTempDirectory().toPath()));

    // create some tasks
    List<TestUserProfileTask> tasks = new ArrayList<TestUserProfileTask>();
    for (int i = 0; i < 5; i++) {
View Full Code Here

        keyManager.putPublicKey(userId, publicKeyCache.get(userId));
      }
      params.setKeyManager(keyManager);

      // create the download manager
      DownloadManager downloadManager = new DownloadManager(networkManager.getDataManager(),
          networkManager.getMessageManager(), keyManager, params.getFileConfig());

      // read the cached downloads and add them to the download manager
      for (BaseDownloadTask task : metaData.getDownloads()) {
        task.reinitializeAfterDeserialization();
        downloadManager.submit(task);
      }
      params.setDownloadManager(downloadManager);

      // create session
      session = new H2HSession(params);
View Full Code Here

TOP

Related Classes of org.hive2hive.core.network.data.download.DownloadManager

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.