Author: sergeyb
Date: Mon Aug 19 10:48:17 2013
New Revision: 1515351
URL: http://svn.apache.org/r1515351
Log:
Merged revisions 1515348 via svnmerge from
https://svn.apache.org/repos/asf/cxf/trunk
........
r1515348 | sergeyb | 2013-08-19 13:45:02 +0300 (Mon, 19 Aug 2013) | 1 line
[CXF-5184] Updating FailoverTargetSelector to deal with cases when
REQUEST_URI starts with ENDPOINT_ADDRESS, major help from Jacek Obarymski
appreciated
........
Modified:
cxf/branches/2.7.x-fixes/ (props changed)
cxf/branches/2.7.x-fixes/rt/features/clustering/src/main/java/org/apache/cxf/clustering/FailoverTargetSelector.java
cxf/branches/2.7.x-fixes/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/failover/LoadDistributorTest.java
Propchange: cxf/branches/2.7.x-fixes/
------------------------------------------------------------------------------
Merged /cxf/trunk:r1515348
Propchange: cxf/branches/2.7.x-fixes/
------------------------------------------------------------------------------
Binary property 'svnmerge-integrated' - no diff available.
Modified:
cxf/branches/2.7.x-fixes/rt/features/clustering/src/main/java/org/apache/cxf/clustering/FailoverTargetSelector.java
URL:
http://svn.apache.org/viewvc/cxf/branches/2.7.x-fixes/rt/features/clustering/src/main/java/org/apache/cxf/clustering/FailoverTargetSelector.java?rev=1515351&r1=1515350&r2=1515351&view=diff
==============================================================================
---
cxf/branches/2.7.x-fixes/rt/features/clustering/src/main/java/org/apache/cxf/clustering/FailoverTargetSelector.java
(original)
+++
cxf/branches/2.7.x-fixes/rt/features/clustering/src/main/java/org/apache/cxf/clustering/FailoverTargetSelector.java
Mon Aug 19 10:48:17 2013
@@ -315,7 +315,7 @@ public class FailoverTargetSelector exte
String
endpointAddress,
Conduit cond) {
String requestURI = (String)message.get(Message.REQUEST_URI);
- if (requestURI != null && endpointAddress != null &&
!requestURI.startsWith(endpointAddress)) {
+ if (requestURI != null && endpointAddress != null &&
!requestURI.equals(endpointAddress)) {
String basePath = (String)message.get(Message.BASE_PATH);
if (basePath != null && requestURI.startsWith(basePath)) {
String pathInfo = requestURI.substring(basePath.length());
Modified:
cxf/branches/2.7.x-fixes/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/failover/LoadDistributorTest.java
URL:
http://svn.apache.org/viewvc/cxf/branches/2.7.x-fixes/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/failover/LoadDistributorTest.java?rev=1515351&r1=1515350&r2=1515351&view=diff
==============================================================================
---
cxf/branches/2.7.x-fixes/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/failover/LoadDistributorTest.java
(original)
+++
cxf/branches/2.7.x-fixes/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/failover/LoadDistributorTest.java
Mon Aug 19 10:48:17 2013
@@ -26,6 +26,7 @@ import javax.ws.rs.core.Response;
import org.apache.cxf.clustering.FailoverFeature;
import org.apache.cxf.clustering.FailoverTargetSelector;
+import org.apache.cxf.clustering.LoadDistributorFeature;
import org.apache.cxf.clustering.LoadDistributorTargetSelector;
import org.apache.cxf.clustering.SequentialStrategy;
import org.apache.cxf.endpoint.ConduitSelector;
@@ -74,11 +75,28 @@ public class LoadDistributorTest extends
}
@Test
- public void testSequentialStrategy() throws Exception {
+ public void testMultipleAltAddresses() throws Exception {
FailoverFeature feature = getFeature(Server.ADDRESS2,
Server.ADDRESS3);
strategyTest(Server.ADDRESS1, feature);
}
+ @Test
+ public void testSingleAltAddress() throws Exception {
+ LoadDistributorFeature feature = new LoadDistributorFeature();
+ List<String> alternateAddresses = new ArrayList<String>();
+ alternateAddresses.add(Server.ADDRESS2);
+ SequentialStrategy strategy = new SequentialStrategy();
+ strategy.setAlternateAddresses(alternateAddresses);
+ feature.setStrategy(strategy);
+
+ BookStore bookStore = getBookStore(Server.ADDRESS1, feature);
+ Book book = bookStore.getBook("123");
+ assertEquals("unexpected id", 123L, book.getId());
+
+ book = bookStore.getBook("123");
+ assertEquals("unexpected id", 123L, book.getId());
+ }
+
private FailoverFeature getFeature(String ...address) {
FailoverFeature feature = new FailoverFeature();