Search in sources :

Example 56 with VoldemortServer

use of voldemort.server.VoldemortServer in project voldemort by voldemort.

the class ServerTestUtilsTest method testStartVoldemortCluster.

@Test
public void testStartVoldemortCluster() throws IOException {
    int numServers = 8;
    VoldemortServer[] servers = new VoldemortServer[numServers];
    int[][] partitionMap = { { 0 }, { 1 }, { 2 }, { 3 }, { 4 }, { 5 }, { 6 }, { 7 } };
    Cluster cluster = ServerTestUtils.startVoldemortCluster(numServers, servers, partitionMap, socketStoreFactory, true, null, storesXmlfile, new Properties());
    assertTrue(cluster != null);
}
Also used : Cluster(voldemort.cluster.Cluster) VoldemortServer(voldemort.server.VoldemortServer) Properties(java.util.Properties) Test(org.junit.Test)

Example 57 with VoldemortServer

use of voldemort.server.VoldemortServer in project voldemort by voldemort.

the class AvroAddStoreTest method testAddAvroSchema.

@Test
public void testAddAvroSchema() throws Exception {
    // backwards incompatible schema should fail
    try {
        logger.info("Now inserting stores with non backward compatible schema. Should see exception");
        adminClient.storeMgmtOps.addStore(new StoreDefinitionsMapper().readStore(new StringReader(storeXmlWithBackwardIncompatibleSchema)));
        Assert.fail("Did not throw exception");
    } catch (VoldemortException e) {
    }
    // invalid key schema should fail
    try {
        logger.info("Now inserting stores with int32 avro key. Should see exception");
        adminClient.storeMgmtOps.addStore(new StoreDefinitionsMapper().readStore(new StringReader(storeXmlWithInvalidAvroKeySchema)));
        Assert.fail("Did not throw exception for invalid key schema");
    } catch (VoldemortException e) {
        logger.error("As expected", e);
    }
    // invalid value schema should fail
    try {
        logger.info("Now inserting stores with html characters in avro value schema");
        adminClient.storeMgmtOps.addStore(new StoreDefinitionsMapper().readStore(new StringReader(storeXmlWithInvalidAvroValueSchema)));
        Assert.fail("Did not throw exception for invalid value schema");
    } catch (VoldemortException e) {
        logger.error("As expected", e);
    }
    for (VoldemortServer vs : vservers.values()) {
        assertNull(vs.getStoreRepository().getLocalStore("test"));
    }
    logger.info("Now inserting stores with backward compatible schema. Should not see exception");
    adminClient.storeMgmtOps.addStore(new StoreDefinitionsMapper().readStore(new StringReader(storeXmlWithBackwardCompatibleSchema)));
    for (VoldemortServer vs : vservers.values()) {
        assertNotNull(vs.getStoreRepository().getLocalStore("test"));
    }
}
Also used : StoreDefinitionsMapper(voldemort.xml.StoreDefinitionsMapper) StringReader(java.io.StringReader) VoldemortServer(voldemort.server.VoldemortServer) VoldemortException(voldemort.VoldemortException) Test(org.junit.Test)

Example 58 with VoldemortServer

use of voldemort.server.VoldemortServer in project voldemort by voldemort.

the class MetaOperationsTest method setup.

@Before
public void setup() throws IOException {
    // setup cluster
    cluster = ServerTestUtils.getLocalCluster(2);
    stores = ServerTestUtils.getStoreDefs(2);
    bsURL = cluster.getNodes().iterator().next().getSocketUrl().toString();
    for (Node node : cluster.getNodes()) {
        SocketStoreFactory ssf = new ClientRequestExecutorPool(2, 10000, 100000, 1024);
        VoldemortConfig config = ServerTestUtils.createServerConfigWithDefs(true, node.getId(), TestUtils.createTempDir().getAbsolutePath(), cluster, stores, new Properties());
        VoldemortServer vs = ServerTestUtils.startVoldemortServer(ssf, config, cluster);
        vservers.put(node.getId(), vs);
        socketStoreFactories.put(node.getId(), ssf);
    }
    adminClient = new AdminClient(cluster);
}
Also used : ClientRequestExecutorPool(voldemort.store.socket.clientrequest.ClientRequestExecutorPool) Node(voldemort.cluster.Node) SocketStoreFactory(voldemort.store.socket.SocketStoreFactory) Properties(java.util.Properties) VoldemortServer(voldemort.server.VoldemortServer) VoldemortConfig(voldemort.server.VoldemortConfig) AdminClient(voldemort.client.protocol.admin.AdminClient) Before(org.junit.Before)

