use of com.linkedin.d2.balancer.util.DelegatingFacilities in project rest.li by linkedin.
the class DynamicClientTest method testClient.
@Test(groups = { "small", "back-end" }, dataProvider = "restOverStreamSwitch")
@SuppressWarnings("deprecation")
public void testClient(boolean restOverStream) throws URISyntaxException {
TestLoadBalancer balancer = new TestLoadBalancer(false);
DirectoryProvider dirProvider = new TestDirectoryProvider();
KeyMapperProvider keyMapperProvider = new TestKeyMapperProvider();
ClientFactoryProvider clientFactoryProvider = new TestClientFactoryProvider();
Facilities facilities = new DelegatingFacilities(dirProvider, keyMapperProvider, clientFactoryProvider);
DynamicClient client = new DynamicClient(balancer, facilities, restOverStream);
URI uri = URI.create("d2://test");
RestRequest restRequest = new RestRequestBuilder(uri).build();
TestCallback<RestResponse> restCallback = new TestCallback<RestResponse>();
client.restRequest(restRequest, restCallback);
assertNull(restCallback.e);
assertNotNull(restCallback.t);
Facilities myFacilities = client.getFacilities();
assertNotNull(facilities, "facilities should not be null");
}
Aggregations