Package com.datastax.driver.core.policies

Examples of com.datastax.driver.core.policies.RoundRobinPolicy


    CountingPolicy policy;
    CCMBridge.CCMCluster c;

    @BeforeClass(groups = "short")
    private void setup() {
        policy = new CountingPolicy(new RoundRobinPolicy());
        Cluster.Builder builder = Cluster.builder().withLoadBalancingPolicy(policy);
        c = CCMBridge.buildCluster(2, builder);
    }
View Full Code Here


    public void should_refresh_single_connected_host() {
        CCMBridge ccm = null;
        Cluster cluster = null;
        try {
            // This will make the driver use at most 2 hosts, the others will be ignored
            LimitingLoadBalancingPolicy loadBalancingPolicy = new LimitingLoadBalancingPolicy(new RoundRobinPolicy(), 2, 1);

            // Setup a 3-host cluster, start only two hosts so that we know in advance which ones the policy will use
            ccm = CCMBridge.create("test");
            ccm.populate(3);
            ccm.start(1);
View Full Code Here

public class LoadBalancingPolicyTest extends AbstractPoliciesTest {

    @Test(groups = "long")
    public void roundRobinTest() throws Throwable {

        Cluster.Builder builder = Cluster.builder().withLoadBalancingPolicy(new RoundRobinPolicy());
        CCMBridge.CCMCluster c = CCMBridge.buildCluster(2, builder);
        try {

            createSchema(c.session);
            init(c, 12);
View Full Code Here

    @Test(groups = "long")
    public void whiteListPolicyTest() throws Throwable {

        List<InetSocketAddress> whiteList = Arrays.asList(new InetSocketAddress(InetAddress.getByName(CCMBridge.IP_PREFIX + '2'), 9042));

        Cluster.Builder builder = Cluster.builder().withLoadBalancingPolicy(new WhiteListPolicy(new RoundRobinPolicy(), whiteList));
        CCMBridge.CCMCluster c = CCMBridge.buildCluster(3, builder);
        try {

            createSchema(c.session);
            init(c, 12);
View Full Code Here

    }

    @Test(groups = "long")
    public void roundRobinWith2DCsTest() throws Throwable {

        Cluster.Builder builder = Cluster.builder().withLoadBalancingPolicy(new RoundRobinPolicy());
        CCMBridge.CCMCluster c = CCMBridge.buildCluster(2, 2, builder);
        try {

            createSchema(c.session);
            init(c, 12);
View Full Code Here

     * that we do not destroy the keys.
     */
    @Test(groups = "long")
    public void tokenAwareCompositeKeyTest() throws Throwable {

        Cluster.Builder builder = Cluster.builder().withLoadBalancingPolicy(new TokenAwarePolicy(new RoundRobinPolicy()));
        CCMBridge.CCMCluster c = CCMBridge.buildCluster(2, builder);

        Session session = c.session;

        try {
View Full Code Here

            c.discard();
        }
    }

    public void tokenAwareTest(boolean usePrepared) throws Throwable {
        Cluster.Builder builder = Cluster.builder().withLoadBalancingPolicy(new TokenAwarePolicy(new RoundRobinPolicy()));
        CCMBridge.CCMCluster c = CCMBridge.buildCluster(3, builder);
        try {

            createSchema(c.session);
            init(c, 12);
View Full Code Here

        }
    }

    @Test(groups = "long")
    public void tokenAwareWithRF2Test() throws Throwable {
        Cluster.Builder builder = Cluster.builder().withLoadBalancingPolicy(new TokenAwarePolicy(new RoundRobinPolicy()));
        CCMBridge.CCMCluster c = CCMBridge.buildCluster(2, builder);
        try {

            createSchema(c.session, 2);
            init(c, 12);
View Full Code Here

    private static final Logger logger = LoggerFactory.getLogger(CCMBridge.class);

    @Test(groups = "long")
    public void testRFOneTokenAware() throws Throwable {
        Cluster.Builder builder = Cluster.builder().withLoadBalancingPolicy(new TokenAwarePolicy(new RoundRobinPolicy()));
        CCMBridge.CCMCluster c = CCMBridge.buildCluster(3, builder);
        try {

            createSchema(c.session, 1);
            init(c, 12, ConsistencyLevel.ONE);
View Full Code Here

        }
    }

    @Test(groups = "long")
    public void testRFTwoTokenAware() throws Throwable {
        Cluster.Builder builder = Cluster.builder().withLoadBalancingPolicy(new TokenAwarePolicy(new RoundRobinPolicy()));
        CCMBridge.CCMCluster c = CCMBridge.buildCluster(3, builder);
        try {

            createSchema(c.session, 2);
            init(c, 12, ConsistencyLevel.TWO);
View Full Code Here

TOP

Related Classes of com.datastax.driver.core.policies.RoundRobinPolicy

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.