use of voldemort.server.VoldemortServer in project qi4j-sdk by Qi4j.
the class VoldemortTest method startServer.
private void startServer(File voldemortHome, String serverProps) throws IOException {
Properties props = new Properties();
InputStream in = getClass().getResourceAsStream(serverProps);
props.load(in);
props.setProperty("voldemort.home", voldemortHome.getCanonicalPath());
VoldemortConfig config = new VoldemortConfig(props);
config.setEnableJmx(false);
VoldemortServer server = new VoldemortServer(config);
server.start();
this.servers.add(server);
}
use of voldemort.server.VoldemortServer in project voldemort by voldemort.
the class ZoneCountWriteTest method testFastPath.
@Test
public void testFastPath() {
try {
client.put("AB", new Versioned<String>("CD"), null);
try {
Thread.sleep(100);
} catch (InterruptedException e) {
e.printStackTrace();
}
for (Integer nodeId : vservers.keySet()) {
VoldemortServer vs = vservers.get(nodeId);
Store<ByteArray, byte[], byte[]> store = vs.getStoreRepository().getLocalStore(storeDef.getName());
byte[] real = store.get(new ByteArray("AB".getBytes()), null).get(0).getValue();
assertTrue(Arrays.equals(real, "CD".getBytes()));
}
} catch (InsufficientOperationalNodesException e) {
fail("Failed with exception: " + e);
}
}
use of voldemort.server.VoldemortServer in project voldemort by voldemort.
the class ZoneCountWriteTest method testRemoteZoneNodeFail.
@Test
public void testRemoteZoneNodeFail() {
try {
for (Integer nodeId : stoppedServersForRemoteZoneNodeFail) {
vservers.get(nodeId).stop();
}
client.put("AB", new Versioned<String>("CD"), null);
try {
Thread.sleep(100);
} catch (InterruptedException e) {
}
for (Integer nodeId : vservers.keySet()) {
// skip stopped ones
if (stoppedServersForRemoteZoneNodeFail.contains(nodeId)) {
continue;
}
VoldemortServer vs = vservers.get(nodeId);
Store<ByteArray, byte[], byte[]> store = vs.getStoreRepository().getLocalStore(storeDef.getName());
byte[] real = store.get(new ByteArray("AB".getBytes()), null).get(0).getValue();
assertTrue(Arrays.equals(real, "CD".getBytes()));
}
} catch (InsufficientOperationalNodesException e) {
fail("Failed with exception: " + e);
e.printStackTrace();
}
}
use of voldemort.server.VoldemortServer in project voldemort by voldemort.
the class ZoneCountWriteTest method setup.
@Before
public void setup() throws IOException {
storeDef = storeDefs.get(0);
Integer zoneCountWrite = 1;
// override
storeDef = new StoreDefinition(storeDef.getName(), storeDef.getType(), storeDef.getDescription(), storeDef.getKeySerializer(), storeDef.getValueSerializer(), storeDef.getTransformsSerializer(), storeDef.getRoutingPolicy(), storeDef.getRoutingStrategyType(), storeDef.getReplicationFactor(), storeDef.getPreferredReads(), storeDef.getRequiredReads(), storeDef.getPreferredWrites(), storeDef.getRequiredWrites(), storeDef.getViewTargetStoreName(), storeDef.getValueTransformation(), storeDef.getZoneReplicationFactor(), storeDef.getZoneCountReads(), zoneCountWrite, storeDef.getRetentionDays(), storeDef.getRetentionScanThrottleRate(), storeDef.getRetentionFrequencyDays(), storeDef.getSerializerFactory(), storeDef.getHintedHandoffStrategyType(), storeDef.getHintPrefListSize(), storeDef.getOwners(), storeDef.getMemoryFootprintMB());
storeDefs.set(0, storeDef);
SocketStoreClientFactory socketStoreClientFactory = new SocketStoreClientFactory(clientConfig);
for (Integer nodeId : cluster.getNodeIds()) {
SocketStoreFactory socketStoreFactory = new ClientRequestExecutorPool(2, 10000, 100000, 1024);
VoldemortConfig config = ServerTestUtils.createServerConfigWithDefs(true, nodeId, TestUtils.createTempDir().getAbsolutePath(), cluster, storeDefs, new Properties());
VoldemortServer vs = ServerTestUtils.startVoldemortServer(socketStoreFactory, config, cluster);
vservers.put(nodeId, vs);
}
client = socketStoreClientFactory.getRawStore(storeDef.getName(), null);
}
use of voldemort.server.VoldemortServer in project voldemort by voldemort.
the class RebootstrappingStoreTest method setUp.
@Before
public void setUp() throws Exception {
SocketStoreFactory socketStoreFactory = new ClientRequestExecutorPool(2, 10000, 100000, 32 * 1024);
int numServers = 2;
VoldemortServer[] voldemortServers = new VoldemortServer[numServers];
int[][] partitionMap = { { 0, 1 }, {} };
cluster = ServerTestUtils.startVoldemortCluster(numServers, voldemortServers, partitionMap, socketStoreFactory, false, null, STORES_XML, new Properties());
servers = Lists.newArrayList();
for (int i = 0; i < numServers; ++i) {
servers.add(voldemortServers[i]);
}
String bootstrapUrl = cluster.getNodeById(0).getSocketUrl().toString();
storeClient = new SocketStoreClientFactory(new ClientConfig().setBootstrapUrls(bootstrapUrl)).getStoreClient(STORE_NAME);
Map<String, String> entries = Maps.newHashMap();
entries.put("a", "1");
entries.put("b", "2");
for (Map.Entry<String, String> entry : entries.entrySet()) storeClient.put(entry.getKey(), entry.getValue());
}
Aggregations