Cleanup some of the warnings across the code base (#9445)

No logic changes, just cleans up warnings to make spotting real problems easier.

Remove "public" declarations on interfaces
Remove duplicate semicolons (Java lines ending in ";;")
Remove unneeded import
Change non-javadoc comment to not start with "/**"
Remove unneeded explicit type declarations from generics
Fix broken javadoc links
This commit is contained in:
Larry Safran 2022-08-15 11:06:31 -07:00 committed by GitHub
parent 03430c786a
commit 01d5bd47cb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
22 changed files with 162 additions and 152 deletions

View File

@ -20,7 +20,6 @@ import io.grpc.ExperimentalApi;
import io.grpc.alts.internal.AltsInternalContext;
import io.grpc.alts.internal.HandshakerResult;
import io.grpc.alts.internal.Identity;
import io.grpc.alts.internal.SecurityLevel;
/** {@code AltsContext} contains security-related information on the ALTS channel. */
@ExperimentalApi("https://github.com/grpc/grpc-java/issues/7864")

View File

@ -64,12 +64,18 @@ class AltsHandshakerStub {
if (!responseQueue.isEmpty()) {
throw new IOException("Received an unexpected response.");
}
writer.onNext(req);
Optional<HandshakerResp> result = responseQueue.take();
if (!result.isPresent()) {
maybeThrowIoException();
if (result.isPresent()) {
return result.get();
}
if (exceptionMessage.get() != null) {
throw new IOException(exceptionMessage.get());
} else {
throw new IOException("No handshaker response received");
}
return result.get();
}
/** Create a new writer if the writer is null. */

View File

@ -86,7 +86,7 @@ public interface TsiHandshaker {
*
* @return the extracted peer.
*/
public Object extractPeerObject() throws GeneralSecurityException;
Object extractPeerObject() throws GeneralSecurityException;
/**
* Creates a frame protector from a completed handshake. No other methods may be called after the

View File

@ -19,6 +19,7 @@ package io.grpc;
import com.google.common.io.BaseEncoding;
import io.grpc.Metadata.AsciiMarshaller;
import io.grpc.Metadata.BinaryStreamMarshaller;
import java.io.InputStream;
import java.nio.charset.Charset;
/**
@ -100,7 +101,7 @@ public final class InternalMetadata {
/**
* Creates a holder for a pre-parsed value read by the transport.
*
* @param marshaller The {@link Metadata#BinaryStreamMarshaller} associated with this value.
* @param marshaller The {@link Metadata.BinaryStreamMarshaller} associated with this value.
* @param value The value to store.
* @return an object holding the pre-parsed value for this key.
*/

View File

@ -211,8 +211,8 @@ public final class Metadata {
return size * 2;
}
/** checks when {@link #namesAndValues} is null or has no elements. */
private boolean isEmpty() {
/** checks when {@link #namesAndValues} is null or has no elements */
return size == 0;
}

View File

@ -188,7 +188,7 @@ final class CensusStatsModule {
@Nullable
private static final AtomicLongFieldUpdater<ClientTracer> inboundUncompressedSizeUpdater;
/**
/*
* When using Atomic*FieldUpdater, some Samsung Android 5.0.x devices encounter a bug in their
* JDK reflection API that triggers a NoSuchFieldException. When this occurs, we fallback to
* (potentially racy) direct updates of the volatile variables.
@ -268,7 +268,7 @@ final class CensusStatsModule {
}
@Override
@SuppressWarnings("NonAtomicVolatileUpdate")
@SuppressWarnings({"NonAtomicVolatileUpdate", "NonAtomicOperationOnVolatileField"})
public void outboundWireSize(long bytes) {
if (outboundWireSizeUpdater != null) {
outboundWireSizeUpdater.getAndAdd(this, bytes);
@ -562,7 +562,7 @@ final class CensusStatsModule {
@Nullable
private static final AtomicLongFieldUpdater<ServerTracer> inboundUncompressedSizeUpdater;
/**
/*
* When using Atomic*FieldUpdater, some Samsung Android 5.0.x devices encounter a bug in their
* JDK reflection API that triggers a NoSuchFieldException. When this occurs, we fallback to
* (potentially racy) direct updates of the volatile variables.

View File

@ -65,7 +65,7 @@ final class CensusTracingModule {
@Nullable private static final AtomicIntegerFieldUpdater<ServerTracer> streamClosedUpdater;
/**
/*
* When using Atomic*FieldUpdater, some Samsung Android 5.0.x devices encounter a bug in their JDK
* reflection API that triggers a NoSuchFieldException. When this occurs, we fallback to
* (potentially racy) direct updates of the volatile variables.

View File

@ -20,7 +20,7 @@ package io.grpc.internal;
* Determines how long to wait before doing some action (typically a retry, or a reconnect).
*/
public interface BackoffPolicy {
public interface Provider {
interface Provider {
BackoffPolicy get();
}

View File

@ -121,6 +121,7 @@ public class DelayedClientCall<ReqT, RespT> extends ClientCall<ReqT, RespT> {
buf.append(seconds);
buf.append(String.format(Locale.US, ".%09d", nanos));
buf.append("s. ");
/** Cancels the call if deadline exceeded prior to the real call being set. */
class DeadlineExceededRunnable implements Runnable {
@Override

View File

@ -50,7 +50,7 @@ public interface InternalServer {
void shutdown();
/**
* Returns the first listening socket address. May change after {@link start(ServerListener)} is
* Returns the first listening socket address. May change after {@link #start(ServerListener)} is
* called.
*/
SocketAddress getListenSocketAddress();
@ -61,7 +61,7 @@ public interface InternalServer {
@Nullable InternalInstrumented<SocketStats> getListenSocketStats();
/**
* Returns a list of listening socket addresses. May change after {@link start(ServerListener)}
* Returns a list of listening socket addresses. May change after {@link #start(ServerListener)}
* is called.
*/
List<? extends SocketAddress> getListenSocketAddresses();

View File

@ -18,6 +18,7 @@ package io.grpc.internal;
import io.grpc.LoadBalancer;
import io.grpc.LoadBalancerProvider;
import io.grpc.NameResolver;
import io.grpc.NameResolver.ConfigOrError;
import java.util.Map;

View File

@ -59,6 +59,6 @@ public interface StreamListener {
* messages until the producer returns null, at which point the producer may be discarded.
*/
@Nullable
public InputStream next();
InputStream next();
}
}

View File

@ -246,7 +246,8 @@ public final class AdvancedTlsX509KeyManager extends X509ExtendedKeyManager {
* Mainly used to avoid throwing IO Exceptions in java.io.Closeable.
*/
public interface Closeable extends java.io.Closeable {
@Override public void close();
@Override
void close();
}
}

View File

@ -295,7 +295,8 @@ public final class AdvancedTlsX509TrustManager extends X509ExtendedTrustManager
// Mainly used to avoid throwing IO Exceptions in java.io.Closeable.
public interface Closeable extends java.io.Closeable {
@Override public void close();
@Override
void close();
}
public static Builder newBuilder() {

View File

@ -236,7 +236,7 @@ public class ServiceConfigErrorHandlingTest {
public void emptyAddresses_validConfig_firstResolution_lbNeedsAddress() throws Exception {
FakeNameResolverFactory nameResolverFactory =
new FakeNameResolverFactory.Builder(expectedUri)
.setServers(Collections.<EquivalentAddressGroup>emptyList())
.setServers(Collections.emptyList())
.build();
channelBuilder.nameResolverFactory(nameResolverFactory);
@ -299,7 +299,7 @@ public class ServiceConfigErrorHandlingTest {
public void emptyAddresses_validConfig_lbDoesNotNeedAddress() throws Exception {
FakeNameResolverFactory nameResolverFactory =
new FakeNameResolverFactory.Builder(expectedUri)
.setServers(Collections.<EquivalentAddressGroup>emptyList())
.setServers(Collections.emptyList())
.build();
channelBuilder.nameResolverFactory(nameResolverFactory);
when(mockLoadBalancer.canHandleEmptyAddressListFromNameResolution()).thenReturn(true);
@ -316,7 +316,7 @@ public class ServiceConfigErrorHandlingTest {
ResolvedAddresses resolvedAddresses = resultCaptor.getValue();
assertThat(resolvedAddresses.getAddresses()).isEmpty();
assertThat(resolvedAddresses.getLoadBalancingPolicyConfig()).isEqualTo("val");;
assertThat(resolvedAddresses.getLoadBalancingPolicyConfig()).isEqualTo("val");
verify(mockLoadBalancer, never()).handleNameResolutionError(any(Status.class));
assertThat(channel.getState(false)).isNotEqualTo(ConnectivityState.TRANSIENT_FAILURE);

View File

@ -223,7 +223,7 @@ public class GcpObservabilityTest {
InternalLoggingChannelInterceptor.Factory channelInterceptorFactory =
mock(InternalLoggingChannelInterceptor.Factory.class);
InternalLoggingServerInterceptor.Factory serverInterceptorFactory =
mock(InternalLoggingServerInterceptor.Factory.class);;
mock(InternalLoggingServerInterceptor.Factory.class);
try (GcpObservability unused =
GcpObservability.grpcInit(

View File

@ -238,7 +238,7 @@ abstract class AbstractNettyHandler extends GrpcHttp2ConnectionHandler {
/** Controls whether PINGs like those for BDP are permitted to be sent at the current time. */
public interface PingLimiter {
public boolean isPingAllowed();
boolean isPingAllowed();
}
private static final class AllowPingLimiter implements PingLimiter {

View File

@ -251,7 +251,7 @@ class NettyClientTransport implements ConnectionClientTransport {
ChannelHandler bufferingHandler = new WriteBufferingAndExceptionHandler(negotiationHandler);
/**
/*
* We don't use a ChannelInitializer in the client bootstrap because its "initChannel" method
* is executed in the event loop and we need this handler to be in the pipeline immediately so
* that it may begin buffering writes.

View File

@ -184,7 +184,7 @@ final class WriteBufferingAndExceptionHandler extends ChannelDuplexHandler {
*/
@Override
public void flush(ChannelHandlerContext ctx) {
/**
/*
* Swallowing any flushes is not only an optimization but also required
* for the SslHandler to work correctly. If the SslHandler receives multiple
* flushes while the handshake is still ongoing, then the handshake "randomly"

View File

@ -822,7 +822,7 @@ final class XdsNameResolver extends NameResolver {
existingClusters == null ? clusters : Sets.difference(clusters, existingClusters);
Set<String> deletedClusters =
existingClusters == null
? Collections.<String>emptySet() : Sets.difference(existingClusters, clusters);
? Collections.emptySet() : Sets.difference(existingClusters, clusters);
existingClusters = clusters;
for (String cluster : addedClusters) {
if (clusterRefs.containsKey(cluster)) {
@ -982,7 +982,7 @@ final class XdsNameResolver extends NameResolver {
final Map<String, FilterConfig> virtualHostOverrideConfig;
private static RoutingConfig empty = new RoutingConfig(
0L, Collections.<Route>emptyList(), null, Collections.<String, FilterConfig>emptyMap());
0, Collections.emptyList(), null, Collections.emptyMap());
private RoutingConfig(
long fallbackTimeoutNano, List<Route> routes, @Nullable List<NamedFilterConfig> filterChain,

View File

@ -19,5 +19,5 @@ package io.grpc.xds.internal.sds;
public interface Closeable extends java.io.Closeable {
@Override
public void close();
void close();
}

View File

@ -274,7 +274,7 @@ public class XdsNameResolverTest {
.authorities(
ImmutableMap.of(targetAuthority, AuthorityInfo.create(
"xdstp://" + targetAuthority + "/envoy.config.listener.v3.Listener/%s?foo=1&bar=2",
ImmutableList.<ServerInfo>of(ServerInfo.create(
ImmutableList.of(ServerInfo.create(
"td.googleapis.com", InsecureChannelCredentials.create(), true)))))
.build();
expectedLdsResourceName = "xdstp://xds.authority.com/envoy.config.listener.v3.Listener/"
@ -299,12 +299,12 @@ public class XdsNameResolverTest {
public void resolving_ldsResourceUpdateRdsName() {
Route route1 = Route.forAction(RouteMatch.withPathExactOnly(call1.getFullMethodNameForPath()),
RouteAction.forCluster(
cluster1, Collections.<HashPolicy>emptyList(), TimeUnit.SECONDS.toNanos(15L), null),
ImmutableMap.<String, FilterConfig>of());
cluster1, Collections.emptyList(), TimeUnit.SECONDS.toNanos(15L), null),
ImmutableMap.of());
Route route2 = Route.forAction(RouteMatch.withPathExactOnly(call2.getFullMethodNameForPath()),
RouteAction.forCluster(
cluster2, Collections.<HashPolicy>emptyList(), TimeUnit.SECONDS.toNanos(20L), null),
ImmutableMap.<String, FilterConfig>of());
cluster2, Collections.emptyList(), TimeUnit.SECONDS.toNanos(20L), null),
ImmutableMap.of());
resolver.start(mockListener);
FakeXdsClient xdsClient = (FakeXdsClient) resolver.getXdsClient();
@ -313,7 +313,7 @@ public class XdsNameResolverTest {
VirtualHost virtualHost =
VirtualHost.create("virtualhost", Collections.singletonList(AUTHORITY),
Collections.singletonList(route1),
ImmutableMap.<String, FilterConfig>of());
ImmutableMap.of());
xdsClient.deliverRdsUpdate(RDS_RESOURCE_NAME, Collections.singletonList(virtualHost));
verify(mockListener).onResult(resolutionResultCaptor.capture());
assertServiceConfigForLoadBalancingConfig(
@ -329,7 +329,7 @@ public class XdsNameResolverTest {
virtualHost =
VirtualHost.create("virtualhost-alter", Collections.singletonList(AUTHORITY),
Collections.singletonList(route2),
ImmutableMap.<String, FilterConfig>of());
ImmutableMap.of());
xdsClient.deliverRdsUpdate(alternativeRdsResource, Collections.singletonList(virtualHost));
// Two new service config updates triggered:
// - with load balancing config being able to select cluster1 and cluster2
@ -357,8 +357,8 @@ public class XdsNameResolverTest {
public void resolving_ldsResourceRevokedAndAddedBack() {
Route route = Route.forAction(RouteMatch.withPathExactOnly(call1.getFullMethodNameForPath()),
RouteAction.forCluster(
cluster1, Collections.<HashPolicy>emptyList(), TimeUnit.SECONDS.toNanos(15L), null),
ImmutableMap.<String, FilterConfig>of());
cluster1, Collections.emptyList(), TimeUnit.SECONDS.toNanos(15L), null),
ImmutableMap.of());
resolver.start(mockListener);
FakeXdsClient xdsClient = (FakeXdsClient) resolver.getXdsClient();
@ -367,7 +367,7 @@ public class XdsNameResolverTest {
VirtualHost virtualHost =
VirtualHost.create("virtualhost", Collections.singletonList(AUTHORITY),
Collections.singletonList(route),
ImmutableMap.<String, FilterConfig>of());
ImmutableMap.of());
xdsClient.deliverRdsUpdate(RDS_RESOURCE_NAME, Collections.singletonList(virtualHost));
verify(mockListener).onResult(resolutionResultCaptor.capture());
assertServiceConfigForLoadBalancingConfig(
@ -396,8 +396,8 @@ public class XdsNameResolverTest {
public void resolving_rdsResourceRevokedAndAddedBack() {
Route route = Route.forAction(RouteMatch.withPathExactOnly(call1.getFullMethodNameForPath()),
RouteAction.forCluster(
cluster1, Collections.<HashPolicy>emptyList(), TimeUnit.SECONDS.toNanos(15L), null),
ImmutableMap.<String, FilterConfig>of());
cluster1, Collections.emptyList(), TimeUnit.SECONDS.toNanos(15L), null),
ImmutableMap.of());
resolver.start(mockListener);
FakeXdsClient xdsClient = (FakeXdsClient) resolver.getXdsClient();
@ -406,7 +406,7 @@ public class XdsNameResolverTest {
VirtualHost virtualHost =
VirtualHost.create("virtualhost", Collections.singletonList(AUTHORITY),
Collections.singletonList(route),
ImmutableMap.<String, FilterConfig>of());
ImmutableMap.of());
xdsClient.deliverRdsUpdate(RDS_RESOURCE_NAME, Collections.singletonList(virtualHost));
verify(mockListener).onResult(resolutionResultCaptor.capture());
assertServiceConfigForLoadBalancingConfig(
@ -473,12 +473,12 @@ public class XdsNameResolverTest {
public void resolving_matchingVirtualHostNotFound_matchingOverrideAuthority() {
Route route = Route.forAction(RouteMatch.withPathExactOnly(call1.getFullMethodNameForPath()),
RouteAction.forCluster(
cluster1, Collections.<HashPolicy>emptyList(), TimeUnit.SECONDS.toNanos(15L), null),
ImmutableMap.<String, FilterConfig>of());
cluster1, Collections.emptyList(), TimeUnit.SECONDS.toNanos(15L), null),
ImmutableMap.of());
VirtualHost virtualHost =
VirtualHost.create("virtualhost", Collections.singletonList("random"),
Collections.singletonList(route),
ImmutableMap.<String, FilterConfig>of());
ImmutableMap.of());
resolver = new XdsNameResolver(null, AUTHORITY, "random",
serviceConfigParser, syncContext, scheduler,
@ -496,12 +496,12 @@ public class XdsNameResolverTest {
public void resolving_matchingVirtualHostNotFound_notMatchingOverrideAuthority() {
Route route = Route.forAction(RouteMatch.withPathExactOnly(call1.getFullMethodNameForPath()),
RouteAction.forCluster(
cluster1, Collections.<HashPolicy>emptyList(), TimeUnit.SECONDS.toNanos(15L), null),
ImmutableMap.<String, FilterConfig>of());
cluster1, Collections.emptyList(), TimeUnit.SECONDS.toNanos(15L), null),
ImmutableMap.of());
VirtualHost virtualHost =
VirtualHost.create("virtualhost", Collections.singletonList(AUTHORITY),
Collections.singletonList(route),
ImmutableMap.<String, FilterConfig>of());
ImmutableMap.of());
resolver = new XdsNameResolver(null, AUTHORITY, "random",
serviceConfigParser, syncContext, scheduler,
@ -543,19 +543,19 @@ public class XdsNameResolverTest {
private List<VirtualHost> buildUnmatchedVirtualHosts() {
Route route1 = Route.forAction(RouteMatch.withPathExactOnly(call2.getFullMethodNameForPath()),
RouteAction.forCluster(
cluster2, Collections.<HashPolicy>emptyList(), TimeUnit.SECONDS.toNanos(15L), null),
ImmutableMap.<String, FilterConfig>of());
cluster2, Collections.emptyList(), TimeUnit.SECONDS.toNanos(15L), null),
ImmutableMap.of());
Route route2 = Route.forAction(RouteMatch.withPathExactOnly(call1.getFullMethodNameForPath()),
RouteAction.forCluster(
cluster1, Collections.<HashPolicy>emptyList(), TimeUnit.SECONDS.toNanos(15L), null),
ImmutableMap.<String, FilterConfig>of());
cluster1, Collections.emptyList(), TimeUnit.SECONDS.toNanos(15L), null),
ImmutableMap.of());
return Arrays.asList(
VirtualHost.create("virtualhost-foo", Collections.singletonList("hello.googleapis.com"),
Collections.singletonList(route1),
ImmutableMap.<String, FilterConfig>of()),
ImmutableMap.of()),
VirtualHost.create("virtualhost-bar", Collections.singletonList("hi.googleapis.com"),
Collections.singletonList(route2),
ImmutableMap.<String, FilterConfig>of()));
ImmutableMap.of()));
}
@Test
@ -564,11 +564,11 @@ public class XdsNameResolverTest {
FakeXdsClient xdsClient = (FakeXdsClient) resolver.getXdsClient();
Route route = Route.forAction(RouteMatch.withPathExactOnly(call1.getFullMethodNameForPath()),
RouteAction.forCluster(
cluster1, Collections.<HashPolicy>emptyList(), null, null), // per-route timeout unset
ImmutableMap.<String, FilterConfig>of());
cluster1, Collections.emptyList(), null, null), // per-route timeout unset
ImmutableMap.of());
VirtualHost virtualHost = VirtualHost.create("does not matter",
Collections.singletonList(AUTHORITY), Collections.singletonList(route),
ImmutableMap.<String, FilterConfig>of());
ImmutableMap.of());
xdsClient.deliverLdsUpdate(0L, Collections.singletonList(virtualHost));
verify(mockListener).onResult(resolutionResultCaptor.capture());
ResolutionResult result = resolutionResultCaptor.getValue();
@ -582,11 +582,11 @@ public class XdsNameResolverTest {
FakeXdsClient xdsClient = (FakeXdsClient) resolver.getXdsClient();
Route route = Route.forAction(RouteMatch.withPathExactOnly(call1.getFullMethodNameForPath()),
RouteAction.forCluster(
cluster1, Collections.<HashPolicy>emptyList(), null, null), // per-route timeout unset
ImmutableMap.<String, FilterConfig>of());
cluster1, Collections.emptyList(), null, null), // per-route timeout unset
ImmutableMap.of());
VirtualHost virtualHost = VirtualHost.create("does not matter",
Collections.singletonList(AUTHORITY), Collections.singletonList(route),
ImmutableMap.<String, FilterConfig>of());
ImmutableMap.of());
xdsClient.deliverLdsUpdate(TimeUnit.SECONDS.toNanos(5L),
Collections.singletonList(virtualHost));
verify(mockListener).onResult(resolutionResultCaptor.capture());
@ -612,10 +612,10 @@ public class XdsNameResolverTest {
RouteMatch.withPathExactOnly(call1.getFullMethodNameForPath()),
RouteAction.forCluster(
cluster1,
Collections.<HashPolicy>emptyList(),
Collections.emptyList(),
null,
retryPolicy),
ImmutableMap.<String, FilterConfig>of())));
ImmutableMap.of())));
verify(mockListener).onResult(resolutionResultCaptor.capture());
ResolutionResult result = resolutionResultCaptor.getValue();
InternalConfigSelector configSelector = result.getAttributes().get(InternalConfigSelector.KEY);
@ -668,12 +668,12 @@ public class XdsNameResolverTest {
Arrays.asList(
Route.forNonForwardingAction(
RouteMatch.withPathExactOnly(call1.getFullMethodNameForPath()),
ImmutableMap.<String, FilterConfig>of()),
ImmutableMap.of()),
Route.forAction(
RouteMatch.withPathExactOnly(call2.getFullMethodNameForPath()),
RouteAction.forCluster(cluster2, Collections.<HashPolicy>emptyList(),
RouteAction.forCluster(cluster2, Collections.emptyList(),
TimeUnit.SECONDS.toNanos(15L), null),
ImmutableMap.<String, FilterConfig>of())));
ImmutableMap.of())));
verify(mockListener).onResult(resolutionResultCaptor.capture());
ResolutionResult result = resolutionResultCaptor.getValue();
assertThat(result.getAddresses()).isEmpty();
@ -709,7 +709,7 @@ public class XdsNameResolverTest {
HashPolicy.forHeader(false, "custom-key", null, null)),
null,
null),
ImmutableMap.<String, FilterConfig>of())));
ImmutableMap.of())));
verify(mockListener).onResult(resolutionResultCaptor.capture());
InternalConfigSelector configSelector =
resolutionResultCaptor.getValue().getAttributes().get(InternalConfigSelector.KEY);
@ -743,7 +743,7 @@ public class XdsNameResolverTest {
HashPolicy.forHeader(false, "custom-key", Pattern.compile("value"), "val")),
null,
null),
ImmutableMap.<String, FilterConfig>of())));
ImmutableMap.of())));
verify(mockListener).onResult(resolutionResultCaptor.capture());
InternalConfigSelector configSelector =
resolutionResultCaptor.getValue().getAttributes().get(InternalConfigSelector.KEY);
@ -782,7 +782,7 @@ public class XdsNameResolverTest {
Collections.singletonList(HashPolicy.forChannelId(false)),
null,
null),
ImmutableMap.<String, FilterConfig>of())));
ImmutableMap.of())));
verify(mockListener).onResult(resolutionResultCaptor.capture());
InternalConfigSelector configSelector =
resolutionResultCaptor.getValue().getAttributes().get(InternalConfigSelector.KEY);
@ -795,7 +795,7 @@ public class XdsNameResolverTest {
// Second call, with no custom header.
startNewCall(TestMethodDescriptors.voidMethod(), configSelector,
Collections.<String, String>emptyMap(),
Collections.emptyMap(),
CallOptions.DEFAULT);
long hash2 = testCall.callOptions.getOption(XdsNameResolver.RPC_HASH_KEY);
@ -817,14 +817,14 @@ public class XdsNameResolverTest {
Collections.singletonList(HashPolicy.forChannelId(false)),
null,
null),
ImmutableMap.<String, FilterConfig>of())));
ImmutableMap.of())));
verify(mockListener).onResult(resolutionResultCaptor.capture());
configSelector = resolutionResultCaptor.getValue().getAttributes().get(
InternalConfigSelector.KEY);
// Third call, with no custom header.
startNewCall(TestMethodDescriptors.voidMethod(), configSelector,
Collections.<String, String>emptyMap(),
Collections.emptyMap(),
CallOptions.DEFAULT);
long hash3 = testCall.callOptions.getOption(XdsNameResolver.RPC_HASH_KEY);
@ -846,15 +846,15 @@ public class XdsNameResolverTest {
Route.forAction(
RouteMatch.withPathExactOnly(call1.getFullMethodNameForPath()),
RouteAction.forCluster(
"another-cluster", Collections.<HashPolicy>emptyList(),
"another-cluster", Collections.emptyList(),
TimeUnit.SECONDS.toNanos(20L), null),
ImmutableMap.<String, FilterConfig>of()),
ImmutableMap.of()),
Route.forAction(
RouteMatch.withPathExactOnly(call2.getFullMethodNameForPath()),
RouteAction.forCluster(
cluster2, Collections.<HashPolicy>emptyList(), TimeUnit.SECONDS.toNanos(15L),
cluster2, Collections.emptyList(), TimeUnit.SECONDS.toNanos(15L),
null),
ImmutableMap.<String, FilterConfig>of())));
ImmutableMap.of())));
verify(mockListener).onResult(resolutionResultCaptor.capture());
ResolutionResult result = resolutionResultCaptor.getValue();
// Updated service config still contains cluster1 while it is removed resource. New calls no
@ -886,15 +886,15 @@ public class XdsNameResolverTest {
Route.forAction(
RouteMatch.withPathExactOnly(call1.getFullMethodNameForPath()),
RouteAction.forCluster(
"another-cluster", Collections.<HashPolicy>emptyList(),
"another-cluster", Collections.emptyList(),
TimeUnit.SECONDS.toNanos(20L), null),
ImmutableMap.<String, FilterConfig>of()),
ImmutableMap.of()),
Route.forAction(
RouteMatch.withPathExactOnly(call2.getFullMethodNameForPath()),
RouteAction.forCluster(
cluster2, Collections.<HashPolicy>emptyList(), TimeUnit.SECONDS.toNanos(15L),
cluster2, Collections.emptyList(), TimeUnit.SECONDS.toNanos(15L),
null),
ImmutableMap.<String, FilterConfig>of())));
ImmutableMap.of())));
// Two consecutive service config updates: one for removing clcuster1,
// one for adding "another=cluster".
verify(mockListener, times(2)).onResult(resolutionResultCaptor.capture());
@ -922,15 +922,15 @@ public class XdsNameResolverTest {
Route.forAction(
RouteMatch.withPathExactOnly(call1.getFullMethodNameForPath()),
RouteAction.forCluster(
"another-cluster", Collections.<HashPolicy>emptyList(),
"another-cluster", Collections.emptyList(),
TimeUnit.SECONDS.toNanos(20L), null),
ImmutableMap.<String, FilterConfig>of()),
ImmutableMap.of()),
Route.forAction(
RouteMatch.withPathExactOnly(call2.getFullMethodNameForPath()),
RouteAction.forCluster(
cluster2, Collections.<HashPolicy>emptyList(),
cluster2, Collections.emptyList(),
TimeUnit.SECONDS.toNanos(15L), null),
ImmutableMap.<String, FilterConfig>of())));
ImmutableMap.of())));
verify(mockListener).onResult(resolutionResultCaptor.capture());
ResolutionResult result = resolutionResultCaptor.getValue();
@ -943,15 +943,15 @@ public class XdsNameResolverTest {
Route.forAction(
RouteMatch.withPathExactOnly(call1.getFullMethodNameForPath()),
RouteAction.forCluster(
"another-cluster", Collections.<HashPolicy>emptyList(),
"another-cluster", Collections.emptyList(),
TimeUnit.SECONDS.toNanos(15L), null),
ImmutableMap.<String, FilterConfig>of()),
ImmutableMap.of()),
Route.forAction(
RouteMatch.withPathExactOnly(call2.getFullMethodNameForPath()),
RouteAction.forCluster(
cluster2, Collections.<HashPolicy>emptyList(),
cluster2, Collections.emptyList(),
TimeUnit.SECONDS.toNanos(15L), null),
ImmutableMap.<String, FilterConfig>of())));
ImmutableMap.of())));
verifyNoMoreInteractions(mockListener); // no cluster added/deleted
assertCallSelectClusterResult(call1, configSelector, "another-cluster", 15.0);
}
@ -966,23 +966,23 @@ public class XdsNameResolverTest {
Route.forAction(
RouteMatch.withPathExactOnly(call2.getFullMethodNameForPath()),
RouteAction.forCluster(
cluster2, Collections.<HashPolicy>emptyList(), TimeUnit.SECONDS.toNanos(15L),
cluster2, Collections.emptyList(), TimeUnit.SECONDS.toNanos(15L),
null),
ImmutableMap.<String, FilterConfig>of())));
ImmutableMap.of())));
xdsClient.deliverLdsUpdate(
Arrays.asList(
Route.forAction(
RouteMatch.withPathExactOnly(call1.getFullMethodNameForPath()),
RouteAction.forCluster(
cluster1, Collections.<HashPolicy>emptyList(), TimeUnit.SECONDS.toNanos(15L),
cluster1, Collections.emptyList(), TimeUnit.SECONDS.toNanos(15L),
null),
ImmutableMap.<String, FilterConfig>of()),
ImmutableMap.of()),
Route.forAction(
RouteMatch.withPathExactOnly(call2.getFullMethodNameForPath()),
RouteAction.forCluster(
cluster2, Collections.<HashPolicy>emptyList(), TimeUnit.SECONDS.toNanos(15L),
cluster2, Collections.emptyList(), TimeUnit.SECONDS.toNanos(15L),
null),
ImmutableMap.<String, FilterConfig>of())));
ImmutableMap.of())));
testCall.deliverErrorStatus();
verifyNoMoreInteractions(mockListener);
}
@ -999,13 +999,13 @@ public class XdsNameResolverTest {
RouteMatch.withPathExactOnly(call1.getFullMethodNameForPath()),
RouteAction.forWeightedClusters(
Arrays.asList(
ClusterWeight.create(cluster1, 20, ImmutableMap.<String, FilterConfig>of()),
ClusterWeight.create(cluster1, 20, ImmutableMap.of()),
ClusterWeight.create(
cluster2, 80, ImmutableMap.<String, FilterConfig>of())),
Collections.<HashPolicy>emptyList(),
cluster2, 80, ImmutableMap.of())),
Collections.emptyList(),
TimeUnit.SECONDS.toNanos(20L),
null),
ImmutableMap.<String, FilterConfig>of())));
ImmutableMap.of())));
verify(mockListener).onResult(resolutionResultCaptor.capture());
ResolutionResult result = resolutionResultCaptor.getValue();
assertThat(result.getAddresses()).isEmpty();
@ -1031,10 +1031,10 @@ public class XdsNameResolverTest {
"rls-plugin-foo",
RlsPluginConfig.create(
ImmutableMap.of("lookupService", "rls-cbt.googleapis.com"))),
Collections.<HashPolicy>emptyList(),
Collections.emptyList(),
TimeUnit.SECONDS.toNanos(20L),
null),
ImmutableMap.<String, FilterConfig>of())));
ImmutableMap.of())));
verify(mockListener).onResult(resolutionResultCaptor.capture());
ResolutionResult result = resolutionResultCaptor.getValue();
assertThat(result.getAddresses()).isEmpty();
@ -1078,11 +1078,11 @@ public class XdsNameResolverTest {
RlsPluginConfig.create(
// changed
ImmutableMap.of("lookupService", "rls-cbt-2.googleapis.com"))),
Collections.<HashPolicy>emptyList(),
Collections.emptyList(),
// changed
TimeUnit.SECONDS.toNanos(30L),
null),
ImmutableMap.<String, FilterConfig>of())));
ImmutableMap.of())));
verify(mockListener, times(2)).onResult(resolutionResultCaptor.capture());
ResolutionResult result2 = resolutionResultCaptor.getValue();
@SuppressWarnings("unchecked")
@ -1136,7 +1136,7 @@ public class XdsNameResolverTest {
ClientInterceptor interceptor = result.getInterceptor();
ClientCall<Void, Void> clientCall = interceptor.interceptCall(
call.methodDescriptor, CallOptions.DEFAULT, channel);
clientCall.start(new NoopClientCallListener<Void>(), new Metadata());
clientCall.start(new NoopClientCallListener<>(), new Metadata());
assertThat(testCall.callOptions.getOption(XdsNameResolver.CLUSTER_SELECTION_KEY))
.isEqualTo("cluster:" + expectedCluster);
@SuppressWarnings("unchecked")
@ -1164,7 +1164,7 @@ public class XdsNameResolverTest {
ClientInterceptor interceptor = result.getInterceptor();
ClientCall<Void, Void> clientCall = interceptor.interceptCall(
call.methodDescriptor, CallOptions.DEFAULT, channel);
clientCall.start(new NoopClientCallListener<Void>(), new Metadata());
clientCall.start(new NoopClientCallListener<>(), new Metadata());
assertThat(testCall.callOptions.getOption(XdsNameResolver.CLUSTER_SELECTION_KEY))
.isEqualTo("cluster_specifier_plugin:" + expectedPluginName);
@SuppressWarnings("unchecked")
@ -1186,15 +1186,15 @@ public class XdsNameResolverTest {
Route.forAction(
RouteMatch.withPathExactOnly(call1.getFullMethodNameForPath()),
RouteAction.forCluster(
cluster1, Collections.<HashPolicy>emptyList(), TimeUnit.SECONDS.toNanos(15L),
cluster1, Collections.emptyList(), TimeUnit.SECONDS.toNanos(15L),
null),
ImmutableMap.<String, FilterConfig>of()),
ImmutableMap.of()),
Route.forAction(
RouteMatch.withPathExactOnly(call2.getFullMethodNameForPath()),
RouteAction.forCluster(
cluster2, Collections.<HashPolicy>emptyList(), TimeUnit.SECONDS.toNanos(15L),
cluster2, Collections.emptyList(), TimeUnit.SECONDS.toNanos(15L),
null),
ImmutableMap.<String, FilterConfig>of())));
ImmutableMap.of())));
verify(mockListener).onResult(resolutionResultCaptor.capture());
ResolutionResult result = resolutionResultCaptor.getValue();
assertThat(result.getAddresses()).isEmpty();
@ -1329,7 +1329,7 @@ public class XdsNameResolverTest {
4, ImmutableList.of(Code.UNAVAILABLE, Code.CANCELLED), Durations.fromMillis(100),
Durations.fromMillis(200), null);
RetryPolicy retryPolicyWithEmptyStatusCodes = RetryPolicy.create(
4, ImmutableList.<Code>of(), Durations.fromMillis(100), Durations.fromMillis(200), null);
4, ImmutableList.of(), Durations.fromMillis(100), Durations.fromMillis(200), null);
// timeout only
String expectedServiceConfigJson = "{\n"
@ -1451,13 +1451,13 @@ public class XdsNameResolverTest {
List<Route> routes = Collections.emptyList();
VirtualHost vHost1 = VirtualHost.create("virtualhost01.googleapis.com",
Arrays.asList("a.googleapis.com", "b.googleapis.com"), routes,
ImmutableMap.<String, FilterConfig>of());
ImmutableMap.of());
VirtualHost vHost2 = VirtualHost.create("virtualhost02.googleapis.com",
Collections.singletonList("*.googleapis.com"), routes,
ImmutableMap.<String, FilterConfig>of());
ImmutableMap.of());
VirtualHost vHost3 = VirtualHost.create("virtualhost03.googleapis.com",
Collections.singletonList("*"), routes,
ImmutableMap.<String, FilterConfig>of());
ImmutableMap.of());
List<VirtualHost> virtualHosts = Arrays.asList(vHost1, vHost2, vHost3);
assertThat(XdsNameResolver.findVirtualHostForHostName(virtualHosts, hostname))
.isEqualTo(vHost1);
@ -1469,13 +1469,13 @@ public class XdsNameResolverTest {
List<Route> routes = Collections.emptyList();
VirtualHost vHost1 = VirtualHost.create("virtualhost01.googleapis.com",
Arrays.asList("*.googleapis.com", "b.googleapis.com"), routes,
ImmutableMap.<String, FilterConfig>of());
ImmutableMap.of());
VirtualHost vHost2 = VirtualHost.create("virtualhost02.googleapis.com",
Collections.singletonList("a.googleapis.*"), routes,
ImmutableMap.<String, FilterConfig>of());
ImmutableMap.of());
VirtualHost vHost3 = VirtualHost.create("virtualhost03.googleapis.com",
Collections.singletonList("*"), routes,
ImmutableMap.<String, FilterConfig>of());
ImmutableMap.of());
List<VirtualHost> virtualHosts = Arrays.asList(vHost1, vHost2, vHost3);
assertThat(XdsNameResolver.findVirtualHostForHostName(virtualHosts, hostname))
.isEqualTo(vHost1);
@ -1487,13 +1487,13 @@ public class XdsNameResolverTest {
List<Route> routes = Collections.emptyList();
VirtualHost vHost1 = VirtualHost.create("virtualhost01.googleapis.com",
Collections.singletonList("*"), routes,
ImmutableMap.<String, FilterConfig>of());
ImmutableMap.of());
VirtualHost vHost2 = VirtualHost.create("virtualhost02.googleapis.com",
Collections.singletonList("b.googleapis.com"), routes,
ImmutableMap.<String, FilterConfig>of());
ImmutableMap.of());
List<VirtualHost> virtualHosts = Arrays.asList(vHost1, vHost2);
assertThat(XdsNameResolver.findVirtualHostForHostName(virtualHosts, hostname))
.isEqualTo(vHost1);;
.isEqualTo(vHost1);
}
@Test
@ -1513,7 +1513,7 @@ public class XdsNameResolverTest {
InternalConfigSelector configSelector = result.getAttributes().get(InternalConfigSelector.KEY);
// no header abort key provided in metadata, rpc should succeed
ClientCall.Listener<Void> observer = startNewCall(TestMethodDescriptors.voidMethod(),
configSelector, Collections.<String, String>emptyMap(), CallOptions.DEFAULT);
configSelector, Collections.emptyMap(), CallOptions.DEFAULT);
verifyRpcSucceeded(observer);
// header abort http status key provided, rpc should fail
observer = startNewCall(TestMethodDescriptors.voidMethod(), configSelector,
@ -1582,7 +1582,7 @@ public class XdsNameResolverTest {
result = resolutionResultCaptor.getValue();
configSelector = result.getAttributes().get(InternalConfigSelector.KEY);
observer = startNewCall(TestMethodDescriptors.voidMethod(), configSelector,
Collections.<String, String>emptyMap(), CallOptions.DEFAULT);
Collections.emptyMap(), CallOptions.DEFAULT);
verifyRpcFailed(
observer,
Status.UNAUTHENTICATED.withDescription(
@ -1600,7 +1600,7 @@ public class XdsNameResolverTest {
result = resolutionResultCaptor.getValue();
configSelector = result.getAttributes().get(InternalConfigSelector.KEY);
observer = startNewCall(TestMethodDescriptors.voidMethod(), configSelector,
Collections.<String, String>emptyMap(), CallOptions.DEFAULT);
Collections.emptyMap(), CallOptions.DEFAULT);
verifyRpcSucceeded(observer);
}
@ -1619,7 +1619,7 @@ public class XdsNameResolverTest {
InternalConfigSelector configSelector = result.getAttributes().get(InternalConfigSelector.KEY);
// no header delay key provided in metadata, rpc should succeed immediately
ClientCall.Listener<Void> observer = startNewCall(TestMethodDescriptors.voidMethod(),
configSelector, Collections.<String, String>emptyMap(), CallOptions.DEFAULT);
configSelector, Collections.emptyMap(), CallOptions.DEFAULT);
verifyRpcSucceeded(observer);
// header delay key provided, rpc should be delayed
observer = startNewCall(TestMethodDescriptors.voidMethod(), configSelector,
@ -1659,7 +1659,7 @@ public class XdsNameResolverTest {
result = resolutionResultCaptor.getValue();
configSelector = result.getAttributes().get(InternalConfigSelector.KEY);
observer = startNewCall(TestMethodDescriptors.voidMethod(), configSelector,
Collections.<String, String>emptyMap(), CallOptions.DEFAULT);
Collections.emptyMap(), CallOptions.DEFAULT);
verifyRpcDelayed(observer, 5000L);
// fixed delay, fix rate = 40%
@ -1672,7 +1672,7 @@ public class XdsNameResolverTest {
result = resolutionResultCaptor.getValue();
configSelector = result.getAttributes().get(InternalConfigSelector.KEY);
observer = startNewCall(TestMethodDescriptors.voidMethod(), configSelector,
Collections.<String, String>emptyMap(), CallOptions.DEFAULT);
Collections.emptyMap(), CallOptions.DEFAULT);
verifyRpcSucceeded(observer);
}
@ -1694,15 +1694,15 @@ public class XdsNameResolverTest {
// Send two calls, then the first call should delayed and the second call should not be delayed
// because maxActiveFaults is exceeded.
ClientCall.Listener<Void> observer1 = startNewCall(TestMethodDescriptors.voidMethod(),
configSelector, Collections.<String, String>emptyMap(), CallOptions.DEFAULT);
configSelector, Collections.emptyMap(), CallOptions.DEFAULT);
assertThat(testCall).isNull();
ClientCall.Listener<Void> observer2 = startNewCall(TestMethodDescriptors.voidMethod(),
configSelector, Collections.<String, String>emptyMap(), CallOptions.DEFAULT);
configSelector, Collections.emptyMap(), CallOptions.DEFAULT);
verifyRpcSucceeded(observer2);
verifyRpcDelayed(observer1, 5000L);
// Once all calls are finished, new call should be delayed.
ClientCall.Listener<Void> observer3 = startNewCall(TestMethodDescriptors.voidMethod(),
configSelector, Collections.<String, String>emptyMap(), CallOptions.DEFAULT);
configSelector, Collections.emptyMap(), CallOptions.DEFAULT);
verifyRpcDelayed(observer3, 5000L);
}
@ -1728,7 +1728,7 @@ public class XdsNameResolverTest {
}
};
ClientCall.Listener<Void> observer = startNewCall(TestMethodDescriptors.voidMethod(),
configSelector, Collections.<String, String>emptyMap(), CallOptions.DEFAULT.withDeadline(
configSelector, Collections.emptyMap(), CallOptions.DEFAULT.withDeadline(
Deadline.after(4000, TimeUnit.NANOSECONDS, fakeTicker)));
assertThat(testCall).isNull();
verifyRpcDelayedThenAborted(observer, 4000L, Status.DEADLINE_EXCEEDED.withDescription(
@ -1753,7 +1753,7 @@ public class XdsNameResolverTest {
ResolutionResult result = resolutionResultCaptor.getValue();
InternalConfigSelector configSelector = result.getAttributes().get(InternalConfigSelector.KEY);
ClientCall.Listener<Void> observer = startNewCall(TestMethodDescriptors.voidMethod(),
configSelector, Collections.<String, String>emptyMap(), CallOptions.DEFAULT);
configSelector, Collections.emptyMap(), CallOptions.DEFAULT);
verifyRpcDelayedThenAborted(
observer, 5000L,
Status.UNAUTHENTICATED.withDescription(
@ -1782,7 +1782,7 @@ public class XdsNameResolverTest {
ResolutionResult result = resolutionResultCaptor.getValue();
InternalConfigSelector configSelector = result.getAttributes().get(InternalConfigSelector.KEY);
ClientCall.Listener<Void> observer = startNewCall(TestMethodDescriptors.voidMethod(),
configSelector, Collections.<String, String>emptyMap(), CallOptions.DEFAULT);
configSelector, Collections.emptyMap(), CallOptions.DEFAULT);
verifyRpcFailed(
observer, Status.INTERNAL.withDescription("RPC terminated due to fault injection"));
@ -1797,7 +1797,7 @@ public class XdsNameResolverTest {
result = resolutionResultCaptor.getValue();
configSelector = result.getAttributes().get(InternalConfigSelector.KEY);
observer = startNewCall(TestMethodDescriptors.voidMethod(), configSelector,
Collections.<String, String>emptyMap(), CallOptions.DEFAULT);
Collections.emptyMap(), CallOptions.DEFAULT);
verifyRpcFailed(
observer, Status.UNKNOWN.withDescription("RPC terminated due to fault injection"));
@ -1814,7 +1814,7 @@ public class XdsNameResolverTest {
result = resolutionResultCaptor.getValue();
configSelector = result.getAttributes().get(InternalConfigSelector.KEY);
observer = startNewCall(TestMethodDescriptors.voidMethod(), configSelector,
Collections.<String, String>emptyMap(), CallOptions.DEFAULT);
Collections.emptyMap(), CallOptions.DEFAULT);
verifyRpcFailed(
observer, Status.UNAVAILABLE.withDescription("RPC terminated due to fault injection"));
}
@ -1843,7 +1843,7 @@ public class XdsNameResolverTest {
ResolutionResult result = resolutionResultCaptor.getValue();
InternalConfigSelector configSelector = result.getAttributes().get(InternalConfigSelector.KEY);
ClientCall.Listener<Void> observer = startNewCall(TestMethodDescriptors.voidMethod(),
configSelector, Collections.<String, String>emptyMap(), CallOptions.DEFAULT);;
configSelector, Collections.emptyMap(), CallOptions.DEFAULT);
verifyRpcFailed(
observer, Status.UNKNOWN.withDescription("RPC terminated due to fault injection"));
}
@ -1904,7 +1904,7 @@ public class XdsNameResolverTest {
RouteMatch routeMatch1 =
RouteMatch.create(
PathMatcher.fromPath("/FooService/barMethod", true),
Collections.<HeaderMatcher>emptyList(), null);
Collections.emptyList(), null);
assertThat(XdsNameResolver.matchRoute(routeMatch1, "/FooService/barMethod", headers, random))
.isTrue();
assertThat(XdsNameResolver.matchRoute(routeMatch1, "/FooService/bazMethod", headers, random))
@ -1913,7 +1913,7 @@ public class XdsNameResolverTest {
RouteMatch routeMatch2 =
RouteMatch.create(
PathMatcher.fromPrefix("/FooService/", true),
Collections.<HeaderMatcher>emptyList(), null);
Collections.emptyList(), null);
assertThat(XdsNameResolver.matchRoute(routeMatch2, "/FooService/barMethod", headers, random))
.isTrue();
assertThat(XdsNameResolver.matchRoute(routeMatch2, "/FooService/bazMethod", headers, random))
@ -1924,7 +1924,7 @@ public class XdsNameResolverTest {
RouteMatch routeMatch3 =
RouteMatch.create(
PathMatcher.fromRegEx(Pattern.compile(".*Foo.*")),
Collections.<HeaderMatcher>emptyList(), null);
Collections.emptyList(), null);
assertThat(XdsNameResolver.matchRoute(routeMatch3, "/FooService/barMethod", headers, random))
.isTrue();
}
@ -1937,14 +1937,14 @@ public class XdsNameResolverTest {
RouteMatch routeMatch1 =
RouteMatch.create(
PathMatcher.fromPath("/FooService/barMethod", false),
Collections.<HeaderMatcher>emptyList(), null);
Collections.emptyList(), null);
assertThat(XdsNameResolver.matchRoute(routeMatch1, "/fooservice/barmethod", headers, random))
.isTrue();
RouteMatch routeMatch2 =
RouteMatch.create(
PathMatcher.fromPrefix("/FooService", false),
Collections.<HeaderMatcher>emptyList(), null);
Collections.emptyList(), null);
assertThat(XdsNameResolver.matchRoute(routeMatch2, "/fooservice/barmethod", headers, random))
.isTrue();
}
@ -2122,7 +2122,7 @@ public class XdsNameResolverTest {
VirtualHost virtualHost =
VirtualHost.create(
"virtual-host", Collections.singletonList(expectedLdsResourceName), routes,
ImmutableMap.<String, FilterConfig>of());
ImmutableMap.of());
ldsWatcher.onChanged(LdsUpdate.forApiListener(HttpConnectionManager.forVirtualHosts(
0L, Collections.singletonList(virtualHost), null)));
}
@ -2140,28 +2140,28 @@ public class XdsNameResolverTest {
new NamedFilterConfig(FAULT_FILTER_INSTANCE_NAME, httpFilterFaultConfig),
new NamedFilterConfig(ROUTER_FILTER_INSTANCE_NAME, RouterFilter.ROUTER_CONFIG));
ImmutableMap<String, FilterConfig> overrideConfig = weightedClusterFaultConfig == null
? ImmutableMap.<String, FilterConfig>of()
: ImmutableMap.<String, FilterConfig>of(
? ImmutableMap.of()
: ImmutableMap.of(
FAULT_FILTER_INSTANCE_NAME, weightedClusterFaultConfig);
ClusterWeight clusterWeight =
ClusterWeight.create(
cluster, 100,
overrideConfig);
overrideConfig = routeFaultConfig == null
? ImmutableMap.<String, FilterConfig>of()
: ImmutableMap.<String, FilterConfig>of(FAULT_FILTER_INSTANCE_NAME, routeFaultConfig);
? ImmutableMap.of()
: ImmutableMap.of(FAULT_FILTER_INSTANCE_NAME, routeFaultConfig);
Route route = Route.forAction(
RouteMatch.create(
PathMatcher.fromPrefix("/", false), Collections.<HeaderMatcher>emptyList(), null),
PathMatcher.fromPrefix("/", false), Collections.emptyList(), null),
RouteAction.forWeightedClusters(
Collections.singletonList(clusterWeight),
Collections.<HashPolicy>emptyList(),
Collections.emptyList(),
null,
null),
overrideConfig);
overrideConfig = virtualHostFaultConfig == null
? ImmutableMap.<String, FilterConfig>of()
: ImmutableMap.<String, FilterConfig>of(
? ImmutableMap.of()
: ImmutableMap.of(
FAULT_FILTER_INSTANCE_NAME, virtualHostFaultConfig);
VirtualHost virtualHost = VirtualHost.create(
"virtual-host",
@ -2201,26 +2201,26 @@ public class XdsNameResolverTest {
return;
}
ImmutableMap<String, FilterConfig> overrideConfig = weightedClusterFaultConfig == null
? ImmutableMap.<String, FilterConfig>of()
: ImmutableMap.<String, FilterConfig>of(
? ImmutableMap.of()
: ImmutableMap.of(
FAULT_FILTER_INSTANCE_NAME, weightedClusterFaultConfig);
ClusterWeight clusterWeight =
ClusterWeight.create(cluster1, 100, overrideConfig);
overrideConfig = routFaultConfig == null
? ImmutableMap.<String, FilterConfig>of()
: ImmutableMap.<String, FilterConfig>of(FAULT_FILTER_INSTANCE_NAME, routFaultConfig);
? ImmutableMap.of()
: ImmutableMap.of(FAULT_FILTER_INSTANCE_NAME, routFaultConfig);
Route route = Route.forAction(
RouteMatch.create(
PathMatcher.fromPrefix("/", false), Collections.<HeaderMatcher>emptyList(), null),
PathMatcher.fromPrefix("/", false), Collections.emptyList(), null),
RouteAction.forWeightedClusters(
Collections.singletonList(clusterWeight),
Collections.<HashPolicy>emptyList(),
Collections.emptyList(),
null,
null),
overrideConfig);
overrideConfig = virtualHostFaultConfig == null
? ImmutableMap.<String, FilterConfig>of()
: ImmutableMap.<String, FilterConfig>of(
? ImmutableMap.of()
: ImmutableMap.of(
FAULT_FILTER_INSTANCE_NAME, virtualHostFaultConfig);
VirtualHost virtualHost = VirtualHost.create(
"virtual-host",