Search in sources :

Example 21 with StoreDefinitionsMapper

use of voldemort.xml.StoreDefinitionsMapper in project voldemort by voldemort.

the class ZonedRebalanceNonContiguousZonesTest method setupZ1Z3.

public static void setupZ1Z3() throws IOException {
    z1z3Current = ClusterTestUtils.getZ1Z3ClusterWithNonContiguousNodeIds();
    z1z3Shuffle = ClusterTestUtils.getZ1Z3ClusterWithNonContiguousNodeIdsWithSwappedPartitions();
    z1z3ClusterExpansionNN = ClusterTestUtils.getZ1Z3ClusterWithNonContiguousNodeIdsWithNN();
    z1z3ClusterExpansionPP = ClusterTestUtils.getZ1Z3ClusterWithNonContiguousNodeIdsWithPP();
    z1z3Stores = ClusterTestUtils.getZ1Z3StoreDefsBDB();
    File z1z3file = ServerTestUtils.createTempFile("z1z3-stores-", ".xml");
    FileUtils.writeStringToFile(z1z3file, new StoreDefinitionsMapper().writeStoreList(z1z3Stores));
    z1z3StoresXml = z1z3file.getAbsolutePath();
    z1z3z5Current = ClusterTestUtils.getZ1Z3Z5ClusterWithNonContiguousNodeIds();
    z1z3z5Shuffle = ClusterTestUtils.getZ1Z3Z5ClusterWithNonContiguousNodeIdsWithSwappedPartitions();
    z1z3z5ClusterExpansionNNN = ClusterTestUtils.getZ1Z3Z5ClusterWithNonContiguousNodeIdsWithNNN();
    z1z3z5ClusterExpansionPPP = ClusterTestUtils.getZ1Z3Z5ClusterWithNonContiguousNodeIdsWithPPP();
    z1z3z5Stores = ClusterTestUtils.getZ1Z3Z5StoreDefsBDB();
    File z1z3z5file = ServerTestUtils.createTempFile("z1z3z5-stores-", ".xml");
    FileUtils.writeStringToFile(z1z3z5file, new StoreDefinitionsMapper().writeStoreList(z1z3z5Stores));
    z1z3z5StoresXml = z1z3z5file.getAbsolutePath();
}
Also used : StoreDefinitionsMapper(voldemort.xml.StoreDefinitionsMapper) File(java.io.File)

Example 22 with StoreDefinitionsMapper

use of voldemort.xml.StoreDefinitionsMapper in project voldemort by voldemort.

the class VerifyOrAddStoreTest method setUp.

@Before
public void setUp() throws IOException {
    servers = new VoldemortServer[NUM_SERVERS];
    int[][] partitionMap = { { 0, 1, 2, 3 }, { 4, 5, 6, 7 }, { 8, 9, 10, 11 }, { 12, 13, 14, 15 } };
    cluster = ServerTestUtils.startVoldemortCluster(servers, partitionMap, serverProps, storesXmlfile);
    newStoreDef = new StoreDefinitionsMapper().readStoreList(new File(readOnlyXmlFilePath)).get(0);
    newStoreName = newStoreDef.getName();
    Node node = cluster.getNodeById(0);
    String bootstrapUrl = "tcp://" + node.getHost() + ":" + node.getSocketPort();
    clientConfig.setBootstrapUrls(bootstrapUrl);
    adminClient = new AdminClient(new AdminClientConfig(), clientConfig);
}
Also used : AdminClientConfig(voldemort.client.protocol.admin.AdminClientConfig) Node(voldemort.cluster.Node) StoreDefinitionsMapper(voldemort.xml.StoreDefinitionsMapper) File(java.io.File) AdminClient(voldemort.client.protocol.admin.AdminClient) Before(org.junit.Before)

Example 23 with StoreDefinitionsMapper

use of voldemort.xml.StoreDefinitionsMapper in project voldemort by voldemort.

the class AbstractZonedRebalanceTest method setupZZandZZZ.

public static void setupZZandZZZ() throws IOException {
    zzCurrent = ClusterTestUtils.getZZCluster();
    zzShuffle = ClusterTestUtils.getZZClusterWithSwappedPartitions();
    zzClusterExpansionNN = ClusterTestUtils.getZZClusterWithNN();
    zzClusterExpansionPP = ClusterTestUtils.getZZClusterWithPP();
    zzStores = ClusterTestUtils.getZZStoreDefsBDB();
    File zzfile = ServerTestUtils.createTempFile("zz-stores-", ".xml");
    FileUtils.writeStringToFile(zzfile, new StoreDefinitionsMapper().writeStoreList(zzStores));
    zzStoresXml = zzfile.getAbsolutePath();
    zzzCurrent = ClusterTestUtils.getZZZCluster();
    zzzShuffle = ClusterTestUtils.getZZZClusterWithSwappedPartitions();
    zzzClusterExpansionNNN = ClusterTestUtils.getZZZClusterWithNNN();
    zzzClusterExpansionPPP = ClusterTestUtils.getZZZClusterWithPPP();
    zzeZoneExpansion = ClusterTestUtils.getZZECluster();
    zzzZoneExpansionXXP = ClusterTestUtils.getZZEClusterXXP();
    zzzStores = ClusterTestUtils.getZZZStoreDefsBDB();
    File zzzfile = ServerTestUtils.createTempFile("zzz-stores-", ".xml");
    FileUtils.writeStringToFile(zzzfile, new StoreDefinitionsMapper().writeStoreList(zzzStores));
    zzzStoresXml = zzzfile.getAbsolutePath();
}
Also used : StoreDefinitionsMapper(voldemort.xml.StoreDefinitionsMapper) File(java.io.File)

