Migrated JMS adapter and parser code from "org.springframework.integration.adapter" to the new "org.springframework.integration.jms" module, and added a dedicated spring-integration-jms-1.0.xsd schema and JmsNamespaceHandler.

This commit is contained in:
Mark Fisher
2008-09-20 15:37:21 +00:00
parent c0e134c4a9
commit 82630b96dc
55 changed files with 417 additions and 330 deletions

View File

@@ -1,231 +0,0 @@
/*
* Copyright 2002-2008 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.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.integration.adapter.jms;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertSame;
import java.util.Map;
import javax.jms.Destination;
import javax.jms.JMSException;
import org.junit.Test;
import org.springframework.integration.message.Message;
import org.springframework.integration.message.MessageBuilder;
/**
* @author Mark Fisher
*/
public class DefaultJmsHeaderMapperTests {
@Test
public void testJmsReplyToMappedFromHeader() throws JMSException {
Destination replyTo = new Destination() {};
Message<String> message = MessageBuilder.withPayload("test")
.setHeader(JmsHeaders.REPLY_TO, replyTo).build();
DefaultJmsHeaderMapper mapper = new DefaultJmsHeaderMapper();
javax.jms.Message jmsMessage = new StubTextMessage();
mapper.mapFromMessageHeaders(message.getHeaders(), jmsMessage);
assertNotNull(jmsMessage.getJMSReplyTo());
assertSame(replyTo, jmsMessage.getJMSReplyTo());
}
@Test
public void testJmsReplyToIgnoredIfIncorrectType() throws JMSException {
Message<String> message = MessageBuilder.withPayload("test")
.setHeader(JmsHeaders.REPLY_TO, "not-a-destination").build();
DefaultJmsHeaderMapper mapper = new DefaultJmsHeaderMapper();
javax.jms.Message jmsMessage = new StubTextMessage();
mapper.mapFromMessageHeaders(message.getHeaders(), jmsMessage);
assertNull(jmsMessage.getJMSReplyTo());
}
@Test
public void testJmsCorrelationIdMappedFromHeader() throws JMSException {
String jmsCorrelationId = "ABC-123";
Message<String> message = MessageBuilder.withPayload("test")
.setHeader(JmsHeaders.CORRELATION_ID, jmsCorrelationId).build();
DefaultJmsHeaderMapper mapper = new DefaultJmsHeaderMapper();
javax.jms.Message jmsMessage = new StubTextMessage();
mapper.mapFromMessageHeaders(message.getHeaders(), jmsMessage);
assertNotNull(jmsMessage.getJMSCorrelationID());
assertEquals(jmsCorrelationId, jmsMessage.getJMSCorrelationID());
}
@Test
public void testJmsCorrelationIdIgnoredIfIncorrectType() throws JMSException {
Message<String> message = MessageBuilder.withPayload("test")
.setHeader(JmsHeaders.CORRELATION_ID, new Integer(123)).build();
DefaultJmsHeaderMapper mapper = new DefaultJmsHeaderMapper();
javax.jms.Message jmsMessage = new StubTextMessage();
mapper.mapFromMessageHeaders(message.getHeaders(), jmsMessage);
assertNull(jmsMessage.getJMSCorrelationID());
}
@Test
public void testJmsTypeMappedFromHeader() throws JMSException {
String jmsType = "testing";
Message<String> message = MessageBuilder.withPayload("test")
.setHeader(JmsHeaders.TYPE, jmsType).build();
DefaultJmsHeaderMapper mapper = new DefaultJmsHeaderMapper();
javax.jms.Message jmsMessage = new StubTextMessage();
mapper.mapFromMessageHeaders(message.getHeaders(), jmsMessage);
assertNotNull(jmsMessage.getJMSType());
assertEquals(jmsType, jmsMessage.getJMSType());
}
@Test
public void testJmsTypeIgnoredIfIncorrectType() throws JMSException {
Message<String> message = MessageBuilder.withPayload("test")
.setHeader(JmsHeaders.TYPE, new Integer(123)).build();
DefaultJmsHeaderMapper mapper = new DefaultJmsHeaderMapper();
javax.jms.Message jmsMessage = new StubTextMessage();
mapper.mapFromMessageHeaders(message.getHeaders(), jmsMessage);
assertNull(jmsMessage.getJMSType());
}
@Test
public void testUserDefinedPropertyMappedFromHeader() throws JMSException {
Message<String> message = MessageBuilder.withPayload("test")
.setHeader(JmsHeaders.USER_PREFIX + "foo", new Integer(123))
.build();
DefaultJmsHeaderMapper mapper = new DefaultJmsHeaderMapper();
javax.jms.Message jmsMessage = new StubTextMessage();
mapper.mapFromMessageHeaders(message.getHeaders(), jmsMessage);
Object value = jmsMessage.getObjectProperty("foo");
assertNotNull(value);
assertEquals(Integer.class, value.getClass());
assertEquals(123, ((Integer) value).intValue());
}
@Test
public void testUserDefinedPropertyWithUnsupportedType() throws JMSException {
Destination destination = new Destination() {};
Message<String> message = MessageBuilder.withPayload("test")
.setHeader(JmsHeaders.USER_PREFIX + "destination", destination)
.build();
DefaultJmsHeaderMapper mapper = new DefaultJmsHeaderMapper();
javax.jms.Message jmsMessage = new StubTextMessage();
mapper.mapFromMessageHeaders(message.getHeaders(), jmsMessage);
Object value = jmsMessage.getObjectProperty("foo");
assertNull(value);
}
@Test
public void testJmsReplyToMappedToHeader() throws JMSException {
Destination replyTo = new Destination() {};
javax.jms.Message jmsMessage = new StubTextMessage();
jmsMessage.setJMSReplyTo(replyTo);
DefaultJmsHeaderMapper mapper = new DefaultJmsHeaderMapper();
Map<String, Object> headers = mapper.mapToMessageHeaders(jmsMessage);
Object attrib = headers.get(JmsHeaders.REPLY_TO);
assertNotNull(attrib);
assertSame(replyTo, attrib);
}
@Test
public void testJmsCorrelationIdMappedToHeader() throws JMSException {
String correlationId = "ABC-123";
javax.jms.Message jmsMessage = new StubTextMessage();
jmsMessage.setJMSCorrelationID(correlationId);
DefaultJmsHeaderMapper mapper = new DefaultJmsHeaderMapper();
Map<String, Object> headers = mapper.mapToMessageHeaders(jmsMessage);
Object attrib = headers.get(JmsHeaders.CORRELATION_ID);
assertNotNull(attrib);
assertSame(correlationId, attrib);
}
@Test
public void testJmsTypeMappedToHeader() throws JMSException {
String type = "testing";
javax.jms.Message jmsMessage = new StubTextMessage();
jmsMessage.setJMSType(type);
DefaultJmsHeaderMapper mapper = new DefaultJmsHeaderMapper();
Map<String, Object> headers = mapper.mapToMessageHeaders(jmsMessage);
Object attrib = headers.get(JmsHeaders.TYPE);
assertNotNull(attrib);
assertSame(type, attrib);
}
@Test
public void testUserDefinedPropertyMappedToHeader() throws JMSException {
javax.jms.Message jmsMessage = new StubTextMessage();
jmsMessage.setIntProperty("foo", 123);
DefaultJmsHeaderMapper mapper = new DefaultJmsHeaderMapper();
Map<String, Object> headers = mapper.mapToMessageHeaders(jmsMessage);
Object attrib = headers.get(JmsHeaders.USER_PREFIX + "foo");
assertNotNull(attrib);
assertEquals(Integer.class, attrib.getClass());
assertEquals(123, ((Integer) attrib).intValue());
}
@Test
public void testJMSExceptionIsNotFatal() throws JMSException {
Message<String> message = MessageBuilder.withPayload("test")
.setHeader(JmsHeaders.USER_PREFIX + "foo", new Integer(123))
.setHeader(JmsHeaders.USER_PREFIX + "bad", new Integer(456))
.setHeader(JmsHeaders.USER_PREFIX + "bar", new Integer(789))
.build();
DefaultJmsHeaderMapper mapper = new DefaultJmsHeaderMapper();
javax.jms.Message jmsMessage = new StubTextMessage() {
@Override
public void setObjectProperty(String name, Object value) throws JMSException {
if (name.equals("bad")) {
throw new JMSException("illegal property");
}
super.setObjectProperty(name, value);
}
};
mapper.mapFromMessageHeaders(message.getHeaders(), jmsMessage);
Object foo = jmsMessage.getObjectProperty("foo");
assertNotNull(foo);
Object bar = jmsMessage.getObjectProperty("bar");
assertNotNull(bar);
Object bad = jmsMessage.getObjectProperty("bad");
assertNull(bad);
}
@Test
public void testIllegalArgumentExceptionIsNotFatal() throws JMSException {
Message<String> message = MessageBuilder.withPayload("test")
.setHeader(JmsHeaders.USER_PREFIX + "foo", new Integer(123))
.setHeader(JmsHeaders.USER_PREFIX + "bad", new Integer(456))
.setHeader(JmsHeaders.USER_PREFIX + "bar", new Integer(789))
.build();
DefaultJmsHeaderMapper mapper = new DefaultJmsHeaderMapper();
javax.jms.Message jmsMessage = new StubTextMessage() {
@Override
public void setObjectProperty(String name, Object value) throws JMSException {
if (name.equals("bad")) {
throw new IllegalArgumentException("illegal property");
}
super.setObjectProperty(name, value);
}
};
mapper.mapFromMessageHeaders(message.getHeaders(), jmsMessage);
Object foo = jmsMessage.getObjectProperty("foo");
assertNotNull(foo);
Object bar = jmsMessage.getObjectProperty("bar");
assertNotNull(bar);
Object bad = jmsMessage.getObjectProperty("bad");
assertNull(bad);
}
}