Example 59 with VoldemortServer

use of voldemort.server.VoldemortServer in project voldemort by voldemort.

the class QuotaOperationsTest method setup.

@Before
public void setup() throws IOException {
    // setup cluster
    cluster = ServerTestUtils.getLocalCluster(2);
    stores = ServerTestUtils.getStoreDefs(2);
    bsURL = cluster.getNodes().iterator().next().getSocketUrl().toString();
    for (Node node : cluster.getNodes()) {
        SocketStoreFactory ssf = new ClientRequestExecutorPool(2, 10000, 100000, 1024);
        VoldemortConfig config = ServerTestUtils.createServerConfigWithDefs(true, node.getId(), TestUtils.createTempDir().getAbsolutePath(), cluster, stores, new Properties());
        VoldemortServer vs = ServerTestUtils.startVoldemortServer(ssf, config, cluster);
        vservers.put(node.getId(), vs);
        socketStoreFactories.put(node.getId(), ssf);
    }
    adminClient = new AdminClient(cluster);
    storeName = stores.iterator().next().getName();
}
Also used : ClientRequestExecutorPool(voldemort.store.socket.clientrequest.ClientRequestExecutorPool) Node(voldemort.cluster.Node) SocketStoreFactory(voldemort.store.socket.SocketStoreFactory) Properties(java.util.Properties) VoldemortServer(voldemort.server.VoldemortServer) VoldemortConfig(voldemort.server.VoldemortConfig) AdminClient(voldemort.client.protocol.admin.AdminClient) Before(org.junit.Before)

Example 60 with VoldemortServer

use of voldemort.server.VoldemortServer in project voldemort by voldemort.

the class CoordinatorAdminToolTest method tearDown.

@After
public void tearDown() throws Exception {
    for (VoldemortServer server : servers) {
        ServerTestUtils.stopVoldemortServer(server);
    }
    coordinator.stop();
    // clean up the temporary file created in set up
    COPY_OF_FAT_CLIENT_CONFIG_FILE.delete();
}
Also used : VoldemortServer(voldemort.server.VoldemortServer) After(org.junit.After)

Aggregations

VoldemortServer (voldemort.server.VoldemortServer)86 Properties (java.util.Properties)36 VoldemortConfig (voldemort.server.VoldemortConfig)24 Test (org.junit.Test)23 Node (voldemort.cluster.Node)23 Before (org.junit.Before)21 SocketStoreFactory (voldemort.store.socket.SocketStoreFactory)20 ClientRequestExecutorPool (voldemort.store.socket.clientrequest.ClientRequestExecutorPool)18 ClientConfig (voldemort.client.ClientConfig)17 ByteArray (voldemort.utils.ByteArray)17 ArrayList (java.util.ArrayList)16 After (org.junit.After)15 StoreDefinition (voldemort.store.StoreDefinition)15 SocketStoreClientFactory (voldemort.client.SocketStoreClientFactory)14 Cluster (voldemort.cluster.Cluster)14 IOException (java.io.IOException)11 HashMap (java.util.HashMap)11 AdminClient (voldemort.client.protocol.admin.AdminClient)11 VectorClock (voldemort.versioning.VectorClock)10 StoreDefinitionsMapper (voldemort.xml.StoreDefinitionsMapper)9