org.apache.accumulo.core.iterators.IteratorUtil.IteratorScope

Here are the examples of the java api class org.apache.accumulo.core.iterators.IteratorUtil.IteratorScope taken from open source projects.

1. NotificationIteratorTest#testLots()

View license
@Test
public void testLots() {
    IteratorScope scope = IteratorScope.scan;
    Random rand = new Random(42L);
    TestData input = new TestData();
    for (int i = 0; i < 1000; i++) {
        int maxTs = Math.max(1, rand.nextInt(50));
        for (int j = 0; j < maxTs; j++) {
            input.add("row" + i + " ntfy foo:baz " + j, "");
        }
    }
    TestData output = new TestData(newNI(input, scope, true));
    rand = new Random(42L);
    TestData expected = new TestData();
    for (int i = 0; i < 1000; i++) {
        int maxTs = Math.max(1, rand.nextInt(50)) - 1;
        expected.add("row" + i + " ntfy foo:baz " + maxTs, "");
    }
    Assert.assertEquals(expected, output);
}

2. NotificationIteratorTest#testAllScopes()

View license
// test the behavior that is expected to be the same in all scopes
@Test
public void testAllScopes() {
    for (IteratorScope scope : IteratorScope.values()) {
        TestData input = getTestDataNoDeletes();
        TestData output = new TestData(newNI(input, scope));
        TestData expected = new TestData();
        expected.add("0 ntfy foo:bar 7", "");
        expected.add("1 ntfy foo:bar 3", "");
        expected.add("1 ntfy foo:baz 1", "");
        expected.add("2 ntfy foo:baz 3", "");
        Assert.assertEquals(expected, output);
        output = new TestData(newNI(input, scope), new Range("1"));
        expected = new TestData();
        expected.add("1 ntfy foo:bar 3", "");
        expected.add("1 ntfy foo:baz 1", "");
        Assert.assertEquals(expected, output);
        output = new TestData(newNI(input, scope), new Range("0", "1"));
        expected = new TestData();
        expected.add("0 ntfy foo:bar 7", "");
        expected.add("1 ntfy foo:bar 3", "");
        expected.add("1 ntfy foo:baz 1", "");
        Assert.assertEquals(expected, output);
        output = new TestData(newNI(input, scope), new Range("1", "2"));
        expected = new TestData();
        expected.add("1 ntfy foo:bar 3", "");
        expected.add("1 ntfy foo:baz 1", "");
        expected.add("2 ntfy foo:baz 3", "");
        Assert.assertEquals(expected, output);
    }
}

3. NotificationIteratorTest#testPartialCompaction()

View license
@Test
public void testPartialCompaction() {
    for (IteratorScope scope : Arrays.asList(IteratorScope.minc, IteratorScope.majc)) {
        TestData input = getTestData();
        TestData output = new TestData(newNI(input, scope, false));
        TestData expected = new TestData();
        expected.add("0 ntfy foo:bar 7", "");
        expected.add("1 ntfy foo:bar 3", "");
        expected.add("1 ntfy foo:baz 1", "");
        expected.add("2 ntfy foo:baz 3", "");
        expected.add("3 ntfy foo:baz 3 DEL", "");
        expected.add("5 ntfy foo:baz 3 DEL", "");
        expected.add("8 ntfy foo:baz 5 DEL", "");
        expected.add("9 ntfy foo:bar 3", "");
        Assert.assertEquals(expected, output);
        input = getMixedTestData();
        expected = new TestData();
        expected.add("0 ntfy zoo:bar 7", "");
        expected.add("0 zoo bar WRITE 16", "11");
        expected.add("0 zoo bar DATA 11", "15");
        expected.add("1 zoo bar WRITE 16", "11");
        expected.add("1 zoo bar DATA 11", "15");
        expected.add("2 ntfy zoo:bar 5 DEL", "");
        expected.add("2 zoo bar WRITE 16", "11");
        expected.add("2 zoo bar DATA 11", "15");
        output = new TestData(newNI(input, scope, false));
        Assert.assertEquals(expected, output);
    }
}

4. NotificationIteratorTest#testFullCompaction()

View license
@Test
public void testFullCompaction() {
    IteratorScope scope = IteratorScope.majc;
    TestData input = getTestData();
    TestData output = new TestData(newNI(input, scope, true));
    TestData expected = new TestData();
    expected.add("0 ntfy foo:bar 7", "");
    expected.add("1 ntfy foo:bar 3", "");
    expected.add("1 ntfy foo:baz 1", "");
    expected.add("2 ntfy foo:baz 3", "");
    expected.add("9 ntfy foo:bar 3", "");
    Assert.assertEquals(expected, output);
    input = getMixedTestData();
    expected = new TestData();
    expected.add("0 ntfy zoo:bar 7", "");
    expected.add("0 zoo bar WRITE 16", "11");
    expected.add("0 zoo bar DATA 11", "15");
    expected.add("1 zoo bar WRITE 16", "11");
    expected.add("1 zoo bar DATA 11", "15");
    expected.add("2 zoo bar WRITE 16", "11");
    expected.add("2 zoo bar DATA 11", "15");
    output = new TestData(newNI(input, scope, true));
    Assert.assertEquals(expected, output);
}