use of com.alibaba.nacos.api.naming.remote.response.InstanceResponse in project nacos by alibaba.
the class NamingGrpcClientProxyTest method setUp.
@Before
public void setUp() throws NacosException, NoSuchFieldException, IllegalAccessException {
List<String> serverList = Stream.of(ORIGIN_SERVER, "anotherServer").collect(Collectors.toList());
when(factory.getServerList()).thenReturn(serverList);
when(factory.genNextServer()).thenReturn(ORIGIN_SERVER);
prop = new Properties();
client = new NamingGrpcClientProxy(NAMESPACE_ID, proxy, factory, prop, holder);
Field rpcClientField = NamingGrpcClientProxy.class.getDeclaredField("rpcClient");
rpcClientField.setAccessible(true);
rpcClientField.set(client, this.rpcClient);
response = new InstanceResponse();
when(this.rpcClient.request(any())).thenReturn(response);
instance = new Instance();
instance.setServiceName(SERVICE_NAME);
instance.setIp("1.1.1.1");
instance.setPort(1111);
}
Aggregations