Package org.hive2hive.core

Examples of org.hive2hive.core.H2HTestData


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

    // create a message with target node B
    final TestMessage message = new TestMessage(nodeB.getNodeId(), contentKey, new H2HTestData(data));

    // initialize the process and the one and only step to test
    BaseMessageProcessStep step = new BaseMessageProcessStep(nodeA.getMessageManager()) {

      @Override
View Full Code Here


      @Override
      public void handleResponseMessage(ResponseMessage responseMessage) {
        // locally store on requesting node received data
        String receivedSecret = (String) responseMessage.getContent();
        try {
          nodeA.getDataManager().putUnblocked(parametersA.setData(new H2HTestData(receivedSecret)))
              .awaitUninterruptibly();
        } catch (NoPeerConnectionException e) {
          Assert.fail(e.getMessage());
        }
      }
View Full Code Here

      if (futureGet.getData() == null) {
        continue;
      }

      try {
        H2HTestData gotData = (H2HTestData) futureGet.getData().object();
        if (gotData.getTestString().equalsIgnoreCase(data.getTestString())) {
          counter++;
        }
      } catch (ClassNotFoundException | IOException e) {
        Assert.fail();
      }
View Full Code Here

    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);

    // initialize the process and the one and only step to test
    BaseDirectMessageProcessStep step = new BaseDirectMessageProcessStep(nodeA.getMessageManager()) {
      @Override
      public void handleResponseMessage(ResponseMessage responseMessage) {
View Full Code Here

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

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

    // initialize the process and the one and only step to test
    BaseDirectMessageProcessStep step = new BaseDirectMessageProcessStep(nodeA.getMessageManager()) {
      @Override
      public void handleResponseMessage(ResponseMessage responseMessage) {
View Full Code Here

      @Override
      public void handleResponseMessage(ResponseMessage responseMessage) {
        // locally store on requesting node received data
        String receivedSecret = (String) responseMessage.getContent();
        try {
          nodeA.getDataManager().putUnblocked(parametersA.setData(new H2HTestData(receivedSecret)))
              .awaitUninterruptibly();
        } catch (NoPeerConnectionException e) {
          Assert.fail();
        }
      }
View Full Code Here

    String secret = NetworkTestUtil.randomString();

    try {
      networkManager.getDataManager().putUnblocked(
          new Parameters().setLocationKey(networkManager.getNodeId())
          .setContentKey(contentKey).setData(new H2HTestData(secret)))
          .awaitUninterruptibly();
    } catch (NoPeerConnectionException e) {
      Assert.fail();
    }
View Full Code Here

    network = NetworkTestUtil.createNetwork(networkSize);
  }

  @Test
  public void testGetProcessStepSuccess() throws NoPeerConnectionException {
    H2HTestData data = new H2HTestData(NetworkTestUtil.randomString());
    NetworkManager getter = network.get(0);
    NetworkManager holder = network.get(1);

    String locationKey = holder.getNodeId();
    String contentKey = NetworkTestUtil.randomString();

    // put in the memory of 2nd peer
    holder.getDataManager()
        .putUnblocked(
            new Parameters().setLocationKey(holder.getNodeId()).setContentKey(contentKey)
                .setData(data)).awaitUninterruptibly();

    TestGetProcessStep getStep = new TestGetProcessStep(locationKey, contentKey, getter.getDataManager());
    UseCaseTestUtil.executeProcess(getStep);

    Assert.assertEquals(data.getTestString(), ((H2HTestData) getStep.getContent()).getTestString());
  }
View Full Code Here

  @Test
  public void testRemoveProcessStepSuccess() throws NoPeerConnectionException {
    String locationKey = network.get(0).getNodeId();
    String contentKey = NetworkTestUtil.randomString();
    H2HTestData testData = new H2HTestData(NetworkTestUtil.randomString());

    // put some data to remove
    network.get(0)
        .getDataManager()
        .putUnblocked(
View Full Code Here

      InvalidProcessStateException {
    String locationKey = network.get(0).getNodeId();
    String contentKey = NetworkTestUtil.randomString();
    Number640 key = new Number640(Number160.createHash(locationKey), Number160.ZERO,
        Number160.createHash(contentKey), Number160.ZERO);
    H2HTestData testData = new H2HTestData(NetworkTestUtil.randomString());

    // manipulate the nodes, remove will not work
    network.get(0).getConnection().getPeer().getPeerBean().storage(new FakeGetTestStorage(key));
    network.get(1).getConnection().getPeer().getPeerBean().storage(new FakeGetTestStorage(key));
    // put some data to remove
View Full Code Here

TOP

Related Classes of org.hive2hive.core.H2HTestData

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.