View File

@@ -1,83 +0,0 @@
/*
* Copyright 2002-2007 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.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.integration.adapter.jms;
import javax.jms.Connection;
import javax.jms.ConnectionConsumer;
import javax.jms.ConnectionMetaData;
import javax.jms.Destination;
import javax.jms.ExceptionListener;
import javax.jms.JMSException;
import javax.jms.ServerSessionPool;
import javax.jms.Session;
import javax.jms.Topic;
/**
* @author Mark Fisher
*/
public class StubConnection implements Connection {
private String messageText;
public StubConnection(String messageText) {
this.messageText = messageText;
}
public void close() throws JMSException {
}
public ConnectionConsumer createConnectionConsumer(Destination destination, String messageSelector,
ServerSessionPool sessionPool, int maxMessages) throws JMSException {
return null;
}
public ConnectionConsumer createDurableConnectionConsumer(Topic topic, String subscriptionName,
String messageSelector, ServerSessionPool sessionPool, int maxMessages) throws JMSException {
return null;
}
public Session createSession(boolean transacted, int acknowledgeMode) throws JMSException {
return new StubSession(this.messageText);
}
public String getClientID() throws JMSException {
return null;
}
public ExceptionListener getExceptionListener() throws JMSException {
return null;
}
public ConnectionMetaData getMetaData() throws JMSException {
return null;
}
public void setClientID(String clientID) throws JMSException {
}
public void setExceptionListener(ExceptionListener listener) throws JMSException {
}
public void start() throws JMSException {
}
public void stop() throws JMSException {
}
}

View File

@@ -1,65 +0,0 @@
/*
* Copyright 2002-2007 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.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.integration.adapter.jms;
import javax.jms.JMSException;
import javax.jms.Message;
import javax.jms.MessageConsumer;
import javax.jms.MessageListener;
/**
* @author Mark Fisher
*/
public class StubConsumer implements MessageConsumer {
private String messageText;
public StubConsumer(String messageText) {
this.messageText = messageText;
}
public void close() throws JMSException {
}
public MessageListener getMessageListener() throws JMSException {
return null;
}
public String getMessageSelector() throws JMSException {
return null;
}
public Message receive() throws JMSException {
StubTextMessage message = new StubTextMessage();
message.setText(this.messageText);
return message;
}
public Message receive(long timeout) throws JMSException {
return this.receive();
}
public Message receiveNoWait() throws JMSException {
return this.receive();
}
public void setMessageListener(MessageListener listener) throws JMSException {
}
}

View File

@@ -1,26 +0,0 @@
/*
* Copyright 2002-2007 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.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.integration.adapter.jms;
import javax.jms.Destination;
/**
* @author Mark Fisher
*/
public class StubDestination implements Destination {
}

View File

