use of org.apache.accumulo.core.iterators.SortedMapIterator in project accumulo by apache.
the class VisibilityFilterTest method testEmptyAuths.
public void testEmptyAuths() throws IOException {
TreeMap<Key, Value> tm = new TreeMap<>();
tm.put(new Key("r1", "cf1", "cq1", ""), new Value(new byte[0]));
tm.put(new Key("r1", "cf1", "cq2", "C"), new Value(new byte[0]));
tm.put(new Key("r1", "cf1", "cq3", ""), new Value(new byte[0]));
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.iterators.SortedMapIterator in project accumulo by apache.
the class BigDecimalCombinerTest method testMax.
@Test
public void testMax() throws IOException {
ai = new BigDecimalCombiner.BigDecimalMaxCombiner();
IteratorSetting is = new IteratorSetting(1, BigDecimalCombiner.BigDecimalMaxCombiner.class);
Combiner.setColumns(is, columns);
ai.init(new SortedMapIterator(tm1), is.getOptions(), CombinerTest.SCAN_IE);
ai.seek(new Range(), EMPTY_COL_FAMS, false);
assertTrue(ai.hasTop());
assertEquals(CombinerTest.newKey(1, 1, 1, 3), ai.getTopKey());
assertEquals(2.3, encoder.decode(ai.getTopValue().get()).doubleValue(), delta);
verify();
}
use of org.apache.accumulo.core.iterators.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());
assertTrue(columnSliceFilter.getTopKey().equals(KEY_2));
columnSliceFilter.next();
assertFalse(columnSliceFilter.hasTop());
}
use of org.apache.accumulo.core.iterators.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());
assertTrue(columnSliceFilter.getTopKey().equals(KEY_2));
columnSliceFilter.next();
assertTrue(columnSliceFilter.hasTop());
assertTrue(columnSliceFilter.getTopKey().equals(KEY_1));
columnSliceFilter.next();
assertTrue(columnSliceFilter.hasTop());
assertTrue(columnSliceFilter.getTopKey().equals(KEY_3));
columnSliceFilter.next();
assertTrue(columnSliceFilter.hasTop());
assertTrue(columnSliceFilter.getTopKey().equals(KEY_6));
columnSliceFilter.next();
assertTrue(columnSliceFilter.hasTop());
assertTrue(columnSliceFilter.getTopKey().equals(KEY_4));
columnSliceFilter.next();
assertTrue(columnSliceFilter.hasTop());
assertTrue(columnSliceFilter.getTopKey().equals(KEY_5));
columnSliceFilter.next();
assertFalse(columnSliceFilter.hasTop());
}
use of org.apache.accumulo.core.iterators.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());
assertTrue(columnSliceFilter.getTopKey().equals(KEY_2));
columnSliceFilter.next();
assertTrue(columnSliceFilter.hasTop());
assertTrue(columnSliceFilter.getTopKey().equals(KEY_3));
columnSliceFilter.next();
assertTrue(columnSliceFilter.hasTop());
assertTrue(columnSliceFilter.getTopKey().equals(KEY_6));
columnSliceFilter.next();
assertTrue(columnSliceFilter.hasTop());
assertTrue(columnSliceFilter.getTopKey().equals(KEY_4));
columnSliceFilter.next();
assertFalse(columnSliceFilter.hasTop());
}
Aggregations