Package net.tomp2p.futures

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


    H2HTestData data = new H2HTestData(NetworkTestUtil.randomString());
    Parameters parameters = new Parameters().setLocationKey(node.getNodeId())
        .setContentKey(NetworkTestUtil.randomString()).setData(data);

    FuturePut futurePut = node.getDataManager().putUnblocked(parameters);
    futurePut.awaitUninterruptibly();

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


    H2HTestData data1 = new H2HTestData(NetworkTestUtil.randomString());
    Parameters parameters1 = new Parameters().setLocationKey(locationKey).setContentKey(contentKey)
        .setData(data1);
    FuturePut futurePut1 = node.getDataManager().putUnblocked(parameters1);
    futurePut1.awaitUninterruptibly();

    H2HTestData data2 = new H2HTestData(NetworkTestUtil.randomString());
    Parameters parameters2 = new Parameters().setLocationKey(locationKey).setContentKey(contentKey)
        .setData(data2);
    FuturePut futurePut2 = node.getDataManager().putUnblocked(parameters2);
View Full Code Here

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

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

    H2HTestData data1 = new H2HTestData(NetworkTestUtil.randomString());
    data1.generateVersionKey();
    Parameters parameters1 = new Parameters().setLocationKey(locationKey).setContentKey(contentKey)
        .setVersionKey(data1.getVersionKey()).setData(data1);
    FuturePut futurePut1 = node.getDataManager().putUnblocked(parameters1);
    futurePut1.awaitUninterruptibly();

    H2HTestData data2 = new H2HTestData(NetworkTestUtil.randomString());
    Parameters parameters2 = new Parameters().setLocationKey(locationKey).setContentKey(contentKey)
        .setData(data2);
    FuturePut futurePut2 = node.getDataManager().putUnblocked(parameters2);
View Full Code Here

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

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

    Data data = new Data(testData).setProtectedEntry().sign(keyPair, factory);
    data.ttlSeconds(10000).basedOn(bKey);

    FuturePut futurePut1 = p1.put(lKey).setData(cKey, data).setDomainKey(dKey).setVersionKey(vKey)
        .keyPair(keyPair).start();
    futurePut1.awaitUninterruptibly();
    assertTrue(futurePut1.isSuccess());

    FutureGet futureGet1a = p1.get(lKey).setContentKey(cKey).setDomainKey(dKey).setVersionKey(vKey)
        .start();
    futureGet1a.awaitUninterruptibly();
View Full Code Here

    // initial put using content protection keys 1
    String testData1 = "data1";
    Data data = new Data(testData1).setProtectedEntry();
    FuturePut futurePut1 = p1.put(lKey).setData(cKey, data).setDomainKey(dKey).keyPair(keyPair1).start();
    futurePut1.awaitUninterruptibly();
    assertTrue(futurePut1.isSuccess());

    FutureGet futureGet1a = p1.get(lKey).setContentKey(cKey).setDomainKey(dKey).start();
    futureGet1a.awaitUninterruptibly();
    assertTrue(futureGet1a.isSuccess());
View Full Code Here

    // try to put with wrong content protection keys 2
    String testData2 = "data2";
    Data data2 = new Data(testData2).setProtectedEntry().sign(keyPair2, factory);
    FuturePut futurePut2 = p2.put(lKey).setData(cKey, data2).setDomainKey(dKey).keyPair(keyPair2).start();
    futurePut2.awaitUninterruptibly();
    assertFalse(futurePut2.isSuccess());

    FutureGet futureGet2a = p1.get(lKey).setContentKey(cKey).setDomainKey(dKey).start();
    futureGet2a.awaitUninterruptibly();
    assertTrue(futureGet2a.isSuccess());
View Full Code Here

    // put with content protection keys 1
    String testData1 = "data1";
    Data data = new Data(testData1).setProtectedEntry();
    FuturePut futurePut1 = p1.put(lKey).setData(cKey, data).keyPair(keyPair1).start();
    futurePut1.awaitUninterruptibly();
    assertTrue(futurePut1.isSuccess());

    // try to remove without content protection keys
    FutureRemove futureRemove1 = p1.remove(lKey).contentKey(cKey).start();
    futureRemove1.awaitUninterruptibly();
View Full Code Here

    // put with content protection keys 1
    String testData1 = "data1";
    Data data = new Data(testData1).setProtectedEntry();
    FuturePut futurePut1 = p1.put(lKey).setDomainKey(dKey).setData(cKey, data).setVersionKey(vKey)
        .keyPair(key1).start();
    futurePut1.awaitUninterruptibly();
    assertTrue(futurePut1.isSuccess());

    // try to remove without content protection keys using from/to
    FutureRemove futureRemove1 = p1.remove(lKey).from(new Number640(lKey, dKey, cKey, Number160.ZERO))
        .to(new Number640(lKey, dKey, cKey, Number160.MAX_VALUE)).start();
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.