@@ -1,168 +0,0 @@
/*
* Copyright 2002-2008 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.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.integration.adapter.jms;
import java.io.Serializable;
import javax.jms.BytesMessage;
import javax.jms.Destination;
import javax.jms.JMSException;
import javax.jms.MapMessage;
import javax.jms.Message;
import javax.jms.MessageConsumer;
import javax.jms.MessageListener;
import javax.jms.MessageProducer;
import javax.jms.ObjectMessage;
import javax.jms.Queue;
import javax.jms.QueueBrowser;
import javax.jms.Session;
import javax.jms.StreamMessage;
import javax.jms.TemporaryQueue;
import javax.jms.TemporaryTopic;
import javax.jms.TextMessage;
import javax.jms.Topic;
import javax.jms.TopicSubscriber;
/**
* @author Mark Fisher
*/
public class StubSession implements Session {
private final String messageText;
public StubSession(String messageText) {
this.messageText = messageText;
}
public void close() throws JMSException {
}
public void commit() throws JMSException {
}
public QueueBrowser createBrowser(Queue queue) throws JMSException {
return null;
}
public QueueBrowser createBrowser(Queue queue, String messageSelector) throws JMSException {
return null;
}
public BytesMessage createBytesMessage() throws JMSException {
return null;
}
public MessageConsumer createConsumer(Destination destination) throws JMSException {
return new StubConsumer(this.messageText);
}
public MessageConsumer createConsumer(Destination destination, String messageSelector) throws JMSException {
return new StubConsumer(this.messageText);
}
public MessageConsumer createConsumer(Destination destination, String messageSelector, boolean NoLocal)
throws JMSException {
return new StubConsumer(this.messageText);
}
public TopicSubscriber createDurableSubscriber(Topic topic, String name) throws JMSException {
return null;
}
public TopicSubscriber createDurableSubscriber(Topic topic, String name, String messageSelector, boolean noLocal)
throws JMSException {
return null;
}
public MapMessage createMapMessage() throws JMSException {
return null;
}
public Message createMessage() throws JMSException {
return null;
}
public ObjectMessage createObjectMessage() throws JMSException {
return null;
}
public ObjectMessage createObjectMessage(Serializable object) throws JMSException {
return null;
}
public MessageProducer createProducer(Destination destination) throws JMSException {
return null;
}
public Queue createQueue(String queueName) throws JMSException {
return null;
}
public StreamMessage createStreamMessage() throws JMSException {
return null;
}
public TemporaryQueue createTemporaryQueue() throws JMSException {
return null;
}
public TemporaryTopic createTemporaryTopic() throws JMSException {
return null;
}
public TextMessage createTextMessage() throws JMSException {
return null;
}
public TextMessage createTextMessage(String text) throws JMSException {
return null;
}
public Topic createTopic(String topicName) throws JMSException {
return null;
}
public int getAcknowledgeMode() throws JMSException {
return 0;
}
public MessageListener getMessageListener() throws JMSException {
return null;
}
public boolean getTransacted() throws JMSException {
return false;
}
public void recover() throws JMSException {
}
public void rollback() throws JMSException {
}
public void run() {
}
public void setMessageListener(MessageListener listener) throws JMSException {
}
public void unsubscribe(String name) throws JMSException {
}
}

View File

