Search in sources :

Example 1 with CountingIterator

use of org.apache.accumulo.tserver.tablet.CountingIterator in project accumulo by apache.

the class CountingIteratorTest method testDeepCopyCount.

@Test
public void testDeepCopyCount() throws IOException {
    TreeMap<Key, Value> tm = new TreeMap<>();
    tm.put(new Key("r1", "cf1", "cq1"), new Value("data1".getBytes()));
    tm.put(new Key("r2", "cf1", "cq1"), new Value("data2".getBytes()));
    SortedMapIterator smi = new SortedMapIterator(tm);
    CountingIterator ci = new CountingIterator(smi, new AtomicLong(0));
    CountingIterator dc1 = ci.deepCopy(null);
    CountingIterator dc2 = ci.deepCopy(null);
    readAll(ci);
    readAll(dc1);
    readAll(dc2);
    Assert.assertEquals(6, ci.getCount());
}
Also used : AtomicLong(java.util.concurrent.atomic.AtomicLong) CountingIterator(org.apache.accumulo.tserver.tablet.CountingIterator) Value(org.apache.accumulo.core.data.Value) TreeMap(java.util.TreeMap) SortedMapIterator(org.apache.accumulo.core.iterators.SortedMapIterator) Key(org.apache.accumulo.core.data.Key) Test(org.junit.Test)

Aggregations

TreeMap (java.util.TreeMap)1 AtomicLong (java.util.concurrent.atomic.AtomicLong)1 Key (org.apache.accumulo.core.data.Key)1 Value (org.apache.accumulo.core.data.Value)1 SortedMapIterator (org.apache.accumulo.core.iterators.SortedMapIterator)1 CountingIterator (org.apache.accumulo.tserver.tablet.CountingIterator)1 Test (org.junit.Test)1