Return-Path: X-Original-To: apmail-cxf-commits-archive@www.apache.org Delivered-To: apmail-cxf-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 8413818584 for ; Tue, 15 Dec 2015 02:20:09 +0000 (UTC) Received: (qmail 16133 invoked by uid 500); 15 Dec 2015 02:20:09 -0000 Delivered-To: apmail-cxf-commits-archive@cxf.apache.org Received: (qmail 16021 invoked by uid 500); 15 Dec 2015 02:20:09 -0000 Mailing-List: contact commits-help@cxf.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@cxf.apache.org Delivered-To: mailing list commits@cxf.apache.org Received: (qmail 16010 invoked by uid 99); 15 Dec 2015 02:20:08 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 15 Dec 2015 02:20:08 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id BE678DFDCF; Tue, 15 Dec 2015 02:20:08 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: reta@apache.org To: commits@cxf.apache.org Message-Id: <364c9f11dd0a47fdbdffea9fe66e99fe@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: cxf git commit: CXF-6622: Enhance Failover Feature to support Circuit Breakers based implementation. Added more JAX-WS failover test cases. Date: Tue, 15 Dec 2015 02:20:08 +0000 (UTC) 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 Authored: Mon Dec 14 21:19:48 2015 -0500 Committer: reta 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.")); + } } }