@@ -1,216 +0,0 @@
/*
* Copyright 2002-2008 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.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.integration.adapter.jms;
import java.util.Enumeration;
import java.util.concurrent.ConcurrentHashMap;
import javax.jms.Destination;
import javax.jms.JMSException;
import javax.jms.TextMessage;
public class StubTextMessage implements TextMessage {
private String text;
private Destination replyTo;
private String correlationID;
private String type;
private ConcurrentHashMap<String, Object> properties = new ConcurrentHashMap<String, Object>();
public String getText() throws JMSException {
return this.text;
}
public void setText(String text) throws JMSException {
this.text = text;
}
public void acknowledge() throws JMSException {
}
public void clearBody() throws JMSException {
}
public void clearProperties() throws JMSException {
}
public boolean getBooleanProperty(String name) throws JMSException {
return false;
}
public byte getByteProperty(String name) throws JMSException {
return 0;
}
public double getDoubleProperty(String name) throws JMSException {
return 0;
}
public float getFloatProperty(String name) throws JMSException {
return 0;
}
public int getIntProperty(String name) throws JMSException {
return 0;
}
public String getJMSCorrelationID() throws JMSException {
return this.correlationID;
}
public byte[] getJMSCorrelationIDAsBytes() throws JMSException {
return null;
}
public int getJMSDeliveryMode() throws JMSException {
return 0;
}
public Destination getJMSDestination() throws JMSException {
return null;
}
public long getJMSExpiration() throws JMSException {
return 0;
}
public String getJMSMessageID() throws JMSException {
return null;
}
public int getJMSPriority() throws JMSException {
return 0;
}
public boolean getJMSRedelivered() throws JMSException {
return false;
}
public Destination getJMSReplyTo() throws JMSException {
return this.replyTo;
}
public long getJMSTimestamp() throws JMSException {
return 0;
}
public String getJMSType() throws JMSException {
return this.type;
}
public long getLongProperty(String name) throws JMSException {
return 0;
}
public Object getObjectProperty(String name) throws JMSException {
return this.properties.get(name);
}
public Enumeration getPropertyNames() throws JMSException {
return this.properties.keys();
}
public short getShortProperty(String name) throws JMSException {
return 0;
}
public String getStringProperty(String name) throws JMSException {
return null;
}
public boolean propertyExists(String name) throws JMSException {
return this.properties.containsKey(name);
}
public void setBooleanProperty(String name, boolean value) throws JMSException {
this.properties.put(name, value);
}
public void setByteProperty(String name, byte value) throws JMSException {
this.properties.put(name, value);
}
public void setDoubleProperty(String name, double value) throws JMSException {
this.properties.put(name, value);
}
public void setFloatProperty(String name, float value) throws JMSException {
this.properties.put(name, value);
}
public void setIntProperty(String name, int value) throws JMSException {
this.properties.put(name, value);
}
public void setJMSCorrelationID(String correlationID) throws JMSException {
this.correlationID = correlationID;
}
public void setJMSCorrelationIDAsBytes(byte[] correlationID) throws JMSException {
}
public void setJMSDeliveryMode(int deliveryMode) throws JMSException {
}
public void setJMSDestination(Destination destination) throws JMSException {
}
public void setJMSExpiration(long expiration) throws JMSException {
}
public void setJMSMessageID(String id) throws JMSException {
}
public void setJMSPriority(int priority) throws JMSException {
}
public void setJMSRedelivered(boolean redelivered) throws JMSException {
}
public void setJMSReplyTo(Destination replyTo) throws JMSException {
this.replyTo = replyTo;
}
public void setJMSTimestamp(long timestamp) throws JMSException {
}
public void setJMSType(String type) throws JMSException {
this.type = type;
}
public void setLongProperty(String name, long value) throws JMSException {
this.properties.put(name, value);
}
public void setObjectProperty(String name, Object value) throws JMSException {
this.properties.put(name, value);
}
public void setShortProperty(String name, short value) throws JMSException {
this.properties.put(name, value);
}
public void setStringProperty(String name, String value) throws JMSException {
this.properties.put(name, value);
}
}

View File

@@ -1,214 +0,0 @@
/*
* Copyright 2002-2008 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.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.integration.adapter.jms.config;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;
import org.junit.Test;
import org.springframework.beans.DirectFieldAccessor;
import org.springframework.beans.factory.BeanCreationException;
import org.springframework.beans.factory.BeanDefinitionStoreException;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import org.springframework.integration.adapter.jms.JmsGateway;
import org.springframework.integration.channel.QueueChannel;
import org.springframework.integration.message.Message;
import org.springframework.jms.connection.JmsTransactionManager;
import org.springframework.jms.listener.AbstractMessageListenerContainer;
/**
* @author Mark Fisher
*/
public class JmsGatewayParserTests {
@Test
public void testGatewayWithConnectionFactoryAndDestination() {
ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext(
"jmsGatewayWithConnectionFactoryAndDestination.xml", this.getClass());
QueueChannel channel = new QueueChannel(1);
JmsGateway gateway = (JmsGateway) context.getBean("jmsGateway");
gateway.setRequestChannel(channel);
context.start();
Message<?> message = channel.receive(3000);
assertNotNull("message should not be null", message);
assertEquals("message-driven-test", message.getPayload());
context.stop();
}
@Test
public void testGatewayWithConnectionFactoryAndDestinationName() {
ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext(
"jmsGatewayWithConnectionFactoryAndDestinationName.xml", this.getClass());
QueueChannel channel = new QueueChannel(1);
JmsGateway gateway = (JmsGateway) context.getBean("jmsGateway");
gateway.setRequestChannel(channel);
context.start();
Message<?> message = channel.receive(3000);
assertNotNull("message should not be null", message);
assertEquals("message-driven-test", message.getPayload());
context.stop();
}
@Test
public void testGatewayWithMessageConverter() {
ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext(
"jmsGatewayWithMessageConverter.xml", this.getClass());
QueueChannel channel = new QueueChannel(1);
JmsGateway gateway = (JmsGateway) context.getBean("jmsGateway");
gateway.setRequestChannel(channel);
context.start();
Message<?> message = channel.receive(3000);
assertNotNull("message should not be null", message);
assertEquals("converted-test-message", message.getPayload());
context.stop();
}
@Test
public void testGatewayWithDefaultExpectReply() {
ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext(
"jmsGatewaysWithExpectReplyAttributes.xml", this.getClass());
JmsGateway gateway = (JmsGateway) context.getBean("defaultGateway");
DirectFieldAccessor accessor = new DirectFieldAccessor(gateway);
assertEquals(Boolean.FALSE, accessor.getPropertyValue("expectReply"));
}
@Test
public void testGatewayExpectingReply() {
ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext(
"jmsGatewaysWithExpectReplyAttributes.xml", this.getClass());
JmsGateway gateway = (JmsGateway) context.getBean("gatewayExpectingReply");
DirectFieldAccessor accessor = new DirectFieldAccessor(gateway);
assertEquals(Boolean.TRUE, accessor.getPropertyValue("expectReply"));
}
@Test
public void testGatewayNotExpectingReply() {
ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext(
"jmsGatewaysWithExpectReplyAttributes.xml", this.getClass());
JmsGateway gateway = (JmsGateway) context.getBean("gatewayNotExpectingReply");
DirectFieldAccessor accessor = new DirectFieldAccessor(gateway);
assertEquals(Boolean.FALSE, accessor.getPropertyValue("expectReply"));
}
@Test(expected=BeanDefinitionStoreException.class)
public void testGatewayWithConnectionFactoryOnly() {
try {
new ClassPathXmlApplicationContext("jmsGatewayWithConnectionFactoryOnly.xml", this.getClass());
}
catch (RuntimeException e) {
assertEquals(BeanCreationException.class, e.getCause().getClass());
throw e;
}
}
@Test(expected=BeanDefinitionStoreException.class)
public void testGatewayWithEmptyConnectionFactory() {
try {
new ClassPathXmlApplicationContext("jmsGatewayWithEmptyConnectionFactory.xml", this.getClass());
}
catch (RuntimeException e) {
assertEquals(BeanCreationException.class, e.getCause().getClass());
throw e;
}
}
@Test
public void testGatewayWithDefaultConnectionFactory() {
ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext(
"jmsGatewayWithDefaultConnectionFactory.xml", this.getClass());
QueueChannel channel = new QueueChannel(1);
JmsGateway gateway = (JmsGateway) context.getBean("jmsGateway");
gateway.setRequestChannel(channel);
context.start();
Message<?> message = channel.receive(3000);
assertNotNull("message should not be null", message);
assertEquals("message-driven-test", message.getPayload());
context.stop();
}
@Test
public void testTransactionManagerIsNullByDefault() {
ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext(
"jmsGatewayTransactionManagerTests.xml", this.getClass());
JmsGateway gateway = (JmsGateway) context.getBean("gatewayWithoutTransactionManager");
DirectFieldAccessor accessor = new DirectFieldAccessor(gateway);
assertNull(accessor.getPropertyValue("transactionManager"));
}
@Test
public void testGatewayWithTransactionManagerReference() {
ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext(
"jmsGatewayTransactionManagerTests.xml", this.getClass());
JmsGateway gateway = (JmsGateway) context.getBean("gatewayWithTransactionManager");
DirectFieldAccessor accessor = new DirectFieldAccessor(gateway);
Object txManager = accessor.getPropertyValue("transactionManager");
assertEquals(JmsTransactionManager.class, txManager.getClass());
assertEquals(context.getBean("txManager"), txManager);
assertEquals(context.getBean("testConnectionFactory"), ((JmsTransactionManager) txManager).getConnectionFactory());
}
@Test
public void testGatewayWithConcurrentConsumers() {
ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext(
"jmsGatewayWithContainerSettings.xml", this.getClass());
JmsGateway gateway = (JmsGateway) context.getBean("gatewayWithConcurrentConsumers");
gateway.start();
AbstractMessageListenerContainer container = (AbstractMessageListenerContainer)
new DirectFieldAccessor(gateway).getPropertyValue("container");
assertEquals(3, new DirectFieldAccessor(container).getPropertyValue("concurrentConsumers"));
gateway.stop();
}
@Test
public void testGatewayWithMaxConcurrentConsumers() {
ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext(
"jmsGatewayWithContainerSettings.xml", this.getClass());
JmsGateway gateway = (JmsGateway) context.getBean("gatewayWithMaxConcurrentConsumers");
gateway.start();
AbstractMessageListenerContainer container = (AbstractMessageListenerContainer)
new DirectFieldAccessor(gateway).getPropertyValue("container");
assertEquals(22, new DirectFieldAccessor(container).getPropertyValue("maxConcurrentConsumers"));
gateway.stop();
}
@Test
public void testGatewayWithMaxMessagesPerTask() {
ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext(
"jmsGatewayWithContainerSettings.xml", this.getClass());
JmsGateway gateway = (JmsGateway) context.getBean("gatewayWithMaxMessagesPerTask");
gateway.start();
AbstractMessageListenerContainer container = (AbstractMessageListenerContainer)
new DirectFieldAccessor(gateway).getPropertyValue("container");
assertEquals(99, new DirectFieldAccessor(container).getPropertyValue("maxMessagesPerTask"));
gateway.stop();
}
@Test
public void testGatewayWithIdleTaskExecutionLimit() {
ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext(
"jmsGatewayWithContainerSettings.xml", this.getClass());
JmsGateway gateway = (JmsGateway) context.getBean("gatewayWithIdleTaskExecutionLimit");
gateway.start();
AbstractMessageListenerContainer container = (AbstractMessageListenerContainer)
new DirectFieldAccessor(gateway).getPropertyValue("container");
assertEquals(7, new DirectFieldAccessor(container).getPropertyValue("idleTaskExecutionLimit"));
gateway.stop();
}
}

