}
setFailureDetector(stores);
routedStoreThreadPool = Executors.newFixedThreadPool(3);
TimeoutConfig timeoutConfig = new TimeoutConfig(1500, true);
// This means, the getall will only succeed on two of the nodes
timeoutConfig.setOperationTimeout(VoldemortOpCode.GET_ALL_OP_CODE, 250);
RoutedStoreFactory routedStoreFactory = createFactory();
List<Zone> zones = Lists.newArrayList();
for(int i = 0; i < 3; i++) {
LinkedList<Integer> zoneProximityList = Lists.newLinkedList();
Set<Integer> zoneIds = Sets.newHashSet(0, 1, 2);
zoneIds.remove(i);
zoneProximityList.addAll(zoneIds);
zones.add(new Zone(i, zoneProximityList));
}
RoutedStore routedStore = routedStoreFactory.create(new Cluster("test", nodes, zones),
definition,
stores,
failureDetector,
createConfig(timeoutConfig));
/* do some puts so we have some data to test getalls */
Map<ByteArray, byte[]> expectedValues = Maps.newHashMap();
for(byte i = 1; i < 11; ++i) {
ByteArray key = new ByteArray(new byte[] { i });
byte[] value = new byte[] { (byte) (i + 50) };
routedStore.put(key, Versioned.value(value), null);
expectedValues.put(key, value);
}
/* 1. positive test; if partial is on, should get something back */
Map<ByteArray, List<Versioned<byte[]>>> all = routedStore.getAll(expectedValues.keySet(),
null);
assert (expectedValues.size() > all.size());
/* 2. negative test; if partial is off, should fail the whole operation */
timeoutConfig.setPartialGetAllAllowed(false);
try {
all = routedStore.getAll(expectedValues.keySet(), null);
fail("Should have failed");
} catch(Exception e) {
// Expected