Repository: cxf Updated Branches: refs/heads/master 670ba1f4d -> c1eaf69cb
CXF-6622: Enhance Failover Feature to support Circuit Breakers based implementation. Added more JAX-WS failover test cases. Project: http://git-wip-us.apache.org/repos/asf/cxf/repo Commit: http://git-wip-us.apache.org/repos/asf/cxf/commit/c1eaf69c Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/c1eaf69c Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/c1eaf69c Branch: refs/heads/master Commit: c1eaf69cb16583f672ddef646dcd7a52cfa23b5d Parents: 670ba1f Author: reta <[email protected]> Authored: Mon Dec 14 21:19:48 2015 -0500 Committer: reta <[email protected]> Committed: Mon Dec 14 21:19:48 2015 -0500 ---------------------------------------------------------------------- .../clustering/CircuitBreakerFailoverTest.java | 43 +++++++++++++++++++- 1 file changed, 41 insertions(+), 2 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cxf/blob/c1eaf69c/systests/uncategorized/src/test/java/org/apache/cxf/systest/clustering/CircuitBreakerFailoverTest.java ---------------------------------------------------------------------- diff --git a/systests/uncategorized/src/test/java/org/apache/cxf/systest/clustering/CircuitBreakerFailoverTest.java b/systests/uncategorized/src/test/java/org/apache/cxf/systest/clustering/CircuitBreakerFailoverTest.java index 14ea048..4875c26 100644 --- a/systests/uncategorized/src/test/java/org/apache/cxf/systest/clustering/CircuitBreakerFailoverTest.java +++ b/systests/uncategorized/src/test/java/org/apache/cxf/systest/clustering/CircuitBreakerFailoverTest.java @@ -19,8 +19,13 @@ package org.apache.cxf.systest.clustering; +import javax.xml.ws.WebServiceException; +import javax.xml.ws.soap.SOAPFaultException; + +import org.apache.cxf.greeter_control.Greeter; import org.junit.Test; +import static org.hamcrest.CoreMatchers.equalTo; /** * Tests failover within a static cluster. @@ -34,7 +39,41 @@ public class CircuitBreakerFailoverTest extends FailoverTest { } @Test - public void testDefaultSequentialStrategyWithCircuitBreaker() throws Exception { - strategyTest(REPLICA_B, REPLICA_C, REPLICA_E, false); + public void testWithNoAlternativeEndpoints() throws Exception { + final Greeter g = getGreeter(REPLICA_E); + + try { + g.greetMe("fred"); + fail("Expecting communication exception"); + } catch (WebServiceException ex) { + assertThat(ex.getMessage(), equalTo("Could not send Message.")); + } + + try { + g.greetMe("fred"); + fail("Expecting no alternative endpoints exception"); + } catch (SOAPFaultException ex) { + assertThat(ex.getMessage(), equalTo("None of alternative addresses are available at the moment")); + } + } + + @Test + public void testWithAlternativeEnpdpoints() throws Exception { + final Greeter g = getGreeter(REPLICA_A); + startTarget(REPLICA_E); + + try { + final String response = g.greetMe("fred"); + assertNotNull("expected non-null response", response); + } finally { + stopTarget(REPLICA_E); + } + + try { + g.greetMe("fred"); + fail("Expecting no alternative endpoints exception"); + } catch (WebServiceException ex) { + assertThat(ex.getMessage(), equalTo("Could not send Message.")); + } } }
