diff --git a/xds/src/main/java/io/grpc/xds/AbstractXdsClient.java b/xds/src/main/java/io/grpc/xds/AbstractXdsClient.java index 9fa25ba2cf..c63036551b 100644 --- a/xds/src/main/java/io/grpc/xds/AbstractXdsClient.java +++ b/xds/src/main/java/io/grpc/xds/AbstractXdsClient.java @@ -46,11 +46,11 @@ import io.grpc.SynchronizationContext.ScheduledHandle; import io.grpc.internal.BackoffPolicy; import io.grpc.stub.StreamObserver; import io.grpc.xds.Bootstrapper.ServerInfo; -import io.grpc.xds.ClientXdsClient.XdsChannelFactory; import io.grpc.xds.EnvoyProtoData.Node; import io.grpc.xds.XdsClient.ResourceStore; import io.grpc.xds.XdsClient.ResourceUpdate; import io.grpc.xds.XdsClient.XdsResponseHandler; +import io.grpc.xds.XdsClientImpl.XdsChannelFactory; import io.grpc.xds.XdsLogger.XdsLogLevel; import java.util.Collection; import java.util.Collections; diff --git a/xds/src/main/java/io/grpc/xds/LoadBalancerConfigFactory.java b/xds/src/main/java/io/grpc/xds/LoadBalancerConfigFactory.java index 5dc73a5313..ce3e95f03d 100644 --- a/xds/src/main/java/io/grpc/xds/LoadBalancerConfigFactory.java +++ b/xds/src/main/java/io/grpc/xds/LoadBalancerConfigFactory.java @@ -35,8 +35,8 @@ import io.envoyproxy.envoy.extensions.load_balancing_policies.wrr_locality.v3.Wr import io.grpc.InternalLogId; import io.grpc.LoadBalancerRegistry; import io.grpc.internal.JsonParser; -import io.grpc.xds.ClientXdsClient.ResourceInvalidException; import io.grpc.xds.LoadBalancerConfigFactory.LoadBalancingPolicyConverter.MaxRecursionReachedException; +import io.grpc.xds.XdsClientImpl.ResourceInvalidException; import io.grpc.xds.XdsLogger.XdsLogLevel; import java.io.IOException; import java.util.Map; diff --git a/xds/src/main/java/io/grpc/xds/SharedXdsClientPoolProvider.java b/xds/src/main/java/io/grpc/xds/SharedXdsClientPoolProvider.java index e70919a9ca..5aabd97608 100644 --- a/xds/src/main/java/io/grpc/xds/SharedXdsClientPoolProvider.java +++ b/xds/src/main/java/io/grpc/xds/SharedXdsClientPoolProvider.java @@ -26,7 +26,7 @@ import io.grpc.internal.ObjectPool; import io.grpc.internal.SharedResourceHolder; import io.grpc.internal.TimeProvider; import io.grpc.xds.Bootstrapper.BootstrapInfo; -import io.grpc.xds.ClientXdsClient.XdsChannelFactory; +import io.grpc.xds.XdsClientImpl.XdsChannelFactory; import io.grpc.xds.XdsNameResolverProvider.XdsClientPoolFactory; import io.grpc.xds.internal.security.TlsContextManagerImpl; import java.util.Map; @@ -123,7 +123,7 @@ final class SharedXdsClientPoolProvider implements XdsClientPoolFactory { synchronized (lock) { if (refCount == 0) { scheduler = SharedResourceHolder.get(GrpcUtil.TIMER_SERVICE); - xdsClient = new ClientXdsClient( + xdsClient = new XdsClientImpl( XdsChannelFactory.DEFAULT_XDS_CHANNEL_FACTORY, bootstrapInfo, context, diff --git a/xds/src/main/java/io/grpc/xds/ClientXdsClient.java b/xds/src/main/java/io/grpc/xds/XdsClientImpl.java similarity index 99% rename from xds/src/main/java/io/grpc/xds/ClientXdsClient.java rename to xds/src/main/java/io/grpc/xds/XdsClientImpl.java index f4dccc8a10..5e9282b671 100644 --- a/xds/src/main/java/io/grpc/xds/ClientXdsClient.java +++ b/xds/src/main/java/io/grpc/xds/XdsClientImpl.java @@ -72,7 +72,7 @@ import javax.annotation.Nullable; /** * XdsClient implementation for client side usages. */ -final class ClientXdsClient extends XdsClient implements XdsResponseHandler, ResourceStore { +final class XdsClientImpl extends XdsClient implements XdsResponseHandler, ResourceStore { // Longest time to wait, since the subscription to some resource, for concluding its absence. @VisibleForTesting @@ -118,7 +118,7 @@ final class ClientXdsClient extends XdsClient implements XdsResponseHandler, Res private volatile boolean isShutdown; // TODO(zdapeng): rename to XdsClientImpl - ClientXdsClient( + XdsClientImpl( XdsChannelFactory xdsChannelFactory, Bootstrapper.BootstrapInfo bootstrapInfo, Context context, diff --git a/xds/src/main/java/io/grpc/xds/XdsClusterResource.java b/xds/src/main/java/io/grpc/xds/XdsClusterResource.java index 4dc3095efa..06c93067ae 100644 --- a/xds/src/main/java/io/grpc/xds/XdsClusterResource.java +++ b/xds/src/main/java/io/grpc/xds/XdsClusterResource.java @@ -42,10 +42,10 @@ import io.grpc.LoadBalancerRegistry; import io.grpc.NameResolver; import io.grpc.internal.ServiceConfigUtil; import io.grpc.internal.ServiceConfigUtil.LbConfig; -import io.grpc.xds.ClientXdsClient.ResourceInvalidException; import io.grpc.xds.EnvoyServerProtoData.OutlierDetection; import io.grpc.xds.EnvoyServerProtoData.UpstreamTlsContext; import io.grpc.xds.XdsClient.ResourceUpdate; +import io.grpc.xds.XdsClientImpl.ResourceInvalidException; import io.grpc.xds.XdsClusterResource.CdsUpdate; import java.util.List; import java.util.Locale; diff --git a/xds/src/main/java/io/grpc/xds/XdsEndpointResource.java b/xds/src/main/java/io/grpc/xds/XdsEndpointResource.java index db1e93d13f..f1b520d480 100644 --- a/xds/src/main/java/io/grpc/xds/XdsEndpointResource.java +++ b/xds/src/main/java/io/grpc/xds/XdsEndpointResource.java @@ -27,10 +27,10 @@ import com.google.protobuf.Message; import io.envoyproxy.envoy.config.endpoint.v3.ClusterLoadAssignment; import io.envoyproxy.envoy.type.v3.FractionalPercent; import io.grpc.EquivalentAddressGroup; -import io.grpc.xds.ClientXdsClient.ResourceInvalidException; import io.grpc.xds.Endpoints.DropOverload; import io.grpc.xds.Endpoints.LocalityLbEndpoints; import io.grpc.xds.XdsClient.ResourceUpdate; +import io.grpc.xds.XdsClientImpl.ResourceInvalidException; import io.grpc.xds.XdsEndpointResource.EdsUpdate; import java.net.InetSocketAddress; import java.util.ArrayList; diff --git a/xds/src/main/java/io/grpc/xds/XdsListenerResource.java b/xds/src/main/java/io/grpc/xds/XdsListenerResource.java index 397ba32dc6..b51896a29d 100644 --- a/xds/src/main/java/io/grpc/xds/XdsListenerResource.java +++ b/xds/src/main/java/io/grpc/xds/XdsListenerResource.java @@ -20,8 +20,8 @@ import static com.google.common.base.Preconditions.checkNotNull; import static io.grpc.xds.AbstractXdsClient.ResourceType; import static io.grpc.xds.AbstractXdsClient.ResourceType.LDS; import static io.grpc.xds.AbstractXdsClient.ResourceType.RDS; -import static io.grpc.xds.ClientXdsClient.ResourceInvalidException; import static io.grpc.xds.XdsClient.ResourceUpdate; +import static io.grpc.xds.XdsClientImpl.ResourceInvalidException; import static io.grpc.xds.XdsClusterResource.validateCommonTlsContext; import static io.grpc.xds.XdsRouteConfigureResource.extractVirtualHosts; diff --git a/xds/src/main/java/io/grpc/xds/XdsResourceType.java b/xds/src/main/java/io/grpc/xds/XdsResourceType.java index 52c143934e..c35889748b 100644 --- a/xds/src/main/java/io/grpc/xds/XdsResourceType.java +++ b/xds/src/main/java/io/grpc/xds/XdsResourceType.java @@ -19,10 +19,10 @@ package io.grpc.xds; import static com.google.common.base.Preconditions.checkNotNull; import static io.grpc.xds.AbstractXdsClient.ResourceType; import static io.grpc.xds.Bootstrapper.ServerInfo; -import static io.grpc.xds.ClientXdsClient.ResourceInvalidException; import static io.grpc.xds.XdsClient.ResourceUpdate; import static io.grpc.xds.XdsClient.canonifyResourceName; import static io.grpc.xds.XdsClient.isResourceNameValid; +import static io.grpc.xds.XdsClientImpl.ResourceInvalidException; import com.google.common.annotations.VisibleForTesting; import com.google.common.base.Strings; @@ -158,7 +158,7 @@ abstract class XdsResourceType { T resourceUpdate; try { resourceUpdate = doParse(args, unpackedMessage, retainedResources, isResourceV3); - } catch (ClientXdsClient.ResourceInvalidException e) { + } catch (XdsClientImpl.ResourceInvalidException e) { errors.add(String.format("%s response %s '%s' validation error: %s", typeName(), unpackedClassName().getSimpleName(), cname, e.getMessage())); invalidResources.add(cname); diff --git a/xds/src/main/java/io/grpc/xds/XdsRouteConfigureResource.java b/xds/src/main/java/io/grpc/xds/XdsRouteConfigureResource.java index f2fca0b1bf..cf571034a3 100644 --- a/xds/src/main/java/io/grpc/xds/XdsRouteConfigureResource.java +++ b/xds/src/main/java/io/grpc/xds/XdsRouteConfigureResource.java @@ -17,8 +17,8 @@ package io.grpc.xds; import static com.google.common.base.Preconditions.checkNotNull; -import static io.grpc.xds.AbstractXdsClient.ResourceType.RDS; import static io.grpc.xds.AbstractXdsClient.ResourceType; +import static io.grpc.xds.AbstractXdsClient.ResourceType.RDS; import static io.grpc.xds.XdsRouteConfigureResource.RdsUpdate; import com.github.udpa.udpa.type.v1.TypedStruct; @@ -40,7 +40,6 @@ import io.envoyproxy.envoy.config.route.v3.RetryPolicy.RetryBackOff; import io.envoyproxy.envoy.config.route.v3.RouteConfiguration; import io.envoyproxy.envoy.type.v3.FractionalPercent; import io.grpc.Status; -import io.grpc.xds.ClientXdsClient.ResourceInvalidException; import io.grpc.xds.ClusterSpecifierPlugin.NamedPluginConfig; import io.grpc.xds.ClusterSpecifierPlugin.PluginConfig; import io.grpc.xds.Filter.FilterConfig; @@ -52,9 +51,10 @@ import io.grpc.xds.VirtualHost.Route.RouteAction.RetryPolicy; import io.grpc.xds.VirtualHost.Route.RouteMatch; import io.grpc.xds.VirtualHost.Route.RouteMatch.PathMatcher; import io.grpc.xds.XdsClient.ResourceUpdate; +import io.grpc.xds.XdsClientImpl.ResourceInvalidException; +import io.grpc.xds.internal.Matchers; import io.grpc.xds.internal.Matchers.FractionMatcher; import io.grpc.xds.internal.Matchers.HeaderMatcher; -import io.grpc.xds.internal.Matchers; import java.util.ArrayList; import java.util.Collections; import java.util.EnumSet; diff --git a/xds/src/test/java/io/grpc/xds/LoadBalancerConfigFactoryTest.java b/xds/src/test/java/io/grpc/xds/LoadBalancerConfigFactoryTest.java index 75aaa00452..c7217cb45e 100644 --- a/xds/src/test/java/io/grpc/xds/LoadBalancerConfigFactoryTest.java +++ b/xds/src/test/java/io/grpc/xds/LoadBalancerConfigFactoryTest.java @@ -47,7 +47,7 @@ import io.grpc.LoadBalancerRegistry; import io.grpc.internal.JsonUtil; import io.grpc.internal.ServiceConfigUtil; import io.grpc.internal.ServiceConfigUtil.LbConfig; -import io.grpc.xds.ClientXdsClient.ResourceInvalidException; +import io.grpc.xds.XdsClientImpl.ResourceInvalidException; import java.util.List; import org.junit.After; import org.junit.Test; diff --git a/xds/src/test/java/io/grpc/xds/ClientXdsClientDataTest.java b/xds/src/test/java/io/grpc/xds/XdsClientImplDataTest.java similarity index 99% rename from xds/src/test/java/io/grpc/xds/ClientXdsClientDataTest.java rename to xds/src/test/java/io/grpc/xds/XdsClientImplDataTest.java index dae17bfb89..8b5b5f84b9 100644 --- a/xds/src/test/java/io/grpc/xds/ClientXdsClientDataTest.java +++ b/xds/src/test/java/io/grpc/xds/XdsClientImplDataTest.java @@ -117,7 +117,6 @@ import io.grpc.lookup.v1.RouteLookupClusterSpecifier; import io.grpc.lookup.v1.RouteLookupConfig; import io.grpc.xds.AbstractXdsClient.ResourceType; import io.grpc.xds.Bootstrapper.ServerInfo; -import io.grpc.xds.ClientXdsClient.ResourceInvalidException; import io.grpc.xds.ClusterSpecifierPlugin.NamedPluginConfig; import io.grpc.xds.ClusterSpecifierPlugin.PluginConfig; import io.grpc.xds.Endpoints.LbEndpoint; @@ -130,6 +129,7 @@ import io.grpc.xds.VirtualHost.Route.RouteAction.ClusterWeight; import io.grpc.xds.VirtualHost.Route.RouteAction.HashPolicy; import io.grpc.xds.VirtualHost.Route.RouteMatch; import io.grpc.xds.VirtualHost.Route.RouteMatch.PathMatcher; +import io.grpc.xds.XdsClientImpl.ResourceInvalidException; import io.grpc.xds.XdsClusterResource.CdsUpdate; import io.grpc.xds.XdsResourceType.StructOrError; import io.grpc.xds.internal.Matchers.FractionMatcher; @@ -152,7 +152,7 @@ import org.junit.runner.RunWith; import org.junit.runners.JUnit4; @RunWith(JUnit4.class) -public class ClientXdsClientDataTest { +public class XdsClientImplDataTest { private static final ServerInfo LRS_SERVER_INFO = ServerInfo.create("lrs.googleapis.com", InsecureChannelCredentials.create(), true); diff --git a/xds/src/test/java/io/grpc/xds/ClientXdsClientTestBase.java b/xds/src/test/java/io/grpc/xds/XdsClientImplTestBase.java similarity index 98% rename from xds/src/test/java/io/grpc/xds/ClientXdsClientTestBase.java rename to xds/src/test/java/io/grpc/xds/XdsClientImplTestBase.java index 788110e1c2..1ee41f8ac0 100644 --- a/xds/src/test/java/io/grpc/xds/ClientXdsClientTestBase.java +++ b/xds/src/test/java/io/grpc/xds/XdsClientImplTestBase.java @@ -70,8 +70,6 @@ import io.grpc.xds.AbstractXdsClient.ResourceType; import io.grpc.xds.Bootstrapper.AuthorityInfo; import io.grpc.xds.Bootstrapper.CertificateProviderInfo; import io.grpc.xds.Bootstrapper.ServerInfo; -import io.grpc.xds.ClientXdsClient.ResourceInvalidException; -import io.grpc.xds.ClientXdsClient.XdsChannelFactory; import io.grpc.xds.Endpoints.DropOverload; import io.grpc.xds.Endpoints.LbEndpoint; import io.grpc.xds.Endpoints.LocalityLbEndpoints; @@ -86,6 +84,8 @@ import io.grpc.xds.XdsClient.ResourceMetadata.ResourceMetadataStatus; import io.grpc.xds.XdsClient.ResourceMetadata.UpdateFailureState; import io.grpc.xds.XdsClient.ResourceUpdate; import io.grpc.xds.XdsClient.ResourceWatcher; +import io.grpc.xds.XdsClientImpl.ResourceInvalidException; +import io.grpc.xds.XdsClientImpl.XdsChannelFactory; import io.grpc.xds.XdsClusterResource.CdsUpdate; import io.grpc.xds.XdsClusterResource.CdsUpdate.ClusterType; import io.grpc.xds.XdsEndpointResource.EdsUpdate; @@ -117,10 +117,10 @@ import org.mockito.Mockito; import org.mockito.MockitoAnnotations; /** - * Tests for {@link ClientXdsClient}. + * Tests for {@link XdsClientImpl}. */ @RunWith(JUnit4.class) -public abstract class ClientXdsClientTestBase { +public abstract class XdsClientImplTestBase { private static final String SERVER_URI = "trafficdirector.googleapis.com"; private static final String SERVER_URI_CUSTOME_AUTHORITY = "trafficdirector2.googleapis.com"; private static final String SERVER_URI_EMPTY_AUTHORITY = "trafficdirector3.googleapis.com"; @@ -264,7 +264,7 @@ public abstract class ClientXdsClientTestBase { private ManagedChannel channel; private ManagedChannel channelForCustomAuthority; private ManagedChannel channelForEmptyAuthority; - private ClientXdsClient xdsClient; + private XdsClientImpl xdsClient; private boolean originalEnableFaultInjection; private boolean originalEnableRbac; private boolean originalEnableLeastRequest; @@ -342,7 +342,7 @@ public abstract class ClientXdsClientTestBase { CertificateProviderInfo.create("file-watcher", ImmutableMap.of()))) .build(); xdsClient = - new ClientXdsClient( + new XdsClientImpl( xdsChannelFactory, bootstrapInfo, Context.ROOT, @@ -589,7 +589,7 @@ public abstract class ClientXdsClientTestBase { verifyResourceMetadataRequested(LDS, LDS_RESOURCE); verifySubscribedResourcesMetadataSizes(1, 0, 0, 0); // Server failed to return subscribed resource within expected time window. - fakeClock.forwardTime(ClientXdsClient.INITIAL_RESOURCE_FETCH_TIMEOUT_SEC, TimeUnit.SECONDS); + fakeClock.forwardTime(XdsClientImpl.INITIAL_RESOURCE_FETCH_TIMEOUT_SEC, TimeUnit.SECONDS); verify(ldsResourceWatcher).onResourceDoesNotExist(LDS_RESOURCE); assertThat(fakeClock.getPendingTasks(LDS_RESOURCE_FETCH_TIMEOUT_TASK_FILTER)).isEmpty(); verifyResourceMetadataDoesNotExist(LDS, LDS_RESOURCE); @@ -872,7 +872,7 @@ public abstract class ClientXdsClientTestBase { public void cachedLdsResource_absent() { DiscoveryRpcCall call = startResourceWatcher(XdsListenerResource.getInstance(), LDS_RESOURCE, ldsResourceWatcher); - fakeClock.forwardTime(ClientXdsClient.INITIAL_RESOURCE_FETCH_TIMEOUT_SEC, TimeUnit.SECONDS); + fakeClock.forwardTime(XdsClientImpl.INITIAL_RESOURCE_FETCH_TIMEOUT_SEC, TimeUnit.SECONDS); verify(ldsResourceWatcher).onResourceDoesNotExist(LDS_RESOURCE); // Add another watcher. ResourceWatcher watcher = mock(ResourceWatcher.class); @@ -1264,7 +1264,7 @@ public abstract class ClientXdsClientTestBase { verifyResourceMetadataRequested(LDS, ldsResourceTwo); verifySubscribedResourcesMetadataSizes(2, 0, 0, 0); - fakeClock.forwardTime(ClientXdsClient.INITIAL_RESOURCE_FETCH_TIMEOUT_SEC, TimeUnit.SECONDS); + fakeClock.forwardTime(XdsClientImpl.INITIAL_RESOURCE_FETCH_TIMEOUT_SEC, TimeUnit.SECONDS); verify(ldsResourceWatcher).onResourceDoesNotExist(LDS_RESOURCE); verify(watcher1).onResourceDoesNotExist(ldsResourceTwo); verify(watcher2).onResourceDoesNotExist(ldsResourceTwo); @@ -1305,7 +1305,7 @@ public abstract class ClientXdsClientTestBase { verifyResourceMetadataRequested(RDS, RDS_RESOURCE); verifySubscribedResourcesMetadataSizes(0, 0, 1, 0); // Server failed to return subscribed resource within expected time window. - fakeClock.forwardTime(ClientXdsClient.INITIAL_RESOURCE_FETCH_TIMEOUT_SEC, TimeUnit.SECONDS); + fakeClock.forwardTime(XdsClientImpl.INITIAL_RESOURCE_FETCH_TIMEOUT_SEC, TimeUnit.SECONDS); verify(rdsResourceWatcher).onResourceDoesNotExist(RDS_RESOURCE); assertThat(fakeClock.getPendingTasks(RDS_RESOURCE_FETCH_TIMEOUT_TASK_FILTER)).isEmpty(); verifyResourceMetadataDoesNotExist(RDS, RDS_RESOURCE); @@ -1468,7 +1468,7 @@ public abstract class ClientXdsClientTestBase { public void cachedRdsResource_absent() { DiscoveryRpcCall call = startResourceWatcher(XdsRouteConfigureResource.getInstance(), RDS_RESOURCE, rdsResourceWatcher); - fakeClock.forwardTime(ClientXdsClient.INITIAL_RESOURCE_FETCH_TIMEOUT_SEC, TimeUnit.SECONDS); + fakeClock.forwardTime(XdsClientImpl.INITIAL_RESOURCE_FETCH_TIMEOUT_SEC, TimeUnit.SECONDS); verify(rdsResourceWatcher).onResourceDoesNotExist(RDS_RESOURCE); // Add another watcher. ResourceWatcher watcher = mock(ResourceWatcher.class); @@ -1630,7 +1630,7 @@ public abstract class ClientXdsClientTestBase { verifyResourceMetadataRequested(RDS, rdsResourceTwo); verifySubscribedResourcesMetadataSizes(0, 0, 2, 0); - fakeClock.forwardTime(ClientXdsClient.INITIAL_RESOURCE_FETCH_TIMEOUT_SEC, TimeUnit.SECONDS); + fakeClock.forwardTime(XdsClientImpl.INITIAL_RESOURCE_FETCH_TIMEOUT_SEC, TimeUnit.SECONDS); verify(rdsResourceWatcher).onResourceDoesNotExist(RDS_RESOURCE); verify(watcher1).onResourceDoesNotExist(rdsResourceTwo); verify(watcher2).onResourceDoesNotExist(rdsResourceTwo); @@ -1677,7 +1677,7 @@ public abstract class ClientXdsClientTestBase { verifyResourceMetadataRequested(CDS, CDS_RESOURCE); verifySubscribedResourcesMetadataSizes(0, 1, 0, 0); // Server failed to return subscribed resource within expected time window. - fakeClock.forwardTime(ClientXdsClient.INITIAL_RESOURCE_FETCH_TIMEOUT_SEC, TimeUnit.SECONDS); + fakeClock.forwardTime(XdsClientImpl.INITIAL_RESOURCE_FETCH_TIMEOUT_SEC, TimeUnit.SECONDS); verify(cdsResourceWatcher).onResourceDoesNotExist(CDS_RESOURCE); assertThat(fakeClock.getPendingTasks(CDS_RESOURCE_FETCH_TIMEOUT_TASK_FILTER)).isEmpty(); verifyResourceMetadataDoesNotExist(CDS, CDS_RESOURCE); @@ -2138,7 +2138,7 @@ public abstract class ClientXdsClientTestBase { // The response NACKed with errors indicating indices of the failed resources. String errorMsg = "CDS response Cluster 'cluster.googleapis.com' validation error: " + "Cluster cluster.googleapis.com: malformed UpstreamTlsContext: " - + "io.grpc.xds.ClientXdsClient$ResourceInvalidException: " + + "io.grpc.xds.XdsClientImpl$ResourceInvalidException: " + "ca_certificate_provider_instance is required in upstream-tls-context"; call.verifyRequestNack(CDS, CDS_RESOURCE, "", "0000", NODE, ImmutableList.of(errorMsg)); verify(cdsResourceWatcher).onError(errorCaptor.capture()); @@ -2288,7 +2288,7 @@ public abstract class ClientXdsClientTestBase { String errorMsg = "CDS response Cluster 'cluster.googleapis.com' validation error: " + "Cluster cluster.googleapis.com: malformed outlier_detection: " - + "io.grpc.xds.ClientXdsClient$ResourceInvalidException: outlier_detection " + + "io.grpc.xds.XdsClientImpl$ResourceInvalidException: outlier_detection " + "max_ejection_percent is > 100"; call.verifyRequestNack(CDS, CDS_RESOURCE, "", "0000", NODE, ImmutableList.of(errorMsg)); verify(cdsResourceWatcher).onError(errorCaptor.capture()); @@ -2417,7 +2417,7 @@ public abstract class ClientXdsClientTestBase { public void cachedCdsResource_absent() { DiscoveryRpcCall call = startResourceWatcher(XdsClusterResource.getInstance(), CDS_RESOURCE, cdsResourceWatcher); - fakeClock.forwardTime(ClientXdsClient.INITIAL_RESOURCE_FETCH_TIMEOUT_SEC, TimeUnit.SECONDS); + fakeClock.forwardTime(XdsClientImpl.INITIAL_RESOURCE_FETCH_TIMEOUT_SEC, TimeUnit.SECONDS); verify(cdsResourceWatcher).onResourceDoesNotExist(CDS_RESOURCE); ResourceWatcher watcher = mock(ResourceWatcher.class); xdsClient.watchXdsResource(XdsClusterResource.getInstance(),CDS_RESOURCE, watcher); @@ -2612,7 +2612,7 @@ public abstract class ClientXdsClientTestBase { verifyResourceMetadataRequested(CDS, cdsResourceTwo); verifySubscribedResourcesMetadataSizes(0, 2, 0, 0); - fakeClock.forwardTime(ClientXdsClient.INITIAL_RESOURCE_FETCH_TIMEOUT_SEC, TimeUnit.SECONDS); + fakeClock.forwardTime(XdsClientImpl.INITIAL_RESOURCE_FETCH_TIMEOUT_SEC, TimeUnit.SECONDS); verify(cdsResourceWatcher).onResourceDoesNotExist(CDS_RESOURCE); verify(watcher1).onResourceDoesNotExist(cdsResourceTwo); verify(watcher2).onResourceDoesNotExist(cdsResourceTwo); @@ -2690,7 +2690,7 @@ public abstract class ClientXdsClientTestBase { verifyResourceMetadataRequested(EDS, EDS_RESOURCE); verifySubscribedResourcesMetadataSizes(0, 0, 0, 1); // Server failed to return subscribed resource within expected time window. - fakeClock.forwardTime(ClientXdsClient.INITIAL_RESOURCE_FETCH_TIMEOUT_SEC, TimeUnit.SECONDS); + fakeClock.forwardTime(XdsClientImpl.INITIAL_RESOURCE_FETCH_TIMEOUT_SEC, TimeUnit.SECONDS); verify(edsResourceWatcher).onResourceDoesNotExist(EDS_RESOURCE); assertThat(fakeClock.getPendingTasks(EDS_RESOURCE_FETCH_TIMEOUT_TASK_FILTER)).isEmpty(); verifyResourceMetadataDoesNotExist(EDS, EDS_RESOURCE); @@ -2860,7 +2860,7 @@ public abstract class ClientXdsClientTestBase { public void cachedEdsResource_absent() { DiscoveryRpcCall call = startResourceWatcher(XdsEndpointResource.getInstance(), EDS_RESOURCE, edsResourceWatcher); - fakeClock.forwardTime(ClientXdsClient.INITIAL_RESOURCE_FETCH_TIMEOUT_SEC, TimeUnit.SECONDS); + fakeClock.forwardTime(XdsClientImpl.INITIAL_RESOURCE_FETCH_TIMEOUT_SEC, TimeUnit.SECONDS); verify(edsResourceWatcher).onResourceDoesNotExist(EDS_RESOURCE); ResourceWatcher watcher = mock(ResourceWatcher.class); xdsClient.watchXdsResource(XdsEndpointResource.getInstance(),EDS_RESOURCE, watcher); @@ -3034,7 +3034,7 @@ public abstract class ClientXdsClientTestBase { verifyResourceMetadataRequested(EDS, edsResourceTwo); verifySubscribedResourcesMetadataSizes(0, 0, 0, 2); - fakeClock.forwardTime(ClientXdsClient.INITIAL_RESOURCE_FETCH_TIMEOUT_SEC, TimeUnit.SECONDS); + fakeClock.forwardTime(XdsClientImpl.INITIAL_RESOURCE_FETCH_TIMEOUT_SEC, TimeUnit.SECONDS); verify(edsResourceWatcher).onResourceDoesNotExist(EDS_RESOURCE); verify(watcher1).onResourceDoesNotExist(edsResourceTwo); verify(watcher2).onResourceDoesNotExist(edsResourceTwo); @@ -3339,7 +3339,7 @@ public abstract class ClientXdsClientTestBase { @Test public void serverSideListenerFound() { Assume.assumeTrue(useProtocolV3()); - ClientXdsClientTestBase.DiscoveryRpcCall call = + XdsClientImplTestBase.DiscoveryRpcCall call = startResourceWatcher(XdsListenerResource.getInstance(), LISTENER_RESOURCE, ldsResourceWatcher); Message hcmFilter = mf.buildHttpConnectionManagerFilter( @@ -3376,7 +3376,7 @@ public abstract class ClientXdsClientTestBase { @Test public void serverSideListenerNotFound() { Assume.assumeTrue(useProtocolV3()); - ClientXdsClientTestBase.DiscoveryRpcCall call = + XdsClientImplTestBase.DiscoveryRpcCall call = startResourceWatcher(XdsListenerResource.getInstance(), LISTENER_RESOURCE, ldsResourceWatcher); Message hcmFilter = mf.buildHttpConnectionManagerFilter( @@ -3396,7 +3396,7 @@ public abstract class ClientXdsClientTestBase { ResourceType.LDS, Collections.singletonList(LISTENER_RESOURCE), "0", "0000", NODE); verifyNoInteractions(ldsResourceWatcher); - fakeClock.forwardTime(ClientXdsClient.INITIAL_RESOURCE_FETCH_TIMEOUT_SEC, TimeUnit.SECONDS); + fakeClock.forwardTime(XdsClientImpl.INITIAL_RESOURCE_FETCH_TIMEOUT_SEC, TimeUnit.SECONDS); verify(ldsResourceWatcher).onResourceDoesNotExist(LISTENER_RESOURCE); assertThat(fakeClock.getPendingTasks(LDS_RESOURCE_FETCH_TIMEOUT_TASK_FILTER)).isEmpty(); } @@ -3404,7 +3404,7 @@ public abstract class ClientXdsClientTestBase { @Test public void serverSideListenerResponseErrorHandling_badDownstreamTlsContext() { Assume.assumeTrue(useProtocolV3()); - ClientXdsClientTestBase.DiscoveryRpcCall call = + XdsClientImplTestBase.DiscoveryRpcCall call = startResourceWatcher(XdsListenerResource.getInstance(), LISTENER_RESOURCE, ldsResourceWatcher); Message hcmFilter = mf.buildHttpConnectionManagerFilter( @@ -3431,7 +3431,7 @@ public abstract class ClientXdsClientTestBase { @Test public void serverSideListenerResponseErrorHandling_badTransportSocketName() { Assume.assumeTrue(useProtocolV3()); - ClientXdsClientTestBase.DiscoveryRpcCall call = + XdsClientImplTestBase.DiscoveryRpcCall call = startResourceWatcher(XdsListenerResource.getInstance(), LISTENER_RESOURCE, ldsResourceWatcher); Message hcmFilter = mf.buildHttpConnectionManagerFilter( @@ -3485,7 +3485,7 @@ public abstract class ClientXdsClientTestBase { ScheduledTask timeoutTask = Iterables.getOnlyElement(fakeClock.getPendingTasks(timeoutTaskFilter)); assertThat(timeoutTask.getDelay(TimeUnit.SECONDS)) - .isEqualTo(ClientXdsClient.INITIAL_RESOURCE_FETCH_TIMEOUT_SEC); + .isEqualTo(XdsClientImpl.INITIAL_RESOURCE_FETCH_TIMEOUT_SEC); return call; } diff --git a/xds/src/test/java/io/grpc/xds/ClientXdsClientV2Test.java b/xds/src/test/java/io/grpc/xds/XdsClientImplV2Test.java similarity index 99% rename from xds/src/test/java/io/grpc/xds/ClientXdsClientV2Test.java rename to xds/src/test/java/io/grpc/xds/XdsClientImplV2Test.java index 3bb6e42138..0e768f5e50 100644 --- a/xds/src/test/java/io/grpc/xds/ClientXdsClientV2Test.java +++ b/xds/src/test/java/io/grpc/xds/XdsClientImplV2Test.java @@ -108,10 +108,10 @@ import org.mockito.ArgumentMatcher; import org.mockito.InOrder; /** - * Tests for {@link ClientXdsClient} with protocol version v2. + * Tests for {@link XdsClientImpl} with protocol version v2. */ @RunWith(Parameterized.class) -public class ClientXdsClientV2Test extends ClientXdsClientTestBase { +public class XdsClientImplV2Test extends XdsClientImplTestBase { /** Parameterized test cases. */ @Parameters(name = "ignoreResourceDeletion={0}") diff --git a/xds/src/test/java/io/grpc/xds/ClientXdsClientV3Test.java b/xds/src/test/java/io/grpc/xds/XdsClientImplV3Test.java similarity index 99% rename from xds/src/test/java/io/grpc/xds/ClientXdsClientV3Test.java rename to xds/src/test/java/io/grpc/xds/XdsClientImplV3Test.java index 6eb48e5bb0..7f134b652b 100644 --- a/xds/src/test/java/io/grpc/xds/ClientXdsClientV3Test.java +++ b/xds/src/test/java/io/grpc/xds/XdsClientImplV3Test.java @@ -116,10 +116,10 @@ import org.mockito.ArgumentMatcher; import org.mockito.InOrder; /** - * Tests for {@link ClientXdsClient} with protocol version v3. + * Tests for {@link XdsClientImpl} with protocol version v3. */ @RunWith(Parameterized.class) -public class ClientXdsClientV3Test extends ClientXdsClientTestBase { +public class XdsClientImplV3Test extends XdsClientImplTestBase { /** Parameterized test cases. */ @Parameters(name = "ignoreResourceDeletion={0}")