cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dk...@apache.org
Subject svn commit: r1088303 - in /cxf/trunk: rt/core/src/main/java/org/apache/cxf/clustering/ rt/core/src/main/java/org/apache/cxf/clustering/spring/ systests/uncategorized/src/test/java/org/apache/cxf/systest/clustering/
Date Sun, 03 Apr 2011 13:54:39 GMT
Author: dkulp
Date: Sun Apr  3 13:54:38 2011
New Revision: 1088303

URL: http://svn.apache.org/viewvc?rev=1088303&view=rev
Log:
[CXF-3424] LoadDistributingConduitSelector
Patch from Jim Talbut applied

Added:
    cxf/trunk/rt/core/src/main/java/org/apache/cxf/clustering/LoadDistributorFeature.java
      - copied, changed from r1087945, cxf/trunk/rt/core/src/main/java/org/apache/cxf/clustering/spring/NamespaceHandler.java
    cxf/trunk/rt/core/src/main/java/org/apache/cxf/clustering/LoadDistributorTargetSelector.java   (with props)
    cxf/trunk/rt/core/src/main/java/org/apache/cxf/clustering/spring/LoadDistributorBeanDefinitionParser.java
      - copied, changed from r1087945, cxf/trunk/rt/core/src/main/java/org/apache/cxf/clustering/spring/NamespaceHandler.java
    cxf/trunk/systests/uncategorized/src/test/java/org/apache/cxf/systest/clustering/LoadDistributorAddressOverrideTest.java   (with props)
    cxf/trunk/systests/uncategorized/src/test/java/org/apache/cxf/systest/clustering/LoadDistributorSequentialStrategy.java   (with props)
    cxf/trunk/systests/uncategorized/src/test/java/org/apache/cxf/systest/clustering/LoadDistributorStaticStrategy.java   (with props)
    cxf/trunk/systests/uncategorized/src/test/java/org/apache/cxf/systest/clustering/LoadDistributorTest.java   (with props)
    cxf/trunk/systests/uncategorized/src/test/java/org/apache/cxf/systest/clustering/load_distributor.xml   (with props)
    cxf/trunk/systests/uncategorized/src/test/java/org/apache/cxf/systest/clustering/load_distributor_address_override.xml   (with props)
Modified:
    cxf/trunk/rt/core/src/main/java/org/apache/cxf/clustering/FailoverTargetSelector.java
    cxf/trunk/rt/core/src/main/java/org/apache/cxf/clustering/spring/NamespaceHandler.java
    cxf/trunk/systests/uncategorized/src/test/java/org/apache/cxf/systest/clustering/FailoverAddressOverrideTest.java
    cxf/trunk/systests/uncategorized/src/test/java/org/apache/cxf/systest/clustering/FailoverTest.java

Modified: cxf/trunk/rt/core/src/main/java/org/apache/cxf/clustering/FailoverTargetSelector.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/core/src/main/java/org/apache/cxf/clustering/FailoverTargetSelector.java?rev=1088303&r1=1088302&r2=1088303&view=diff
==============================================================================
--- cxf/trunk/rt/core/src/main/java/org/apache/cxf/clustering/FailoverTargetSelector.java (original)
+++ cxf/trunk/rt/core/src/main/java/org/apache/cxf/clustering/FailoverTargetSelector.java Sun Apr  3 13:54:38 2011
@@ -41,13 +41,15 @@ import org.apache.cxf.transport.Conduit;
  * Implements a target selection strategy based on failover to an 
  * alternate target endpoint when a transport level failure is 
  * encountered.