View File

@@ -1,141 +0,0 @@
/*
* Copyright 2002-2008 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.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.integration.adapter.jms.config;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import org.junit.Test;
import org.springframework.beans.factory.BeanCreationException;
import org.springframework.beans.factory.BeanDefinitionStoreException;
import org.springframework.beans.factory.NoSuchBeanDefinitionException;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import org.springframework.integration.adapter.jms.JmsSource;
import org.springframework.integration.channel.PollableChannel;
import org.springframework.integration.message.Message;
/**
* @author Mark Fisher
*/
public class JmsSourceParserTests {
@Test
public void testSourceWithJmsTemplate() {
ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext(
"jmsSourceWithJmsTemplate.xml", this.getClass());
JmsSource source = (JmsSource) context.getBean("jmsSource");
Message<?> message = source.receive();
assertNotNull("message should not be null", message);
assertEquals("polling-test", message.getPayload());
}
@Test
public void testSourceWithConnectionFactoryAndDestination() {
ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext(
"jmsSourceWithConnectionFactoryAndDestination.xml", this.getClass());
JmsSource source = (JmsSource) context.getBean("jmsSource");
Message<?> message = source.receive();
assertNotNull("message should not be null", message);
assertEquals("polling-test", message.getPayload());
context.stop();
}
@Test
public void testSourceWithConnectionFactoryAndDestinationName() {
ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext(
"jmsSourceWithConnectionFactoryAndDestinationName.xml", this.getClass());
JmsSource source = (JmsSource) context.getBean("jmsSource");
Message<?> message = source.receive();
assertNotNull("message should not be null", message);
assertEquals("polling-test", message.getPayload());
context.stop();
}
@Test(expected=BeanDefinitionStoreException.class)
public void testSourceWithConnectionFactoryOnly() {
try {
new ClassPathXmlApplicationContext("jmsSourceWithConnectionFactoryOnly.xml", this.getClass());
}
catch (RuntimeException e) {
assertEquals(BeanCreationException.class, e.getCause().getClass());
throw e;
}
}
@Test(expected=BeanCreationException.class)
public void testSourceWithDestinationOnly() {
try {
new ClassPathXmlApplicationContext("jmsSourceWithDestinationOnly.xml", this.getClass());
}
catch (RuntimeException e) {
assertEquals(NoSuchBeanDefinitionException.class, e.getCause().getClass());
throw e;
}
}
@Test
public void testSourceWithDestinationAndDefaultConnectionFactory() {
ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext(
"jmsSourceWithDestinationAndDefaultConnectionFactory.xml", this.getClass());
JmsSource source = (JmsSource) context.getBean("jmsSource");
Message<?> message = source.receive();
assertNotNull("message should not be null", message);
assertEquals("polling-test", message.getPayload());
context.stop();
}
@Test(expected=BeanCreationException.class)
public void testSourceWithDestinationNameOnly() {
new ClassPathXmlApplicationContext("jmsSourceWithDestinationNameOnly.xml", this.getClass());
}
@Test
public void testSourceWithDestinationNameAndDefaultConnectionFactory() {
ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext(
"jmsSourceWithDestinationNameAndDefaultConnectionFactory.xml", this.getClass());
JmsSource source = (JmsSource) context.getBean("jmsSource");
Message<?> message = source.receive();
assertNotNull("message should not be null", message);
assertEquals("polling-test", message.getPayload());
}
@Test
public void testSourceWithHeaderMapper() {
ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext(
"jmsSourceWithHeaderMapper.xml", this.getClass());
JmsSource source = (JmsSource) context.getBean("jmsSource");
Message<?> message = source.receive();
assertNotNull("message should not be null", message);
assertEquals("polling-test", message.getPayload());
assertEquals("foo", message.getHeaders().get("testProperty"));
assertEquals(new Integer(123), message.getHeaders().get("testAttribute"));
}
@Test
public void testSourceEndpoint() {
ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext(
"jmsSourceEndpoint.xml", this.getClass());
context.start();
PollableChannel channel = (PollableChannel) context.getBean("channel");
Message<?> message = channel.receive(3000);
assertNotNull("message should not be null", message);
assertEquals("polling-test", message.getPayload());
context.stop();
}
}

View File

@@ -1,87 +0,0 @@
/*
* Copyright 2002-2008 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.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.integration.adapter.jms.config;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import org.junit.Test;
import org.springframework.beans.DirectFieldAccessor;
import org.springframework.beans.factory.BeanCreationException;
import org.springframework.beans.factory.BeanDefinitionStoreException;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import org.springframework.integration.adapter.MessageHeaderMapper;
import org.springframework.integration.adapter.jms.JmsTarget;
/**
* @author Mark Fisher
*/
public class JmsTargetParserTests {
@Test
public void testTargetWithConnectionFactoryAndDestination() {
ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext(
"targetWithConnectionFactoryAndDestination.xml", this.getClass());
JmsTarget target = (JmsTarget) context.getBean("target");
DirectFieldAccessor accessor = new DirectFieldAccessor(target);
assertNotNull(accessor.getPropertyValue("jmsTemplate"));
}
@Test
public void testTargetWithConnectionFactoryAndDestinationName() {
ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext(
"targetWithConnectionFactoryAndDestinationName.xml", this.getClass());
JmsTarget target = (JmsTarget) context.getBean("target");
DirectFieldAccessor accessor = new DirectFieldAccessor(target);
assertNotNull(accessor.getPropertyValue("jmsTemplate"));
}
@Test
public void testTargetWithDefaultConnectionFactory() {
ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext(
"targetWithDefaultConnectionFactory.xml", this.getClass());
JmsTarget target = (JmsTarget) context.getBean("target");
DirectFieldAccessor accessor = new DirectFieldAccessor(target);
assertNotNull(accessor.getPropertyValue("jmsTemplate"));
}
@Test
@SuppressWarnings("unchecked")
public void testTargetWithHeaderMapper() {
ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext(
"targetWithHeaderMapper.xml", this.getClass());
JmsTarget target = (JmsTarget) context.getBean("target");
DirectFieldAccessor accessor = new DirectFieldAccessor(target);
MessageHeaderMapper headerMapper = (MessageHeaderMapper)
accessor.getPropertyValue("headerMapper");
assertNotNull(headerMapper);
assertEquals(TestMessageHeaderMapper.class, headerMapper.getClass());
}
@Test(expected=BeanDefinitionStoreException.class)
public void testTargetWithEmptyConnectionFactory() {
try {
new ClassPathXmlApplicationContext("targetWithEmptyConnectionFactory.xml", this.getClass());
}
catch (RuntimeException e) {
assertEquals(BeanCreationException.class, e.getCause().getClass());
throw e;
}
}
}

