use of com.linkedin.darkcluster.impl.DefaultDarkClusterDispatcher in project rest.li by linkedin.
the class TestBaseDarkClusterDispatcher method testBaseDispatcher.
@Test(dataProvider = "provideKeys")
public void testBaseDispatcher(int numDuplicates, boolean failRequests, boolean requestSent, int expectedSuccessCount, int expectedRequestCount, int expectedExceptionCount) {
DarkClusterDispatcher darkClusterDispatcher = new DefaultDarkClusterDispatcher(new MockClient(failRequests));
BaseDarkClusterDispatcherImpl baseDispatcher = new BaseDarkClusterDispatcherImpl(DARK_CLUSTER_NAME, darkClusterDispatcher, new DoNothingNotifier(), new CountingVerifierManager());
RestRequest dummyRestRequest = new RestRequestBuilder(URI.create("foo")).build();
boolean result = baseDispatcher.sendRequest(dummyRestRequest, dummyRestRequest, new RequestContext(), numDuplicates);
Assert.assertEquals(result, requestSent, "expected: " + requestSent);
Assert.assertEquals(baseDispatcher.getSuccessCount(), expectedSuccessCount, "unexpected successCount");
Assert.assertEquals(baseDispatcher.getRequestCount(), expectedRequestCount, "unexpected requestCount");
Assert.assertEquals(baseDispatcher.getExceptionCount(), expectedExceptionCount, "unexpected exceptionCount");
}
Aggregations