Skip to content

Commit

Permalink
Additional test in ChainedInconsistencyResolverTest for testing large…
Browse files Browse the repository at this point in the history
…r conflicts
  • Loading branch information
Chinmay Soman committed Mar 1, 2012
1 parent 2f08f0d commit 3d8ecf2
Showing 1 changed file with 27 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ public class ChainedInconsistencyResolverTest extends TestCase {

private static final String KEY = "XYZ";
private Versioned<String> v1, v2;
private Versioned<String> conflict1, conflict2, conflict3, conflict4, conflict5, conflict6;

private Node node;
private Cluster cluster;
Expand Down Expand Up @@ -74,8 +75,18 @@ public void setUp() throws IOException {
new Properties()),
cluster));

// Initialize versioned puts for basic test
v1 = getVersioned(0, 1, 1, 1, 1, 1);
v2 = getVersioned(0, 0, 1, 1, 1, 1);

// Initialize versioned puts for > 1 conflicts
conflict1 = getVersioned(0, 1, 1, 1, 1, 1, 1, 1, 1, 1);
conflict2 = getVersioned(0, 0, 1, 1, 1, 1, 1, 1, 1, 1);
conflict3 = getVersioned(0, 0, 0, 1, 1, 1, 1, 1, 1, 1);
conflict4 = getVersioned(0, 0, 0, 0, 1, 1, 1, 1, 1, 1);
conflict5 = getVersioned(0, 0, 0, 0, 0, 1, 1, 1, 1, 1);
conflict6 = getVersioned(0, 0, 0, 0, 0, 0, 1, 1, 1, 1);

defaultStoreClient = storeClientFactory.getStoreClient("test");
socketStore = ServerTestUtils.getSocketStore(socketStoreFactory,
"test",
Expand Down Expand Up @@ -112,4 +123,20 @@ public void testNormalPut() {
List<Versioned<byte[]>> resList = socketStore.get(new ByteArray(KEY.getBytes()), null);
assertEquals(1, resList.size());
}

@Test
public void testMoreConflicts() {
defaultStoreClient.put(KEY, conflict1);
defaultStoreClient.put(KEY, conflict2);
defaultStoreClient.put(KEY, conflict3);
defaultStoreClient.put(KEY, conflict4);
defaultStoreClient.put(KEY, conflict5);
defaultStoreClient.put(KEY, conflict6);
List<Versioned<byte[]>> resList = socketStore.get(new ByteArray(KEY.getBytes()), null);
assertEquals(6, resList.size());
Versioned<String> res = defaultStoreClient.get(KEY);
defaultStoreClient.put(KEY, res);
resList = socketStore.get(new ByteArray(KEY.getBytes()), null);
assertEquals(1, resList.size());
}
}

0 comments on commit 3d8ecf2

Please sign in to comment.