Package net.tomp2p.futures

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


    H2HTestData data2 = new H2HTestData(NetworkTestUtil.randomString());
    Parameters parameters2 = new Parameters().setLocationKey(locationKey).setContentKey(contentKey)
        .setData(data2);
    futurePut = node.getDataManager().putUnblocked(parameters2);
    futurePut.awaitUninterruptibly();

    assertFalse(futurePut.getRawResult().isEmpty());
    for (PeerAddress peerAddress : futurePut.getRawResult().keySet()) {
      for (Number640 key : futurePut.getRawResult().get(peerAddress).keySet()) {
        assertEquals(PutStatusH2H.FAILED_SECURITY, PutStatusH2H.values()[futurePut.getRawResult()
View Full Code Here


        H2HConstants.KEYLENGTH_USER_PROFILE);
    EncryptedNetworkContent encrypted = H2HEncryptionUtil.encryptAES(testProfile, encryptionKeys);
    FuturePut putGlobal = putter.getDataManager().putUnblocked(
        new Parameters().setLocationKey(credentials.getProfileLocationKey())
            .setContentKey(H2HConstants.USER_PROFILE).setData(encrypted));
    putGlobal.awaitUninterruptibly();

    UserProfile profile = UseCaseTestUtil.getUserProfile(putter, credentials);

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

    // already put a locations map
    FuturePut putLocations = client.getDataManager().putUnblocked(
        new Parameters().setLocationKey(credentials.getUserId())
            .setContentKey(H2HConstants.USER_LOCATIONS)
            .setData(new Locations(credentials.getUserId())));
    putLocations.awaitUninterruptibly();
    putLocations.getFutureRequests().awaitUninterruptibly();

    assertTrue(putLocations.isSuccess());

    IProcessComponent registerProcess = ProcessFactory.instance().createRegisterProcess(credentials,
View Full Code Here

    // initial put
    H2HTestData data1 = new H2HTestData("bla1");
    Parameters parameters1 = new Parameters().setLocationKey(locationKey).setDomainKey(domainKey)
        .setContentKey(contentKey).setData(data1).setProtectionKeys(protectionKey);
    FuturePut futurePut = node.getDataManager().putUnblocked(parameters1);
    futurePut.awaitUninterruptibly();

    // verify initial put
    FutureGet futureGet = node.getDataManager().getUnblocked(parameters1);
    futureGet.awaitUninterruptibly();
    assertEquals(data1.getTestString(), ((H2HTestData) futureGet.getData().object()).getTestString());
View Full Code Here

    // try to put without a protection key
    H2HTestData data2 = new H2HTestData("bla2");
    Parameters parameters2 = new Parameters().setLocationKey(locationKey).setDomainKey(domainKey)
        .setContentKey(contentKey).setData(data2);
    futurePut = node.getDataManager().putUnblocked(parameters2);
    futurePut.awaitUninterruptibly();

    // should have been not modified
    futureGet = node.getDataManager().getUnblocked(parameters1);
    futureGet.awaitUninterruptibly();
    assertEquals(data1.getTestString(), ((H2HTestData) futureGet.getData().object()).getTestString());
View Full Code Here

    // initial put
    H2HTestData data1 = new H2HTestData("bla1");
    Parameters parameters1 = new Parameters().setLocationKey(locationKey).setDomainKey(domainKey)
        .setContentKey(contentKey).setData(data1).setProtectionKeys(protectionKey);
    FuturePut futurePut = node.getDataManager().putUnblocked(parameters1);
    futurePut.awaitUninterruptibly();

    // verify initial put
    FutureGet futureGet = node.getDataManager().getUnblocked(parameters1);
    futureGet.awaitUninterruptibly();
    assertEquals(data1.getTestString(), ((H2HTestData) futureGet.getData().object()).getTestString());
View Full Code Here

    // overwrite with correct protection key
    H2HTestData data2 = new H2HTestData("bla2");
    Parameters parameters2 = new Parameters().setLocationKey(locationKey).setDomainKey(domainKey)
        .setContentKey(contentKey).setData(data2).setProtectionKeys(protectionKey);
    futurePut = node.getDataManager().putUnblocked(parameters2);
    futurePut.awaitUninterruptibly();

    // verify overwrite
    futureGet = node.getDataManager().getUnblocked(parameters2);
    futureGet.awaitUninterruptibly();
    assertEquals(data2.getTestString(), ((H2HTestData) futureGet.getData().object()).getTestString());
View Full Code Here

    // try to overwrite without protection key
    H2HTestData data3 = new H2HTestData("bla3");
    Parameters parameters3 = new Parameters().setLocationKey(locationKey).setDomainKey(domainKey)
        .setContentKey(contentKey).setData(data3);
    futurePut = node.getDataManager().putUnblocked(parameters3);
    futurePut.awaitUninterruptibly();

    // should have been not changed
    futureGet = node.getDataManager().getUnblocked(parameters1);
    futureGet.awaitUninterruptibly();
    assertEquals(data2.getTestString(), ((H2HTestData) futureGet.getData().object()).getTestString());
View Full Code Here

    // initial put
    H2HTestData data1 = new H2HTestData("bla1");
    Parameters parameters1 = new Parameters().setLocationKey(locationKey).setDomainKey(domainKey)
        .setContentKey(contentKey).setData(data1).setProtectionKeys(protectionKey1);
    FuturePut futurePut = node.getDataManager().putUnblocked(parameters1);
    futurePut.awaitUninterruptibly();

    // verify initial put
    FutureGet futureGet = node.getDataManager().getUnblocked(parameters1);
    futureGet.awaitUninterruptibly();
    assertEquals(data1.getTestString(), ((H2HTestData) futureGet.getData().object()).getTestString());
View Full Code Here

    // try to overwrite with wrong protection key
    H2HTestData data2 = new H2HTestData("bla2");
    Parameters parameters2 = new Parameters().setLocationKey(locationKey).setDomainKey(domainKey)
        .setContentKey(contentKey).setData(data2).setProtectionKeys(protectionKey2);
    futurePut = node.getDataManager().putUnblocked(parameters2);
    futurePut.awaitUninterruptibly();

    // should have been not changed;
    futureGet = node.getDataManager().getUnblocked(parameters1);
    futureGet.awaitUninterruptibly();
    assertEquals(data1.getTestString(), ((H2HTestData) futureGet.getData().object()).getTestString());
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.