ARTEMIS-657 Fixing JORAM AMQP Tests

This commit is contained in:
Clebert Suconic 2016-08-31 12:25:02 -04:00
parent 6690da5b81
commit 03b938468a
3 changed files with 30 additions and 13 deletions

View File

@ -16,6 +16,7 @@
*/
package org.apache.activemq.artemis.core.protocol.proton.converter.message;
import org.apache.activemq.artemis.core.message.impl.MessageInternal;
import org.apache.qpid.proton.amqp.Binary;
import org.apache.qpid.proton.amqp.Symbol;
import org.apache.qpid.proton.amqp.UnsignedByte;
@ -31,6 +32,7 @@ import org.apache.qpid.proton.amqp.messaging.MessageAnnotations;
import org.apache.qpid.proton.amqp.messaging.Properties;
import org.apache.qpid.proton.amqp.messaging.Section;
import org.apache.qpid.proton.message.ProtonJMessage;
import org.jboss.logging.Logger;
import org.proton.plug.exceptions.ActiveMQAMQPIllegalStateException;
import javax.jms.BytesMessage;
@ -55,7 +57,7 @@ import java.util.Enumeration;
import java.util.HashMap;
public class JMSMappingOutboundTransformer extends OutboundTransformer {
private static final Logger logger = Logger.getLogger(JMSMappingOutboundTransformer.class);
public static final Symbol JMS_DEST_TYPE_MSG_ANNOTATION = Symbol.valueOf("x-opt-jms-dest");
public static final Symbol JMS_REPLY_TO_TYPE_MSG_ANNOTATION = Symbol.valueOf("x-opt-jms-reply-to");
@ -140,9 +142,22 @@ public class JMSMappingOutboundTransformer extends OutboundTransformer {
}
if (body == null && msg instanceof org.apache.activemq.artemis.core.protocol.proton.converter.jms.ServerJMSMessage) {
Object s = ((org.apache.activemq.artemis.core.protocol.proton.converter.jms.ServerJMSMessage) msg).getInnerMessage().getBodyBuffer().readNullableSimpleString();
if (s != null) {
body = new AmqpValue(s.toString());
MessageInternal internalMessage = ((org.apache.activemq.artemis.core.protocol.proton.converter.jms.ServerJMSMessage) msg).getInnerMessage();
if (!internalMessage.containsProperty("AMQP_MESSAGE_FORMAT")) {
int readerIndex = internalMessage.getBodyBuffer().readerIndex();
try {
Object s = internalMessage.getBodyBuffer().readNullableSimpleString();
if (s != null) {
body = new AmqpValue(s.toString());
}
}
catch (Throwable ignored) {
logger.debug("Exception ignored during conversion, should be ok!", ignored.getMessage(), ignored);
}
finally {
internalMessage.getBodyBuffer().readerIndex(readerIndex);
}
}
}

View File

@ -288,9 +288,14 @@ public class ServerMessageImpl extends MessageImpl implements ServerMessage {
@Override
public String toString() {
return "ServerMessage[messageID=" + messageID + ",durable=" + isDurable() + ",userID=" + getUserID() + ",priority=" + this.getPriority() + ", bodySize=" + this.getBodyBufferDuplicate().capacity() +
", timestamp=" + toDate(getTimestamp()) + ",expiration=" + toDate(getExpiration()) +
", durable=" + durable + ", address=" + getAddress() + ",properties=" + properties.toString() + "]@" + System.identityHashCode(this);
try {
return "ServerMessage[messageID=" + messageID + ",durable=" + isDurable() + ",userID=" + getUserID() + ",priority=" + this.getPriority() + ", bodySize=" + this.getBodyBufferDuplicate().capacity() +
", timestamp=" + toDate(getTimestamp()) + ",expiration=" + toDate(getExpiration()) +
", durable=" + durable + ", address=" + getAddress() + ",properties=" + properties.toString() + "]@" + System.identityHashCode(this);
}
catch (Throwable e) {
return "ServerMessage[messageID=" + messageID + "]";
}
}
private static String toDate(long timestamp) {

View File

@ -20,9 +20,6 @@
##
jms.provider.admin.class=org.apache.activemq.artemis.jms.ActiveMQCoreAdmin
#jms.provider.admin.class = org.apache.activemq.artemis.api.jms.GenericAdmin
#jms.provider.admin.class = org.objectweb.jtests.providers.admin.JoramAdmin
#jms.provider.admin.class = org.objectweb.jtests.providers.admin.AshnaMQAdmin
#jms.provider.admin.class = org.objectweb.jtests.providers.admin.FioranoMQAdmin
#jms.provider.admin.class = org.objectweb.jtests.providers.admin.PramatiAdmin
#jms.provider.admin.class = org.objectweb.jtests.providers.admin.SwiftMQAdmin
# Uncomment this to use AMQP by default on tests
#jms.provider.admin.class=org.apache.activemq.artemis.amqpJMS.ActiveMQAMQPAdmin