From 361bc02fa95347231ac0a6a423165739816dfaa0 Mon Sep 17 00:00:00 2001 From: Abhinay Nagpal Date: Thu, 16 May 2013 18:12:45 -0700 Subject: [PATCH] Cleaned up the test --- .../RebalanceRebootstrapConsistencyTest.java | 28 +++++++++---------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/test/unit/voldemort/client/rebalance/RebalanceRebootstrapConsistencyTest.java b/test/unit/voldemort/client/rebalance/RebalanceRebootstrapConsistencyTest.java index 105947bf3f..389325a11a 100644 --- a/test/unit/voldemort/client/rebalance/RebalanceRebootstrapConsistencyTest.java +++ b/test/unit/voldemort/client/rebalance/RebalanceRebootstrapConsistencyTest.java @@ -19,10 +19,7 @@ import org.junit.Test; import voldemort.ServerTestUtils; -import voldemort.client.ClientConfig; import voldemort.client.RoutingTier; -import voldemort.client.SocketStoreClientFactory; -import voldemort.client.StoreClient; import voldemort.client.SystemStore; import voldemort.client.SystemStoreRepository; import voldemort.client.protocol.admin.AdminClient; @@ -54,9 +51,11 @@ /** * - * We simulate the rebelance controller here by changing the cluster state and - * stores state On rebootstrap we want to ensure that the cluster and store defs - * are consistent + * We simulate the rebalance controller here by changing the cluster state and + * stores state + * + * On rebootstrap we want to ensure that the cluster and store defs are + * consistent from a client's perspective * */ public class RebalanceRebootstrapConsistencyTest { @@ -65,19 +64,16 @@ public class RebalanceRebootstrapConsistencyTest { private Cluster cluster; private List servers; - private StoreClient storeClient; String[] bootStrapUrls = null; public static String socketUrl = ""; protected final int CLIENT_ZONE_ID = 0; - private long newVersion = 0; private SystemStore sysVersionStore; private SystemStoreRepository repository; private SchedulerService scheduler; private AsyncMetadataVersionManager asyncCheckMetadata; private boolean callbackDone = false; - private long updatedClusterVersion; private StoreDefinition rwStoreDefWithReplication; private StoreDefinition rwStoreDefWithReplication2; @@ -131,7 +127,7 @@ public void setUp() throws Exception { .setRequiredWrites(1) .build(); - List storedefs = new ArrayList(); + List storedefs = new ArrayList(); storedefs.add(rwStoreDefWithReplication); @@ -160,9 +156,6 @@ public void setUp() throws Exception { servers.add(voldemortServers[i]); } - String bootstrapUrl = cluster.getNodeById(0).getSocketUrl().toString(); - storeClient = new SocketStoreClientFactory(new ClientConfig().setBootstrapUrls(bootstrapUrl)).getStoreClient(STORE_NAME); - socketUrl = voldemortServers[0].getIdentityNode().getSocketUrl().toString(); bootStrapUrls = new String[1]; @@ -177,6 +170,7 @@ public void setUp() throws Exception { Callable rebootstrapCallback = new Callable() { + @Override public Void call() throws Exception { // callbackForClusterChange(); checkConsistentMetadata(); @@ -209,6 +203,9 @@ public void tearDown() { server.stop(); } + /* + * simulate rebalance behavior + */ public void rebalance() { assert servers != null && servers.size() > 1; @@ -225,7 +222,7 @@ public void rebalance() { false); adminClient.rpcOps.waitForCompletion(1, req, 5, TimeUnit.SECONDS); Versioned versionedCluster = adminClient.metadataMgmtOps.getRemoteCluster(0); - Versioned> versionedStoreDefs = adminClient.metadataMgmtOps.getRemoteStoreDefList(0); + Node node0 = versionedCluster.getValue().getNodeById(0); Node node1 = versionedCluster.getValue().getNodeById(1); Node newNode0 = new Node(node0.getId(), @@ -288,6 +285,9 @@ public void testBasicAsyncBehaviour() { } } + /* + * In callback ensure metadata is consistent + */ private void checkConsistentMetadata() { Versioned versionedCluster = adminClient.metadataMgmtOps.getRemoteCluster(0);