Skip to content

Commit

Permalink
Cleaned up the test
Browse files Browse the repository at this point in the history
  • Loading branch information
abh1nay committed May 17, 2013
1 parent 34ebf5a commit 361bc02
Showing 1 changed file with 14 additions and 14 deletions.
Expand Up @@ -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;
Expand Down Expand Up @@ -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 {
Expand All @@ -65,19 +64,16 @@ public class RebalanceRebootstrapConsistencyTest {

private Cluster cluster;
private List<VoldemortServer> servers;
private StoreClient<String, String> storeClient;

String[] bootStrapUrls = null;
public static String socketUrl = "";
protected final int CLIENT_ZONE_ID = 0;
private long newVersion = 0;

private SystemStore<String, String> sysVersionStore;
private SystemStoreRepository repository;
private SchedulerService scheduler;
private AsyncMetadataVersionManager asyncCheckMetadata;
private boolean callbackDone = false;
private long updatedClusterVersion;

private StoreDefinition rwStoreDefWithReplication;
private StoreDefinition rwStoreDefWithReplication2;
Expand Down Expand Up @@ -131,7 +127,7 @@ public void setUp() throws Exception {
.setRequiredWrites(1)
.build();

List<StoreDefinition> storedefs = new ArrayList();
List<StoreDefinition> storedefs = new ArrayList<StoreDefinition>();

storedefs.add(rwStoreDefWithReplication);

Expand Down Expand Up @@ -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];
Expand All @@ -177,6 +170,7 @@ public void setUp() throws Exception {

Callable<Void> rebootstrapCallback = new Callable<Void>() {

@Override
public Void call() throws Exception {
// callbackForClusterChange();
checkConsistentMetadata();
Expand Down Expand Up @@ -209,6 +203,9 @@ public void tearDown() {
server.stop();
}

/*
* simulate rebalance behavior
*/
public void rebalance() {
assert servers != null && servers.size() > 1;

Expand All @@ -225,7 +222,7 @@ public void rebalance() {
false);
adminClient.rpcOps.waitForCompletion(1, req, 5, TimeUnit.SECONDS);
Versioned<Cluster> versionedCluster = adminClient.metadataMgmtOps.getRemoteCluster(0);
Versioned<List<StoreDefinition>> versionedStoreDefs = adminClient.metadataMgmtOps.getRemoteStoreDefList(0);

Node node0 = versionedCluster.getValue().getNodeById(0);
Node node1 = versionedCluster.getValue().getNodeById(1);
Node newNode0 = new Node(node0.getId(),
Expand Down Expand Up @@ -288,6 +285,9 @@ public void testBasicAsyncBehaviour() {
}
}

/*
* In callback ensure metadata is consistent
*/
private void checkConsistentMetadata() {

Versioned<Cluster> versionedCluster = adminClient.metadataMgmtOps.getRemoteCluster(0);
Expand Down

0 comments on commit 361bc02

Please sign in to comment.