use of com.linkedin.d2.balancer.ServiceUnavailableException in project rest.li by linkedin.
the class TestScatterGather method testBuildSGEntityRequests.
public static void testBuildSGEntityRequests(int endPointsNum, int partitionNum, RootBuilderWrapper<Long, Greeting> builders) throws URISyntaxException, RestException, ServiceUnavailableException {
final int NUM_ENDPOINTS = endPointsNum;
ConsistentHashKeyMapper mapper;
if (partitionNum > 0) {
mapper = getKeyToHostMapper(endPointsNum, partitionNum);
} else {
mapper = getKeyToHostMapper(endPointsNum);
}
ScatterGatherBuilder<Greeting> sg = new ScatterGatherBuilder<Greeting>(mapper);
final int NUM_IDS = 100;
Long[] ids = generateIds(NUM_IDS);
Map<Long, Greeting> updates = generateUpdates(ids);
testBuildSGGetEntityRequests(NUM_ENDPOINTS, sg, ids);
testBuildSGDeleteRequests(NUM_ENDPOINTS, sg, ids, builders);
testBuildSGUpdateRequests(NUM_ENDPOINTS, sg, updates, builders);
}
Aggregations