Upgrade to SF-5.0 and Reactor-3.0
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2007 the original author or authors.
|
||||
* Copyright 2002-2016 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -28,6 +28,7 @@ import javax.jms.Topic;
|
||||
|
||||
/**
|
||||
* @author Mark Fisher
|
||||
* @author Artem Bilan
|
||||
*/
|
||||
public class StubConnection implements Connection {
|
||||
|
||||
@@ -38,46 +39,78 @@ public class StubConnection implements Connection {
|
||||
this.messageText = messageText;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void close() throws JMSException {
|
||||
}
|
||||
|
||||
@Override
|
||||
public ConnectionConsumer createConnectionConsumer(Destination destination, String messageSelector,
|
||||
ServerSessionPool sessionPool, int maxMessages) throws JMSException {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ConnectionConsumer createDurableConnectionConsumer(Topic topic, String subscriptionName,
|
||||
String messageSelector, ServerSessionPool sessionPool, int maxMessages) throws JMSException {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Session createSession(boolean transacted, int acknowledgeMode) throws JMSException {
|
||||
return new StubSession(this.messageText);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getClientID() throws JMSException {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ExceptionListener getExceptionListener() throws JMSException {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ConnectionMetaData getMetaData() throws JMSException {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setClientID(String clientID) throws JMSException {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setExceptionListener(ExceptionListener listener) throws JMSException {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void start() throws JMSException {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void stop() throws JMSException {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Session createSession(int sessionMode) throws JMSException {
|
||||
return new StubSession(this.messageText);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Session createSession() throws JMSException {
|
||||
return new StubSession(this.messageText);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ConnectionConsumer createSharedConnectionConsumer(Topic topic, String subscriptionName,
|
||||
String messageSelector, ServerSessionPool sessionPool, int maxMessages) throws JMSException {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ConnectionConsumer createSharedDurableConnectionConsumer(Topic topic, String subscriptionName,
|
||||
String messageSelector, ServerSessionPool sessionPool, int maxMessages) throws JMSException {
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
|
||||
package org.springframework.integration.jms;
|
||||
|
||||
import javax.jms.CompletionListener;
|
||||
import javax.jms.Destination;
|
||||
import javax.jms.InvalidDestinationException;
|
||||
import javax.jms.JMSException;
|
||||
@@ -31,6 +32,8 @@ public class StubProducer implements MessageProducer {
|
||||
|
||||
private Destination staticDestination;
|
||||
|
||||
private long deliveryDelay;
|
||||
|
||||
|
||||
public StubProducer(Destination destination) {
|
||||
this.staticDestination = destination;
|
||||
@@ -118,4 +121,37 @@ public class StubProducer implements MessageProducer {
|
||||
public void setTimeToLive(long timeToLive) throws JMSException {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setDeliveryDelay(long deliveryDelay) throws JMSException {
|
||||
this.deliveryDelay = deliveryDelay;
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getDeliveryDelay() throws JMSException {
|
||||
return this.deliveryDelay;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void send(Message message, CompletionListener completionListener) throws JMSException {
|
||||
send(message);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void send(Message message, int deliveryMode, int priority, long timeToLive,
|
||||
CompletionListener completionListener) throws JMSException {
|
||||
send(message);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void send(Destination destination, Message message, CompletionListener completionListener)
|
||||
throws JMSException {
|
||||
send(destination, message);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void send(Destination destination, Message message, int deliveryMode, int priority, long timeToLive,
|
||||
CompletionListener completionListener) throws JMSException {
|
||||
send(destination, message);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2009 the original author or authors.
|
||||
* Copyright 2002-2016 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -39,6 +39,7 @@ import javax.jms.TopicSubscriber;
|
||||
|
||||
/**
|
||||
* @author Mark Fisher
|
||||
* @author Artem Bilan
|
||||
*/
|
||||
public class StubSession implements Session {
|
||||
|
||||
@@ -49,120 +50,181 @@ public class StubSession implements Session {
|
||||
this.messageText = messageText;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void close() throws JMSException {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void commit() throws JMSException {
|
||||
}
|
||||
|
||||
@Override
|
||||
public QueueBrowser createBrowser(Queue queue) throws JMSException {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public QueueBrowser createBrowser(Queue queue, String messageSelector) throws JMSException {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BytesMessage createBytesMessage() throws JMSException {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public MessageConsumer createConsumer(Destination destination) throws JMSException {
|
||||
return new StubConsumer(this.messageText, null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public MessageConsumer createConsumer(Destination destination, String messageSelector) throws JMSException {
|
||||
return new StubConsumer(this.messageText, messageSelector);
|
||||
}
|
||||
|
||||
@Override
|
||||
public MessageConsumer createConsumer(Destination destination, String messageSelector, boolean NoLocal)
|
||||
throws JMSException {
|
||||
return new StubConsumer(this.messageText, messageSelector);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TopicSubscriber createDurableSubscriber(Topic topic, String name) throws JMSException {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public TopicSubscriber createDurableSubscriber(Topic topic, String name, String messageSelector, boolean noLocal)
|
||||
throws JMSException {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public MapMessage createMapMessage() throws JMSException {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Message createMessage() throws JMSException {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ObjectMessage createObjectMessage() throws JMSException {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ObjectMessage createObjectMessage(Serializable object) throws JMSException {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public MessageProducer createProducer(Destination destination) throws JMSException {
|
||||
return new StubProducer(destination);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Queue createQueue(String queueName) throws JMSException {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public StreamMessage createStreamMessage() throws JMSException {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public TemporaryQueue createTemporaryQueue() throws JMSException {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public TemporaryTopic createTemporaryTopic() throws JMSException {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public TextMessage createTextMessage() throws JMSException {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public TextMessage createTextMessage(String text) throws JMSException {
|
||||
return new StubTextMessage(text);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Topic createTopic(String topicName) throws JMSException {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getAcknowledgeMode() throws JMSException {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public MessageListener getMessageListener() throws JMSException {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean getTransacted() throws JMSException {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void recover() throws JMSException {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void rollback() throws JMSException {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setMessageListener(MessageListener listener) throws JMSException {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void unsubscribe(String name) throws JMSException {
|
||||
}
|
||||
|
||||
@Override
|
||||
public MessageConsumer createSharedConsumer(Topic topic, String sharedSubscriptionName) throws JMSException {
|
||||
return new StubConsumer(this.messageText, null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public MessageConsumer createSharedConsumer(Topic topic, String sharedSubscriptionName, String messageSelector) throws JMSException {
|
||||
return new StubConsumer(this.messageText, messageSelector);
|
||||
}
|
||||
|
||||
@Override
|
||||
public MessageConsumer createDurableConsumer(Topic topic, String name) throws JMSException {
|
||||
return new StubConsumer(this.messageText, null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public MessageConsumer createDurableConsumer(Topic topic, String name, String messageSelector, boolean noLocal)
|
||||
throws JMSException {
|
||||
return new StubConsumer(this.messageText, messageSelector);
|
||||
}
|
||||
|
||||
@Override
|
||||
public MessageConsumer createSharedDurableConsumer(Topic topic, String name) throws JMSException {
|
||||
return new StubConsumer(this.messageText, null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public MessageConsumer createSharedDurableConsumer(Topic topic, String name, String messageSelector)
|
||||
throws JMSException {
|
||||
return new StubConsumer(this.messageText, messageSelector);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2010 the original author or authors.
|
||||
* Copyright 2002-2016 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -27,6 +27,7 @@ import javax.jms.TextMessage;
|
||||
* Stub JMS Message implementation intended for testing purposes only.
|
||||
*
|
||||
* @author Mark Fisher
|
||||
* @author Artem Bilan
|
||||
*/
|
||||
public class StubTextMessage implements TextMessage {
|
||||
|
||||
@@ -54,6 +55,8 @@ public class StubTextMessage implements TextMessage {
|
||||
|
||||
private ConcurrentHashMap<String, Object> properties = new ConcurrentHashMap<String, Object>();
|
||||
|
||||
private long deliveryTime;
|
||||
|
||||
|
||||
public StubTextMessage() {
|
||||
}
|
||||
@@ -62,201 +65,269 @@ public class StubTextMessage implements TextMessage {
|
||||
this.text = text;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String getText() throws JMSException {
|
||||
return this.text;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setText(String text) throws JMSException {
|
||||
this.text = text;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void acknowledge() throws JMSException {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void clearBody() throws JMSException {
|
||||
this.text = null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void clearProperties() throws JMSException {
|
||||
this.properties.clear();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean getBooleanProperty(String name) throws JMSException {
|
||||
Object value = this.properties.get(name);
|
||||
return (value instanceof Boolean) ? ((Boolean) value).booleanValue() : false;
|
||||
return (value instanceof Boolean) && (Boolean) value;
|
||||
}
|
||||
|
||||
@Override
|
||||
public byte getByteProperty(String name) throws JMSException {
|
||||
Object value = this.properties.get(name);
|
||||
return (value instanceof Byte) ? ((Byte) value).byteValue() : 0;
|
||||
return (value instanceof Byte) ? (Byte) value : 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getDoubleProperty(String name) throws JMSException {
|
||||
Object value = this.properties.get(name);
|
||||
return (value instanceof Double) ? ((Double) value).doubleValue() : 0;
|
||||
return (value instanceof Double) ? (Double) value : 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getFloatProperty(String name) throws JMSException {
|
||||
Object value = this.properties.get(name);
|
||||
return (value instanceof Float) ? ((Float) value).floatValue() : 0;
|
||||
return (value instanceof Float) ? (Float) value : 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getIntProperty(String name) throws JMSException {
|
||||
Object value = this.properties.get(name);
|
||||
return (value instanceof Integer) ? ((Integer) value).intValue() : 0;
|
||||
return (value instanceof Integer) ? (Integer) value : 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getJMSCorrelationID() throws JMSException {
|
||||
return this.correlationId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public byte[] getJMSCorrelationIDAsBytes() throws JMSException {
|
||||
return this.correlationId.getBytes();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getJMSDeliveryMode() throws JMSException {
|
||||
return this.deliveryMode;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Destination getJMSDestination() throws JMSException {
|
||||
return this.destination;
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getJMSExpiration() throws JMSException {
|
||||
return this.expiration;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getJMSMessageID() throws JMSException {
|
||||
return this.messageId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getJMSPriority() throws JMSException {
|
||||
return this.priority;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean getJMSRedelivered() throws JMSException {
|
||||
return this.redelivered;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Destination getJMSReplyTo() throws JMSException {
|
||||
return this.replyTo;
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getJMSTimestamp() throws JMSException {
|
||||
return this.timestamp;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getJMSType() throws JMSException {
|
||||
return this.type;
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getLongProperty(String name) throws JMSException {
|
||||
Object value = this.properties.get(name);
|
||||
return (value instanceof Long) ? ((Long) value).longValue() : 0;
|
||||
return (value instanceof Long) ? (Long) value : 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getObjectProperty(String name) throws JMSException {
|
||||
return this.properties.get(name);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Enumeration<?> getPropertyNames() throws JMSException {
|
||||
return this.properties.keys();
|
||||
}
|
||||
|
||||
@Override
|
||||
public short getShortProperty(String name) throws JMSException {
|
||||
Object value = this.properties.get(name);
|
||||
return (value instanceof Short) ? ((Short) value).shortValue() : 0;
|
||||
return (value instanceof Short) ? (Short) value : 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getStringProperty(String name) throws JMSException {
|
||||
Object value = this.properties.get(name);
|
||||
return (value instanceof String) ? (String) value : null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean propertyExists(String name) throws JMSException {
|
||||
return this.properties.containsKey(name);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setBooleanProperty(String name, boolean value) throws JMSException {
|
||||
this.properties.put(name, value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setByteProperty(String name, byte value) throws JMSException {
|
||||
this.properties.put(name, value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setDoubleProperty(String name, double value) throws JMSException {
|
||||
this.properties.put(name, value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setFloatProperty(String name, float value) throws JMSException {
|
||||
this.properties.put(name, value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setIntProperty(String name, int value) throws JMSException {
|
||||
this.properties.put(name, value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setJMSCorrelationID(String correlationId) throws JMSException {
|
||||
this.correlationId = correlationId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setJMSCorrelationIDAsBytes(byte[] correlationID) throws JMSException {
|
||||
this.correlationId = new String(correlationID);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setJMSDeliveryMode(int deliveryMode) throws JMSException {
|
||||
this.deliveryMode = deliveryMode;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setJMSDestination(Destination destination) throws JMSException {
|
||||
this.destination = destination;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setJMSExpiration(long expiration) throws JMSException {
|
||||
this.expiration = expiration;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setJMSMessageID(String id) throws JMSException {
|
||||
this.messageId = id;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setJMSPriority(int priority) throws JMSException {
|
||||
this.priority = priority;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setJMSRedelivered(boolean redelivered) throws JMSException {
|
||||
this.redelivered = redelivered;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setJMSReplyTo(Destination replyTo) throws JMSException {
|
||||
this.replyTo = replyTo;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setJMSTimestamp(long timestamp) throws JMSException {
|
||||
this.timestamp = timestamp;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setJMSType(String type) throws JMSException {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setLongProperty(String name, long value) throws JMSException {
|
||||
this.properties.put(name, value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setObjectProperty(String name, Object value) throws JMSException {
|
||||
this.properties.put(name, value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setShortProperty(String name, short value) throws JMSException {
|
||||
this.properties.put(name, value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setStringProperty(String name, String value) throws JMSException {
|
||||
this.properties.put(name, value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getJMSDeliveryTime() throws JMSException {
|
||||
return this.deliveryTime;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setJMSDeliveryTime(long deliveryTime) throws JMSException {
|
||||
this.deliveryTime = deliveryTime;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("unchecked")
|
||||
public <T> T getBody(Class<T> c) throws JMSException {
|
||||
return (T) this.text;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings({"unchecked", "rawtypes"})
|
||||
public boolean isBodyAssignableTo(Class c) throws JMSException {
|
||||
return c.isAssignableFrom(String.class);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user