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>

View File

@@ -136,7 +136,7 @@ public class DefaultXmlPayloadConverterTests {
public void testConvertSourceToDocument() throws Exception {
Node element = testDocument.getElementsByTagName("test").item(0);
DOMSource domSource = new DOMSource(element);
Document doc = converter.convertToDocument(element);
Document doc = converter.convertToDocument(domSource);
NodeList childNodes = doc.getChildNodes();
assertEquals(1, childNodes.getLength());
assertEquals("test", childNodes.item(0).getNodeName());

View File

@@ -27,4 +27,4 @@ xpath-transformer-poller=<int:chain input-channel="input">\
<int-xml:xpath-transformer xpath-expression="/person/@name">\
<int:poller id="poller" fixed-rate="5000" max-messages-per-poll="10" />\
</int-xml:xpath-transformer>\
</int:chain>
</int:chain>

View File

@@ -4,4 +4,4 @@
<xsl:template match="order">
<bob>test</bob>
</xsl:template>
</xsl:stylesheet>
</xsl:stylesheet>

View File

@@ -3,4 +3,4 @@
<xsl:template match="order">
hello world text
</xsl:template>
</xsl:stylesheet>
</xsl:stylesheet>

View File

@@ -6,14 +6,14 @@
<xsl:output omit-xml-declaration="yes" />
<xsl:template match="order">
<bob>test</bob>
<sampleElementA>
<sampleElementA>
<xsl:value-of select="$testParam" />
</sampleElementA>
<sampleElementB>
<sampleElementB>
<xsl:value-of select="$testParam2" />
</sampleElementB>
<sampleElementC>
<sampleElementC>
<xsl:value-of select="$testParam3" />
</sampleElementC>
</xsl:template>
</xsl:stylesheet>
</xsl:stylesheet>

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2015 the original author or authors.
* Copyright 2002-2016 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -27,6 +27,7 @@ import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
/**
* @author Mark Fisher
* @author Artem Bilan
* @author Gary Russell
* @since 2.0
*/
@ContextConfiguration
@@ -34,7 +35,7 @@ import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
public class ConsoleChatTests {
public static void main(String[] args) {
new ClassPathXmlApplicationContext("ConsoleChatTests-context.xml", ConsoleChatTests.class);
new ClassPathXmlApplicationContext("ConsoleChatTests-context.xml", ConsoleChatTests.class).close();
}
@Test

View File

@@ -15,14 +15,14 @@
<context:property-placeholder location="classpath:test.properties"/>
<beans:bean id="xmppProducer"
class="org.springframework.integration.xmpp.ignore.XmppMessageProducer"
p:recipient="${user.2.login}"/>
class="org.springframework.integration.xmpp.ignore.XmppMessageProducer"
p:recipient="${user.2.login}"/>
<xmpp:xmpp-connection id="testConnection"
user="${user.1.login}"
password="${user.1.password}"
host="${user.1.host}"
service-name="${user.1.service}"/>
<xmpp:xmpp-connection id="testConnection"
user="${user.1.login}"
password="${user.1.password}"
host="${user.1.host}"
service-name="${user.1.service}"/>
<inbound-channel-adapter ref="xmppProducer" channel="outboundChatChannel">
<poller fixed-rate="1000"/>

View File

@@ -19,7 +19,6 @@ package org.springframework.integration.xmpp.ignore;
import org.junit.Ignore;
import org.junit.Test;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import org.springframework.messaging.Message;
import org.springframework.messaging.MessageChannel;
@@ -27,22 +26,26 @@ import org.springframework.messaging.support.GenericMessage;
/**
* @author Oleg Zhurakousky
* @author Gary Russell
*/
public class SmackMessageSampleTests {
@Test
@Ignore
public void validateSmackMessageSent() {
ApplicationContext ac = new ClassPathXmlApplicationContext("SmackMessageSampleTest-context.xml", this.getClass());
ClassPathXmlApplicationContext ac = new ClassPathXmlApplicationContext("SmackMessageSampleTest-context.xml",
this.getClass());
MessageChannel xmppInput = ac.getBean("xmppInput", MessageChannel.class);
org.jivesoftware.smack.packet.Message smackMessage = new org.jivesoftware.smack.packet.Message("springintegration@gmail.com");
org.jivesoftware.smack.packet.Message smackMessage = new org.jivesoftware.smack.packet.Message(
"springintegration@gmail.com");
smackMessage.setBody("Message sent as Smack Message");
Message<org.jivesoftware.smack.packet.Message> message =
new GenericMessage<org.jivesoftware.smack.packet.Message>(smackMessage);
xmppInput.send(message);
ac.close();
}
}

View File

@@ -3,4 +3,4 @@ user.2.login=user2@gmail.com
user.1.login=user1@gmail.com
user.1.password=password
user.1.host=talk.google.com
user.1.service=gmail.com
user.1.service=gmail.com