use of org.apache.cxf.clustering.FailoverFeature in project camel by apache.
the class FailOverFeatureTest method startRoute.
private void startRoute(DefaultCamelContext ctx, final String proxy, final String real) throws Exception {
ctx.addRoutes(new RouteBuilder() {
public void configure() {
String alt = SERVICE_ADDRESS;
List<String> serviceList = new ArrayList<String>();
serviceList.add(alt);
RandomStrategy strategy = new RandomStrategy();
strategy.setAlternateAddresses(serviceList);
FailoverFeature ff = new FailoverFeature();
ff.setStrategy(strategy);
CxfEndpoint endpoint = (CxfEndpoint) (endpoint(real));
endpoint.getFeatures().add(ff);
from(proxy).to(endpoint);
}
});
ctx.start();
}
use of org.apache.cxf.clustering.FailoverFeature in project jbossws-cxf by jbossws.
the class CXFClientClusterTestCase method testCluster.
@Test
@RunAsClient
public void testCluster() throws Exception {
List<String> serviceList = new ArrayList<String>();
serviceList.add(baseURL.toExternalForm() + "/ClusetrService");
RandomStrategy strategy = new RandomStrategy();
strategy.setAlternateAddresses(serviceList);
FailoverFeature ff = new FailoverFeature();
ff.setStrategy(strategy);
JaxWsProxyFactoryBean factory = new JaxWsProxyFactoryBean();
factory.setAddress("http://localhost:8080/notExist/NotExistPort");
factory.getFeatures().add(ff);
factory.setServiceClass(Endpoint.class);
Endpoint proxy = factory.create(Endpoint.class);
assertEquals("Unexpected resposne", "cluster", proxy.echo("cluster"));
URL wsdlURL = new URL(baseURL.toExternalForm() + "/ClusetrService?wsdl");
QName qname = new QName("http://org.jboss.ws/jaxws/cxf/endpoint", "EndpointService");
Service service = Service.create(wsdlURL, qname);
Endpoint endpoint = service.getPort(Endpoint.class, ff);
((BindingProvider) endpoint).getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, "http://localhost:8080/notExist/NotExistPort");
assertEquals("Unexpected resposne", "cluster", endpoint.echo("cluster"));
}
use of org.apache.cxf.clustering.FailoverFeature in project cxf by apache.
the class AbstractFailoverTest method testSequentialStrategyWith406NoFailover.
@Test
public void testSequentialStrategyWith406NoFailover() throws Exception {
FailoverFeature feature = getFeature(false, Server.ADDRESS3);
strategyTestWebClientHttpError(Server.ADDRESS2, feature, Server.ADDRESS3, true);
}
use of org.apache.cxf.clustering.FailoverFeature in project cxf by apache.
the class AbstractFailoverTest method testSequentialStrategyWithDiffBaseAddresses2.
@Test
public void testSequentialStrategyWithDiffBaseAddresses2() throws Exception {
FailoverFeature feature = getFeature(false, Server.ADDRESS3, null);
strategyTest(Server.ADDRESS1, feature, Server.ADDRESS3, Server.ADDRESS2, false, false, true);
}
use of org.apache.cxf.clustering.FailoverFeature in project cxf by apache.
the class AbstractFailoverTest method testSequentialStrategyWebClient.
@Test
public void testSequentialStrategyWebClient() throws Exception {
FailoverFeature feature = getFeature(false, Server.ADDRESS2, Server.ADDRESS3);
strategyTestWebClient(Server.ADDRESS1, feature, Server.ADDRESS2, null, false, false);
}
Aggregations