use of org.janusgraph.diskstorage.keycolumnvalue.KeyRangeQuery in project janusgraph by JanusGraph.
the class CQLStoreTest method testGetKeysWithoutUnorderedScan.
@Test
@FeatureFlag(feature = JanusGraphFeature.OrderedScan)
public void testGetKeysWithoutUnorderedScan() throws BackendException, NoSuchFieldException, IllegalAccessException {
// support ordered scan but not unordered scan
Field field = StandardStoreFeatures.class.getDeclaredField("unorderedScan");
field.setAccessible(true);
Field modifiersField = Field.class.getDeclaredField("modifiers");
modifiersField.setAccessible(true);
modifiersField.setInt(field, field.getModifiers() & ~Modifier.FINAL);
field.set(manager.getFeatures(), false);
Exception ex = assertThrows(PermanentBackendException.class, () -> store.getKeys(new SliceQuery(BufferUtil.zeroBuffer(1), BufferUtil.oneBuffer(4)), tx));
assertEquals("This operation is only allowed when partitioner supports unordered scan", ex.getMessage());
assertDoesNotThrow(() -> store.getKeys(new KeyRangeQuery(BufferUtil.getLongBuffer(1), BufferUtil.getLongBuffer(1000), BufferUtil.getLongBuffer(1), BufferUtil.getLongBuffer(1000)), tx));
}
Aggregations