diff --git a/activemq-core/src/main/java/org/apache/activemq/command/Message.java b/activemq-core/src/main/java/org/apache/activemq/command/Message.java index e746726c1a..5c00d6ee41 100755 --- a/activemq-core/src/main/java/org/apache/activemq/command/Message.java +++ b/activemq-core/src/main/java/org/apache/activemq/command/Message.java @@ -46,9 +46,9 @@ abstract public class Message extends BaseCommand implements MarshallAware, Mess protected ActiveMQDestination originalDestination; protected TransactionId originalTransactionId; - protected ProducerId producerId; - protected ActiveMQDestination destination; - protected TransactionId transactionId; + protected ProducerId producerId; + protected ActiveMQDestination destination; + protected TransactionId transactionId; protected long expiration; protected long timestamp; @@ -68,20 +68,21 @@ abstract public class Message extends BaseCommand implements MarshallAware, Mess protected ByteSequence marshalledProperties; protected DataStructure dataStructure; protected int redeliveryCounter; - - protected transient int size; - protected transient HashMap properties; - protected transient boolean readOnlyProperties = false; - protected transient boolean readOnlyBody = false; + + protected int size; + protected HashMap properties; + protected boolean readOnlyProperties = false; + protected boolean readOnlyBody = false; protected transient boolean recievedByDFBridge = false; - private BrokerId [] brokerPath; private transient short referenceCount; private transient ActiveMQConnection connection; private transient org.apache.activemq.broker.region.Destination regionDestination; - private WireFormat cachedWireFormat; - private ByteSequence cachedWireFormatData; - + private transient WireFormat cachedWireFormat; + private transient ByteSequence cachedWireFormatData; + + private BrokerId [] brokerPath; + abstract public Message copy(); protected void copy(Message copy) { @@ -104,10 +105,12 @@ abstract public class Message extends BaseCommand implements MarshallAware, Mess copy.groupID = groupID; copy.userID = userID; copy.groupSequence = groupSequence; + if( properties!=null ) copy.properties = new HashMap(properties); else copy.properties = properties; + copy.content = content; copy.marshalledProperties = marshalledProperties; copy.dataStructure = dataStructure; diff --git a/activemq-optional/src/test/java/org/apache/activemq/transport/http/HttpJmsDurableTopicSendReceiveTest.java b/activemq-optional/src/test/java/org/apache/activemq/transport/http/HttpJmsDurableTopicSendReceiveTest.java new file mode 100644 index 0000000000..5adc2cde70 --- /dev/null +++ b/activemq-optional/src/test/java/org/apache/activemq/transport/http/HttpJmsDurableTopicSendReceiveTest.java @@ -0,0 +1,56 @@ +/** + * + * Copyright 2005-2006 The Apache Software Foundation + * + * 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.apache.activemq.transport.http; + +import org.apache.activemq.JmsDurableTopicSendReceiveTest; +import org.apache.activemq.ActiveMQConnectionFactory; +import org.apache.activemq.broker.BrokerService; + +public class HttpJmsDurableTopicSendReceiveTest extends JmsDurableTopicSendReceiveTest { + protected BrokerService broker; + + protected void setUp() throws Exception { + if (broker == null) { + broker = createBroker(); + broker.start(); + } + super.setUp(); + } + + protected void tearDown() throws Exception { + super.tearDown(); + if (broker != null) { + broker.stop(); + } + } + + protected ActiveMQConnectionFactory createConnectionFactory() { + ActiveMQConnectionFactory connectionFactory = new ActiveMQConnectionFactory(getBrokerURL()); + return connectionFactory; + } + + protected String getBrokerURL() { + return "http://localhost:8161"; + } + + protected BrokerService createBroker() throws Exception { + BrokerService answer = new BrokerService(); + answer.setPersistent(false); + answer.addConnector(getBrokerURL()); + return answer; + } +} diff --git a/activemq-optional/src/test/java/org/apache/activemq/transport/http/HttpPersistentSendAndReceiveTest.java b/activemq-optional/src/test/java/org/apache/activemq/transport/http/HttpPersistentSendAndReceiveTest.java new file mode 100644 index 0000000000..17af0a0c8a --- /dev/null +++ b/activemq-optional/src/test/java/org/apache/activemq/transport/http/HttpPersistentSendAndReceiveTest.java @@ -0,0 +1,38 @@ +/** + * + * Copyright 2005-2006 The Apache Software Foundation + * + * 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.apache.activemq.transport.http; + +import org.apache.activemq.broker.BrokerService; + +import javax.jms.DeliveryMode; + +public class HttpPersistentSendAndReceiveTest extends HttpJmsSendAndReceiveTest { + protected BrokerService broker; + + protected void setUp() throws Exception { + this.topic = false; + this.deliveryMode = DeliveryMode.PERSISTENT; + super.setUp(); + } + + protected BrokerService createBroker() throws Exception { + BrokerService answer = new BrokerService(); + answer.setPersistent(true); + answer.addConnector(getBrokerURL()); + return answer; + } +}