autogenerated unit test cases for OpenWire now working

git-svn-id: https://svn.apache.org/repos/asf/incubator/activemq/trunk@379409 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
James Strachan 2006-02-21 10:03:39 +00:00
parent 628f9af1e1
commit 6ce83ac909
81 changed files with 272 additions and 137 deletions

View File

@ -345,10 +345,6 @@
<exclude>**/FanoutTransportBrokerTest.*</exclude>
<!-- http://jira.activemq.org/jira/browse/AMQ-583 -->
<exclude>**/DiscoveryTransportBrokerTest.*</exclude>
<!-- TODO auto-generated openwire tests not quite working yet -->
<exclude>**/openwire/*/*Test.*</exclude>
</excludes>
</unitTest>
<resources>

View File

@ -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;
}
}

View File

@ -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);
}
}

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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]);
}
}
}

View File

@ -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 {

View File

@ -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 {

View File

@ -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 {

View File

@ -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 {

View File

@ -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 {

View File

@ -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 {

View File

@ -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 {

View File

@ -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 {

View File

@ -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 {

View File

@ -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 {

View File

@ -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 {

View File

@ -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 {

View File

@ -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 {

View File

@ -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 {

View File

@ -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 {

View File

@ -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 {

View File

@ -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 {

View File

@ -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 {

View File

@ -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 {

View File

@ -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 {

View File

@ -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 {

View File

@ -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 {

View File

@ -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 {

View File

@ -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 {

View File

@ -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 {

View File

@ -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 {

View File

@ -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 {

View File

@ -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 {

View File

@ -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 {

View File

@ -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 {

View File

@ -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 {

View File

@ -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 {

View File

@ -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 {

View File

@ -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 {

View File

@ -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 {

View File

@ -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 {

View File

@ -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 {

View File

@ -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 {

View File

@ -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 {

View File

@ -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 {

View File

@ -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 {

View File

@ -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 {

View File

@ -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 {

View File

@ -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 {

View File

@ -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 {

View File

@ -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 {

View File

@ -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 {

View File

@ -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 {

View File

@ -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 {

View File

@ -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 {

View File

@ -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 {

View File

@ -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);

View File

@ -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 {

View File

@ -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));
}
}
}