mirror of https://github.com/grpc/grpc-java.git
Change ArgumentCaptor.forClass(null) to ArgumentCaptor.forClass(Foo.class)
The former will [soon throw NullPointerException][notnull].
[notnull]: fe1cb2de09 (diff-8d274a9bda2d871524d15bbfcd6272bd893a47e6b1a0b460d82a8845615f26daR31)
This commit is contained in:
parent
cc5378453f
commit
c0de130ac6
|
@ -144,7 +144,7 @@ public class CallCredentialsApplyingTest {
|
||||||
|
|
||||||
transport.newStream(method, origHeaders, callOptions, tracers);
|
transport.newStream(method, origHeaders, callOptions, tracers);
|
||||||
|
|
||||||
ArgumentCaptor<RequestInfo> infoCaptor = ArgumentCaptor.forClass(null);
|
ArgumentCaptor<RequestInfo> infoCaptor = ArgumentCaptor.forClass(RequestInfo.class);
|
||||||
verify(mockCreds).applyRequestMetadata(infoCaptor.capture(), same(mockExecutor),
|
verify(mockCreds).applyRequestMetadata(infoCaptor.capture(), same(mockExecutor),
|
||||||
any(CallCredentials.MetadataApplier.class));
|
any(CallCredentials.MetadataApplier.class));
|
||||||
RequestInfo info = infoCaptor.getValue();
|
RequestInfo info = infoCaptor.getValue();
|
||||||
|
@ -169,7 +169,7 @@ public class CallCredentialsApplyingTest {
|
||||||
callOptions.withAuthority("calloptions-authority").withExecutor(anotherExecutor),
|
callOptions.withAuthority("calloptions-authority").withExecutor(anotherExecutor),
|
||||||
tracers);
|
tracers);
|
||||||
|
|
||||||
ArgumentCaptor<RequestInfo> infoCaptor = ArgumentCaptor.forClass(null);
|
ArgumentCaptor<RequestInfo> infoCaptor = ArgumentCaptor.forClass(RequestInfo.class);
|
||||||
verify(mockCreds).applyRequestMetadata(infoCaptor.capture(),
|
verify(mockCreds).applyRequestMetadata(infoCaptor.capture(),
|
||||||
same(mockExecutor), any(CallCredentials.MetadataApplier.class));
|
same(mockExecutor), any(CallCredentials.MetadataApplier.class));
|
||||||
RequestInfo info = infoCaptor.getValue();
|
RequestInfo info = infoCaptor.getValue();
|
||||||
|
@ -189,7 +189,7 @@ public class CallCredentialsApplyingTest {
|
||||||
|
|
||||||
transport.newStream(method, origHeaders, callOptions, tracers);
|
transport.newStream(method, origHeaders, callOptions, tracers);
|
||||||
|
|
||||||
ArgumentCaptor<RequestInfo> infoCaptor = ArgumentCaptor.forClass(null);
|
ArgumentCaptor<RequestInfo> infoCaptor = ArgumentCaptor.forClass(RequestInfo.class);
|
||||||
verify(mockCreds).applyRequestMetadata(
|
verify(mockCreds).applyRequestMetadata(
|
||||||
infoCaptor.capture(), same(mockExecutor),
|
infoCaptor.capture(), same(mockExecutor),
|
||||||
any(io.grpc.CallCredentials.MetadataApplier.class));
|
any(io.grpc.CallCredentials.MetadataApplier.class));
|
||||||
|
@ -213,7 +213,7 @@ public class CallCredentialsApplyingTest {
|
||||||
callOptions.withAuthority("calloptions-authority").withExecutor(anotherExecutor),
|
callOptions.withAuthority("calloptions-authority").withExecutor(anotherExecutor),
|
||||||
tracers);
|
tracers);
|
||||||
|
|
||||||
ArgumentCaptor<RequestInfo> infoCaptor = ArgumentCaptor.forClass(null);
|
ArgumentCaptor<RequestInfo> infoCaptor = ArgumentCaptor.forClass(RequestInfo.class);
|
||||||
verify(mockCreds).applyRequestMetadata(
|
verify(mockCreds).applyRequestMetadata(
|
||||||
infoCaptor.capture(), same(mockExecutor),
|
infoCaptor.capture(), same(mockExecutor),
|
||||||
any(io.grpc.CallCredentials.MetadataApplier.class));
|
any(io.grpc.CallCredentials.MetadataApplier.class));
|
||||||
|
@ -333,7 +333,8 @@ public class CallCredentialsApplyingTest {
|
||||||
DelayedStream stream = (DelayedStream) transport.newStream(
|
DelayedStream stream = (DelayedStream) transport.newStream(
|
||||||
method, origHeaders, callOptions, tracers);
|
method, origHeaders, callOptions, tracers);
|
||||||
|
|
||||||
ArgumentCaptor<CallCredentials.MetadataApplier> applierCaptor = ArgumentCaptor.forClass(null);
|
ArgumentCaptor<CallCredentials.MetadataApplier> applierCaptor =
|
||||||
|
ArgumentCaptor.forClass(CallCredentials.MetadataApplier.class);
|
||||||
verify(mockCreds).applyRequestMetadata(any(RequestInfo.class),
|
verify(mockCreds).applyRequestMetadata(any(RequestInfo.class),
|
||||||
same(mockExecutor), applierCaptor.capture());
|
same(mockExecutor), applierCaptor.capture());
|
||||||
verify(mockTransport, never()).newStream(
|
verify(mockTransport, never()).newStream(
|
||||||
|
@ -359,7 +360,8 @@ public class CallCredentialsApplyingTest {
|
||||||
@Test
|
@Test
|
||||||
public void delayedShutdown_shutdownShutdownNowThenApply() {
|
public void delayedShutdown_shutdownShutdownNowThenApply() {
|
||||||
transport.newStream(method, origHeaders, callOptions, tracers);
|
transport.newStream(method, origHeaders, callOptions, tracers);
|
||||||
ArgumentCaptor<CallCredentials.MetadataApplier> applierCaptor = ArgumentCaptor.forClass(null);
|
ArgumentCaptor<CallCredentials.MetadataApplier> applierCaptor =
|
||||||
|
ArgumentCaptor.forClass(CallCredentials.MetadataApplier.class);
|
||||||
verify(mockCreds).applyRequestMetadata(any(RequestInfo.class),
|
verify(mockCreds).applyRequestMetadata(any(RequestInfo.class),
|
||||||
same(mockExecutor), applierCaptor.capture());
|
same(mockExecutor), applierCaptor.capture());
|
||||||
transport.shutdown(Status.UNAVAILABLE);
|
transport.shutdown(Status.UNAVAILABLE);
|
||||||
|
@ -380,7 +382,8 @@ public class CallCredentialsApplyingTest {
|
||||||
@Test
|
@Test
|
||||||
public void delayedShutdown_shutdownThenApplyThenShutdownNow() {
|
public void delayedShutdown_shutdownThenApplyThenShutdownNow() {
|
||||||
transport.newStream(method, origHeaders, callOptions, tracers);
|
transport.newStream(method, origHeaders, callOptions, tracers);
|
||||||
ArgumentCaptor<CallCredentials.MetadataApplier> applierCaptor = ArgumentCaptor.forClass(null);
|
ArgumentCaptor<CallCredentials.MetadataApplier> applierCaptor =
|
||||||
|
ArgumentCaptor.forClass(CallCredentials.MetadataApplier.class);
|
||||||
verify(mockCreds).applyRequestMetadata(any(RequestInfo.class),
|
verify(mockCreds).applyRequestMetadata(any(RequestInfo.class),
|
||||||
same(mockExecutor), applierCaptor.capture());
|
same(mockExecutor), applierCaptor.capture());
|
||||||
transport.shutdown(Status.UNAVAILABLE);
|
transport.shutdown(Status.UNAVAILABLE);
|
||||||
|
@ -408,7 +411,8 @@ public class CallCredentialsApplyingTest {
|
||||||
transport.newStream(method, origHeaders, callOptions, tracers);
|
transport.newStream(method, origHeaders, callOptions, tracers);
|
||||||
transport.newStream(method, origHeaders, callOptions, tracers);
|
transport.newStream(method, origHeaders, callOptions, tracers);
|
||||||
transport.newStream(method, origHeaders, callOptions, tracers);
|
transport.newStream(method, origHeaders, callOptions, tracers);
|
||||||
ArgumentCaptor<CallCredentials.MetadataApplier> applierCaptor = ArgumentCaptor.forClass(null);
|
ArgumentCaptor<CallCredentials.MetadataApplier> applierCaptor =
|
||||||
|
ArgumentCaptor.forClass(CallCredentials.MetadataApplier.class);
|
||||||
verify(mockCreds, times(3)).applyRequestMetadata(any(RequestInfo.class),
|
verify(mockCreds, times(3)).applyRequestMetadata(any(RequestInfo.class),
|
||||||
same(mockExecutor), applierCaptor.capture());
|
same(mockExecutor), applierCaptor.capture());
|
||||||
applierCaptor.getAllValues().get(1).apply(headers);
|
applierCaptor.getAllValues().get(1).apply(headers);
|
||||||
|
@ -436,7 +440,8 @@ public class CallCredentialsApplyingTest {
|
||||||
DelayedStream stream = (DelayedStream) transport.newStream(
|
DelayedStream stream = (DelayedStream) transport.newStream(
|
||||||
method, origHeaders, callOptions, tracers);
|
method, origHeaders, callOptions, tracers);
|
||||||
|
|
||||||
ArgumentCaptor<CallCredentials.MetadataApplier> applierCaptor = ArgumentCaptor.forClass(null);
|
ArgumentCaptor<CallCredentials.MetadataApplier> applierCaptor =
|
||||||
|
ArgumentCaptor.forClass(CallCredentials.MetadataApplier.class);
|
||||||
verify(mockCreds).applyRequestMetadata(any(RequestInfo.class),
|
verify(mockCreds).applyRequestMetadata(any(RequestInfo.class),
|
||||||
same(mockExecutor), applierCaptor.capture());
|
same(mockExecutor), applierCaptor.capture());
|
||||||
|
|
||||||
|
|
|
@ -395,7 +395,7 @@ public class ClientCallImplTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void methodInfoDeadlinePropagatedToStream() {
|
public void methodInfoDeadlinePropagatedToStream() {
|
||||||
ArgumentCaptor<CallOptions> callOptionsCaptor = ArgumentCaptor.forClass(null);
|
ArgumentCaptor<CallOptions> callOptionsCaptor = ArgumentCaptor.forClass(CallOptions.class);
|
||||||
CallOptions callOptions = baseCallOptions.withDeadline(Deadline.after(2000, SECONDS));
|
CallOptions callOptions = baseCallOptions.withDeadline(Deadline.after(2000, SECONDS));
|
||||||
|
|
||||||
// Case: config Deadline expires later than CallOptions Deadline
|
// Case: config Deadline expires later than CallOptions Deadline
|
||||||
|
|
|
@ -132,7 +132,7 @@ public class ConfigSelectingClientCallTest {
|
||||||
method,
|
method,
|
||||||
CallOptions.DEFAULT);
|
CallOptions.DEFAULT);
|
||||||
configSelectingClientCall.start(callListener, new Metadata());
|
configSelectingClientCall.start(callListener, new Metadata());
|
||||||
ArgumentCaptor<Status> statusCaptor = ArgumentCaptor.forClass(null);
|
ArgumentCaptor<Status> statusCaptor = ArgumentCaptor.forClass(Status.class);
|
||||||
verify(callListener).onClose(statusCaptor.capture(), any(Metadata.class));
|
verify(callListener).onClose(statusCaptor.capture(), any(Metadata.class));
|
||||||
assertThat(statusCaptor.getValue().getCode()).isEqualTo(Status.Code.DEADLINE_EXCEEDED);
|
assertThat(statusCaptor.getValue().getCode()).isEqualTo(Status.Code.DEADLINE_EXCEEDED);
|
||||||
|
|
||||||
|
@ -157,7 +157,7 @@ public class ConfigSelectingClientCallTest {
|
||||||
method,
|
method,
|
||||||
CallOptions.DEFAULT);
|
CallOptions.DEFAULT);
|
||||||
configSelectingClientCall.start(callListener, new Metadata());
|
configSelectingClientCall.start(callListener, new Metadata());
|
||||||
ArgumentCaptor<Status> statusCaptor = ArgumentCaptor.forClass(null);
|
ArgumentCaptor<Status> statusCaptor = ArgumentCaptor.forClass(Status.class);
|
||||||
verify(callListener).onClose(statusCaptor.capture(), any(Metadata.class));
|
verify(callListener).onClose(statusCaptor.capture(), any(Metadata.class));
|
||||||
// ... so it should be represented as an internal error to highlight the control plane bug.
|
// ... so it should be represented as an internal error to highlight the control plane bug.
|
||||||
assertThat(statusCaptor.getValue().getCode()).isEqualTo(Status.Code.INTERNAL);
|
assertThat(statusCaptor.getValue().getCode()).isEqualTo(Status.Code.INTERNAL);
|
||||||
|
|
|
@ -108,7 +108,8 @@ public class DelayedClientCallTest {
|
||||||
callExecutor, fakeClock.getScheduledExecutorService(), Deadline.after(10, SECONDS));
|
callExecutor, fakeClock.getScheduledExecutorService(), Deadline.after(10, SECONDS));
|
||||||
delayedClientCall.start(listener, new Metadata());
|
delayedClientCall.start(listener, new Metadata());
|
||||||
callMeMaybe(delayedClientCall.setCall(mockRealCall));
|
callMeMaybe(delayedClientCall.setCall(mockRealCall));
|
||||||
ArgumentCaptor<Listener<Integer>> listenerCaptor = ArgumentCaptor.forClass(null);
|
@SuppressWarnings("unchecked")
|
||||||
|
ArgumentCaptor<Listener<Integer>> listenerCaptor = ArgumentCaptor.forClass(Listener.class);
|
||||||
verify(mockRealCall).start(listenerCaptor.capture(), any(Metadata.class));
|
verify(mockRealCall).start(listenerCaptor.capture(), any(Metadata.class));
|
||||||
Listener<Integer> realCallListener = listenerCaptor.getValue();
|
Listener<Integer> realCallListener = listenerCaptor.getValue();
|
||||||
Metadata metadata = new Metadata();
|
Metadata metadata = new Metadata();
|
||||||
|
@ -133,7 +134,8 @@ public class DelayedClientCallTest {
|
||||||
callMeMaybe(delayedClientCall.setCall(mockRealCall));
|
callMeMaybe(delayedClientCall.setCall(mockRealCall));
|
||||||
delayedClientCall.start(listener, new Metadata());
|
delayedClientCall.start(listener, new Metadata());
|
||||||
delayedClientCall.request(1);
|
delayedClientCall.request(1);
|
||||||
ArgumentCaptor<Listener<Integer>> listenerCaptor = ArgumentCaptor.forClass(null);
|
@SuppressWarnings("unchecked")
|
||||||
|
ArgumentCaptor<Listener<Integer>> listenerCaptor = ArgumentCaptor.forClass(Listener.class);
|
||||||
verify(mockRealCall).start(listenerCaptor.capture(), any(Metadata.class));
|
verify(mockRealCall).start(listenerCaptor.capture(), any(Metadata.class));
|
||||||
Listener<Integer> realCallListener = listenerCaptor.getValue();
|
Listener<Integer> realCallListener = listenerCaptor.getValue();
|
||||||
verify(mockRealCall).request(1);
|
verify(mockRealCall).request(1);
|
||||||
|
@ -150,7 +152,8 @@ public class DelayedClientCallTest {
|
||||||
Runnable r = delayedClientCall.setCall(mockRealCall);
|
Runnable r = delayedClientCall.setCall(mockRealCall);
|
||||||
assertThat(r).isNotNull();
|
assertThat(r).isNotNull();
|
||||||
r.run();
|
r.run();
|
||||||
ArgumentCaptor<Listener<Integer>> listenerCaptor = ArgumentCaptor.forClass(null);
|
@SuppressWarnings("unchecked")
|
||||||
|
ArgumentCaptor<Listener<Integer>> listenerCaptor = ArgumentCaptor.forClass(Listener.class);
|
||||||
verify(mockRealCall).start(listenerCaptor.capture(), any(Metadata.class));
|
verify(mockRealCall).start(listenerCaptor.capture(), any(Metadata.class));
|
||||||
Listener<Integer> realCallListener = listenerCaptor.getValue();
|
Listener<Integer> realCallListener = listenerCaptor.getValue();
|
||||||
verify(mockRealCall).request(1);
|
verify(mockRealCall).request(1);
|
||||||
|
@ -185,7 +188,8 @@ public class DelayedClientCallTest {
|
||||||
assertThat(r).isNotNull();
|
assertThat(r).isNotNull();
|
||||||
r.run();
|
r.run();
|
||||||
delayedClientCall.cancel("cancel", new StatusException(Status.CANCELLED));
|
delayedClientCall.cancel("cancel", new StatusException(Status.CANCELLED));
|
||||||
ArgumentCaptor<Listener<Integer>> listenerCaptor = ArgumentCaptor.forClass(null);
|
@SuppressWarnings("unchecked")
|
||||||
|
ArgumentCaptor<Listener<Integer>> listenerCaptor = ArgumentCaptor.forClass(Listener.class);
|
||||||
verify(mockRealCall).start(listenerCaptor.capture(), any(Metadata.class));
|
verify(mockRealCall).start(listenerCaptor.capture(), any(Metadata.class));
|
||||||
Listener<Integer> realCallListener = listenerCaptor.getValue();
|
Listener<Integer> realCallListener = listenerCaptor.getValue();
|
||||||
verify(mockRealCall).request(1);
|
verify(mockRealCall).request(1);
|
||||||
|
|
|
@ -325,7 +325,7 @@ public class ManagedChannelImplIdlenessTest {
|
||||||
call.start(mockCallListener, new Metadata());
|
call.start(mockCallListener, new Metadata());
|
||||||
|
|
||||||
// Verify that we have exited the idle mode
|
// Verify that we have exited the idle mode
|
||||||
ArgumentCaptor<Helper> helperCaptor = ArgumentCaptor.forClass(null);
|
ArgumentCaptor<Helper> helperCaptor = ArgumentCaptor.forClass(Helper.class);
|
||||||
verify(mockLoadBalancerProvider).newLoadBalancer(helperCaptor.capture());
|
verify(mockLoadBalancerProvider).newLoadBalancer(helperCaptor.capture());
|
||||||
deliverResolutionResult();
|
deliverResolutionResult();
|
||||||
Helper helper = helperCaptor.getValue();
|
Helper helper = helperCaptor.getValue();
|
||||||
|
@ -373,7 +373,7 @@ public class ManagedChannelImplIdlenessTest {
|
||||||
call.start(mockCallListener, new Metadata());
|
call.start(mockCallListener, new Metadata());
|
||||||
|
|
||||||
// Verify that we have exited the idle mode
|
// Verify that we have exited the idle mode
|
||||||
ArgumentCaptor<Helper> helperCaptor = ArgumentCaptor.forClass(null);
|
ArgumentCaptor<Helper> helperCaptor = ArgumentCaptor.forClass(Helper.class);
|
||||||
verify(mockLoadBalancerProvider).newLoadBalancer(helperCaptor.capture());
|
verify(mockLoadBalancerProvider).newLoadBalancer(helperCaptor.capture());
|
||||||
deliverResolutionResult();
|
deliverResolutionResult();
|
||||||
Helper helper = helperCaptor.getValue();
|
Helper helper = helperCaptor.getValue();
|
||||||
|
@ -412,7 +412,7 @@ public class ManagedChannelImplIdlenessTest {
|
||||||
public void updateSubchannelAddresses_newAddressConnects() {
|
public void updateSubchannelAddresses_newAddressConnects() {
|
||||||
ClientCall<String, Integer> call = channel.newCall(method, CallOptions.DEFAULT);
|
ClientCall<String, Integer> call = channel.newCall(method, CallOptions.DEFAULT);
|
||||||
call.start(mockCallListener, new Metadata()); // Create LB
|
call.start(mockCallListener, new Metadata()); // Create LB
|
||||||
ArgumentCaptor<Helper> helperCaptor = ArgumentCaptor.forClass(null);
|
ArgumentCaptor<Helper> helperCaptor = ArgumentCaptor.forClass(Helper.class);
|
||||||
verify(mockLoadBalancerProvider).newLoadBalancer(helperCaptor.capture());
|
verify(mockLoadBalancerProvider).newLoadBalancer(helperCaptor.capture());
|
||||||
deliverResolutionResult();
|
deliverResolutionResult();
|
||||||
Helper helper = helperCaptor.getValue();
|
Helper helper = helperCaptor.getValue();
|
||||||
|
@ -436,7 +436,7 @@ public class ManagedChannelImplIdlenessTest {
|
||||||
public void updateSubchannelAddresses_existingAddressDoesNotConnect() {
|
public void updateSubchannelAddresses_existingAddressDoesNotConnect() {
|
||||||
ClientCall<String, Integer> call = channel.newCall(method, CallOptions.DEFAULT);
|
ClientCall<String, Integer> call = channel.newCall(method, CallOptions.DEFAULT);
|
||||||
call.start(mockCallListener, new Metadata()); // Create LB
|
call.start(mockCallListener, new Metadata()); // Create LB
|
||||||
ArgumentCaptor<Helper> helperCaptor = ArgumentCaptor.forClass(null);
|
ArgumentCaptor<Helper> helperCaptor = ArgumentCaptor.forClass(Helper.class);
|
||||||
verify(mockLoadBalancerProvider).newLoadBalancer(helperCaptor.capture());
|
verify(mockLoadBalancerProvider).newLoadBalancer(helperCaptor.capture());
|
||||||
deliverResolutionResult();
|
deliverResolutionResult();
|
||||||
Helper helper = helperCaptor.getValue();
|
Helper helper = helperCaptor.getValue();
|
||||||
|
@ -461,7 +461,7 @@ public class ManagedChannelImplIdlenessTest {
|
||||||
call.start(mockCallListener, new Metadata());
|
call.start(mockCallListener, new Metadata());
|
||||||
|
|
||||||
// Verify that we have exited the idle mode
|
// Verify that we have exited the idle mode
|
||||||
ArgumentCaptor<Helper> helperCaptor = ArgumentCaptor.forClass(null);
|
ArgumentCaptor<Helper> helperCaptor = ArgumentCaptor.forClass(Helper.class);
|
||||||
verify(mockLoadBalancerProvider).newLoadBalancer(helperCaptor.capture());
|
verify(mockLoadBalancerProvider).newLoadBalancer(helperCaptor.capture());
|
||||||
Helper helper = helperCaptor.getValue();
|
Helper helper = helperCaptor.getValue();
|
||||||
deliverResolutionResult();
|
deliverResolutionResult();
|
||||||
|
@ -510,7 +510,7 @@ public class ManagedChannelImplIdlenessTest {
|
||||||
public void updateOobChannelAddresses_newAddressConnects() {
|
public void updateOobChannelAddresses_newAddressConnects() {
|
||||||
ClientCall<String, Integer> call = channel.newCall(method, CallOptions.DEFAULT);
|
ClientCall<String, Integer> call = channel.newCall(method, CallOptions.DEFAULT);
|
||||||
call.start(mockCallListener, new Metadata()); // Create LB
|
call.start(mockCallListener, new Metadata()); // Create LB
|
||||||
ArgumentCaptor<Helper> helperCaptor = ArgumentCaptor.forClass(null);
|
ArgumentCaptor<Helper> helperCaptor = ArgumentCaptor.forClass(Helper.class);
|
||||||
verify(mockLoadBalancerProvider).newLoadBalancer(helperCaptor.capture());
|
verify(mockLoadBalancerProvider).newLoadBalancer(helperCaptor.capture());
|
||||||
deliverResolutionResult();
|
deliverResolutionResult();
|
||||||
Helper helper = helperCaptor.getValue();
|
Helper helper = helperCaptor.getValue();
|
||||||
|
@ -534,7 +534,7 @@ public class ManagedChannelImplIdlenessTest {
|
||||||
public void updateOobChannelAddresses_existingAddressDoesNotConnect() {
|
public void updateOobChannelAddresses_existingAddressDoesNotConnect() {
|
||||||
ClientCall<String, Integer> call = channel.newCall(method, CallOptions.DEFAULT);
|
ClientCall<String, Integer> call = channel.newCall(method, CallOptions.DEFAULT);
|
||||||
call.start(mockCallListener, new Metadata()); // Create LB
|
call.start(mockCallListener, new Metadata()); // Create LB
|
||||||
ArgumentCaptor<Helper> helperCaptor = ArgumentCaptor.forClass(null);
|
ArgumentCaptor<Helper> helperCaptor = ArgumentCaptor.forClass(Helper.class);
|
||||||
verify(mockLoadBalancerProvider).newLoadBalancer(helperCaptor.capture());
|
verify(mockLoadBalancerProvider).newLoadBalancer(helperCaptor.capture());
|
||||||
Helper helper = helperCaptor.getValue();
|
Helper helper = helperCaptor.getValue();
|
||||||
deliverResolutionResult();
|
deliverResolutionResult();
|
||||||
|
|
|
@ -315,7 +315,7 @@ public class ManagedChannelImplTest {
|
||||||
|
|
||||||
assertEquals(numExpectedTasks, timer.numPendingTasks());
|
assertEquals(numExpectedTasks, timer.numPendingTasks());
|
||||||
|
|
||||||
ArgumentCaptor<Helper> helperCaptor = ArgumentCaptor.forClass(null);
|
ArgumentCaptor<Helper> helperCaptor = ArgumentCaptor.forClass(Helper.class);
|
||||||
verify(mockLoadBalancerProvider).newLoadBalancer(helperCaptor.capture());
|
verify(mockLoadBalancerProvider).newLoadBalancer(helperCaptor.capture());
|
||||||
helper = helperCaptor.getValue();
|
helper = helperCaptor.getValue();
|
||||||
}
|
}
|
||||||
|
@ -402,7 +402,8 @@ public class ManagedChannelImplTest {
|
||||||
Subchannel subchannel =
|
Subchannel subchannel =
|
||||||
createSubchannelSafely(helper, addressGroup, Attributes.EMPTY, subchannelStateListener);
|
createSubchannelSafely(helper, addressGroup, Attributes.EMPTY, subchannelStateListener);
|
||||||
requestConnectionSafely(helper, subchannel);
|
requestConnectionSafely(helper, subchannel);
|
||||||
ArgumentCaptor<ClientTransportOptions> transportOptionCaptor = ArgumentCaptor.forClass(null);
|
ArgumentCaptor<ClientTransportOptions> transportOptionCaptor =
|
||||||
|
ArgumentCaptor.forClass(ClientTransportOptions.class);
|
||||||
verify(mockTransportFactory)
|
verify(mockTransportFactory)
|
||||||
.newClientTransport(
|
.newClientTransport(
|
||||||
any(SocketAddress.class), transportOptionCaptor.capture(), any(ChannelLogger.class));
|
any(SocketAddress.class), transportOptionCaptor.capture(), any(ChannelLogger.class));
|
||||||
|
@ -427,7 +428,8 @@ public class ManagedChannelImplTest {
|
||||||
final Subchannel subchannel =
|
final Subchannel subchannel =
|
||||||
createSubchannelSafely(helper, addressGroup, Attributes.EMPTY, subchannelStateListener);
|
createSubchannelSafely(helper, addressGroup, Attributes.EMPTY, subchannelStateListener);
|
||||||
requestConnectionSafely(helper, subchannel);
|
requestConnectionSafely(helper, subchannel);
|
||||||
ArgumentCaptor<ClientTransportOptions> transportOptionCaptor = ArgumentCaptor.forClass(null);
|
ArgumentCaptor<ClientTransportOptions> transportOptionCaptor =
|
||||||
|
ArgumentCaptor.forClass(ClientTransportOptions.class);
|
||||||
verify(mockTransportFactory)
|
verify(mockTransportFactory)
|
||||||
.newClientTransport(
|
.newClientTransport(
|
||||||
any(SocketAddress.class), transportOptionCaptor.capture(), any(ChannelLogger.class));
|
any(SocketAddress.class), transportOptionCaptor.capture(), any(ChannelLogger.class));
|
||||||
|
@ -494,7 +496,7 @@ public class ManagedChannelImplTest {
|
||||||
ClientCall<String, Integer> call = channel.newCall(method, CallOptions.DEFAULT);
|
ClientCall<String, Integer> call = channel.newCall(method, CallOptions.DEFAULT);
|
||||||
call.start(mockCallListener, headers);
|
call.start(mockCallListener, headers);
|
||||||
|
|
||||||
ArgumentCaptor<Helper> helperCaptor = ArgumentCaptor.forClass(null);
|
ArgumentCaptor<Helper> helperCaptor = ArgumentCaptor.forClass(Helper.class);
|
||||||
verify(mockLoadBalancerProvider).newLoadBalancer(helperCaptor.capture());
|
verify(mockLoadBalancerProvider).newLoadBalancer(helperCaptor.capture());
|
||||||
helper = helperCaptor.getValue();
|
helper = helperCaptor.getValue();
|
||||||
// Make the transport available
|
// Make the transport available
|
||||||
|
@ -520,7 +522,7 @@ public class ManagedChannelImplTest {
|
||||||
updateBalancingStateSafely(helper, READY, mockPicker);
|
updateBalancingStateSafely(helper, READY, mockPicker);
|
||||||
executor.runDueTasks();
|
executor.runDueTasks();
|
||||||
|
|
||||||
ArgumentCaptor<CallOptions> callOptionsCaptor = ArgumentCaptor.forClass(null);
|
ArgumentCaptor<CallOptions> callOptionsCaptor = ArgumentCaptor.forClass(CallOptions.class);
|
||||||
verify(mockTransport).newStream(
|
verify(mockTransport).newStream(
|
||||||
same(method), same(headers), callOptionsCaptor.capture(),
|
same(method), same(headers), callOptionsCaptor.capture(),
|
||||||
ArgumentMatchers.<ClientStreamTracer[]>any());
|
ArgumentMatchers.<ClientStreamTracer[]>any());
|
||||||
|
@ -576,7 +578,7 @@ public class ManagedChannelImplTest {
|
||||||
ClientCall<String, Integer> call = channel.newCall(method, CallOptions.DEFAULT);
|
ClientCall<String, Integer> call = channel.newCall(method, CallOptions.DEFAULT);
|
||||||
call.start(mockCallListener, headers);
|
call.start(mockCallListener, headers);
|
||||||
|
|
||||||
ArgumentCaptor<Helper> helperCaptor = ArgumentCaptor.forClass(null);
|
ArgumentCaptor<Helper> helperCaptor = ArgumentCaptor.forClass(Helper.class);
|
||||||
verify(mockLoadBalancerProvider).newLoadBalancer(helperCaptor.capture());
|
verify(mockLoadBalancerProvider).newLoadBalancer(helperCaptor.capture());
|
||||||
helper = helperCaptor.getValue();
|
helper = helperCaptor.getValue();
|
||||||
// Make the transport available
|
// Make the transport available
|
||||||
|
@ -599,7 +601,7 @@ public class ManagedChannelImplTest {
|
||||||
updateBalancingStateSafely(helper, READY, mockPicker);
|
updateBalancingStateSafely(helper, READY, mockPicker);
|
||||||
executor.runDueTasks();
|
executor.runDueTasks();
|
||||||
|
|
||||||
ArgumentCaptor<CallOptions> callOptionsCaptor = ArgumentCaptor.forClass(null);
|
ArgumentCaptor<CallOptions> callOptionsCaptor = ArgumentCaptor.forClass(CallOptions.class);
|
||||||
verify(mockTransport).newStream(
|
verify(mockTransport).newStream(
|
||||||
same(method), same(headers), callOptionsCaptor.capture(),
|
same(method), same(headers), callOptionsCaptor.capture(),
|
||||||
ArgumentMatchers.<ClientStreamTracer[]>any());
|
ArgumentMatchers.<ClientStreamTracer[]>any());
|
||||||
|
@ -2270,9 +2272,10 @@ public class ManagedChannelImplTest {
|
||||||
.thenReturn(PickResult.withSubchannel(subchannel));
|
.thenReturn(PickResult.withSubchannel(subchannel));
|
||||||
updateBalancingStateSafely(helper, READY, mockPicker);
|
updateBalancingStateSafely(helper, READY, mockPicker);
|
||||||
executor.runDueTasks();
|
executor.runDueTasks();
|
||||||
ArgumentCaptor<RequestInfo> infoCaptor = ArgumentCaptor.forClass(null);
|
ArgumentCaptor<RequestInfo> infoCaptor = ArgumentCaptor.forClass(RequestInfo.class);
|
||||||
ArgumentCaptor<Executor> executorArgumentCaptor = ArgumentCaptor.forClass(null);
|
ArgumentCaptor<Executor> executorArgumentCaptor = ArgumentCaptor.forClass(Executor.class);
|
||||||
ArgumentCaptor<CallCredentials.MetadataApplier> applierCaptor = ArgumentCaptor.forClass(null);
|
ArgumentCaptor<CallCredentials.MetadataApplier> applierCaptor =
|
||||||
|
ArgumentCaptor.forClass(CallCredentials.MetadataApplier.class);
|
||||||
verify(creds).applyRequestMetadata(infoCaptor.capture(),
|
verify(creds).applyRequestMetadata(infoCaptor.capture(),
|
||||||
executorArgumentCaptor.capture(), applierCaptor.capture());
|
executorArgumentCaptor.capture(), applierCaptor.capture());
|
||||||
assertSame(offloadExecutor,
|
assertSame(offloadExecutor,
|
||||||
|
@ -2435,7 +2438,7 @@ public class ManagedChannelImplTest {
|
||||||
|
|
||||||
// call getState() with requestConnection = true
|
// call getState() with requestConnection = true
|
||||||
assertEquals(IDLE, channel.getState(true));
|
assertEquals(IDLE, channel.getState(true));
|
||||||
ArgumentCaptor<Helper> helperCaptor = ArgumentCaptor.forClass(null);
|
ArgumentCaptor<Helper> helperCaptor = ArgumentCaptor.forClass(Helper.class);
|
||||||
verify(mockLoadBalancerProvider).newLoadBalancer(helperCaptor.capture());
|
verify(mockLoadBalancerProvider).newLoadBalancer(helperCaptor.capture());
|
||||||
helper = helperCaptor.getValue();
|
helper = helperCaptor.getValue();
|
||||||
|
|
||||||
|
@ -2732,7 +2735,7 @@ public class ManagedChannelImplTest {
|
||||||
|
|
||||||
private void verifyCallListenerClosed(
|
private void verifyCallListenerClosed(
|
||||||
ClientCall.Listener<Integer> listener, Status.Code code, Throwable cause) {
|
ClientCall.Listener<Integer> listener, Status.Code code, Throwable cause) {
|
||||||
ArgumentCaptor<Status> captor = ArgumentCaptor.forClass(null);
|
ArgumentCaptor<Status> captor = ArgumentCaptor.forClass(Status.class);
|
||||||
verify(listener).onClose(captor.capture(), any(Metadata.class));
|
verify(listener).onClose(captor.capture(), any(Metadata.class));
|
||||||
Status rpcStatus = captor.getValue();
|
Status rpcStatus = captor.getValue();
|
||||||
assertEquals(code, rpcStatus.getCode());
|
assertEquals(code, rpcStatus.getCode());
|
||||||
|
@ -3343,7 +3346,7 @@ public class ManagedChannelImplTest {
|
||||||
public void channelsAndSubchannels_instrumented_state() throws Exception {
|
public void channelsAndSubchannels_instrumented_state() throws Exception {
|
||||||
createChannel();
|
createChannel();
|
||||||
|
|
||||||
ArgumentCaptor<Helper> helperCaptor = ArgumentCaptor.forClass(null);
|
ArgumentCaptor<Helper> helperCaptor = ArgumentCaptor.forClass(Helper.class);
|
||||||
verify(mockLoadBalancerProvider).newLoadBalancer(helperCaptor.capture());
|
verify(mockLoadBalancerProvider).newLoadBalancer(helperCaptor.capture());
|
||||||
helper = helperCaptor.getValue();
|
helper = helperCaptor.getValue();
|
||||||
|
|
||||||
|
|
|
@ -186,7 +186,7 @@ public class ServiceConfigErrorHandlingTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
assertEquals(numExpectedTasks, timer.numPendingTasks());
|
assertEquals(numExpectedTasks, timer.numPendingTasks());
|
||||||
ArgumentCaptor<Helper> helperCaptor = ArgumentCaptor.forClass(null);
|
ArgumentCaptor<Helper> helperCaptor = ArgumentCaptor.forClass(Helper.class);
|
||||||
verify(mockLoadBalancerProvider).newLoadBalancer(helperCaptor.capture());
|
verify(mockLoadBalancerProvider).newLoadBalancer(helperCaptor.capture());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -479,7 +479,7 @@ public class GracefulSwitchLoadBalancerTest {
|
||||||
@Test
|
@Test
|
||||||
public void transientFailureOnInitialResolutionError() {
|
public void transientFailureOnInitialResolutionError() {
|
||||||
gracefulSwitchLb.handleNameResolutionError(Status.DATA_LOSS);
|
gracefulSwitchLb.handleNameResolutionError(Status.DATA_LOSS);
|
||||||
ArgumentCaptor<SubchannelPicker> pickerCaptor = ArgumentCaptor.forClass(null);
|
ArgumentCaptor<SubchannelPicker> pickerCaptor = ArgumentCaptor.forClass(SubchannelPicker.class);
|
||||||
verify(mockHelper).updateBalancingState(eq(TRANSIENT_FAILURE), pickerCaptor.capture());
|
verify(mockHelper).updateBalancingState(eq(TRANSIENT_FAILURE), pickerCaptor.capture());
|
||||||
SubchannelPicker picker = pickerCaptor.getValue();
|
SubchannelPicker picker = pickerCaptor.getValue();
|
||||||
assertThat(picker.pickSubchannel(mock(PickSubchannelArgs.class)).getStatus().getCode())
|
assertThat(picker.pickSubchannel(mock(PickSubchannelArgs.class)).getStatus().getCode())
|
||||||
|
|
|
@ -300,7 +300,7 @@ public class RetryTest {
|
||||||
Status.UNAVAILABLE.withDescription("2nd attempt failed"),
|
Status.UNAVAILABLE.withDescription("2nd attempt failed"),
|
||||||
new Metadata());
|
new Metadata());
|
||||||
// no more retry
|
// no more retry
|
||||||
ArgumentCaptor<Status> statusCaptor = ArgumentCaptor.forClass(null);
|
ArgumentCaptor<Status> statusCaptor = ArgumentCaptor.forClass(Status.class);
|
||||||
verify(mockCallListener, timeout(5000)).onClose(statusCaptor.capture(), any(Metadata.class));
|
verify(mockCallListener, timeout(5000)).onClose(statusCaptor.capture(), any(Metadata.class));
|
||||||
assertThat(statusCaptor.getValue().getDescription()).contains("2nd attempt failed");
|
assertThat(statusCaptor.getValue().getDescription()).contains("2nd attempt failed");
|
||||||
}
|
}
|
||||||
|
|
|
@ -179,7 +179,8 @@ public class WeightedTargetLoadBalancerTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void handleResolvedAddresses() {
|
public void handleResolvedAddresses() {
|
||||||
ArgumentCaptor<ResolvedAddresses> resolvedAddressesCaptor = ArgumentCaptor.forClass(null);
|
ArgumentCaptor<ResolvedAddresses> resolvedAddressesCaptor =
|
||||||
|
ArgumentCaptor.forClass(ResolvedAddresses.class);
|
||||||
Attributes.Key<Object> fakeKey = Attributes.Key.create("fake_key");
|
Attributes.Key<Object> fakeKey = Attributes.Key.create("fake_key");
|
||||||
Object fakeValue = new Object();
|
Object fakeValue = new Object();
|
||||||
|
|
||||||
|
@ -260,8 +261,8 @@ public class WeightedTargetLoadBalancerTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void handleNameResolutionError() {
|
public void handleNameResolutionError() {
|
||||||
ArgumentCaptor<SubchannelPicker> pickerCaptor = ArgumentCaptor.forClass(null);
|
ArgumentCaptor<SubchannelPicker> pickerCaptor = ArgumentCaptor.forClass(SubchannelPicker.class);
|
||||||
ArgumentCaptor<Status> statusCaptor = ArgumentCaptor.forClass(null);
|
ArgumentCaptor<Status> statusCaptor = ArgumentCaptor.forClass(Status.class);
|
||||||
|
|
||||||
// Error before any child balancer created.
|
// Error before any child balancer created.
|
||||||
weightedTargetLb.handleNameResolutionError(Status.DATA_LOSS);
|
weightedTargetLb.handleNameResolutionError(Status.DATA_LOSS);
|
||||||
|
@ -326,7 +327,7 @@ public class WeightedTargetLoadBalancerTest {
|
||||||
new ErrorPicker(Status.DATA_LOSS),
|
new ErrorPicker(Status.DATA_LOSS),
|
||||||
new ErrorPicker(Status.DATA_LOSS)
|
new ErrorPicker(Status.DATA_LOSS)
|
||||||
};
|
};
|
||||||
ArgumentCaptor<SubchannelPicker> pickerCaptor = ArgumentCaptor.forClass(null);
|
ArgumentCaptor<SubchannelPicker> pickerCaptor = ArgumentCaptor.forClass(SubchannelPicker.class);
|
||||||
|
|
||||||
// One child balancer goes to TRANSIENT_FAILURE.
|
// One child balancer goes to TRANSIENT_FAILURE.
|
||||||
childHelpers.get(1).updateBalancingState(TRANSIENT_FAILURE, failurePickers[1]);
|
childHelpers.get(1).updateBalancingState(TRANSIENT_FAILURE, failurePickers[1]);
|
||||||
|
|
|
@ -103,7 +103,7 @@ public class XdsServerBuilderTest {
|
||||||
assertThat(socketAddress.getPort()).isGreaterThan(-1);
|
assertThat(socketAddress.getPort()).isGreaterThan(-1);
|
||||||
if (mockXdsServingStatusListener != null) {
|
if (mockXdsServingStatusListener != null) {
|
||||||
if (notServingStatus != null) {
|
if (notServingStatus != null) {
|
||||||
ArgumentCaptor<Throwable> argCaptor = ArgumentCaptor.forClass(null);
|
ArgumentCaptor<Throwable> argCaptor = ArgumentCaptor.forClass(Throwable.class);
|
||||||
verify(mockXdsServingStatusListener, times(1)).onNotServing(argCaptor.capture());
|
verify(mockXdsServingStatusListener, times(1)).onNotServing(argCaptor.capture());
|
||||||
Throwable throwable = argCaptor.getValue();
|
Throwable throwable = argCaptor.getValue();
|
||||||
assertThat(throwable).isInstanceOf(StatusException.class);
|
assertThat(throwable).isInstanceOf(StatusException.class);
|
||||||
|
|
|
@ -80,7 +80,8 @@ public class SslContextProviderSupplierTest {
|
||||||
.findOrCreateClientSslContextProvider(eq(upstreamTlsContext));
|
.findOrCreateClientSslContextProvider(eq(upstreamTlsContext));
|
||||||
verify(mockTlsContextManager, times(0))
|
verify(mockTlsContextManager, times(0))
|
||||||
.releaseClientSslContextProvider(any(SslContextProvider.class));
|
.releaseClientSslContextProvider(any(SslContextProvider.class));
|
||||||
ArgumentCaptor<SslContextProvider.Callback> callbackCaptor = ArgumentCaptor.forClass(null);
|
ArgumentCaptor<SslContextProvider.Callback> callbackCaptor =
|
||||||
|
ArgumentCaptor.forClass(SslContextProvider.Callback.class);
|
||||||
verify(mockSslContextProvider, times(1)).addCallback(callbackCaptor.capture());
|
verify(mockSslContextProvider, times(1)).addCallback(callbackCaptor.capture());
|
||||||
SslContextProvider.Callback capturedCallback = callbackCaptor.getValue();
|
SslContextProvider.Callback capturedCallback = callbackCaptor.getValue();
|
||||||
assertThat(capturedCallback).isNotNull();
|
assertThat(capturedCallback).isNotNull();
|
||||||
|
@ -99,7 +100,8 @@ public class SslContextProviderSupplierTest {
|
||||||
public void get_onException() {
|
public void get_onException() {
|
||||||
prepareSupplier();
|
prepareSupplier();
|
||||||
callUpdateSslContext();
|
callUpdateSslContext();
|
||||||
ArgumentCaptor<SslContextProvider.Callback> callbackCaptor = ArgumentCaptor.forClass(null);
|
ArgumentCaptor<SslContextProvider.Callback> callbackCaptor =
|
||||||
|
ArgumentCaptor.forClass(SslContextProvider.Callback.class);
|
||||||
verify(mockSslContextProvider, times(1)).addCallback(callbackCaptor.capture());
|
verify(mockSslContextProvider, times(1)).addCallback(callbackCaptor.capture());
|
||||||
SslContextProvider.Callback capturedCallback = callbackCaptor.getValue();
|
SslContextProvider.Callback capturedCallback = callbackCaptor.getValue();
|
||||||
assertThat(capturedCallback).isNotNull();
|
assertThat(capturedCallback).isNotNull();
|
||||||
|
|
|
@ -352,7 +352,7 @@ public class FileWatcherCertificateProviderTest {
|
||||||
if (code == null && throwableType == null && causeMessages == null) {
|
if (code == null && throwableType == null && causeMessages == null) {
|
||||||
verify(mockWatcher, never()).onError(any(Status.class));
|
verify(mockWatcher, never()).onError(any(Status.class));
|
||||||
} else {
|
} else {
|
||||||
ArgumentCaptor<Status> statusCaptor = ArgumentCaptor.forClass(null);
|
ArgumentCaptor<Status> statusCaptor = ArgumentCaptor.forClass(Status.class);
|
||||||
verify(mockWatcher, times(1)).onError(statusCaptor.capture());
|
verify(mockWatcher, times(1)).onError(statusCaptor.capture());
|
||||||
Status status = statusCaptor.getValue();
|
Status status = statusCaptor.getValue();
|
||||||
assertThat(status.getCode()).isEqualTo(code);
|
assertThat(status.getCode()).isEqualTo(code);
|
||||||
|
@ -375,7 +375,8 @@ public class FileWatcherCertificateProviderTest {
|
||||||
private void verifyWatcherUpdates(String certPemFile, String rootPemFile)
|
private void verifyWatcherUpdates(String certPemFile, String rootPemFile)
|
||||||
throws IOException, CertificateException {
|
throws IOException, CertificateException {
|
||||||
if (certPemFile != null) {
|
if (certPemFile != null) {
|
||||||
ArgumentCaptor<List<X509Certificate>> certChainCaptor = ArgumentCaptor.forClass(null);
|
@SuppressWarnings("unchecked")
|
||||||
|
ArgumentCaptor<List<X509Certificate>> certChainCaptor = ArgumentCaptor.forClass(List.class);
|
||||||
verify(mockWatcher, times(1))
|
verify(mockWatcher, times(1))
|
||||||
.updateCertificate(any(PrivateKey.class), certChainCaptor.capture());
|
.updateCertificate(any(PrivateKey.class), certChainCaptor.capture());
|
||||||
List<X509Certificate> certChain = certChainCaptor.getValue();
|
List<X509Certificate> certChain = certChainCaptor.getValue();
|
||||||
|
@ -387,7 +388,8 @@ public class FileWatcherCertificateProviderTest {
|
||||||
.updateCertificate(any(PrivateKey.class), ArgumentMatchers.<X509Certificate>anyList());
|
.updateCertificate(any(PrivateKey.class), ArgumentMatchers.<X509Certificate>anyList());
|
||||||
}
|
}
|
||||||
if (rootPemFile != null) {
|
if (rootPemFile != null) {
|
||||||
ArgumentCaptor<List<X509Certificate>> rootsCaptor = ArgumentCaptor.forClass(null);
|
@SuppressWarnings("unchecked")
|
||||||
|
ArgumentCaptor<List<X509Certificate>> rootsCaptor = ArgumentCaptor.forClass(List.class);
|
||||||
verify(mockWatcher, times(1)).updateTrustedRoots(rootsCaptor.capture());
|
verify(mockWatcher, times(1)).updateTrustedRoots(rootsCaptor.capture());
|
||||||
List<X509Certificate> roots = rootsCaptor.getValue();
|
List<X509Certificate> roots = rootsCaptor.getValue();
|
||||||
assertThat(roots).hasSize(1);
|
assertThat(roots).hasSize(1);
|
||||||
|
|
|
@ -239,7 +239,8 @@ public class OrcaOobUtilTest {
|
||||||
|
|
||||||
// Calling createSubchannel() on orcaHelper correctly passes augmented CreateSubchannelArgs
|
// Calling createSubchannel() on orcaHelper correctly passes augmented CreateSubchannelArgs
|
||||||
// to origHelper.
|
// to origHelper.
|
||||||
ArgumentCaptor<CreateSubchannelArgs> createArgsCaptor = ArgumentCaptor.forClass(null);
|
ArgumentCaptor<CreateSubchannelArgs> createArgsCaptor =
|
||||||
|
ArgumentCaptor.forClass(CreateSubchannelArgs.class);
|
||||||
for (int i = 0; i < NUM_SUBCHANNELS; i++) {
|
for (int i = 0; i < NUM_SUBCHANNELS; i++) {
|
||||||
String subchannelAttrValue = "eag attr " + i;
|
String subchannelAttrValue = "eag attr " + i;
|
||||||
Attributes attrs =
|
Attributes attrs =
|
||||||
|
@ -322,7 +323,8 @@ public class OrcaOobUtilTest {
|
||||||
|
|
||||||
// Calling createSubchannel() on child helper correctly passes augmented CreateSubchannelArgs
|
// Calling createSubchannel() on child helper correctly passes augmented CreateSubchannelArgs
|
||||||
// to origHelper.
|
// to origHelper.
|
||||||
ArgumentCaptor<CreateSubchannelArgs> createArgsCaptor = ArgumentCaptor.forClass(null);
|
ArgumentCaptor<CreateSubchannelArgs> createArgsCaptor =
|
||||||
|
ArgumentCaptor.forClass(CreateSubchannelArgs.class);
|
||||||
for (int i = 0; i < NUM_SUBCHANNELS; i++) {
|
for (int i = 0; i < NUM_SUBCHANNELS; i++) {
|
||||||
String subchannelAttrValue = "eag attr " + i;
|
String subchannelAttrValue = "eag attr " + i;
|
||||||
Attributes attrs =
|
Attributes attrs =
|
||||||
|
@ -667,8 +669,7 @@ public class OrcaOobUtilTest {
|
||||||
orcaServiceImps[0].calls.peek().responseObserver.onNext(report);
|
orcaServiceImps[0].calls.peek().responseObserver.onNext(report);
|
||||||
assertLog(subchannels[0].logs, "DEBUG: Received an ORCA report: " + report);
|
assertLog(subchannels[0].logs, "DEBUG: Received an ORCA report: " + report);
|
||||||
// Only parent helper's listener receives the report.
|
// Only parent helper's listener receives the report.
|
||||||
ArgumentCaptor<MetricReport> parentReportCaptor =
|
ArgumentCaptor<MetricReport> parentReportCaptor = ArgumentCaptor.forClass(MetricReport.class);
|
||||||
ArgumentCaptor.forClass(null);
|
|
||||||
verify(mockOrcaListener1).onLoadReport(parentReportCaptor.capture());
|
verify(mockOrcaListener1).onLoadReport(parentReportCaptor.capture());
|
||||||
assertThat(OrcaPerRequestUtilTest.reportEqual(parentReportCaptor.getValue(),
|
assertThat(OrcaPerRequestUtilTest.reportEqual(parentReportCaptor.getValue(),
|
||||||
OrcaPerRequestUtil.fromOrcaLoadReport(report))).isTrue();
|
OrcaPerRequestUtil.fromOrcaLoadReport(report))).isTrue();
|
||||||
|
@ -679,8 +680,7 @@ public class OrcaOobUtilTest {
|
||||||
orcaServiceImps[0].calls.peek().responseObserver.onNext(report);
|
orcaServiceImps[0].calls.peek().responseObserver.onNext(report);
|
||||||
assertLog(subchannels[0].logs, "DEBUG: Received an ORCA report: " + report);
|
assertLog(subchannels[0].logs, "DEBUG: Received an ORCA report: " + report);
|
||||||
// Both helper receives the same report instance.
|
// Both helper receives the same report instance.
|
||||||
ArgumentCaptor<MetricReport> childReportCaptor =
|
ArgumentCaptor<MetricReport> childReportCaptor = ArgumentCaptor.forClass(MetricReport.class);
|
||||||
ArgumentCaptor.forClass(null);
|
|
||||||
verify(mockOrcaListener1, times(2))
|
verify(mockOrcaListener1, times(2))
|
||||||
.onLoadReport(parentReportCaptor.capture());
|
.onLoadReport(parentReportCaptor.capture());
|
||||||
verify(mockOrcaListener2)
|
verify(mockOrcaListener2)
|
||||||
|
|
|
@ -83,7 +83,8 @@ public class OrcaPerRequestUtilTest {
|
||||||
OrcaPerRequestUtil.getInstance()
|
OrcaPerRequestUtil.getInstance()
|
||||||
.newOrcaClientStreamTracerFactory(fakeDelegateFactory, orcaListener1);
|
.newOrcaClientStreamTracerFactory(fakeDelegateFactory, orcaListener1);
|
||||||
ClientStreamTracer tracer = factory.newClientStreamTracer(STREAM_INFO, new Metadata());
|
ClientStreamTracer tracer = factory.newClientStreamTracer(STREAM_INFO, new Metadata());
|
||||||
ArgumentCaptor<ClientStreamTracer.StreamInfo> streamInfoCaptor = ArgumentCaptor.forClass(null);
|
ArgumentCaptor<ClientStreamTracer.StreamInfo> streamInfoCaptor =
|
||||||
|
ArgumentCaptor.forClass(ClientStreamTracer.StreamInfo.class);
|
||||||
verify(fakeDelegateFactory)
|
verify(fakeDelegateFactory)
|
||||||
.newClientStreamTracer(streamInfoCaptor.capture(), any(Metadata.class));
|
.newClientStreamTracer(streamInfoCaptor.capture(), any(Metadata.class));
|
||||||
ClientStreamTracer.StreamInfo capturedInfo = streamInfoCaptor.getValue();
|
ClientStreamTracer.StreamInfo capturedInfo = streamInfoCaptor.getValue();
|
||||||
|
@ -99,8 +100,7 @@ public class OrcaPerRequestUtilTest {
|
||||||
OrcaReportingTracerFactory.ORCA_ENDPOINT_LOAD_METRICS_KEY,
|
OrcaReportingTracerFactory.ORCA_ENDPOINT_LOAD_METRICS_KEY,
|
||||||
OrcaLoadReport.getDefaultInstance());
|
OrcaLoadReport.getDefaultInstance());
|
||||||
tracer.inboundTrailers(trailer);
|
tracer.inboundTrailers(trailer);
|
||||||
ArgumentCaptor<MetricReport> reportCaptor =
|
ArgumentCaptor<MetricReport> reportCaptor = ArgumentCaptor.forClass(MetricReport.class);
|
||||||
ArgumentCaptor.forClass(null);
|
|
||||||
verify(orcaListener1).onLoadReport(reportCaptor.capture());
|
verify(orcaListener1).onLoadReport(reportCaptor.capture());
|
||||||
assertThat(reportEqual(reportCaptor.getValue(),
|
assertThat(reportEqual(reportCaptor.getValue(),
|
||||||
OrcaPerRequestUtil.fromOrcaLoadReport(OrcaLoadReport.getDefaultInstance()))).isTrue();
|
OrcaPerRequestUtil.fromOrcaLoadReport(OrcaLoadReport.getDefaultInstance()))).isTrue();
|
||||||
|
@ -144,7 +144,8 @@ public class OrcaPerRequestUtilTest {
|
||||||
// Child factory will augment the StreamInfo and pass it to the parent factory.
|
// Child factory will augment the StreamInfo and pass it to the parent factory.
|
||||||
ClientStreamTracer childTracer =
|
ClientStreamTracer childTracer =
|
||||||
childFactory.newClientStreamTracer(STREAM_INFO, new Metadata());
|
childFactory.newClientStreamTracer(STREAM_INFO, new Metadata());
|
||||||
ArgumentCaptor<ClientStreamTracer.StreamInfo> streamInfoCaptor = ArgumentCaptor.forClass(null);
|
ArgumentCaptor<ClientStreamTracer.StreamInfo> streamInfoCaptor =
|
||||||
|
ArgumentCaptor.forClass(ClientStreamTracer.StreamInfo.class);
|
||||||
verify(parentFactory).newClientStreamTracer(streamInfoCaptor.capture(), any(Metadata.class));
|
verify(parentFactory).newClientStreamTracer(streamInfoCaptor.capture(), any(Metadata.class));
|
||||||
ClientStreamTracer.StreamInfo parentStreamInfo = streamInfoCaptor.getValue();
|
ClientStreamTracer.StreamInfo parentStreamInfo = streamInfoCaptor.getValue();
|
||||||
assertThat(parentStreamInfo).isNotEqualTo(STREAM_INFO);
|
assertThat(parentStreamInfo).isNotEqualTo(STREAM_INFO);
|
||||||
|
@ -162,10 +163,8 @@ public class OrcaPerRequestUtilTest {
|
||||||
OrcaReportingTracerFactory.ORCA_ENDPOINT_LOAD_METRICS_KEY,
|
OrcaReportingTracerFactory.ORCA_ENDPOINT_LOAD_METRICS_KEY,
|
||||||
OrcaLoadReport.getDefaultInstance());
|
OrcaLoadReport.getDefaultInstance());
|
||||||
childTracer.inboundTrailers(trailer);
|
childTracer.inboundTrailers(trailer);
|
||||||
ArgumentCaptor<MetricReport> parentReportCap =
|
ArgumentCaptor<MetricReport> parentReportCap = ArgumentCaptor.forClass(MetricReport.class);
|
||||||
ArgumentCaptor.forClass(null);
|
ArgumentCaptor<MetricReport> childReportCap = ArgumentCaptor.forClass(MetricReport.class);
|
||||||
ArgumentCaptor<MetricReport> childReportCap =
|
|
||||||
ArgumentCaptor.forClass(null);
|
|
||||||
verify(orcaListener1).onLoadReport(parentReportCap.capture());
|
verify(orcaListener1).onLoadReport(parentReportCap.capture());
|
||||||
verify(orcaListener2).onLoadReport(childReportCap.capture());
|
verify(orcaListener2).onLoadReport(childReportCap.capture());
|
||||||
assertThat(reportEqual(parentReportCap.getValue(),
|
assertThat(reportEqual(parentReportCap.getValue(),
|
||||||
|
|
|
@ -132,7 +132,7 @@ public class OrcaServiceImplTest {
|
||||||
oobServer.shutdownNow();
|
oobServer.shutdownNow();
|
||||||
assertThat(fakeClock.forwardTime(1, TimeUnit.SECONDS)).isEqualTo(0);
|
assertThat(fakeClock.forwardTime(1, TimeUnit.SECONDS)).isEqualTo(0);
|
||||||
assertThat(((OrcaServiceImpl)orcaServiceImpl).clientCount.get()).isEqualTo(0);
|
assertThat(((OrcaServiceImpl)orcaServiceImpl).clientCount.get()).isEqualTo(0);
|
||||||
ArgumentCaptor<Status> callCloseCaptor = ArgumentCaptor.forClass(null);
|
ArgumentCaptor<Status> callCloseCaptor = ArgumentCaptor.forClass(Status.class);
|
||||||
verify(listener).onClose(callCloseCaptor.capture(), any());
|
verify(listener).onClose(callCloseCaptor.capture(), any());
|
||||||
assertThat(callCloseCaptor.getValue().getCode()).isEqualTo(Status.Code.UNAVAILABLE);
|
assertThat(callCloseCaptor.getValue().getCode()).isEqualTo(Status.Code.UNAVAILABLE);
|
||||||
}
|
}
|
||||||
|
@ -232,7 +232,7 @@ public class OrcaServiceImplTest {
|
||||||
channel.shutdownNow();
|
channel.shutdownNow();
|
||||||
assertThat(fakeClock.forwardTime(1, TimeUnit.SECONDS)).isEqualTo(0);
|
assertThat(fakeClock.forwardTime(1, TimeUnit.SECONDS)).isEqualTo(0);
|
||||||
assertThat(((OrcaServiceImpl)orcaServiceImpl).clientCount.get()).isEqualTo(0);
|
assertThat(((OrcaServiceImpl)orcaServiceImpl).clientCount.get()).isEqualTo(0);
|
||||||
ArgumentCaptor<Status> callCloseCaptor = ArgumentCaptor.forClass(null);
|
ArgumentCaptor<Status> callCloseCaptor = ArgumentCaptor.forClass(Status.class);
|
||||||
verify(listener, times(2)).onClose(callCloseCaptor.capture(), any());
|
verify(listener, times(2)).onClose(callCloseCaptor.capture(), any());
|
||||||
assertThat(callCloseCaptor.getValue().getCode()).isEqualTo(Status.Code.UNAVAILABLE);
|
assertThat(callCloseCaptor.getValue().getCode()).isEqualTo(Status.Code.UNAVAILABLE);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue