Package org.apache.cxf.clustering

Examples of org.apache.cxf.clustering.FailoverFeature


        strategyTest(Server.ADDRESS1, feature, Server.ADDRESS2, Server.ADDRESS3, false, true, false);
    }
   
    @Test   
    public void testSequentialStrategyWithDiffBaseAddresses() throws Exception {
        FailoverFeature feature =
            getFeature(false, false, Server.ADDRESS3, null);
        strategyTest(Server.ADDRESS1, feature, Server.ADDRESS3, Server.ADDRESS2, false, false, false);
    }
View Full Code Here


            getFeature(false, false, Server.ADDRESS3, null);
        strategyTest(Server.ADDRESS1, feature, Server.ADDRESS3, Server.ADDRESS2, false, false, false);
    }
   
    public void testSequentialStrategyWithDiffBaseAddresses2() throws Exception {
        FailoverFeature feature =
            getFeature(false, false, Server.ADDRESS3, null);
        strategyTest(Server.ADDRESS1, feature, Server.ADDRESS3, Server.ADDRESS2, false, false, true);
    }
View Full Code Here

        strategyTest(Server.ADDRESS1, feature, Server.ADDRESS3, Server.ADDRESS2, false, false, true);
    }
   
    @Test(expected = InternalServerErrorException.class)
    public void testSequentialStrategyWithServerException() throws Exception {
        FailoverFeature feature =
            getFeature(false, false, Server.ADDRESS2, Server.ADDRESS3);
        strategyTest(Server.ADDRESS1, feature, Server.ADDRESS2, Server.ADDRESS3, true, false, false);
    }
View Full Code Here

        strategyTest(Server.ADDRESS1, feature, Server.ADDRESS2, Server.ADDRESS3, true, false, false);
    }
   
    @Test(expected = ClientException.class)   
    public void testSequentialStrategyFailure() throws Exception {
        FailoverFeature feature =
            getFeature(false, false, "http://localhost:" + NON_PORT + "/non-existent");
        strategyTest(Server.ADDRESS1, feature, null, null, false, false, false);
    }
View Full Code Here

    @Test
    public void testSequentialStrategyWithRetries() throws Exception {
        String address = "http://localhost:" + NON_PORT + "/non-existent";
        String address2 = "http://localhost:" + NON_PORT + "/non-existent2";
       
        FailoverFeature feature = new FailoverFeature();
        List<String> alternateAddresses = new ArrayList<String>();
        alternateAddresses.add(address);
        alternateAddresses.add(address2);
        CustomRetryStrategy strategy = new CustomRetryStrategy();
        strategy.setMaxNumberOfRetries(5);
        strategy.setAlternateAddresses(alternateAddresses);
        feature.setStrategy(strategy);
           
        BookStore store = getBookStore(address, feature);
        try {
            store.getBook("1");
            fail("Exception expected");
View Full Code Here

        }
    }
   

    private FailoverFeature getFeature(boolean custom, boolean random, String ...address) {
        FailoverFeature feature = new FailoverFeature();
        List<String> alternateAddresses = new ArrayList<String>();
        for (String s : address) {
            alternateAddresses.add(s);
        }
        if (!random) {
            SequentialStrategy strategy = new SequentialStrategy();
            strategy.setAlternateAddresses(alternateAddresses);
            feature.setStrategy(strategy);
        } else {
            RandomStrategy strategy = new RandomStrategy();
            strategy.setAlternateAddresses(alternateAddresses);
            feature.setStrategy(strategy);
        }
        if (custom) {
            FailoverTargetSelector selector = new ReplaceInitialAddressSelector();
            feature.setTargetSelector(selector);
        }
       
        return feature;
    }
View Full Code Here

                serviceList.add(alt);

                RandomStrategy strategy = new RandomStrategy();
                strategy.setAlternateAddresses(serviceList);

                FailoverFeature ff = new FailoverFeature();
                ff.setStrategy(strategy);

                CxfEndpoint endpoint = (CxfEndpoint)(endpoint(real));
                endpoint.getFeatures().add(ff);

                from(proxy).to(endpoint);
View Full Code Here

        serviceList.add("http://localhost:" + PORT + "/SoapContext/GreeterPort");

        RandomStrategy strategy = new RandomStrategy();
        strategy.setAlternateAddresses(serviceList);

        FailoverFeature ff = new FailoverFeature();
        ff.setStrategy(strategy);
       
        // setup the feature by using JAXWS front-end API
        JaxWsProxyFactoryBean factory = new JaxWsProxyFactoryBean();
        // set a fake address to kick off the failover feature
        factory.setAddress("http://localhost:" + PORT2 + "/SoapContext/GreeterPort");
View Full Code Here

        strategyTest(Server.ADDRESS1, feature, Server.ADDRESS2, null, false, false, false);
    }
   
    @Test   
    public void testSequentialStrategyWithCustomTargetSelector() throws Exception {
        FailoverFeature feature =
            getFeature(true, false, Server.ADDRESS2, Server.ADDRESS3);
        strategyTest("resolver://info", feature, Server.ADDRESS3, null, false, false, false);
    }
View Full Code Here

        strategyTest("resolver://info", feature, Server.ADDRESS3, null, false, false, false);
    }
   
    @Test   
    public void testSequentialStrategyWithCustomTargetSelector2() throws Exception {
        FailoverFeature feature =
            getFeature(true, false, Server.ADDRESS2, Server.ADDRESS3);
        strategyTest("resolver://info", feature, Server.ADDRESS3, null, false, false, true);
    }
View Full Code Here

TOP

Related Classes of org.apache.cxf.clustering.FailoverFeature

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.