use of com.google.cloud.bigtable.data.v2.models.Range.ByteStringRange in project java-bigtable by googleapis.
the class RangeTest method byteStringChangeEndTest.
@Test
public void byteStringChangeEndTest() {
ByteStringRange range = ByteStringRange.create(ByteString.copyFromUtf8("a"), ByteString.copyFromUtf8("z")).endClosed(ByteString.copyFromUtf8("y"));
assertThat(range.getStartBound()).isEqualTo(BoundType.CLOSED);
assertThat(range.getStart()).isEqualTo(ByteString.copyFromUtf8("a"));
assertThat(range.getEndBound()).isEqualTo(BoundType.CLOSED);
assertThat(range.getEnd()).isEqualTo(ByteString.copyFromUtf8("y"));
range = range.endOpen(ByteString.copyFromUtf8("x"));
assertThat(range.getEndBound()).isEqualTo(BoundType.OPEN);
assertThat(range.getEnd()).isEqualTo(ByteString.copyFromUtf8("x"));
assertThat(range.endOpen(ByteString.EMPTY).getEndBound()).isEqualTo(BoundType.UNBOUNDED);
assertThat(range.endClosed(ByteString.EMPTY).getEndBound()).isEqualTo(BoundType.UNBOUNDED);
}
use of com.google.cloud.bigtable.data.v2.models.Range.ByteStringRange in project java-bigtable by googleapis.
the class RangeTest method byteStringCloneTest.
@Test
public void byteStringCloneTest() {
ByteStringRange range = ByteStringRange.create("a", "original");
ByteStringRange rangeSame = range.endClosed("sameInstance");
ByteStringRange rangeClone = range.clone().endClosed("cloneInstance");
assertThat(range.getEnd().toStringUtf8()).isEqualTo("sameInstance");
assertThat(rangeSame.getEnd().toStringUtf8()).isEqualTo("sameInstance");
assertThat(rangeClone.getEnd().toStringUtf8()).isEqualTo("cloneInstance");
}
use of com.google.cloud.bigtable.data.v2.models.Range.ByteStringRange in project java-bigtable by googleapis.
the class RangeTest method byteStringChangeEndStringTest.
@Test
public void byteStringChangeEndStringTest() {
ByteStringRange range = ByteStringRange.create("a", "z").endClosed("y");
assertThat(range.getStartBound()).isEqualTo(BoundType.CLOSED);
assertThat(range.getStart()).isEqualTo(ByteString.copyFromUtf8("a"));
assertThat(range.getEndBound()).isEqualTo(BoundType.CLOSED);
assertThat(range.getEnd()).isEqualTo(ByteString.copyFromUtf8("y"));
range = range.endOpen("x");
assertThat(range.getEndBound()).isEqualTo(BoundType.OPEN);
assertThat(range.getEnd()).isEqualTo(ByteString.copyFromUtf8("x"));
assertThat(range.endOpen("").getEndBound()).isEqualTo(BoundType.UNBOUNDED);
assertThat(range.endClosed("").getEndBound()).isEqualTo(BoundType.UNBOUNDED);
}
use of com.google.cloud.bigtable.data.v2.models.Range.ByteStringRange in project java-bigtable by googleapis.
the class RowSetUtilTest method singleRangeUnbounded1BoundTest.
@Test
public void singleRangeUnbounded1BoundTest() {
RowSet rowSet = RowSet.newBuilder().addRowRanges(RowRange.newBuilder().setStartKeyClosed(ByteString.copyFromUtf8("a"))).build();
ByteStringRange actual = RowSetUtil.getBound(rowSet);
assertThat(actual).isEqualTo(ByteStringRange.unbounded().startClosed("a"));
}
use of com.google.cloud.bigtable.data.v2.models.Range.ByteStringRange in project java-bigtable by googleapis.
the class RowSetUtilTest method singleRangeUnbounded2BoundTest.
@Test
public void singleRangeUnbounded2BoundTest() {
RowSet rowSet = RowSet.newBuilder().addRowRanges(RowRange.newBuilder().setEndKeyClosed(ByteString.copyFromUtf8("z"))).build();
ByteStringRange actual = RowSetUtil.getBound(rowSet);
assertThat(actual).isEqualTo(ByteStringRange.unbounded().endClosed("z"));
}
Aggregations