From 77e81d794fcea75597bf44eb1385ecaf8451b1b4 Mon Sep 17 00:00:00 2001 From: mohanli-ml Date: Tue, 19 Oct 2021 04:43:45 +0000 Subject: [PATCH] feat: add google-c2p dependence to DirectPath --- .../gax/grpc/InstantiatingGrpcChannelProvider.java | 2 +- .../grpc/InstantiatingGrpcChannelProviderTest.java | 11 +++++------ 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/gax-grpc/src/main/java/com/google/api/gax/grpc/InstantiatingGrpcChannelProvider.java b/gax-grpc/src/main/java/com/google/api/gax/grpc/InstantiatingGrpcChannelProvider.java index 3451609a4..84df6529d 100644 --- a/gax-grpc/src/main/java/com/google/api/gax/grpc/InstantiatingGrpcChannelProvider.java +++ b/gax-grpc/src/main/java/com/google/api/gax/grpc/InstantiatingGrpcChannelProvider.java @@ -401,7 +401,7 @@ && isOnComputeEngine()) { return managedChannel; } - /** The endpoint passed to the builder. It must have a pot, and must not have a URI scheme. */ + /** The endpoint passed to the builder, which must have a port. */ public String getEndpoint() { return endpoint; } diff --git a/gax-grpc/src/test/java/com/google/api/gax/grpc/InstantiatingGrpcChannelProviderTest.java b/gax-grpc/src/test/java/com/google/api/gax/grpc/InstantiatingGrpcChannelProviderTest.java index 8476df890..2f5f756ba 100644 --- a/gax-grpc/src/test/java/com/google/api/gax/grpc/InstantiatingGrpcChannelProviderTest.java +++ b/gax-grpc/src/test/java/com/google/api/gax/grpc/InstantiatingGrpcChannelProviderTest.java @@ -408,23 +408,22 @@ public void testWithDirectPathXds() throws IOException { ScheduledExecutorService executor = new ScheduledThreadPoolExecutor(1); executor.shutdown(); - InstantiatingGrpcChannelProvider iProvider = + InstantiatingGrpcChannelProvider grpcChannelProvider = InstantiatingGrpcChannelProvider.newBuilder() .setAttemptDirectPath(true) .setEnvProvider(new TestEnvironmentProvider(/*isDirectPathXdsEnabled = */ "true")) .build(); - TransportChannelProvider provider = - iProvider + TransportChannelProvider transportChannelProvider = + grpcChannelProvider .withHeaders(Collections.emptyMap()) .withExecutor((Executor) executor) .withEndpoint("localhost:8080") .withCredentials(ComputeEngineCredentials.create()); - ; - provider.getTransportChannel().shutdownNow(); + transportChannelProvider.getTransportChannel().shutdownNow(); - assertEquals(iProvider.getActiveEndpoint(), "google-c2p:///localhost"); + assertEquals(grpcChannelProvider.getActiveEndpoint(), "google-c2p:///localhost"); } @Test