Skip to content

Commit

Permalink
Tests for system store with a 3 zone cluster
Browse files Browse the repository at this point in the history
  • Loading branch information
abh1nay authored and jayjwylie committed Jun 20, 2013
1 parent 3512cff commit a758c2a
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 25 deletions.
Expand Up @@ -20,20 +20,25 @@
import static org.junit.Assert.fail;

import java.util.Date;
import java.util.List;
import java.util.Properties;
import java.util.concurrent.Callable;

import org.junit.After;
import org.junit.Before;
import org.junit.Test;

import voldemort.ClusterTestUtils;
import voldemort.ServerTestUtils;
import voldemort.TestUtils;
import voldemort.client.SystemStore;
import voldemort.client.SystemStoreRepository;
import voldemort.client.scheduler.AsyncMetadataVersionManager;
import voldemort.cluster.Cluster;
import voldemort.common.service.SchedulerService;
import voldemort.server.VoldemortConfig;
import voldemort.server.VoldemortServer;
import voldemort.store.StoreDefinition;
import voldemort.store.socket.SocketStoreFactory;
import voldemort.store.socket.clientrequest.ClientRequestExecutorPool;
import voldemort.utils.MetadataVersionStoreUtils;
Expand Down Expand Up @@ -70,17 +75,24 @@ public class AsyncMetadataVersionManagerTest {

@Before
public void setUp() throws Exception {
final int numServers = 2;
servers = new VoldemortServer[numServers];
int partitionMap[][] = { { 0, 1, 2, 3 }, { 4, 5, 6, 7 } };
cluster = ServerTestUtils.startVoldemortCluster(numServers,
servers,
partitionMap,
socketStoreFactory,
true, // useNio
null,
storesXmlfile,
new Properties());
cluster = ClusterTestUtils.getZZZCluster();
servers = new VoldemortServer[cluster.getNodeIds().size()];

List<StoreDefinition> storeDefs = ClusterTestUtils.getZZZ322StoreDefs("bdb");
int i = 0;

for(Integer nodeId: cluster.getNodeIds()) {
VoldemortConfig config = ServerTestUtils.createServerConfigWithDefs(true,
nodeId,
TestUtils.createTempDir()
.getAbsolutePath(),
cluster,
storeDefs,
new Properties());
VoldemortServer server = ServerTestUtils.startVoldemortServer(socketStoreFactory,
config);
servers[i++] = server;
}

socketUrl = servers[0].getIdentityNode().getSocketUrl().toString();

Expand Down
38 changes: 24 additions & 14 deletions test/unit/voldemort/store/system/SystemStoreTest.java
Expand Up @@ -19,19 +19,24 @@
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.fail;

import java.util.List;
import java.util.Properties;

import org.junit.After;
import org.junit.Before;
import org.junit.Test;

import voldemort.ClusterTestUtils;
import voldemort.ServerTestUtils;
import voldemort.TestUtils;
import voldemort.client.AbstractStoreClientFactory;
import voldemort.client.ClientConfig;
import voldemort.client.SocketStoreClientFactory;
import voldemort.client.SystemStore;
import voldemort.cluster.Cluster;
import voldemort.server.VoldemortConfig;
import voldemort.server.VoldemortServer;
import voldemort.store.StoreDefinition;
import voldemort.store.metadata.MetadataStore;
import voldemort.store.socket.SocketStoreFactory;
import voldemort.store.socket.clientrequest.ClientRequestExecutorPool;
Expand Down Expand Up @@ -60,20 +65,25 @@ public class SystemStoreTest {

@Before
public void setUp() throws Exception {
final int numServers = 2;
servers = new VoldemortServer[numServers];
int partitionMap[][] = { { 0, 1, 2, 3 }, { 4, 5, 6, 7 } };

cluster = ServerTestUtils.getLocalCluster(2, new int[][] { { 0, 1, 2, 3 }, { 4, 5, 6, 7 } });
servers = new VoldemortServer[2];
cluster = ServerTestUtils.startVoldemortCluster(numServers,
servers,
partitionMap,
socketStoreFactory,
true, // useNio
null,
storesXmlfile,
new Properties());

cluster = ClusterTestUtils.getZZZCluster();
servers = new VoldemortServer[cluster.getNodeIds().size()];

List<StoreDefinition> storeDefs = ClusterTestUtils.getZZZ322StoreDefs("bdb");
int i = 0;

for(Integer nodeId: cluster.getNodeIds()) {
VoldemortConfig config = ServerTestUtils.createServerConfigWithDefs(true,
nodeId,
TestUtils.createTempDir()
.getAbsolutePath(),
cluster,
storeDefs,
new Properties());
VoldemortServer server = ServerTestUtils.startVoldemortServer(socketStoreFactory,
config);
servers[i++] = server;
}

socketUrl = servers[0].getIdentityNode().getSocketUrl().toString();

Expand Down

0 comments on commit a758c2a

Please sign in to comment.