View File

@@ -1,41 +0,0 @@
/*
* Copyright 2002-2008 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.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.integration.adapter.jms.config;
import javax.jms.JMSException;
import javax.jms.Message;
import javax.jms.Session;
import javax.jms.TextMessage;
import org.springframework.jms.support.converter.MessageConversionException;
import org.springframework.jms.support.converter.MessageConverter;
/**
* @author Mark Fisher
*/
public class TestMessageConverter implements MessageConverter {
public Object fromMessage(Message message) throws JMSException, MessageConversionException {
String original = ((TextMessage) message).getText();
return "converted-" + original;
}
public javax.jms.Message toMessage(Object object, Session session) throws JMSException, MessageConversionException {
return null;
}
}

View File

@@ -1,42 +0,0 @@
/*
* Copyright 2002-2008 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.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.integration.adapter.jms.config;
import java.util.HashMap;
import java.util.Map;
import javax.jms.Message;
import org.springframework.integration.adapter.MessageHeaderMapper;
import org.springframework.integration.message.MessageHeaders;
/**
* @author Mark Fisher
*/
public class TestMessageHeaderMapper implements MessageHeaderMapper<Message> {
public void mapFromMessageHeaders(MessageHeaders headers, Message target) {
}
public Map<String, Object> mapToMessageHeaders(Message source) {
Map<String, Object> headerMap = new HashMap<String, Object>();
headerMap.put("testProperty", "foo");
headerMap.put("testAttribute", new Integer(123));
return headerMap;
}
}

View File

@@ -1,37 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:si="http://www.springframework.org/schema/integration"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
http://www.springframework.org/schema/integration
http://www.springframework.org/schema/integration/spring-integration-1.0.xsd">
<si:channel id="requestChannel"/>
<si:jms-gateway id="gatewayWithoutTransactionManager"
connection-factory="testConnectionFactory"
destination="testDestination"
request-channel="requestChannel"/>
<si:jms-gateway id="gatewayWithTransactionManager"
connection-factory="testConnectionFactory"
destination="testDestination"
request-channel="requestChannel"
transaction-manager="txManager"/>
<bean id="txManager" class="org.springframework.jms.connection.JmsTransactionManager">
<property name="connectionFactory" ref="testConnectionFactory"/>
</bean>
<bean id="testConnectionFactory" class="org.springframework.jms.connection.SingleConnectionFactory">
<constructor-arg>
<bean class="org.springframework.integration.adapter.jms.StubConnection">
<constructor-arg value="message-driven-test"/>
</bean>
</constructor-arg>
</bean>
<bean id="testDestination" class="org.springframework.integration.adapter.jms.StubDestination"/>
</beans>

View File

@@ -1,27 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:si="http://www.springframework.org/schema/integration"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
http://www.springframework.org/schema/integration
http://www.springframework.org/schema/integration/spring-integration-1.0.xsd">
<si:channel id="requestChannel"/>
<si:jms-gateway id="jmsGateway"
connection-factory="testConnectionFactory"
destination="testDestination"
request-channel="requestChannel"/>
<bean id="testConnectionFactory" class="org.springframework.jms.connection.SingleConnectionFactory">
<constructor-arg>
<bean class="org.springframework.integration.adapter.jms.StubConnection">
<constructor-arg value="message-driven-test"/>
</bean>
</constructor-arg>
</bean>
<bean id="testDestination" class="org.springframework.integration.adapter.jms.StubDestination"/>
</beans>

View File

@@ -1,27 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:si="http://www.springframework.org/schema/integration"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
http://www.springframework.org/schema/integration
http://www.springframework.org/schema/integration/spring-integration-1.0.xsd">
<si:message-bus/>
<si:channel id="requestChannel"/>
<si:jms-gateway id="jmsGateway"
connection-factory="testConnectionFactory"
destination-name="testDestinationName"
request-channel="requestChannel"/>
<bean id="testConnectionFactory" class="org.springframework.jms.connection.SingleConnectionFactory">
<constructor-arg>
<bean class="org.springframework.integration.adapter.jms.StubConnection">
<constructor-arg value="message-driven-test"/>
</bean>
</constructor-arg>
</bean>
</beans>

View File

@@ -1,26 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:si="http://www.springframework.org/schema/integration"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
http://www.springframework.org/schema/integration
http://www.springframework.org/schema/integration/spring-integration-1.0.xsd">
<si:message-bus/>
<si:channel id="requestChannel"/>
<si:jms-gateway id="jmsGateway"
connection-factory="testConnectionFactory"
request-channel="requestChannel"/>
<bean id="testConnectionFactory" class="org.springframework.jms.connection.SingleConnectionFactory">
<constructor-arg>
<bean class="org.springframework.integration.adapter.jms.StubConnection">
<constructor-arg value="message-driven-test"/>
</bean>
</constructor-arg>
</bean>
</beans>

View File

