mirror of https://github.com/grpc/grpc-java.git
api: patch CreateSubchannelArgs toString() with customOptions (#5646)
This commit is contained in:
parent
6a32c508b8
commit
405d8c3865
|
|
@ -23,6 +23,7 @@ import com.google.common.base.MoreObjects;
|
||||||
import com.google.common.base.Objects;
|
import com.google.common.base.Objects;
|
||||||
import com.google.common.base.Preconditions;
|
import com.google.common.base.Preconditions;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Arrays;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
@ -738,6 +739,7 @@ public abstract class LoadBalancer {
|
||||||
.add("addrs", addrs)
|
.add("addrs", addrs)
|
||||||
.add("attrs", attrs)
|
.add("attrs", attrs)
|
||||||
.add("listener", stateListener)
|
.add("listener", stateListener)
|
||||||
|
.add("customOptions", Arrays.deepToString(customOptions))
|
||||||
.toString();
|
.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -268,6 +268,22 @@ public class LoadBalancerTest {
|
||||||
assertThat(args.getOption(testKey)).isEqualTo(testValue2);
|
assertThat(args.getOption(testKey)).isEqualTo(testValue2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void createSubchannelArgs_toString() {
|
||||||
|
CreateSubchannelArgs.Key<String> testKey = CreateSubchannelArgs.Key.create("test-key");
|
||||||
|
CreateSubchannelArgs args = CreateSubchannelArgs.newBuilder()
|
||||||
|
.setAddresses(eag)
|
||||||
|
.setAttributes(attrs)
|
||||||
|
.setStateListener(subchannelStateListener)
|
||||||
|
.addOption(testKey, "test-value")
|
||||||
|
.build();
|
||||||
|
String str = args.toString();
|
||||||
|
assertThat(str).contains("addrs=");
|
||||||
|
assertThat(str).contains("attrs=");
|
||||||
|
assertThat(str).contains("listener=");
|
||||||
|
assertThat(str).contains("customOptions=");
|
||||||
|
}
|
||||||
|
|
||||||
@Deprecated
|
@Deprecated
|
||||||
@Test
|
@Test
|
||||||
public void handleResolvedAddressGroups_delegatesToHandleResolvedAddresses() {
|
public void handleResolvedAddressGroups_delegatesToHandleResolvedAddresses() {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue