Package net.tomp2p.futures

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


    // try to overwrite without content protection and without data signature (expected to fail)
    data = new Data("dataC");
    data.ttlSeconds(ttl).basedOn(bKey).sign(keyPair1, factory);
    // put using wrong content protection keys 2 to sign message
    futureTryOverwrite = p1.put(lKey).setDomainKey(dKey).setData(cKey, data).setVersionKey(vKey).start();
    futureTryOverwrite.awaitUninterruptibly();
    Assert.assertFalse(futureTryOverwrite.isSuccess());

    // verify that nothing changed
    retData = p1.get(lKey).setDomainKey(dKey).setContentKey(cKey).setVersionKey(vKey).start()
        .awaitUninterruptibly().getData();
View Full Code Here


    data = new Data("dataD").setProtectedEntry();
    data.ttlSeconds(ttl).basedOn(bKey).sign(keyPair1, factory);
    // put using wrong content protection keys 2 to sign message
    futureTryOverwrite = p1.put(lKey).setDomainKey(dKey).setData(cKey, data).setVersionKey(vKey)
        .keyPair(keyPair2).start();
    futureTryOverwrite.awaitUninterruptibly();
    Assert.assertFalse(futureTryOverwrite.isSuccess());

    // verify that nothing changed
    retData = p1.get(lKey).setDomainKey(dKey).setContentKey(cKey).setVersionKey(vKey).start()
        .awaitUninterruptibly().getData();
View Full Code Here

    intialData = new Data("data2").setProtectedEntry();
    intialData.ttlSeconds(ttl).basedOn(bKey);
    // put using content protection key 1 to sign message
    FuturePut futureOverwrite1 = p1.put(lKey).setDomainKey(dKey).setData(cKey, intialData)
        .setVersionKey(vKey).keyPair(keyPair1).start();
    futureOverwrite1.awaitUninterruptibly();
    Assert.assertTrue(futureOverwrite1.isSuccess());

    // verify overwrite
    retData = p1.get(lKey).setDomainKey(dKey).setContentKey(cKey).setVersionKey(vKey).start()
        .awaitUninterruptibly().getData();
View Full Code Here

    intialData = new Data("data3").setProtectedEntry();
    intialData.ttlSeconds(ttl).basedOn(bKey).sign(keyPair1, factory);
    // put using content protection key 1 to sign message
    FuturePut futureOverwrite2 = p1.put(lKey).setDomainKey(dKey).setData(cKey, intialData)
        .setVersionKey(vKey).keyPair(keyPair1).start();
    futureOverwrite2.awaitUninterruptibly();
    Assert.assertTrue(futureOverwrite2.isSuccess());

    // verify overwrite
    retData = p1.get(lKey).setDomainKey(dKey).setContentKey(cKey).setVersionKey(vKey).start()
        .awaitUninterruptibly().getData();
View Full Code Here

    // don't forget to set signed flag, create meta data
    data.signed(true).duplicateMeta();
    // put meta using content content protection key 1 to sign message
    FuturePut futurePutMeta = p1.put(lKey).setDomainKey(dKey).putMeta().setData(cKey, data)
        .setVersionKey(vKey).keyPair(keyPair1).start();
    futurePutMeta.awaitUninterruptibly();
    Assert.assertTrue(futurePutMeta.isSuccess());

    // verify change
    retData = p1.get(lKey).setDomainKey(dKey).setContentKey(cKey).setVersionKey(vKey).start()
        .awaitUninterruptibly().getData();
View Full Code Here

    data = new Data("data4").setProtectedEntry();
    data.ttlSeconds(ttl).basedOn(bKey).sign(keyPair1, factory);
    // put using content content protection key 1 to sign message
    FuturePut futureOverwrite3 = p1.put(lKey).setDomainKey(dKey).setData(cKey, data).setVersionKey(vKey)
        .keyPair(keyPair1).start();
    futureOverwrite3.awaitUninterruptibly();
    Assert.assertTrue(futureOverwrite3.isSuccess());

    // verify change
    retData = p1.get(lKey).setDomainKey(dKey).setContentKey(cKey).setVersionKey(vKey).start()
        .awaitUninterruptibly().getData();
View Full Code Here

    Data data = new Data("data1").setProtectedEntry();
    data.ttlSeconds(ttl).basedOn(bKey).sign(keyPair1, factory);
    // put using content protection key 1 to sign message
    FuturePut futureIntialPut = p1.put(lKey).setDomainKey(dKey).setData(cKey, data).setVersionKey(vKey)
        .keyPair(keyPair1).start();
    futureIntialPut.awaitUninterruptibly();
    Assert.assertTrue(futureIntialPut.isSuccess());

    // verify put
    Data retData = p1.get(lKey).setDomainKey(dKey).setContentKey(cKey).setVersionKey(vKey).start()
        .awaitUninterruptibly().getData();
View Full Code Here

    // create meta data
    data.duplicateMeta();
    // put meta using content content protection key 1 to sign message
    FuturePut futurePutMeta = p1.put(lKey).setDomainKey(dKey).putMeta().setData(cKey, data)
        .setVersionKey(vKey).keyPair(keyPair1).start();
    futurePutMeta.awaitUninterruptibly();
    Assert.assertTrue(futurePutMeta.isSuccess());

    // verify change
    retData = p1.get(lKey).setDomainKey(dKey).setContentKey(cKey).setVersionKey(vKey).start()
        .awaitUninterruptibly().getData();
View Full Code Here

    data = new Data("data2").setProtectedEntry();
    data.ttlSeconds(ttl).basedOn(bKey).sign(keyPair2, factory);
    // put using content wrong protection keys 1 to sign message
    FuturePut futureOverwrite3 = p1.put(lKey).setDomainKey(dKey).setData(cKey, data).setVersionKey(vKey)
        .keyPair(keyPair1).start();
    futureOverwrite3.awaitUninterruptibly();
    Assert.assertFalse(futureOverwrite3.isSuccess());

    // verify that nothing changed
    retData = p1.get(lKey).setDomainKey(dKey).setContentKey(cKey).setVersionKey(vKey).start()
        .awaitUninterruptibly().getData();
View Full Code Here

    Data data = new Data("data1").setProtectedEntry();
    data.ttlSeconds(ttl).basedOn(bKey).sign(keyPair1, factory);
    // put using content protection key 1 to sign message
    FuturePut futureIntialPut = p1.put(lKey).setDomainKey(dKey).setData(cKey, data).setVersionKey(vKey)
        .keyPair(keyPair1).start();
    futureIntialPut.awaitUninterruptibly();
    Assert.assertTrue(futureIntialPut.isSuccess());

    // verify put
    Data retData = p1.get(lKey).setDomainKey(dKey).setContentKey(cKey).setVersionKey(vKey).start()
        .awaitUninterruptibly().getData();
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.