Examples of PartitionListIterator


Examples of voldemort.store.PartitionListIterator

    }

    @Test
    public void testEmptyPartitionList() {

        PartitionListIterator plistItr = new PartitionListIterator(store, new ArrayList<Integer>());
        assertEquals("Empty list cannot have a next element", false, plistItr.hasNext());
        try {
            plistItr.next();
            fail("Should have thrown an exception for next()");
        } catch(NoSuchElementException ne) {

        } finally {
            plistItr.close();
        }
    }
View Full Code Here

Examples of voldemort.store.PartitionListIterator

    }

    @Test
    public void testEmptyPartition() {

        PartitionListIterator plistItr = new PartitionListIterator(store, Arrays.asList(1));
        assertEquals("No data loaded for odd partitions, so hasNext() should be false",
                     false,
                     plistItr.hasNext());
        try {
            plistItr.next();
            fail("Should have thrown an exception for next()");
        } catch(NoSuchElementException ne) {

        } finally {
            plistItr.close();
        }
    }
View Full Code Here

Examples of voldemort.store.PartitionListIterator

        }
    }

    @Test
    public void testSingletonPartitionList() {
        PartitionListIterator plistItr = new PartitionListIterator(store, Arrays.asList(4));
        Set<String> pentries = new HashSet<String>();
        while(plistItr.hasNext()) {
            pentries.add(new String(plistItr.next().getFirst().get()));
        }
        plistItr.close();
        assertEquals(partitionEntries.get(4), pentries);
    }
View Full Code Here

Examples of voldemort.store.PartitionListIterator

        assertEquals(partitionEntries.get(4), pentries);
    }

    @Test
    public void testPartitionListWithEmptyPartitions() {
        PartitionListIterator plistItr = new PartitionListIterator(store, Arrays.asList(2,
                                                                                        3,
                                                                                        4,
                                                                                        5,
                                                                                        6));
        HashMap<Integer, Set<String>> retrievedPartitionEntries = new HashMap<Integer, Set<String>>();
        while(plistItr.hasNext()) {
            String key = new String(plistItr.next().getFirst().get());
            int p = strategy.getMasterPartition(key.getBytes());

            if(!retrievedPartitionEntries.containsKey(p))
                retrievedPartitionEntries.put(p, new HashSet<String>());
            retrievedPartitionEntries.get(p).add(key);
        }
        plistItr.close();

        // should only have retrieved entries for even partitions
        assertEquals(3, retrievedPartitionEntries.size());
        for(Integer p: Arrays.asList(2, 3, 4, 5, 6)) {
            if(p % 2 == 0) {
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.