@@ -1,48 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:si="http://www.springframework.org/schema/integration"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
http://www.springframework.org/schema/integration
http://www.springframework.org/schema/integration/spring-integration-1.0.xsd">
<si:message-bus auto-startup="false"/>
<si:channel id="requestChannel">
<si:queue capacity="10"/>
</si:channel>
<si:jms-gateway id="gatewayWithConcurrentConsumers"
connection-factory="testConnectionFactory"
request-channel="requestChannel"
destination-name="test"
concurrent-consumers="3"/>
<si:jms-gateway id="gatewayWithMaxConcurrentConsumers"
connection-factory="testConnectionFactory"
request-channel="requestChannel"
destination-name="test"
max-concurrent-consumers="22"/>
<si:jms-gateway id="gatewayWithMaxMessagesPerTask"
connection-factory="testConnectionFactory"
request-channel="requestChannel"
destination-name="test"
max-messages-per-task="99"/>
<si:jms-gateway id="gatewayWithIdleTaskExecutionLimit"
connection-factory="testConnectionFactory"
request-channel="requestChannel"
destination-name="test"
idle-task-execution-limit="7"/>
<bean id="testConnectionFactory" class="org.springframework.jms.connection.SingleConnectionFactory">
<constructor-arg>
<bean class="org.springframework.integration.adapter.jms.StubConnection">
<constructor-arg value="message-driven-test"/>
</bean>
</constructor-arg>
</bean>
</beans>

View File

@@ -1,26 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:si="http://www.springframework.org/schema/integration"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
http://www.springframework.org/schema/integration
http://www.springframework.org/schema/integration/spring-integration-1.0.xsd">
<si:message-bus/>
<si:channel id="requestChannel"/>
<si:jms-gateway id="jmsGateway"
destination-name="testDestinationName"
request-channel="requestChannel"/>
<bean id="connectionFactory" class="org.springframework.jms.connection.SingleConnectionFactory">
<constructor-arg>
<bean class="org.springframework.integration.adapter.jms.StubConnection">
<constructor-arg value="message-driven-test"/>
</bean>
</constructor-arg>
</bean>
</beans>

View File

@@ -1,17 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:si="http://www.springframework.org/schema/integration"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
http://www.springframework.org/schema/integration
http://www.springframework.org/schema/integration/spring-integration-1.0.xsd">
<si:channel id="requestChannel"/>
<si:jms-gateway id="jmsGateway"
connection-factory=""
destination-name="testDestinationName"
request-channel="requestChannel"/>
</beans>

View File

@@ -1,32 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:si="http://www.springframework.org/schema/integration"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
http://www.springframework.org/schema/integration
http://www.springframework.org/schema/integration/spring-integration-1.0.xsd">
<si:message-bus/>
<si:channel id="requestChannel"/>
<si:jms-gateway id="jmsGateway"
connection-factory="testConnectionFactory"
destination="testDestination"
message-converter="converter"
request-channel="requestChannel"/>
<bean id="converter" class="org.springframework.integration.adapter.jms.config.TestMessageConverter"/>
<bean id="testConnectionFactory" class="org.springframework.jms.connection.SingleConnectionFactory">
<constructor-arg>
<bean class="org.springframework.integration.adapter.jms.StubConnection">
<constructor-arg value="test-message"/>
</bean>
</constructor-arg>
</bean>
<bean id="testDestination" class="org.springframework.integration.adapter.jms.StubDestination"/>
</beans>

View File

@@ -1,40 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:si="http://www.springframework.org/schema/integration"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
http://www.springframework.org/schema/integration
http://www.springframework.org/schema/integration/spring-integration-1.0.xsd">
<si:message-bus auto-startup="false"/>
<si:channel id="requestChannel">
<si:queue capacity="10"/>
</si:channel>
<si:jms-gateway id="defaultGateway"
destination="testDestination"
request-channel="requestChannel"/>
<si:jms-gateway id="gatewayNotExpectingReply"
destination="testDestination"
request-channel="requestChannel"
expect-reply="false"/>
<si:jms-gateway id="gatewayExpectingReply"
destination="testDestination"
request-channel="requestChannel"
expect-reply="true"/>
<bean id="connectionFactory" class="org.springframework.jms.connection.SingleConnectionFactory">
<constructor-arg>
<bean class="org.springframework.integration.adapter.jms.StubConnection">
<constructor-arg value="test-message"/>
</bean>
</constructor-arg>
</bean>
<bean id="testDestination" class="org.springframework.integration.adapter.jms.StubDestination"/>
</beans>

View File

@@ -1,35 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:si="http://www.springframework.org/schema/integration"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
http://www.springframework.org/schema/integration
http://www.springframework.org/schema/integration/spring-integration-1.0.xsd">
<si:message-bus/>
<si:channel id="channel">
<si:queue capacity="10"/>
</si:channel>
<si:channel-adapter source="jmsSource" channel="channel">
<si:poller period="5000" initial-delay="0" max-messages-per-poll="1"/>
</si:channel-adapter>
<si:jms-source id="jmsSource" jms-template="jmsTemplate"/>
<bean id="jmsTemplate" class="org.springframework.jms.core.JmsTemplate">
<property name="connectionFactory" ref="connectionFactory"/>
<property name="defaultDestinationName" value="test"/>
</bean>
<bean id="connectionFactory" class="org.springframework.jms.connection.SingleConnectionFactory">
<constructor-arg>
<bean class="org.springframework.integration.adapter.jms.StubConnection">
<constructor-arg value="polling-test"/>
</bean>
</constructor-arg>
</bean>
</beans>

View File

@@ -1,24 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:si="http://www.springframework.org/schema/integration"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
http://www.springframework.org/schema/integration
http://www.springframework.org/schema/integration/spring-integration-1.0.xsd">
<si:jms-source id="jmsSource"
connection-factory="testConnectionFactory"
destination="testDestination"/>
<bean id="testConnectionFactory" class="org.springframework.jms.connection.SingleConnectionFactory">
<constructor-arg>
<bean class="org.springframework.integration.adapter.jms.StubConnection">
<constructor-arg value="polling-test"/>
</bean>
</constructor-arg>
</bean>
<bean id="testDestination" class="org.springframework.integration.adapter.jms.StubDestination"/>
</beans>

View File

@@ -1,22 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:si="http://www.springframework.org/schema/integration"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
http://www.springframework.org/schema/integration
http://www.springframework.org/schema/integration/spring-integration-1.0.xsd">
<si:jms-source id="jmsSource"
connection-factory="testConnectionFactory"
destination-name="testDestinationName"/>
<bean id="testConnectionFactory" class="org.springframework.jms.connection.SingleConnectionFactory">
<constructor-arg>
<bean class="org.springframework.integration.adapter.jms.StubConnection">
<constructor-arg value="polling-test"/>
</bean>
</constructor-arg>
</bean>
</beans>

View File

@@ -1,20 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:si="http://www.springframework.org/schema/integration"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
http://www.springframework.org/schema/integration
http://www.springframework.org/schema/integration/spring-integration-1.0.xsd">
<si:jms-source id="adapter" connection-factory="testConnectionFactory"/>
<bean id="testConnectionFactory" class="org.springframework.jms.connection.SingleConnectionFactory">
<constructor-arg>
<bean class="org.springframework.integration.adapter.jms.StubConnection">
<constructor-arg value="polling-test"/>
</bean>
</constructor-arg>
</bean>
</beans>

