Search in sources :

Example 1 with IteratorTestOutput

use of org.apache.accumulo.iteratortest.IteratorTestOutput in project accumulo by apache.

the class ReSeekTestCase method test.

@Override
public IteratorTestOutput test(IteratorTestInput testInput) {
    final SortedKeyValueIterator<Key, Value> skvi = IteratorTestUtil.instantiateIterator(testInput);
    final SortedKeyValueIterator<Key, Value> source = IteratorTestUtil.createSource(testInput);
    try {
        skvi.init(source, testInput.getIteratorOptions(), new SimpleIteratorEnvironment());
        skvi.seek(testInput.getRange(), testInput.getFamilies(), testInput.isInclusive());
        return new IteratorTestOutput(consume(skvi, testInput));
    } catch (IOException e) {
        return new IteratorTestOutput(e);
    }
}
Also used : IteratorTestOutput(org.apache.accumulo.iteratortest.IteratorTestOutput) SimpleIteratorEnvironment(org.apache.accumulo.iteratortest.environments.SimpleIteratorEnvironment) Value(org.apache.accumulo.core.data.Value) IOException(java.io.IOException) Key(org.apache.accumulo.core.data.Key)

Example 2 with IteratorTestOutput

use of org.apache.accumulo.iteratortest.IteratorTestOutput in project accumulo by apache.

the class YieldingTestCase method test.

@Override
public IteratorTestOutput test(IteratorTestInput testInput) {
    final SortedKeyValueIterator<Key, Value> skvi = IteratorTestUtil.instantiateIterator(testInput);
    final SortedKeyValueIterator<Key, Value> source = IteratorTestUtil.createSource(testInput);
    try {
        skvi.init(source, testInput.getIteratorOptions(), new SimpleIteratorEnvironment());
        YieldCallback<Key> yield = new YieldCallback<>();
        skvi.enableYielding(yield);
        skvi.seek(testInput.getRange(), testInput.getFamilies(), testInput.isInclusive());
        return new IteratorTestOutput(consume(testInput, skvi, yield));
    } catch (IOException e) {
        return new IteratorTestOutput(e);
    }
}
Also used : YieldCallback(org.apache.accumulo.core.iterators.YieldCallback) IteratorTestOutput(org.apache.accumulo.iteratortest.IteratorTestOutput) SimpleIteratorEnvironment(org.apache.accumulo.iteratortest.environments.SimpleIteratorEnvironment) Value(org.apache.accumulo.core.data.Value) IOException(java.io.IOException) Key(org.apache.accumulo.core.data.Key)

Example 3 with IteratorTestOutput

use of org.apache.accumulo.iteratortest.IteratorTestOutput in project accumulo by apache.

the class JUnitFrameworkTest method parameters.

@Parameters
public static Object[][] parameters() {
    IteratorTestInput input = getIteratorInput();
    IteratorTestOutput output = getIteratorOutput();
    List<IteratorTestCase> tests = Collections.singletonList(new NoopIteratorTestCase());
    return BaseJUnit4IteratorTest.createParameters(input, output, tests);
}
Also used : IteratorTestOutput(org.apache.accumulo.iteratortest.IteratorTestOutput) IteratorTestCase(org.apache.accumulo.iteratortest.testcases.IteratorTestCase) IteratorTestInput(org.apache.accumulo.iteratortest.IteratorTestInput) Parameters(org.junit.runners.Parameterized.Parameters)

Example 4 with IteratorTestOutput

use of org.apache.accumulo.iteratortest.IteratorTestOutput in project accumulo by apache.

the class DeepCopyTestCase method test.

@Override
public IteratorTestOutput test(IteratorTestInput testInput) {
    final SortedKeyValueIterator<Key, Value> skvi = IteratorTestUtil.instantiateIterator(testInput);
    final SortedKeyValueIterator<Key, Value> source = IteratorTestUtil.createSource(testInput);
    try {
        skvi.init(source, testInput.getIteratorOptions(), new SimpleIteratorEnvironment());
        SortedKeyValueIterator<Key, Value> copy = skvi.deepCopy(new SimpleIteratorEnvironment());
        copy.seek(testInput.getRange(), testInput.getFamilies(), testInput.isInclusive());
        return new IteratorTestOutput(consume(copy));
    } catch (IOException e) {
        return new IteratorTestOutput(e);
    }
}
Also used : IteratorTestOutput(org.apache.accumulo.iteratortest.IteratorTestOutput) SimpleIteratorEnvironment(org.apache.accumulo.iteratortest.environments.SimpleIteratorEnvironment) Value(org.apache.accumulo.core.data.Value) IOException(java.io.IOException) Key(org.apache.accumulo.core.data.Key)

Example 5 with IteratorTestOutput

use of org.apache.accumulo.iteratortest.IteratorTestOutput in project accumulo by apache.

the class IsolatedDeepCopiesTestCase method test.

@Override
public IteratorTestOutput test(IteratorTestInput testInput) {
    final SortedKeyValueIterator<Key, Value> skvi = IteratorTestUtil.instantiateIterator(testInput);
    final SortedKeyValueIterator<Key, Value> source = IteratorTestUtil.createSource(testInput);
    try {
        skvi.init(source, testInput.getIteratorOptions(), new SimpleIteratorEnvironment());
        SortedKeyValueIterator<Key, Value> copy1 = skvi.deepCopy(new SimpleIteratorEnvironment());
        SortedKeyValueIterator<Key, Value> copy2 = copy1.deepCopy(new SimpleIteratorEnvironment());
        Range seekRange = testInput.getRange();
        Collection<ByteSequence> seekColumnFamilies = testInput.getFamilies();
        boolean seekInclusive = testInput.isInclusive();
        skvi.seek(testInput.getRange(), seekColumnFamilies, seekInclusive);
        copy1.seek(testInput.getRange(), seekColumnFamilies, seekInclusive);
        copy2.seek(testInput.getRange(), seekColumnFamilies, seekInclusive);
        TreeMap<Key, Value> output = consumeMany(new ArrayList<>(Arrays.asList(skvi, copy1, copy2)), seekRange, seekColumnFamilies, seekInclusive);
        return new IteratorTestOutput(output);
    } catch (IOException e) {
        return new IteratorTestOutput(e);
    }
}
Also used : IteratorTestOutput(org.apache.accumulo.iteratortest.IteratorTestOutput) SimpleIteratorEnvironment(org.apache.accumulo.iteratortest.environments.SimpleIteratorEnvironment) Value(org.apache.accumulo.core.data.Value) IOException(java.io.IOException) Range(org.apache.accumulo.core.data.Range) Key(org.apache.accumulo.core.data.Key) ByteSequence(org.apache.accumulo.core.data.ByteSequence)

Aggregations

IteratorTestOutput (org.apache.accumulo.iteratortest.IteratorTestOutput)10 IOException (java.io.IOException)5 Key (org.apache.accumulo.core.data.Key)5 Value (org.apache.accumulo.core.data.Value)5 IteratorTestInput (org.apache.accumulo.iteratortest.IteratorTestInput)5 SimpleIteratorEnvironment (org.apache.accumulo.iteratortest.environments.SimpleIteratorEnvironment)5 IteratorTestCase (org.apache.accumulo.iteratortest.testcases.IteratorTestCase)5 Parameters (org.junit.runners.Parameterized.Parameters)5 ByteSequence (org.apache.accumulo.core.data.ByteSequence)1 Range (org.apache.accumulo.core.data.Range)1 YieldCallback (org.apache.accumulo.core.iterators.YieldCallback)1