Search in sources :

Example 81 with StoreDefinitionsMapper

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

the class StreamingClientTest method testSetup.

@Before
public void testSetup() throws IOException {
    if (null == servers) {
        servers = new VoldemortServer[numServers];
        serverPorts = new int[numServers];
        File tempStoreXml = new File(TestUtils.createTempDir(), "stores.xml");
        try {
            FileUtils.writeStringToFile(tempStoreXml, new StoreDefinitionsMapper().writeStoreList(Lists.newArrayList(storeDef)));
        } catch (IOException e1) {
            // TODO Auto-generated catch block
            e1.printStackTrace();
            throw e1;
        }
        int count = 0;
        for (int nodeId : cluster.getNodeIds()) {
            try {
                servers[count] = ServerTestUtils.startVoldemortServer(socketStoreFactory, ServerTestUtils.createServerConfig(true, nodeId, TestUtils.createTempDir().getAbsolutePath(), null, tempStoreXml.getAbsolutePath(), new Properties()), cluster);
            } catch (IOException e) {
                e.printStackTrace();
                throw e;
            }
            serverPorts[count] = servers[count].getIdentityNode().getSocketPort();
            count++;
        }
        adminClient = ServerTestUtils.getAdminClient(cluster);
    }
    startTime = System.currentTimeMillis();
}
Also used : StoreDefinitionsMapper(voldemort.xml.StoreDefinitionsMapper) IOException(java.io.IOException) Properties(java.util.Properties) File(java.io.File) Before(org.junit.Before)

Example 82 with StoreDefinitionsMapper

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

the class OfflineStateTest method setUp.

@Before
public void setUp() throws IOException {
    int numServers = 1;
    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(onlineRetention));
    cluster = ServerTestUtils.startVoldemortCluster(numServers, servers, partitionMap, socketStoreFactory, useNio, null, storesXmlfile, serverProperties);
    storeDefs = new StoreDefinitionsMapper().readStoreList(new File(storesXmlfile));
    Properties adminProperties = new Properties();
    adminProperties.setProperty("max_connections", "20");
    adminClient = new AdminClient(cluster, new AdminClientConfig(adminProperties));
    Node node = cluster.getNodeById(0);
    String bootstrapUrl = "tcp://" + node.getHost() + ":" + node.getSocketPort();
    StoreClientFactory storeClientFactory = new SocketStoreClientFactory(new ClientConfig().setBootstrapUrls(bootstrapUrl));
    storeClient = storeClientFactory.getStoreClient(STORE_NAME);
}
Also used : AdminClientConfig(voldemort.client.protocol.admin.AdminClientConfig) Node(voldemort.cluster.Node) StoreDefinitionsMapper(voldemort.xml.StoreDefinitionsMapper) Properties(java.util.Properties) AdminClientConfig(voldemort.client.protocol.admin.AdminClientConfig) 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