+ * Note that this feature changes the conduit on the fly and thus makes
+ * the Client not thread safe.
  */
 public class FailoverTargetSelector extends AbstractConduitSelector {
 
     private static final Logger LOG =
         LogUtils.getL7dLogger(FailoverTargetSelector.class);
-    private Map<InvocationKey, InvocationContext> inProgress;
-    private FailoverStrategy failoverStrategy;
+    protected Map<InvocationKey, InvocationContext> inProgress;
+    protected FailoverStrategy failoverStrategy;
     
     /**
      * Normal constructor.
@@ -101,7 +103,7 @@ public class FailoverTargetSelector exte
     }
 
     /**
-     * Called on completion of the MEP for which the Condit was required.
+     * Called on completion of the MEP for which the Conduit was required.
      * 
      * @param exchange represents the completed MEP
      */
@@ -191,7 +193,7 @@ public class FailoverTargetSelector exte
      * @param exchange the current Exchange
      * @return boolean true if a failover should be attempted
      */
-    private boolean requiresFailover(Exchange exchange) {
+    protected boolean requiresFailover(Exchange exchange) {
         Message outMessage = exchange.getOutMessage();
         Exception ex = outMessage.get(Exception.class) != null
                        ? outMessage.get(Exception.class)
@@ -218,7 +220,7 @@ public class FailoverTargetSelector exte
      * @param invocation the current InvocationContext
      * @return a failover endpoint if one is available
      */
-    private Endpoint getFailoverTarget(Exchange exchange,
+    protected Endpoint getFailoverTarget(Exchange exchange,
                                        InvocationContext invocation) {
         List<String> alternateAddresses = null;
         if (!invocation.hasAlternates()) {
@@ -259,7 +261,7 @@ public class FailoverTargetSelector exte
      * 
      * @param context the request context
      */
-    private void overrideAddressProperty(Map<String, Object> context) {
+    protected void overrideAddressProperty(Map<String, Object> context) {
         Map<String, Object> requestContext =
             CastUtils.cast((Map)context.get(Client.REQUEST_CONTEXT));
         if (requestContext != null) {
@@ -273,10 +275,10 @@ public class FailoverTargetSelector exte
     /**
      * Used to wrap an Exchange for usage as a Map key. The raw Exchange
      * is not a suitable key type, as the hashCode is computed from its
-     * current contents, which may obvioulsy change over the lifetime of
+     * current contents, which may obviously change over the lifetime of
      * an invocation.
      */
-    private static class InvocationKey {
+    protected static class InvocationKey {
         private Exchange exchange;
         
         InvocationKey(Exchange ex) {
@@ -299,7 +301,7 @@ public class FailoverTargetSelector exte
     /**
      * Records the context of an invocation.
      */
-    private class InvocationContext {
+    protected class InvocationContext {
         private Endpoint originalEndpoint;
         private String originalAddress;
         private BindingOperationInfo bindingOperationInfo;

Copied: cxf/trunk/rt/core/src/main/java/org/apache/cxf/clustering/LoadDistributorFeature.java (from r1087945, cxf/trunk/rt/core/src/main/java/org/apache/cxf/clustering/spring/NamespaceHandler.java)
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/core/src/main/java/org/apache/cxf/clustering/LoadDistributorFeature.java?p2=cxf/trunk/rt/core/src/main/java/org/apache/cxf/clustering/LoadDistributorFeature.java&p1=cxf/trunk/rt/core/src/main/java/org/apache/cxf/clustering/spring/NamespaceHandler.java&r1=1087945&r2=1088303&rev=1088303&view=diff
==============================================================================
--- cxf/trunk/rt/core/src/main/java/org/apache/cxf/clustering/spring/NamespaceHandler.java (original)
+++ cxf/trunk/rt/core/src/main/java/org/apache/cxf/clustering/LoadDistributorFeature.java Sun Apr  3 13:54:38 2011
@@ -16,13 +16,28 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-package org.apache.cxf.clustering.spring;
+package org.apache.cxf.clustering;
 
-import org.springframework.beans.factory.xml.NamespaceHandlerSupport;
+import org.apache.cxf.Bus;
+import org.apache.cxf.common.injection.NoJSR250Annotations;
+import org.apache.cxf.endpoint.Client;
 
-public class NamespaceHandler extends NamespaceHandlerSupport {
-    public void init() {
-        registerBeanDefinitionParser("failover",
-                                     new FailoverBeanDefinitionParser());
+/**
+ * This feature may be applied to a Client so as to enable
+ * load distribution amongst a set of target endpoints or addresses
+ * Note that this feature changes the conduit on the fly and thus makes
+ * the Client not thread safe.
+ */
+@NoJSR250Annotations
+public class LoadDistributorFeature extends FailoverFeature {
+
+    @Override
+    public void initialize(Client client, Bus bus) {
+        LoadDistributorTargetSelector selector =
+            new LoadDistributorTargetSelector();
+        selector.setEndpoint(client.getEndpoint());
+        selector.setStrategy(getStrategy());
+        client.setConduitSelector(selector);
     }
+
 }

Added: cxf/trunk/rt/core/src/main/java/org/apache/cxf/clustering/LoadDistributorTargetSelector.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/core/src/main/java/org/apache/cxf/clustering/LoadDistributorTargetSelector.java?rev=1088303&view=auto
==============================================================================
--- cxf/trunk/rt/core/src/main/java/org/apache/cxf/clustering/LoadDistributorTargetSelector.java (added)
+++ cxf/trunk/rt/core/src/main/java/org/apache/cxf/clustering/LoadDistributorTargetSelector.java Sun Apr  3 13:54:38 2011
@@ -0,0 +1,221 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.cxf.clustering;
+
+import java.util.List;
+import java.util.logging.Logger;
+import org.apache.cxf.common.logging.LogUtils;
+import org.apache.cxf.endpoint.Endpoint;
+import org.apache.cxf.message.Exchange;
+import org.apache.cxf.message.Message;
+import org.apache.cxf.transport.Conduit;
+
+/**
+ *
+ * @author jtalbut
+ * 
+ * The LoadDistributorTargetSelector attempts to do the same job as the 
+ * FailoverTargetSelector, but to choose an alternate target on every request
+ * rather than just when a fault occurs.
+ * The LoadDistributorTargetSelector uses the same FailoverStrategy interface as 
+ * the FailoverTargetSelector, but has a few significant limitations:
+ * 1. Because the LoadDistributorTargetSelector needs to maintain a list of targets
+ *    between calls it has to obtain that list without reference to a Message.
+ *    Most FailoverStrategy classes can support this for addresses, but it cannot
+ *    be supported for endpoints.
+ *    If the list of targets cannot be obtained without reference to a Message then
+ *    the list will still be obtained but it will be specific to the Message and thus
+ *    discarded after this message has been processed.  As a consequence, if the
+ *    strategy chosen is a simple sequential one the first item in the list will
+ *    be chosen every time.
+ *    Conclusion: Be aware that if you are working with targets that are 
+ *    dependent on the Message the process will be less efficient and that the
+ *    SequentialStrategy will not distribute the load at all.
+ * 2. The AbstractStaticFailoverStrategy base class excludes the 'default' endpoint
+ *    from the list of alternate endpoints.
+ *    If alternate endpoints (as opposed to alternate addresses) are to be used
+ *    you should probably ensure that your FailoverStrategy overrides getAlternateEndpoints
+ *    and calls getEndpoints with acceptCandidatesWithSameAddress = true.
+ */
+public class LoadDistributorTargetSelector extends FailoverTargetSelector {
+    private static final Logger LOG = LogUtils.getL7dLogger(
+                        LoadDistributorTargetSelector.class);
+    private static final String IS_DISTRIBUTED = 
+            "org.apache.cxf.clustering.LoadDistributorTargetSelector.IS_DISTRIBUTED";
+
+    private List<String> addressList;
+
+    private boolean failover = true;
+
+    /**
+     * Normal constructor.
+     */
+    public LoadDistributorTargetSelector() {
+        this(null);
+    }
+
+    /**
+     * Constructor, allowing a specific conduit to override normal selection.
+     *
+     * @param c specific conduit
+     */
+    public LoadDistributorTargetSelector(Conduit c) {
+        super(c);
+    }
+
+    public boolean isFailover() {
+        return failover;
+    }
+
+    public void setFailover(boolean failover) {
+        this.failover = failover;
+    }
+
+    @Override
+    protected java.util.logging.Logger getLogger() {
+        return LOG;
+    }
+
+    /**
+     * Called when a Conduit is actually required.
+     *
+     * @param message
+     * @return the Conduit to use for mediation of the message
+     */
+    public Conduit selectConduit(Message message) {
+        Exchange exchange = message.getExchange();
+        InvocationKey key = new InvocationKey(exchange);
+        InvocationContext invocation = inProgress.get(key);
+        if ((invocation != null) && !invocation.getContext().containsKey(IS_DISTRIBUTED)) {
+            Endpoint target = getDistributionTarget(exchange, invocation);
+            if (target != null) {
+                setEndpoint(target);
+                if (selectedConduit != null) {
+                    selectedConduit.close();
+                    selectedConduit = null;
+                }
+                message.put(Message.ENDPOINT_ADDRESS, target.getEndpointInfo().getAddress());
+                overrideAddressProperty(invocation.getContext());
+                invocation.getContext().put(IS_DISTRIBUTED, null);
+            }
+        }
+        return getSelectedConduit(message);
+    }
+
+    /**
+     * Get the failover target endpoint, if a suitable one is available.
+     *
+     * @param exchange the current Exchange
+     * @param invocation the current InvocationContext
+     * @return a failover endpoint if one is available
+     * 
+     * Note: The only difference between this and the super implementation is
+     * that the current (failed) address is removed from the list set of alternates,
+     * it could be argued that that change should be in the super implementation
+     * but I'm not sure of the impact.
+     */
+    protected Endpoint getFailoverTarget(Exchange exchange,
+                                       InvocationContext invocation) {
+        List<String> alternateAddresses = null;
+        if (!invocation.hasAlternates()) {
+            // no previous failover attempt on this invocation
+            //
+            alternateAddresses = 
+                getStrategy().getAlternateAddresses(exchange);
+            if (alternateAddresses != null) {
+                alternateAddresses.remove(exchange.getEndpoint().getEndpointInfo().getAddress());
+                invocation.setAlternateAddresses(alternateAddresses);
+            } else {
+                invocation.setAlternateEndpoints(
+                    getStrategy().getAlternateEndpoints(exchange));
+            }
+        } else {
+            alternateAddresses = invocation.getAlternateAddresses();
+        }
+
+        Endpoint failoverTarget = null;
+        if (alternateAddresses != null) {
+            String alternateAddress = 
+                getStrategy().selectAlternateAddress(alternateAddresses);
+            if (alternateAddress != null) {
+                // re-use current endpoint
+                //
+                failoverTarget = getEndpoint();
+
+                failoverTarget.getEndpointInfo().setAddress(alternateAddress);
+            }
+        } else {
+            failoverTarget = getStrategy().selectAlternateEndpoint(
+                                 invocation.getAlternateEndpoints());
+        }
+        return failoverTarget;
+    }
+
+    /**
+     * Get the distribution target endpoint, if a suitable one is available.
+     *
+     * @param exchange the current Exchange
+     * @param invocation the current InvocationContext
+     * @return a distribution endpoint if one is available
+     */
+    private Endpoint getDistributionTarget(Exchange exchange,
+                                           InvocationContext invocation) {
+        List<String> alternateAddresses = null;
+        if ((addressList == null) || (addressList.isEmpty())) {
+            try {
+                addressList = getStrategy().getAlternateAddresses(null);
+            } catch (NullPointerException ex) {
+                getLogger().fine("Strategy " + getStrategy().getClass()
+                        + " cannot handle a null argument to getAlternateAddresses: " + ex.toString());
+            }
+        }
+        alternateAddresses = addressList;
+
+        if ((alternateAddresses == null) || (alternateAddresses.isEmpty())) {
+            alternateAddresses = getStrategy().getAlternateAddresses(exchange);
+            if (alternateAddresses != null) {
+                invocation.setAlternateAddresses(alternateAddresses);
+            } else {
+                invocation.setAlternateEndpoints(
+                    getStrategy().getAlternateEndpoints(exchange));
+            }
+        }
+
+        Endpoint distributionTarget = null;
+        if ((alternateAddresses != null) && !alternateAddresses.isEmpty()) {
+            String alternateAddress =
+                getStrategy().selectAlternateAddress(alternateAddresses);
+            if (alternateAddress != null) {
+                // re-use current endpoint
+                distributionTarget = getEndpoint();
+                distributionTarget.getEndpointInfo().setAddress(alternateAddress);
+            }
+        } else {
+            distributionTarget = getStrategy().selectAlternateEndpoint(
+                                 invocation.getAlternateEndpoints());
+        }
+        return distributionTarget;
+    }
+
+    @Override
+    protected boolean requiresFailover(Exchange exchange) {
+        return failover && super.requiresFailover(exchange);
+    }
+
+}

Propchange: cxf/trunk/rt/core/src/main/java/org/apache/cxf/clustering/LoadDistributorTargetSelector.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: cxf/trunk/rt/core/src/main/java/org/apache/cxf/clustering/LoadDistributorTargetSelector.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Copied: cxf/trunk/rt/core/src/main/java/org/apache/cxf/clustering/spring/LoadDistributorBeanDefinitionParser.java (from r1087945, cxf/trunk/rt/core/src/main/java/org/apache/cxf/clustering/spring/NamespaceHandler.java)
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/core/src/main/java/org/apache/cxf/clustering/spring/LoadDistributorBeanDefinitionParser.java?p2=cxf/trunk/rt/core/src/main/java/org/apache/cxf/clustering/spring/LoadDistributorBeanDefinitionParser.java&p1=cxf/trunk/rt/core/src/main/java/org/apache/cxf/clustering/spring/NamespaceHandler.java&r1=1087945&r2=1088303&rev=1088303&view=diff
==============================================================================
--- cxf/trunk/rt/core/src/main/java/org/apache/cxf/clustering/spring/NamespaceHandler.java (original)
+++ cxf/trunk/rt/core/src/main/java/org/apache/cxf/clustering/spring/LoadDistributorBeanDefinitionParser.java Sun Apr  3 13:54:38 2011
@@ -18,11 +18,22 @@
  */
 package org.apache.cxf.clustering.spring;
 
-import org.springframework.beans.factory.xml.NamespaceHandlerSupport;
+import org.w3c.dom.Element;
 
-public class NamespaceHandler extends NamespaceHandlerSupport {
-    public void init() {
-        registerBeanDefinitionParser("failover",
-                                     new FailoverBeanDefinitionParser());
+import org.apache.cxf.clustering.LoadDistributorFeature;
+import org.apache.cxf.configuration.spring.AbstractBeanDefinitionParser;
+import org.springframework.beans.factory.support.BeanDefinitionBuilder;
+import org.springframework.beans.factory.xml.ParserContext;
+
+public class LoadDistributorBeanDefinitionParser extends AbstractBeanDefinitionParser {
+
+    @Override
+    protected Class getBeanClass(Element element) {
+        return LoadDistributorFeature.class;
+    }
+ 
+    @Override
+    protected void mapElement(ParserContext ctx, BeanDefinitionBuilder bean, Element e, String name) {
+        setFirstChildAsProperty(e, ctx, bean, name);
     }
 }

Modified: cxf/trunk/rt/core/src/main/java/org/apache/cxf/clustering/spring/NamespaceHandler.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/core/src/main/java/org/apache/cxf/clustering/spring/NamespaceHandler.java?rev=1088303&r1=1088302&r2=1088303&view=diff
==============================================================================
--- cxf/trunk/rt/core/src/main/java/org/apache/cxf/clustering/spring/NamespaceHandler.java (original)
+++ cxf/trunk/rt/core/src/main/java/org/apache/cxf/clustering/spring/NamespaceHandler.java Sun Apr  3 13:54:38 2011
@@ -24,5 +24,7 @@ public class NamespaceHandler extends Na
     public void init() {
         registerBeanDefinitionParser("failover",
                                      new FailoverBeanDefinitionParser());
+        registerBeanDefinitionParser("loadDistributor",
+                                     new LoadDistributorBeanDefinitionParser());
     }
 }

Modified: cxf/trunk/systests/uncategorized/src/test/java/org/apache/cxf/systest/clustering/FailoverAddressOverrideTest.java
URL: http://svn.apache.org/viewvc/cxf/trunk/systests/uncategorized/src/test/java/org/apache/cxf/systest/clustering/FailoverAddressOverrideTest.java?rev=1088303&r1=1088302&r2=1088303&view=diff
==============================================================================
--- cxf/trunk/systests/uncategorized/src/test/java/org/apache/cxf/systest/clustering/FailoverAddressOverrideTest.java (original)
+++ cxf/trunk/systests/uncategorized/src/test/java/org/apache/cxf/systest/clustering/FailoverAddressOverrideTest.java Sun Apr  3 13:54:38 2011
@@ -63,14 +63,14 @@ public class FailoverAddressOverrideTest
     protected static final String REPLICA_D =
         "http://localhost:9054/SoapContext/ReplicatedPortD"; 
     private static final Logger LOG =
-        LogUtils.getLogger(FailoverTest.class);
+        LogUtils.getLogger(FailoverAddressOverrideTest.class);
     private static final String FAILOVER_CONFIG =
         "org/apache/cxf/systest/clustering/failover_address_override.xml";
 
-    private Bus bus;
+    protected Bus bus;
+    protected Greeter greeter;
+    protected List<String> targets;
     private Control control;
-    private Greeter greeter;
-    private List<String> targets;
     private MAPAggregator mapAggregator;
     private MAPCodec mapCodec;
 
@@ -80,12 +80,16 @@ public class FailoverAddressOverrideTest
         assertTrue("server did not launch correctly",
                    launchServer(Server.class));
     }
+    
+    protected String getConfig() {
+        return FAILOVER_CONFIG;
+    }
             
     @Before
     public void setUp() {
         targets = new ArrayList<String>();
         SpringBusFactory bf = new SpringBusFactory();    
-        bus = bf.createBus(FAILOVER_CONFIG);
+        bus = bf.createBus(getConfig());
         BusFactory.setDefaultBus(bus);
     }
     
@@ -152,7 +156,7 @@ public class FailoverAddressOverrideTest
     }
     
 
-    private void startTarget(String address) {
+    protected void startTarget(String address) {
         ControlService cs = new ControlService();
         control = cs.getControlPort();
 
@@ -162,7 +166,7 @@ public class FailoverAddressOverrideTest
         targets.add(address);
     }
     
-    private void stopTarget(String address) {
+    protected void stopTarget(String address) {
         if (control != null
             && targets.contains(address)) {
             LOG.info("starting replicated target: " + address);
@@ -171,38 +175,38 @@ public class FailoverAddressOverrideTest
         }
     }
 
-    private void verifyCurrentEndpoint(String replica) {
+    protected void verifyCurrentEndpoint(String replica) {
         assertEquals("unexpected current endpoint",
                      replica,
                      getCurrentEndpoint(greeter));
     }
     
-    private String getCurrentEndpoint(Object proxy) {
+    protected String getCurrentEndpoint(Object proxy) {
         return ClientProxy.getClient(proxy).getEndpoint().getEndpointInfo().getAddress();
     }
     
-    private void setupGreeterA() {
+    protected void setupGreeterA() {
         greeter = new ClusteredGreeterService().getReplicatedPortA();
         verifyConduitSelector(greeter);
     }
 
-    private void setupGreeterB() {
+    protected void setupGreeterB() {
         greeter = new ClusteredGreeterService().getReplicatedPortB();
         verifyConduitSelector(greeter);
     }
 
-    private void setupGreeterC() {
+    protected void setupGreeterC() {
         greeter = new ClusteredGreeterService().getReplicatedPortC();
         verifyConduitSelector(greeter);
     }
         
-    private void verifyConduitSelector(Greeter g) {
+    protected void verifyConduitSelector(Greeter g) {
         assertTrue("unexpected conduit slector",
                    ClientProxy.getClient(g).getConduitSelector()
                    instanceof FailoverTargetSelector);
     }
 
-    private void verifyStrategy(Object proxy, Class clz, int count) {
+    protected void verifyStrategy(Object proxy, Class clz, int count) {
         ConduitSelector conduitSelector =
             ClientProxy.getClient(proxy).getConduitSelector();
         if (conduitSelector instanceof FailoverTargetSelector) {

Modified: cxf/trunk/systests/uncategorized/src/test/java/org/apache/cxf/systest/clustering/FailoverTest.java
URL: http://svn.apache.org/viewvc/cxf/trunk/systests/uncategorized/src/test/java/org/apache/cxf/systest/clustering/FailoverTest.java?rev=1088303&r1=1088302&r2=1088303&view=diff
==============================================================================
--- cxf/trunk/systests/uncategorized/src/test/java/org/apache/cxf/systest/clustering/FailoverTest.java (original)
+++ cxf/trunk/systests/uncategorized/src/test/java/org/apache/cxf/systest/clustering/FailoverTest.java Sun Apr  3 13:54:38 2011
@@ -67,10 +67,10 @@ public class FailoverTest extends Abstra
     private static final String FAILOVER_CONFIG =
         "org/apache/cxf/systest/clustering/failover.xml";
 
-    private Bus bus;
-    private Control control;
-    private Greeter greeter;
-    private List<String> targets;
+    protected Bus bus;
+    protected Greeter greeter;
+    protected List<String> targets;
+    protected Control control;
     private MAPAggregator mapAggregator;
     private MAPCodec mapCodec;
 
@@ -81,11 +81,15 @@ public class FailoverTest extends Abstra
                    launchServer(Server.class));
     }
             
+    protected String getConfig() {
+        return FAILOVER_CONFIG;
+    }
+    
     @Before
     public void setUp() {
         targets = new ArrayList<String>();
         SpringBusFactory bf = new SpringBusFactory();    
-        bus = bf.createBus(FAILOVER_CONFIG);
+        bus = bf.createBus(getConfig());
         BusFactory.setDefaultBus(bus);
     }
     
@@ -296,7 +300,7 @@ public class FailoverTest extends Abstra
         strategyTest(REPLICA_A, REPLICA_B, REPLICA_C, true);
     }
     
-    private void strategyTest(String activeReplica1,
+    protected void strategyTest(String activeReplica1,
                               String activeReplica2,
                               String inactiveReplica,
                               boolean expectRandom) {
@@ -328,7 +332,7 @@ public class FailoverTest extends Abstra
                      randomized);
     }
 
-    private void startTarget(String address) {
+    protected void startTarget(String address) {
         ControlService cs = new ControlService();
         control = cs.getControlPort();
 
@@ -337,7 +341,7 @@ public class FailoverTest extends Abstra
         targets.add(address);
     }
     
-    private void stopTarget(String address) {
+    protected void stopTarget(String address) {
         if (control != null
             && targets.contains(address)) {
             LOG.info("starting replicated target: " + address);
@@ -346,17 +350,17 @@ public class FailoverTest extends Abstra
         }
     }
 
-    private void verifyCurrentEndpoint(String replica) {
+    protected void verifyCurrentEndpoint(String replica) {
         assertEquals("unexpected current endpoint",
                      replica,
                      getCurrentEndpoint(greeter));
     }
     
-    private String getCurrentEndpoint(Object proxy) {
+    protected String getCurrentEndpoint(Object proxy) {
         return ClientProxy.getClient(proxy).getEndpoint().getEndpointInfo().getAddress();
     }
     
-    private void setupGreeter() {
+    protected void setupGreeter() {
         ClusteredGreeterService cs = new ClusteredGreeterService();
         // REVISIT: why doesn't the generic (i.e. non-Port-specific)
         // Service.getPort() load the <jaxws:client> configuration?
@@ -367,7 +371,7 @@ public class FailoverTest extends Abstra
                    instanceof FailoverTargetSelector);
     }
         
-    private void verifyStrategy(Object proxy, Class clz) {
+    protected void verifyStrategy(Object proxy, Class clz) {
         ConduitSelector conduitSelector =
             ClientProxy.getClient(proxy).getConduitSelector();
         if (conduitSelector instanceof FailoverTargetSelector) {

Added: cxf/trunk/systests/uncategorized/src/test/java/org/apache/cxf/systest/clustering/LoadDistributorAddressOverrideTest.java
URL: http://svn.apache.org/viewvc/cxf/trunk/systests/uncategorized/src/test/java/org/apache/cxf/systest/clustering/LoadDistributorAddressOverrideTest.java?rev=1088303&view=auto
==============================================================================
--- cxf/trunk/systests/uncategorized/src/test/java/org/apache/cxf/systest/clustering/LoadDistributorAddressOverrideTest.java (added)
+++ cxf/trunk/systests/uncategorized/src/test/java/org/apache/cxf/systest/clustering/LoadDistributorAddressOverrideTest.java Sun Apr  3 13:54:38 2011
@@ -0,0 +1,142 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.cxf.systest.clustering;
+
+import java.util.HashMap;
+import java.util.Map;
+import javax.xml.ws.WebServiceException;
+import org.apache.cxf.clustering.LoadDistributorTargetSelector;
+
+import org.apache.cxf.clustering.SequentialStrategy;
+import org.apache.cxf.endpoint.ConduitSelector;
+import org.apache.cxf.frontend.ClientProxy;
+
+import org.junit.Test;
+
+/**
+ *
+ * @author jtalbut
+ */
+public class LoadDistributorAddressOverrideTest  extends FailoverAddressOverrideTest {
+    private static final String FAILOVER_CONFIG =
+        "org/apache/cxf/systest/clustering/load_distributor_address_override.xml";
+
+    @Override
+    protected String getConfig() {
+        return FAILOVER_CONFIG;
+    }
+    
+    private String responseFrom(String response) {
+        if (response.endsWith(REPLICA_A)) {
+            return REPLICA_A;
+        } else if (response.endsWith(REPLICA_B)) {
+            return REPLICA_B;
+        } else if (response.endsWith(REPLICA_C)) {
+            return REPLICA_C;
+        } else {
+            return response;
+        }
+    }
+    
+    private void incrementResponseCount(Map< String, Integer > responseCounts
+            , String response) {
+        String responder = responseFrom(response);
+        Integer currentCount = responseCounts.get(responder);
+        responseCounts.put(responder, 1 + (currentCount == null ? 0 : currentCount));
+    }
+
+    @Test
+    public void testDistributedSequentialStrategy() throws Exception {
+        startTarget(REPLICA_A);
+        startTarget(REPLICA_B);
+        startTarget(REPLICA_C);
+        setupGreeterA();
+        verifyStrategy(greeter, SequentialStrategy.class, 3);
+        Map< String, Integer > responseCounts = new HashMap< String, Integer >();
+        for (int i = 0; i < 12; ++i) {
+            String response = greeter.greetMe("fred");
+            assertNotNull("expected non-null response", response);
+            incrementResponseCount(responseCounts, response);
+        }
+        assertEquals(4, (long)responseCounts.get(REPLICA_A));
+        assertEquals(4, (long)responseCounts.get(REPLICA_B));
+        assertEquals(4, (long)responseCounts.get(REPLICA_C));
+        verifyCurrentEndpoint(REPLICA_C);
+        stopTarget(REPLICA_A);
+        stopTarget(REPLICA_B);
+        stopTarget(REPLICA_C);
+    }
+    
+    @Test
+    public void testDistributedSequentialStrategyWithFailover() throws Exception {
+        startTarget(REPLICA_A);
+        startTarget(REPLICA_C);
+        setupGreeterA();
+        verifyStrategy(greeter, SequentialStrategy.class, 3);
+        Map< String, Integer > responseCounts = new HashMap< String, Integer >();
+        for (int i = 0; i < 12; ++i) {
+            String response = greeter.greetMe("fred");
+            assertNotNull("expected non-null response", response);
+            incrementResponseCount(responseCounts, response);
+        }
+        // Note that when failover occurs the address list is requeried
+        // so SequentialStrategy it starts again from the beginning
+        // (the failed address is removed from the returned list, if it's there).
+        assertEquals(8, (long)responseCounts.get(REPLICA_A));
+        assertEquals(null, responseCounts.get(REPLICA_B));
+        assertEquals(4, (long)responseCounts.get(REPLICA_C));
+        verifyCurrentEndpoint(REPLICA_C);
+        stopTarget(REPLICA_A);
+        stopTarget(REPLICA_C);
+    }
+    
+    @Test
+    public void testDistributedSequentialStrategyWithoutFailover() throws Exception {
+        startTarget(REPLICA_A);
+        startTarget(REPLICA_C);
+        setupGreeterA();
+        verifyStrategy(greeter, SequentialStrategy.class, 3);
+        ConduitSelector conduitSelector =
+            ClientProxy.getClient(greeter).getConduitSelector();
+        if (conduitSelector instanceof LoadDistributorTargetSelector) {
+            ((LoadDistributorTargetSelector)conduitSelector).setFailover(false);
+        } else {
+            fail("unexpected conduit selector: " + conduitSelector);
+        }
+        
+        Map< String, Integer > responseCounts = new HashMap< String, Integer >();
+        for (int i = 0; i < 12; ++i) {
+            try {
+                String response = greeter.greetMe("fred");
+                assertNotNull("expected non-null response", response);
+                incrementResponseCount(responseCounts, response);
+            } catch (WebServiceException ex) {
+                incrementResponseCount(responseCounts, "");
+            }
+        }
+        assertEquals(4, (long)responseCounts.get(REPLICA_A));
+        assertEquals(null, responseCounts.get(REPLICA_B));
+        assertEquals(4, (long)responseCounts.get(REPLICA_C));
+        assertEquals(4, (long)responseCounts.get(""));
+        verifyCurrentEndpoint(REPLICA_C);
+        stopTarget(REPLICA_A);
+        stopTarget(REPLICA_C);
+    }
+}

Propchange: cxf/trunk/systests/uncategorized/src/test/java/org/apache/cxf/systest/clustering/LoadDistributorAddressOverrideTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: cxf/trunk/systests/uncategorized/src/test/java/org/apache/cxf/systest/clustering/LoadDistributorAddressOverrideTest.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: cxf/trunk/systests/uncategorized/src/test/java/org/apache/cxf/systest/clustering/LoadDistributorSequentialStrategy.java
URL: http://svn.apache.org/viewvc/cxf/trunk/systests/uncategorized/src/test/java/org/apache/cxf/systest/clustering/LoadDistributorSequentialStrategy.java?rev=1088303&view=auto
==============================================================================
--- cxf/trunk/systests/uncategorized/src/test/java/org/apache/cxf/systest/clustering/LoadDistributorSequentialStrategy.java (added)
+++ cxf/trunk/systests/uncategorized/src/test/java/org/apache/cxf/systest/clustering/LoadDistributorSequentialStrategy.java Sun Apr  3 13:54:38 2011
@@ -0,0 +1,57 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.cxf.systest.clustering;
+
+import java.util.List;
+import org.apache.cxf.clustering.SequentialStrategy;
+import org.apache.cxf.endpoint.Endpoint;
+import org.apache.cxf.message.Exchange;
+
+/**
+ *
+ * @author jtalbut
+ */
+public class LoadDistributorSequentialStrategy extends SequentialStrategy {
+
+    @Override
+    public List<Endpoint> getAlternateEndpoints(Exchange exchange) {
+
+        // Get the list of endpoints, including the current one.
+        // This part is required for most FailoverStrategys that provide alternate 
+        // target endpoints for the LoadDistributorTargetSelector.
+        List<Endpoint> alternateEndpoints = getEndpoints(exchange, true);
+        
+        // Put the original endpoint at the head of the list
+        // This is only required if the client wants to always try one endpoint first,
+        // which is not typically desired for a load distributed configuration
+        // (but is required by one of the unit tests)        
+        Endpoint endpoint = exchange.get(Endpoint.class);
+        String defaultAddress = endpoint.getEndpointInfo().getAddress();
+        for (Endpoint alternate : alternateEndpoints) {            
+            if (defaultAddress.equals(alternate.getEndpointInfo().getAddress())) {
+                alternateEndpoints.remove(alternate);
+                alternateEndpoints.add(0, alternate);
+                break;
+            }
+        }
+        
+        return alternateEndpoints;
+    }
+}

Propchange: cxf/trunk/systests/uncategorized/src/test/java/org/apache/cxf/systest/clustering/LoadDistributorSequentialStrategy.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: cxf/trunk/systests/uncategorized/src/test/java/org/apache/cxf/systest/clustering/LoadDistributorSequentialStrategy.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: cxf/trunk/systests/uncategorized/src/test/java/org/apache/cxf/systest/clustering/LoadDistributorStaticStrategy.java
URL: http://svn.apache.org/viewvc/cxf/trunk/systests/uncategorized/src/test/java/org/apache/cxf/systest/clustering/LoadDistributorStaticStrategy.java?rev=1088303&view=auto
==============================================================================
--- cxf/trunk/systests/uncategorized/src/test/java/org/apache/cxf/systest/clustering/LoadDistributorStaticStrategy.java (added)
+++ cxf/trunk/systests/uncategorized/src/test/java/org/apache/cxf/systest/clustering/LoadDistributorStaticStrategy.java Sun Apr  3 13:54:38 2011
@@ -0,0 +1,55 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.cxf.systest.clustering;
+
+import java.util.List;
+import org.apache.cxf.clustering.SequentialStrategy;
+import org.apache.cxf.endpoint.Endpoint;
+import org.apache.cxf.message.Exchange;
+
+/**
+ *
+ * @author jtalbut
+ */
+public class LoadDistributorStaticStrategy extends SequentialStrategy {
+
+    private int index;
+    
+    @Override
+    public List<Endpoint> getAlternateEndpoints(Exchange exchange) {
+
+        // Get the list of endpoints, including the current one.
+        // This part is required for most FailoverStrategys that provide alternate 
+        // target endpoints for the LoadDistributorTargetSelector.
+        List<Endpoint> alternateEndpoints = getEndpoints(exchange, true);
+        
+        return alternateEndpoints;
+    }
+    
+    @Override
+    protected <T> T getNextAlternate(List<T> alternates) {
+        // Iterate through the list of endpoints even though that list is
+        // regenerated before each call.
+        // FailoverStrategys that provide alternate target endpoints must either
+        // maintain state like this or choose a random entry.
+        return alternates.remove(index++ % alternates.size());
+    }
+
+}

Propchange: cxf/trunk/systests/uncategorized/src/test/java/org/apache/cxf/systest/clustering/LoadDistributorStaticStrategy.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: cxf/trunk/systests/uncategorized/src/test/java/org/apache/cxf/systest/clustering/LoadDistributorStaticStrategy.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: cxf/trunk/systests/uncategorized/src/test/java/org/apache/cxf/systest/clustering/LoadDistributorTest.java
URL: http://svn.apache.org/viewvc/cxf/trunk/systests/uncategorized/src/test/java/org/apache/cxf/systest/clustering/LoadDistributorTest.java?rev=1088303&view=auto
==============================================================================
--- cxf/trunk/systests/uncategorized/src/test/java/org/apache/cxf/systest/clustering/LoadDistributorTest.java (added)
+++ cxf/trunk/systests/uncategorized/src/test/java/org/apache/cxf/systest/clustering/LoadDistributorTest.java Sun Apr  3 13:54:38 2011
@@ -0,0 +1,170 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.cxf.systest.clustering;
+
+import java.util.HashMap;
+import java.util.Map;
+import javax.xml.ws.WebServiceException;
+import org.apache.cxf.clustering.LoadDistributorTargetSelector;
+import org.apache.cxf.endpoint.ConduitSelector;
+import org.apache.cxf.frontend.ClientProxy;
+import org.junit.Test;
+
+
+/**
+ * Tests load distribution within a static cluster.
+ */
+public class LoadDistributorTest extends FailoverTest {
+
+    private static final String FAILOVER_CONFIG =
+        "org/apache/cxf/systest/clustering/load_distributor.xml";
+
+    protected String getConfig() {
+        return FAILOVER_CONFIG;
+    }
+
+    private String responseFrom(String response) {
+        if (response.endsWith(REPLICA_A)) {
+            return REPLICA_A;
+        } else if (response.endsWith(REPLICA_B)) {
+            return REPLICA_B;
+        } else if (response.endsWith(REPLICA_C)) {
+            return REPLICA_C;
+        } else {
+            return response;
+        }
+    }
+    
+    private void incrementResponseCount(Map< String, Integer > responseCounts
+            , String response) {
+        String responder = responseFrom(response);
+        Integer currentCount = responseCounts.get(responder);
+        responseCounts.put(responder, 1 + (currentCount == null ? 0 : currentCount));
+    }
+
+    /*
+     * This test can't be left to super because the distributor ignores the default
+     * endpoint, so we need to get REPLICA_A added to the list of endpoints.
+     */
+    @Test
+    @Override
+    public void testRevertExceptionOnUnsucessfulFailover() throws Exception {
+        targets.add(REPLICA_A);
+        super.testRevertExceptionOnUnsucessfulFailover();
+        
+    }
+    
+    @Test
+    public void testDistributedSequentialStrategy() throws Exception {
+        startTarget(REPLICA_A);
+        startTarget(REPLICA_B);
+        startTarget(REPLICA_C);
+        setupGreeter();
+
+        // Change the strategy to iterate through the endpoints
+        ConduitSelector conduitSelector =
+            ClientProxy.getClient(greeter).getConduitSelector();
+        if (conduitSelector instanceof LoadDistributorTargetSelector) {
+            ((LoadDistributorTargetSelector)conduitSelector).setStrategy(
+                    new LoadDistributorStaticStrategy());
+        } else {
+            fail("unexpected conduit selector: " + conduitSelector);
+        }
+        
+        
+        Map< String, Integer > responseCounts = new HashMap< String, Integer >();
+        for (int i = 0; i < 12; ++i) {
+            String response = greeter.greetMe("fred");
+            assertNotNull("expected non-null response", response);
+            incrementResponseCount(responseCounts, response);
+        }
+        assertEquals(4, (long)responseCounts.get(REPLICA_A));
+        assertEquals(4, (long)responseCounts.get(REPLICA_B));
+        assertEquals(4, (long)responseCounts.get(REPLICA_C));
+        stopTarget(REPLICA_A);
+        stopTarget(REPLICA_B);
+        stopTarget(REPLICA_C);
+    }
+    
+    @Test
+    public void testDistributedSequentialStrategyWithFailover() throws Exception {
+        startTarget(REPLICA_A);
+        startTarget(REPLICA_B);
+        startTarget(REPLICA_C);
+        setupGreeter();
+        stopTarget(REPLICA_B);
+        ConduitSelector conduitSelector =
+            ClientProxy.getClient(greeter).getConduitSelector();
+        if (conduitSelector instanceof LoadDistributorTargetSelector) {
+            ((LoadDistributorTargetSelector)conduitSelector).setStrategy(
+                    new LoadDistributorStaticStrategy());
+        } else {
+            fail("unexpected conduit selector: " + conduitSelector);
+        }
+        Map< String, Integer > responseCounts = new HashMap< String, Integer >();
+        for (int i = 0; i < 12; ++i) {
+            String response = greeter.greetMe("fred");
+            assertNotNull("expected non-null response", response);
+            incrementResponseCount(responseCounts, response);
+        }
+        assertTrue((long)responseCounts.get(REPLICA_A) > 0);
+        assertTrue((long)responseCounts.get(REPLICA_C) > 0);
+        assertEquals(12, responseCounts.get(REPLICA_A) + responseCounts.get(REPLICA_C));
+        stopTarget(REPLICA_A);
+        stopTarget(REPLICA_C);
+    }
+    
+    @Test
+    public void testDistributedSequentialStrategyWithoutFailover() throws Exception {
+        startTarget(REPLICA_A);
+        startTarget(REPLICA_B);
+        startTarget(REPLICA_C);
+        setupGreeter();
+        stopTarget(REPLICA_B);
+        ConduitSelector conduitSelector =
+            ClientProxy.getClient(greeter).getConduitSelector();
+        if (conduitSelector instanceof LoadDistributorTargetSelector) {
+            ((LoadDistributorTargetSelector)conduitSelector).setStrategy(
+                    new LoadDistributorStaticStrategy());
+            ((LoadDistributorTargetSelector)conduitSelector).setFailover(false);
+        } else {
+            fail("unexpected conduit selector: " + conduitSelector);
+        }
+        
+        Map< String, Integer > responseCounts = new HashMap< String, Integer >();
+        for (int i = 0; i < 12; ++i) {
+            try {
+                String response = greeter.greetMe("fred");
+                assertNotNull("expected non-null response", response);
+                incrementResponseCount(responseCounts, response);
+            } catch (WebServiceException ex) {
+                incrementResponseCount(responseCounts, "");
+            }
+        }
+        assertEquals(4, (long)responseCounts.get(REPLICA_A));
+        assertEquals(null, responseCounts.get(REPLICA_B));
+        assertEquals(4, (long)responseCounts.get(REPLICA_C));
+        assertEquals(4, (long)responseCounts.get(""));
+        stopTarget(REPLICA_A);
+        stopTarget(REPLICA_C);
+    }
+    
+    
+}

Propchange: cxf/trunk/systests/uncategorized/src/test/java/org/apache/cxf/systest/clustering/LoadDistributorTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: cxf/trunk/systests/uncategorized/src/test/java/org/apache/cxf/systest/clustering/LoadDistributorTest.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: cxf/trunk/systests/uncategorized/src/test/java/org/apache/cxf/systest/clustering/load_distributor.xml
URL: http://svn.apache.org/viewvc/cxf/trunk/systests/uncategorized/src/test/java/org/apache/cxf/systest/clustering/load_distributor.xml?rev=1088303&view=auto
==============================================================================
--- cxf/trunk/systests/uncategorized/src/test/java/org/apache/cxf/systest/clustering/load_distributor.xml (added)
+++ cxf/trunk/systests/uncategorized/src/test/java/org/apache/cxf/systest/clustering/load_distributor.xml Sun Apr  3 13:54:38 2011
@@ -0,0 +1,64 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  Licensed to the Apache Software Foundation (ASF) under one
+  or more contributor license agreements. See the NOTICE file
+  distributed with this work for additional information
+  regarding copyright ownership. The ASF licenses this file
+  to you under the Apache License, Version 2.0 (the
+  "License"); you may not use this file except in compliance
+  with the License. You may obtain a copy of the License at
+ 
+  http://www.apache.org/licenses/LICENSE-2.0
+ 
+  Unless required by applicable law or agreed to in writing,
+  software distributed under the License is distributed on an
+  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+  KIND, either express or implied. See the License for the
+  specific language governing permissions and limitations
+  under the License.
+-->
+<beans xmlns="http://www.springframework.org/schema/beans"
+       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+       xmlns:jaxws="http://cxf.apache.org/jaxws"
+       xmlns:clustering="http://cxf.apache.org/clustering"
+       xsi:schemaLocation="
+http://cxf.apache.org/jaxws http://cxf.apache.org/schemas/jaxws.xsd
+http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd">
+    
+    <bean id="Sequential" class="org.apache.cxf.systest.clustering.LoadDistributorSequentialStrategy"/>
+    <bean id="Random" class="org.apache.cxf.clustering.RandomStrategy"/>
+    
+    <jaxws:client name="{http://cxf.apache.org/greeter_control}ReplicatedPortA"
+                  createdFromAPI="true">
+        <jaxws:features>
+            <clustering:loadDistributor>
+                <clustering:strategy>
+                    <ref bean="Sequential"/>
+                </clustering:strategy>
+            </clustering:loadDistributor>
+        </jaxws:features>
+    </jaxws:client>
+
+    <jaxws:client name="{http://cxf.apache.org/greeter_control}ReplicatedPortB"
+                  createdFromAPI="true">
+        <jaxws:features>
+            <clustering:loadDistributor>
+                <clustering:strategy>
+                    <ref bean="Sequential"/>
+                </clustering:strategy>
+            </clustering:loadDistributor>
+        </jaxws:features>
+    </jaxws:client>
+
+    <jaxws:client name="{http://cxf.apache.org/greeter_control}ReplicatedPortC"
+                  createdFromAPI="true">
+        <jaxws:features>
+            <clustering:loadDistributor>
+                <clustering:strategy>
+                    <ref bean="Random"/>
+                </clustering:strategy>
+            </clustering:loadDistributor>
+        </jaxws:features>
+    </jaxws:client>
+    
+</beans>

Propchange: cxf/trunk/systests/uncategorized/src/test/java/org/apache/cxf/systest/clustering/load_distributor.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: cxf/trunk/systests/uncategorized/src/test/java/org/apache/cxf/systest/clustering/load_distributor.xml
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Propchange: cxf/trunk/systests/uncategorized/src/test/java/org/apache/cxf/systest/clustering/load_distributor.xml
------------------------------------------------------------------------------
    svn:mime-type = text/xml

Added: cxf/trunk/systests/uncategorized/src/test/java/org/apache/cxf/systest/clustering/load_distributor_address_override.xml
URL: http://svn.apache.org/viewvc/cxf/trunk/systests/uncategorized/src/test/java/org/apache/cxf/systest/clustering/load_distributor_address_override.xml?rev=1088303&view=auto
==============================================================================
--- cxf/trunk/systests/uncategorized/src/test/java/org/apache/cxf/systest/clustering/load_distributor_address_override.xml (added)
+++ cxf/trunk/systests/uncategorized/src/test/java/org/apache/cxf/systest/clustering/load_distributor_address_override.xml Sun Apr  3 13:54:38 2011
@@ -0,0 +1,91 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  Licensed to the Apache Software Foundation (ASF) under one
+  or more contributor license agreements. See the NOTICE file
+  distributed with this work for additional information
+  regarding copyright ownership. The ASF licenses this file
+  to you under the Apache License, Version 2.0 (the
+  "License"); you may not use this file except in compliance
+  with the License. You may obtain a copy of the License at
+ 
+  http://www.apache.org/licenses/LICENSE-2.0
+ 
+  Unless required by applicable law or agreed to in writing,
+  software distributed under the License is distributed on an
+  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+  KIND, either express or implied. See the License for the
+  specific language governing permissions and limitations
+  under the License.
+-->
+<beans xmlns="http://www.springframework.org/schema/beans"
+       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+       xmlns:jaxws="http://cxf.apache.org/jaxws"
+       xmlns:clustering="http://cxf.apache.org/clustering"
+       xmlns:util="http://www.springframework.org/schema/util"
+       xsi:schemaLocation="
+http://cxf.apache.org/jaxws http://cxf.apache.org/schemas/jaxws.xsd
+http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
+http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util.xsd">
+    
+    <util:list id="addressList">
+        <value>http://localhost:9051/SoapContext/ReplicatedPortA</value>
+        <value>http://localhost:9052/SoapContext/ReplicatedPortB</value>
+        <value>http://localhost:9053/SoapContext/ReplicatedPortC</value>
+    </util:list>
+
+    <bean id="SequentialAddresses" class="org.apache.cxf.clustering.SequentialStrategy">
+        <property name="alternateAddresses">
+            <ref bean="addressList"/>
+        </property>
+    </bean>
+
+    <bean id="RandomAddresses" class="org.apache.cxf.clustering.RandomStrategy">
+        <property name="alternateAddresses">
+            <ref bean="addressList"/>
+        </property>
+    </bean>
+
+    <bean id="UnreachableAddresses" class="org.apache.cxf.clustering.SequentialStrategy">
+        <property name="alternateAddresses">
+            <list>        
+                <value>http://localhost:9050/SoapContext/ReplicatedPortA</value>
+                <value>http://localhost:9053/SoapContext/ReplicatedPortC</value>
+            </list>
+        </property>
+    </bean>
+
+    <jaxws:client name="{http://cxf.apache.org/greeter_control}ReplicatedPortA"
+                  createdFromAPI="true">
+        <jaxws:features>
+            <clustering:loadDistributor>
+                <clustering:strategy>
+                    <ref bean="SequentialAddresses"/>
+                </clustering:strategy>
+            </clustering:loadDistributor>
+        </jaxws:features>
+    </jaxws:client>
+
+    <jaxws:client name="{http://cxf.apache.org/greeter_control}ReplicatedPortC"
+                  createdFromAPI="true">
+        <jaxws:features>
+            <clustering:loadDistributor>
+                <clustering:strategy>
+                    <ref bean="RandomAddresses"/>
+                </clustering:strategy>
+            </clustering:loadDistributor>
+        </jaxws:features>
+    </jaxws:client>
+
+    <jaxws:client name="{http://cxf.apache.org/greeter_control}ReplicatedPortB"
+                  address="http://localhost:15555/SoapContext/ReplicatedPortB"
+                  createdFromAPI="true">
+        <jaxws:features>
+            <clustering:loadDistributor>
+                <clustering:strategy>
+                    <ref bean="UnreachableAddresses"/>
+                </clustering:strategy>
+            </clustering:loadDistributor>
+        </jaxws:features>
+    </jaxws:client>
+    
+</beans>

Propchange: cxf/trunk/systests/uncategorized/src/test/java/org/apache/cxf/systest/clustering/load_distributor_address_override.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: cxf/trunk/systests/uncategorized/src/test/java/org/apache/cxf/systest/clustering/load_distributor_address_override.xml
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Propchange: cxf/trunk/systests/uncategorized/src/test/java/org/apache/cxf/systest/clustering/load_distributor_address_override.xml
------------------------------------------------------------------------------
    svn:mime-type = text/xml



Mime
View raw message