diff --git a/google-cloud-bigtable/clirr-ignored-differences.xml b/google-cloud-bigtable/clirr-ignored-differences.xml
index a3dc564c44..748848c8fa 100644
--- a/google-cloud-bigtable/clirr-ignored-differences.xml
+++ b/google-cloud-bigtable/clirr-ignored-differences.xml
@@ -275,4 +275,25 @@
com/google/cloud/bigtable/data/v2/stub/metrics/DefaultMetricsProvider
*
+
+
+ 7006
+ com/google/cloud/bigtable/data/v2/internal/*
+ *getTimestamp(*)
+ java.time.Instant
+
+
+
+ 7006
+ com/google/cloud/bigtable/data/v2/models/sql/StructReader
+ *getTimestamp(*)
+ java.time.Instant
+
+
+
+ 7005
+ com/google/cloud/bigtable/data/v2/models/sql/Statement$Builder
+ *setTimestampParam(java.lang.String, org.threeten.bp.Instant)
+ *setTimestampParam(java.lang.String, java.time.Instant)
+
diff --git a/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/common/Type.java b/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/common/Type.java
index df5c6dcd95..cd6a0a5407 100644
--- a/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/common/Type.java
+++ b/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/common/Type.java
@@ -23,8 +23,8 @@
import com.google.common.base.Objects;
import com.google.common.collect.ImmutableList;
import com.google.protobuf.ByteString;
+import java.time.Instant;
import java.util.List;
-import org.threeten.bp.Instant;
/**
* Shared type implementations. Right now this is only used by SqlType but this will become a shared
diff --git a/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/BigtableDataSettings.java b/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/BigtableDataSettings.java
index 25ff2ff30d..ad1e70ba6a 100644
--- a/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/BigtableDataSettings.java
+++ b/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/BigtableDataSettings.java
@@ -39,7 +39,6 @@
import java.util.logging.Logger;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
-import org.threeten.bp.Duration;
/**
* Settings class to configure an instance of {@link BigtableDataClient}.
@@ -134,9 +133,11 @@ public static Builder newBuilderForEmulator(String hostname, int port) {
.setMaxInboundMessageSize(256 * 1024 * 1024)
.setChannelPoolSettings(ChannelPoolSettings.staticallySized(1))
.setChannelConfigurator(ManagedChannelBuilder::usePlaintext)
- .setKeepAliveTime(Duration.ofSeconds(61)) // sends ping in this interval
- .setKeepAliveTimeout(
- Duration.ofSeconds(10)) // wait this long before considering the connection dead
+ .setKeepAliveTimeDuration(
+ java.time.Duration.ofSeconds(61)) // sends ping in this interval
+ .setKeepAliveTimeoutDuration(
+ java.time.Duration.ofSeconds(
+ 10)) // wait this long before considering the connection dead
.build());
LOGGER.info("Connecting to the Bigtable emulator at " + hostname + ":" + port);
diff --git a/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/internal/AbstractProtoStructReader.java b/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/internal/AbstractProtoStructReader.java
index dff4d4e0b2..2a74fccd22 100644
--- a/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/internal/AbstractProtoStructReader.java
+++ b/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/internal/AbstractProtoStructReader.java
@@ -25,12 +25,12 @@
import com.google.common.base.Preconditions;
import com.google.protobuf.ByteString;
import com.google.protobuf.Timestamp;
+import java.time.Instant;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
-import org.threeten.bp.Instant;
@InternalApi
public abstract class AbstractProtoStructReader implements StructReader {
diff --git a/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/internal/ResultSetImpl.java b/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/internal/ResultSetImpl.java
index 1d2bd37f2d..53044c3b37 100644
--- a/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/internal/ResultSetImpl.java
+++ b/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/internal/ResultSetImpl.java
@@ -28,10 +28,10 @@
import com.google.cloud.bigtable.data.v2.stub.sql.SqlServerStream;
import com.google.common.base.Preconditions;
import com.google.protobuf.ByteString;
+import java.time.Instant;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
-import org.threeten.bp.Instant;
/**
* The primary implementation of a ResultSet.
diff --git a/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/models/ChangeStreamMutation.java b/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/models/ChangeStreamMutation.java
index 23fb47bd82..1defc67c5e 100644
--- a/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/models/ChangeStreamMutation.java
+++ b/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/models/ChangeStreamMutation.java
@@ -15,7 +15,11 @@
*/
package com.google.cloud.bigtable.data.v2.models;
+import static com.google.api.gax.util.TimeConversionUtils.toJavaTimeInstant;
+import static com.google.api.gax.util.TimeConversionUtils.toThreetenInstant;
+
import com.google.api.core.InternalApi;
+import com.google.api.core.ObsoleteApi;
import com.google.auto.value.AutoValue;
import com.google.cloud.bigtable.data.v2.models.Range.TimestampRange;
import com.google.cloud.bigtable.data.v2.stub.changestream.ChangeStreamRecordMerger;
@@ -23,7 +27,6 @@
import com.google.protobuf.ByteString;
import java.io.Serializable;
import javax.annotation.Nonnull;
-import org.threeten.bp.Instant;
/**
* A ChangeStreamMutation represents a list of mods(represented by List<{@link Entry}>) targeted at
@@ -73,13 +76,13 @@ public enum MutationType {
static Builder createUserMutation(
@Nonnull ByteString rowKey,
@Nonnull String sourceClusterId,
- Instant commitTimestamp,
+ java.time.Instant commitTimestamp,
int tieBreaker) {
return builder()
.setRowKey(rowKey)
.setType(MutationType.USER)
.setSourceClusterId(sourceClusterId)
- .setCommitTimestamp(commitTimestamp)
+ .setCommitTime(commitTimestamp)
.setTieBreaker(tieBreaker);
}
@@ -89,12 +92,12 @@ static Builder createUserMutation(
* mutation.
*/
static Builder createGcMutation(
- @Nonnull ByteString rowKey, Instant commitTimestamp, int tieBreaker) {
+ @Nonnull ByteString rowKey, java.time.Instant commitTimestamp, int tieBreaker) {
return builder()
.setRowKey(rowKey)
.setType(MutationType.GARBAGE_COLLECTION)
.setSourceClusterId("")
- .setCommitTimestamp(commitTimestamp)
+ .setCommitTime(commitTimestamp)
.setTieBreaker(tieBreaker);
}
@@ -110,8 +113,14 @@ static Builder createGcMutation(
@Nonnull
public abstract String getSourceClusterId();
+ /** This method is obsolete. Use {@link #getCommitTime()} instead. */
+ @ObsoleteApi("Use getCommitTime() instead")
+ public abstract org.threeten.bp.Instant getCommitTimestamp();
+
/** Get the commit timestamp of the current mutation. */
- public abstract Instant getCommitTimestamp();
+ public java.time.Instant getCommitTime() {
+ return toJavaTimeInstant(getCommitTimestamp());
+ }
/**
* Get the tie breaker of the current mutation. This is used to resolve conflicts when multiple
@@ -123,8 +132,14 @@ static Builder createGcMutation(
@Nonnull
public abstract String getToken();
+ /** This method is obsolete. Use {@link #getEstimatedLowWatermarkTime()} instead. */
+ @ObsoleteApi("Use getEstimatedLowWatermarkTime() instead")
+ public abstract org.threeten.bp.Instant getEstimatedLowWatermark();
+
/** Get the low watermark of the current mutation. */
- public abstract Instant getEstimatedLowWatermark();
+ public java.time.Instant getEstimatedLowWatermarkTime() {
+ return toJavaTimeInstant(getEstimatedLowWatermark());
+ }
/** Get the list of mods of the current mutation. */
@Nonnull
@@ -145,7 +160,13 @@ abstract static class Builder {
abstract Builder setSourceClusterId(@Nonnull String sourceClusterId);
- abstract Builder setCommitTimestamp(Instant commitTimestamp);
+ Builder setCommitTime(java.time.Instant commitTimestamp) {
+ return setCommitTimestamp(toThreetenInstant(commitTimestamp));
+ }
+
+ /** This method is obsolete. Use {@link #setCommitTime(java.time.Instant)} instead. */
+ @ObsoleteApi("Use setCommitTime(java.time.Instant) instead")
+ abstract Builder setCommitTimestamp(org.threeten.bp.Instant commitTimestamp);
abstract Builder setTieBreaker(int tieBreaker);
@@ -153,7 +174,13 @@ abstract static class Builder {
abstract Builder setToken(@Nonnull String token);
- abstract Builder setEstimatedLowWatermark(Instant estimatedLowWatermark);
+ Builder setLowWatermarkTime(java.time.Instant estimatedLowWatermark) {
+ return setEstimatedLowWatermark(toThreetenInstant(estimatedLowWatermark));
+ }
+
+ /** This method is obsolete. Use {@link #setLowWatermarkTime(java.time.Instant)} instead. */
+ @ObsoleteApi("Use setEstimatedLowWatermarkInstant(java.time.Instant) instead")
+ abstract Builder setEstimatedLowWatermark(org.threeten.bp.Instant estimatedLowWatermark);
Builder setCell(
@Nonnull String familyName,
diff --git a/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/models/ChangeStreamRecordAdapter.java b/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/models/ChangeStreamRecordAdapter.java
index 40a71b1d3c..9b892b14ea 100644
--- a/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/models/ChangeStreamRecordAdapter.java
+++ b/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/models/ChangeStreamRecordAdapter.java
@@ -19,8 +19,8 @@
import com.google.bigtable.v2.ReadChangeStreamResponse;
import com.google.cloud.bigtable.data.v2.models.Range.TimestampRange;
import com.google.protobuf.ByteString;
+import java.time.Instant;
import javax.annotation.Nonnull;
-import org.threeten.bp.Instant;
/**
* An extension point that allows end users to plug in a custom implementation of logical change
diff --git a/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/models/DefaultChangeStreamRecordAdapter.java b/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/models/DefaultChangeStreamRecordAdapter.java
index d40ad7621c..217caa93f2 100644
--- a/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/models/DefaultChangeStreamRecordAdapter.java
+++ b/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/models/DefaultChangeStreamRecordAdapter.java
@@ -20,9 +20,9 @@
import com.google.cloud.bigtable.data.v2.models.Range.TimestampRange;
import com.google.common.base.Preconditions;
import com.google.protobuf.ByteString;
+import java.time.Instant;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
-import org.threeten.bp.Instant;
/**
* Default implementation of a {@link ChangeStreamRecordAdapter} that uses {@link
@@ -112,8 +112,7 @@ public void startUserMutation(
/** {@inheritDoc} */
@Override
- public void startGcMutation(
- @Nonnull ByteString rowKey, Instant commitTimestamp, int tieBreaker) {
+ public void startGcMutation(ByteString rowKey, Instant commitTimestamp, int tieBreaker) {
this.changeStreamMutationBuilder =
ChangeStreamMutation.createGcMutation(rowKey, commitTimestamp, tieBreaker);
}
@@ -176,9 +175,9 @@ public void finishCell() {
/** {@inheritDoc} */
@Override
public ChangeStreamRecord finishChangeStreamMutation(
- @Nonnull String token, Instant estimatedLowWatermark) {
+ String token, Instant estimatedLowWatermark) {
this.changeStreamMutationBuilder.setToken(token);
- this.changeStreamMutationBuilder.setEstimatedLowWatermark(estimatedLowWatermark);
+ this.changeStreamMutationBuilder.setLowWatermarkTime(estimatedLowWatermark);
return this.changeStreamMutationBuilder.build();
}
diff --git a/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/models/Heartbeat.java b/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/models/Heartbeat.java
index 8e3d865790..0cf792ee1b 100644
--- a/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/models/Heartbeat.java
+++ b/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/models/Heartbeat.java
@@ -15,12 +15,15 @@
*/
package com.google.cloud.bigtable.data.v2.models;
+import static com.google.api.gax.util.TimeConversionUtils.toJavaTimeInstant;
+import static com.google.api.gax.util.TimeConversionUtils.toThreetenInstant;
+
import com.google.api.core.InternalApi;
+import com.google.api.core.ObsoleteApi;
import com.google.auto.value.AutoValue;
import com.google.bigtable.v2.ReadChangeStreamResponse;
import java.io.Serializable;
import javax.annotation.Nonnull;
-import org.threeten.bp.Instant;
/** A simple wrapper for {@link ReadChangeStreamResponse.Heartbeat}. */
@InternalApi("Intended for use by the BigtableIO in apache/beam only.")
@@ -29,15 +32,17 @@ public abstract class Heartbeat implements ChangeStreamRecord, Serializable {
private static final long serialVersionUID = 7316215828353608504L;
private static Heartbeat create(
- ChangeStreamContinuationToken changeStreamContinuationToken, Instant estimatedLowWatermark) {
- return new AutoValue_Heartbeat(changeStreamContinuationToken, estimatedLowWatermark);
+ ChangeStreamContinuationToken changeStreamContinuationToken,
+ java.time.Instant estimatedLowWatermark) {
+ return new AutoValue_Heartbeat(
+ changeStreamContinuationToken, toThreetenInstant(estimatedLowWatermark));
}
/** Wraps the protobuf {@link ReadChangeStreamResponse.Heartbeat}. */
static Heartbeat fromProto(@Nonnull ReadChangeStreamResponse.Heartbeat heartbeat) {
return create(
ChangeStreamContinuationToken.fromProto(heartbeat.getContinuationToken()),
- Instant.ofEpochSecond(
+ java.time.Instant.ofEpochSecond(
heartbeat.getEstimatedLowWatermark().getSeconds(),
heartbeat.getEstimatedLowWatermark().getNanos()));
}
@@ -45,6 +50,12 @@ static Heartbeat fromProto(@Nonnull ReadChangeStreamResponse.Heartbeat heartbeat
@InternalApi("Intended for use by the BigtableIO in apache/beam only.")
public abstract ChangeStreamContinuationToken getChangeStreamContinuationToken();
+ /** This method is obsolete. Use {@link #getEstimatedLowWatermarkInstant()} instead. */
+ @ObsoleteApi("Use getEstimatedLowWatermarkInstant() instead")
+ public abstract org.threeten.bp.Instant getEstimatedLowWatermark();
+
@InternalApi("Intended for use by the BigtableIO in apache/beam only.")
- public abstract Instant getEstimatedLowWatermark();
+ public java.time.Instant getEstimatedLowWatermarkInstant() {
+ return toJavaTimeInstant(getEstimatedLowWatermark());
+ }
}
diff --git a/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/models/ReadChangeStreamQuery.java b/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/models/ReadChangeStreamQuery.java
index a6dfb7666d..2c9cf54354 100644
--- a/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/models/ReadChangeStreamQuery.java
+++ b/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/models/ReadChangeStreamQuery.java
@@ -15,7 +15,11 @@
*/
package com.google.cloud.bigtable.data.v2.models;
+import static com.google.api.gax.util.TimeConversionUtils.toJavaTimeDuration;
+import static com.google.api.gax.util.TimeConversionUtils.toJavaTimeInstant;
+
import com.google.api.core.InternalApi;
+import com.google.api.core.ObsoleteApi;
import com.google.bigtable.v2.ReadChangeStreamRequest;
import com.google.bigtable.v2.RowRange;
import com.google.bigtable.v2.StreamContinuationTokens;
@@ -36,7 +40,6 @@
import java.util.List;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
-import org.threeten.bp.Instant;
/** A simple wrapper to construct a query for the ReadChangeStream RPC. */
@InternalApi("Intended for use by the BigtableIO in apache/beam only.")
@@ -143,8 +146,14 @@ public ReadChangeStreamQuery streamPartition(ByteStringRange range) {
return streamPartition(rangeBuilder.build());
}
+ /** This method is obsolete. Use {@link #startTime(java.time.Instant)} instead. */
+ @ObsoleteApi("Use startTime(java.time.Instant) instead")
+ public ReadChangeStreamQuery startTime(org.threeten.bp.Instant value) {
+ return startTime(toJavaTimeInstant(value));
+ }
+
/** Sets the startTime to read the change stream. */
- public ReadChangeStreamQuery startTime(Instant value) {
+ public ReadChangeStreamQuery startTime(java.time.Instant value) {
Preconditions.checkState(
!builder.hasContinuationTokens(),
"startTime and continuationTokens can't be specified together");
@@ -156,8 +165,14 @@ public ReadChangeStreamQuery startTime(Instant value) {
return this;
}
+ /** This method is obsolete. Use {@link #endTime(java.time.Instant)} instead. */
+ @ObsoleteApi("Use endTime(java.time.Instant) instead")
+ public ReadChangeStreamQuery endTime(org.threeten.bp.Instant value) {
+ return endTime(toJavaTimeInstant(value));
+ }
+
/** Sets the endTime to read the change stream. */
- public ReadChangeStreamQuery endTime(Instant value) {
+ public ReadChangeStreamQuery endTime(java.time.Instant value) {
builder.setEndTime(
Timestamp.newBuilder()
.setSeconds(value.getEpochSecond())
@@ -181,8 +196,14 @@ public ReadChangeStreamQuery continuationTokens(
return this;
}
- /** Sets the heartbeat duration for the change stream. */
+ /** This method is obsolete. Use {@link #heartbeatDuration(java.time.Duration)} instead. */
+ @ObsoleteApi("Use heartbeatDuration(java.time.Duration) instead")
public ReadChangeStreamQuery heartbeatDuration(org.threeten.bp.Duration duration) {
+ return heartbeatDuration(toJavaTimeDuration(duration));
+ }
+
+ /** Sets the heartbeat duration for the change stream. */
+ public ReadChangeStreamQuery heartbeatDuration(java.time.Duration duration) {
builder.setHeartbeatDuration(
Duration.newBuilder()
.setSeconds(duration.getSeconds())
diff --git a/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/models/sql/SqlType.java b/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/models/sql/SqlType.java
index 50146f292a..d4d3261dcf 100644
--- a/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/models/sql/SqlType.java
+++ b/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/models/sql/SqlType.java
@@ -23,8 +23,8 @@
import com.google.cloud.bigtable.common.Type.StructWithSchema;
import com.google.protobuf.ByteString;
import java.io.Serializable;
+import java.time.Instant;
import java.util.List;
-import org.threeten.bp.Instant;
/**
* Represents a data type in a SQL query.
diff --git a/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/models/sql/Statement.java b/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/models/sql/Statement.java
index 58c16e2c5c..c1831219a6 100644
--- a/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/models/sql/Statement.java
+++ b/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/models/sql/Statement.java
@@ -27,11 +27,11 @@
import com.google.common.collect.ImmutableMap;
import com.google.protobuf.ByteString;
import com.google.protobuf.Timestamp;
+import java.time.Instant;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.annotation.Nullable;
-import org.threeten.bp.Instant;
/**
* A SQL statement that can be executed by calling {@link
diff --git a/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/models/sql/StructReader.java b/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/models/sql/StructReader.java
index 8f450bbd92..f127b6b54c 100644
--- a/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/models/sql/StructReader.java
+++ b/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/models/sql/StructReader.java
@@ -18,9 +18,9 @@
import com.google.api.core.BetaApi;
import com.google.cloud.Date;
import com.google.protobuf.ByteString;
+import java.time.Instant;
import java.util.List;
import java.util.Map;
-import org.threeten.bp.Instant;
/**
* An interface for reading the columns of a {@code Struct} or {@code
diff --git a/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/stub/RateLimitingServerStreamingCallable.java b/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/stub/RateLimitingServerStreamingCallable.java
index 62f8b5abf6..c3b0f94ec7 100644
--- a/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/stub/RateLimitingServerStreamingCallable.java
+++ b/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/stub/RateLimitingServerStreamingCallable.java
@@ -30,13 +30,13 @@
import com.google.common.base.Preconditions;
import com.google.common.base.Stopwatch;
import com.google.common.util.concurrent.RateLimiter;
+import java.time.Duration;
+import java.time.Instant;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.concurrent.atomic.AtomicReference;
import java.util.logging.Logger;
import javax.annotation.Nonnull;
-import org.threeten.bp.Duration;
-import org.threeten.bp.Instant;
class RateLimitingServerStreamingCallable
extends ServerStreamingCallable {
diff --git a/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/stub/changestream/ChangeStreamStateMachine.java b/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/stub/changestream/ChangeStreamStateMachine.java
index b41acc4ac3..27cb6f1478 100644
--- a/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/stub/changestream/ChangeStreamStateMachine.java
+++ b/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/stub/changestream/ChangeStreamStateMachine.java
@@ -22,7 +22,6 @@
import com.google.cloud.bigtable.data.v2.models.Range.TimestampRange;
import com.google.cloud.bigtable.data.v2.models.Value;
import com.google.common.base.Preconditions;
-import org.threeten.bp.Instant;
/**
* A state machine to produce change stream records from a stream of {@link
@@ -334,7 +333,7 @@ State handleDataChange(ReadChangeStreamResponse.DataChange dataChange) {
"AWAITING_NEW_STREAM_RECORD: GC mutation shouldn't have source cluster id.");
builder.startGcMutation(
dataChange.getRowKey(),
- Instant.ofEpochSecond(
+ java.time.Instant.ofEpochSecond(
dataChange.getCommitTimestamp().getSeconds(),
dataChange.getCommitTimestamp().getNanos()),
dataChange.getTiebreaker());
@@ -345,7 +344,7 @@ State handleDataChange(ReadChangeStreamResponse.DataChange dataChange) {
builder.startUserMutation(
dataChange.getRowKey(),
dataChange.getSourceClusterId(),
- Instant.ofEpochSecond(
+ java.time.Instant.ofEpochSecond(
dataChange.getCommitTimestamp().getSeconds(),
dataChange.getCommitTimestamp().getNanos()),
dataChange.getTiebreaker());
@@ -578,7 +577,7 @@ private State checkAndFinishMutationIfNeeded(ReadChangeStreamResponse.DataChange
completeChangeStreamRecord =
builder.finishChangeStreamMutation(
dataChange.getToken(),
- Instant.ofEpochSecond(
+ java.time.Instant.ofEpochSecond(
dataChange.getEstimatedLowWatermark().getSeconds(),
dataChange.getEstimatedLowWatermark().getNanos()));
return AWAITING_STREAM_RECORD_CONSUME;
diff --git a/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/stub/metrics/BigtableCloudMonitoringExporter.java b/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/stub/metrics/BigtableCloudMonitoringExporter.java
index ff5bcd81c1..28dc981730 100644
--- a/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/stub/metrics/BigtableCloudMonitoringExporter.java
+++ b/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/stub/metrics/BigtableCloudMonitoringExporter.java
@@ -65,7 +65,6 @@
import java.util.logging.Logger;
import java.util.stream.Collectors;
import javax.annotation.Nullable;
-import org.threeten.bp.Duration;
/**
* Bigtable Cloud Monitoring OpenTelemetry Exporter.
@@ -144,10 +143,10 @@ public static BigtableCloudMonitoringExporter create(
settingsBuilder.setEndpoint(endpoint);
}
- org.threeten.bp.Duration timeout = Duration.ofMinutes(1);
+ java.time.Duration timeout = java.time.Duration.ofMinutes(1);
// TODO: createServiceTimeSeries needs special handling if the request failed. Leaving
// it as not retried for now.
- settingsBuilder.createServiceTimeSeriesSettings().setSimpleTimeoutNoRetries(timeout);
+ settingsBuilder.createServiceTimeSeriesSettings().setSimpleTimeoutNoRetriesDuration(timeout);
// Detect the resource that the client application is running on. For example,
// this could be a GCE instance or a GKE pod. Currently, we only support GCE instance and
diff --git a/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/stub/metrics/BuiltinMetricsTracer.java b/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/stub/metrics/BuiltinMetricsTracer.java
index 4683ff9c8e..d2cd501de0 100644
--- a/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/stub/metrics/BuiltinMetricsTracer.java
+++ b/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/stub/metrics/BuiltinMetricsTracer.java
@@ -33,6 +33,7 @@
import io.opentelemetry.api.common.Attributes;
import io.opentelemetry.api.metrics.DoubleHistogram;
import io.opentelemetry.api.metrics.LongCounter;
+import java.time.Duration;
import java.util.concurrent.CancellationException;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicBoolean;
@@ -40,7 +41,6 @@
import java.util.concurrent.atomic.AtomicLong;
import java.util.logging.Logger;
import javax.annotation.Nullable;
-import org.threeten.bp.Duration;
/**
* A {@link BigtableTracer} that records built-in metrics and publish under the
@@ -201,7 +201,7 @@ public void attemptCancelled() {
}
@Override
- public void attemptFailed(Throwable error, Duration delay) {
+ public void attemptFailedDuration(Throwable error, Duration delay) {
recordAttemptCompletion(error);
}
@@ -291,7 +291,7 @@ public void setLocations(String zone, String cluster) {
@Override
public void batchRequestThrottled(long throttledTimeNanos) {
- totalClientBlockingTime.addAndGet(Duration.ofNanos(throttledTimeNanos).toMillis());
+ totalClientBlockingTime.addAndGet(java.time.Duration.ofNanos(throttledTimeNanos).toMillis());
}
@Override
diff --git a/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/stub/metrics/CompositeTracer.java b/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/stub/metrics/CompositeTracer.java
index 7882c82d93..f355fc9047 100644
--- a/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/stub/metrics/CompositeTracer.java
+++ b/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/stub/metrics/CompositeTracer.java
@@ -20,7 +20,6 @@
import java.util.ArrayList;
import java.util.List;
import javax.annotation.Nullable;
-import org.threeten.bp.Duration;
/**
* Combines multiple {@link ApiTracer}s and {@link BigtableTracer}s into a single {@link ApiTracer}.
@@ -124,9 +123,10 @@ public void attemptCancelled() {
}
}
- public void attemptFailed(Throwable error, Duration delay) {
+ @Override
+ public void attemptFailedDuration(Throwable error, java.time.Duration delay) {
for (ApiTracer child : children) {
- child.attemptFailed(error, delay);
+ child.attemptFailedDuration(error, delay);
}
}
diff --git a/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/stub/metrics/MetricsTracer.java b/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/stub/metrics/MetricsTracer.java
index a2c5bdac1f..59ec1c8594 100644
--- a/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/stub/metrics/MetricsTracer.java
+++ b/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/stub/metrics/MetricsTracer.java
@@ -32,7 +32,6 @@
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicBoolean;
import javax.annotation.Nullable;
-import org.threeten.bp.Duration;
class MetricsTracer extends BigtableTracer {
@@ -153,7 +152,7 @@ public void attemptCancelled() {
}
@Override
- public void attemptFailed(Throwable throwable, Duration duration) {
+ public void attemptFailedDuration(Throwable throwable, java.time.Duration duration) {
recordAttemptCompletion(throwable);
}
diff --git a/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/stub/metrics/TracedBatcherUnaryCallable.java b/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/stub/metrics/TracedBatcherUnaryCallable.java
index ce73d75dc1..44ba688d55 100644
--- a/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/stub/metrics/TracedBatcherUnaryCallable.java
+++ b/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/stub/metrics/TracedBatcherUnaryCallable.java
@@ -21,7 +21,6 @@
import com.google.api.gax.rpc.ApiCallContext;
import com.google.api.gax.rpc.UnaryCallable;
import com.google.api.gax.tracing.ApiTracer;
-import org.threeten.bp.Duration;
/**
* This callable will extract total throttled time from {@link ApiCallContext} and add it to {@link
@@ -44,7 +43,8 @@ public ApiFuture futureCall(RequestT request, ApiCallContext context)
if (tracer instanceof BigtableTracer) {
((BigtableTracer) tracer)
.batchRequestThrottled(
- Duration.ofMillis(context.getOption(Batcher.THROTTLED_TIME_KEY)).toNanos());
+ java.time.Duration.ofMillis(context.getOption(Batcher.THROTTLED_TIME_KEY))
+ .toNanos());
}
}
return innerCallable.futureCall(request, context);
diff --git a/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/gaxx/retrying/AttemptCallable.java b/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/gaxx/retrying/AttemptCallable.java
index 3599e1e4df..6d5c75ea99 100644
--- a/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/gaxx/retrying/AttemptCallable.java
+++ b/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/gaxx/retrying/AttemptCallable.java
@@ -24,7 +24,6 @@
import com.google.api.gax.rpc.UnaryCallable;
import com.google.common.base.Preconditions;
import java.util.concurrent.Callable;
-import org.threeten.bp.Duration;
// TODO: remove this once ApiResultRetryAlgorithm is added to gax.
/**
@@ -59,9 +58,9 @@ public ResponseT call() {
try {
// Set the RPC timeout if the caller did not provide their own.
- Duration rpcTimeout = externalFuture.getAttemptSettings().getRpcTimeout();
+ java.time.Duration rpcTimeout = externalFuture.getAttemptSettings().getRpcTimeoutDuration();
if (!rpcTimeout.isZero() && callContext.getTimeout() == null) {
- callContext = callContext.withTimeout(rpcTimeout);
+ callContext = callContext.withTimeoutDuration(rpcTimeout);
}
externalFuture.setAttemptFuture(new NonCancellableFuture());
diff --git a/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/gaxx/retrying/RetryInfoRetryAlgorithm.java b/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/gaxx/retrying/RetryInfoRetryAlgorithm.java
index 085b48bbb5..98e549cee1 100644
--- a/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/gaxx/retrying/RetryInfoRetryAlgorithm.java
+++ b/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/gaxx/retrying/RetryInfoRetryAlgorithm.java
@@ -22,8 +22,7 @@
import com.google.api.gax.rpc.ApiException;
import com.google.protobuf.util.Durations;
import com.google.rpc.RetryInfo;
-import org.checkerframework.checker.nullness.qual.Nullable;
-import org.threeten.bp.Duration;
+import javax.annotation.Nullable;
// TODO move this algorithm to gax
/**
@@ -36,11 +35,11 @@ public class RetryInfoRetryAlgorithm extends BasicResultRetryAlgorith
@Override
public TimedAttemptSettings createNextAttempt(
Throwable prevThrowable, ResponseT prevResponse, TimedAttemptSettings prevSettings) {
- Duration retryDelay = extractRetryDelay(prevThrowable);
+ java.time.Duration retryDelay = extractRetryDelay(prevThrowable);
if (retryDelay != null) {
return prevSettings
.toBuilder()
- .setRandomizedRetryDelay(retryDelay)
+ .setRandomizedRetryDelayDuration(retryDelay)
.setAttemptCount(prevSettings.getAttemptCount() + 1)
.setOverallAttemptCount(prevSettings.getAttemptCount() + 1)
.build();
@@ -81,8 +80,7 @@ public boolean shouldRetry(
&& ((ApiException) previousThrowable).isRetryable();
}
- @Nullable
- static Duration extractRetryDelay(@Nullable Throwable throwable) {
+ static java.time.Duration extractRetryDelay(@Nullable Throwable throwable) {
if (throwable == null) {
return null;
}
@@ -97,6 +95,6 @@ static Duration extractRetryDelay(@Nullable Throwable throwable) {
return null;
}
RetryInfo retryInfo = exception.getErrorDetails().getRetryInfo();
- return Duration.ofMillis(Durations.toMillis(retryInfo.getRetryDelay()));
+ return java.time.Duration.ofMillis(Durations.toMillis(retryInfo.getRetryDelay()));
}
}
diff --git a/google-cloud-bigtable/src/test/java/com/google/cloud/bigtable/admin/v2/BigtableInstanceAdminSettingsTest.java b/google-cloud-bigtable/src/test/java/com/google/cloud/bigtable/admin/v2/BigtableInstanceAdminSettingsTest.java
index 7ac632f29b..fbdab21d3f 100644
--- a/google-cloud-bigtable/src/test/java/com/google/cloud/bigtable/admin/v2/BigtableInstanceAdminSettingsTest.java
+++ b/google-cloud-bigtable/src/test/java/com/google/cloud/bigtable/admin/v2/BigtableInstanceAdminSettingsTest.java
@@ -22,11 +22,11 @@
import com.google.api.gax.rpc.StatusCode.Code;
import com.google.cloud.bigtable.admin.v2.stub.BigtableInstanceAdminStubSettings;
import java.io.IOException;
+import java.time.Duration;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.JUnit4;
import org.mockito.Mockito;
-import org.threeten.bp.Duration;
@RunWith(JUnit4.class)
public class BigtableInstanceAdminSettingsTest {
@@ -139,7 +139,7 @@ public void testToString() throws IOException {
stubSettings
.getInstanceSettings()
.setRetrySettings(
- RetrySettings.newBuilder().setTotalTimeout(Duration.ofMinutes(812)).build());
+ RetrySettings.newBuilder().setTotalTimeoutDuration(Duration.ofMinutes(812)).build());
BigtableInstanceAdminSettings settings = builder.build();
checkToString(settings);
diff --git a/google-cloud-bigtable/src/test/java/com/google/cloud/bigtable/admin/v2/BigtableTableAdminClientTests.java b/google-cloud-bigtable/src/test/java/com/google/cloud/bigtable/admin/v2/BigtableTableAdminClientTests.java
index 0ba472f783..15713b17f1 100644
--- a/google-cloud-bigtable/src/test/java/com/google/cloud/bigtable/admin/v2/BigtableTableAdminClientTests.java
+++ b/google-cloud-bigtable/src/test/java/com/google/cloud/bigtable/admin/v2/BigtableTableAdminClientTests.java
@@ -368,6 +368,8 @@ public void testUpdateTable() {
assertThat(actualResult.getId()).isEqualTo(TABLE_ID);
assertThat(actualResult.getChangeStreamRetention())
.isEqualTo(org.threeten.bp.Duration.ofHours(24));
+ assertThat(actualResult.getChangeStreamRetention().toMillis())
+ .isEqualTo(actualResult.getChangeStreamRetention().toMillis());
}
@Test
@@ -1015,6 +1017,7 @@ public void testCopyBackup() {
String srcTableId = "src-table";
String srcClusterId = "src-cluster";
String srcBackupId = "src-backup";
+
Instant expireTime = Instant.now().plus(org.threeten.bp.Duration.ofDays(15));
long sizeBytes = 123456789;
diff --git a/google-cloud-bigtable/src/test/java/com/google/cloud/bigtable/admin/v2/BigtableTableAdminSettingsTest.java b/google-cloud-bigtable/src/test/java/com/google/cloud/bigtable/admin/v2/BigtableTableAdminSettingsTest.java
index 506f73700b..451454c735 100644
--- a/google-cloud-bigtable/src/test/java/com/google/cloud/bigtable/admin/v2/BigtableTableAdminSettingsTest.java
+++ b/google-cloud-bigtable/src/test/java/com/google/cloud/bigtable/admin/v2/BigtableTableAdminSettingsTest.java
@@ -31,7 +31,6 @@
import org.junit.runner.RunWith;
import org.junit.runners.JUnit4;
import org.mockito.Mockito;
-import org.threeten.bp.Duration;
@RunWith(JUnit4.class)
public class BigtableTableAdminSettingsTest {
@@ -165,7 +164,9 @@ public void testToString() throws IOException {
stubSettings
.getBackupSettings()
.setRetrySettings(
- RetrySettings.newBuilder().setTotalTimeout(Duration.ofMinutes(812)).build());
+ RetrySettings.newBuilder()
+ .setTotalTimeoutDuration(java.time.Duration.ofMinutes(812))
+ .build());
BigtableTableAdminSettings settings = builder.build();
checkToString(settings);
diff --git a/google-cloud-bigtable/src/test/java/com/google/cloud/bigtable/admin/v2/stub/AwaitConsistencyCallableTest.java b/google-cloud-bigtable/src/test/java/com/google/cloud/bigtable/admin/v2/stub/AwaitConsistencyCallableTest.java
index 2628cdf224..db199950ce 100644
--- a/google-cloud-bigtable/src/test/java/com/google/cloud/bigtable/admin/v2/stub/AwaitConsistencyCallableTest.java
+++ b/google-cloud-bigtable/src/test/java/com/google/cloud/bigtable/admin/v2/stub/AwaitConsistencyCallableTest.java
@@ -35,6 +35,7 @@
import com.google.bigtable.admin.v2.TableName;
import com.google.cloud.bigtable.admin.v2.models.ConsistencyRequest;
import com.google.cloud.bigtable.data.v2.internal.TableAdminRequestContext;
+import java.time.Duration;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.TimeUnit;
import org.junit.Before;
@@ -47,7 +48,6 @@
import org.mockito.junit.MockitoJUnit;
import org.mockito.junit.MockitoRule;
import org.mockito.quality.Strictness;
-import org.threeten.bp.Duration;
@RunWith(JUnit4.class)
public class AwaitConsistencyCallableTest {
@@ -80,14 +80,14 @@ public void setUp() {
RetrySettings retrySettings =
RetrySettings.newBuilder()
- .setTotalTimeout(Duration.ofMillis(100))
+ .setTotalTimeoutDuration(Duration.ofMillis(100))
// Delay settings: 1 ms const
- .setInitialRetryDelay(Duration.ofMillis(1))
- .setMaxRetryDelay(Duration.ofMillis(1))
+ .setInitialRetryDelayDuration(Duration.ofMillis(1))
+ .setMaxRetryDelayDuration(Duration.ofMillis(1))
.setRetryDelayMultiplier(1.0)
// RPC timeout: ignored const 1 s
- .setInitialRpcTimeout(Duration.ofSeconds(1))
- .setMaxRpcTimeout(Duration.ofSeconds(1))
+ .setInitialRpcTimeoutDuration(Duration.ofSeconds(1))
+ .setMaxRpcTimeoutDuration(Duration.ofSeconds(1))
.setRpcTimeoutMultiplier(1.0)
.build();
diff --git a/google-cloud-bigtable/src/test/java/com/google/cloud/bigtable/data/v2/internal/AbstractProtoStructReaderTest.java b/google-cloud-bigtable/src/test/java/com/google/cloud/bigtable/data/v2/internal/AbstractProtoStructReaderTest.java
index 95955bab94..8770880983 100644
--- a/google-cloud-bigtable/src/test/java/com/google/cloud/bigtable/data/v2/internal/AbstractProtoStructReaderTest.java
+++ b/google-cloud-bigtable/src/test/java/com/google/cloud/bigtable/data/v2/internal/AbstractProtoStructReaderTest.java
@@ -57,6 +57,7 @@
import com.google.cloud.bigtable.data.v2.models.sql.Struct;
import com.google.cloud.bigtable.data.v2.stub.sql.SqlProtoFactory;
import com.google.protobuf.ByteString;
+import java.time.Instant;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
@@ -71,7 +72,6 @@
import org.junit.runners.JUnit4;
import org.junit.runners.Parameterized;
import org.junit.runners.Parameterized.Parameter;
-import org.threeten.bp.Instant;
@RunWith(Enclosed.class)
public class AbstractProtoStructReaderTest {
diff --git a/google-cloud-bigtable/src/test/java/com/google/cloud/bigtable/data/v2/internal/ProtoStructTest.java b/google-cloud-bigtable/src/test/java/com/google/cloud/bigtable/data/v2/internal/ProtoStructTest.java
index 6fa71e7fff..66808bb98a 100644
--- a/google-cloud-bigtable/src/test/java/com/google/cloud/bigtable/data/v2/internal/ProtoStructTest.java
+++ b/google-cloud-bigtable/src/test/java/com/google/cloud/bigtable/data/v2/internal/ProtoStructTest.java
@@ -47,13 +47,13 @@
import com.google.cloud.Date;
import com.google.cloud.bigtable.data.v2.models.sql.SqlType;
import com.google.protobuf.ByteString;
+import java.time.Instant;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.JUnit4;
-import org.threeten.bp.Instant;
@RunWith(JUnit4.class)
public class ProtoStructTest {
diff --git a/google-cloud-bigtable/src/test/java/com/google/cloud/bigtable/data/v2/internal/ResultSetImplTest.java b/google-cloud-bigtable/src/test/java/com/google/cloud/bigtable/data/v2/internal/ResultSetImplTest.java
index a5b823b205..a8c5776a87 100644
--- a/google-cloud-bigtable/src/test/java/com/google/cloud/bigtable/data/v2/internal/ResultSetImplTest.java
+++ b/google-cloud-bigtable/src/test/java/com/google/cloud/bigtable/data/v2/internal/ResultSetImplTest.java
@@ -54,6 +54,7 @@
import com.google.cloud.bigtable.data.v2.stub.sql.SqlServerStreamImpl;
import com.google.cloud.bigtable.gaxx.testing.FakeStreamingApi.ServerStreamingStashCallable;
import com.google.protobuf.ByteString;
+import java.time.Instant;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
@@ -62,7 +63,6 @@
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.JUnit4;
-import org.threeten.bp.Instant;
@RunWith(JUnit4.class)
public class ResultSetImplTest {
diff --git a/google-cloud-bigtable/src/test/java/com/google/cloud/bigtable/data/v2/it/BuiltinMetricsIT.java b/google-cloud-bigtable/src/test/java/com/google/cloud/bigtable/data/v2/it/BuiltinMetricsIT.java
index d929627e12..d091da3c68 100644
--- a/google-cloud-bigtable/src/test/java/com/google/cloud/bigtable/data/v2/it/BuiltinMetricsIT.java
+++ b/google-cloud-bigtable/src/test/java/com/google/cloud/bigtable/data/v2/it/BuiltinMetricsIT.java
@@ -60,6 +60,8 @@
import io.opentelemetry.sdk.metrics.data.MetricData;
import io.opentelemetry.sdk.testing.exporter.InMemoryMetricReader;
import java.io.IOException;
+import java.time.Duration;
+import java.time.Instant;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
@@ -76,8 +78,6 @@
import org.junit.rules.Timeout;
import org.junit.runner.RunWith;
import org.junit.runners.JUnit4;
-import org.threeten.bp.Duration;
-import org.threeten.bp.Instant;
@Ignore("Temporarily disable flaky test")
@RunWith(JUnit4.class)
diff --git a/google-cloud-bigtable/src/test/java/com/google/cloud/bigtable/data/v2/it/BulkMutateIT.java b/google-cloud-bigtable/src/test/java/com/google/cloud/bigtable/data/v2/it/BulkMutateIT.java
index a284f8b7cb..ca580def73 100644
--- a/google-cloud-bigtable/src/test/java/com/google/cloud/bigtable/data/v2/it/BulkMutateIT.java
+++ b/google-cloud-bigtable/src/test/java/com/google/cloud/bigtable/data/v2/it/BulkMutateIT.java
@@ -37,13 +37,13 @@
import com.google.cloud.bigtable.test_helpers.env.EmulatorEnv;
import com.google.cloud.bigtable.test_helpers.env.TestEnvRule;
import java.io.IOException;
+import java.time.Duration;
import java.util.Objects;
import java.util.UUID;
import org.junit.ClassRule;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.JUnit4;
-import org.threeten.bp.Duration;
@RunWith(JUnit4.class)
public class BulkMutateIT {
@@ -158,7 +158,7 @@ public void testManyMutations() throws IOException, InterruptedException {
.stubSettings()
.bulkMutateRowsSettings()
.setBatchingSettings(
- batchingSettings.toBuilder().setDelayThreshold(Duration.ofHours(1)).build());
+ batchingSettings.toBuilder().setDelayThresholdDuration(Duration.ofHours(1)).build());
try (BigtableDataClient client = BigtableDataClient.create(settings);
BatcherImpl batcher =
(BatcherImpl)
@@ -207,7 +207,7 @@ public void testManyMutationsOnAuthorizedView() throws IOException, InterruptedE
.stubSettings()
.bulkMutateRowsSettings()
.setBatchingSettings(
- batchingSettings.toBuilder().setDelayThreshold(Duration.ofHours(1)).build());
+ batchingSettings.toBuilder().setDelayThresholdDuration(Duration.ofHours(1)).build());
try (BigtableDataClient client = BigtableDataClient.create(settings);
Batcher batcher =
client.newBulkMutationBatcher(
diff --git a/google-cloud-bigtable/src/test/java/com/google/cloud/bigtable/data/v2/it/ExecuteQueryIT.java b/google-cloud-bigtable/src/test/java/com/google/cloud/bigtable/data/v2/it/ExecuteQueryIT.java
index 620d290338..34d0952401 100644
--- a/google-cloud-bigtable/src/test/java/com/google/cloud/bigtable/data/v2/it/ExecuteQueryIT.java
+++ b/google-cloud-bigtable/src/test/java/com/google/cloud/bigtable/data/v2/it/ExecuteQueryIT.java
@@ -31,6 +31,7 @@
import com.google.cloud.bigtable.test_helpers.env.TestEnvRule;
import com.google.protobuf.ByteString;
import java.io.IOException;
+import java.time.Instant;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
@@ -41,7 +42,6 @@
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.JUnit4;
-import org.threeten.bp.Instant;
@RunWith(JUnit4.class)
public class ExecuteQueryIT {
diff --git a/google-cloud-bigtable/src/test/java/com/google/cloud/bigtable/data/v2/models/ChangeStreamMutationTest.java b/google-cloud-bigtable/src/test/java/com/google/cloud/bigtable/data/v2/models/ChangeStreamMutationTest.java
index 61c028cdb6..c3dc61244a 100644
--- a/google-cloud-bigtable/src/test/java/com/google/cloud/bigtable/data/v2/models/ChangeStreamMutationTest.java
+++ b/google-cloud-bigtable/src/test/java/com/google/cloud/bigtable/data/v2/models/ChangeStreamMutationTest.java
@@ -29,11 +29,11 @@
import java.io.IOException;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
+import java.time.Instant;
import org.junit.Assert;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.JUnit4;
-import org.threeten.bp.Instant;
@RunWith(JUnit4.class)
public class ChangeStreamMutationTest {
@@ -73,17 +73,17 @@ public void userInitiatedMutationTest() throws IOException, ClassNotFoundExcepti
Value.rawTimestamp(1000),
Value.rawValue(ByteString.copyFrom(Longs.toByteArray(1234L))))
.setToken("fake-token")
- .setEstimatedLowWatermark(FAKE_LOW_WATERMARK)
+ .setLowWatermarkTime(FAKE_LOW_WATERMARK)
.build();
// Test the getters.
assertThat(changeStreamMutation.getRowKey()).isEqualTo(ByteString.copyFromUtf8("key"));
assertThat(changeStreamMutation.getType()).isEqualTo(ChangeStreamMutation.MutationType.USER);
assertThat(changeStreamMutation.getSourceClusterId()).isEqualTo("fake-source-cluster-id");
- assertThat(changeStreamMutation.getCommitTimestamp()).isEqualTo(FAKE_COMMIT_TIMESTAMP);
+ assertThat(changeStreamMutation.getCommitTime()).isEqualTo(FAKE_COMMIT_TIMESTAMP);
assertThat(changeStreamMutation.getTieBreaker()).isEqualTo(0);
assertThat(changeStreamMutation.getToken()).isEqualTo("fake-token");
- assertThat(changeStreamMutation.getEstimatedLowWatermark()).isEqualTo(FAKE_LOW_WATERMARK);
+ assertThat(changeStreamMutation.getEstimatedLowWatermarkTime()).isEqualTo(FAKE_LOW_WATERMARK);
// Test serialization.
ByteArrayOutputStream bos = new ByteArrayOutputStream();
@@ -112,7 +112,7 @@ public void gcMutationTest() throws IOException, ClassNotFoundException {
ByteString.copyFromUtf8("fake-qualifier"),
Range.TimestampRange.create(1000L, 2000L))
.setToken("fake-token")
- .setEstimatedLowWatermark(FAKE_LOW_WATERMARK)
+ .setLowWatermarkTime(FAKE_LOW_WATERMARK)
.build();
// Test the getters.
@@ -120,10 +120,10 @@ public void gcMutationTest() throws IOException, ClassNotFoundException {
assertThat(changeStreamMutation.getType())
.isEqualTo(ChangeStreamMutation.MutationType.GARBAGE_COLLECTION);
Assert.assertTrue(changeStreamMutation.getSourceClusterId().isEmpty());
- assertThat(changeStreamMutation.getCommitTimestamp()).isEqualTo(FAKE_COMMIT_TIMESTAMP);
+ assertThat(changeStreamMutation.getCommitTime()).isEqualTo(FAKE_COMMIT_TIMESTAMP);
assertThat(changeStreamMutation.getTieBreaker()).isEqualTo(0);
assertThat(changeStreamMutation.getToken()).isEqualTo("fake-token");
- assertThat(changeStreamMutation.getEstimatedLowWatermark()).isEqualTo(FAKE_LOW_WATERMARK);
+ assertThat(changeStreamMutation.getEstimatedLowWatermarkTime()).isEqualTo(FAKE_LOW_WATERMARK);
// Test serialization.
ByteArrayOutputStream bos = new ByteArrayOutputStream();
@@ -161,7 +161,7 @@ public void toRowMutationTest() {
Value.rawTimestamp(1000),
Value.rawValue(ByteString.copyFrom(Longs.toByteArray(1234L))))
.setToken("fake-token")
- .setEstimatedLowWatermark(FAKE_LOW_WATERMARK)
+ .setLowWatermarkTime(FAKE_LOW_WATERMARK)
.build();
// Convert it to a rowMutation and construct a MutateRowRequest.
@@ -204,7 +204,7 @@ public void toRowMutationWithoutTokenShouldFailTest() {
ChangeStreamMutation.createUserMutation(
ByteString.copyFromUtf8("key"), "fake-source-cluster-id", FAKE_COMMIT_TIMESTAMP, 0)
.deleteFamily("fake-family")
- .setEstimatedLowWatermark(FAKE_LOW_WATERMARK);
+ .setLowWatermarkTime(FAKE_LOW_WATERMARK);
Assert.assertThrows(IllegalStateException.class, builder::build);
}
@@ -244,7 +244,7 @@ public void toRowMutationEntryTest() {
Value.rawTimestamp(1000),
Value.rawValue(ByteString.copyFrom(Longs.toByteArray(1234L))))
.setToken("fake-token")
- .setEstimatedLowWatermark(FAKE_LOW_WATERMARK)
+ .setLowWatermarkTime(FAKE_LOW_WATERMARK)
.build();
// Convert it to a rowMutationEntry and construct a MutateRowRequest.
@@ -284,7 +284,7 @@ public void toRowMutationEntryWithoutTokenShouldFailTest() {
ChangeStreamMutation.createUserMutation(
ByteString.copyFromUtf8("key"), "fake-source-cluster-id", FAKE_COMMIT_TIMESTAMP, 0)
.deleteFamily("fake-family")
- .setEstimatedLowWatermark(FAKE_LOW_WATERMARK);
+ .setLowWatermarkTime(FAKE_LOW_WATERMARK);
Assert.assertThrows(IllegalStateException.class, builder::build);
}
@@ -309,7 +309,7 @@ public void testWithLongValue() {
1000L,
ByteString.copyFrom(Longs.toByteArray(1L)))
.setToken("fake-token")
- .setEstimatedLowWatermark(FAKE_LOW_WATERMARK)
+ .setLowWatermarkTime(FAKE_LOW_WATERMARK)
.build();
RowMutation rowMutation = changeStreamMutation.toRowMutation(TABLE_ID);
diff --git a/google-cloud-bigtable/src/test/java/com/google/cloud/bigtable/data/v2/models/ChangeStreamRecordTest.java b/google-cloud-bigtable/src/test/java/com/google/cloud/bigtable/data/v2/models/ChangeStreamRecordTest.java
index 3f09d9b443..14697f430e 100644
--- a/google-cloud-bigtable/src/test/java/com/google/cloud/bigtable/data/v2/models/ChangeStreamRecordTest.java
+++ b/google-cloud-bigtable/src/test/java/com/google/cloud/bigtable/data/v2/models/ChangeStreamRecordTest.java
@@ -30,6 +30,7 @@
import java.io.IOException;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
+import java.time.Instant;
import org.junit.Assert;
import org.junit.Rule;
import org.junit.Test;
@@ -37,7 +38,6 @@
import org.junit.rules.ExpectedException;
import org.junit.runner.RunWith;
import org.junit.runners.JUnit4;
-import org.threeten.bp.Instant;
@RunWith(JUnit4.class)
public class ChangeStreamRecordTest {
@@ -129,7 +129,7 @@ public void heartbeatTest() {
.build();
Heartbeat actualHeartbeat = Heartbeat.fromProto(heartbeatProto);
- assertThat(actualHeartbeat.getEstimatedLowWatermark())
+ assertThat(actualHeartbeat.getEstimatedLowWatermarkInstant())
.isEqualTo(Instant.ofEpochSecond(lowWatermark.getSeconds(), lowWatermark.getNanos()));
assertThat(actualHeartbeat.getChangeStreamContinuationToken().getPartition())
.isEqualTo(ByteStringRange.create(rowRange.getStartKeyClosed(), rowRange.getEndKeyOpen()));
diff --git a/google-cloud-bigtable/src/test/java/com/google/cloud/bigtable/data/v2/models/DefaultChangeStreamRecordAdapterTest.java b/google-cloud-bigtable/src/test/java/com/google/cloud/bigtable/data/v2/models/DefaultChangeStreamRecordAdapterTest.java
index 22270bc269..425f9580b7 100644
--- a/google-cloud-bigtable/src/test/java/com/google/cloud/bigtable/data/v2/models/DefaultChangeStreamRecordAdapterTest.java
+++ b/google-cloud-bigtable/src/test/java/com/google/cloud/bigtable/data/v2/models/DefaultChangeStreamRecordAdapterTest.java
@@ -25,6 +25,7 @@
import com.google.protobuf.ByteString;
import com.google.protobuf.Timestamp;
import com.google.rpc.Status;
+import java.time.Instant;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Rule;
@@ -32,7 +33,6 @@
import org.junit.rules.ExpectedException;
import org.junit.runner.RunWith;
import org.junit.runners.JUnit4;
-import org.threeten.bp.Instant;
@RunWith(JUnit4.class)
public class DefaultChangeStreamRecordAdapterTest {
@@ -59,7 +59,7 @@ public void isHeartbeatTest() {
ChangeStreamMutation.createGcMutation(
ByteString.copyFromUtf8("key"), FAKE_COMMIT_TIMESTAMP, 0)
.setToken("token")
- .setEstimatedLowWatermark(FAKE_LOW_WATERMARK)
+ .setLowWatermarkTime(FAKE_LOW_WATERMARK)
.build();
Assert.assertTrue(adapter.isHeartbeat(heartbeatRecord));
Assert.assertFalse(adapter.isHeartbeat(closeStreamRecord));
@@ -99,7 +99,7 @@ public void isChangeStreamMutationTest() {
ChangeStreamMutation.createGcMutation(
ByteString.copyFromUtf8("key"), FAKE_COMMIT_TIMESTAMP, 0)
.setToken("token")
- .setEstimatedLowWatermark(FAKE_LOW_WATERMARK)
+ .setLowWatermarkTime(FAKE_LOW_WATERMARK)
.build();
Assert.assertFalse(adapter.isChangeStreamMutation(heartbeatRecord));
Assert.assertFalse(adapter.isChangeStreamMutation(closeStreamRecord));
@@ -112,7 +112,7 @@ public void getTokenFromChangeStreamMutationTest() {
ChangeStreamMutation.createGcMutation(
ByteString.copyFromUtf8("key"), FAKE_COMMIT_TIMESTAMP, 0)
.setToken("change-stream-mutation-token")
- .setEstimatedLowWatermark(FAKE_LOW_WATERMARK)
+ .setLowWatermarkTime(FAKE_LOW_WATERMARK)
.build();
Assert.assertEquals(
adapter.getTokenFromChangeStreamMutation(changeStreamMutationRecord),
@@ -186,7 +186,7 @@ public void singleDeleteFamilyTest() {
ByteString.copyFromUtf8("key"), "fake-source-cluster-id", FAKE_COMMIT_TIMESTAMP, 0)
.deleteFamily("fake-family")
.setToken("fake-token")
- .setEstimatedLowWatermark(FAKE_LOW_WATERMARK)
+ .setLowWatermarkTime(FAKE_LOW_WATERMARK)
.build();
// Create the ChangeStreamMutation through the ChangeStreamRecordBuilder.
@@ -225,7 +225,7 @@ public void singleDeleteCellTest() {
ByteString.copyFromUtf8("fake-qualifier"),
Range.TimestampRange.create(1000L, 2000L))
.setToken("fake-token")
- .setEstimatedLowWatermark(FAKE_LOW_WATERMARK)
+ .setLowWatermarkTime(FAKE_LOW_WATERMARK)
.build();
// Create the ChangeStreamMutation through the ChangeStreamRecordBuilder.
@@ -258,7 +258,7 @@ public void singleNonChunkedCellTest() {
100L,
ByteString.copyFromUtf8("fake-value"))
.setToken("fake-token")
- .setEstimatedLowWatermark(FAKE_LOW_WATERMARK)
+ .setLowWatermarkTime(FAKE_LOW_WATERMARK)
.build();
// Create the ChangeStreamMutation through the ChangeStreamRecordBuilder.
@@ -290,7 +290,7 @@ public void singleChunkedCellTest() {
100L,
ByteString.copyFromUtf8("fake-value1-value2"))
.setToken("fake-token")
- .setEstimatedLowWatermark(FAKE_LOW_WATERMARK)
+ .setLowWatermarkTime(FAKE_LOW_WATERMARK)
.build();
// Create the ChangeStreamMutation through the ChangeStreamRecordBuilder.
@@ -327,7 +327,7 @@ public void multipleChunkedCellsTest() {
}
expectedChangeStreamMutationBuilder
.setToken("fake-token")
- .setEstimatedLowWatermark(FAKE_LOW_WATERMARK);
+ .setLowWatermarkTime(FAKE_LOW_WATERMARK);
// Create the ChangeStreamMutation through the ChangeStreamRecordBuilder.
changeStreamRecordBuilder.startUserMutation(
@@ -369,7 +369,7 @@ public void multipleDifferentModsTest() {
100L,
ByteString.copyFromUtf8("chunked-value"))
.setToken("fake-token")
- .setEstimatedLowWatermark(FAKE_LOW_WATERMARK);
+ .setLowWatermarkTime(FAKE_LOW_WATERMARK);
// Create the ChangeStreamMutation through the ChangeStreamRecordBuilder.
changeStreamRecordBuilder.startUserMutation(
@@ -418,7 +418,7 @@ public void resetTest() {
ByteString.copyFromUtf8("key"), "fake-source-cluster-id", FAKE_COMMIT_TIMESTAMP, 0)
.deleteFamily("fake-family")
.setToken("fake-token")
- .setEstimatedLowWatermark(FAKE_LOW_WATERMARK)
+ .setLowWatermarkTime(FAKE_LOW_WATERMARK)
.build();
changeStreamRecordBuilder.startUserMutation(
ByteString.copyFromUtf8("key"), "fake-source-cluster-id", FAKE_COMMIT_TIMESTAMP, 0);
@@ -438,7 +438,7 @@ public void resetTest() {
100L,
ByteString.copyFromUtf8("fake-value1-value2"))
.setToken("fake-token")
- .setEstimatedLowWatermark(FAKE_LOW_WATERMARK)
+ .setLowWatermarkTime(FAKE_LOW_WATERMARK)
.build();
changeStreamRecordBuilder.startUserMutation(
diff --git a/google-cloud-bigtable/src/test/java/com/google/cloud/bigtable/data/v2/models/ReadChangeStreamQueryTest.java b/google-cloud-bigtable/src/test/java/com/google/cloud/bigtable/data/v2/models/ReadChangeStreamQueryTest.java
index 699f60a8d1..13e1bcb915 100644
--- a/google-cloud-bigtable/src/test/java/com/google/cloud/bigtable/data/v2/models/ReadChangeStreamQueryTest.java
+++ b/google-cloud-bigtable/src/test/java/com/google/cloud/bigtable/data/v2/models/ReadChangeStreamQueryTest.java
@@ -34,6 +34,7 @@
import java.io.IOException;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
+import java.time.Instant;
import java.util.Collections;
import org.junit.Before;
import org.junit.Rule;
@@ -41,7 +42,6 @@
import org.junit.rules.ExpectedException;
import org.junit.runner.RunWith;
import org.junit.runners.JUnit4;
-import org.threeten.bp.Instant;
@RunWith(JUnit4.class)
public class ReadChangeStreamQueryTest {
@@ -152,8 +152,7 @@ public void endTimeTest() {
@Test
public void heartbeatDurationTest() {
ReadChangeStreamQuery query =
- ReadChangeStreamQuery.create(TABLE_ID)
- .heartbeatDuration(org.threeten.bp.Duration.ofSeconds(5));
+ ReadChangeStreamQuery.create(TABLE_ID).heartbeatDuration(java.time.Duration.ofSeconds(5));
Builder expectedProto =
expectedProtoBuilder().setHeartbeatDuration(Duration.newBuilder().setSeconds(5).build());
@@ -232,7 +231,7 @@ public void serializationTest() throws IOException, ClassNotFoundException {
.streamPartition("simple-begin", "simple-end")
.continuationTokens(Collections.singletonList(token))
.endTime(FAKE_END_TIME)
- .heartbeatDuration(org.threeten.bp.Duration.ofSeconds(5));
+ .heartbeatDuration(java.time.Duration.ofSeconds(5));
ByteArrayOutputStream bos = new ByteArrayOutputStream();
ObjectOutputStream oos = new ObjectOutputStream(bos);
@@ -302,7 +301,7 @@ public void testEquality() {
.streamPartition("simple-begin", "simple-end")
.startTime(FAKE_START_TIME)
.endTime(FAKE_END_TIME)
- .heartbeatDuration(org.threeten.bp.Duration.ofSeconds(5));
+ .heartbeatDuration(java.time.Duration.ofSeconds(5));
// ReadChangeStreamQuery#toProto should not change the ReadChangeStreamQuery instance state
request.toProto(requestContext);
@@ -312,7 +311,7 @@ public void testEquality() {
.streamPartition("simple-begin", "simple-end")
.startTime(FAKE_START_TIME)
.endTime(FAKE_END_TIME)
- .heartbeatDuration(org.threeten.bp.Duration.ofSeconds(5)));
+ .heartbeatDuration(java.time.Duration.ofSeconds(5)));
assertThat(ReadChangeStreamQuery.create(TABLE_ID).streamPartition("begin-1", "end-1"))
.isNotEqualTo(ReadChangeStreamQuery.create(TABLE_ID).streamPartition("begin-2", "end-1"));
@@ -324,10 +323,10 @@ public void testEquality() {
ReadChangeStreamQuery.create(TABLE_ID).endTime(Instant.ofEpochSecond(1L, 1001L)));
assertThat(
ReadChangeStreamQuery.create(TABLE_ID)
- .heartbeatDuration(org.threeten.bp.Duration.ofSeconds(5)))
+ .heartbeatDuration(java.time.Duration.ofSeconds(5)))
.isNotEqualTo(
ReadChangeStreamQuery.create(TABLE_ID)
- .heartbeatDuration(org.threeten.bp.Duration.ofSeconds(6)));
+ .heartbeatDuration(java.time.Duration.ofSeconds(6)));
}
@Test
@@ -350,7 +349,7 @@ public void testClone() {
.streamPartition("begin", "end")
.continuationTokens(Collections.singletonList(token))
.endTime(FAKE_END_TIME)
- .heartbeatDuration(org.threeten.bp.Duration.ofSeconds(5));
+ .heartbeatDuration(java.time.Duration.ofSeconds(5));
ReadChangeStreamRequest request =
ReadChangeStreamRequest.newBuilder()
.setTableName(NameUtil.formatTableName(PROJECT_ID, INSTANCE_ID, TABLE_ID))
diff --git a/google-cloud-bigtable/src/test/java/com/google/cloud/bigtable/data/v2/models/sql/StatementTest.java b/google-cloud-bigtable/src/test/java/com/google/cloud/bigtable/data/v2/models/sql/StatementTest.java
index cb19a7fde9..6d4765230e 100644
--- a/google-cloud-bigtable/src/test/java/com/google/cloud/bigtable/data/v2/models/sql/StatementTest.java
+++ b/google-cloud-bigtable/src/test/java/com/google/cloud/bigtable/data/v2/models/sql/StatementTest.java
@@ -41,12 +41,12 @@
import com.google.cloud.Date;
import com.google.cloud.bigtable.data.v2.internal.RequestContext;
import com.google.protobuf.ByteString;
+import java.time.Instant;
import java.util.Arrays;
import java.util.Collections;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.JUnit4;
-import org.threeten.bp.Instant;
@RunWith(JUnit4.class)
public class StatementTest {
diff --git a/google-cloud-bigtable/src/test/java/com/google/cloud/bigtable/data/v2/stub/BigtableBatchingCallSettingsTest.java b/google-cloud-bigtable/src/test/java/com/google/cloud/bigtable/data/v2/stub/BigtableBatchingCallSettingsTest.java
index dcdef068a5..cf42f07ff8 100644
--- a/google-cloud-bigtable/src/test/java/com/google/cloud/bigtable/data/v2/stub/BigtableBatchingCallSettingsTest.java
+++ b/google-cloud-bigtable/src/test/java/com/google/cloud/bigtable/data/v2/stub/BigtableBatchingCallSettingsTest.java
@@ -25,11 +25,11 @@
import com.google.api.gax.rpc.StatusCode;
import com.google.cloud.bigtable.data.v2.stub.mutaterows.MutateRowsBatchingDescriptor;
import com.google.common.collect.ImmutableSet;
+import java.time.Duration;
import java.util.Set;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.JUnit4;
-import org.threeten.bp.Duration;
@RunWith(JUnit4.class)
public class BigtableBatchingCallSettingsTest {
@@ -38,7 +38,7 @@ public class BigtableBatchingCallSettingsTest {
BatchingSettings.newBuilder()
.setElementCountThreshold(10L)
.setRequestByteThreshold(20L)
- .setDelayThreshold(Duration.ofMillis(5))
+ .setDelayThresholdDuration(Duration.ofMillis(5))
.setFlowControlSettings(
FlowControlSettings.newBuilder()
.setMaxOutstandingElementCount(100L)
@@ -111,7 +111,7 @@ public void testBuilderFromSettings() {
BigtableBatchingCallSettings.Builder builder =
BigtableBatchingCallSettings.newBuilder(new MutateRowsBatchingDescriptor());
RetrySettings retrySettings =
- RetrySettings.newBuilder().setTotalTimeout(Duration.ofMinutes(1)).build();
+ RetrySettings.newBuilder().setTotalTimeoutDuration(Duration.ofMinutes(1)).build();
builder
.setBatchingSettings(BATCHING_SETTINGS)
.setRetryableCodes(StatusCode.Code.UNAVAILABLE, StatusCode.Code.UNAUTHENTICATED)
diff --git a/google-cloud-bigtable/src/test/java/com/google/cloud/bigtable/data/v2/stub/BigtableBulkReadRowsCallSettingsTest.java b/google-cloud-bigtable/src/test/java/com/google/cloud/bigtable/data/v2/stub/BigtableBulkReadRowsCallSettingsTest.java
index a343bf4667..63a6d95858 100644
--- a/google-cloud-bigtable/src/test/java/com/google/cloud/bigtable/data/v2/stub/BigtableBulkReadRowsCallSettingsTest.java
+++ b/google-cloud-bigtable/src/test/java/com/google/cloud/bigtable/data/v2/stub/BigtableBulkReadRowsCallSettingsTest.java
@@ -24,11 +24,11 @@
import com.google.api.gax.rpc.StatusCode;
import com.google.cloud.bigtable.data.v2.stub.readrows.ReadRowsBatchingDescriptor;
import com.google.common.collect.ImmutableSet;
+import java.time.Duration;
import java.util.Set;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.JUnit4;
-import org.threeten.bp.Duration;
@RunWith(JUnit4.class)
public class BigtableBulkReadRowsCallSettingsTest {
@@ -37,7 +37,7 @@ public class BigtableBulkReadRowsCallSettingsTest {
BatchingSettings.newBuilder()
.setElementCountThreshold(10L)
.setRequestByteThreshold(20L)
- .setDelayThreshold(Duration.ofMillis(5))
+ .setDelayThresholdDuration(Duration.ofMillis(5))
.setFlowControlSettings(
FlowControlSettings.newBuilder()
.setMaxOutstandingElementCount(100L)
@@ -78,7 +78,7 @@ public void testBuilderFromSettings() {
BigtableBulkReadRowsCallSettings.Builder builder =
BigtableBulkReadRowsCallSettings.newBuilder(new ReadRowsBatchingDescriptor());
RetrySettings retrySettings =
- RetrySettings.newBuilder().setTotalTimeout(Duration.ofMinutes(1)).build();
+ RetrySettings.newBuilder().setTotalTimeoutDuration(Duration.ofMinutes(1)).build();
builder
.setBatchingSettings(BATCHING_SETTINGS)
.setRetryableCodes(StatusCode.Code.UNAVAILABLE, StatusCode.Code.UNAUTHENTICATED)
diff --git a/google-cloud-bigtable/src/test/java/com/google/cloud/bigtable/data/v2/stub/CookiesHolderTest.java b/google-cloud-bigtable/src/test/java/com/google/cloud/bigtable/data/v2/stub/CookiesHolderTest.java
index 95a807bf76..5f69a3c6cd 100644
--- a/google-cloud-bigtable/src/test/java/com/google/cloud/bigtable/data/v2/stub/CookiesHolderTest.java
+++ b/google-cloud-bigtable/src/test/java/com/google/cloud/bigtable/data/v2/stub/CookiesHolderTest.java
@@ -62,6 +62,7 @@
import io.grpc.StatusRuntimeException;
import io.grpc.stub.StreamObserver;
import java.io.IOException;
+import java.time.Duration;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashSet;
@@ -74,7 +75,6 @@
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.JUnit4;
-import org.threeten.bp.Duration;
@RunWith(JUnit4.class)
public class CookiesHolderTest {
@@ -145,8 +145,8 @@ public void sendHeaders(Metadata responseHeaders) {
.checkAndMutateRowSettings()
.setRetrySettings(
RetrySettings.newBuilder()
- .setInitialRetryDelay(Duration.ofMillis(10))
- .setMaxRetryDelay(Duration.ofMinutes(1))
+ .setInitialRetryDelayDuration(Duration.ofMillis(10))
+ .setMaxRetryDelayDuration(Duration.ofMinutes(1))
.setMaxAttempts(2)
.build())
.setRetryableCodes(StatusCode.Code.UNAVAILABLE);
@@ -156,8 +156,8 @@ public void sendHeaders(Metadata responseHeaders) {
.readModifyWriteRowSettings()
.setRetrySettings(
RetrySettings.newBuilder()
- .setInitialRetryDelay(Duration.ofMillis(10))
- .setMaxRetryDelay(Duration.ofMinutes(1))
+ .setInitialRetryDelayDuration(Duration.ofMillis(10))
+ .setMaxRetryDelayDuration(Duration.ofMinutes(1))
.setMaxAttempts(2)
.build())
.setRetryableCodes(StatusCode.Code.UNAVAILABLE);
diff --git a/google-cloud-bigtable/src/test/java/com/google/cloud/bigtable/data/v2/stub/EnhancedBigtableStubSettingsTest.java b/google-cloud-bigtable/src/test/java/com/google/cloud/bigtable/data/v2/stub/EnhancedBigtableStubSettingsTest.java
index fdc6b5717e..51790a73d8 100644
--- a/google-cloud-bigtable/src/test/java/com/google/cloud/bigtable/data/v2/stub/EnhancedBigtableStubSettingsTest.java
+++ b/google-cloud-bigtable/src/test/java/com/google/cloud/bigtable/data/v2/stub/EnhancedBigtableStubSettingsTest.java
@@ -42,6 +42,7 @@
import java.lang.reflect.Field;
import java.lang.reflect.Modifier;
import java.net.URI;
+import java.time.Duration;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
@@ -51,7 +52,6 @@
import org.junit.runner.RunWith;
import org.junit.runners.JUnit4;
import org.mockito.Mockito;
-import org.threeten.bp.Duration;
@RunWith(JUnit4.class)
public class EnhancedBigtableStubSettingsTest {
@@ -92,7 +92,7 @@ public void settingsAreNotLostTest() {
.setEndpoint(endpoint)
.setCredentialsProvider(credentialsProvider)
.setStreamWatchdogProvider(watchdogProvider)
- .setStreamWatchdogCheckInterval(watchdogInterval)
+ .setStreamWatchdogCheckIntervalDuration(watchdogInterval)
.setEnableRoutingCookie(enableRoutingCookie)
.setEnableRetryInfo(enableRetryInfo)
.setMetricsEndpoint(metricsEndpoint);
@@ -158,7 +158,7 @@ private void verifyBuilder(
assertThat(builder.getEndpoint()).isEqualTo(endpoint);
assertThat(builder.getCredentialsProvider()).isEqualTo(credentialsProvider);
assertThat(builder.getStreamWatchdogProvider()).isSameInstanceAs(watchdogProvider);
- assertThat(builder.getStreamWatchdogCheckInterval()).isEqualTo(watchdogInterval);
+ assertThat(builder.getStreamWatchdogCheckIntervalDuration()).isEqualTo(watchdogInterval);
assertThat(builder.getEnableRoutingCookie()).isEqualTo(enableRoutingCookie);
assertThat(builder.getEnableRetryInfo()).isEqualTo(enableRetryInfo);
assertThat(builder.getMetricsEndpoint()).isEqualTo(metricsEndpoint);
@@ -184,7 +184,7 @@ private void verifySettings(
assertThat(settings.getEndpoint()).isEqualTo(endpoint);
assertThat(settings.getCredentialsProvider()).isEqualTo(credentialsProvider);
assertThat(settings.getStreamWatchdogProvider()).isSameInstanceAs(watchdogProvider);
- assertThat(settings.getStreamWatchdogCheckInterval()).isEqualTo(watchdogInterval);
+ assertThat(settings.getStreamWatchdogCheckIntervalDuration()).isEqualTo(watchdogInterval);
assertThat(settings.getEnableRoutingCookie()).isEqualTo(enableRoutingCookie);
assertThat(settings.getEnableRetryInfo()).isEqualTo(enableRetryInfo);
assertThat(settings.getMetricsEndpoint()).isEqualTo(metricsEndpoint);
@@ -222,16 +222,16 @@ public void readRowsIsNotLostTest() {
RetrySettings retrySettings =
RetrySettings.newBuilder()
.setMaxAttempts(10)
- .setTotalTimeout(Duration.ofHours(1))
- .setInitialRpcTimeout(Duration.ofSeconds(10))
+ .setTotalTimeoutDuration(Duration.ofHours(1))
+ .setInitialRpcTimeoutDuration(Duration.ofSeconds(10))
.setRpcTimeoutMultiplier(1)
- .setMaxRpcTimeout(Duration.ofSeconds(10))
+ .setMaxRpcTimeoutDuration(Duration.ofSeconds(10))
.setJittered(true)
.build();
builder
.readRowsSettings()
- .setIdleTimeout(Duration.ofMinutes(5))
+ .setIdleTimeoutDuration(Duration.ofMinutes(5))
.setRetryableCodes(Code.ABORTED, Code.DEADLINE_EXCEEDED)
.setRetrySettings(retrySettings)
.build();
@@ -240,18 +240,19 @@ public void readRowsIsNotLostTest() {
builder.readRowSettings().setRetryableCodes(Code.ABORTED, Code.DEADLINE_EXCEEDED);
builder.bulkReadRowsSettings().setRetryableCodes(Code.ABORTED, Code.DEADLINE_EXCEEDED);
- assertThat(builder.readRowsSettings().getIdleTimeout()).isEqualTo(Duration.ofMinutes(5));
+ assertThat(builder.readRowsSettings().getIdleTimeoutDuration())
+ .isEqualTo(Duration.ofMinutes(5));
assertThat(builder.readRowsSettings().getRetryableCodes())
.containsAtLeast(Code.ABORTED, Code.DEADLINE_EXCEEDED);
assertThat(builder.readRowsSettings().getRetrySettings()).isEqualTo(retrySettings);
- assertThat(builder.build().readRowsSettings().getIdleTimeout())
+ assertThat(builder.build().readRowsSettings().getIdleTimeoutDuration())
.isEqualTo(Duration.ofMinutes(5));
assertThat(builder.build().readRowsSettings().getRetryableCodes())
.containsAtLeast(Code.ABORTED, Code.DEADLINE_EXCEEDED);
assertThat(builder.build().readRowsSettings().getRetrySettings()).isEqualTo(retrySettings);
- assertThat(builder.build().toBuilder().readRowsSettings().getIdleTimeout())
+ assertThat(builder.build().toBuilder().readRowsSettings().getIdleTimeoutDuration())
.isEqualTo(Duration.ofMinutes(5));
assertThat(builder.build().toBuilder().readRowsSettings().getRetryableCodes())
.containsAtLeast(Code.ABORTED, Code.DEADLINE_EXCEEDED);
@@ -281,10 +282,10 @@ public void readRowIsNotLostTest() {
RetrySettings retrySettings =
RetrySettings.newBuilder()
.setMaxAttempts(10)
- .setTotalTimeout(Duration.ofHours(1))
- .setInitialRpcTimeout(Duration.ofSeconds(10))
+ .setTotalTimeoutDuration(Duration.ofHours(1))
+ .setInitialRpcTimeoutDuration(Duration.ofSeconds(10))
.setRpcTimeoutMultiplier(1)
- .setMaxRpcTimeout(Duration.ofSeconds(10))
+ .setMaxRpcTimeoutDuration(Duration.ofSeconds(10))
.setJittered(true)
.build();
@@ -369,10 +370,10 @@ public void sampleRowKeysSettingsAreNotLostTest() {
RetrySettings retrySettings =
RetrySettings.newBuilder()
.setMaxAttempts(10)
- .setTotalTimeout(Duration.ofHours(1))
- .setInitialRpcTimeout(Duration.ofSeconds(10))
+ .setTotalTimeoutDuration(Duration.ofHours(1))
+ .setInitialRpcTimeoutDuration(Duration.ofSeconds(10))
.setRpcTimeoutMultiplier(1)
- .setMaxRpcTimeout(Duration.ofSeconds(10))
+ .setMaxRpcTimeoutDuration(Duration.ofSeconds(10))
.setJittered(true)
.build();
@@ -417,10 +418,10 @@ public void mutateRowSettingsAreNotLostTest() {
RetrySettings retrySettings =
RetrySettings.newBuilder()
.setMaxAttempts(10)
- .setTotalTimeout(Duration.ofHours(1))
- .setInitialRpcTimeout(Duration.ofSeconds(10))
+ .setTotalTimeoutDuration(Duration.ofHours(1))
+ .setInitialRpcTimeoutDuration(Duration.ofSeconds(10))
.setRpcTimeoutMultiplier(1)
- .setMaxRpcTimeout(Duration.ofSeconds(10))
+ .setMaxRpcTimeoutDuration(Duration.ofSeconds(10))
.setJittered(true)
.build();
@@ -467,10 +468,10 @@ public void bulkMutateRowsSettingsAreNotLostTest() {
RetrySettings retrySettings =
RetrySettings.newBuilder()
.setMaxAttempts(10)
- .setTotalTimeout(Duration.ofHours(1))
- .setInitialRpcTimeout(Duration.ofSeconds(10))
+ .setTotalTimeoutDuration(Duration.ofHours(1))
+ .setInitialRpcTimeoutDuration(Duration.ofSeconds(10))
.setRpcTimeoutMultiplier(1)
- .setMaxRpcTimeout(Duration.ofSeconds(10))
+ .setMaxRpcTimeoutDuration(Duration.ofSeconds(10))
.setJittered(true)
.build();
@@ -579,10 +580,10 @@ public void bulkReadRowsSettingsAreNotLostTest() {
RetrySettings retrySettings =
RetrySettings.newBuilder()
.setMaxAttempts(10)
- .setTotalTimeout(Duration.ofHours(1))
- .setInitialRpcTimeout(Duration.ofSeconds(10))
+ .setTotalTimeoutDuration(Duration.ofHours(1))
+ .setInitialRpcTimeoutDuration(Duration.ofSeconds(10))
.setRpcTimeoutMultiplier(1)
- .setMaxRpcTimeout(Duration.ofSeconds(10))
+ .setMaxRpcTimeoutDuration(Duration.ofSeconds(10))
.setJittered(true)
.build();
@@ -626,7 +627,7 @@ public void mutateRowsHasSaneDefaultsTest() {
verifyRetrySettingAreSane(builder.getRetryableCodes(), builder.getRetrySettings());
- assertThat(builder.getBatchingSettings().getDelayThreshold())
+ assertThat(builder.getBatchingSettings().getDelayThresholdDuration())
.isIn(Range.open(Duration.ZERO, Duration.ofMinutes(1)));
assertThat(builder.getBatchingSettings().getElementCountThreshold())
.isIn(Range.open(0L, 1_000L));
@@ -768,7 +769,8 @@ public void pingAndWarmRetriesAreDisabled() {
EnhancedBigtableStubSettings.newBuilder().pingAndWarmSettings();
assertThat(builder.getRetrySettings().getMaxAttempts()).isAtMost(1);
- assertThat(builder.getRetrySettings().getInitialRpcTimeout()).isAtMost(Duration.ofSeconds(30));
+ assertThat(builder.getRetrySettings().getInitialRpcTimeoutDuration())
+ .isAtMost(Duration.ofSeconds(30));
}
@Test
@@ -789,34 +791,35 @@ public void executeQuerySettingsAreNotLost() {
RetrySettings retrySettings =
RetrySettings.newBuilder()
.setMaxAttempts(10)
- .setTotalTimeout(Duration.ofHours(1))
- .setInitialRpcTimeout(Duration.ofSeconds(10))
+ .setTotalTimeoutDuration(Duration.ofHours(1))
+ .setInitialRpcTimeoutDuration(Duration.ofSeconds(10))
.setRpcTimeoutMultiplier(1)
- .setMaxRpcTimeout(Duration.ofSeconds(10))
+ .setMaxRpcTimeoutDuration(Duration.ofSeconds(10))
.setJittered(true)
.build();
builder
.executeQuerySettings()
- .setIdleTimeout(Duration.ofMinutes(5))
+ .setIdleTimeoutDuration(Duration.ofMinutes(5))
.setRetryableCodes(Code.ABORTED, Code.DEADLINE_EXCEEDED)
.setRetrySettings(retrySettings)
.build();
builder.executeQuerySettings().setRetryableCodes(Code.ABORTED, Code.DEADLINE_EXCEEDED);
- assertThat(builder.executeQuerySettings().getIdleTimeout()).isEqualTo(Duration.ofMinutes(5));
+ assertThat(builder.executeQuerySettings().getIdleTimeoutDuration())
+ .isEqualTo(Duration.ofMinutes(5));
assertThat(builder.executeQuerySettings().getRetryableCodes())
.containsAtLeast(Code.ABORTED, Code.DEADLINE_EXCEEDED);
assertThat(builder.executeQuerySettings().getRetrySettings()).isEqualTo(retrySettings);
- assertThat(builder.build().executeQuerySettings().getIdleTimeout())
+ assertThat(builder.build().executeQuerySettings().getIdleTimeoutDuration())
.isEqualTo(Duration.ofMinutes(5));
assertThat(builder.build().executeQuerySettings().getRetryableCodes())
.containsAtLeast(Code.ABORTED, Code.DEADLINE_EXCEEDED);
assertThat(builder.build().executeQuerySettings().getRetrySettings()).isEqualTo(retrySettings);
- assertThat(builder.build().toBuilder().executeQuerySettings().getIdleTimeout())
+ assertThat(builder.build().toBuilder().executeQuerySettings().getIdleTimeoutDuration())
.isEqualTo(Duration.ofMinutes(5));
assertThat(builder.build().toBuilder().executeQuerySettings().getRetryableCodes())
.containsAtLeast(Code.ABORTED, Code.DEADLINE_EXCEEDED);
@@ -832,8 +835,10 @@ public void executeQueryHasSaneDefaults() {
// Retries aren't supported right now
// call verifyRetrySettingAreSane when we do
assertThat(builder.getRetryableCodes()).containsExactlyElementsIn(Collections.emptySet());
- assertThat(builder.getRetrySettings().getInitialRpcTimeout()).isEqualTo(Duration.ofSeconds(30));
- assertThat(builder.getRetrySettings().getMaxRpcTimeout()).isEqualTo(Duration.ofSeconds(30));
+ assertThat(builder.getRetrySettings().getInitialRpcTimeoutDuration())
+ .isEqualTo(Duration.ofSeconds(30));
+ assertThat(builder.getRetrySettings().getMaxRpcTimeoutDuration())
+ .isEqualTo(Duration.ofSeconds(30));
assertThat(builder.getRetrySettings().getMaxAttempts()).isEqualTo(1);
}
@@ -843,21 +848,22 @@ public void executeQueryRetriesAreDisabled() {
EnhancedBigtableStubSettings.newBuilder().executeQuerySettings();
assertThat(builder.getRetrySettings().getMaxAttempts()).isAtMost(1);
- assertThat(builder.getRetrySettings().getInitialRpcTimeout()).isAtMost(Duration.ofSeconds(30));
+ assertThat(builder.getRetrySettings().getInitialRpcTimeoutDuration())
+ .isAtMost(Duration.ofSeconds(30));
}
private void verifyRetrySettingAreSane(Set retryCodes, RetrySettings retrySettings) {
assertThat(retryCodes).containsAtLeast(Code.DEADLINE_EXCEEDED, Code.UNAVAILABLE);
- assertThat(retrySettings.getTotalTimeout()).isGreaterThan(Duration.ZERO);
+ assertThat(retrySettings.getTotalTimeoutDuration()).isGreaterThan(Duration.ZERO);
- assertThat(retrySettings.getInitialRetryDelay()).isGreaterThan(Duration.ZERO);
+ assertThat(retrySettings.getInitialRetryDelayDuration()).isGreaterThan(Duration.ZERO);
assertThat(retrySettings.getRetryDelayMultiplier()).isAtLeast(1.0);
- assertThat(retrySettings.getMaxRetryDelay()).isGreaterThan(Duration.ZERO);
+ assertThat(retrySettings.getMaxRetryDelayDuration()).isGreaterThan(Duration.ZERO);
- assertThat(retrySettings.getInitialRpcTimeout()).isGreaterThan(Duration.ZERO);
+ assertThat(retrySettings.getInitialRpcTimeoutDuration()).isGreaterThan(Duration.ZERO);
assertThat(retrySettings.getRpcTimeoutMultiplier()).isAtLeast(1.0);
- assertThat(retrySettings.getMaxRpcTimeout()).isGreaterThan(Duration.ZERO);
+ assertThat(retrySettings.getMaxRpcTimeoutDuration()).isGreaterThan(Duration.ZERO);
}
@Test
diff --git a/google-cloud-bigtable/src/test/java/com/google/cloud/bigtable/data/v2/stub/EnhancedBigtableStubTest.java b/google-cloud-bigtable/src/test/java/com/google/cloud/bigtable/data/v2/stub/EnhancedBigtableStubTest.java
index fcdb4a0624..0754104144 100644
--- a/google-cloud-bigtable/src/test/java/com/google/cloud/bigtable/data/v2/stub/EnhancedBigtableStubTest.java
+++ b/google-cloud-bigtable/src/test/java/com/google/cloud/bigtable/data/v2/stub/EnhancedBigtableStubTest.java
@@ -119,6 +119,7 @@
import java.security.KeyPair;
import java.security.KeyPairGenerator;
import java.security.NoSuchAlgorithmException;
+import java.time.Duration;
import java.util.Base64;
import java.util.Collection;
import java.util.Iterator;
@@ -133,7 +134,6 @@
import org.junit.runner.RunWith;
import org.junit.runners.JUnit4;
import org.mockito.Mockito;
-import org.threeten.bp.Duration;
@RunWith(JUnit4.class)
public class EnhancedBigtableStubTest {
@@ -616,7 +616,7 @@ public void testCallContextPropagatedInMutationBatcher()
// Override the timeout
GrpcCallContext clientCtx =
- GrpcCallContext.createDefault().withTimeout(Duration.ofMinutes(10));
+ GrpcCallContext.createDefault().withTimeoutDuration(Duration.ofMinutes(10));
// Send a batch
try (Batcher batcher =
@@ -647,7 +647,7 @@ public void testCallContextPropagatedInReadBatcher()
// Override the timeout
GrpcCallContext clientCtx =
- GrpcCallContext.createDefault().withTimeout(Duration.ofMinutes(10));
+ GrpcCallContext.createDefault().withTimeoutDuration(Duration.ofMinutes(10));
// Send a batch
try (Batcher batcher =
@@ -709,9 +709,9 @@ public void testBulkMutationFlowControlFeatureFlagIsNotSet() throws Exception {
public void testWaitTimeoutIsSet() throws Exception {
EnhancedBigtableStubSettings.Builder settings = defaultSettings.toBuilder();
// Set a shorter wait timeout and make watchdog checks more frequently
- settings.readRowsSettings().setWaitTimeout(WATCHDOG_CHECK_DURATION.dividedBy(2));
+ settings.readRowsSettings().setWaitTimeoutDuration(WATCHDOG_CHECK_DURATION.dividedBy(2));
settings.setStreamWatchdogProvider(
- InstantiatingWatchdogProvider.create().withCheckInterval(WATCHDOG_CHECK_DURATION));
+ InstantiatingWatchdogProvider.create().withCheckIntervalDuration(WATCHDOG_CHECK_DURATION));
try (EnhancedBigtableStub stub = EnhancedBigtableStub.create(settings.build())) {
ServerStream results = stub.readRowsCallable().call(Query.create(WAIT_TIME_TABLE_ID));
@@ -726,9 +726,11 @@ public void testWaitTimeoutIsSet() throws Exception {
public void testReadChangeStreamWaitTimeoutIsSet() throws Exception {
EnhancedBigtableStubSettings.Builder settings = defaultSettings.toBuilder();
// Set a shorter wait timeout and make watchdog checks more frequently
- settings.readChangeStreamSettings().setWaitTimeout(WATCHDOG_CHECK_DURATION.dividedBy(2));
+ settings
+ .readChangeStreamSettings()
+ .setWaitTimeoutDuration(WATCHDOG_CHECK_DURATION.dividedBy(2));
settings.setStreamWatchdogProvider(
- InstantiatingWatchdogProvider.create().withCheckInterval(WATCHDOG_CHECK_DURATION));
+ InstantiatingWatchdogProvider.create().withCheckIntervalDuration(WATCHDOG_CHECK_DURATION));
try (EnhancedBigtableStub stub = EnhancedBigtableStub.create(settings.build())) {
ServerStream results =
@@ -822,9 +824,9 @@ public void testCreateExecuteQueryCallable() throws InterruptedException {
public void testExecuteQueryWaitTimeoutIsSet() throws IOException {
EnhancedBigtableStubSettings.Builder settings = defaultSettings.toBuilder();
// Set a shorter wait timeout and make watchdog checks more frequently
- settings.executeQuerySettings().setWaitTimeout(WATCHDOG_CHECK_DURATION.dividedBy(2));
+ settings.executeQuerySettings().setWaitTimeoutDuration(WATCHDOG_CHECK_DURATION.dividedBy(2));
settings.setStreamWatchdogProvider(
- InstantiatingWatchdogProvider.create().withCheckInterval(WATCHDOG_CHECK_DURATION));
+ InstantiatingWatchdogProvider.create().withCheckIntervalDuration(WATCHDOG_CHECK_DURATION));
EnhancedBigtableStub stub = EnhancedBigtableStub.create(settings.build());
Iterator iterator =
@@ -838,9 +840,9 @@ public void testExecuteQueryWaitTimeoutWorksWithMetadataFuture()
throws IOException, InterruptedException {
EnhancedBigtableStubSettings.Builder settings = defaultSettings.toBuilder();
// Set a shorter wait timeout and make watchdog checks more frequently
- settings.executeQuerySettings().setWaitTimeout(WATCHDOG_CHECK_DURATION.dividedBy(2));
+ settings.executeQuerySettings().setWaitTimeoutDuration(WATCHDOG_CHECK_DURATION.dividedBy(2));
settings.setStreamWatchdogProvider(
- InstantiatingWatchdogProvider.create().withCheckInterval(WATCHDOG_CHECK_DURATION));
+ InstantiatingWatchdogProvider.create().withCheckIntervalDuration(WATCHDOG_CHECK_DURATION));
try (EnhancedBigtableStub stub = EnhancedBigtableStub.create(settings.build())) {
ApiFuture future =
diff --git a/google-cloud-bigtable/src/test/java/com/google/cloud/bigtable/data/v2/stub/RateLimitingCallableTest.java b/google-cloud-bigtable/src/test/java/com/google/cloud/bigtable/data/v2/stub/RateLimitingCallableTest.java
index f2fe77725d..652049b266 100644
--- a/google-cloud-bigtable/src/test/java/com/google/cloud/bigtable/data/v2/stub/RateLimitingCallableTest.java
+++ b/google-cloud-bigtable/src/test/java/com/google/cloud/bigtable/data/v2/stub/RateLimitingCallableTest.java
@@ -36,12 +36,12 @@
import com.google.protobuf.Duration;
import com.google.rpc.Code;
import com.google.rpc.Status;
+import java.time.Instant;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.JUnit4;
import org.mockito.Mockito;
-import org.threeten.bp.Instant;
@RunWith(JUnit4.class)
public class RateLimitingCallableTest {
@@ -72,7 +72,7 @@ public void testUpdateRate() throws Exception {
callableToTest.call(request, responseObserver, context);
callableToTest.setLimiterEnabled(true);
- Instant earlier = Instant.now().minus(org.threeten.bp.Duration.ofHours(1));
+ Instant earlier = Instant.now().minus(java.time.Duration.ofHours(1));
// Make sure rate will be updated.
callableToTest.getNextRateUpdateTime().set(earlier);
@@ -105,7 +105,7 @@ public void testNoRateLimitInfoDoesNotUpdateRate() throws Exception {
callableToTest.call(request, responseObserver, context);
callableToTest.setLimiterEnabled(true);
- Instant earlier = Instant.now().minus(org.threeten.bp.Duration.ofHours(1));
+ Instant earlier = Instant.now().minus(java.time.Duration.ofHours(1));
// Make sure rate will be updated.
callableToTest.getNextRateUpdateTime().set(earlier);
@@ -131,7 +131,7 @@ public void testInvalidRateLimitInfoDoesNotUpdateRate() throws Exception {
callableToTest.call(request, responseObserver, context);
callableToTest.setLimiterEnabled(true);
- Instant earlier = Instant.now().minus(org.threeten.bp.Duration.ofHours(1));
+ Instant earlier = Instant.now().minus(java.time.Duration.ofHours(1));
// make sure QPS will be updated
callableToTest.getNextRateUpdateTime().set(earlier);
@@ -166,7 +166,7 @@ public void testMissingRateLimitInfoFactorDoesNotUpdateRate() throws Exception {
callableToTest.call(request, responseObserver, context);
callableToTest.setLimiterEnabled(true);
- Instant earlier = Instant.now().minus(org.threeten.bp.Duration.ofHours(1));
+ Instant earlier = Instant.now().minus(java.time.Duration.ofHours(1));
// Make sure rate can be updated.
callableToTest.getNextRateUpdateTime().set(earlier);
@@ -199,7 +199,7 @@ public void testNoUpdateBeforeAllowedTime() throws Exception {
callableToTest.call(request, responseObserver, context);
callableToTest.setLimiterEnabled(true);
- Instant later = Instant.now().plus(org.threeten.bp.Duration.ofHours(1));
+ Instant later = Instant.now().plus(java.time.Duration.ofHours(1));
// Make sure rate will not be updated.
callableToTest.getNextRateUpdateTime().set(later);
double oldQps = callableToTest.getCurrentRate();
@@ -232,7 +232,7 @@ public void testDoesNotDisableBeforeAllowedTime() throws Exception {
callableToTest.call(request, responseObserver, context);
callableToTest.setLimiterEnabled(true);
- Instant later = Instant.now().plus(org.threeten.bp.Duration.ofHours(1));
+ Instant later = Instant.now().plus(java.time.Duration.ofHours(1));
// Make sure limiter will not be disabled.
callableToTest.getNextRateUpdateTime().set(later);
double oldQps = callableToTest.getCurrentRate();
@@ -257,7 +257,7 @@ public void testEnableWithinPeriodDoesNotUpdateRate() throws Exception {
callableToTest.call(request, responseObserver, context);
callableToTest.setRate(1.5);
- Instant later = Instant.now().plus(org.threeten.bp.Duration.ofHours(1));
+ Instant later = Instant.now().plus(java.time.Duration.ofHours(1));
// Even though the rate update time is far in the future, enable is always allowed.
callableToTest.getNextRateUpdateTime().set(later);
double oldQps = callableToTest.getCurrentRate();
@@ -289,7 +289,7 @@ public void testEnableWithinPeriodDoesNotUpdateRate() throws Exception {
public void testErrorInfoLowerQPS() throws Exception {
callableToTest.call(request, responseObserver, context);
- Instant earlier = Instant.now().minus(org.threeten.bp.Duration.ofHours(1));
+ Instant earlier = Instant.now().minus(java.time.Duration.ofHours(1));
// make sure QPS will be updated
callableToTest.getNextRateUpdateTime().set(earlier);
diff --git a/google-cloud-bigtable/src/test/java/com/google/cloud/bigtable/data/v2/stub/changestream/ChangeStreamRecordMergingCallableTest.java b/google-cloud-bigtable/src/test/java/com/google/cloud/bigtable/data/v2/stub/changestream/ChangeStreamRecordMergingCallableTest.java
index f0939fb0cf..c34173edea 100644
--- a/google-cloud-bigtable/src/test/java/com/google/cloud/bigtable/data/v2/stub/changestream/ChangeStreamRecordMergingCallableTest.java
+++ b/google-cloud-bigtable/src/test/java/com/google/cloud/bigtable/data/v2/stub/changestream/ChangeStreamRecordMergingCallableTest.java
@@ -33,13 +33,13 @@
import com.google.protobuf.ByteString;
import com.google.protobuf.Timestamp;
import com.google.rpc.Status;
+import java.time.Instant;
import java.util.Collections;
import java.util.List;
import org.junit.Assert;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.JUnit4;
-import org.threeten.bp.Instant;
/**
* Additional tests in addition to {@link ReadChangeStreamMergingAcceptanceTest}.
@@ -80,7 +80,7 @@ public void heartbeatTest() {
.isEqualTo(ByteStringRange.create(rowRange.getStartKeyClosed(), rowRange.getEndKeyOpen()));
assertThat(heartbeat.getChangeStreamContinuationToken().getToken())
.isEqualTo(heartbeatProto.getContinuationToken().getToken());
- assertThat(heartbeat.getEstimatedLowWatermark())
+ assertThat(heartbeat.getEstimatedLowWatermarkInstant())
.isEqualTo(
Instant.ofEpochSecond(
heartbeatProto.getEstimatedLowWatermark().getSeconds(),
diff --git a/google-cloud-bigtable/src/test/java/com/google/cloud/bigtable/data/v2/stub/changestream/ReadChangeStreamRetryTest.java b/google-cloud-bigtable/src/test/java/com/google/cloud/bigtable/data/v2/stub/changestream/ReadChangeStreamRetryTest.java
index 48a62bfee8..3e03236bb8 100644
--- a/google-cloud-bigtable/src/test/java/com/google/cloud/bigtable/data/v2/stub/changestream/ReadChangeStreamRetryTest.java
+++ b/google-cloud-bigtable/src/test/java/com/google/cloud/bigtable/data/v2/stub/changestream/ReadChangeStreamRetryTest.java
@@ -51,6 +51,7 @@
import io.grpc.stub.StreamObserver;
import io.grpc.testing.GrpcServerRule;
import java.io.IOException;
+import java.time.Instant;
import java.util.Collections;
import java.util.List;
import java.util.Queue;
@@ -62,7 +63,6 @@
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.JUnit4;
-import org.threeten.bp.Instant;
@RunWith(JUnit4.class)
public class ReadChangeStreamRetryTest {
diff --git a/google-cloud-bigtable/src/test/java/com/google/cloud/bigtable/data/v2/stub/changestream/ReadChangeStreamUserCallableTest.java b/google-cloud-bigtable/src/test/java/com/google/cloud/bigtable/data/v2/stub/changestream/ReadChangeStreamUserCallableTest.java
index 84f9765ea6..d28d39c3d9 100644
--- a/google-cloud-bigtable/src/test/java/com/google/cloud/bigtable/data/v2/stub/changestream/ReadChangeStreamUserCallableTest.java
+++ b/google-cloud-bigtable/src/test/java/com/google/cloud/bigtable/data/v2/stub/changestream/ReadChangeStreamUserCallableTest.java
@@ -21,11 +21,11 @@
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 java.time.Instant;
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)
public class ReadChangeStreamUserCallableTest {
diff --git a/google-cloud-bigtable/src/test/java/com/google/cloud/bigtable/data/v2/stub/metrics/CompositeTracerTest.java b/google-cloud-bigtable/src/test/java/com/google/cloud/bigtable/data/v2/stub/metrics/CompositeTracerTest.java
index cb0916ad28..2bd4f8fd0e 100644
--- a/google-cloud-bigtable/src/test/java/com/google/cloud/bigtable/data/v2/stub/metrics/CompositeTracerTest.java
+++ b/google-cloud-bigtable/src/test/java/com/google/cloud/bigtable/data/v2/stub/metrics/CompositeTracerTest.java
@@ -29,6 +29,7 @@
import io.grpc.Status;
import io.grpc.StatusRuntimeException;
import java.lang.reflect.Method;
+import java.time.Duration;
import java.util.Arrays;
import org.junit.Assert;
import org.junit.Before;
@@ -39,7 +40,6 @@
import org.mockito.Mock;
import org.mockito.junit.MockitoJUnit;
import org.mockito.junit.MockitoRule;
-import org.threeten.bp.Duration;
@RunWith(JUnit4.class)
public class CompositeTracerTest {
@@ -149,11 +149,11 @@ public void testAttemptCancelled() {
public void testAttemptFailed() {
RuntimeException error = new RuntimeException();
Duration delay = Duration.ofMillis(10);
- compositeTracer.attemptFailed(error, delay);
- verify(child1, times(1)).attemptFailed(error, delay);
- verify(child2, times(1)).attemptFailed(error, delay);
- verify(child3, times(1)).attemptFailed(error, delay);
- verify(child4, times(1)).attemptFailed(error, delay);
+ compositeTracer.attemptFailedDuration(error, delay);
+ verify(child1, times(1)).attemptFailedDuration(error, delay);
+ verify(child2, times(1)).attemptFailedDuration(error, delay);
+ verify(child3, times(1)).attemptFailedDuration(error, delay);
+ verify(child4, times(1)).attemptFailedDuration(error, delay);
}
@Test
diff --git a/google-cloud-bigtable/src/test/java/com/google/cloud/bigtable/data/v2/stub/mutaterows/MutateRowsAttemptCallableTest.java b/google-cloud-bigtable/src/test/java/com/google/cloud/bigtable/data/v2/stub/mutaterows/MutateRowsAttemptCallableTest.java
index 6dd1ff9bd0..60ec5193e4 100644
--- a/google-cloud-bigtable/src/test/java/com/google/cloud/bigtable/data/v2/stub/mutaterows/MutateRowsAttemptCallableTest.java
+++ b/google-cloud-bigtable/src/test/java/com/google/cloud/bigtable/data/v2/stub/mutaterows/MutateRowsAttemptCallableTest.java
@@ -41,6 +41,7 @@
import com.google.common.collect.Lists;
import com.google.protobuf.ByteString;
import com.google.rpc.Status;
+import java.time.Duration;
import java.util.List;
import java.util.Set;
import java.util.concurrent.Callable;
@@ -49,7 +50,6 @@
import org.junit.runner.RunWith;
import org.junit.runners.JUnit4;
import org.mockito.Mockito;
-import org.threeten.bp.Duration;
@RunWith(JUnit4.class)
public class MutateRowsAttemptCallableTest {
@@ -140,7 +140,7 @@ public void missingEntry() throws Exception {
@Test
public void testNoRpcTimeout() {
parentFuture.timedAttemptSettings =
- parentFuture.timedAttemptSettings.toBuilder().setRpcTimeout(Duration.ZERO).build();
+ parentFuture.timedAttemptSettings.toBuilder().setRpcTimeoutDuration(Duration.ZERO).build();
MutateRowsRequest request =
MutateRowsRequest.newBuilder().addEntries(Entry.getDefaultInstance()).build();
@@ -405,12 +405,13 @@ static class MockRetryingFuture extends AbstractApiFuture 0) {
- settings.setInitialRpcTimeout(newTimeout).setMaxRpcTimeout(newTimeout);
+ settings.setInitialRpcTimeoutDuration(newTimeout).setMaxRpcTimeoutDuration(newTimeout);
}
- settings.setTotalTimeout(newTimeout);
+ settings.setTotalTimeoutDuration(newTimeout);
}
/** Helper method to get a client object by its id. */
diff --git a/test-proxy/src/main/java/com/google/cloud/bigtable/testproxy/ResultSetSerializer.java b/test-proxy/src/main/java/com/google/cloud/bigtable/testproxy/ResultSetSerializer.java
index c138c82a6b..7400986b6e 100644
--- a/test-proxy/src/main/java/com/google/cloud/bigtable/testproxy/ResultSetSerializer.java
+++ b/test-proxy/src/main/java/com/google/cloud/bigtable/testproxy/ResultSetSerializer.java
@@ -33,9 +33,9 @@
import com.google.cloud.bigtable.data.v2.models.sql.SqlType;
import com.google.cloud.bigtable.data.v2.models.sql.StructReader;
import com.google.protobuf.ByteString;
+import java.time.Instant;
import java.util.List;
import java.util.concurrent.ExecutionException;
-import org.threeten.bp.Instant;
public class ResultSetSerializer {
public static ExecuteQueryResult toExecuteQueryResult(ResultSet resultSet)
diff --git a/test-proxy/src/main/java/com/google/cloud/bigtable/testproxy/StatementDeserializer.java b/test-proxy/src/main/java/com/google/cloud/bigtable/testproxy/StatementDeserializer.java
index ae3b50aa7f..4eb5f47e3a 100644
--- a/test-proxy/src/main/java/com/google/cloud/bigtable/testproxy/StatementDeserializer.java
+++ b/test-proxy/src/main/java/com/google/cloud/bigtable/testproxy/StatementDeserializer.java
@@ -21,10 +21,10 @@
import com.google.cloud.bigtable.data.v2.models.sql.SqlType;
import com.google.cloud.bigtable.data.v2.models.sql.Statement;
import com.google.protobuf.Timestamp;
+import java.time.Instant;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
-import org.threeten.bp.Instant;
public class StatementDeserializer {