use of com.google.cloud.bigtable.hbase.util.RowKeyWrapper in project java-bigtable-hbase by googleapis.
the class TestRowRangeAdapter method testSingleKeyRowSet.
@Test
public void testSingleKeyRowSet() {
ByteString key = ByteString.copyFromUtf8("myKey");
RowSet in = RowSet.newBuilder().addRowKeys(key).build();
RangeSet<RowKeyWrapper> out = adapter.rowSetToRangeSet(in);
RangeSet<RowKeyWrapper> expected = ImmutableRangeSet.<RowKeyWrapper>builder().add(Range.closed(new RowKeyWrapper(key), new RowKeyWrapper(key))).build();
assertEquals(expected, out);
adapter.rangeSetToByteStringRange(out, query);
assertEquals(in, query.toProto(requestContext).getRows());
}
use of com.google.cloud.bigtable.hbase.util.RowKeyWrapper in project java-bigtable-hbase by googleapis.
the class TestRowRangeAdapter method testSingleOpenRangeRowSet.
@Test
public void testSingleOpenRangeRowSet() {
ByteString key1 = ByteString.copyFromUtf8("myKey");
ByteString key2 = ByteString.copyFromUtf8("otherKey");
RowSet in = RowSet.newBuilder().addRowRanges(RowRange.newBuilder().setStartKeyOpen(key1).setEndKeyOpen(key2)).build();
RangeSet<RowKeyWrapper> out = adapter.rowSetToRangeSet(in);
RangeSet<RowKeyWrapper> expected = ImmutableRangeSet.<RowKeyWrapper>builder().add(Range.open(new RowKeyWrapper(key1), new RowKeyWrapper(key2))).build();
assertEquals(expected, out);
adapter.rangeSetToByteStringRange(out, query);
assertEquals(in, query.toProto(requestContext).getRows());
}
use of com.google.cloud.bigtable.hbase.util.RowKeyWrapper in project java-bigtable-hbase by googleapis.
the class TestRowRangeAdapter method testEmptyRowSet.
@Test
public void testEmptyRowSet() {
RowSet in = RowSet.newBuilder().build();
RangeSet<RowKeyWrapper> out = adapter.rowSetToRangeSet(in);
assertEquals(ImmutableRangeSet.builder().build(), out);
adapter.rangeSetToByteStringRange(out, query);
assertEquals(in, query.toProto(requestContext).getRows());
}
use of com.google.cloud.bigtable.hbase.util.RowKeyWrapper in project java-bigtable-hbase by googleapis.
the class TestRowRangeAdapter method testAllRowSet2.
@Test
public void testAllRowSet2() {
RowSet in = RowSet.newBuilder().addRowRanges(RowRange.newBuilder().setStartKeyClosed(ByteString.EMPTY).setEndKeyOpen(ByteString.EMPTY)).build();
RangeSet<RowKeyWrapper> out = adapter.rowSetToRangeSet(in);
RangeSet<RowKeyWrapper> expected = ImmutableRangeSet.<RowKeyWrapper>builder().add(Range.<RowKeyWrapper>all()).build();
assertEquals(expected, out);
// NOTE: this isn't symmetrical, ['','') is converted to its canonical form of unset bounds
}
Aggregations