use of com.google.cloud.bigtable.hbase.adapters.read.DefaultReadHooks in project java-bigtable-hbase by googleapis.
the class TestPageFilterAdapter method mustPassAllIsNotSupportedBelowTopLevel.
@Test
public void mustPassAllIsNotSupportedBelowTopLevel() {
FilterAdapterContext context = new FilterAdapterContext(new Scan(), new DefaultReadHooks());
PageFilter pageFilter = new PageFilter(20);
FilterList secondLevelList = new FilterList(Operator.MUST_PASS_ALL, pageFilter);
FilterList topLevelList = new FilterList(Operator.MUST_PASS_ALL, secondLevelList);
try (ContextCloseable ignored = context.beginFilterList(topLevelList)) {
try (ContextCloseable evenMoreIgnored = context.beginFilterList(secondLevelList)) {
FilterSupportStatus status = pageFilterAdapter.isFilterSupported(context, pageFilter);
Assert.assertFalse("MUST_PASS_ALL should not be supported lower than top level.", status.isSupported());
}
}
}
use of com.google.cloud.bigtable.hbase.adapters.read.DefaultReadHooks in project java-bigtable-hbase by googleapis.
the class TestPageFilterAdapter method pageFilterIsAppliedToReadRowsRequest.
@Test
public void pageFilterIsAppliedToReadRowsRequest() throws IOException {
final String TABLE_ID = "tableId";
final RequestContext requestContext = RequestContext.create("ProjectId", "InstanceId", "AppProfile");
ReadHooks hooks = new DefaultReadHooks();
FilterAdapterContext context = new FilterAdapterContext(new Scan(), hooks);
PageFilter pageFilter = new PageFilter(20);
Filters.Filter adaptedFilter = pageFilterAdapter.adapt(context, pageFilter);
Assert.assertNull("PageFilterAdapter should not return a Filters.Filter.", adaptedFilter);
Query query = Query.create(TABLE_ID).limit(100);
hooks.applyPreSendHook(query);
Assert.assertEquals(20, query.toProto(requestContext).getRowsLimit());
}
use of com.google.cloud.bigtable.hbase.adapters.read.DefaultReadHooks in project java-bigtable-hbase by googleapis.
the class TestWhileMatchFilterAdapter method notSupported_inChain_inInterleave.
@Test
public void notSupported_inChain_inInterleave() {
QualifierFilter qualifierFilter = new QualifierFilter(CompareOp.EQUAL, new BinaryComparator(Bytes.toBytes("x")));
WhileMatchFilter whileMatchFilter = new WhileMatchFilter(qualifierFilter);
FilterList chainList = new FilterList(Operator.MUST_PASS_ALL, whileMatchFilter);
FilterList interleaveList = new FilterList(Operator.MUST_PASS_ONE, chainList);
Scan scan = new Scan();
scan.setFilter(interleaveList);
FilterAdapterContext context = new FilterAdapterContext(scan, new DefaultReadHooks());
assertFalse(instance.isFilterSupported(context, whileMatchFilter).isSupported());
}
use of com.google.cloud.bigtable.hbase.adapters.read.DefaultReadHooks in project java-bigtable-hbase by googleapis.
the class TestWhileMatchFilterAdapter method notSupported_inInterleave_inChain.
@Test
public void notSupported_inInterleave_inChain() {
QualifierFilter qualifierFilter = new QualifierFilter(CompareOp.EQUAL, new BinaryComparator(Bytes.toBytes("x")));
WhileMatchFilter whileMatchFilter = new WhileMatchFilter(qualifierFilter);
FilterList interleaveList = new FilterList(Operator.MUST_PASS_ONE, whileMatchFilter);
FilterList chainList = new FilterList(Operator.MUST_PASS_ALL, interleaveList);
Scan scan = new Scan();
scan.setFilter(chainList);
FilterAdapterContext context = new FilterAdapterContext(scan, new DefaultReadHooks());
assertFalse(instance.isFilterSupported(context, whileMatchFilter).isSupported());
}
use of com.google.cloud.bigtable.hbase.adapters.read.DefaultReadHooks in project java-bigtable-hbase by googleapis.
the class TestWhileMatchFilterAdapter method wrappedFilterSupported.
@Test
public void wrappedFilterSupported() {
WhileMatchFilter filter = new WhileMatchFilter(new PageFilter(30));
Scan scan = new Scan();
scan.setFilter(filter);
FilterAdapterContext context = new FilterAdapterContext(scan, new DefaultReadHooks());
assertEquals(FilterSupportStatus.SUPPORTED, instance.isFilterSupported(context, filter));
}
Aggregations