File Cleanup - ws to xmpp

This commit is contained in:
Gary Russell
2016-06-04 12:50:39 -04:00
parent dd1d2ecab4
commit 90e5457260
18 changed files with 54 additions and 42 deletions

View File

@@ -28,4 +28,4 @@
<bean id="endpointStub"
class="org.springframework.integration.ws.MarshallingWebServiceIntegrationTests$StubEndpoint" />
</beans>
</beans>

View File

@@ -35,7 +35,6 @@ import org.mockito.invocation.InvocationOnMock;
import org.mockito.stubbing.Answer;
import org.springframework.beans.factory.BeanFactory;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import org.springframework.integration.handler.ReplyRequiredException;
import org.springframework.integration.support.MessageBuilder;
@@ -103,12 +102,14 @@ public class SimpleWebServiceOutboundGatewayTests {
@Test //INT-1029
public void testWsOutboundGatewayInsideChain() {
ApplicationContext context = new ClassPathXmlApplicationContext("WebServiceOutboundGatewayInsideChainTests-context.xml", this.getClass());
ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext(
"WebServiceOutboundGatewayInsideChainTests-context.xml", this.getClass());
MessageChannel channel = context.getBean("wsOutboundGatewayInsideChain", MessageChannel.class);
channel.send(MessageBuilder.withPayload("<test>foo</test>").build());
PollableChannel replyChannel = context.getBean("replyChannel", PollableChannel.class);
Message<?> replyMessage = replyChannel.receive();
assertThat(replyMessage.getPayload().toString(), Matchers.endsWith(response));
context.close();
}
@Test(expected = ReplyRequiredException.class)

View File

@@ -15,4 +15,4 @@
<soap-action expression="'http://' + payload"/>
</header-enricher>
</beans:beans>
</beans:beans>

View File

@@ -309,6 +309,7 @@ public class WebServiceOutboundGatewayParserTests {
"simpleWebServiceOutboundGatewayParserTests.xml", this.getClass());
AbstractEndpoint endpoint = (AbstractEndpoint) context.getBean("gatewayWithOrderAndAutoStartupFalse");
assertEquals(Boolean.FALSE, new DirectFieldAccessor(endpoint).getPropertyValue("autoStartup"));
context.close();
}
@Test

View File

