Added tests for JmsSourceAdapterParser.
This commit is contained in:
@@ -0,0 +1,83 @@
|
||||
/*
|
||||
* 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 {
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,65 @@
|
||||
/*
|
||||
* 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 {
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
/*
|
||||
* 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 {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,168 @@
|
||||
/*
|
||||
* 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 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 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 {
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,178 @@
|
||||
package org.springframework.integration.adapter.jms;
|
||||
|
||||
import java.util.Enumeration;
|
||||
|
||||
import javax.jms.Destination;
|
||||
import javax.jms.JMSException;
|
||||
import javax.jms.TextMessage;
|
||||
|
||||
public class StubTextMessage implements TextMessage {
|
||||
|
||||
private String text;
|
||||
|
||||
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 null;
|
||||
}
|
||||
|
||||
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 null;
|
||||
}
|
||||
|
||||
public long getJMSTimestamp() throws JMSException {
|
||||
return 0;
|
||||
}
|
||||
|
||||
public String getJMSType() throws JMSException {
|
||||
return null;
|
||||
}
|
||||
|
||||
public long getLongProperty(String name) throws JMSException {
|
||||
return 0;
|
||||
}
|
||||
|
||||
public Object getObjectProperty(String name) throws JMSException {
|
||||
return null;
|
||||
}
|
||||
|
||||
public Enumeration getPropertyNames() throws JMSException {
|
||||
return null;
|
||||
}
|
||||
|
||||
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 false;
|
||||
}
|
||||
|
||||
public void setBooleanProperty(String name, boolean value) throws JMSException {
|
||||
}
|
||||
|
||||
public void setByteProperty(String name, byte value) throws JMSException {
|
||||
}
|
||||
|
||||
public void setDoubleProperty(String name, double value) throws JMSException {
|
||||
}
|
||||
|
||||
public void setFloatProperty(String name, float value) throws JMSException {
|
||||
}
|
||||
|
||||
public void setIntProperty(String name, int value) throws JMSException {
|
||||
}
|
||||
|
||||
public void setJMSCorrelationID(String correlationID) throws JMSException {
|
||||
}
|
||||
|
||||
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 {
|
||||
}
|
||||
|
||||
public void setJMSTimestamp(long timestamp) throws JMSException {
|
||||
}
|
||||
|
||||
public void setJMSType(String type) throws JMSException {
|
||||
}
|
||||
|
||||
public void setLongProperty(String name, long value) throws JMSException {
|
||||
}
|
||||
|
||||
public void setObjectProperty(String name, Object value) throws JMSException {
|
||||
}
|
||||
|
||||
public void setShortProperty(String name, short value) throws JMSException {
|
||||
}
|
||||
|
||||
public void setStringProperty(String name, String value) throws JMSException {
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,162 @@
|
||||
/*
|
||||
* 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.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.context.support.ClassPathXmlApplicationContext;
|
||||
import org.springframework.integration.adapter.jms.JmsMessageDrivenSourceAdapter;
|
||||
import org.springframework.integration.adapter.jms.JmsPollingSourceAdapter;
|
||||
import org.springframework.integration.channel.MessageChannel;
|
||||
import org.springframework.integration.message.Message;
|
||||
|
||||
/**
|
||||
* @author Mark Fisher
|
||||
*/
|
||||
public class JmsSourceAdapterParserTests {
|
||||
|
||||
@Test
|
||||
public void testPollingAdapterWithJmsTemplate() {
|
||||
ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext(
|
||||
"pollingAdapterWithJmsTemplate.xml", this.getClass());
|
||||
context.start();
|
||||
MessageChannel channel = (MessageChannel) context.getBean("channel");
|
||||
JmsPollingSourceAdapter adapter = (JmsPollingSourceAdapter) context.getBean("adapter");
|
||||
adapter.dispatch();
|
||||
Message<?> message = channel.receive(100);
|
||||
assertNotNull("message should not be null", message);
|
||||
assertEquals("polling-test", message.getPayload());
|
||||
context.stop();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testPollingAdapterWithConnectionFactoryAndDestination() {
|
||||
ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext(
|
||||
"pollingAdapterWithConnectionFactoryAndDestination.xml", this.getClass());
|
||||
context.start();
|
||||
MessageChannel channel = (MessageChannel) context.getBean("channel");
|
||||
JmsPollingSourceAdapter adapter = (JmsPollingSourceAdapter) context.getBean("adapter");
|
||||
adapter.dispatch();
|
||||
Message<?> message = channel.receive(100);
|
||||
assertNotNull("message should not be null", message);
|
||||
assertEquals("polling-test", message.getPayload());
|
||||
context.stop();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testPollingAdapterWithConnectionFactoryAndDestinationName() {
|
||||
ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext(
|
||||
"pollingAdapterWithConnectionFactoryAndDestinationName.xml", this.getClass());
|
||||
context.start();
|
||||
MessageChannel channel = (MessageChannel) context.getBean("channel");
|
||||
JmsPollingSourceAdapter adapter = (JmsPollingSourceAdapter) context.getBean("adapter");
|
||||
adapter.dispatch();
|
||||
Message<?> message = channel.receive(100);
|
||||
assertNotNull("message should not be null", message);
|
||||
assertEquals("polling-test", message.getPayload());
|
||||
context.stop();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testMessageDrivenAdapterWithConnectionFactoryAndDestination() {
|
||||
ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext(
|
||||
"messageDrivenAdapterWithConnectionFactoryAndDestination.xml", this.getClass());
|
||||
context.start();
|
||||
MessageChannel channel = (MessageChannel) context.getBean("channel");
|
||||
JmsMessageDrivenSourceAdapter adapter = (JmsMessageDrivenSourceAdapter) context.getBean("adapter");
|
||||
assertEquals(JmsMessageDrivenSourceAdapter.class, adapter.getClass());
|
||||
Message<?> message = channel.receive(100);
|
||||
assertNotNull("message should not be null", message);
|
||||
assertEquals("message-driven-test", message.getPayload());
|
||||
context.stop();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testMessageDrivenAdapterWithConnectionFactoryAndDestinationName() {
|
||||
ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext(
|
||||
"messageDrivenAdapterWithConnectionFactoryAndDestinationName.xml", this.getClass());
|
||||
context.start();
|
||||
MessageChannel channel = (MessageChannel) context.getBean("channel");
|
||||
JmsMessageDrivenSourceAdapter adapter = (JmsMessageDrivenSourceAdapter) context.getBean("adapter");
|
||||
assertEquals(JmsMessageDrivenSourceAdapter.class, adapter.getClass());
|
||||
Message<?> message = channel.receive(100);
|
||||
assertNotNull("message should not be null", message);
|
||||
assertEquals("message-driven-test", message.getPayload());
|
||||
context.stop();
|
||||
}
|
||||
|
||||
@Test(expected=BeanDefinitionStoreException.class)
|
||||
public void testPollingAdapterWithConnectionFactoryOnly() {
|
||||
try {
|
||||
new ClassPathXmlApplicationContext("pollingAdapterWithConnectionFactoryOnly.xml", this.getClass());
|
||||
}
|
||||
catch (RuntimeException e) {
|
||||
assertEquals(BeanCreationException.class, e.getCause().getClass());
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
||||
@Test(expected=BeanDefinitionStoreException.class)
|
||||
public void testPollingAdapterWithDestinationOnly() {
|
||||
try {
|
||||
new ClassPathXmlApplicationContext("pollingAdapterWithDestinationOnly.xml", this.getClass());
|
||||
}
|
||||
catch (RuntimeException e) {
|
||||
assertEquals(BeanCreationException.class, e.getCause().getClass());
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
||||
@Test(expected=BeanDefinitionStoreException.class)
|
||||
public void testPollingAdapterWithDestinationNameOnly() {
|
||||
try {
|
||||
new ClassPathXmlApplicationContext("pollingAdapterWithDestinationNameOnly.xml", this.getClass());
|
||||
}
|
||||
catch (RuntimeException e) {
|
||||
assertEquals(BeanCreationException.class, e.getCause().getClass());
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
||||
@Test(expected=BeanDefinitionStoreException.class)
|
||||
public void testPollingAdapterWithoutPollPeriod() {
|
||||
try {
|
||||
new ClassPathXmlApplicationContext("pollingAdapterWithoutPollPeriod.xml", this.getClass());
|
||||
}
|
||||
catch (RuntimeException e) {
|
||||
assertEquals(BeanCreationException.class, e.getCause().getClass());
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
||||
@Test(expected=BeanDefinitionStoreException.class)
|
||||
public void testMessageDrivenAdapterWithConnectionFactoryOnly() {
|
||||
try {
|
||||
new ClassPathXmlApplicationContext("messageDrivenAdapterWithConnectionFactoryOnly.xml", this.getClass());
|
||||
}
|
||||
catch (RuntimeException e) {
|
||||
assertEquals(BeanCreationException.class, e.getCause().getClass());
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
<?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:jms-source id="adapter"
|
||||
connection-factory="connectionFactory"
|
||||
destination="testDestination"
|
||||
channel="channel"/>
|
||||
|
||||
<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>
|
||||
|
||||
<bean id="testDestination" class="org.springframework.integration.adapter.jms.StubDestination"/>
|
||||
|
||||
</beans>
|
||||
@@ -0,0 +1,27 @@
|
||||
<?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:jms-source id="adapter"
|
||||
connection-factory="connectionFactory"
|
||||
destination-name="testDestinationName"
|
||||
channel="channel"/>
|
||||
|
||||
<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>
|
||||
@@ -0,0 +1,24 @@
|
||||
<?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:jms-source id="adapter" connection-factory="connectionFactory" channel="channel"/>
|
||||
|
||||
<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>
|
||||
@@ -0,0 +1,30 @@
|
||||
<?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:jms-source id="adapter"
|
||||
connection-factory="connectionFactory"
|
||||
destination="testDestination"
|
||||
channel="channel"
|
||||
poll-period="5000"/>
|
||||
|
||||
<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>
|
||||
|
||||
<bean id="testDestination" class="org.springframework.integration.adapter.jms.StubDestination"/>
|
||||
|
||||
</beans>
|
||||
@@ -0,0 +1,28 @@
|
||||
<?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:jms-source id="adapter"
|
||||
connection-factory="connectionFactory"
|
||||
destination-name="testDestinationName"
|
||||
channel="channel"
|
||||
poll-period="5000"/>
|
||||
|
||||
<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>
|
||||
@@ -0,0 +1,24 @@
|
||||
<?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:jms-source id="adapter" connection-factory="connectionFactory" channel="channel" poll-period="5000"/>
|
||||
|
||||
<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>
|
||||
@@ -0,0 +1,16 @@
|
||||
<?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:jms-source id="adapter" destination-name="testDestinationName" channel="channel" poll-period="5000"/>
|
||||
|
||||
</beans>
|
||||
@@ -0,0 +1,18 @@
|
||||
<?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:jms-source id="adapter" destination="testDestination" channel="channel" poll-period="5000"/>
|
||||
|
||||
<bean id="testDestination" class="org.springframework.integration.adapter.jms.StubDestination"/>
|
||||
|
||||
</beans>
|
||||
@@ -0,0 +1,29 @@
|
||||
<?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:jms-source id="adapter" jms-template="jmsTemplate" channel="channel" poll-period="5000"/>
|
||||
|
||||
<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>
|
||||
@@ -0,0 +1,29 @@
|
||||
<?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:jms-source id="adapter" jms-template="jmsTemplate" channel="channel"/>
|
||||
|
||||
<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>
|
||||
Reference in New Issue
Block a user