INT-2695 WS Support URI Schemes Other than http(s)

Previously, only http: or https: URI schemes were supported
by the uri attribute. To use other schemes (such as jms:),
you had to provide a DestinationProvider.

Add support for schemes other than http and https by
creating a DestinationProvider internally when such a
URI is detected.

Note: <uri-variable/>s are NOT supported except when
a URI with an http(s) scheme is provided. An exception
is thrown if variables are provided with an incompatible
URI, or if a DestinationProvider is supplied.

This could break existing applications that provide an
external DestinationProvider and have configured
<uri-variable/>s. Previously, these variables were
simply ignored.
This commit is contained in:
Gary Russell
2012-09-07 13:08:38 -04:00
committed by Oleg Zhurakousky
parent e337521958
commit 40ce2ab793
4 changed files with 58 additions and 6 deletions

View File

@@ -18,8 +18,10 @@ package org.springframework.integration.ws.config;
import static junit.framework.Assert.assertEquals;
import static junit.framework.Assert.assertTrue;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;
import java.net.URI;
import java.util.List;
import org.junit.Test;
@@ -45,6 +47,7 @@ import org.springframework.ws.WebServiceMessageFactory;
import org.springframework.ws.client.core.FaultMessageResolver;
import org.springframework.ws.client.core.SourceExtractor;
import org.springframework.ws.client.core.WebServiceMessageCallback;
import org.springframework.ws.client.support.destination.DestinationProvider;
import org.springframework.ws.client.support.interceptor.ClientInterceptor;
import org.springframework.ws.transport.WebServiceMessageSender;
@@ -380,7 +383,7 @@ public class WebServiceOutboundGatewayParserTests {
}
@Test
public void testInt2718AdvisedInsideTheChain() {
public void testInt2718AdvisedInsideAChain() {
adviceCalled = 0;
ApplicationContext context = new ClassPathXmlApplicationContext(
"simpleWebServiceOutboundGatewayParserTests.xml", this.getClass());
@@ -389,6 +392,18 @@ public class WebServiceOutboundGatewayParserTests {
assertEquals(1, adviceCalled);
}
@Test
public void jmsUri() {
ApplicationContext context = new ClassPathXmlApplicationContext(
"simpleWebServiceOutboundGatewayParserTests.xml", this.getClass());
AbstractEndpoint endpoint = (AbstractEndpoint) context.getBean("gatewayWithJmsUri");
assertEquals(EventDrivenConsumer.class, endpoint.getClass());
MessageHandler handler = TestUtils.getPropertyValue(endpoint, "handler", MessageHandler.class);
DestinationProvider destinationProvider = TestUtils.getPropertyValue(handler, "destinationProvider", DestinationProvider.class);
assertNotNull(destinationProvider);
assertEquals(URI.create("jms:wsQueue"), destinationProvider.getDestination());
}
@Test(expected = BeanDefinitionParsingException.class)
public void invalidGatewayWithBothUriAndDestinationProvider() {
new ClassPathXmlApplicationContext("invalidGatewayWithBothUriAndDestinationProvider.xml", this.getClass());

View File

@@ -112,7 +112,6 @@
</ws:request-handler-advice-chain>
</ws:outbound-gateway>
<si:chain input-channel="gatewayWithAdviceInsideAChain">
<ws:outbound-gateway destination-provider="destinationProvider">
<ws:request-handler-advice-chain>
@@ -121,6 +120,10 @@
</ws:outbound-gateway>
</si:chain>
<ws:outbound-gateway id="gatewayWithJmsUri"
request-channel="inputChannel"
uri="jms:wsQueue" />
<bean id="sourceExtractor" class="org.springframework.integration.ws.config.StubSourceExtractor"/>
<bean id="requestCallback" class="org.springframework.integration.ws.config.StubWebServiceMessageCallback"/>