Search in sources :

Example 36 with SerializerDefinition

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);
}
Also used : StoreDefinitionBuilder(voldemort.store.StoreDefinitionBuilder) StoreDefinitionsMapper(voldemort.xml.StoreDefinitionsMapper) Properties(java.util.Properties) File(java.io.File) SerializerDefinition(voldemort.serialization.SerializerDefinition)

Example 37 with SerializerDefinition

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);
}
Also used : StoreDefinitionBuilder(voldemort.store.StoreDefinitionBuilder) StoreDefinitionsMapper(voldemort.xml.StoreDefinitionsMapper) Properties(java.util.Properties) File(java.io.File) SerializerDefinition(voldemort.serialization.SerializerDefinition)

Example 38 with SerializerDefinition

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());
}
Also used : DefaultSerializerFactory(voldemort.serialization.DefaultSerializerFactory) SerializerDefinition(voldemort.serialization.SerializerDefinition)

Example 39 with SerializerDefinition

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());
}
Also used : DefaultSerializerFactory(voldemort.serialization.DefaultSerializerFactory) SerializerDefinition(voldemort.serialization.SerializerDefinition)

Example 40 with SerializerDefinition

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");
}
Also used : DefaultSerializerFactory(voldemort.serialization.DefaultSerializerFactory) SerializerDefinition(voldemort.serialization.SerializerDefinition)

Aggregations

SerializerDefinition (voldemort.serialization.SerializerDefinition)65 StoreDefinitionBuilder (voldemort.store.StoreDefinitionBuilder)46 StoreDefinition (voldemort.store.StoreDefinition)38 HashMap (java.util.HashMap)31 ArrayList (java.util.ArrayList)22 ByteArray (voldemort.utils.ByteArray)19 Test (org.junit.Test)18 DefaultSerializerFactory (voldemort.serialization.DefaultSerializerFactory)15 File (java.io.File)14 Cluster (voldemort.cluster.Cluster)12 Node (voldemort.cluster.Node)11 LinkedList (java.util.LinkedList)10 IOException (java.io.IOException)9 Serializer (voldemort.serialization.Serializer)9 List (java.util.List)8 VoldemortException (voldemort.VoldemortException)8 StoreDefinitionsMapper (voldemort.xml.StoreDefinitionsMapper)8 StatTrackingStore (voldemort.store.stats.StatTrackingStore)7 Before (org.junit.Before)6 Store (voldemort.store.Store)6