use of com.linkedin.d2.balancer.util.partitions.RangeBasedPartitionAccessor in project rest.li by linkedin.
the class URIMapperTestUtil method createRangeBasedPartitionInfoProvider.
/**
* Create a mock PartitionInfoProvider that returns {@link RangeBasedPartitionAccessor} for testing
*/
public static PartitionInfoProvider createRangeBasedPartitionInfoProvider(int partitionCount) throws ServiceUnavailableException {
PartitionInfoProvider infoProvider = Mockito.mock(PartitionInfoProvider.class);
RangeBasedPartitionProperties properties = new RangeBasedPartitionProperties(PARTITION_KEY_REGEX, 0, 1, partitionCount);
RangeBasedPartitionAccessor accessor = new RangeBasedPartitionAccessor(properties);
Mockito.when(infoProvider.getPartitionAccessor(anyObject())).thenReturn(accessor);
return infoProvider;
}
Aggregations