Package net.tomp2p.futures

Examples of net.tomp2p.futures.FutureGet.awaitUninterruptibly()


    String contentKey = NetworkTestUtil.randomString();
    Parameters parameters = new Parameters().setLocationKey(nodeB.getNodeId()).setContentKey(contentKey);

    // check if selected location is empty
    FutureGet futureGet = nodeA.getDataManager().getUnblocked(parameters);
    futureGet.awaitUninterruptibly();
    assertNull(futureGet.getData());

    // create a message with target node B
    final TestDirectMessage message = new TestDirectMessage(nodeB.getNodeId(), nodeB.getConnection()
        .getPeer().getPeerAddress(), contentKey, new H2HTestData(data), false);
View Full Code Here


    // wait till message gets handled
    H2HWaiter w = new H2HWaiter(10);
    do {
      w.tickASecond();
      futureGet = nodeB.getDataManager().getUnblocked(parameters);
      futureGet.awaitUninterruptibly();
    } while (futureGet.getData() == null);

    // verify that data arrived
    String result = ((H2HTestData) futureGet.getData().object()).getTestString();
    assertNotNull(result);
View Full Code Here

    String contentKey = NetworkTestUtil.randomString();
    Parameters parameters = new Parameters().setLocationKey(nodeB.getNodeId()).setContentKey(contentKey);

    // check if selected location is empty
    FutureGet futureGet = nodeA.getDataManager().getUnblocked(parameters);
    futureGet.awaitUninterruptibly();
    assertNull(futureGet.getData());

    // assign a denying message handler at target node
    nodeB.getConnection().getPeer().setObjectDataReply(new DenyingMessageReplyHandler());
View Full Code Here

    // wait for the process to finish
    UseCaseTestUtil.waitTillFailed(listener, 10);

    // check if selected location is still empty
    futureGet = nodeB.getDataManager().getUnblocked(parameters);
    futureGet.awaitUninterruptibly();
    assertNull(futureGet.getData());
  }

  /**
   * Sends an asynchronous request message through a process step. This test checks if the process step
View Full Code Here

    final Parameters parametersB = new Parameters().setLocationKey(nodeB.getNodeId()).setContentKey(
        contentKey);

    // check if selected locations are empty
    FutureGet futureGet = nodeB.getDataManager().getUnblocked(parametersA);
    futureGet.awaitUninterruptibly();
    assertNull(futureGet.getData());
    futureGet = nodeA.getDataManager().getUnblocked(parametersB);
    futureGet.awaitUninterruptibly();
    assertNull(futureGet.getData());
View Full Code Here

    // check if selected locations are empty
    FutureGet futureGet = nodeB.getDataManager().getUnblocked(parametersA);
    futureGet.awaitUninterruptibly();
    assertNull(futureGet.getData());
    futureGet = nodeA.getDataManager().getUnblocked(parametersB);
    futureGet.awaitUninterruptibly();
    assertNull(futureGet.getData());

    // create a message with target node B
    final TestDirectMessageWithReply message = new TestDirectMessageWithReply(nodeB.getConnection()
        .getPeer().getPeerAddress(), contentKey);
View Full Code Here

    // wait till response message gets handled
    H2HWaiter waiter = new H2HWaiter(10);
    do {
      waiter.tickASecond();
      futureGet = nodeA.getDataManager().getUnblocked(parametersA);
      futureGet.awaitUninterruptibly();
    } while (futureGet.getData() == null);

    // load and verify if same secret was shared
    String receivedSecret = ((H2HTestData) futureGet.getData().object()).getTestString();
    futureGet = nodeB.getDataManager().getUnblocked(parametersB);
View Full Code Here

    for (FileVersion version : metaDocumentBeforeDeletion.getVersions()) {
      for (MetaChunk metaChunks : version.getMetaChunks()) {
        FutureGet get = client.getDataManager().getUnblocked(
            new Parameters().setLocationKey(metaChunks.getChunkId()).setContentKey(
                H2HConstants.FILE_CHUNK));
        get.awaitUninterruptibly();
        get.getFutureRequests().awaitUninterruptibly();

        // chunk should not exist
        Assert.assertNull(get.getData());
      }
View Full Code Here

    } while (futureGet.getData() == null);

    // load and verify if same secret was shared
    String receivedSecret = ((H2HTestData) futureGet.getData().object()).getTestString();
    futureGet = nodeB.getDataManager().getUnblocked(parametersB);
    futureGet.awaitUninterruptibly();
    String originalSecret = ((H2HTestData) futureGet.getData().object()).getTestString();
    assertEquals(originalSecret, receivedSecret);
  }

  private PublicKey getPublicKey(NetworkManager networkManager) {
View Full Code Here

        .getDataManager());
    UseCaseTestUtil.executeProcess(putStep);

    FutureGet futureGet = network.get(0).getDataManager()
        .getUnblocked(new Parameters().setLocationKey(locationKey).setContentKey(contentKey));
    futureGet.awaitUninterruptibly();
    assertNull(futureGet.getData());
  }

  @Test
  public void testRemoveProcessStepRollBack() throws NoPeerConnectionException,
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.