use of org.apache.cxf.clustering.FailoverFeature in project cxf by apache.
the class AbstractFailoverTest method testSequentialStrategyWith406.
@Test
public void testSequentialStrategyWith406() throws Exception {
FailoverFeature feature = getFeature(false, Server.ADDRESS3);
feature.getTargetSelector().setSupportNotAvailableErrorsOnly(false);
strategyTestWebClientHttpError(Server.ADDRESS2, feature, Server.ADDRESS3, false);
}
use of org.apache.cxf.clustering.FailoverFeature in project cxf by apache.
the class AbstractFailoverTest method testSequentialStrategyWith404.
@Test
public void testSequentialStrategyWith404() throws Exception {
FailoverFeature feature = getFeature(false, Server.ADDRESS3);
feature.getTargetSelector().setSupportNotAvailableErrorsOnly(true);
strategyTestWebClient(Server.ADDRESS2 + "/new", feature, Server.ADDRESS3, null, false, false);
}
use of org.apache.cxf.clustering.FailoverFeature in project cxf by apache.
the class CircuitBreakerFailoverTest method testSequentialStrategyWithElapsingCircuitBreakerTimeout.
@Test
public void testSequentialStrategyWithElapsingCircuitBreakerTimeout() throws Throwable {
FailoverFeature feature = customizeFeature(new CircuitBreakerFailoverFeature(1, 3000), false, "http://localhost:" + NON_PORT + "/non-existent", "http://localhost:" + NON_PORT + "/non-existent2");
final BookStore bookStore = getBookStore("http://localhost:" + NON_PORT + "/non-existent", feature);
// should reset all circuit breakers and the URLs could be tried again.
for (int i = 0; i < 2; ++i) {
try {
bookStore.getBook(1);
fail("Exception expected");
} catch (ProcessingException ex) {
if (!(ex.getCause() instanceof IOException)) {
throw ex.getCause();
}
}
// Let's wait a bit more than circuit breaker timeout
Thread.sleep(4000);
}
}
use of org.apache.cxf.clustering.FailoverFeature in project cxf by apache.
the class CircuitBreakerFailoverTest method testSequentialStrategyWithRetry.
@Test
public void testSequentialStrategyWithRetry() throws Exception {
FailoverFeature feature = getFeature(false, "http://localhost:" + NON_PORT + "/non-existent", Server.ADDRESS2);
strategyTest("http://localhost:" + NON_PORT + "/non-existent", feature, Server.ADDRESS2, null, false, false, false);
}
use of org.apache.cxf.clustering.FailoverFeature in project cxf by apache.
the class FailoverWebClientTest method testRetryFailover.
@Test
public void testRetryFailover() throws Exception {
String address = "http://localhost:" + PORT1 + "/bookstore/unavailable";
final FailoverFeature feature = new FailoverFeature();
RetryStrategy strategy = new RetryStrategy();
strategy.setMaxNumberOfRetries(5);
feature.setStrategy(strategy);
final JAXRSClientFactoryBean bean = new JAXRSClientFactoryBean();
bean.setAddress(address);
bean.setFeatures(Arrays.asList(feature));
bean.setServiceClass(FailoverBookStore.class);
WebClient webClient = bean.createWebClient();
final Book b = webClient.get(Book.class);
assertEquals(124L, b.getId());
assertEquals("root", b.getName());
assertEquals(address, webClient.getBaseURI().toString());
}
Aggregations