diff --git a/activemq-core/project.xml b/activemq-core/project.xml index c1cca33411..90269dd6ed 100755 --- a/activemq-core/project.xml +++ b/activemq-core/project.xml @@ -345,10 +345,6 @@ **/FanoutTransportBrokerTest.* **/DiscoveryTransportBrokerTest.* - - - **/openwire/*/*Test.* - diff --git a/activemq-core/src/main/java/org/apache/activemq/command/BaseCommand.java b/activemq-core/src/main/java/org/apache/activemq/command/BaseCommand.java index 402c3d68a4..dc6689a8d2 100755 --- a/activemq-core/src/main/java/org/apache/activemq/command/BaseCommand.java +++ b/activemq-core/src/main/java/org/apache/activemq/command/BaseCommand.java @@ -18,12 +18,13 @@ package org.apache.activemq.command; import org.apache.activemq.util.IntrospectionSupport; + /** * * @openwire:marshaller * @version $Revision: 1.11 $ */ -abstract public class BaseCommand implements Command { +abstract public class BaseCommand extends DataStructureSupport implements Command { protected short commandId; protected boolean responseRequired; @@ -33,42 +34,6 @@ abstract public class BaseCommand implements Command { copy.responseRequired = responseRequired; } - public boolean isWireFormatInfo() { - return false; - } - - public boolean isBrokerInfo() { - return false; - } - - public boolean isResponse() { - return false; - } - - public boolean isMessageDispatch() { - return false; - } - - public boolean isMessage() { - return false; - } - - public boolean isMarshallAware() { - return false; - } - - public boolean isMessageAck() { - return false; - } - - public boolean isMessageDispatchNotification(){ - return false; - } - - public boolean isShutdownInfo(){ - return false; - } - /** * @openwire:property version=1 */ @@ -94,5 +59,40 @@ abstract public class BaseCommand implements Command { public String toString() { return IntrospectionSupport.toString(this, BaseCommand.class); } + + public boolean isWireFormatInfo() { + return false; + } + public boolean isBrokerInfo() { + return false; + } + + public boolean isResponse() { + return false; + } + + public boolean isMessageDispatch() { + return false; + } + + public boolean isMessage() { + return false; + } + + public boolean isMarshallAware() { + return false; + } + + public boolean isMessageAck() { + return false; + } + + public boolean isMessageDispatchNotification() { + return false; + } + + public boolean isShutdownInfo() { + return false; + } } diff --git a/activemq-core/src/main/java/org/apache/activemq/command/DataStructureSupport.java b/activemq-core/src/main/java/org/apache/activemq/command/DataStructureSupport.java new file mode 100644 index 0000000000..0b6435d9b7 --- /dev/null +++ b/activemq-core/src/main/java/org/apache/activemq/command/DataStructureSupport.java @@ -0,0 +1,31 @@ +/** + * + * 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.command; + +import org.apache.activemq.util.IntrospectionSupport; + +/** + * + * @version $Revision$ + */ +public abstract class DataStructureSupport implements DataStructure { + + public String toString() { + return IntrospectionSupport.toString(this, DataStructureSupport.class); + } + +} diff --git a/activemq-core/src/main/java/org/apache/activemq/command/JournalQueueAck.java b/activemq-core/src/main/java/org/apache/activemq/command/JournalQueueAck.java index e8a3139e23..c10d22fe54 100755 --- a/activemq-core/src/main/java/org/apache/activemq/command/JournalQueueAck.java +++ b/activemq-core/src/main/java/org/apache/activemq/command/JournalQueueAck.java @@ -21,7 +21,7 @@ package org.apache.activemq.command; * @openwire:marshaller code="52" * @version $Revision$ */ -public class JournalQueueAck implements DataStructure { +public class JournalQueueAck extends DataStructureSupport implements DataStructure { public static final byte DATA_STRUCTURE_TYPE=CommandTypes.JOURNAL_REMOVE; diff --git a/activemq-core/src/main/java/org/apache/activemq/command/JournalTopicAck.java b/activemq-core/src/main/java/org/apache/activemq/command/JournalTopicAck.java index e2e526f43b..a3ee01e4cf 100755 --- a/activemq-core/src/main/java/org/apache/activemq/command/JournalTopicAck.java +++ b/activemq-core/src/main/java/org/apache/activemq/command/JournalTopicAck.java @@ -21,7 +21,7 @@ package org.apache.activemq.command; * @openwire:marshaller code="50" * @version $Revision$ */ -public class JournalTopicAck implements DataStructure { +public class JournalTopicAck extends DataStructureSupport implements DataStructure { public static final byte DATA_STRUCTURE_TYPE=CommandTypes.JOURNAL_ACK; diff --git a/activemq-core/src/main/java/org/apache/activemq/command/JournalTrace.java b/activemq-core/src/main/java/org/apache/activemq/command/JournalTrace.java index c75ee3f8d7..4eb36bf549 100755 --- a/activemq-core/src/main/java/org/apache/activemq/command/JournalTrace.java +++ b/activemq-core/src/main/java/org/apache/activemq/command/JournalTrace.java @@ -21,7 +21,7 @@ package org.apache.activemq.command; * @openwire:marshaller code="53" * @version $Revision: 1.6 $ */ -public class JournalTrace implements DataStructure { +public class JournalTrace extends DataStructureSupport implements DataStructure { public static final byte DATA_STRUCTURE_TYPE=CommandTypes.JOURNAL_TRACE; diff --git a/activemq-core/src/main/java/org/apache/activemq/command/JournalTransaction.java b/activemq-core/src/main/java/org/apache/activemq/command/JournalTransaction.java index 8e6b9284be..02d2363a64 100755 --- a/activemq-core/src/main/java/org/apache/activemq/command/JournalTransaction.java +++ b/activemq-core/src/main/java/org/apache/activemq/command/JournalTransaction.java @@ -20,7 +20,7 @@ package org.apache.activemq.command; /** * @openwire:marshaller code="54" */ -public class JournalTransaction implements DataStructure { +public class JournalTransaction extends DataStructureSupport implements DataStructure { public static final byte DATA_STRUCTURE_TYPE=CommandTypes.JOURNAL_TRANSACTION; diff --git a/activemq-core/src/main/java/org/apache/activemq/command/KeepAliveInfo.java b/activemq-core/src/main/java/org/apache/activemq/command/KeepAliveInfo.java index 27bf6d50e6..de9025f888 100755 --- a/activemq-core/src/main/java/org/apache/activemq/command/KeepAliveInfo.java +++ b/activemq-core/src/main/java/org/apache/activemq/command/KeepAliveInfo.java @@ -22,7 +22,7 @@ import org.apache.activemq.state.CommandVisitor; * @openwire:marshaller code="10" * @version $Revision$ */ -public class KeepAliveInfo implements Command { +public class KeepAliveInfo extends DataStructureSupport implements Command { public static final byte DATA_STRUCTURE_TYPE=CommandTypes.KEEP_ALIVE_INFO; diff --git a/activemq-core/src/main/java/org/apache/activemq/command/WireFormatInfo.java b/activemq-core/src/main/java/org/apache/activemq/command/WireFormatInfo.java index 9b87c9870e..3c4704abd2 100755 --- a/activemq-core/src/main/java/org/apache/activemq/command/WireFormatInfo.java +++ b/activemq-core/src/main/java/org/apache/activemq/command/WireFormatInfo.java @@ -48,7 +48,7 @@ public class WireFormatInfo implements Command { } /** - * @openwire:property version=1 size=8 + * @openwire:property version=1 size=8 testSize=-1 */ public byte[] getMagic() { return magic; diff --git a/activemq-core/src/main/java/org/apache/activemq/openwire/v1/ActiveMQDestinationMarshaller.java b/activemq-core/src/main/java/org/apache/activemq/openwire/v1/ActiveMQDestinationMarshaller.java index f6364959ee..3fa641b2a2 100755 --- a/activemq-core/src/main/java/org/apache/activemq/openwire/v1/ActiveMQDestinationMarshaller.java +++ b/activemq-core/src/main/java/org/apache/activemq/openwire/v1/ActiveMQDestinationMarshaller.java @@ -36,7 +36,7 @@ import org.apache.activemq.command.*; * * @version $Revision$ */ -public abstract class ActiveMQDestinationMarshaller extends org.apache.activemq.openwire.DataStreamMarshaller { +public abstract class ActiveMQDestinationMarshaller extends DataStreamMarshaller { /** * Un-marshal an object instance from the data input stream diff --git a/activemq-core/src/main/java/org/apache/activemq/openwire/v1/BaseCommandMarshaller.java b/activemq-core/src/main/java/org/apache/activemq/openwire/v1/BaseCommandMarshaller.java index c43afca34f..a29048393e 100755 --- a/activemq-core/src/main/java/org/apache/activemq/openwire/v1/BaseCommandMarshaller.java +++ b/activemq-core/src/main/java/org/apache/activemq/openwire/v1/BaseCommandMarshaller.java @@ -36,7 +36,7 @@ import org.apache.activemq.command.*; * * @version $Revision$ */ -public abstract class BaseCommandMarshaller extends org.apache.activemq.openwire.DataStreamMarshaller { +public abstract class BaseCommandMarshaller extends DataStreamMarshaller { /** * Un-marshal an object instance from the data input stream diff --git a/activemq-core/src/main/java/org/apache/activemq/openwire/v1/BrokerIdMarshaller.java b/activemq-core/src/main/java/org/apache/activemq/openwire/v1/BrokerIdMarshaller.java index 68e49c0cb8..19a81e5f5f 100755 --- a/activemq-core/src/main/java/org/apache/activemq/openwire/v1/BrokerIdMarshaller.java +++ b/activemq-core/src/main/java/org/apache/activemq/openwire/v1/BrokerIdMarshaller.java @@ -36,7 +36,7 @@ import org.apache.activemq.command.*; * * @version $Revision$ */ -public class BrokerIdMarshaller extends org.apache.activemq.openwire.DataStreamMarshaller { +public class BrokerIdMarshaller extends DataStreamMarshaller { /** * Return the type of Data Structure we marshal diff --git a/activemq-core/src/main/java/org/apache/activemq/openwire/v1/ConnectionIdMarshaller.java b/activemq-core/src/main/java/org/apache/activemq/openwire/v1/ConnectionIdMarshaller.java index 2e42718208..b0b4fad8f5 100755 --- a/activemq-core/src/main/java/org/apache/activemq/openwire/v1/ConnectionIdMarshaller.java +++ b/activemq-core/src/main/java/org/apache/activemq/openwire/v1/ConnectionIdMarshaller.java @@ -36,7 +36,7 @@ import org.apache.activemq.command.*; * * @version $Revision$ */ -public class ConnectionIdMarshaller extends org.apache.activemq.openwire.DataStreamMarshaller { +public class ConnectionIdMarshaller extends DataStreamMarshaller { /** * Return the type of Data Structure we marshal diff --git a/activemq-core/src/main/java/org/apache/activemq/openwire/v1/ConsumerIdMarshaller.java b/activemq-core/src/main/java/org/apache/activemq/openwire/v1/ConsumerIdMarshaller.java index b520f1a7d4..19b0cfa95b 100755 --- a/activemq-core/src/main/java/org/apache/activemq/openwire/v1/ConsumerIdMarshaller.java +++ b/activemq-core/src/main/java/org/apache/activemq/openwire/v1/ConsumerIdMarshaller.java @@ -36,7 +36,7 @@ import org.apache.activemq.command.*; * * @version $Revision$ */ -public class ConsumerIdMarshaller extends org.apache.activemq.openwire.DataStreamMarshaller { +public class ConsumerIdMarshaller extends DataStreamMarshaller { /** * Return the type of Data Structure we marshal diff --git a/activemq-core/src/main/java/org/apache/activemq/openwire/v1/DiscoveryEventMarshaller.java b/activemq-core/src/main/java/org/apache/activemq/openwire/v1/DiscoveryEventMarshaller.java index 43383821ff..50b3aa3d93 100644 --- a/activemq-core/src/main/java/org/apache/activemq/openwire/v1/DiscoveryEventMarshaller.java +++ b/activemq-core/src/main/java/org/apache/activemq/openwire/v1/DiscoveryEventMarshaller.java @@ -36,7 +36,7 @@ import org.apache.activemq.command.*; * * @version $Revision$ */ -public class DiscoveryEventMarshaller extends org.apache.activemq.openwire.DataStreamMarshaller { +public class DiscoveryEventMarshaller extends DataStreamMarshaller { /** * Return the type of Data Structure we marshal diff --git a/activemq-core/src/main/java/org/apache/activemq/openwire/v1/JournalQueueAckMarshaller.java b/activemq-core/src/main/java/org/apache/activemq/openwire/v1/JournalQueueAckMarshaller.java index cea205c57e..9484434efe 100755 --- a/activemq-core/src/main/java/org/apache/activemq/openwire/v1/JournalQueueAckMarshaller.java +++ b/activemq-core/src/main/java/org/apache/activemq/openwire/v1/JournalQueueAckMarshaller.java @@ -36,7 +36,7 @@ import org.apache.activemq.command.*; * * @version $Revision$ */ -public class JournalQueueAckMarshaller extends org.apache.activemq.openwire.DataStreamMarshaller { +public class JournalQueueAckMarshaller extends DataStreamMarshaller { /** * Return the type of Data Structure we marshal diff --git a/activemq-core/src/main/java/org/apache/activemq/openwire/v1/JournalTopicAckMarshaller.java b/activemq-core/src/main/java/org/apache/activemq/openwire/v1/JournalTopicAckMarshaller.java index 6381152fd7..d3cb770886 100755 --- a/activemq-core/src/main/java/org/apache/activemq/openwire/v1/JournalTopicAckMarshaller.java +++ b/activemq-core/src/main/java/org/apache/activemq/openwire/v1/JournalTopicAckMarshaller.java @@ -36,7 +36,7 @@ import org.apache.activemq.command.*; * * @version $Revision$ */ -public class JournalTopicAckMarshaller extends org.apache.activemq.openwire.DataStreamMarshaller { +public class JournalTopicAckMarshaller extends DataStreamMarshaller { /** * Return the type of Data Structure we marshal diff --git a/activemq-core/src/main/java/org/apache/activemq/openwire/v1/JournalTraceMarshaller.java b/activemq-core/src/main/java/org/apache/activemq/openwire/v1/JournalTraceMarshaller.java index 759561f005..1e88ca3ae1 100755 --- a/activemq-core/src/main/java/org/apache/activemq/openwire/v1/JournalTraceMarshaller.java +++ b/activemq-core/src/main/java/org/apache/activemq/openwire/v1/JournalTraceMarshaller.java @@ -36,7 +36,7 @@ import org.apache.activemq.command.*; * * @version $Revision$ */ -public class JournalTraceMarshaller extends org.apache.activemq.openwire.DataStreamMarshaller { +public class JournalTraceMarshaller extends DataStreamMarshaller { /** * Return the type of Data Structure we marshal diff --git a/activemq-core/src/main/java/org/apache/activemq/openwire/v1/JournalTransactionMarshaller.java b/activemq-core/src/main/java/org/apache/activemq/openwire/v1/JournalTransactionMarshaller.java index 97194f019f..a5ca8881eb 100755 --- a/activemq-core/src/main/java/org/apache/activemq/openwire/v1/JournalTransactionMarshaller.java +++ b/activemq-core/src/main/java/org/apache/activemq/openwire/v1/JournalTransactionMarshaller.java @@ -36,7 +36,7 @@ import org.apache.activemq.command.*; * * @version $Revision$ */ -public class JournalTransactionMarshaller extends org.apache.activemq.openwire.DataStreamMarshaller { +public class JournalTransactionMarshaller extends DataStreamMarshaller { /** * Return the type of Data Structure we marshal diff --git a/activemq-core/src/main/java/org/apache/activemq/openwire/v1/KeepAliveInfoMarshaller.java b/activemq-core/src/main/java/org/apache/activemq/openwire/v1/KeepAliveInfoMarshaller.java index ecd7f3b8c9..b655c4a710 100755 --- a/activemq-core/src/main/java/org/apache/activemq/openwire/v1/KeepAliveInfoMarshaller.java +++ b/activemq-core/src/main/java/org/apache/activemq/openwire/v1/KeepAliveInfoMarshaller.java @@ -36,7 +36,7 @@ import org.apache.activemq.command.*; * * @version $Revision$ */ -public class KeepAliveInfoMarshaller extends org.apache.activemq.openwire.DataStreamMarshaller { +public class KeepAliveInfoMarshaller extends DataStreamMarshaller { /** * Return the type of Data Structure we marshal diff --git a/activemq-core/src/main/java/org/apache/activemq/openwire/v1/MessageIdMarshaller.java b/activemq-core/src/main/java/org/apache/activemq/openwire/v1/MessageIdMarshaller.java index b0ab417080..b31376ec2f 100755 --- a/activemq-core/src/main/java/org/apache/activemq/openwire/v1/MessageIdMarshaller.java +++ b/activemq-core/src/main/java/org/apache/activemq/openwire/v1/MessageIdMarshaller.java @@ -36,7 +36,7 @@ import org.apache.activemq.command.*; * * @version $Revision$ */ -public class MessageIdMarshaller extends org.apache.activemq.openwire.DataStreamMarshaller { +public class MessageIdMarshaller extends DataStreamMarshaller { /** * Return the type of Data Structure we marshal diff --git a/activemq-core/src/main/java/org/apache/activemq/openwire/v1/ProducerIdMarshaller.java b/activemq-core/src/main/java/org/apache/activemq/openwire/v1/ProducerIdMarshaller.java index ece3a31d35..99edb412ec 100755 --- a/activemq-core/src/main/java/org/apache/activemq/openwire/v1/ProducerIdMarshaller.java +++ b/activemq-core/src/main/java/org/apache/activemq/openwire/v1/ProducerIdMarshaller.java @@ -36,7 +36,7 @@ import org.apache.activemq.command.*; * * @version $Revision$ */ -public class ProducerIdMarshaller extends org.apache.activemq.openwire.DataStreamMarshaller { +public class ProducerIdMarshaller extends DataStreamMarshaller { /** * Return the type of Data Structure we marshal diff --git a/activemq-core/src/main/java/org/apache/activemq/openwire/v1/SessionIdMarshaller.java b/activemq-core/src/main/java/org/apache/activemq/openwire/v1/SessionIdMarshaller.java index bcf9326dd4..163e91cb02 100755 --- a/activemq-core/src/main/java/org/apache/activemq/openwire/v1/SessionIdMarshaller.java +++ b/activemq-core/src/main/java/org/apache/activemq/openwire/v1/SessionIdMarshaller.java @@ -36,7 +36,7 @@ import org.apache.activemq.command.*; * * @version $Revision$ */ -public class SessionIdMarshaller extends org.apache.activemq.openwire.DataStreamMarshaller { +public class SessionIdMarshaller extends DataStreamMarshaller { /** * Return the type of Data Structure we marshal diff --git a/activemq-core/src/main/java/org/apache/activemq/openwire/v1/SubscriptionInfoMarshaller.java b/activemq-core/src/main/java/org/apache/activemq/openwire/v1/SubscriptionInfoMarshaller.java index 71e6676ad5..deff325269 100755 --- a/activemq-core/src/main/java/org/apache/activemq/openwire/v1/SubscriptionInfoMarshaller.java +++ b/activemq-core/src/main/java/org/apache/activemq/openwire/v1/SubscriptionInfoMarshaller.java @@ -36,7 +36,7 @@ import org.apache.activemq.command.*; * * @version $Revision$ */ -public class SubscriptionInfoMarshaller extends org.apache.activemq.openwire.DataStreamMarshaller { +public class SubscriptionInfoMarshaller extends DataStreamMarshaller { /** * Return the type of Data Structure we marshal diff --git a/activemq-core/src/main/java/org/apache/activemq/openwire/v1/TransactionIdMarshaller.java b/activemq-core/src/main/java/org/apache/activemq/openwire/v1/TransactionIdMarshaller.java index 10d48459ea..0500b346a7 100755 --- a/activemq-core/src/main/java/org/apache/activemq/openwire/v1/TransactionIdMarshaller.java +++ b/activemq-core/src/main/java/org/apache/activemq/openwire/v1/TransactionIdMarshaller.java @@ -36,7 +36,7 @@ import org.apache.activemq.command.*; * * @version $Revision$ */ -public abstract class TransactionIdMarshaller extends org.apache.activemq.openwire.DataStreamMarshaller { +public abstract class TransactionIdMarshaller extends DataStreamMarshaller { /** * Un-marshal an object instance from the data input stream diff --git a/activemq-core/src/main/java/org/apache/activemq/openwire/v1/WireFormatInfoMarshaller.java b/activemq-core/src/main/java/org/apache/activemq/openwire/v1/WireFormatInfoMarshaller.java index 42d728af0e..a6f6e56a36 100755 --- a/activemq-core/src/main/java/org/apache/activemq/openwire/v1/WireFormatInfoMarshaller.java +++ b/activemq-core/src/main/java/org/apache/activemq/openwire/v1/WireFormatInfoMarshaller.java @@ -36,7 +36,7 @@ import org.apache.activemq.command.*; * * @version $Revision$ */ -public class WireFormatInfoMarshaller extends org.apache.activemq.openwire.DataStreamMarshaller { +public class WireFormatInfoMarshaller extends DataStreamMarshaller { /** * Return the type of Data Structure we marshal diff --git a/activemq-core/src/test/java/org/apache/activemq/filter/DestinationPathTest.java b/activemq-core/src/test/java/org/apache/activemq/filter/DestinationPathTest.java index 82ee89de84..197ae08dcf 100755 --- a/activemq-core/src/test/java/org/apache/activemq/filter/DestinationPathTest.java +++ b/activemq-core/src/test/java/org/apache/activemq/filter/DestinationPathTest.java @@ -16,11 +16,9 @@ */ package org.apache.activemq.filter; -import org.apache.activemq.filter.DestinationPath; +import org.apache.activemq.test.TestSupport; -import junit.framework.TestCase; - -public class DestinationPathTest extends TestCase { +public class DestinationPathTest extends TestSupport { public void testPathParse() { assertParse("FOO", new String[]{"FOO"}); @@ -35,11 +33,4 @@ public class DestinationPathTest extends TestCase { String[] path = DestinationPath.getDestinationPaths(subject); assertArrayEqual(subject, expected, path); } - - protected void assertArrayEqual(String message, Object[] expected, Object[] actual) { - assertEquals(message + ". Array length", expected.length, actual.length); - for (int i = 0; i < expected.length; i++) { - assertEquals(message + ". element: " + i, expected[i], actual[i]); - } - } } diff --git a/activemq-core/src/test/java/org/apache/activemq/openwire/DataFileGeneratorTestSupport.java b/activemq-core/src/test/java/org/apache/activemq/openwire/DataFileGeneratorTestSupport.java index d65f6492f8..0db39bb0f0 100644 --- a/activemq-core/src/test/java/org/apache/activemq/openwire/DataFileGeneratorTestSupport.java +++ b/activemq-core/src/test/java/org/apache/activemq/openwire/DataFileGeneratorTestSupport.java @@ -16,6 +16,7 @@ */ package org.apache.activemq.openwire; +import org.activeio.ByteSequence; import org.apache.activemq.command.ActiveMQDestination; import org.apache.activemq.command.ActiveMQQueue; import org.apache.activemq.command.ActiveMQTextMessage; @@ -34,7 +35,11 @@ import org.apache.activemq.command.TransactionId; import org.apache.activemq.openwire.v1.ActiveMQTextMessageTest; import org.apache.activemq.openwire.v1.BrokerInfoTest; import org.apache.activemq.openwire.v1.MessageAckTest; +import org.apache.activemq.test.TestSupport; +import java.beans.BeanInfo; +import java.beans.Introspector; +import java.beans.PropertyDescriptor; import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.DataInputStream; @@ -43,17 +48,23 @@ import java.io.File; import java.io.FileInputStream; import java.io.FileOutputStream; import java.io.InputStream; +import java.lang.reflect.Array; +import java.lang.reflect.InvocationTargetException; +import java.lang.reflect.Method; import java.net.URI; import java.net.URL; +import java.util.*; import junit.framework.TestCase; -public abstract class DataFileGeneratorTestSupport extends TestCase { +public abstract class DataFileGeneratorTestSupport extends TestSupport { + + protected static final Object[] EMPTY_ARGUMENTS = {}; + private static Throwable singletonException = new Exception("shared exception"); static final File moduleBaseDir; static final File controlDir; static final File classFileDir; - private static Throwable singletonException = new Exception("shared exception"); static { File basedir = null; @@ -77,7 +88,7 @@ public abstract class DataFileGeneratorTestSupport extends TestCase { generateControlFile(); assertControlFileIsEqual(); } - + public void testGenerateAndReParsingIsTheSame() throws Exception { ByteArrayOutputStream buffer = new ByteArrayOutputStream(); DataOutputStream ds = new DataOutputStream(buffer); @@ -85,17 +96,106 @@ public abstract class DataFileGeneratorTestSupport extends TestCase { System.out.println("Created: " + expected); openWireformat.marshal(expected, ds); ds.close(); - + // now lets try parse it back again ByteArrayInputStream in = new ByteArrayInputStream(buffer.toByteArray()); DataInputStream dis = new DataInputStream(in); Object actual = openWireformat.unmarshal(dis); - + System.out.println("Parsed: " + actual); - - assertEquals("Objects should be equal", expected.toString(), actual.toString()); - - // TODO generate a property based equality method? + + assertBeansEqual("", new HashSet(), expected, actual); + } + + protected void assertBeansEqual(String message, Set comparedObjects, Object expected, Object actual) throws Exception { + assertNotNull("Actual object should be equal to: " + expected + " but was null", actual); + if (comparedObjects.contains(expected)) { + return; + } + comparedObjects.add(expected); + Class type = expected.getClass(); + assertEquals("Should be of same type", type, actual.getClass()); + BeanInfo beanInfo = Introspector.getBeanInfo(type); + PropertyDescriptor[] descriptors = beanInfo.getPropertyDescriptors(); + for (int i = 0; i < descriptors.length; i++) { + PropertyDescriptor descriptor = descriptors[i]; + Method method = descriptor.getReadMethod(); + if (method != null) { + String name = descriptor.getName(); + Object expectedValue = null; + Object actualValue = null; + try { + expectedValue = method.invoke(expected, EMPTY_ARGUMENTS); + actualValue = method.invoke(actual, EMPTY_ARGUMENTS); + } + catch (Exception e) { + System.out.println("Failed to access property: " + name); + } + assertPropertyValuesEqual(message + name, comparedObjects, expectedValue, actualValue); + } + } + } + + protected void assertPropertyValuesEqual(String name, Set comparedObjects, Object expectedValue, Object actualValue) throws Exception { + String message = "Property " + name + " not equal"; + if (expectedValue == null) { + assertNull("Property " + name + " should be null", actualValue); + } + else if (expectedValue instanceof Object[]) { + assertArrayEqual(message, comparedObjects, (Object[]) expectedValue, (Object[]) actualValue); + } + else if (expectedValue.getClass().isArray()) { + assertPrimitiveArrayEqual(message, comparedObjects, expectedValue, actualValue); + } + else { + if (expectedValue instanceof Exception) { + assertExceptionsEqual(message, (Exception) expectedValue, actualValue); + } + else if (expectedValue instanceof ByteSequence) { + assertByteSequencesEqual(message, (ByteSequence) expectedValue, actualValue); + } + else if (expectedValue instanceof DataStructure) { + assertBeansEqual(message + name, comparedObjects, expectedValue, actualValue); + } + else { + assertEquals(message, expectedValue, actualValue); + } + + } + } + + protected void assertArrayEqual(String message,Set comparedObjects, Object[] expected, Object[] actual) throws Exception { + assertEquals(message + ". Array length", expected.length, actual.length); + for (int i = 0; i < expected.length; i++) { + assertPropertyValuesEqual(message + ". element: " + i, comparedObjects, expected[i], actual[i]); + } + } + + protected void assertPrimitiveArrayEqual(String message, Set comparedObjects, Object expected, Object actual) throws ArrayIndexOutOfBoundsException, IllegalArgumentException, Exception { + int length = Array.getLength(expected); + assertEquals(message + ". Array length", length, Array.getLength(actual)); + for (int i = 0; i < length; i++) { + assertPropertyValuesEqual(message + ". element: " + i, comparedObjects, Array.get(expected, i), Array.get(actual, i)); + } + } + protected void assertByteSequencesEqual(String message, ByteSequence expected, Object actualValue) { + assertTrue(message + ". Actual value should be a ByteSequence but was: " + actualValue, actualValue instanceof ByteSequence); + ByteSequence actual = (ByteSequence) actualValue; + int length = expected.getLength(); + assertEquals(message + ". Length", length, actual.getLength()); + int offset = expected.getOffset(); + assertEquals(message + ". Offset", offset, actual.getOffset()); + byte[] data = expected.getData(); + byte[] actualData = actual.getData(); + for (int i = 0; i < length; i++) { + assertEquals(message + ". Offset " + i, data[offset + i], actualData[offset + i]); + } + } + + protected void assertExceptionsEqual(String message, Exception expected, Object actualValue) { + assertTrue(message + ". Actual value should be an exception but was: " + actualValue, actualValue instanceof Exception); + Exception actual = (Exception) actualValue; + assertEquals(message, expected.getMessage(), actual.getMessage()); } protected void setUp() throws Exception { diff --git a/activemq-core/src/test/java/org/apache/activemq/openwire/v1/ActiveMQBytesMessageTest.java b/activemq-core/src/test/java/org/apache/activemq/openwire/v1/ActiveMQBytesMessageTest.java index 0ecfafc091..aa13731116 100644 --- a/activemq-core/src/test/java/org/apache/activemq/openwire/v1/ActiveMQBytesMessageTest.java +++ b/activemq-core/src/test/java/org/apache/activemq/openwire/v1/ActiveMQBytesMessageTest.java @@ -33,7 +33,7 @@ import org.apache.activemq.command.*; * under src/gram/script and then use maven openwire:generate to regenerate * this file. * - * @version $Revision$ + * @version $Revision: $ */ public class ActiveMQBytesMessageTest extends ActiveMQMessageTest { diff --git a/activemq-core/src/test/java/org/apache/activemq/openwire/v1/ActiveMQDestinationTestSupport.java b/activemq-core/src/test/java/org/apache/activemq/openwire/v1/ActiveMQDestinationTestSupport.java index 9af8252a2e..62694c6f3e 100644 --- a/activemq-core/src/test/java/org/apache/activemq/openwire/v1/ActiveMQDestinationTestSupport.java +++ b/activemq-core/src/test/java/org/apache/activemq/openwire/v1/ActiveMQDestinationTestSupport.java @@ -33,7 +33,7 @@ import org.apache.activemq.command.*; * under src/gram/script and then use maven openwire:generate to regenerate * this file. * - * @version $Revision$ + * @version $Revision: $ */ public abstract class ActiveMQDestinationTestSupport extends DataFileGeneratorTestSupport { diff --git a/activemq-core/src/test/java/org/apache/activemq/openwire/v1/ActiveMQMapMessageTest.java b/activemq-core/src/test/java/org/apache/activemq/openwire/v1/ActiveMQMapMessageTest.java index ec7c3f963b..a0714a8f4b 100644 --- a/activemq-core/src/test/java/org/apache/activemq/openwire/v1/ActiveMQMapMessageTest.java +++ b/activemq-core/src/test/java/org/apache/activemq/openwire/v1/ActiveMQMapMessageTest.java @@ -33,7 +33,7 @@ import org.apache.activemq.command.*; * under src/gram/script and then use maven openwire:generate to regenerate * this file. * - * @version $Revision$ + * @version $Revision: $ */ public class ActiveMQMapMessageTest extends ActiveMQMessageTest { diff --git a/activemq-core/src/test/java/org/apache/activemq/openwire/v1/ActiveMQMessageTest.java b/activemq-core/src/test/java/org/apache/activemq/openwire/v1/ActiveMQMessageTest.java index bc4048ce1f..2f2037b4c3 100644 --- a/activemq-core/src/test/java/org/apache/activemq/openwire/v1/ActiveMQMessageTest.java +++ b/activemq-core/src/test/java/org/apache/activemq/openwire/v1/ActiveMQMessageTest.java @@ -33,7 +33,7 @@ import org.apache.activemq.command.*; * under src/gram/script and then use maven openwire:generate to regenerate * this file. * - * @version $Revision$ + * @version $Revision: $ */ public class ActiveMQMessageTest extends MessageTestSupport { diff --git a/activemq-core/src/test/java/org/apache/activemq/openwire/v1/ActiveMQObjectMessageTest.java b/activemq-core/src/test/java/org/apache/activemq/openwire/v1/ActiveMQObjectMessageTest.java index e88dbef3d2..1b874e4779 100644 --- a/activemq-core/src/test/java/org/apache/activemq/openwire/v1/ActiveMQObjectMessageTest.java +++ b/activemq-core/src/test/java/org/apache/activemq/openwire/v1/ActiveMQObjectMessageTest.java @@ -33,7 +33,7 @@ import org.apache.activemq.command.*; * under src/gram/script and then use maven openwire:generate to regenerate * this file. * - * @version $Revision$ + * @version $Revision: $ */ public class ActiveMQObjectMessageTest extends ActiveMQMessageTest { diff --git a/activemq-core/src/test/java/org/apache/activemq/openwire/v1/ActiveMQQueueTest.java b/activemq-core/src/test/java/org/apache/activemq/openwire/v1/ActiveMQQueueTest.java index a0ad108772..6516221b64 100644 --- a/activemq-core/src/test/java/org/apache/activemq/openwire/v1/ActiveMQQueueTest.java +++ b/activemq-core/src/test/java/org/apache/activemq/openwire/v1/ActiveMQQueueTest.java @@ -33,7 +33,7 @@ import org.apache.activemq.command.*; * under src/gram/script and then use maven openwire:generate to regenerate * this file. * - * @version $Revision$ + * @version $Revision: $ */ public class ActiveMQQueueTest extends ActiveMQDestinationTestSupport { diff --git a/activemq-core/src/test/java/org/apache/activemq/openwire/v1/ActiveMQStreamMessageTest.java b/activemq-core/src/test/java/org/apache/activemq/openwire/v1/ActiveMQStreamMessageTest.java index 1870f005fe..c39cd9c60a 100644 --- a/activemq-core/src/test/java/org/apache/activemq/openwire/v1/ActiveMQStreamMessageTest.java +++ b/activemq-core/src/test/java/org/apache/activemq/openwire/v1/ActiveMQStreamMessageTest.java @@ -33,7 +33,7 @@ import org.apache.activemq.command.*; * under src/gram/script and then use maven openwire:generate to regenerate * this file. * - * @version $Revision$ + * @version $Revision: $ */ public class ActiveMQStreamMessageTest extends ActiveMQMessageTest { diff --git a/activemq-core/src/test/java/org/apache/activemq/openwire/v1/ActiveMQTempDestinationTestSupport.java b/activemq-core/src/test/java/org/apache/activemq/openwire/v1/ActiveMQTempDestinationTestSupport.java index 102cb53793..0ec0d93b3b 100644 --- a/activemq-core/src/test/java/org/apache/activemq/openwire/v1/ActiveMQTempDestinationTestSupport.java +++ b/activemq-core/src/test/java/org/apache/activemq/openwire/v1/ActiveMQTempDestinationTestSupport.java @@ -33,7 +33,7 @@ import org.apache.activemq.command.*; * under src/gram/script and then use maven openwire:generate to regenerate * this file. * - * @version $Revision$ + * @version $Revision: $ */ public abstract class ActiveMQTempDestinationTestSupport extends ActiveMQDestinationTestSupport { diff --git a/activemq-core/src/test/java/org/apache/activemq/openwire/v1/ActiveMQTempQueueTest.java b/activemq-core/src/test/java/org/apache/activemq/openwire/v1/ActiveMQTempQueueTest.java index 9dfd271020..3bcee31b0e 100644 --- a/activemq-core/src/test/java/org/apache/activemq/openwire/v1/ActiveMQTempQueueTest.java +++ b/activemq-core/src/test/java/org/apache/activemq/openwire/v1/ActiveMQTempQueueTest.java @@ -33,7 +33,7 @@ import org.apache.activemq.command.*; * under src/gram/script and then use maven openwire:generate to regenerate * this file. * - * @version $Revision$ + * @version $Revision: $ */ public class ActiveMQTempQueueTest extends ActiveMQTempDestinationTestSupport { diff --git a/activemq-core/src/test/java/org/apache/activemq/openwire/v1/ActiveMQTempTopicTest.java b/activemq-core/src/test/java/org/apache/activemq/openwire/v1/ActiveMQTempTopicTest.java index c0e9ec3712..dc4b00d600 100644 --- a/activemq-core/src/test/java/org/apache/activemq/openwire/v1/ActiveMQTempTopicTest.java +++ b/activemq-core/src/test/java/org/apache/activemq/openwire/v1/ActiveMQTempTopicTest.java @@ -33,7 +33,7 @@ import org.apache.activemq.command.*; * under src/gram/script and then use maven openwire:generate to regenerate * this file. * - * @version $Revision$ + * @version $Revision: $ */ public class ActiveMQTempTopicTest extends ActiveMQTempDestinationTestSupport { diff --git a/activemq-core/src/test/java/org/apache/activemq/openwire/v1/ActiveMQTextMessageTest.java b/activemq-core/src/test/java/org/apache/activemq/openwire/v1/ActiveMQTextMessageTest.java index 783a167651..33cc69c173 100644 --- a/activemq-core/src/test/java/org/apache/activemq/openwire/v1/ActiveMQTextMessageTest.java +++ b/activemq-core/src/test/java/org/apache/activemq/openwire/v1/ActiveMQTextMessageTest.java @@ -33,7 +33,7 @@ import org.apache.activemq.command.*; * under src/gram/script and then use maven openwire:generate to regenerate * this file. * - * @version $Revision$ + * @version $Revision: $ */ public class ActiveMQTextMessageTest extends ActiveMQMessageTest { diff --git a/activemq-core/src/test/java/org/apache/activemq/openwire/v1/ActiveMQTopicTest.java b/activemq-core/src/test/java/org/apache/activemq/openwire/v1/ActiveMQTopicTest.java index be43de2159..9c7ba1b064 100644 --- a/activemq-core/src/test/java/org/apache/activemq/openwire/v1/ActiveMQTopicTest.java +++ b/activemq-core/src/test/java/org/apache/activemq/openwire/v1/ActiveMQTopicTest.java @@ -33,7 +33,7 @@ import org.apache.activemq.command.*; * under src/gram/script and then use maven openwire:generate to regenerate * this file. * - * @version $Revision$ + * @version $Revision: $ */ public class ActiveMQTopicTest extends ActiveMQDestinationTestSupport { diff --git a/activemq-core/src/test/java/org/apache/activemq/openwire/v1/BaseCommandTestSupport.java b/activemq-core/src/test/java/org/apache/activemq/openwire/v1/BaseCommandTestSupport.java index c9b3066255..7708e3d3ae 100644 --- a/activemq-core/src/test/java/org/apache/activemq/openwire/v1/BaseCommandTestSupport.java +++ b/activemq-core/src/test/java/org/apache/activemq/openwire/v1/BaseCommandTestSupport.java @@ -33,7 +33,7 @@ import org.apache.activemq.command.*; * under src/gram/script and then use maven openwire:generate to regenerate * this file. * - * @version $Revision$ + * @version $Revision: $ */ public abstract class BaseCommandTestSupport extends DataFileGeneratorTestSupport { diff --git a/activemq-core/src/test/java/org/apache/activemq/openwire/v1/BrokerIdTest.java b/activemq-core/src/test/java/org/apache/activemq/openwire/v1/BrokerIdTest.java index b11771b8e6..59cb8f9de5 100644 --- a/activemq-core/src/test/java/org/apache/activemq/openwire/v1/BrokerIdTest.java +++ b/activemq-core/src/test/java/org/apache/activemq/openwire/v1/BrokerIdTest.java @@ -33,7 +33,7 @@ import org.apache.activemq.command.*; * under src/gram/script and then use maven openwire:generate to regenerate * this file. * - * @version $Revision$ + * @version $Revision: $ */ public class BrokerIdTest extends DataFileGeneratorTestSupport { diff --git a/activemq-core/src/test/java/org/apache/activemq/openwire/v1/BrokerInfoTest.java b/activemq-core/src/test/java/org/apache/activemq/openwire/v1/BrokerInfoTest.java index bfe675f4cc..8bc3b5fd7a 100644 --- a/activemq-core/src/test/java/org/apache/activemq/openwire/v1/BrokerInfoTest.java +++ b/activemq-core/src/test/java/org/apache/activemq/openwire/v1/BrokerInfoTest.java @@ -33,7 +33,7 @@ import org.apache.activemq.command.*; * under src/gram/script and then use maven openwire:generate to regenerate * this file. * - * @version $Revision$ + * @version $Revision: $ */ public class BrokerInfoTest extends BaseCommandTestSupport { diff --git a/activemq-core/src/test/java/org/apache/activemq/openwire/v1/ConnectionErrorTest.java b/activemq-core/src/test/java/org/apache/activemq/openwire/v1/ConnectionErrorTest.java index 641191d970..f501335de2 100644 --- a/activemq-core/src/test/java/org/apache/activemq/openwire/v1/ConnectionErrorTest.java +++ b/activemq-core/src/test/java/org/apache/activemq/openwire/v1/ConnectionErrorTest.java @@ -33,7 +33,7 @@ import org.apache.activemq.command.*; * under src/gram/script and then use maven openwire:generate to regenerate * this file. * - * @version $Revision$ + * @version $Revision: $ */ public class ConnectionErrorTest extends BaseCommandTestSupport { diff --git a/activemq-core/src/test/java/org/apache/activemq/openwire/v1/ConnectionIdTest.java b/activemq-core/src/test/java/org/apache/activemq/openwire/v1/ConnectionIdTest.java index 86d0a94632..7545e9aa2c 100644 --- a/activemq-core/src/test/java/org/apache/activemq/openwire/v1/ConnectionIdTest.java +++ b/activemq-core/src/test/java/org/apache/activemq/openwire/v1/ConnectionIdTest.java @@ -33,7 +33,7 @@ import org.apache.activemq.command.*; * under src/gram/script and then use maven openwire:generate to regenerate * this file. * - * @version $Revision$ + * @version $Revision: $ */ public class ConnectionIdTest extends DataFileGeneratorTestSupport { diff --git a/activemq-core/src/test/java/org/apache/activemq/openwire/v1/ConnectionInfoTest.java b/activemq-core/src/test/java/org/apache/activemq/openwire/v1/ConnectionInfoTest.java index 0273c689d4..6b1103b349 100644 --- a/activemq-core/src/test/java/org/apache/activemq/openwire/v1/ConnectionInfoTest.java +++ b/activemq-core/src/test/java/org/apache/activemq/openwire/v1/ConnectionInfoTest.java @@ -33,7 +33,7 @@ import org.apache.activemq.command.*; * under src/gram/script and then use maven openwire:generate to regenerate * this file. * - * @version $Revision$ + * @version $Revision: $ */ public class ConnectionInfoTest extends BaseCommandTestSupport { diff --git a/activemq-core/src/test/java/org/apache/activemq/openwire/v1/ConsumerIdTest.java b/activemq-core/src/test/java/org/apache/activemq/openwire/v1/ConsumerIdTest.java index 733be2bf52..d1a8179016 100644 --- a/activemq-core/src/test/java/org/apache/activemq/openwire/v1/ConsumerIdTest.java +++ b/activemq-core/src/test/java/org/apache/activemq/openwire/v1/ConsumerIdTest.java @@ -33,7 +33,7 @@ import org.apache.activemq.command.*; * under src/gram/script and then use maven openwire:generate to regenerate * this file. * - * @version $Revision$ + * @version $Revision: $ */ public class ConsumerIdTest extends DataFileGeneratorTestSupport { diff --git a/activemq-core/src/test/java/org/apache/activemq/openwire/v1/ConsumerInfoTest.java b/activemq-core/src/test/java/org/apache/activemq/openwire/v1/ConsumerInfoTest.java index 4fea11db8f..15506d4c6b 100644 --- a/activemq-core/src/test/java/org/apache/activemq/openwire/v1/ConsumerInfoTest.java +++ b/activemq-core/src/test/java/org/apache/activemq/openwire/v1/ConsumerInfoTest.java @@ -33,7 +33,7 @@ import org.apache.activemq.command.*; * under src/gram/script and then use maven openwire:generate to regenerate * this file. * - * @version $Revision$ + * @version $Revision: $ */ public class ConsumerInfoTest extends BaseCommandTestSupport { diff --git a/activemq-core/src/test/java/org/apache/activemq/openwire/v1/ControlCommandTest.java b/activemq-core/src/test/java/org/apache/activemq/openwire/v1/ControlCommandTest.java index 59febc60c9..0fb7297d84 100644 --- a/activemq-core/src/test/java/org/apache/activemq/openwire/v1/ControlCommandTest.java +++ b/activemq-core/src/test/java/org/apache/activemq/openwire/v1/ControlCommandTest.java @@ -33,7 +33,7 @@ import org.apache.activemq.command.*; * under src/gram/script and then use maven openwire:generate to regenerate * this file. * - * @version $Revision$ + * @version $Revision: $ */ public class ControlCommandTest extends BaseCommandTestSupport { diff --git a/activemq-core/src/test/java/org/apache/activemq/openwire/v1/DataArrayResponseTest.java b/activemq-core/src/test/java/org/apache/activemq/openwire/v1/DataArrayResponseTest.java index dd63c62ef7..7fc957c05d 100644 --- a/activemq-core/src/test/java/org/apache/activemq/openwire/v1/DataArrayResponseTest.java +++ b/activemq-core/src/test/java/org/apache/activemq/openwire/v1/DataArrayResponseTest.java @@ -33,7 +33,7 @@ import org.apache.activemq.command.*; * under src/gram/script and then use maven openwire:generate to regenerate * this file. * - * @version $Revision$ + * @version $Revision: $ */ public class DataArrayResponseTest extends ResponseTest { diff --git a/activemq-core/src/test/java/org/apache/activemq/openwire/v1/DataResponseTest.java b/activemq-core/src/test/java/org/apache/activemq/openwire/v1/DataResponseTest.java index 9f9700c38b..e6dfa3d3a4 100644 --- a/activemq-core/src/test/java/org/apache/activemq/openwire/v1/DataResponseTest.java +++ b/activemq-core/src/test/java/org/apache/activemq/openwire/v1/DataResponseTest.java @@ -33,7 +33,7 @@ import org.apache.activemq.command.*; * under src/gram/script and then use maven openwire:generate to regenerate * this file. * - * @version $Revision$ + * @version $Revision: $ */ public class DataResponseTest extends ResponseTest { diff --git a/activemq-core/src/test/java/org/apache/activemq/openwire/v1/DestinationInfoTest.java b/activemq-core/src/test/java/org/apache/activemq/openwire/v1/DestinationInfoTest.java index a138760845..3dd1630f40 100644 --- a/activemq-core/src/test/java/org/apache/activemq/openwire/v1/DestinationInfoTest.java +++ b/activemq-core/src/test/java/org/apache/activemq/openwire/v1/DestinationInfoTest.java @@ -33,7 +33,7 @@ import org.apache.activemq.command.*; * under src/gram/script and then use maven openwire:generate to regenerate * this file. * - * @version $Revision$ + * @version $Revision: $ */ public class DestinationInfoTest extends BaseCommandTestSupport { diff --git a/activemq-core/src/test/java/org/apache/activemq/openwire/v1/DiscoveryEventTest.java b/activemq-core/src/test/java/org/apache/activemq/openwire/v1/DiscoveryEventTest.java index 913b38a8ac..2ec41f321f 100644 --- a/activemq-core/src/test/java/org/apache/activemq/openwire/v1/DiscoveryEventTest.java +++ b/activemq-core/src/test/java/org/apache/activemq/openwire/v1/DiscoveryEventTest.java @@ -33,7 +33,7 @@ import org.apache.activemq.command.*; * under src/gram/script and then use maven openwire:generate to regenerate * this file. * - * @version $Revision$ + * @version $Revision: $ */ public class DiscoveryEventTest extends DataFileGeneratorTestSupport { diff --git a/activemq-core/src/test/java/org/apache/activemq/openwire/v1/ExceptionResponseTest.java b/activemq-core/src/test/java/org/apache/activemq/openwire/v1/ExceptionResponseTest.java index 753504e393..f5fdb1e1ac 100644 --- a/activemq-core/src/test/java/org/apache/activemq/openwire/v1/ExceptionResponseTest.java +++ b/activemq-core/src/test/java/org/apache/activemq/openwire/v1/ExceptionResponseTest.java @@ -33,7 +33,7 @@ import org.apache.activemq.command.*; * under src/gram/script and then use maven openwire:generate to regenerate * this file. * - * @version $Revision$ + * @version $Revision: $ */ public class ExceptionResponseTest extends ResponseTest { diff --git a/activemq-core/src/test/java/org/apache/activemq/openwire/v1/FlushCommandTest.java b/activemq-core/src/test/java/org/apache/activemq/openwire/v1/FlushCommandTest.java index 550deae206..bff4893f4c 100644 --- a/activemq-core/src/test/java/org/apache/activemq/openwire/v1/FlushCommandTest.java +++ b/activemq-core/src/test/java/org/apache/activemq/openwire/v1/FlushCommandTest.java @@ -33,7 +33,7 @@ import org.apache.activemq.command.*; * under src/gram/script and then use maven openwire:generate to regenerate * this file. * - * @version $Revision$ + * @version $Revision: $ */ public class FlushCommandTest extends BaseCommandTestSupport { diff --git a/activemq-core/src/test/java/org/apache/activemq/openwire/v1/IntegerResponseTest.java b/activemq-core/src/test/java/org/apache/activemq/openwire/v1/IntegerResponseTest.java index ccdad39a02..eacf61f6d0 100644 --- a/activemq-core/src/test/java/org/apache/activemq/openwire/v1/IntegerResponseTest.java +++ b/activemq-core/src/test/java/org/apache/activemq/openwire/v1/IntegerResponseTest.java @@ -33,7 +33,7 @@ import org.apache.activemq.command.*; * under src/gram/script and then use maven openwire:generate to regenerate * this file. * - * @version $Revision$ + * @version $Revision: $ */ public class IntegerResponseTest extends ResponseTest { diff --git a/activemq-core/src/test/java/org/apache/activemq/openwire/v1/JournalQueueAckTest.java b/activemq-core/src/test/java/org/apache/activemq/openwire/v1/JournalQueueAckTest.java index 2bb4d63726..8e473b7042 100644 --- a/activemq-core/src/test/java/org/apache/activemq/openwire/v1/JournalQueueAckTest.java +++ b/activemq-core/src/test/java/org/apache/activemq/openwire/v1/JournalQueueAckTest.java @@ -33,7 +33,7 @@ import org.apache.activemq.command.*; * under src/gram/script and then use maven openwire:generate to regenerate * this file. * - * @version $Revision$ + * @version $Revision: $ */ public class JournalQueueAckTest extends DataFileGeneratorTestSupport { diff --git a/activemq-core/src/test/java/org/apache/activemq/openwire/v1/JournalTopicAckTest.java b/activemq-core/src/test/java/org/apache/activemq/openwire/v1/JournalTopicAckTest.java index c26851791d..da09663d0e 100644 --- a/activemq-core/src/test/java/org/apache/activemq/openwire/v1/JournalTopicAckTest.java +++ b/activemq-core/src/test/java/org/apache/activemq/openwire/v1/JournalTopicAckTest.java @@ -33,7 +33,7 @@ import org.apache.activemq.command.*; * under src/gram/script and then use maven openwire:generate to regenerate * this file. * - * @version $Revision$ + * @version $Revision: $ */ public class JournalTopicAckTest extends DataFileGeneratorTestSupport { diff --git a/activemq-core/src/test/java/org/apache/activemq/openwire/v1/JournalTraceTest.java b/activemq-core/src/test/java/org/apache/activemq/openwire/v1/JournalTraceTest.java index 00c323aa46..c442747e40 100644 --- a/activemq-core/src/test/java/org/apache/activemq/openwire/v1/JournalTraceTest.java +++ b/activemq-core/src/test/java/org/apache/activemq/openwire/v1/JournalTraceTest.java @@ -33,7 +33,7 @@ import org.apache.activemq.command.*; * under src/gram/script and then use maven openwire:generate to regenerate * this file. * - * @version $Revision$ + * @version $Revision: $ */ public class JournalTraceTest extends DataFileGeneratorTestSupport { diff --git a/activemq-core/src/test/java/org/apache/activemq/openwire/v1/JournalTransactionTest.java b/activemq-core/src/test/java/org/apache/activemq/openwire/v1/JournalTransactionTest.java index c29e9856aa..0888375614 100644 --- a/activemq-core/src/test/java/org/apache/activemq/openwire/v1/JournalTransactionTest.java +++ b/activemq-core/src/test/java/org/apache/activemq/openwire/v1/JournalTransactionTest.java @@ -33,7 +33,7 @@ import org.apache.activemq.command.*; * under src/gram/script and then use maven openwire:generate to regenerate * this file. * - * @version $Revision$ + * @version $Revision: $ */ public class JournalTransactionTest extends DataFileGeneratorTestSupport { diff --git a/activemq-core/src/test/java/org/apache/activemq/openwire/v1/KeepAliveInfoTest.java b/activemq-core/src/test/java/org/apache/activemq/openwire/v1/KeepAliveInfoTest.java index 3b6d466c83..0e7a1509e0 100644 --- a/activemq-core/src/test/java/org/apache/activemq/openwire/v1/KeepAliveInfoTest.java +++ b/activemq-core/src/test/java/org/apache/activemq/openwire/v1/KeepAliveInfoTest.java @@ -33,7 +33,7 @@ import org.apache.activemq.command.*; * under src/gram/script and then use maven openwire:generate to regenerate * this file. * - * @version $Revision$ + * @version $Revision: $ */ public class KeepAliveInfoTest extends DataFileGeneratorTestSupport { diff --git a/activemq-core/src/test/java/org/apache/activemq/openwire/v1/LocalTransactionIdTest.java b/activemq-core/src/test/java/org/apache/activemq/openwire/v1/LocalTransactionIdTest.java index 5a5b363493..756a5f634b 100644 --- a/activemq-core/src/test/java/org/apache/activemq/openwire/v1/LocalTransactionIdTest.java +++ b/activemq-core/src/test/java/org/apache/activemq/openwire/v1/LocalTransactionIdTest.java @@ -33,7 +33,7 @@ import org.apache.activemq.command.*; * under src/gram/script and then use maven openwire:generate to regenerate * this file. * - * @version $Revision$ + * @version $Revision: $ */ public class LocalTransactionIdTest extends TransactionIdTestSupport { diff --git a/activemq-core/src/test/java/org/apache/activemq/openwire/v1/MessageAckTest.java b/activemq-core/src/test/java/org/apache/activemq/openwire/v1/MessageAckTest.java index 07c6fcbd35..7cf1d5c653 100644 --- a/activemq-core/src/test/java/org/apache/activemq/openwire/v1/MessageAckTest.java +++ b/activemq-core/src/test/java/org/apache/activemq/openwire/v1/MessageAckTest.java @@ -33,7 +33,7 @@ import org.apache.activemq.command.*; * under src/gram/script and then use maven openwire:generate to regenerate * this file. * - * @version $Revision$ + * @version $Revision: $ */ public class MessageAckTest extends BaseCommandTestSupport { diff --git a/activemq-core/src/test/java/org/apache/activemq/openwire/v1/MessageDispatchNotificationTest.java b/activemq-core/src/test/java/org/apache/activemq/openwire/v1/MessageDispatchNotificationTest.java index 08218d54bc..45ee2f122f 100644 --- a/activemq-core/src/test/java/org/apache/activemq/openwire/v1/MessageDispatchNotificationTest.java +++ b/activemq-core/src/test/java/org/apache/activemq/openwire/v1/MessageDispatchNotificationTest.java @@ -33,7 +33,7 @@ import org.apache.activemq.command.*; * under src/gram/script and then use maven openwire:generate to regenerate * this file. * - * @version $Revision$ + * @version $Revision: $ */ public class MessageDispatchNotificationTest extends BaseCommandTestSupport { diff --git a/activemq-core/src/test/java/org/apache/activemq/openwire/v1/MessageDispatchTest.java b/activemq-core/src/test/java/org/apache/activemq/openwire/v1/MessageDispatchTest.java index d0c10a60e9..e9b4416656 100644 --- a/activemq-core/src/test/java/org/apache/activemq/openwire/v1/MessageDispatchTest.java +++ b/activemq-core/src/test/java/org/apache/activemq/openwire/v1/MessageDispatchTest.java @@ -33,7 +33,7 @@ import org.apache.activemq.command.*; * under src/gram/script and then use maven openwire:generate to regenerate * this file. * - * @version $Revision$ + * @version $Revision: $ */ public class MessageDispatchTest extends BaseCommandTestSupport { diff --git a/activemq-core/src/test/java/org/apache/activemq/openwire/v1/MessageIdTest.java b/activemq-core/src/test/java/org/apache/activemq/openwire/v1/MessageIdTest.java index 97333f75a0..588e8d099d 100644 --- a/activemq-core/src/test/java/org/apache/activemq/openwire/v1/MessageIdTest.java +++ b/activemq-core/src/test/java/org/apache/activemq/openwire/v1/MessageIdTest.java @@ -33,7 +33,7 @@ import org.apache.activemq.command.*; * under src/gram/script and then use maven openwire:generate to regenerate * this file. * - * @version $Revision$ + * @version $Revision: $ */ public class MessageIdTest extends DataFileGeneratorTestSupport { diff --git a/activemq-core/src/test/java/org/apache/activemq/openwire/v1/MessageTestSupport.java b/activemq-core/src/test/java/org/apache/activemq/openwire/v1/MessageTestSupport.java index 8ea87f3f2a..fa5f353016 100644 --- a/activemq-core/src/test/java/org/apache/activemq/openwire/v1/MessageTestSupport.java +++ b/activemq-core/src/test/java/org/apache/activemq/openwire/v1/MessageTestSupport.java @@ -33,7 +33,7 @@ import org.apache.activemq.command.*; * under src/gram/script and then use maven openwire:generate to regenerate * this file. * - * @version $Revision$ + * @version $Revision: $ */ public abstract class MessageTestSupport extends BaseCommandTestSupport { diff --git a/activemq-core/src/test/java/org/apache/activemq/openwire/v1/ProducerIdTest.java b/activemq-core/src/test/java/org/apache/activemq/openwire/v1/ProducerIdTest.java index f22fa43df9..faedb172f8 100644 --- a/activemq-core/src/test/java/org/apache/activemq/openwire/v1/ProducerIdTest.java +++ b/activemq-core/src/test/java/org/apache/activemq/openwire/v1/ProducerIdTest.java @@ -33,7 +33,7 @@ import org.apache.activemq.command.*; * under src/gram/script and then use maven openwire:generate to regenerate * this file. * - * @version $Revision$ + * @version $Revision: $ */ public class ProducerIdTest extends DataFileGeneratorTestSupport { diff --git a/activemq-core/src/test/java/org/apache/activemq/openwire/v1/ProducerInfoTest.java b/activemq-core/src/test/java/org/apache/activemq/openwire/v1/ProducerInfoTest.java index 178b426ee8..c0310e561f 100644 --- a/activemq-core/src/test/java/org/apache/activemq/openwire/v1/ProducerInfoTest.java +++ b/activemq-core/src/test/java/org/apache/activemq/openwire/v1/ProducerInfoTest.java @@ -33,7 +33,7 @@ import org.apache.activemq.command.*; * under src/gram/script and then use maven openwire:generate to regenerate * this file. * - * @version $Revision$ + * @version $Revision: $ */ public class ProducerInfoTest extends BaseCommandTestSupport { diff --git a/activemq-core/src/test/java/org/apache/activemq/openwire/v1/RemoveInfoTest.java b/activemq-core/src/test/java/org/apache/activemq/openwire/v1/RemoveInfoTest.java index a57bd37da3..2e604a898c 100644 --- a/activemq-core/src/test/java/org/apache/activemq/openwire/v1/RemoveInfoTest.java +++ b/activemq-core/src/test/java/org/apache/activemq/openwire/v1/RemoveInfoTest.java @@ -33,7 +33,7 @@ import org.apache.activemq.command.*; * under src/gram/script and then use maven openwire:generate to regenerate * this file. * - * @version $Revision$ + * @version $Revision: $ */ public class RemoveInfoTest extends BaseCommandTestSupport { diff --git a/activemq-core/src/test/java/org/apache/activemq/openwire/v1/RemoveSubscriptionInfoTest.java b/activemq-core/src/test/java/org/apache/activemq/openwire/v1/RemoveSubscriptionInfoTest.java index 0406719a4a..46b1bb8d2d 100644 --- a/activemq-core/src/test/java/org/apache/activemq/openwire/v1/RemoveSubscriptionInfoTest.java +++ b/activemq-core/src/test/java/org/apache/activemq/openwire/v1/RemoveSubscriptionInfoTest.java @@ -33,7 +33,7 @@ import org.apache.activemq.command.*; * under src/gram/script and then use maven openwire:generate to regenerate * this file. * - * @version $Revision$ + * @version $Revision: $ */ public class RemoveSubscriptionInfoTest extends BaseCommandTestSupport { diff --git a/activemq-core/src/test/java/org/apache/activemq/openwire/v1/ResponseTest.java b/activemq-core/src/test/java/org/apache/activemq/openwire/v1/ResponseTest.java index 477f37d06f..05b07a2c2c 100644 --- a/activemq-core/src/test/java/org/apache/activemq/openwire/v1/ResponseTest.java +++ b/activemq-core/src/test/java/org/apache/activemq/openwire/v1/ResponseTest.java @@ -33,7 +33,7 @@ import org.apache.activemq.command.*; * under src/gram/script and then use maven openwire:generate to regenerate * this file. * - * @version $Revision$ + * @version $Revision: $ */ public class ResponseTest extends BaseCommandTestSupport { diff --git a/activemq-core/src/test/java/org/apache/activemq/openwire/v1/SessionIdTest.java b/activemq-core/src/test/java/org/apache/activemq/openwire/v1/SessionIdTest.java index 0714c5e06d..c8c6607bc5 100644 --- a/activemq-core/src/test/java/org/apache/activemq/openwire/v1/SessionIdTest.java +++ b/activemq-core/src/test/java/org/apache/activemq/openwire/v1/SessionIdTest.java @@ -33,7 +33,7 @@ import org.apache.activemq.command.*; * under src/gram/script and then use maven openwire:generate to regenerate * this file. * - * @version $Revision$ + * @version $Revision: $ */ public class SessionIdTest extends DataFileGeneratorTestSupport { diff --git a/activemq-core/src/test/java/org/apache/activemq/openwire/v1/SessionInfoTest.java b/activemq-core/src/test/java/org/apache/activemq/openwire/v1/SessionInfoTest.java index f40deaf6e4..086d840ec4 100644 --- a/activemq-core/src/test/java/org/apache/activemq/openwire/v1/SessionInfoTest.java +++ b/activemq-core/src/test/java/org/apache/activemq/openwire/v1/SessionInfoTest.java @@ -33,7 +33,7 @@ import org.apache.activemq.command.*; * under src/gram/script and then use maven openwire:generate to regenerate * this file. * - * @version $Revision$ + * @version $Revision: $ */ public class SessionInfoTest extends BaseCommandTestSupport { diff --git a/activemq-core/src/test/java/org/apache/activemq/openwire/v1/ShutdownInfoTest.java b/activemq-core/src/test/java/org/apache/activemq/openwire/v1/ShutdownInfoTest.java index f9c2f81aff..31d7a25336 100644 --- a/activemq-core/src/test/java/org/apache/activemq/openwire/v1/ShutdownInfoTest.java +++ b/activemq-core/src/test/java/org/apache/activemq/openwire/v1/ShutdownInfoTest.java @@ -33,7 +33,7 @@ import org.apache.activemq.command.*; * under src/gram/script and then use maven openwire:generate to regenerate * this file. * - * @version $Revision$ + * @version $Revision: $ */ public class ShutdownInfoTest extends BaseCommandTestSupport { diff --git a/activemq-core/src/test/java/org/apache/activemq/openwire/v1/SubscriptionInfoTest.java b/activemq-core/src/test/java/org/apache/activemq/openwire/v1/SubscriptionInfoTest.java index 0611c2edd9..5c65552bd1 100644 --- a/activemq-core/src/test/java/org/apache/activemq/openwire/v1/SubscriptionInfoTest.java +++ b/activemq-core/src/test/java/org/apache/activemq/openwire/v1/SubscriptionInfoTest.java @@ -33,7 +33,7 @@ import org.apache.activemq.command.*; * under src/gram/script and then use maven openwire:generate to regenerate * this file. * - * @version $Revision$ + * @version $Revision: $ */ public class SubscriptionInfoTest extends DataFileGeneratorTestSupport { diff --git a/activemq-core/src/test/java/org/apache/activemq/openwire/v1/TransactionIdTestSupport.java b/activemq-core/src/test/java/org/apache/activemq/openwire/v1/TransactionIdTestSupport.java index 1fc6e494e8..489808af0d 100644 --- a/activemq-core/src/test/java/org/apache/activemq/openwire/v1/TransactionIdTestSupport.java +++ b/activemq-core/src/test/java/org/apache/activemq/openwire/v1/TransactionIdTestSupport.java @@ -33,7 +33,7 @@ import org.apache.activemq.command.*; * under src/gram/script and then use maven openwire:generate to regenerate * this file. * - * @version $Revision$ + * @version $Revision: $ */ public abstract class TransactionIdTestSupport extends DataFileGeneratorTestSupport { diff --git a/activemq-core/src/test/java/org/apache/activemq/openwire/v1/TransactionInfoTest.java b/activemq-core/src/test/java/org/apache/activemq/openwire/v1/TransactionInfoTest.java index 264e232560..1e910b6cc9 100644 --- a/activemq-core/src/test/java/org/apache/activemq/openwire/v1/TransactionInfoTest.java +++ b/activemq-core/src/test/java/org/apache/activemq/openwire/v1/TransactionInfoTest.java @@ -33,7 +33,7 @@ import org.apache.activemq.command.*; * under src/gram/script and then use maven openwire:generate to regenerate * this file. * - * @version $Revision$ + * @version $Revision: $ */ public class TransactionInfoTest extends BaseCommandTestSupport { diff --git a/activemq-core/src/test/java/org/apache/activemq/openwire/v1/WireFormatInfoTest.java b/activemq-core/src/test/java/org/apache/activemq/openwire/v1/WireFormatInfoTest.java index b19c12063b..469409a217 100644 --- a/activemq-core/src/test/java/org/apache/activemq/openwire/v1/WireFormatInfoTest.java +++ b/activemq-core/src/test/java/org/apache/activemq/openwire/v1/WireFormatInfoTest.java @@ -33,7 +33,7 @@ import org.apache.activemq.command.*; * under src/gram/script and then use maven openwire:generate to regenerate * this file. * - * @version $Revision$ + * @version $Revision: $ */ public class WireFormatInfoTest extends DataFileGeneratorTestSupport { @@ -50,7 +50,6 @@ public class WireFormatInfoTest extends DataFileGeneratorTestSupport { protected void populateObject(Object object) throws Exception { super.populateObject(object); WireFormatInfo info = (WireFormatInfo) object; - info.setMagic("Magic:1".getBytes()); info.setVersion(1); info.setOptions(2); diff --git a/activemq-core/src/test/java/org/apache/activemq/openwire/v1/XATransactionIdTest.java b/activemq-core/src/test/java/org/apache/activemq/openwire/v1/XATransactionIdTest.java index a9b47be6b5..25337bfc04 100644 --- a/activemq-core/src/test/java/org/apache/activemq/openwire/v1/XATransactionIdTest.java +++ b/activemq-core/src/test/java/org/apache/activemq/openwire/v1/XATransactionIdTest.java @@ -33,7 +33,7 @@ import org.apache.activemq.command.*; * under src/gram/script and then use maven openwire:generate to regenerate * this file. * - * @version $Revision$ + * @version $Revision: $ */ public class XATransactionIdTest extends TransactionIdTestSupport { diff --git a/activemq-core/src/test/java/org/apache/activemq/test/TestSupport.java b/activemq-core/src/test/java/org/apache/activemq/test/TestSupport.java index 320b33229a..9f158b6305 100755 --- a/activemq-core/src/test/java/org/apache/activemq/test/TestSupport.java +++ b/activemq-core/src/test/java/org/apache/activemq/test/TestSupport.java @@ -31,6 +31,9 @@ import javax.jms.JMSException; import javax.jms.Message; import javax.jms.TextMessage; +import java.lang.reflect.Array; +import java.util.Arrays; + /** * Useful base class for unit test cases @@ -226,4 +229,19 @@ public class TestSupport extends TestCase { protected String getSubject() { return getClass().getName() + "." + getName(); } + + protected void assertArrayEqual(String message, Object[] expected, Object[] actual) { + assertEquals(message + ". Array length", expected.length, actual.length); + for (int i = 0; i < expected.length; i++) { + assertEquals(message + ". element: " + i, expected[i], actual[i]); + } + } + + protected void assertPrimitiveArrayEqual(String message, Object expected, Object actual) { + int length = Array.getLength(expected); + assertEquals(message + ". Array length", length, Array.getLength(actual)); + for (int i = 0; i < length; i++) { + assertEquals(message + ". element: " + i, Array.get(expected, i), Array.get(actual, i)); + } + } }