use of org.apache.cxf.clustering.FailoverTargetSelector in project cxf by apache.
the class LoadDistributorTest method verifyStrategy.
protected void verifyStrategy(Object proxy, Class<?> clz) {
ConduitSelector conduitSelector = WebClient.getConfig(proxy).getConduitSelector();
if (conduitSelector instanceof FailoverTargetSelector) {
Object strategy = ((FailoverTargetSelector) conduitSelector).getStrategy();
assertTrue("unexpected strategy", clz.isInstance(strategy));
} else {
fail("unexpected conduit selector: " + conduitSelector);
}
}
use of org.apache.cxf.clustering.FailoverTargetSelector in project cxf by apache.
the class AbstractFailoverTest method verifyStrategy.
protected void verifyStrategy(Object proxy, Class<?> clz) {
ConduitSelector conduitSelector = WebClient.getConfig(proxy).getConduitSelector();
if (conduitSelector instanceof FailoverTargetSelector) {
Object strategy = ((FailoverTargetSelector) conduitSelector).getStrategy();
assertTrue("unexpected strategy", clz.isInstance(strategy));
} else {
fail("unexpected conduit selector: " + conduitSelector);
}
}
use of org.apache.cxf.clustering.FailoverTargetSelector 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.FailoverTargetSelector in project cxf by apache.
the class FailoverAddressOverrideTest method verifyStrategy.
protected void verifyStrategy(Object proxy, Class<?> clz, int count) {
ConduitSelector conduitSelector = ClientProxy.getClient(proxy).getConduitSelector();
if (conduitSelector instanceof FailoverTargetSelector) {
AbstractStaticFailoverStrategy strategy = (AbstractStaticFailoverStrategy) ((FailoverTargetSelector) conduitSelector).getStrategy();
assertTrue("unexpected strategy", clz.isInstance(strategy));
List<String> alternates = strategy.getAlternateAddresses(null);
assertNotNull("expected alternate addresses", alternates);
assertEquals("unexpected alternate addresses", count, alternates.size());
} else {
fail("unexpected conduit selector: " + conduitSelector);
}
}
use of org.apache.cxf.clustering.FailoverTargetSelector in project cxf by apache.
the class FailoverTest method verifyStrategy.
protected void verifyStrategy(Object proxy, Class<?> clz) {
ConduitSelector conduitSelector = ClientProxy.getClient(proxy).getConduitSelector();
if (conduitSelector instanceof FailoverTargetSelector) {
Object strategy = ((FailoverTargetSelector) conduitSelector).getStrategy();
assertTrue("unexpected strategy", clz.isInstance(strategy));
} else {
fail("unexpected conduit selector: " + conduitSelector);
}
}
Aggregations