redirectingStoreNode2.get(primaryKey1, null).size() > 0);
// 2. Test that put is still issued on top of version on remote version.
// But once moved over, can be issued just on local version.
ByteArray secondaryKey1 = testSecondaryKeys.get(1);
VectorClock writeClock = makeSuperClock(time++);
socketStoreNode0.put(secondaryKey1, new
Versioned<byte[]>("value-win".getBytes(),
writeClock), null);
try {
redirectingStoreNode2.put(secondaryKey1, new
Versioned<byte[]>("value-ove".getBytes(),
writeClock), null);
fail("Missing OVE.. put should be based on remote version");
} catch(ObsoleteVersionException ove) {
// should have OVE if based on remote version due to equal clock
}
// But would have still move over value from Node 0
assertEquals("Value not moved over from Node 0",
"value-win",
new String(socketStoreNode2.get(secondaryKey1, null).get(0).getValue()));
socketStoreNode0.delete(secondaryKey1, makeSuperClock(time++));
redirectingStoreNode2.put(secondaryKey1,
new Versioned<byte[]>("value-final".getBytes(),
makeSuperClock(time++)),
null);
assertEquals("Final value not found on node 2",
"value-final",
new String(socketStoreNode2.get(secondaryKey1, null).get(0).getValue()));
assertEquals("Final value not found on node 0",
"value-final",
new String(socketStoreNode0.get(secondaryKey1, null).get(0).getValue()));
// delete all the primary and secondary keys from Node 2 and Node 0, to
// begin getAll() tests
for(ByteArray key: testPrimaryKeys) {
socketStoreNode0.delete(key, makeSuperClock(time++));
socketStoreNode2.delete(key, makeSuperClock(time++));
socketStoreNode0.put(key, new Versioned<byte[]>("normal".getBytes(),
makeSuperClock(time++)), null);
}
for(ByteArray key: testSecondaryKeys) {
socketStoreNode0.delete(key, makeSuperClock(time++));
socketStoreNode2.delete(key, makeSuperClock(time++));
socketStoreNode0.put(key, new Versioned<byte[]>("normal".getBytes(),
makeSuperClock(time++)), null);
}
// 3. Test case where some keys are moved over and some are n't for
// getAlls.
List<ByteArray> keyList = new ArrayList<ByteArray>();
keyList.addAll(testPrimaryKeys);
keyList.addAll(testSecondaryKeys);
keyList.add(new ByteArray("non-existent-key".getBytes()));
// add the first primary & secondary key with bigger vector clock on
// Node 2 and lower clock on Node 0..
VectorClock smallerClock = makeSuperClock(time++);
VectorClock biggerClock = makeSuperClock(time++);
socketStoreNode0.put(testPrimaryKeys.get(0), new
Versioned<byte[]>("loser".getBytes(),
smallerClock), null);
socketStoreNode2.put(testPrimaryKeys.get(0), new
Versioned<byte[]>("winner".getBytes(),