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);
}
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;
}
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);
}
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;
}
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);
}
Aggregations