use of org.apache.cxf.clustering.FailoverStrategy in project tesb-rt-se by Talend.
the class LocatorClientEnablerTest method enableClient.
@Test
public void enableClient() {
ServiceLocator sl = createMock(ServiceLocator.class);
Capture<LocatorTargetSelector> capturedSelector = new Capture<LocatorTargetSelector>();
Client client = createMock(Client.class);
expect(client.getConduitSelector()).andStubReturn(conduitSelector);
client.setConduitSelector(capture(capturedSelector));
replay(client);
LocatorClientEnabler clientRegistrar = new LocatorClientEnabler();
clientRegistrar.setServiceLocator(sl);
clientRegistrar.setLocatorSelectionStrategyMap(locatorSelectionStrategyMap);
// clientRegistrar.setLocatorSelectionStrategy("defaultSelectionStrategy");
clientRegistrar.setDefaultLocatorSelectionStrategy("evenDistributionSelectionStrategy");
clientRegistrar.enable(client);
LocatorTargetSelector selector = capturedSelector.getValue();
assertEquals(endpoint, selector.getEndpoint());
FailoverStrategy strategy = selector.getStrategy();
assertThat(strategy, instanceOf(LocatorSelectionStrategy.class));
verify(client);
}
Aggregations