use of voldemort.serialization.SerializerDefinition in project voldemort by voldemort.
the class AdminRebalanceTest method startFourNodeRORW.
public void startFourNodeRORW() throws IOException {
storeDef1 = new StoreDefinitionBuilder().setName("test").setType(ReadOnlyStorageConfiguration.TYPE_NAME).setKeySerializer(new SerializerDefinition("string")).setValueSerializer(new SerializerDefinition("string")).setRoutingPolicy(RoutingTier.CLIENT).setRoutingStrategyType(RoutingStrategyType.CONSISTENT_STRATEGY).setReplicationFactor(2).setPreferredReads(1).setRequiredReads(1).setPreferredWrites(1).setRequiredWrites(1).build();
storeDef2 = new StoreDefinitionBuilder().setName("test2").setType(ReadOnlyStorageConfiguration.TYPE_NAME).setKeySerializer(new SerializerDefinition("string")).setValueSerializer(new SerializerDefinition("string")).setRoutingPolicy(RoutingTier.CLIENT).setRoutingStrategyType(RoutingStrategyType.CONSISTENT_STRATEGY).setReplicationFactor(3).setPreferredReads(1).setRequiredReads(1).setPreferredWrites(1).setRequiredWrites(1).build();
storeDef3 = ServerTestUtils.getStoreDef("test3", 2, 1, 1, 1, 1, RoutingStrategyType.CONSISTENT_STRATEGY);
storeDef4 = ServerTestUtils.getStoreDef("test4", 3, 1, 1, 1, 1, RoutingStrategyType.CONSISTENT_STRATEGY);
File tempStoreXml = new File(TestUtils.createTempDir(), "stores.xml");
FileUtils.writeStringToFile(tempStoreXml, new StoreDefinitionsMapper().writeStoreList(Lists.newArrayList(storeDef1, storeDef2, storeDef3, storeDef4)));
int numServers = 4;
servers = new VoldemortServer[numServers];
int[][] partitionMap = { { 0, 1, 2, 3 }, { 4, 5, 6, 7 }, { 8, 9, 10, 11 }, {} };
currentCluster = ServerTestUtils.startVoldemortCluster(numServers, servers, partitionMap, socketStoreFactory, useNio, null, tempStoreXml.getAbsolutePath(), new Properties());
finalCluster = UpdateClusterUtils.createUpdatedCluster(currentCluster, 3, Lists.newArrayList(0));
// Make plan only with RO stores
RebalanceBatchPlan plan = new RebalanceBatchPlan(currentCluster, finalCluster, Lists.newArrayList(storeDef1, storeDef2));
plans = plan.getBatchPlan();
adminClient = ServerTestUtils.getAdminClient(currentCluster);
}
use of voldemort.serialization.SerializerDefinition in project voldemort by voldemort.
the class AdminRebalanceTest method startFourNodeRO.
public void startFourNodeRO() throws IOException {
storeDef1 = new StoreDefinitionBuilder().setName("test").setType(ReadOnlyStorageConfiguration.TYPE_NAME).setKeySerializer(new SerializerDefinition("string")).setValueSerializer(new SerializerDefinition("string")).setRoutingPolicy(RoutingTier.CLIENT).setRoutingStrategyType(RoutingStrategyType.CONSISTENT_STRATEGY).setReplicationFactor(2).setPreferredReads(1).setRequiredReads(1).setPreferredWrites(1).setRequiredWrites(1).build();
storeDef2 = new StoreDefinitionBuilder().setName("test2").setType(ReadOnlyStorageConfiguration.TYPE_NAME).setKeySerializer(new SerializerDefinition("string")).setValueSerializer(new SerializerDefinition("string")).setRoutingPolicy(RoutingTier.CLIENT).setRoutingStrategyType(RoutingStrategyType.CONSISTENT_STRATEGY).setReplicationFactor(3).setPreferredReads(1).setRequiredReads(1).setPreferredWrites(1).setRequiredWrites(1).build();
File tempStoreXml = new File(TestUtils.createTempDir(), "stores.xml");
FileUtils.writeStringToFile(tempStoreXml, new StoreDefinitionsMapper().writeStoreList(Lists.newArrayList(storeDef1, storeDef2)));
int numServers = 4;
servers = new VoldemortServer[numServers];
int[][] partitionMap = { { 0, 1, 2, 3 }, { 4, 5, 6, 7 }, { 8, 9, 10, 11 }, {} };
currentCluster = ServerTestUtils.startVoldemortCluster(numServers, servers, partitionMap, socketStoreFactory, useNio, null, tempStoreXml.getAbsolutePath(), new Properties());
finalCluster = UpdateClusterUtils.createUpdatedCluster(currentCluster, 3, Lists.newArrayList(0));
RebalanceBatchPlan plan = new RebalanceBatchPlan(currentCluster, finalCluster, Lists.newArrayList(storeDef1, storeDef2));
plans = Lists.newArrayList(plan.getBatchPlan());
adminClient = ServerTestUtils.getAdminClient(currentCluster);
}
use of voldemort.serialization.SerializerDefinition in project voldemort by voldemort.
the class ProtoBufSerializerTest method testGetSerializer.
public void testGetSerializer() {
SerializerDefinition def = new SerializerDefinition("protobuf", "java=" + MessageStub.class.getName());
Serializer<?> serializer = new DefaultSerializerFactory().getSerializer(def);
assertEquals(ProtoBufSerializer.class, serializer.getClass());
}
use of voldemort.serialization.SerializerDefinition in project voldemort by voldemort.
the class ThriftSerializerTest method testGetSerializer.
public void testGetSerializer() {
SerializerDefinition def = new SerializerDefinition("thrift", "java=" + MockMessage.class.getName() + ", protocol=binary ");
Serializer<?> serializer = new DefaultSerializerFactory().getSerializer(def);
assertEquals(ThriftSerializer.class, serializer.getClass());
}
use of voldemort.serialization.SerializerDefinition in project voldemort by voldemort.
the class ThriftSerializerTest method testGetSerializer3.
public void testGetSerializer3() {
try {
SerializerDefinition def = new SerializerDefinition("thrift", "protocol=json");
new DefaultSerializerFactory().getSerializer(def);
} catch (IllegalArgumentException e) {
return;
}
fail("IllegalArgumentException should have been thrown for missing Thrift class");
}
Aggregations