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

Examples of org.hive2hive.core.processes.framework.interfaces.IProcessComponent.attachListener()


    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();
View Full Code Here


    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();
View Full Code Here

    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();
View Full Code Here

      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();
View Full Code Here

    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

      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

    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
View Full Code Here

    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

    assertTrue(putLocations.isSuccess());

    IProcessComponent registerProcess = ProcessFactory.instance().createRegisterProcess(credentials,
        client);
    ProcessComponentListener listener = new ProcessComponentListener();
    registerProcess.attachListener(listener);
    registerProcess.start();

    H2HWaiter waiter = new H2HWaiter(20);
    do {
      waiter.tickASecond();
View Full Code Here

    NetworkManager notifier = network.get(0);
    CountingNotificationMessageFactory msgFactory = new CountingNotificationMessageFactory(notifier);
    IProcessComponent process = ProcessFactory.instance().createNotificationProcess(msgFactory,
        new HashSet<String>(0), notifier);
    TestProcessComponentListener listener = new TestProcessComponentListener();
    process.attachListener(listener);
    process.start();

    // wait until all messages are sent
    UseCaseTestUtil.waitTillSucceded(listener, 10);
  }
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.