Package org.hive2hive.core.processes.framework.interfaces

Examples of org.hive2hive.core.processes.framework.interfaces.IProcessComponent


    Set<String> users = new HashSet<String>(3);
    users.add(userACredentials.getUserId());
    users.add(userBCredentials.getUserId());
    users.add(userCCredentials.getUserId());
    CountingNotificationMessageFactory msgFactory = new CountingNotificationMessageFactory(notifier);
    IProcessComponent process = ProcessFactory.instance().createNotificationProcess(msgFactory, users,
        notifier);
    process.start();

    H2HWaiter waiter = new H2HWaiter(20);
    do {
      waiter.tickASecond();
    } while (!msgFactory.allMsgsArrived());

    Assert.assertEquals(4, msgFactory.getSentMessageCount());
    Assert.assertEquals(ProcessState.SUCCEEDED, process.getState());
  }
View Full Code Here


    // send notification to own peers
    Set<String> users = new HashSet<String>(2);
    users.add(userACredentials.getUserId());
    users.add(userBCredentials.getUserId());
    CountingNotificationMessageFactory msgFactory = new CountingNotificationMessageFactory(notifier);
    IProcessComponent process = ProcessFactory.instance().createNotificationProcess(msgFactory, users,
        notifier);
    TestProcessComponentListener listener = new TestProcessComponentListener();
    process.attachListener(listener);

    // kick out peer 3 (B)
    network.get(3).getConnection().getPeer().setObjectDataReply(new DenyingMessageReplyHandler());
    process.start();

    // wait until all messages are sent
    UseCaseTestUtil.waitTillSucceded(listener, 20);

    H2HWaiter waiter = new H2HWaiter(10);
View Full Code Here

    // send notification to own peers
    Set<String> users = new HashSet<String>(2);
    users.add(userACredentials.getUserId());
    users.add(userBCredentials.getUserId());
    CountingNotificationMessageFactory msgFactory = new CountingNotificationMessageFactory(notifier);
    IProcessComponent process = ProcessFactory.instance().createNotificationProcess(msgFactory, users,
        notifier);
    TestProcessComponentListener listener = new TestProcessComponentListener();
    process.attachListener(listener);

    // kick out peer 3 and 4 (B)
    network.get(3).getConnection().getPeer().setObjectDataReply(new DenyingMessageReplyHandler());
    network.get(4).getConnection().getPeer().setObjectDataReply(new DenyingMessageReplyHandler());
    process.start();

    // wait until all messages are sent
    UseCaseTestUtil.waitTillSucceded(listener, 20);

    H2HWaiter waiter = new H2HWaiter(10);
View Full Code Here

    // send notification to own peers
    Set<String> users = new HashSet<String>(1);
    users.add(userACredentials.getUserId());
    CountingNotificationMessageFactory msgFactory = new CountingNotificationMessageFactory(notifier);
    IProcessComponent process = ProcessFactory.instance().createNotificationProcess(msgFactory, users,
        notifier);
    TestProcessComponentListener listener = new TestProcessComponentListener();
    process.attachListener(listener);

    // kick out Peer 1
    network.get(1).getConnection().getPeer().setObjectDataReply(new DenyingMessageReplyHandler());
    process.start();

    // wait until all messages are sent
    UseCaseTestUtil.waitTillSucceded(listener, 20);

    // check the locations map; should have 2 entries only
View Full Code Here

  @Test
  public void testUploadSameVersion() throws IllegalFileLocation, GetFailedException, IOException,
      NoSessionException, InvalidProcessStateException, IllegalArgumentException,
      NoPeerConnectionException {
    // upload the same content again
    IProcessComponent process = ProcessFactory.instance().createUpdateFileProcess(file, uploader);
    TestProcessComponentListener listener = new TestProcessComponentListener();
    process.attachListener(listener);
    process.start();

    H2HWaiter waiter = new H2HWaiter(60);
    do {
      waiter.tickASecond();
    } while (!listener.hasFailed());
View Full Code Here

      NoSessionException, NoPeerConnectionException {
    NetworkManager client = network.get(new Random().nextInt(networkSize));
    SessionParameters sessionParameters = new SessionParameters();
    sessionParameters.setProfileManager(new UserProfileManager(client.getDataManager(), wrongCredentials));

    IProcessComponent loginProcess = ProcessFactory.instance().createLoginProcess(wrongCredentials, sessionParameters,
        client);
    TestProcessComponentListener listener = new TestProcessComponentListener();
    loginProcess.attachListener(listener);
    loginProcess.start();

    UseCaseTestUtil.waitTillFailed(listener, 20);

    return client.getSession();
  }
View Full Code Here

  @Test
  public void testDownloadWrongKeys() throws IOException, NoSessionException, GetFailedException,
      InvalidProcessStateException {
    KeyPair wrongKeys = EncryptionUtil.generateRSAKeyPair(H2HConstants.KEYLENGTH_META_FILE);

    IProcessComponent process = ProcessFactory.instance().createDownloadFileProcess(wrongKeys.getPublic(), downloader);
    TestProcessComponentListener listener = new TestProcessComponentListener();
    process.attachListener(listener);
    process.start();

    UseCaseTestUtil.waitTillFailed(listener, 20);
  }
View Full Code Here

    // create the existing file
    File existing = new File(downloaderRoot, uploadedFile.getName());
    FileUtils.write(existing, testContent);
    long lastModifiedBefore = existing.lastModified();

    IProcessComponent process = ProcessFactory.instance().createDownloadFileProcess(fileNode.getFilePublicKey(),
        downloader);
    TestProcessComponentListener listener = new TestProcessComponentListener();
    process.attachListener(listener);
    process.start();

    UseCaseTestUtil.waitTillFailed(listener, 20);

    // the existing file has already same content, should not have been downloaded
    Assert.assertEquals(lastModifiedBefore, existing.lastModified());
View Full Code Here

      InvalidProcessStateException, NoPeerConnectionException {
    // skip the login and continue with the newfile process
    NetworkManager client = network.get(2);

    File file = FileTestUtil.createFileRandomContent(1, uploaderRoot, CHUNK_SIZE);
    IProcessComponent process = ProcessFactory.instance().createNewFileProcess(file, client);
    TestProcessComponentListener listener = new TestProcessComponentListener();
    process.attachListener(listener);
    process.start();

    UseCaseTestUtil.waitTillFailed(listener, 40);
  }
View Full Code Here

    Locations locations = (Locations) futureGet.getData().object();

    Assert.assertEquals(1, locations.getPeerAddresses().size());

    // logout
    IProcessComponent process = ProcessFactory.instance().createLogoutProcess(client);
    UseCaseTestUtil.executeProcess(process);

    // verify the locations map after logout
    FutureGet futureGet2 = client.getDataManager().getUnblocked(
        new Parameters().setLocationKey(userCredentials.getUserId()).setContentKey(
View Full Code Here

TOP

Related Classes of org.hive2hive.core.processes.framework.interfaces.IProcessComponent

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.