Package net.tomp2p.futures

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


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

    FutureGet futureGet = proxy.getDataManager().getUnblocked(
        new Parameters().setLocationKey(locationKey).setContentKey(contentKey));
    futureGet.awaitUninterruptibly();
    assertEquals(data, ((H2HTestData) futureGet.getData().object()).getTestString());
  }

  @Test
  public void testPutProcessFailure() throws NoPeerConnectionException, InvalidProcessStateException {
View Full Code Here


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

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

  @AfterClass
  public static void cleanAfterClass() {
View Full Code Here

    // verify put locations
    FutureGet getLocations = otherClient.getDataManager().getUnblocked(
        new Parameters().setLocationKey(credentials.getUserId()).setContentKey(
            H2HConstants.USER_LOCATIONS));
    getLocations.awaitUninterruptibly();
    getLocations.getFutureRequests().awaitUninterruptibly();
    Locations locations = (Locations) getLocations.getData().object();

    assertNotNull(locations);
    assertEquals(credentials.getUserId(), locations.getUserId());
View Full Code Here

    // verify put user public key
    FutureGet getKey = otherClient.getDataManager().getUnblocked(
        new Parameters().setLocationKey(credentials.getUserId()).setContentKey(
            H2HConstants.USER_PUBLIC_KEY));
    getKey.awaitUninterruptibly();
    getKey.getFutureRequests().awaitUninterruptibly();
    UserPublicKey publicKey = (UserPublicKey) getKey.getData().object();

    assertNotNull(publicKey);
  }
View Full Code Here

    UseCaseTestUtil.executeProcess(step);

    // get the locations
    FutureGet future = proxy.getDataManager().getUnblocked(
        new Parameters().setLocationKey(userId).setContentKey(H2HConstants.USER_LOCATIONS));
    future.awaitUninterruptibly();
    Assert.assertNotNull(future.getData());
    Locations found = (Locations) future.getData().object();

    // verify if both objects are the same
    Assert.assertEquals(userId, found.getUserId());
View Full Code Here

    UseCaseTestUtil.waitTillFailed(listener, 10);

    // get the locations which should be stored at the proxy --> they should be null
    FutureGet futureGet = proxy.getDataManager().getUnblocked(
        new Parameters().setLocationKey(userId).setContentKey(H2HConstants.USER_LOCATIONS));
    futureGet.awaitUninterruptibly();
    assertNull(futureGet.getData());
  }

  @Override
  @After
View Full Code Here

    // verify the locations map before logout
    FutureGet futureGet = client.getDataManager().getUnblocked(
        new Parameters().setLocationKey(userCredentials.getUserId()).setContentKey(
            H2HConstants.USER_LOCATIONS));
    futureGet.awaitUninterruptibly();
    futureGet.getFutureRequests().awaitUninterruptibly();
    Locations locations = (Locations) futureGet.getData().object();

    Assert.assertEquals(1, locations.getPeerAddresses().size());
View Full Code Here

    // verify the locations map after logout
    FutureGet futureGet2 = client.getDataManager().getUnblocked(
        new Parameters().setLocationKey(userCredentials.getUserId()).setContentKey(
            H2HConstants.USER_LOCATIONS));
    futureGet2.awaitUninterruptibly();
    futureGet2.getFutureRequests().awaitUninterruptibly();
    Locations locations2 = (Locations) futureGet2.getData().object();

    Assert.assertEquals(0, locations2.getPeerAddresses().size());
  }
View Full Code Here

    futurePut1.awaitUninterruptibly();
    assertTrue(futurePut1.isSuccess());

    // verify put from peer 1
    FutureGet futureGet1a = p1.get(lKey).setContentKey(cKey).setDomainKey(dKey).start();
    futureGet1a.awaitUninterruptibly();
    assertTrue(futureGet1a.isSuccess());
    Data retData = futureGet1a.getData();
    assertEquals(testData, (String) retData.object());
    assertEquals(keyPair.getPublic(), retData.publicKey());
View Full Code Here

    assertEquals(testData, (String) retData.object());
    assertEquals(keyPair.getPublic(), retData.publicKey());

    // verify put from peer 2
    FutureGet futureGet1b = p2.get(lKey).setContentKey(cKey).setDomainKey(dKey).start();
    futureGet1b.awaitUninterruptibly();
    assertTrue(futureGet1b.isSuccess());
    retData = futureGet1b.getData();
    assertEquals(testData, (String) retData.object());
    assertEquals(keyPair.getPublic(), retData.publicKey());
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.