You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@activemq.apache.org by cl...@apache.org on 2017/03/04 16:47:15 UTC
[3/3] activemq-artemis git commit: fixing tests
fixing tests
Project: http://git-wip-us.apache.org/repos/asf/activemq-artemis/repo
Commit: http://git-wip-us.apache.org/repos/asf/activemq-artemis/commit/80f6ae6b
Tree: http://git-wip-us.apache.org/repos/asf/activemq-artemis/tree/80f6ae6b
Diff: http://git-wip-us.apache.org/repos/asf/activemq-artemis/diff/80f6ae6b
Branch: refs/heads/artemis-1009
Commit: 80f6ae6bacbf0bea94dadfe211bf3c7d6794fcde
Parents: 5a9cdad
Author: Clebert Suconic <cl...@apache.org>
Authored: Sat Mar 4 11:38:14 2017 -0500
Committer: Clebert Suconic <cl...@apache.org>
Committed: Sat Mar 4 11:45:58 2017 -0500
----------------------------------------------------------------------
.../activemq/artemis/utils/TypedProperties.java | 12 ++++
.../activemq/artemis/api/core/Message.java | 4 ++
.../artemis/core/message/impl/CoreMessage.java | 46 ++++++++++-----
.../protocol/amqp/broker/AMQPMessage.java | 34 ++++++++---
.../amqp/broker/AMQPSessionCallback.java | 1 -
.../amqp/converter/AmqpCoreConverter.java | 1 +
.../amqp/converter/CoreAmqpConverter.java | 1 +
.../core/protocol/openwire/OpenwireMessage.java | 10 ++++
.../core/postoffice/impl/PostOfficeImpl.java | 1 -
.../artemis/core/server/ServerConsumer.java | 1 -
.../core/server/impl/ServerSessionImpl.java | 3 +-
.../management/impl/ManagementServiceImpl.java | 1 +
.../impl/ScheduledDeliveryHandlerTest.java | 10 ++++
.../amqp/AmqpDescribedTypePayloadTest.java | 6 +-
.../tests/integration/amqp/ProtonTest.java | 2 +-
.../integration/client/AcknowledgeTest.java | 10 ++++
.../cluster/bridge/SimpleTransformer.java | 61 ++++++++++----------
17 files changed, 145 insertions(+), 59 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/80f6ae6b/artemis-commons/src/main/java/org/apache/activemq/artemis/utils/TypedProperties.java
----------------------------------------------------------------------
diff --git a/artemis-commons/src/main/java/org/apache/activemq/artemis/utils/TypedProperties.java b/artemis-commons/src/main/java/org/apache/activemq/artemis/utils/TypedProperties.java
index a421484..fda135b 100644
--- a/artemis-commons/src/main/java/org/apache/activemq/artemis/utils/TypedProperties.java
+++ b/artemis-commons/src/main/java/org/apache/activemq/artemis/utils/TypedProperties.java
@@ -50,10 +50,14 @@ import static org.apache.activemq.artemis.utils.DataConstants.STRING;
*/
public final class TypedProperties {
+ private static final SimpleString AMQ_PROPNAME = new SimpleString("_AMQ_");
+
private Map<SimpleString, PropertyValue> properties;
private volatile int size;
+ private boolean internalProperties;
+
public TypedProperties() {
}
@@ -77,6 +81,10 @@ public final class TypedProperties {
size = other.size;
}
+ public boolean hasInternalProperties() {
+ return internalProperties;
+ }
+
public void putBooleanProperty(final SimpleString key, final boolean value) {
checkCreateProperties();
doPutValue(key, new BooleanValue(value));
@@ -497,6 +505,10 @@ public final class TypedProperties {
}
private synchronized void doPutValue(final SimpleString key, final PropertyValue value) {
+ if (key.startsWith(AMQ_PROPNAME)) {
+ internalProperties = true;
+ }
+
PropertyValue oldValue = properties.put(key, value);
if (oldValue != null) {
size += value.encodeSize() - oldValue.encodeSize();
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/80f6ae6b/artemis-core-client/src/main/java/org/apache/activemq/artemis/api/core/Message.java
----------------------------------------------------------------------
diff --git a/artemis-core-client/src/main/java/org/apache/activemq/artemis/api/core/Message.java b/artemis-core-client/src/main/java/org/apache/activemq/artemis/api/core/Message.java
index b39b719..f4f0e84 100644
--- a/artemis-core-client/src/main/java/org/apache/activemq/artemis/api/core/Message.java
+++ b/artemis-core-client/src/main/java/org/apache/activemq/artemis/api/core/Message.java
@@ -226,6 +226,10 @@ public interface Message {
* */
RefCountMessageListener getContext();
+ SimpleString getReplyTo();
+
+ Message setReplyTo(SimpleString address);
+
Message setContext(RefCountMessageListener context);
/** The buffer will belong to this message, until release is called. */
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/80f6ae6b/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/message/impl/CoreMessage.java
----------------------------------------------------------------------
diff --git a/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/message/impl/CoreMessage.java b/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/message/impl/CoreMessage.java
index 51c3701..22f9aa3 100644
--- a/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/message/impl/CoreMessage.java
+++ b/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/message/impl/CoreMessage.java
@@ -37,6 +37,7 @@ import org.apache.activemq.artemis.core.buffers.impl.ResetLimitWrappedActiveMQBu
import org.apache.activemq.artemis.core.message.LargeBodyEncoder;
import org.apache.activemq.artemis.core.persistence.Persister;
import org.apache.activemq.artemis.core.protocol.core.impl.PacketImpl;
+import org.apache.activemq.artemis.reader.MessageUtil;
import org.apache.activemq.artemis.utils.DataConstants;
import org.apache.activemq.artemis.utils.TypedProperties;
import org.apache.activemq.artemis.utils.UUID;
@@ -109,22 +110,24 @@ public class CoreMessage extends RefCountMessage implements ICoreMessage {
@Override
public void cleanupInternalProperties() {
- LinkedList<SimpleString> valuesToRemove = null;
-
- for (SimpleString name : getPropertyNames()) {
- // We use properties to establish routing context on clustering.
- // However if the client resends the message after receiving, it needs to be removed
- if ((name.startsWith(Message.HDR_ROUTE_TO_IDS) && !name.equals(Message.HDR_ROUTE_TO_IDS)) || (name.startsWith(Message.HDR_ROUTE_TO_ACK_IDS) && !name.equals(Message.HDR_ROUTE_TO_ACK_IDS))) {
- if (valuesToRemove == null) {
- valuesToRemove = new LinkedList<>();
+ if (properties.hasInternalProperties()) {
+ LinkedList<SimpleString> valuesToRemove = null;
+
+ for (SimpleString name : getPropertyNames()) {
+ // We use properties to establish routing context on clustering.
+ // However if the client resends the message after receiving, it needs to be removed
+ if ((name.startsWith(Message.HDR_ROUTE_TO_IDS) && !name.equals(Message.HDR_ROUTE_TO_IDS)) || (name.startsWith(Message.HDR_ROUTE_TO_ACK_IDS) && !name.equals(Message.HDR_ROUTE_TO_ACK_IDS))) {
+ if (valuesToRemove == null) {
+ valuesToRemove = new LinkedList<>();
+ }
+ valuesToRemove.add(name);
}
- valuesToRemove.add(name);
}
- }
- if (valuesToRemove != null) {
- for (SimpleString removal : valuesToRemove) {
- this.removeProperty(removal);
+ if (valuesToRemove != null) {
+ for (SimpleString removal : valuesToRemove) {
+ this.removeProperty(removal);
+ }
}
}
}
@@ -152,6 +155,23 @@ public class CoreMessage extends RefCountMessage implements ICoreMessage {
}
@Override
+ public SimpleString getReplyTo() {
+ return getSimpleStringProperty(MessageUtil.REPLYTO_HEADER_NAME);
+ }
+
+ @Override
+ public CoreMessage setReplyTo(SimpleString address) {
+
+ if (address == null) {
+ checkProperties();
+ properties.removeProperty(MessageUtil.REPLYTO_HEADER_NAME);
+ } else {
+ putStringProperty(MessageUtil.REPLYTO_HEADER_NAME, address);
+ }
+ return this;
+ }
+
+ @Override
public void receiveBuffer(ByteBuf buffer) {
this.buffer = buffer;
this.buffer.retain();
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/80f6ae6b/artemis-protocols/artemis-amqp-protocol/src/main/java/org/apache/activemq/artemis/protocol/amqp/broker/AMQPMessage.java
----------------------------------------------------------------------
diff --git a/artemis-protocols/artemis-amqp-protocol/src/main/java/org/apache/activemq/artemis/protocol/amqp/broker/AMQPMessage.java b/artemis-protocols/artemis-amqp-protocol/src/main/java/org/apache/activemq/artemis/protocol/amqp/broker/AMQPMessage.java
index 83970e5..a533760 100644
--- a/artemis-protocols/artemis-amqp-protocol/src/main/java/org/apache/activemq/artemis/protocol/amqp/broker/AMQPMessage.java
+++ b/artemis-protocols/artemis-amqp-protocol/src/main/java/org/apache/activemq/artemis/protocol/amqp/broker/AMQPMessage.java
@@ -60,8 +60,8 @@ public class AMQPMessage extends RefCountMessage {
MessageImpl protonMessage;
private volatile int memoryEstimate = -1;
private long expiration = 0;
- // this can be used to encode the header again and the rest of the message buffer
- private int headerEnd = -1;
+ // this is to store where to start sending bytes, ignoring header and delivery annotations.
+ private int sendFrom = -1;
private boolean parsedHeaders = false;
private Header _header;
private DeliveryAnnotations _deliveryAnnotations;
@@ -111,7 +111,7 @@ public class AMQPMessage extends RefCountMessage {
private void initalizeObjects() {
if (protonMessage == null) {
if (data == null) {
- this.headerEnd = -1;
+ this.sendFrom = -1;
_header = new Header();
_deliveryAnnotations = new DeliveryAnnotations(new HashMap<>());
_properties = new Properties();
@@ -214,7 +214,7 @@ public class AMQPMessage extends RefCountMessage {
}
if (section instanceof Header) {
- headerEnd = buffer.position();
+ sendFrom = buffer.position();
_header = (Header) section;
if (_header.getTtl() != null) {
@@ -228,10 +228,11 @@ public class AMQPMessage extends RefCountMessage {
}
} else {
// meaning there is no header
- headerEnd = 0;
+ sendFrom = 0;
}
if (section instanceof DeliveryAnnotations) {
_deliveryAnnotations = (DeliveryAnnotations) section;
+ sendFrom = buffer.position();
if (buffer.hasRemaining()) {
section = (Section) decoder.readObject();
@@ -258,7 +259,6 @@ public class AMQPMessage extends RefCountMessage {
} else {
section = null;
}
-
}
if (section instanceof ApplicationProperties) {
@@ -450,7 +450,7 @@ public class AMQPMessage extends RefCountMessage {
TLSEncode.getEncoder().writeObject(header);
}
}
- buffer.writeBytes(data, headerEnd, data.writerIndex() - headerEnd);
+ buffer.writeBytes(data, sendFrom, data.writerIndex() - sendFrom);
}
@Override
@@ -770,6 +770,26 @@ public class AMQPMessage extends RefCountMessage {
}
}
+
+ @Override
+ public SimpleString getReplyTo() {
+ if (getProperties() != null) {
+ return SimpleString.toSimpleString(getProperties().getReplyTo());
+ } else {
+ return null;
+ }
+
+ }
+
+ @Override
+ public AMQPMessage setReplyTo(SimpleString address) {
+ if (getProperties() != null) {
+ getProperties().setReplyTo(address.toString());
+ }
+ return this;
+ }
+
+
@Override
public int getPersistSize() {
checkBuffer();
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/80f6ae6b/artemis-protocols/artemis-amqp-protocol/src/main/java/org/apache/activemq/artemis/protocol/amqp/broker/AMQPSessionCallback.java
----------------------------------------------------------------------
diff --git a/artemis-protocols/artemis-amqp-protocol/src/main/java/org/apache/activemq/artemis/protocol/amqp/broker/AMQPSessionCallback.java b/artemis-protocols/artemis-amqp-protocol/src/main/java/org/apache/activemq/artemis/protocol/amqp/broker/AMQPSessionCallback.java
index 2ffcebf..a079190 100644
--- a/artemis-protocols/artemis-amqp-protocol/src/main/java/org/apache/activemq/artemis/protocol/amqp/broker/AMQPSessionCallback.java
+++ b/artemis-protocols/artemis-amqp-protocol/src/main/java/org/apache/activemq/artemis/protocol/amqp/broker/AMQPSessionCallback.java
@@ -40,7 +40,6 @@ import org.apache.activemq.artemis.core.server.impl.AddressInfo;
import org.apache.activemq.artemis.core.server.impl.ServerConsumerImpl;
import org.apache.activemq.artemis.core.transaction.Transaction;
import org.apache.activemq.artemis.jms.client.ActiveMQConnection;
-import org.apache.activemq.artemis.protocol.amqp.converter.CoreAmqpConverter;
import org.apache.activemq.artemis.protocol.amqp.exceptions.ActiveMQAMQPException;
import org.apache.activemq.artemis.protocol.amqp.exceptions.ActiveMQAMQPInternalErrorException;
import org.apache.activemq.artemis.protocol.amqp.exceptions.ActiveMQAMQPResourceLimitExceededException;
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/80f6ae6b/artemis-protocols/artemis-amqp-protocol/src/main/java/org/apache/activemq/artemis/protocol/amqp/converter/AmqpCoreConverter.java
----------------------------------------------------------------------
diff --git a/artemis-protocols/artemis-amqp-protocol/src/main/java/org/apache/activemq/artemis/protocol/amqp/converter/AmqpCoreConverter.java b/artemis-protocols/artemis-amqp-protocol/src/main/java/org/apache/activemq/artemis/protocol/amqp/converter/AmqpCoreConverter.java
index 656f2f2..030a7a0 100644
--- a/artemis-protocols/artemis-amqp-protocol/src/main/java/org/apache/activemq/artemis/protocol/amqp/converter/AmqpCoreConverter.java
+++ b/artemis-protocols/artemis-amqp-protocol/src/main/java/org/apache/activemq/artemis/protocol/amqp/converter/AmqpCoreConverter.java
@@ -171,6 +171,7 @@ public class AmqpCoreConverter {
}
populateMessage(result, message.getProtonMessage());
+ result.getInnerMessage().setReplyTo(message.getReplyTo());
result.encode();
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/80f6ae6b/artemis-protocols/artemis-amqp-protocol/src/main/java/org/apache/activemq/artemis/protocol/amqp/converter/CoreAmqpConverter.java
----------------------------------------------------------------------
diff --git a/artemis-protocols/artemis-amqp-protocol/src/main/java/org/apache/activemq/artemis/protocol/amqp/converter/CoreAmqpConverter.java b/artemis-protocols/artemis-amqp-protocol/src/main/java/org/apache/activemq/artemis/protocol/amqp/converter/CoreAmqpConverter.java
index 5ba3371..111de8c 100644
--- a/artemis-protocols/artemis-amqp-protocol/src/main/java/org/apache/activemq/artemis/protocol/amqp/converter/CoreAmqpConverter.java
+++ b/artemis-protocols/artemis-amqp-protocol/src/main/java/org/apache/activemq/artemis/protocol/amqp/converter/CoreAmqpConverter.java
@@ -316,6 +316,7 @@ public class CoreAmqpConverter {
AMQPMessage amqpMessage = new AMQPMessage(messageFormat, data);
amqpMessage.setMessageID(message.getInnerMessage().getMessageID());
+ amqpMessage.setReplyTo(coreMessage.getReplyTo());
return amqpMessage;
} finally {
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/80f6ae6b/artemis-protocols/artemis-openwire-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/openwire/OpenwireMessage.java
----------------------------------------------------------------------
diff --git a/artemis-protocols/artemis-openwire-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/openwire/OpenwireMessage.java b/artemis-protocols/artemis-openwire-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/openwire/OpenwireMessage.java
index 005186d..6c86751 100644
--- a/artemis-protocols/artemis-openwire-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/openwire/OpenwireMessage.java
+++ b/artemis-protocols/artemis-openwire-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/openwire/OpenwireMessage.java
@@ -42,6 +42,16 @@ public class OpenwireMessage implements Message {
}
@Override
+ public SimpleString getReplyTo() {
+ return null;
+ }
+
+ @Override
+ public Message setReplyTo(SimpleString address) {
+ return null;
+ }
+
+ @Override
public boolean containsDeliveryAnnotationProperty(SimpleString property) {
return false;
}
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/80f6ae6b/artemis-server/src/main/java/org/apache/activemq/artemis/core/postoffice/impl/PostOfficeImpl.java
----------------------------------------------------------------------
diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/postoffice/impl/PostOfficeImpl.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/postoffice/impl/PostOfficeImpl.java
index 9737dc0..464859f 100644
--- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/postoffice/impl/PostOfficeImpl.java
+++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/postoffice/impl/PostOfficeImpl.java
@@ -22,7 +22,6 @@ import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
-import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.Set;
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/80f6ae6b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/ServerConsumer.java
----------------------------------------------------------------------
diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/ServerConsumer.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/ServerConsumer.java
index 0d57a78..ce9c489 100644
--- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/ServerConsumer.java
+++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/ServerConsumer.java
@@ -18,7 +18,6 @@ package org.apache.activemq.artemis.core.server;
import java.util.List;
-import org.apache.activemq.artemis.api.core.ActiveMQException;
import org.apache.activemq.artemis.core.transaction.Transaction;
/**
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/80f6ae6b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/ServerSessionImpl.java
----------------------------------------------------------------------
diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/ServerSessionImpl.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/ServerSessionImpl.java
index 6d95341..5361983 100644
--- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/ServerSessionImpl.java
+++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/ServerSessionImpl.java
@@ -42,7 +42,6 @@ import org.apache.activemq.artemis.api.core.SimpleString;
import org.apache.activemq.artemis.api.core.client.ClientSession;
import org.apache.activemq.artemis.api.core.management.CoreNotificationType;
import org.apache.activemq.artemis.api.core.management.ManagementHelper;
-import org.apache.activemq.artemis.core.client.impl.ClientMessageImpl;
import org.apache.activemq.artemis.core.exception.ActiveMQXAException;
import org.apache.activemq.artemis.core.filter.Filter;
import org.apache.activemq.artemis.core.filter.impl.FilterImpl;
@@ -1550,7 +1549,7 @@ public class ServerSessionImpl implements ServerSession, FailureListener {
Message reply = managementService.handleMessage(message);
- SimpleString replyTo = message.getSimpleStringProperty(ClientMessageImpl.REPLYTO_HEADER_NAME);
+ SimpleString replyTo = message.getReplyTo();
if (replyTo != null) {
// TODO: move this check somewhere else? this is a JMS-specific bit of logic in the core impl
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/80f6ae6b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/management/impl/ManagementServiceImpl.java
----------------------------------------------------------------------
diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/management/impl/ManagementServiceImpl.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/management/impl/ManagementServiceImpl.java
index cda0a8a..f45aea7 100644
--- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/management/impl/ManagementServiceImpl.java
+++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/management/impl/ManagementServiceImpl.java
@@ -370,6 +370,7 @@ public class ManagementServiceImpl implements ManagementService {
message = message.toCore();
// a reply message is sent with the result stored in the message body.
CoreMessage reply = new CoreMessage(storageManager.generateID(), 512);
+ reply.setReplyTo(message.getReplyTo());
String resourceName = message.getStringProperty(ManagementHelper.HDR_RESOURCE_NAME);
if (logger.isDebugEnabled()) {
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/80f6ae6b/artemis-server/src/test/java/org/apache/activemq/artemis/core/server/impl/ScheduledDeliveryHandlerTest.java
----------------------------------------------------------------------
diff --git a/artemis-server/src/test/java/org/apache/activemq/artemis/core/server/impl/ScheduledDeliveryHandlerTest.java b/artemis-server/src/test/java/org/apache/activemq/artemis/core/server/impl/ScheduledDeliveryHandlerTest.java
index 447fb08..faf8b12 100644
--- a/artemis-server/src/test/java/org/apache/activemq/artemis/core/server/impl/ScheduledDeliveryHandlerTest.java
+++ b/artemis-server/src/test/java/org/apache/activemq/artemis/core/server/impl/ScheduledDeliveryHandlerTest.java
@@ -284,6 +284,16 @@ public class ScheduledDeliveryHandlerTest extends Assert {
class FakeMessage extends RefCountMessage {
@Override
+ public SimpleString getReplyTo() {
+ return null;
+ }
+
+ @Override
+ public Message setReplyTo(SimpleString address) {
+ return null;
+ }
+
+ @Override
public boolean containsDeliveryAnnotationProperty(SimpleString property) {
return false;
}
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/80f6ae6b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/amqp/AmqpDescribedTypePayloadTest.java
----------------------------------------------------------------------
diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/amqp/AmqpDescribedTypePayloadTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/amqp/AmqpDescribedTypePayloadTest.java
index bbb9c26..138f3cc 100644
--- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/amqp/AmqpDescribedTypePayloadTest.java
+++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/amqp/AmqpDescribedTypePayloadTest.java
@@ -24,6 +24,7 @@ import javax.jms.Destination;
import javax.jms.Message;
import javax.jms.MessageConsumer;
import javax.jms.MessageProducer;
+import javax.jms.ObjectMessage;
import javax.jms.Session;
import org.apache.activemq.ActiveMQConnectionFactory;
@@ -35,6 +36,7 @@ import org.apache.activemq.transport.amqp.client.AmqpNoLocalFilter;
import org.apache.activemq.transport.amqp.client.AmqpReceiver;
import org.apache.activemq.transport.amqp.client.AmqpSender;
import org.apache.activemq.transport.amqp.client.AmqpSession;
+import org.apache.qpid.jms.JmsConnectionFactory;
import org.junit.Test;
/**
@@ -119,7 +121,7 @@ public class AmqpDescribedTypePayloadTest extends AmqpClientTestSupport {
assertEquals(1, queue.getMessageCount());
// Receive and resend with OpenWire JMS client
- ActiveMQConnectionFactory factory = new ActiveMQConnectionFactory("tcp://localhost:61616");
+ JmsConnectionFactory factory = new JmsConnectionFactory("amqp://localhost:61616");
Connection jmsConnection = factory.createConnection();
try {
Session jmsSession = jmsConnection.createSession(false, Session.AUTO_ACKNOWLEDGE);
@@ -129,7 +131,7 @@ public class AmqpDescribedTypePayloadTest extends AmqpClientTestSupport {
Message received = jmsConsumer.receive(5000);
assertNotNull(received);
- assertTrue(received instanceof BytesMessage);
+ assertTrue(received instanceof ObjectMessage);
MessageProducer jmsProducer = jmsSession.createProducer(destination);
jmsProducer.send(received);
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/80f6ae6b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/amqp/ProtonTest.java
----------------------------------------------------------------------
diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/amqp/ProtonTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/amqp/ProtonTest.java
index 16f2e70..1308c37 100644
--- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/amqp/ProtonTest.java
+++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/amqp/ProtonTest.java
@@ -926,7 +926,7 @@ public class ProtonTest extends ProtonTestBase {
request.setText("[]");
sender.send(request);
- AmqpMessage response = receiver.receive(50, TimeUnit.SECONDS);
+ AmqpMessage response = receiver.receive(5, TimeUnit.SECONDS);
Assert.assertNotNull(response);
assertNotNull(response);
Object section = response.getWrappedMessage().getBody();
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/80f6ae6b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/AcknowledgeTest.java
----------------------------------------------------------------------
diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/AcknowledgeTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/AcknowledgeTest.java
index 887524a..08d9787 100644
--- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/AcknowledgeTest.java
+++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/AcknowledgeTest.java
@@ -341,6 +341,16 @@ public class AcknowledgeTest extends ActiveMQTestBase {
final long id;
@Override
+ public SimpleString getReplyTo() {
+ return null;
+ }
+
+ @Override
+ public Message setReplyTo(SimpleString address) {
+ return null;
+ }
+
+ @Override
public boolean containsDeliveryAnnotationProperty(SimpleString property) {
return false;
}
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/80f6ae6b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/bridge/SimpleTransformer.java
----------------------------------------------------------------------
diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/bridge/SimpleTransformer.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/bridge/SimpleTransformer.java
index c0487d0..e462240 100644
--- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/bridge/SimpleTransformer.java
+++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/bridge/SimpleTransformer.java
@@ -16,43 +16,42 @@
*/
package org.apache.activemq.artemis.tests.integration.cluster.bridge;
-
+import org.apache.activemq.artemis.api.core.ActiveMQBuffer;
+import org.apache.activemq.artemis.api.core.ICoreMessage;
import org.apache.activemq.artemis.api.core.Message;
+import org.apache.activemq.artemis.api.core.SimpleString;
import org.apache.activemq.artemis.core.server.cluster.Transformer;
public class SimpleTransformer implements Transformer {
@Override
- public Message transform(final Message message) {
-
- // TODO-now: fix this test!!!
-
- throw new RuntimeException(("Fix me"));
-// SimpleString oldProp = (SimpleString) message.getObjectProperty(new SimpleString("wibble"));
-//
-// if (!oldProp.equals(new SimpleString("bing"))) {
-// throw new IllegalStateException("Wrong property value!!");
-// }
-//
-// // Change a property
-// message.putStringProperty(new SimpleString("wibble"), new SimpleString("bong"));
-//
-// // Change the body
-// ActiveMQBuffer buffer = message.getBodyBuffer();
-//
-// buffer.readerIndex(0);
-//
-// String str = buffer.readString();
-//
-// if (!str.equals("doo be doo be doo be doo")) {
-// throw new IllegalStateException("Wrong body!!");
-// }
-//
-// buffer.clear();
-//
-// buffer.writeString("dee be dee be dee be dee");
-//
-// return message;
+ public Message transform(final Message messageParameter) {
+ ICoreMessage message = messageParameter.toCore();
+ SimpleString oldProp = (SimpleString) message.getObjectProperty(new SimpleString("wibble"));
+
+ if (!oldProp.equals(new SimpleString("bing"))) {
+ throw new IllegalStateException("Wrong property value!!");
+ }
+
+ // Change a property
+ message.putStringProperty(new SimpleString("wibble"), new SimpleString("bong"));
+
+ // Change the body
+ ActiveMQBuffer buffer = message.getBodyBuffer();
+
+ buffer.readerIndex(0);
+
+ String str = buffer.readString();
+
+ if (!str.equals("doo be doo be doo be doo")) {
+ throw new IllegalStateException("Wrong body!!");
+ }
+
+ buffer.clear();
+
+ buffer.writeString("dee be dee be dee be dee");
+
+ return message;
}
}