use of com.linkedin.d2.balancer.clients.RewriteLoadBalancerClient in project rest.li by linkedin.
the class RewriteLoadBalancerClientTestStreamRequest method testPathAppend.
@Test
public void testPathAppend() {
URI uri = URI.create("http://test.linkedin.com:9876/test");
String serviceName = "HistoryService";
TestClient wrappedClient = new TestClient();
RewriteLoadBalancerClient client = new RewriteLoadBalancerClient(serviceName, uri, wrappedClient);
assertEquals(client.getUri(), uri);
assertEquals(client.getServiceName(), serviceName);
StreamRequest streamRequest;
Map<String, String> restWireAttrs = new HashMap<>();
TestTransportCallback<StreamResponse> restCallback = new TestTransportCallback<>();
streamRequest = getRequest("d2://HistoryService");
client.streamRequest(streamRequest, new RequestContext(), restWireAttrs, restCallback);
checkRewrite(wrappedClient, streamRequest, restCallback, "http://test.linkedin.com:9876/test");
streamRequest = getRequest("d2://HistoryService/");
client.streamRequest(streamRequest, new RequestContext(), restWireAttrs, restCallback);
checkRewrite(wrappedClient, streamRequest, restCallback, "http://test.linkedin.com:9876/test/");
streamRequest = getRequest("d2://HistoryService//");
client.streamRequest(streamRequest, new RequestContext(), restWireAttrs, restCallback);
checkRewrite(wrappedClient, streamRequest, restCallback, "http://test.linkedin.com:9876/test//");
streamRequest = getRequest("d2://HistoryService/foo");
client.streamRequest(streamRequest, new RequestContext(), restWireAttrs, restCallback);
checkRewrite(wrappedClient, streamRequest, restCallback, "http://test.linkedin.com:9876/test/foo");
streamRequest = getRequest("d2://HistoryService/foo/");
client.streamRequest(streamRequest, new RequestContext(), restWireAttrs, restCallback);
checkRewrite(wrappedClient, streamRequest, restCallback, "http://test.linkedin.com:9876/test/foo/");
}
Aggregations