Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ public ReadChangeStreamQuery continuationTokens(
}

/** Sets the heartbeat duration for the change stream. */
public ReadChangeStreamQuery heartbeatDuration(java.time.Duration duration) {
public ReadChangeStreamQuery heartbeatDuration(org.threeten.bp.Duration duration) {
builder.setHeartbeatDuration(
Duration.newBuilder()
.setSeconds(duration.getSeconds())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -152,11 +152,11 @@ public void endTimeTest() {
@Test
public void heartbeatDurationTest() {
ReadChangeStreamQuery query =
ReadChangeStreamQuery.create(TABLE_ID).heartbeatDuration(java.time.Duration.ofSeconds(5));
ReadChangeStreamQuery.create(TABLE_ID)
.heartbeatDuration(org.threeten.bp.Duration.ofSeconds(5));

Builder expectedProto =
expectedProtoBuilder()
.setHeartbeatDuration(com.google.protobuf.Duration.newBuilder().setSeconds(5).build());
expectedProtoBuilder().setHeartbeatDuration(Duration.newBuilder().setSeconds(5).build());

ReadChangeStreamRequest actualProto = query.toProto(requestContext);
assertThat(actualProto).isEqualTo(expectedProto.build());
Expand Down Expand Up @@ -232,7 +232,7 @@ public void serializationTest() throws IOException, ClassNotFoundException {
.streamPartition("simple-begin", "simple-end")
.continuationTokens(Collections.singletonList(token))
.endTime(FAKE_END_TIME)
.heartbeatDuration(java.time.Duration.ofSeconds(5));
.heartbeatDuration(org.threeten.bp.Duration.ofSeconds(5));

ByteArrayOutputStream bos = new ByteArrayOutputStream();
ObjectOutputStream oos = new ObjectOutputStream(bos);
Expand Down Expand Up @@ -302,7 +302,7 @@ public void testEquality() {
.streamPartition("simple-begin", "simple-end")
.startTime(FAKE_START_TIME)
.endTime(FAKE_END_TIME)
.heartbeatDuration(java.time.Duration.ofSeconds(5));
.heartbeatDuration(org.threeten.bp.Duration.ofSeconds(5));

// ReadChangeStreamQuery#toProto should not change the ReadChangeStreamQuery instance state
request.toProto(requestContext);
Expand All @@ -312,7 +312,7 @@ public void testEquality() {
.streamPartition("simple-begin", "simple-end")
.startTime(FAKE_START_TIME)
.endTime(FAKE_END_TIME)
.heartbeatDuration(java.time.Duration.ofSeconds(5)));
.heartbeatDuration(org.threeten.bp.Duration.ofSeconds(5)));

assertThat(ReadChangeStreamQuery.create(TABLE_ID).streamPartition("begin-1", "end-1"))
.isNotEqualTo(ReadChangeStreamQuery.create(TABLE_ID).streamPartition("begin-2", "end-1"));
Expand All @@ -324,10 +324,10 @@ public void testEquality() {
ReadChangeStreamQuery.create(TABLE_ID).endTime(Instant.ofEpochSecond(1L, 1001L)));
assertThat(
ReadChangeStreamQuery.create(TABLE_ID)
.heartbeatDuration(java.time.Duration.ofSeconds(5)))
.heartbeatDuration(org.threeten.bp.Duration.ofSeconds(5)))
.isNotEqualTo(
ReadChangeStreamQuery.create(TABLE_ID)
.heartbeatDuration(java.time.Duration.ofSeconds(6)));
.heartbeatDuration(org.threeten.bp.Duration.ofSeconds(6)));
}

@Test
Expand All @@ -350,7 +350,7 @@ public void testClone() {
.streamPartition("begin", "end")
.continuationTokens(Collections.singletonList(token))
.endTime(FAKE_END_TIME)
.heartbeatDuration(java.time.Duration.ofSeconds(5));
.heartbeatDuration(org.threeten.bp.Duration.ofSeconds(5));
ReadChangeStreamRequest request =
ReadChangeStreamRequest.newBuilder()
.setTableName(NameUtil.formatTableName(PROJECT_ID, INSTANCE_ID, TABLE_ID))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@
import com.google.cloud.bigtable.data.v2.models.ReadChangeStreamQuery;
import com.google.cloud.bigtable.gaxx.testing.FakeStreamingApi.ServerStreamingStashCallable;
import com.google.common.truth.Truth;
import java.time.Duration;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.JUnit4;
import org.threeten.bp.Duration;
import org.threeten.bp.Instant;

@RunWith(JUnit4.class)
Expand Down