@@ -40,7 +40,6 @@ import org.mockito.stubbing.Answer;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import org.springframework.integration.channel.QueueChannel;
import org.springframework.integration.mapping.AbstractHeaderMapper;
@@ -87,9 +86,12 @@ public class WebServiceOutboundGatewayWithHeaderMapperTests {
@SuppressWarnings("unchecked")
@Test
public void headerMapperParserTest() throws Exception {
ApplicationContext context = new ClassPathXmlApplicationContext("ws-outbound-gateway-with-headermappers.xml", this.getClass());
SimpleWebServiceOutboundGateway gateway = TestUtils.getPropertyValue(context.getBean("withHeaderMapper"), "handler", SimpleWebServiceOutboundGateway.class);
DefaultSoapHeaderMapper headerMapper = TestUtils.getPropertyValue(gateway, "headerMapper", DefaultSoapHeaderMapper.class);
ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext(
"ws-outbound-gateway-with-headermappers.xml", this.getClass());
SimpleWebServiceOutboundGateway gateway = TestUtils.getPropertyValue(context.getBean("withHeaderMapper"),
"handler", SimpleWebServiceOutboundGateway.class);
DefaultSoapHeaderMapper headerMapper = TestUtils.getPropertyValue(gateway, "headerMapper",
DefaultSoapHeaderMapper.class);
assertNotNull(headerMapper);
AbstractHeaderMapper.HeaderMatcher requestHeaderMatcher = TestUtils.getPropertyValue(headerMapper,
@@ -109,6 +111,7 @@ public class WebServiceOutboundGatewayWithHeaderMapperTests {
assertFalse(replyHeaderMatcher.matchHeader("123baz123"));
assertTrue(replyHeaderMatcher.matchHeader("bar"));
assertTrue(replyHeaderMatcher.matchHeader("bar123"));
context.close();
}
@Test
@@ -183,8 +186,10 @@ public class WebServiceOutboundGatewayWithHeaderMapperTests {
@SuppressWarnings("rawtypes")
public Message<?> process(Object payload, String gatewayName, String channelName, final boolean soap) throws Exception {
ApplicationContext context = new ClassPathXmlApplicationContext("ws-outbound-gateway-with-headermappers.xml", this.getClass());
AbstractWebServiceOutboundGateway gateway = TestUtils.getPropertyValue(context.getBean(gatewayName), "handler", AbstractWebServiceOutboundGateway.class);
ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext(
"ws-outbound-gateway-with-headermappers.xml", this.getClass());
AbstractWebServiceOutboundGateway gateway = TestUtils.getPropertyValue(context.getBean(gatewayName), "handler",
AbstractWebServiceOutboundGateway.class);
if (!soap) {
WebServiceTemplate template = TestUtils.getPropertyValue(gateway, "webServiceTemplate", WebServiceTemplate.class);
@@ -257,6 +262,7 @@ public class WebServiceOutboundGatewayWithHeaderMapperTests {
inputChannel.send(message);
QueueChannel outputChannel = context.getBean("outputChannel", QueueChannel.class);
Message<?> replyMessage = outputChannel.receive(0);
context.close();
return replyMessage;
}

View File

@@ -10,7 +10,7 @@
http://www.springframework.org/schema/integration/spring-integration.xsd
http://www.springframework.org/schema/integration/ws
http://www.springframework.org/schema/integration/ws/spring-integration-ws.xsd
http://www.springframework.org/schema/util
http://www.springframework.org/schema/util
http://www.springframework.org/schema/util/spring-util.xsd">
<si:channel id="inputChannel"/>
@@ -24,6 +24,6 @@
uri="http://example.org"
destination-provider="destinationProvider"/>
<bean id="destinationProvider" class="org.springframework.integration.ws.config.StubDestinationProvider"/>
<bean id="destinationProvider" class="org.springframework.integration.ws.config.StubDestinationProvider"/>
</beans>

View File

@@ -10,7 +10,7 @@
http://www.springframework.org/schema/integration/spring-integration.xsd
http://www.springframework.org/schema/integration/ws
http://www.springframework.org/schema/integration/ws/spring-integration-ws.xsd
http://www.springframework.org/schema/util
http://www.springframework.org/schema/util
http://www.springframework.org/schema/util/spring-util.xsd">
<si:channel id="inputChannel"/>
@@ -22,6 +22,6 @@
<ws:outbound-gateway id="gatewayWithBothUriAndDestinationProvider"
request-channel="inputChannel"/>
<bean id="destinationProvider" class="org.springframework.integration.ws.config.StubDestinationProvider"/>
<bean id="destinationProvider" class="org.springframework.integration.ws.config.StubDestinationProvider"/>
</beans>

View File

@@ -148,6 +148,6 @@
<bean class="org.springframework.integration.ws.config.StubClientInterceptor"/>
</util:list>
<bean id="destinationProvider" class="org.springframework.integration.ws.config.StubDestinationProvider"/>
<bean id="destinationProvider" class="org.springframework.integration.ws.config.StubDestinationProvider"/>
</beans>

View File

@@ -17,7 +17,7 @@
uri="http://example.org"
mapped-request-headers="foo*, *baz*"
mapped-reply-headers="bar*"/>
<int-ws:outbound-gateway id="marshallingWithHeaderMapper"
request-channel="inputMarshallingChannel"
reply-channel="outputChannel"
@@ -26,13 +26,13 @@
unmarshaller="ubmarshaller"
mapped-request-headers="foo*, *baz*"
mapped-reply-headers="bar*"/>
<bean id="marshaller" class="org.springframework.oxm.xstream.XStreamMarshaller"/>
<bean id="ubmarshaller" class="org.springframework.integration.ws.config.WebServiceOutboundGatewayWithHeaderMapperTests.SampleUnmarshaller"/>
<int:channel id="outputChannel">
<int:queue/>
</int:channel>
</int:channel>
</beans>