WebServiceEndpointComponent extends AbstractEndpointComponent { @Override protected Endpoint createEndpoint(String resourcePath, Map<String, String> parameters, TestContext context) { WebServiceClient client = new WebServiceClient(); client.getEndpointConfiguration().setDefaultUri("http: if (parameters.containsKey("errorHandlingStrategy")) { String strategy = parameters.remove("errorHandlingStrategy"); client.getEndpointConfiguration().setErrorHandlingStrategy(ErrorHandlingStrategy.fromName(strategy)); } enrichEndpointConfiguration(client.getEndpointConfiguration(), parameters, context); return client; } WebServiceEndpointComponent();   }
@Test public void testCreateClientEndpoint() throws Exception { WebServiceEndpointComponent component = new WebServiceEndpointComponent(); reset(referenceResolver); Endpoint endpoint = component.createEndpoint("http: Assert.assertEquals(endpoint.getClass(), WebServiceClient.class); Assert.assertEquals(((WebServiceClient)endpoint).getEndpointConfiguration().getDefaultUri(), "http: Assert.assertEquals(((WebServiceClient) endpoint).getEndpointConfiguration().getErrorHandlingStrategy(), ErrorHandlingStrategy.THROWS_EXCEPTION); Assert.assertEquals(((WebServiceClient) endpoint).getEndpointConfiguration().getTimeout(), 5000L); }
@Test public void testCreateClientEndpointWithParameters() throws Exception { WebServiceEndpointComponent component = new WebServiceEndpointComponent(); reset(referenceResolver); when(referenceResolver.isResolvable("myMessageFactory")).thenReturn(true); when(referenceResolver.resolve("myMessageFactory", WebServiceMessageFactory.class)).thenReturn(messageFactory); Endpoint endpoint = component.createEndpoint("http:localhost:8088?timeout=10000&errorHandlingStrategy=propagateError&messageFactory=myMessageFactory", context); Assert.assertEquals(endpoint.getClass(), WebServiceClient.class); Assert.assertEquals(((WebServiceClient)endpoint).getEndpointConfiguration().getDefaultUri(), "http: Assert.assertEquals(((WebServiceClient) endpoint).getEndpointConfiguration().getMessageFactory(), messageFactory); Assert.assertEquals(((WebServiceClient) endpoint).getEndpointConfiguration().getErrorHandlingStrategy(), ErrorHandlingStrategy.PROPAGATE); Assert.assertEquals(((WebServiceClient) endpoint).getEndpointConfiguration().getTimeout(), 10000L); }