Package net.tomp2p.storage

Examples of net.tomp2p.storage.Storage


        Assert.assertEquals(0, result4.size());
    }

    @Test
    public void testTTL1() throws Exception {
        Storage storageM = createStorage();
        testTTL1(new StorageLayer(storageM));
        storageM.close();
    }
View Full Code Here


        Assert.assertEquals(true, tmp != null);
    }

    @Test
    public void testTTL2() throws Exception {
        Storage storageM = createStorage();
        testTTL2(new StorageLayer(storageM));
        storageM.close();
    }
View Full Code Here

        Assert.assertEquals(true, tmp == null);
    }
   
    @Test
    public void testTTLLeak() throws Exception {
        Storage storageM = createStorage();
        testTTLLeak(new StorageLayer(storageM));
        Assert.assertEquals(0, storageM.subMapTimeout(Long.MAX_VALUE).size());
        storageM.close();
    }
View Full Code Here

        Assert.assertEquals(true, tmp == null);
    }

    @Test
    public void testResponsibility() throws Exception {
        Storage storageM = createStorage();
        testResponsibility(storageM);
        storageM.close();
    }
View Full Code Here

        Assert.assertEquals(domainKey, storage.findPeerIDsForResponsibleContent(content1).iterator().next());
    }

    @Test
    public void testPublicKeyDomain() throws Exception {
        Storage storageM = createStorage();
        testPublicKeyDomain(new StorageLayer(storageM));
        storageM.close();
    }
View Full Code Here

        Assert.assertEquals(0, lock.cacheSize());
    }
   
    @Test
    public void testConcurrency() throws InterruptedException, IOException {
        final Storage sM = createStorage();
        final StorageLayer storageGeneric = new StorageLayer(sM);
        store(storageGeneric);
        final AtomicInteger counter = new AtomicInteger();
        final Data result1 = storageGeneric.get(key1);
        for (int i = 0; i < 10; i++) {
            new Thread(new Runnable() {
                @Override
                public void run() {
                    try {
                        Assert.assertEquals("test1", result1.object());   
                    } catch (Throwable t) {
                        t.printStackTrace();
                        counter.incrementAndGet();
                    }
                }
            }).start();
        }
        Thread.sleep(500);
        Assert.assertEquals(0, counter.get());
        sM.close();
    }
View Full Code Here

        sM.close();
    }

    @Test
    public void testConcurrency2() throws InterruptedException, IOException {
        final Storage sM = createStorage();
        final StorageLayer storageGeneric = new StorageLayer(sM);
        store(storageGeneric);
        final AtomicInteger counter = new AtomicInteger();
        for (int i = 0; i < 100; i++) {
            new Thread(new Runnable() {
                @Override
                public void run() {
                    Data result1 = null;
                    Data result2 = null;
                    Data result3 = null;
                    try {
                        result1 = storageGeneric.get(key1);
                        Assert.assertEquals("test1", result1.object());
                        result3 = storageGeneric.get(key3);
                        Assert.assertEquals(null, result3);
                        store(storageGeneric, 1);
                    } catch (Throwable t) {
                        t.printStackTrace();
                        counter.incrementAndGet();
                    }
                    try {
                        result2 = storageGeneric.get(key2);
                        Assert.assertEquals("test2", result2.object());
                        result3 = storageGeneric.get(key3);
                        Assert.assertEquals(null, result3);
                        store(storageGeneric, 1);
                    } catch (Throwable t) {
                        t.printStackTrace();
                        counter.incrementAndGet();
                    }
                }
            }).start();
        }
        Thread.sleep(500);
        Assert.assertEquals(0, counter.get());
        sM.close();
    }
View Full Code Here

TOP

Related Classes of net.tomp2p.storage.Storage

Copyright © 2018 www.massapicom. 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.