use of org.apache.accumulo.core.iteratorsImpl.system.SortedMapIterator in project accumulo by apache.
the class VisibilityFilterTest method testEmptyAuths.
@Test
public void testEmptyAuths() throws IOException {
TreeMap<Key, Value> tm = new TreeMap<>();
tm.put(new Key("r1", "cf1", "cq1", ""), new Value());
tm.put(new Key("r1", "cf1", "cq2", "C"), new Value());
tm.put(new Key("r1", "cf1", "cq3", ""), new Value());
SortedKeyValueIterator<Key, Value> filter = VisibilityFilter.wrap(new SortedMapIterator(tm), Authorizations.EMPTY, "".getBytes());
filter.seek(new Range(), new HashSet<>(), false);
assertTrue(filter.hasTop());
assertEquals(new Key("r1", "cf1", "cq1", ""), filter.getTopKey());
filter.next();
assertTrue(filter.hasTop());
assertEquals(new Key("r1", "cf1", "cq3", ""), filter.getTopKey());
filter.next();
assertFalse(filter.hasTop());
}
use of org.apache.accumulo.core.iteratorsImpl.system.SortedMapIterator in project accumulo by apache.
the class ColumnSliceFilterTest method testStartEqualToEndBothInclusive.
@Test
public void testStartEqualToEndBothInclusive() throws IOException {
ColumnSliceFilter.setSlice(is, "20080202", true, "20080202", true);
columnSliceFilter.validateOptions(is.getOptions());
columnSliceFilter.init(new SortedMapIterator(TEST_DATA), is.getOptions(), iteratorEnvironment);
columnSliceFilter.seek(new Range(), EMPTY_COL_FAMS, false);
assertTrue(columnSliceFilter.hasTop());
assertEquals(columnSliceFilter.getTopKey(), KEY_2);
columnSliceFilter.next();
assertFalse(columnSliceFilter.hasTop());
}
use of org.apache.accumulo.core.iteratorsImpl.system.SortedMapIterator in project accumulo by apache.
the class ColumnSliceFilterTest method testNullStart.
@Test
public void testNullStart() throws IOException {
ColumnSliceFilter.setSlice(is, null, "20080204");
columnSliceFilter.validateOptions(is.getOptions());
columnSliceFilter.init(new SortedMapIterator(TEST_DATA), is.getOptions(), iteratorEnvironment);
columnSliceFilter.seek(new Range(), EMPTY_COL_FAMS, false);
assertTrue(columnSliceFilter.hasTop());
assertEquals(columnSliceFilter.getTopKey(), KEY_2);
columnSliceFilter.next();
assertTrue(columnSliceFilter.hasTop());
assertEquals(columnSliceFilter.getTopKey(), KEY_1);
columnSliceFilter.next();
assertTrue(columnSliceFilter.hasTop());
assertEquals(columnSliceFilter.getTopKey(), KEY_3);
columnSliceFilter.next();
assertTrue(columnSliceFilter.hasTop());
assertEquals(columnSliceFilter.getTopKey(), KEY_6);
columnSliceFilter.next();
assertFalse(columnSliceFilter.hasTop());
}
use of org.apache.accumulo.core.iteratorsImpl.system.SortedMapIterator in project accumulo by apache.
the class ColumnSliceFilterTest method testBothNull.
@Test
public void testBothNull() throws IOException {
ColumnSliceFilter.setSlice(is, null, null);
columnSliceFilter.validateOptions(is.getOptions());
columnSliceFilter.init(new SortedMapIterator(TEST_DATA), is.getOptions(), iteratorEnvironment);
columnSliceFilter.seek(new Range(), EMPTY_COL_FAMS, false);
assertTrue(columnSliceFilter.hasTop());
assertEquals(columnSliceFilter.getTopKey(), KEY_2);
columnSliceFilter.next();
assertTrue(columnSliceFilter.hasTop());
assertEquals(columnSliceFilter.getTopKey(), KEY_1);
columnSliceFilter.next();
assertTrue(columnSliceFilter.hasTop());
assertEquals(columnSliceFilter.getTopKey(), KEY_3);
columnSliceFilter.next();
assertTrue(columnSliceFilter.hasTop());
assertEquals(columnSliceFilter.getTopKey(), KEY_6);
columnSliceFilter.next();
assertTrue(columnSliceFilter.hasTop());
assertEquals(columnSliceFilter.getTopKey(), KEY_4);
columnSliceFilter.next();
assertTrue(columnSliceFilter.hasTop());
assertEquals(columnSliceFilter.getTopKey(), KEY_5);
columnSliceFilter.next();
assertFalse(columnSliceFilter.hasTop());
}
use of org.apache.accumulo.core.iteratorsImpl.system.SortedMapIterator in project accumulo by apache.
the class ColumnSliceFilterTest method testBothInclusive.
@Test
public void testBothInclusive() throws IOException {
ColumnSliceFilter.setSlice(is, "20080202", true, "20080204", true);
columnSliceFilter.validateOptions(is.getOptions());
columnSliceFilter.init(new SortedMapIterator(TEST_DATA), is.getOptions(), iteratorEnvironment);
columnSliceFilter.seek(new Range(), EMPTY_COL_FAMS, false);
assertTrue(columnSliceFilter.hasTop());
assertEquals(columnSliceFilter.getTopKey(), KEY_2);
columnSliceFilter.next();
assertTrue(columnSliceFilter.hasTop());
assertEquals(columnSliceFilter.getTopKey(), KEY_3);
columnSliceFilter.next();
assertTrue(columnSliceFilter.hasTop());
assertEquals(columnSliceFilter.getTopKey(), KEY_6);
columnSliceFilter.next();
assertTrue(columnSliceFilter.hasTop());
assertEquals(columnSliceFilter.getTopKey(), KEY_4);
columnSliceFilter.next();
assertFalse(columnSliceFilter.hasTop());
}
Aggregations