View File

@@ -1,22 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:si="http://www.springframework.org/schema/integration"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
http://www.springframework.org/schema/integration
http://www.springframework.org/schema/integration/spring-integration-1.0.xsd">
<si:jms-source id="jmsSource" destination="testDestination"/>
<bean id="testDestination" class="org.springframework.integration.adapter.jms.StubDestination"/>
<bean id="connectionFactory" class="org.springframework.jms.connection.SingleConnectionFactory">
<constructor-arg>
<bean class="org.springframework.integration.adapter.jms.StubConnection">
<constructor-arg value="polling-test"/>
</bean>
</constructor-arg>
</bean>
</beans>

View File

@@ -1,20 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:si="http://www.springframework.org/schema/integration"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
http://www.springframework.org/schema/integration
http://www.springframework.org/schema/integration/spring-integration-1.0.xsd">
<si:jms-source id="jmsSource" destination-name="testDestinationName"/>
<bean id="connectionFactory" class="org.springframework.jms.connection.SingleConnectionFactory">
<constructor-arg>
<bean class="org.springframework.integration.adapter.jms.StubConnection">
<constructor-arg value="polling-test"/>
</bean>
</constructor-arg>
</bean>
</beans>

View File

@@ -1,12 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:si="http://www.springframework.org/schema/integration"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
http://www.springframework.org/schema/integration
http://www.springframework.org/schema/integration/spring-integration-1.0.xsd">
<si:jms-source id="jmsSource" destination-name="testDestinationName"/>
</beans>

View File

@@ -1,14 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:si="http://www.springframework.org/schema/integration"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
http://www.springframework.org/schema/integration
http://www.springframework.org/schema/integration/spring-integration-1.0.xsd">
<si:jms-source id="jmsSource" destination="testDestination"/>
<bean id="testDestination" class="org.springframework.integration.adapter.jms.StubDestination"/>
</beans>

View File

@@ -1,27 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:si="http://www.springframework.org/schema/integration"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
http://www.springframework.org/schema/integration
http://www.springframework.org/schema/integration/spring-integration-1.0.xsd">
<si:jms-source id="jmsSource" jms-template="jmsTemplate" header-mapper="mapper"/>
<bean id="mapper" class="org.springframework.integration.adapter.jms.config.TestMessageHeaderMapper"/>
<bean id="jmsTemplate" class="org.springframework.jms.core.JmsTemplate">
<property name="connectionFactory" ref="connectionFactory"/>
<property name="defaultDestinationName" value="test"/>
</bean>
<bean id="connectionFactory" class="org.springframework.jms.connection.SingleConnectionFactory">
<constructor-arg>
<bean class="org.springframework.integration.adapter.jms.StubConnection">
<constructor-arg value="polling-test"/>
</bean>
</constructor-arg>
</bean>
</beans>

View File

@@ -1,25 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:si="http://www.springframework.org/schema/integration"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
http://www.springframework.org/schema/integration
http://www.springframework.org/schema/integration/spring-integration-1.0.xsd">
<si:jms-source id="jmsSource" jms-template="jmsTemplate"/>
<bean id="jmsTemplate" class="org.springframework.jms.core.JmsTemplate">
<property name="connectionFactory" ref="connectionFactory"/>
<property name="defaultDestinationName" value="test"/>
</bean>
<bean id="connectionFactory" class="org.springframework.jms.connection.SingleConnectionFactory">
<constructor-arg>
<bean class="org.springframework.integration.adapter.jms.StubConnection">
<constructor-arg value="polling-test"/>
</bean>
</constructor-arg>
</bean>
</beans>

View File

@@ -1,24 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:si="http://www.springframework.org/schema/integration"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
http://www.springframework.org/schema/integration
http://www.springframework.org/schema/integration/spring-integration-1.0.xsd">
<si:jms-target id="target"
connection-factory="testConnectionFactory"
destination="testDestination"/>
<bean id="testConnectionFactory" class="org.springframework.jms.connection.SingleConnectionFactory">
<constructor-arg>
<bean class="org.springframework.integration.adapter.jms.StubConnection">
<constructor-arg value="target-test"/>
</bean>
</constructor-arg>
</bean>
<bean id="testDestination" class="org.springframework.integration.adapter.jms.StubDestination"/>
</beans>

View File

@@ -1,22 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:si="http://www.springframework.org/schema/integration"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
http://www.springframework.org/schema/integration
http://www.springframework.org/schema/integration/spring-integration-1.0.xsd">
<si:jms-target id="target"
connection-factory="testConnectionFactory"
destination-name="queue.test"/>
<bean id="testConnectionFactory" class="org.springframework.jms.connection.SingleConnectionFactory">
<constructor-arg>
<bean class="org.springframework.integration.adapter.jms.StubConnection">
<constructor-arg value="target-test"/>
</bean>
</constructor-arg>
</bean>
</beans>

View File

@@ -1,22 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:si="http://www.springframework.org/schema/integration"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
http://www.springframework.org/schema/integration
http://www.springframework.org/schema/integration/spring-integration-1.0.xsd">
<si:jms-target id="target" destination="testDestination"/>
<bean id="connectionFactory" class="org.springframework.jms.connection.SingleConnectionFactory">
<constructor-arg>
<bean class="org.springframework.integration.adapter.jms.StubConnection">
<constructor-arg value="target-test"/>
</bean>
</constructor-arg>
</bean>
<bean id="testDestination" class="org.springframework.integration.adapter.jms.StubDestination"/>
</beans>

View File

@@ -1,16 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:si="http://www.springframework.org/schema/integration"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
http://www.springframework.org/schema/integration
http://www.springframework.org/schema/integration/spring-integration-1.0.xsd">
<si:jms-target id="target"
connection-factory=""
destination="testDestination"/>
<bean id="testDestination" class="org.springframework.integration.adapter.jms.StubDestination"/>
</beans>

View File

@@ -1,24 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:si="http://www.springframework.org/schema/integration"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
http://www.springframework.org/schema/integration
http://www.springframework.org/schema/integration/spring-integration-1.0.xsd">
<si:jms-target id="target" destination="testDestination" header-mapper="mapper"/>
<bean id="mapper" class="org.springframework.integration.adapter.jms.config.TestMessageHeaderMapper"/>
<bean id="connectionFactory" class="org.springframework.jms.connection.SingleConnectionFactory">
<constructor-arg>
<bean class="org.springframework.integration.adapter.jms.StubConnection">
<constructor-arg value="target-test"/>
</bean>
</constructor-arg>
</bean>
<bean id="testDestination" class="org.springframework.integration.adapter.jms.StubDestination"/>
</beans>