Search in sources :

Example 11 with FailoverFeature

use of org.apache.cxf.clustering.FailoverFeature in project cxf by apache.

the class LoadDistributorTest method testMultipleAltAddresses.

@Test
public void testMultipleAltAddresses() throws Exception {
    FailoverFeature feature = getFeature(Server.ADDRESS2, Server.ADDRESS3);
    strategyTest(Server.ADDRESS1, feature);
}
Also used : FailoverFeature(org.apache.cxf.clustering.FailoverFeature) Test(org.junit.Test)

Example 12 with FailoverFeature

use of org.apache.cxf.clustering.FailoverFeature in project cxf by apache.

the class LoadDistributorTest method getFeature.

private FailoverFeature getFeature(String... address) {
    FailoverFeature feature = new FailoverFeature();
    List<String> alternateAddresses = new ArrayList<>();
    for (String s : address) {
        alternateAddresses.add(s);
    }
    SequentialStrategy strategy = new SequentialStrategy();
    strategy.setAlternateAddresses(alternateAddresses);
    feature.setStrategy(strategy);
    LoadDistributorTargetSelector selector = new LoadDistributorTargetSelector();
    selector.setFailover(false);
    feature.setTargetSelector(selector);
    return feature;
}
Also used : SequentialStrategy(org.apache.cxf.clustering.SequentialStrategy) LoadDistributorTargetSelector(org.apache.cxf.clustering.LoadDistributorTargetSelector) FailoverFeature(org.apache.cxf.clustering.FailoverFeature) ArrayList(java.util.ArrayList)

Example 13 with FailoverFeature

use of org.apache.cxf.clustering.FailoverFeature in project cxf by apache.

the class FailoverTest method testSequentialStrategyWithCustomTargetSelector.

@Test
public void testSequentialStrategyWithCustomTargetSelector() throws Exception {
    FailoverFeature feature = getCustomFeature(true, false, Server.ADDRESS2, Server.ADDRESS3);
    strategyTest("resolver://info", feature, Server.ADDRESS3, null, false, false, false);
}
Also used : FailoverFeature(org.apache.cxf.clustering.FailoverFeature) Test(org.junit.Test)

Example 14 with FailoverFeature

use of org.apache.cxf.clustering.FailoverFeature in project cxf by apache.

the class FailoverTest method getCustomFeature.

private FailoverFeature getCustomFeature(boolean custom, boolean random, String... address) {
    FailoverFeature feature = new FailoverFeature();
    List<String> alternateAddresses = new ArrayList<>();
    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;
}
Also used : SequentialStrategy(org.apache.cxf.clustering.SequentialStrategy) RandomStrategy(org.apache.cxf.clustering.RandomStrategy) FailoverFeature(org.apache.cxf.clustering.FailoverFeature) ArrayList(java.util.ArrayList) FailoverTargetSelector(org.apache.cxf.clustering.FailoverTargetSelector)

Example 15 with FailoverFeature

use of org.apache.cxf.clustering.FailoverFeature in project camel by apache.

the class CxfEndpointBeansTest method testCxfFeatureSetting.

@Test
public void testCxfFeatureSetting() {
    CxfEndpoint routerEndpoint = context.getEndpoint("cxf:bean:routerEndpoint", CxfEndpoint.class);
    assertEquals("Get a wrong size of features.", 1, routerEndpoint.getFeatures().size());
    assertTrue("Get a wrong feature instance.", routerEndpoint.getFeatures().get(0) instanceof FailoverFeature);
}
Also used : FailoverFeature(org.apache.cxf.clustering.FailoverFeature) CxfEndpoint(org.apache.camel.component.cxf.CxfEndpoint) Test(org.junit.Test)

Aggregations

FailoverFeature (org.apache.cxf.clustering.FailoverFeature)29 Test (org.junit.Test)25 ArrayList (java.util.ArrayList)7 CircuitBreakerFailoverFeature (org.apache.cxf.clustering.circuitbreaker.CircuitBreakerFailoverFeature)7 RandomStrategy (org.apache.cxf.clustering.RandomStrategy)4 SequentialStrategy (org.apache.cxf.clustering.SequentialStrategy)4 WebClient (org.apache.cxf.jaxrs.client.WebClient)4 ProcessingException (javax.ws.rs.ProcessingException)3 Book (org.apache.cxf.systest.jaxrs.Book)3 BookStore (org.apache.cxf.systest.jaxrs.BookStore)3 URL (java.net.URL)2 RetryStrategy (org.apache.cxf.clustering.RetryStrategy)2 JAXRSClientFactoryBean (org.apache.cxf.jaxrs.client.JAXRSClientFactoryBean)2 JaxWsProxyFactoryBean (org.apache.cxf.jaxws.JaxWsProxyFactoryBean)2 IOException (java.io.IOException)1 List (java.util.List)1 Response (javax.ws.rs.core.Response)1 QName (javax.xml.namespace.QName)1 Service (javax.xml.ws.Service)1 RouteBuilder (org.apache.camel.builder.RouteBuilder)1