Example 24 with StoreDefinitionsMapper

use of voldemort.xml.StoreDefinitionsMapper in project voldemort by voldemort.

the class AdminRebalanceTest method startThreeNodeRW.

public void startThreeNodeRW() throws IOException {
    storeDef1 = ServerTestUtils.getStoreDef("test", 1, 1, 1, 1, 1, RoutingStrategyType.CONSISTENT_STRATEGY);
    storeDef2 = ServerTestUtils.getStoreDef("test2", 2, 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)));
    int numServers = 3;
    servers = new VoldemortServer[numServers];
    int[][] partitionMap = { { 0, 1, 2, 3 }, { 4, 5, 6, 7 }, {} };
    currentCluster = ServerTestUtils.startVoldemortCluster(numServers, servers, partitionMap, socketStoreFactory, useNio, null, tempStoreXml.getAbsolutePath(), new Properties());
    finalCluster = UpdateClusterUtils.createUpdatedCluster(currentCluster, 2, Lists.newArrayList(0));
    RebalanceBatchPlan plan = new RebalanceBatchPlan(currentCluster, finalCluster, Lists.newArrayList(storeDef1, storeDef2));
    plans = Lists.newArrayList(plan.getBatchPlan());
    adminClient = ServerTestUtils.getAdminClient(currentCluster);
}
Also used : StoreDefinitionsMapper(voldemort.xml.StoreDefinitionsMapper) Properties(java.util.Properties) File(java.io.File)

Example 25 with StoreDefinitionsMapper

use of voldemort.xml.StoreDefinitionsMapper in project voldemort by voldemort.

the class QuotaResetterTest method setUp.

@Before
public void setUp() throws IOException {
    int numServers = 2;
    servers = new VoldemortServer[numServers];
    int[][] partitionMap = { { 0, 1, 2, 3 }, { 4, 5, 6, 7 } };
    Properties serverProperties = new Properties();
    serverProperties.setProperty("client.max.connections.per.node", "20");
    serverProperties.setProperty("enforce.retention.policy.on.read", Boolean.toString(false));
    cluster = ServerTestUtils.startVoldemortCluster(numServers, servers, partitionMap, socketStoreFactory, true, null, storesXmlfile, serverProperties);
    List<StoreDefinition> storeDefs = new StoreDefinitionsMapper().readStoreList(new File(storesXmlfile));
    this.storeNames = Sets.newHashSet();
    for (StoreDefinition storeDef : storeDefs) {
        storeNames.add(storeDef.getName());
    }
    Properties adminProperties = new Properties();
    adminProperties.setProperty("max_connections", "20");
    adminClient = new AdminClient(cluster, new AdminClientConfig(adminProperties));
}
Also used : AdminClientConfig(voldemort.client.protocol.admin.AdminClientConfig) StoreDefinition(voldemort.store.StoreDefinition) StoreDefinitionsMapper(voldemort.xml.StoreDefinitionsMapper) Properties(java.util.Properties) File(java.io.File) AdminClient(voldemort.client.protocol.admin.AdminClient) Before(org.junit.Before)

Aggregations

StoreDefinitionsMapper (voldemort.xml.StoreDefinitionsMapper)82 StoreDefinition (voldemort.store.StoreDefinition)50 File (java.io.File)44 StringReader (java.io.StringReader)29 ClusterMapper (voldemort.xml.ClusterMapper)26 Before (org.junit.Before)19 Cluster (voldemort.cluster.Cluster)18 Properties (java.util.Properties)16 VoldemortException (voldemort.VoldemortException)15 Test (org.junit.Test)14 Node (voldemort.cluster.Node)14 AdminClient (voldemort.client.protocol.admin.AdminClient)13 ArrayList (java.util.ArrayList)12 StoreDefinitionBuilder (voldemort.store.StoreDefinitionBuilder)12 IOException (java.io.IOException)10 OptionSet (joptsimple.OptionSet)9 VoldemortServer (voldemort.server.VoldemortServer)9 ByteArray (voldemort.utils.ByteArray)9 HashMap (java.util.HashMap)8 SerializerDefinition (voldemort.serialization.SerializerDefinition)8