diff --git a/grpc-gcp/CHANGELOG.md b/grpc-gcp/CHANGELOG.md new file mode 100644 index 00000000..eb625256 --- /dev/null +++ b/grpc-gcp/CHANGELOG.md @@ -0,0 +1,10 @@ +# Changelog + +## 1.0.0 (2021-06-11) + +### Features + +* gRPC channel pool with configurable channel affinity. +* provide a channel with minimum active streams for a new call. +* an optional fallback from non-ready channel to a ready channel. +* an option to detect unresponsive channels. diff --git a/grpc-gcp/build.gradle b/grpc-gcp/build.gradle index 00a49a23..84d98d8d 100644 --- a/grpc-gcp/build.gradle +++ b/grpc-gcp/build.gradle @@ -2,8 +2,10 @@ plugins { id 'java' id 'maven' id 'maven-publish' + id 'signing' id 'com.google.protobuf' version '0.8.10' id 'com.github.sherter.google-java-format' version '0.8' + id 'io.codearte.nexus-staging' version '0.8.0' } repositories { @@ -13,11 +15,12 @@ repositories { mavenLocal() } -version = '0.0.1-SNAPSHOT' +version = '1.0.0' group = 'com.google.cloud' description = 'GRPC-GCP-Extension Java' sourceCompatibility = '1.8' +def title = 'gRPC extension library for Google Cloud Platform' def grpcVersion = '1.36.0' def protobufVersion = '3.12.0' def protocVersion = '3.12.0' @@ -61,8 +64,8 @@ test { outputs.upToDateWhen {false} showStandardStreams = true } - exclude 'com/google/grpc/gcp/SpannerIntegrationTest.class' - exclude 'com/google/grpc/gcp/BigtableIntegrationTest.class' + exclude 'com/google/cloud/grpc/SpannerIntegrationTest.class' + exclude 'com/google/cloud/grpc/BigtableIntegrationTest.class' } task allTests( type: Test ) { @@ -88,6 +91,16 @@ task sourcesJar(type: Jar) { from sourceSets.main.allJava } +if (project.hasProperty('ossrhUsername') && project.hasProperty('ossrhPassword')) { + // Nexus staging plugin only works at root project level + // See https://github.com/Codearte/gradle-nexus-staging-plugin/issues/47 + nexusStaging { + username = ossrhUsername + password = ossrhPassword + packageGroup = group + } +} + publishing { publications { maven(MavenPublication) { @@ -98,7 +111,7 @@ publishing { artifactId = 'grpc-gcp' version = version pom { - name = "gRPC extension library for Google Cloud Library" + name = title url = 'https://github.com/GoogleCloudPlatform/grpc-gcp-java/tree/master/grpc-gcp' afterEvaluate { // description is not available until evaluated. @@ -130,4 +143,22 @@ publishing { } } } + repositories { + maven { + url 'https://google.oss.sonatype.org/service/local/staging/deploy/maven2/' + credentials { + username = project.hasProperty('ossrhUsername') ? project.getProperty('ossrhUsername') : null + password = project.hasProperty('ossrhPassword') ? project.getProperty('ossrhPassword') : null + } + } + } +} + +signing { + if (!project.hasProperty('skip.signing')) { + if (project.hasProperty('signing.gnupg.executable')) { + useGpgCmd() + } + sign publishing.publications.maven + } } diff --git a/grpc-gcp/src/main/java/com/google/grpc/gcp/GcpClientCall.java b/grpc-gcp/src/main/java/com/google/cloud/grpc/GcpClientCall.java similarity index 99% rename from grpc-gcp/src/main/java/com/google/grpc/gcp/GcpClientCall.java rename to grpc-gcp/src/main/java/com/google/cloud/grpc/GcpClientCall.java index e0853001..1cf27280 100644 --- a/grpc-gcp/src/main/java/com/google/grpc/gcp/GcpClientCall.java +++ b/grpc-gcp/src/main/java/com/google/cloud/grpc/GcpClientCall.java @@ -14,10 +14,10 @@ * limitations under the License. */ -package com.google.grpc.gcp; +package com.google.cloud.grpc; +import com.google.cloud.grpc.proto.AffinityConfig; import com.google.common.base.MoreObjects; -import com.google.grpc.gcp.proto.AffinityConfig; import io.grpc.Attributes; import io.grpc.CallOptions; import io.grpc.ClientCall; diff --git a/grpc-gcp/src/main/java/com/google/grpc/gcp/GcpManagedChannel.java b/grpc-gcp/src/main/java/com/google/cloud/grpc/GcpManagedChannel.java similarity index 89% rename from grpc-gcp/src/main/java/com/google/grpc/gcp/GcpManagedChannel.java rename to grpc-gcp/src/main/java/com/google/cloud/grpc/GcpManagedChannel.java index 9fdef91e..35b7a7c6 100644 --- a/grpc-gcp/src/main/java/com/google/grpc/gcp/GcpManagedChannel.java +++ b/grpc-gcp/src/main/java/com/google/cloud/grpc/GcpManagedChannel.java @@ -14,49 +14,14 @@ * limitations under the License. */ -package com.google.grpc.gcp; - -import static com.google.grpc.gcp.GcpMetricsConstants.COUNT; -import static com.google.grpc.gcp.GcpMetricsConstants.METRIC_AVG_CHANNEL_READINESS_TIME; -import static com.google.grpc.gcp.GcpMetricsConstants.METRIC_MAX_ACTIVE_STREAMS; -import static com.google.grpc.gcp.GcpMetricsConstants.METRIC_MAX_AFFINITY; -import static com.google.grpc.gcp.GcpMetricsConstants.METRIC_MAX_ALLOWED_CHANNELS; -import static com.google.grpc.gcp.GcpMetricsConstants.METRIC_MAX_CALLS; -import static com.google.grpc.gcp.GcpMetricsConstants.METRIC_MAX_CHANNELS; -import static com.google.grpc.gcp.GcpMetricsConstants.METRIC_MAX_CHANNEL_READINESS_TIME; -import static com.google.grpc.gcp.GcpMetricsConstants.METRIC_MAX_READY_CHANNELS; -import static com.google.grpc.gcp.GcpMetricsConstants.METRIC_MAX_TOTAL_ACTIVE_STREAMS; -import static com.google.grpc.gcp.GcpMetricsConstants.METRIC_MAX_UNRESPONSIVE_DETECTION_TIME; -import static com.google.grpc.gcp.GcpMetricsConstants.METRIC_MAX_UNRESPONSIVE_DROPPED_CALLS; -import static com.google.grpc.gcp.GcpMetricsConstants.METRIC_MIN_ACTIVE_STREAMS; -import static com.google.grpc.gcp.GcpMetricsConstants.METRIC_MIN_AFFINITY; -import static com.google.grpc.gcp.GcpMetricsConstants.METRIC_MIN_CALLS; -import static com.google.grpc.gcp.GcpMetricsConstants.METRIC_MIN_CHANNEL_READINESS_TIME; -import static com.google.grpc.gcp.GcpMetricsConstants.METRIC_MIN_READY_CHANNELS; -import static com.google.grpc.gcp.GcpMetricsConstants.METRIC_MIN_TOTAL_ACTIVE_STREAMS; -import static com.google.grpc.gcp.GcpMetricsConstants.METRIC_MIN_UNRESPONSIVE_DETECTION_TIME; -import static com.google.grpc.gcp.GcpMetricsConstants.METRIC_MIN_UNRESPONSIVE_DROPPED_CALLS; -import static com.google.grpc.gcp.GcpMetricsConstants.METRIC_NUM_AFFINITY; -import static com.google.grpc.gcp.GcpMetricsConstants.METRIC_NUM_CALLS_COMPLETED; -import static com.google.grpc.gcp.GcpMetricsConstants.METRIC_NUM_CHANNEL_CONNECT; -import static com.google.grpc.gcp.GcpMetricsConstants.METRIC_NUM_CHANNEL_DISCONNECT; -import static com.google.grpc.gcp.GcpMetricsConstants.METRIC_NUM_FALLBACKS; -import static com.google.grpc.gcp.GcpMetricsConstants.METRIC_NUM_UNRESPONSIVE_DETECTIONS; -import static com.google.grpc.gcp.GcpMetricsConstants.MICROSECOND; -import static com.google.grpc.gcp.GcpMetricsConstants.MILLISECOND; -import static com.google.grpc.gcp.GcpMetricsConstants.POOL_INDEX_DESC; -import static com.google.grpc.gcp.GcpMetricsConstants.POOL_INDEX_LABEL; -import static com.google.grpc.gcp.GcpMetricsConstants.RESULT_DESC; -import static com.google.grpc.gcp.GcpMetricsConstants.RESULT_ERROR; -import static com.google.grpc.gcp.GcpMetricsConstants.RESULT_LABEL; -import static com.google.grpc.gcp.GcpMetricsConstants.RESULT_SUCCESS; +package com.google.cloud.grpc; +import com.google.cloud.grpc.GcpManagedChannelOptions.GcpMetricsOptions; +import com.google.cloud.grpc.GcpManagedChannelOptions.GcpResiliencyOptions; +import com.google.cloud.grpc.proto.AffinityConfig; +import com.google.cloud.grpc.proto.ApiConfig; +import com.google.cloud.grpc.proto.MethodConfig; import com.google.common.annotations.VisibleForTesting; -import com.google.grpc.gcp.GcpManagedChannelOptions.GcpMetricsOptions; -import com.google.grpc.gcp.GcpManagedChannelOptions.GcpResiliencyOptions; -import com.google.grpc.gcp.proto.AffinityConfig; -import com.google.grpc.gcp.proto.ApiConfig; -import com.google.grpc.gcp.proto.MethodConfig; import com.google.protobuf.Descriptors.FieldDescriptor; import com.google.protobuf.MessageOrBuilder; import io.grpc.CallOptions; @@ -131,12 +96,16 @@ public class GcpManagedChannel extends ManagedChannel { private MetricRegistry metricRegistry; private final List labelKeys = new ArrayList<>(); private final List labelKeysWithResult = - new ArrayList<>(Collections.singletonList(LabelKey.create(RESULT_LABEL, RESULT_DESC))); + new ArrayList<>( + Collections.singletonList( + LabelKey.create(GcpMetricsConstants.RESULT_LABEL, GcpMetricsConstants.RESULT_DESC))); private final List labelValues = new ArrayList<>(); private final List labelValuesSuccess = - new ArrayList<>(Collections.singletonList(LabelValue.create(RESULT_SUCCESS))); + new ArrayList<>( + Collections.singletonList(LabelValue.create(GcpMetricsConstants.RESULT_SUCCESS))); private final List labelValuesError = - new ArrayList<>(Collections.singletonList(LabelValue.create(RESULT_ERROR))); + new ArrayList<>( + Collections.singletonList(LabelValue.create(GcpMetricsConstants.RESULT_ERROR))); private String metricPrefix; // Metrics counters. @@ -231,7 +200,8 @@ private void initMetrics() { labelValuesSuccess.addAll(metricsOptions.getLabelValues()); labelValuesError.addAll(metricsOptions.getLabelValues()); - final LabelKey poolKey = LabelKey.create(POOL_INDEX_LABEL, POOL_INDEX_DESC); + final LabelKey poolKey = + LabelKey.create(GcpMetricsConstants.POOL_INDEX_LABEL, GcpMetricsConstants.POOL_INDEX_DESC); labelKeys.add(poolKey); labelKeysWithResult.add(poolKey); final LabelValue poolIndex = @@ -243,181 +213,181 @@ private void initMetrics() { metricPrefix = metricsOptions.getNamePrefix(); createDerivedLongGaugeTimeSeries( - METRIC_MIN_READY_CHANNELS, + GcpMetricsConstants.METRIC_MIN_READY_CHANNELS, "The minimum number of channels simultaneously in the READY state.", - COUNT, + GcpMetricsConstants.COUNT, this, GcpManagedChannel::reportMinReadyChannels); createDerivedLongGaugeTimeSeries( - METRIC_MAX_READY_CHANNELS, + GcpMetricsConstants.METRIC_MAX_READY_CHANNELS, "The maximum number of channels simultaneously in the READY state.", - COUNT, + GcpMetricsConstants.COUNT, this, GcpManagedChannel::reportMaxReadyChannels); createDerivedLongGaugeTimeSeries( - METRIC_MAX_CHANNELS, + GcpMetricsConstants.METRIC_MAX_CHANNELS, "The maximum number of channels in the pool.", - COUNT, + GcpMetricsConstants.COUNT, this, GcpManagedChannel::reportMaxChannels); createDerivedLongGaugeTimeSeries( - METRIC_MAX_ALLOWED_CHANNELS, + GcpMetricsConstants.METRIC_MAX_ALLOWED_CHANNELS, "The maximum number of channels allowed in the pool. (The poll max size)", - COUNT, + GcpMetricsConstants.COUNT, this, GcpManagedChannel::reportMaxAllowedChannels); createDerivedLongCumulativeTimeSeries( - METRIC_NUM_CHANNEL_DISCONNECT, + GcpMetricsConstants.METRIC_NUM_CHANNEL_DISCONNECT, "The number of disconnections (occurrences when a channel deviates from the READY state)", - COUNT, + GcpMetricsConstants.COUNT, this, GcpManagedChannel::reportNumChannelDisconnect); createDerivedLongCumulativeTimeSeries( - METRIC_NUM_CHANNEL_CONNECT, + GcpMetricsConstants.METRIC_NUM_CHANNEL_CONNECT, "The number of times when a channel reached the READY state.", - COUNT, + GcpMetricsConstants.COUNT, this, GcpManagedChannel::reportNumChannelConnect); createDerivedLongGaugeTimeSeries( - METRIC_MIN_CHANNEL_READINESS_TIME, + GcpMetricsConstants.METRIC_MIN_CHANNEL_READINESS_TIME, "The minimum time it took to transition a channel to the READY state.", - MICROSECOND, + GcpMetricsConstants.MICROSECOND, this, GcpManagedChannel::reportMinReadinessTime); createDerivedLongGaugeTimeSeries( - METRIC_AVG_CHANNEL_READINESS_TIME, + GcpMetricsConstants.METRIC_AVG_CHANNEL_READINESS_TIME, "The average time it took to transition a channel to the READY state.", - MICROSECOND, + GcpMetricsConstants.MICROSECOND, this, GcpManagedChannel::reportAvgReadinessTime); createDerivedLongGaugeTimeSeries( - METRIC_MAX_CHANNEL_READINESS_TIME, + GcpMetricsConstants.METRIC_MAX_CHANNEL_READINESS_TIME, "The maximum time it took to transition a channel to the READY state.", - MICROSECOND, + GcpMetricsConstants.MICROSECOND, this, GcpManagedChannel::reportMaxReadinessTime); createDerivedLongGaugeTimeSeries( - METRIC_MIN_ACTIVE_STREAMS, + GcpMetricsConstants.METRIC_MIN_ACTIVE_STREAMS, "The minimum number of active streams on any channel.", - COUNT, + GcpMetricsConstants.COUNT, this, GcpManagedChannel::reportMinActiveStreams); createDerivedLongGaugeTimeSeries( - METRIC_MAX_ACTIVE_STREAMS, + GcpMetricsConstants.METRIC_MAX_ACTIVE_STREAMS, "The maximum number of active streams on any channel.", - COUNT, + GcpMetricsConstants.COUNT, this, GcpManagedChannel::reportMaxActiveStreams); createDerivedLongGaugeTimeSeries( - METRIC_MIN_TOTAL_ACTIVE_STREAMS, + GcpMetricsConstants.METRIC_MIN_TOTAL_ACTIVE_STREAMS, "The minimum total number of active streams across all channels.", - COUNT, + GcpMetricsConstants.COUNT, this, GcpManagedChannel::reportMinTotalActiveStreams); createDerivedLongGaugeTimeSeries( - METRIC_MAX_TOTAL_ACTIVE_STREAMS, + GcpMetricsConstants.METRIC_MAX_TOTAL_ACTIVE_STREAMS, "The maximum total number of active streams across all channels.", - COUNT, + GcpMetricsConstants.COUNT, this, GcpManagedChannel::reportMaxTotalActiveStreams); createDerivedLongGaugeTimeSeries( - METRIC_MIN_AFFINITY, + GcpMetricsConstants.METRIC_MIN_AFFINITY, "The minimum number of affinity count on any channel.", - COUNT, + GcpMetricsConstants.COUNT, this, GcpManagedChannel::reportMinAffinity); createDerivedLongGaugeTimeSeries( - METRIC_MAX_AFFINITY, + GcpMetricsConstants.METRIC_MAX_AFFINITY, "The maximum number of affinity count on any channel.", - COUNT, + GcpMetricsConstants.COUNT, this, GcpManagedChannel::reportMaxAffinity); createDerivedLongGaugeTimeSeries( - METRIC_NUM_AFFINITY, + GcpMetricsConstants.METRIC_NUM_AFFINITY, "The total number of affinity count across all channels.", - COUNT, + GcpMetricsConstants.COUNT, this, GcpManagedChannel::reportNumAffinity); createDerivedLongGaugeTimeSeriesWithResult( - METRIC_MIN_CALLS, + GcpMetricsConstants.METRIC_MIN_CALLS, "The minimum number of completed calls on any channel.", - COUNT, + GcpMetricsConstants.COUNT, this, GcpManagedChannel::reportMinOkCalls, GcpManagedChannel::reportMinErrCalls); createDerivedLongGaugeTimeSeriesWithResult( - METRIC_MAX_CALLS, + GcpMetricsConstants.METRIC_MAX_CALLS, "The maximum number of completed calls on any channel.", - COUNT, + GcpMetricsConstants.COUNT, this, GcpManagedChannel::reportMaxOkCalls, GcpManagedChannel::reportMaxErrCalls); createDerivedLongCumulativeTimeSeriesWithResult( - METRIC_NUM_CALLS_COMPLETED, + GcpMetricsConstants.METRIC_NUM_CALLS_COMPLETED, "The number of calls completed across all channels.", - COUNT, + GcpMetricsConstants.COUNT, this, GcpManagedChannel::reportTotalOkCalls, GcpManagedChannel::reportTotalErrCalls); createDerivedLongCumulativeTimeSeriesWithResult( - METRIC_NUM_FALLBACKS, + GcpMetricsConstants.METRIC_NUM_FALLBACKS, "The number of calls that had fallback to another channel.", - COUNT, + GcpMetricsConstants.COUNT, this, GcpManagedChannel::reportSucceededFallbacks, GcpManagedChannel::reportFailedFallbacks); createDerivedLongCumulativeTimeSeries( - METRIC_NUM_UNRESPONSIVE_DETECTIONS, + GcpMetricsConstants.METRIC_NUM_UNRESPONSIVE_DETECTIONS, "The number of unresponsive connections detected.", - COUNT, + GcpMetricsConstants.COUNT, this, GcpManagedChannel::reportUnresponsiveDetectionCount); createDerivedLongGaugeTimeSeries( - METRIC_MIN_UNRESPONSIVE_DETECTION_TIME, + GcpMetricsConstants.METRIC_MIN_UNRESPONSIVE_DETECTION_TIME, "The minimum time it took to detect an unresponsive connection.", - MILLISECOND, + GcpMetricsConstants.MILLISECOND, this, GcpManagedChannel::reportMinUnresponsiveMs); createDerivedLongGaugeTimeSeries( - METRIC_MAX_UNRESPONSIVE_DETECTION_TIME, + GcpMetricsConstants.METRIC_MAX_UNRESPONSIVE_DETECTION_TIME, "The maximum time it took to detect an unresponsive connection.", - MILLISECOND, + GcpMetricsConstants.MILLISECOND, this, GcpManagedChannel::reportMaxUnresponsiveMs); createDerivedLongGaugeTimeSeries( - METRIC_MIN_UNRESPONSIVE_DROPPED_CALLS, + GcpMetricsConstants.METRIC_MIN_UNRESPONSIVE_DROPPED_CALLS, "The minimum calls dropped before detection of an unresponsive connection.", - MILLISECOND, + GcpMetricsConstants.MILLISECOND, this, GcpManagedChannel::reportMinUnresponsiveDrops); createDerivedLongGaugeTimeSeries( - METRIC_MAX_UNRESPONSIVE_DROPPED_CALLS, + GcpMetricsConstants.METRIC_MAX_UNRESPONSIVE_DROPPED_CALLS, "The maximum calls dropped before detection of an unresponsive connection.", - MILLISECOND, + GcpMetricsConstants.MILLISECOND, this, GcpManagedChannel::reportMaxUnresponsiveDrops); } diff --git a/grpc-gcp/src/main/java/com/google/grpc/gcp/GcpManagedChannelBuilder.java b/grpc-gcp/src/main/java/com/google/cloud/grpc/GcpManagedChannelBuilder.java similarity index 97% rename from grpc-gcp/src/main/java/com/google/grpc/gcp/GcpManagedChannelBuilder.java rename to grpc-gcp/src/main/java/com/google/cloud/grpc/GcpManagedChannelBuilder.java index 6a3ac757..d635bccb 100644 --- a/grpc-gcp/src/main/java/com/google/grpc/gcp/GcpManagedChannelBuilder.java +++ b/grpc-gcp/src/main/java/com/google/cloud/grpc/GcpManagedChannelBuilder.java @@ -14,10 +14,10 @@ * limitations under the License. */ -package com.google.grpc.gcp; +package com.google.cloud.grpc; +import com.google.cloud.grpc.proto.ApiConfig; import com.google.common.annotations.VisibleForTesting; -import com.google.grpc.gcp.proto.ApiConfig; import com.google.protobuf.util.JsonFormat; import io.grpc.ForwardingChannelBuilder; import io.grpc.ManagedChannel; diff --git a/grpc-gcp/src/main/java/com/google/grpc/gcp/GcpManagedChannelOptions.java b/grpc-gcp/src/main/java/com/google/cloud/grpc/GcpManagedChannelOptions.java similarity index 99% rename from grpc-gcp/src/main/java/com/google/grpc/gcp/GcpManagedChannelOptions.java rename to grpc-gcp/src/main/java/com/google/cloud/grpc/GcpManagedChannelOptions.java index fb04b5f9..8870bcb5 100644 --- a/grpc-gcp/src/main/java/com/google/grpc/gcp/GcpManagedChannelOptions.java +++ b/grpc-gcp/src/main/java/com/google/cloud/grpc/GcpManagedChannelOptions.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package com.google.grpc.gcp; +package com.google.cloud.grpc; import com.google.common.base.Preconditions; import io.opencensus.metrics.LabelKey; diff --git a/grpc-gcp/src/main/java/com/google/grpc/gcp/GcpMetricsConstants.java b/grpc-gcp/src/main/java/com/google/cloud/grpc/GcpMetricsConstants.java similarity index 99% rename from grpc-gcp/src/main/java/com/google/grpc/gcp/GcpMetricsConstants.java rename to grpc-gcp/src/main/java/com/google/cloud/grpc/GcpMetricsConstants.java index f88ed8f3..df14f407 100644 --- a/grpc-gcp/src/main/java/com/google/grpc/gcp/GcpMetricsConstants.java +++ b/grpc-gcp/src/main/java/com/google/cloud/grpc/GcpMetricsConstants.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package com.google.grpc.gcp; +package com.google.cloud.grpc; class GcpMetricsConstants { public static String POOL_INDEX_LABEL = "pool_index"; diff --git a/grpc-gcp/src/main/proto/google/grpc/gcp/proto/grpc_gcp.proto b/grpc-gcp/src/main/proto/google/grpc/gcp/proto/grpc_gcp.proto index 839a5381..1301dd99 100644 --- a/grpc-gcp/src/main/proto/google/grpc/gcp/proto/grpc_gcp.proto +++ b/grpc-gcp/src/main/proto/google/grpc/gcp/proto/grpc_gcp.proto @@ -18,7 +18,7 @@ package grpc.gcp; option java_multiple_files = true; option java_outer_classname = "GcpExtensionProto"; -option java_package = "com.google.grpc.gcp.proto"; +option java_package = "com.google.cloud.grpc.proto"; message ApiConfig { // The channel pool configurations. diff --git a/grpc-gcp/src/test/java/com/google/grpc/gcp/BigtableIntegrationTest.java b/grpc-gcp/src/test/java/com/google/cloud/grpc/BigtableIntegrationTest.java similarity index 99% rename from grpc-gcp/src/test/java/com/google/grpc/gcp/BigtableIntegrationTest.java rename to grpc-gcp/src/test/java/com/google/cloud/grpc/BigtableIntegrationTest.java index 82d02722..d4e0126b 100644 --- a/grpc-gcp/src/test/java/com/google/grpc/gcp/BigtableIntegrationTest.java +++ b/grpc-gcp/src/test/java/com/google/cloud/grpc/BigtableIntegrationTest.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package com.google.grpc.gcp; +package com.google.cloud.grpc; import static com.google.common.truth.Truth.assertThat; import static org.junit.Assert.assertEquals; diff --git a/grpc-gcp/src/test/java/com/google/grpc/gcp/GcpManagedChannelOptionsTest.java b/grpc-gcp/src/test/java/com/google/cloud/grpc/GcpManagedChannelOptionsTest.java similarity index 97% rename from grpc-gcp/src/test/java/com/google/grpc/gcp/GcpManagedChannelOptionsTest.java rename to grpc-gcp/src/test/java/com/google/cloud/grpc/GcpManagedChannelOptionsTest.java index 672249cf..3a39d86a 100644 --- a/grpc-gcp/src/test/java/com/google/grpc/gcp/GcpManagedChannelOptionsTest.java +++ b/grpc-gcp/src/test/java/com/google/cloud/grpc/GcpManagedChannelOptionsTest.java @@ -14,15 +14,15 @@ * limitations under the License. */ -package com.google.grpc.gcp; +package com.google.cloud.grpc; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertTrue; -import com.google.grpc.gcp.GcpManagedChannelOptions.GcpMetricsOptions; -import com.google.grpc.gcp.GcpManagedChannelOptions.GcpResiliencyOptions; +import com.google.cloud.grpc.GcpManagedChannelOptions.GcpMetricsOptions; +import com.google.cloud.grpc.GcpManagedChannelOptions.GcpResiliencyOptions; import io.opencensus.metrics.LabelKey; import io.opencensus.metrics.LabelValue; import io.opencensus.metrics.MetricRegistry; diff --git a/grpc-gcp/src/test/java/com/google/grpc/gcp/GcpManagedChannelTest.java b/grpc-gcp/src/test/java/com/google/cloud/grpc/GcpManagedChannelTest.java similarity index 95% rename from grpc-gcp/src/test/java/com/google/grpc/gcp/GcpManagedChannelTest.java rename to grpc-gcp/src/test/java/com/google/cloud/grpc/GcpManagedChannelTest.java index dd935e55..e9ae7919 100644 --- a/grpc-gcp/src/test/java/com/google/grpc/gcp/GcpManagedChannelTest.java +++ b/grpc-gcp/src/test/java/com/google/cloud/grpc/GcpManagedChannelTest.java @@ -14,21 +14,21 @@ * limitations under the License. */ -package com.google.grpc.gcp; +package com.google.cloud.grpc; import static com.google.common.truth.Truth.assertThat; import static org.junit.Assert.assertEquals; -import com.google.grpc.gcp.GcpManagedChannel.ChannelRef; -import com.google.grpc.gcp.GcpManagedChannelOptions.GcpMetricsOptions; -import com.google.grpc.gcp.GcpManagedChannelOptions.GcpResiliencyOptions; -import com.google.grpc.gcp.MetricRegistryTestUtils.FakeMetricRegistry; -import com.google.grpc.gcp.MetricRegistryTestUtils.MetricsRecord; -import com.google.grpc.gcp.MetricRegistryTestUtils.PointWithFunction; -import com.google.grpc.gcp.proto.AffinityConfig; -import com.google.grpc.gcp.proto.ApiConfig; -import com.google.grpc.gcp.proto.ChannelPoolConfig; -import com.google.grpc.gcp.proto.MethodConfig; +import com.google.cloud.grpc.GcpManagedChannel.ChannelRef; +import com.google.cloud.grpc.GcpManagedChannelOptions.GcpMetricsOptions; +import com.google.cloud.grpc.GcpManagedChannelOptions.GcpResiliencyOptions; +import com.google.cloud.grpc.MetricRegistryTestUtils.FakeMetricRegistry; +import com.google.cloud.grpc.MetricRegistryTestUtils.MetricsRecord; +import com.google.cloud.grpc.MetricRegistryTestUtils.PointWithFunction; +import com.google.cloud.grpc.proto.AffinityConfig; +import com.google.cloud.grpc.proto.ApiConfig; +import com.google.cloud.grpc.proto.ChannelPoolConfig; +import com.google.cloud.grpc.proto.MethodConfig; import com.google.spanner.v1.PartitionReadRequest; import com.google.spanner.v1.TransactionSelector; import io.grpc.CallOptions; @@ -49,6 +49,7 @@ import java.util.concurrent.TimeUnit; import java.util.concurrent.atomic.AtomicInteger; import org.junit.After; +import org.junit.Assert; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; @@ -219,7 +220,7 @@ public void testParseGoodJsonFile() throws Exception { .apiConfig; ChannelPoolConfig expectedChannel = ChannelPoolConfig.newBuilder().setMaxSize(3).setMaxConcurrentStreamsLowWatermark(2).build(); - assertEquals(expectedChannel, apiconfig.getChannelPool()); + Assert.assertEquals(expectedChannel, apiconfig.getChannelPool()); assertEquals(3, apiconfig.getMethodCount()); MethodConfig.Builder expectedMethod1 = MethodConfig.newBuilder(); @@ -263,7 +264,7 @@ public void testParseEmptyMethodJsonFile() { .setIdleTimeout(1000) .setMaxConcurrentStreamsLowWatermark(5) .build(); - assertEquals(expectedChannel, apiconfig.getChannelPool()); + Assert.assertEquals(expectedChannel, apiconfig.getChannelPool()); assertEquals(0, apiconfig.getMethodCount()); } @@ -277,7 +278,7 @@ public void testParseEmptyChannelJsonFile() { GcpManagedChannelBuilder.forDelegateBuilder(builder) .withApiConfigJsonFile(configFile) .apiConfig; - assertEquals(ChannelPoolConfig.getDefaultInstance(), apiconfig.getChannelPool()); + Assert.assertEquals(ChannelPoolConfig.getDefaultInstance(), apiconfig.getChannelPool()); assertEquals(3, apiconfig.getMethodCount()); MethodConfig.Builder expectedMethod1 = MethodConfig.newBuilder(); diff --git a/grpc-gcp/src/test/java/com/google/grpc/gcp/MetricRegistryTestUtils.java b/grpc-gcp/src/test/java/com/google/cloud/grpc/MetricRegistryTestUtils.java similarity index 99% rename from grpc-gcp/src/test/java/com/google/grpc/gcp/MetricRegistryTestUtils.java rename to grpc-gcp/src/test/java/com/google/cloud/grpc/MetricRegistryTestUtils.java index c1b968f1..740d4f5f 100644 --- a/grpc-gcp/src/test/java/com/google/grpc/gcp/MetricRegistryTestUtils.java +++ b/grpc-gcp/src/test/java/com/google/cloud/grpc/MetricRegistryTestUtils.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package com.google.grpc.gcp; +package com.google.cloud.grpc; import com.google.common.collect.Maps; import io.opencensus.common.ToLongFunction; diff --git a/grpc-gcp/src/test/java/com/google/grpc/gcp/SpannerIntegrationTest.java b/grpc-gcp/src/test/java/com/google/cloud/grpc/SpannerIntegrationTest.java similarity index 99% rename from grpc-gcp/src/test/java/com/google/grpc/gcp/SpannerIntegrationTest.java rename to grpc-gcp/src/test/java/com/google/cloud/grpc/SpannerIntegrationTest.java index 6cfb8b37..f87938fc 100644 --- a/grpc-gcp/src/test/java/com/google/grpc/gcp/SpannerIntegrationTest.java +++ b/grpc-gcp/src/test/java/com/google/cloud/grpc/SpannerIntegrationTest.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package com.google.grpc.gcp; +package com.google.cloud.grpc; import static com.google.common.base.Preconditions.checkState; import static com.google.common.truth.Truth.assertThat;