Package voldemort.routing

Examples of voldemort.routing.RouteToAllStrategy


public class ConfigureNodesTest extends AbstractActionTest {

    @Test
    public void testConfigureNodes() throws Exception {
        RoutingStrategy routingStrategy = new RouteToAllStrategy(cluster.getNodes());
        BasicPipelineData<byte[]> pipelineData = new BasicPipelineData<byte[]>();
        ConfigureNodes<byte[], BasicPipelineData<byte[]>> action = new ConfigureNodes<byte[], BasicPipelineData<byte[]>>(pipelineData,
                                                                                                                         Event.COMPLETED,
                                                                                                                         failureDetector,
                                                                                                                         1,
View Full Code Here


        assertEquals(cluster.getNodes().size(), pipelineData.getNodes().size());
    }

    @Test(expected = InsufficientOperationalNodesException.class)
    public void testConfigureNodesNotEnoughNodes() throws Exception {
        RoutingStrategy routingStrategy = new RouteToAllStrategy(cluster.getNodes());
        BasicPipelineData<byte[]> pipelineData = new BasicPipelineData<byte[]>();
        ConfigureNodes<byte[], BasicPipelineData<byte[]>> action = new ConfigureNodes<byte[], BasicPipelineData<byte[]>>(pipelineData,
                                                                                                                         Event.COMPLETED,
                                                                                                                         failureDetector,
                                                                                                                         cluster.getNodes()
View Full Code Here

public class GetAllConfigureNodesTest extends AbstractActionTest {

    @Test
    public void testConfigureNodes() throws Exception {
        RoutingStrategy routingStrategy = new RouteToAllStrategy(cluster.getNodes());
        GetAllPipelineData pipelineData = new GetAllPipelineData();
        List<ByteArray> keys = new ArrayList<ByteArray>();

        for(int i = 0; i < 10; i++)
            keys.add(TestUtils.toByteArray("key-" + i));

        int preferred = cluster.getNumberOfNodes() - 1;

        GetAllConfigureNodes action = new GetAllConfigureNodes(pipelineData,
                                                               Event.COMPLETED,
                                                               failureDetector,
                                                               preferred,
                                                               preferred - 1,
                                                               routingStrategy,
                                                               keys,
                                                               null,
                                                               null,
                                                               null);

        Pipeline pipeline = new Pipeline(Operation.GET, 10000, TimeUnit.MILLISECONDS);
        pipeline.addEventAction(Event.STARTED, action);
        pipeline.addEvent(Event.STARTED);
        pipeline.execute();

        if(pipelineData.getFatalError() != null)
            throw pipelineData.getFatalError();

        for(ByteArray key: keys) {
            List<Node> allNodesList = routingStrategy.routeRequest(key.get());
            assertEquals(cluster.getNumberOfNodes(), allNodesList.size());

            List<Node> extraNodes = pipelineData.getKeyToExtraNodesMap().get(key);
            assertEquals(cluster.getNumberOfNodes() - preferred, extraNodes.size());
View Full Code Here

            failureDetector.recordException(node,
                                            0,
                                            new UnreachableStoreException("Test for "
                                                                          + getClass().getName()));

        RoutingStrategy routingStrategy = new RouteToAllStrategy(cluster.getNodes());
        GetAllPipelineData pipelineData = new GetAllPipelineData();

        GetAllConfigureNodes action = new GetAllConfigureNodes(pipelineData,
                                                               Event.COMPLETED,
                                                               failureDetector,
View Full Code Here

        for(StoreDefinition store: storeDefs.values()) {
            map.put(store.getName(), routingFactory.updateRoutingStrategy(store, cluster));
        }

        // add metadata Store route to ALL routing strategy.
        map.put(METADATA_STORE_NAME, new RouteToAllStrategy(getCluster().getNodes()));

        return map;
    }
View Full Code Here

TOP

Related Classes of voldemort.routing.RouteToAllStrategy

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.