Search in sources :

Example 6 with Filter

use of org.apache.accumulo.core.iterators.Filter in project accumulo by apache.

the class VisibilityFilterTest method verify.

private void verify(TreeMap<Key, Value> source, int expectedSourceSize, Map<String, String> options, Text expectedCF, Text expectedCQ, Text expectedCV, int expectedFinalCount) throws IOException {
    assertEquals(expectedSourceSize, source.size());
    Filter filter = new VisibilityFilter();
    filter.init(new SortedMapIterator(source), options, null);
    filter.seek(new Range(), EMPTY_COL_FAMS, false);
    int count = 0;
    while (filter.hasTop()) {
        count++;
        // System.out.println(DefaultFormatter.formatEntry(Collections.singletonMap(filter.getTopKey(), filter.getTopValue()).entrySet().iterator().next(),
        // false));
        assertEquals(expectedCF, filter.getTopKey().getColumnFamily());
        assertEquals(expectedCQ, filter.getTopKey().getColumnQualifier());
        assertEquals(expectedCV, filter.getTopKey().getColumnVisibility());
        filter.next();
    }
    assertEquals(expectedFinalCount, count);
}
Also used : Filter(org.apache.accumulo.core.iterators.Filter) SortedMapIterator(org.apache.accumulo.core.iterators.SortedMapIterator) Range(org.apache.accumulo.core.data.Range)

Aggregations

Range (org.apache.accumulo.core.data.Range)6 Filter (org.apache.accumulo.core.iterators.Filter)6 TreeMap (java.util.TreeMap)4 Key (org.apache.accumulo.core.data.Key)4 Value (org.apache.accumulo.core.data.Value)4 SortedMapIterator (org.apache.accumulo.core.iterators.SortedMapIterator)4 ColumnQualifierFilter (org.apache.accumulo.core.iterators.system.ColumnQualifierFilter)4 VisibilityFilter (org.apache.accumulo.core.iterators.system.VisibilityFilter)4 Test (org.junit.Test)4 Text (org.apache.hadoop.io.Text)3 IteratorSetting (org.apache.accumulo.core.client.IteratorSetting)2 ImmutableMap (com.google.common.collect.ImmutableMap)1 Builder (com.google.common.collect.ImmutableMap.Builder)1 ImmutableSet (com.google.common.collect.ImmutableSet)1 Iterables (com.google.common.collect.Iterables)1 Lists (com.google.common.collect.Lists)1 IOException (java.io.IOException)1 Arrays (java.util.Arrays)1 Collection (java.util.Collection)1 Collections (java.util.Collections)1