Package net.tomp2p.futures

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


            SearchValues v = new SearchValues(new Number160("0x1"), null, bf);
            FutureResponse fr = neighbors2.closeNeighbors(sender.peerAddress(), v,
                    Type.REQUEST_2, cc, new DefaultConnectionConfiguration());

            fr.awaitUninterruptibly();
            // Thread.sleep(10000000);
            Assert.assertEquals(true, fr.isSuccess());
            NeighborSet pas = fr.responseMessage().neighborsSet(0);
            // we are able to fit 40 neighbors into 1400 bytes
            Assert.assertEquals(33, pas.size());
View Full Code Here


            addBuilder.dataSet(dataSet);
            addBuilder.versionKey(Number160.ZERO);
            // addBuilder.setList();
            // addBuilder.random(new Random(42));
            FutureResponse fr = smmSender.add(recv1.peerAddress(), addBuilder, cc);
            fr.awaitUninterruptibly();
            System.err.println(fr.failedReason());
            Assert.assertEquals(true, fr.isSuccess());
            // add a the same data twice
            fr = smmSender.add(recv1.peerAddress(), addBuilder, cc);
            fr.awaitUninterruptibly();
View Full Code Here

            fr.awaitUninterruptibly();
            System.err.println(fr.failedReason());
            Assert.assertEquals(true, fr.isSuccess());
            // add a the same data twice
            fr = smmSender.add(recv1.peerAddress(), addBuilder, cc);
            fr.awaitUninterruptibly();
            System.err.println(fr.failedReason());
            Assert.assertEquals(true, fr.isSuccess());

            Number320 key = new Number320(new Number160(33), Number160.createHash("test"));
            // Set<Number480> tofetch = new HashSet<Number480>();
View Full Code Here

            addBuilder.list();
            addBuilder.random(new Random(42));

            fr = smmSender.add(recv1.peerAddress(), addBuilder, cc);
            fr.awaitUninterruptibly();
            System.err.println(fr.failedReason());
            Assert.assertEquals(true, fr.isSuccess());

            key = new Number320(new Number160(33), Number160.createHash("test"));
            // Set<Number480> tofetch = new HashSet<Number480>();
View Full Code Here

            putBuilder.versionKey(Number160.ZERO);
            putBuilder.dataMapContent(tmp);
            putBuilder.versionKey(Number160.ZERO);

            FutureResponse fr = smmSender.put(recv1.peerAddress(), putBuilder, cc);
            fr.awaitUninterruptibly();
            System.err.println(fr.failedReason());
            Assert.assertEquals(true, fr.isSuccess());

            Number640 key1 = new Number640(new Number160(33), Number160.createHash("test"), new Number160(77), Number160.ZERO);
            Data c = storeRecv.get(key1);
View Full Code Here

            test2 = new Data(me2);
            tmp.put(new Number160(77), test);
            tmp.put(new Number160(88), test2);
            putBuilder.dataMapContent(tmp);
            fr = smmSender.put(recv1.peerAddress(), putBuilder, cc);
            fr.awaitUninterruptibly();
            System.err.println(fr.failedReason());
            Assert.assertEquals(true, fr.isSuccess());
            Map<Number640, Data> result2 = storeRecv.subMap(key1.minContentKey(), key1.maxContentKey(), -1, true);
            Assert.assertEquals(result2.size(), 2);
            //Number480 search = new Number480(key, new Number160(88));
View Full Code Here

            putBuilder.dataMapContent(tmp);
            putBuilder.versionKey(Number160.ZERO);
            //putBuilder.set

            FutureResponse fr = smmSender.put(recv1.peerAddress(), putBuilder, cc);
            fr.awaitUninterruptibly();
            Assert.assertEquals(true, fr.isSuccess());
            Number640 key = new Number640(new Number160(33), Number160.createHash("test"), new Number160(77), Number160.ZERO);
            Data c = storeRecv.get(key);

            Assert.assertEquals(c, test);
View Full Code Here

            tmp.put(new Number160(88), new Data(me4));

            putBuilder.putIfAbsent();

            fr = smmSender.putIfAbsent(recv1.peerAddress(), putBuilder, cc);
            fr.awaitUninterruptibly();
            // we cannot put anything there, since there already is
            Assert.assertEquals(true, fr.isSuccess());
            Map<Number640, Byte> putKeys = fr.responseMessage().keyMapByte(0).keysMap();
            Assert.assertEquals(2, putKeys.size());
            Assert.assertEquals(Byte.valueOf((byte)PutStatus.FAILED_NOT_ABSENT.ordinal()), putKeys.values().iterator().next());
View Full Code Here

            DataMap dataMap = new DataMap(new Number160(33), Number160.createHash("test"), Number160.ZERO, tmp);
            putBuilder.dataMapContent(tmp);
            putBuilder.versionKey(Number160.ZERO);

            FutureResponse fr = smmSender.put(recv1.peerAddress(), putBuilder, cc);
            fr.awaitUninterruptibly();
            // get

            GetBuilder getBuilder = new GetBuilder(recv1, new Number160(33));
            getBuilder.domainKey(Number160.createHash("test"));
            getBuilder.contentKeys(tmp.keySet());
View Full Code Here

            getBuilder.domainKey(Number160.createHash("test"));
            getBuilder.contentKeys(tmp.keySet());
            getBuilder.versionKey(Number160.ZERO);

            fr = smmSender.get(recv1.peerAddress(), getBuilder, cc);
            fr.awaitUninterruptibly();
            Assert.assertEquals(true, fr.isSuccess());
            System.err.println(fr.failedReason());
            Message m = fr.responseMessage();
            Map<Number640, Data> stored = m.dataMap(0).dataMap();
            compare(dataMap.convertToMap640(), stored);
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.