mirror of https://github.com/apache/activemq.git
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:
parent
628f9af1e1
commit
6ce83ac909
|
@ -345,10 +345,6 @@
|
||||||
<exclude>**/FanoutTransportBrokerTest.*</exclude>
|
<exclude>**/FanoutTransportBrokerTest.*</exclude>
|
||||||
<!-- http://jira.activemq.org/jira/browse/AMQ-583 -->
|
<!-- http://jira.activemq.org/jira/browse/AMQ-583 -->
|
||||||
<exclude>**/DiscoveryTransportBrokerTest.*</exclude>
|
<exclude>**/DiscoveryTransportBrokerTest.*</exclude>
|
||||||
|
|
||||||
<!-- TODO auto-generated openwire tests not quite working yet -->
|
|
||||||
<exclude>**/openwire/*/*Test.*</exclude>
|
|
||||||
|
|
||||||
</excludes>
|
</excludes>
|
||||||
</unitTest>
|
</unitTest>
|
||||||
<resources>
|
<resources>
|
||||||
|
|
|
@ -18,12 +18,13 @@ package org.apache.activemq.command;
|
||||||
|
|
||||||
import org.apache.activemq.util.IntrospectionSupport;
|
import org.apache.activemq.util.IntrospectionSupport;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @openwire:marshaller
|
* @openwire:marshaller
|
||||||
* @version $Revision: 1.11 $
|
* @version $Revision: 1.11 $
|
||||||
*/
|
*/
|
||||||
abstract public class BaseCommand implements Command {
|
abstract public class BaseCommand extends DataStructureSupport implements Command {
|
||||||
|
|
||||||
protected short commandId;
|
protected short commandId;
|
||||||
protected boolean responseRequired;
|
protected boolean responseRequired;
|
||||||
|
@ -33,6 +34,32 @@ abstract public class BaseCommand implements Command {
|
||||||
copy.responseRequired = responseRequired;
|
copy.responseRequired = responseRequired;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @openwire:property version=1
|
||||||
|
*/
|
||||||
|
public short getCommandId() {
|
||||||
|
return commandId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCommandId(short commandId) {
|
||||||
|
this.commandId = commandId;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @openwire:property version=1
|
||||||
|
*/
|
||||||
|
public boolean isResponseRequired() {
|
||||||
|
return responseRequired;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setResponseRequired(boolean responseRequired) {
|
||||||
|
this.responseRequired = responseRequired;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String toString() {
|
||||||
|
return IntrospectionSupport.toString(this, BaseCommand.class);
|
||||||
|
}
|
||||||
|
|
||||||
public boolean isWireFormatInfo() {
|
public boolean isWireFormatInfo() {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -61,38 +88,11 @@ abstract public class BaseCommand implements Command {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isMessageDispatchNotification(){
|
public boolean isMessageDispatchNotification() {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isShutdownInfo(){
|
public boolean isShutdownInfo() {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @openwire:property version=1
|
|
||||||
*/
|
|
||||||
public short getCommandId() {
|
|
||||||
return commandId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setCommandId(short commandId) {
|
|
||||||
this.commandId = commandId;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @openwire:property version=1
|
|
||||||
*/
|
|
||||||
public boolean isResponseRequired() {
|
|
||||||
return responseRequired;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setResponseRequired(boolean responseRequired) {
|
|
||||||
this.responseRequired = responseRequired;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String toString() {
|
|
||||||
return IntrospectionSupport.toString(this, BaseCommand.class);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -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);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -21,7 +21,7 @@ package org.apache.activemq.command;
|
||||||
* @openwire:marshaller code="52"
|
* @openwire:marshaller code="52"
|
||||||
* @version $Revision$
|
* @version $Revision$
|
||||||
*/
|
*/
|
||||||
public class JournalQueueAck implements DataStructure {
|
public class JournalQueueAck extends DataStructureSupport implements DataStructure {
|
||||||
|
|
||||||
public static final byte DATA_STRUCTURE_TYPE=CommandTypes.JOURNAL_REMOVE;
|
public static final byte DATA_STRUCTURE_TYPE=CommandTypes.JOURNAL_REMOVE;
|
||||||
|
|
||||||
|
|
|
@ -21,7 +21,7 @@ package org.apache.activemq.command;
|
||||||
* @openwire:marshaller code="50"
|
* @openwire:marshaller code="50"
|
||||||
* @version $Revision$
|
* @version $Revision$
|
||||||
*/
|
*/
|
||||||
public class JournalTopicAck implements DataStructure {
|
public class JournalTopicAck extends DataStructureSupport implements DataStructure {
|
||||||
|
|
||||||
public static final byte DATA_STRUCTURE_TYPE=CommandTypes.JOURNAL_ACK;
|
public static final byte DATA_STRUCTURE_TYPE=CommandTypes.JOURNAL_ACK;
|
||||||
|
|
||||||
|
|
|
@ -21,7 +21,7 @@ package org.apache.activemq.command;
|
||||||
* @openwire:marshaller code="53"
|
* @openwire:marshaller code="53"
|
||||||
* @version $Revision: 1.6 $
|
* @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;
|
public static final byte DATA_STRUCTURE_TYPE=CommandTypes.JOURNAL_TRACE;
|
||||||
|
|
||||||
|
|
|
@ -20,7 +20,7 @@ package org.apache.activemq.command;
|
||||||
/**
|
/**
|
||||||
* @openwire:marshaller code="54"
|
* @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;
|
public static final byte DATA_STRUCTURE_TYPE=CommandTypes.JOURNAL_TRANSACTION;
|
||||||
|
|
||||||
|
|
|
@ -22,7 +22,7 @@ import org.apache.activemq.state.CommandVisitor;
|
||||||
* @openwire:marshaller code="10"
|
* @openwire:marshaller code="10"
|
||||||
* @version $Revision$
|
* @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;
|
public static final byte DATA_STRUCTURE_TYPE=CommandTypes.KEEP_ALIVE_INFO;
|
||||||
|
|
||||||
|
|
|
@ -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() {
|
public byte[] getMagic() {
|
||||||
return magic;
|
return magic;
|
||||||
|
|
|
@ -36,7 +36,7 @@ import org.apache.activemq.command.*;
|
||||||
*
|
*
|
||||||
* @version $Revision$
|
* @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
|
* Un-marshal an object instance from the data input stream
|
||||||
|
|
|
@ -36,7 +36,7 @@ import org.apache.activemq.command.*;
|
||||||
*
|
*
|
||||||
* @version $Revision$
|
* @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
|
* Un-marshal an object instance from the data input stream
|
||||||
|
|
|
@ -36,7 +36,7 @@ import org.apache.activemq.command.*;
|
||||||
*
|
*
|
||||||
* @version $Revision$
|
* @version $Revision$
|
||||||
*/
|
*/
|
||||||
public class BrokerIdMarshaller extends org.apache.activemq.openwire.DataStreamMarshaller {
|
public class BrokerIdMarshaller extends DataStreamMarshaller {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the type of Data Structure we marshal
|
* Return the type of Data Structure we marshal
|
||||||
|
|
|
@ -36,7 +36,7 @@ import org.apache.activemq.command.*;
|
||||||
*
|
*
|
||||||
* @version $Revision$
|
* @version $Revision$
|
||||||
*/
|
*/
|
||||||
public class ConnectionIdMarshaller extends org.apache.activemq.openwire.DataStreamMarshaller {
|
public class ConnectionIdMarshaller extends DataStreamMarshaller {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the type of Data Structure we marshal
|
* Return the type of Data Structure we marshal
|
||||||
|
|
|
@ -36,7 +36,7 @@ import org.apache.activemq.command.*;
|
||||||
*
|
*
|
||||||
* @version $Revision$
|
* @version $Revision$
|
||||||
*/
|
*/
|
||||||
public class ConsumerIdMarshaller extends org.apache.activemq.openwire.DataStreamMarshaller {
|
public class ConsumerIdMarshaller extends DataStreamMarshaller {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the type of Data Structure we marshal
|
* Return the type of Data Structure we marshal
|
||||||
|
|
|
@ -36,7 +36,7 @@ import org.apache.activemq.command.*;
|
||||||
*
|
*
|
||||||
* @version $Revision$
|
* @version $Revision$
|
||||||
*/
|
*/
|
||||||
public class DiscoveryEventMarshaller extends org.apache.activemq.openwire.DataStreamMarshaller {
|
public class DiscoveryEventMarshaller extends DataStreamMarshaller {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the type of Data Structure we marshal
|
* Return the type of Data Structure we marshal
|
||||||
|
|
|
@ -36,7 +36,7 @@ import org.apache.activemq.command.*;
|
||||||
*
|
*
|
||||||
* @version $Revision$
|
* @version $Revision$
|
||||||
*/
|
*/
|
||||||
public class JournalQueueAckMarshaller extends org.apache.activemq.openwire.DataStreamMarshaller {
|
public class JournalQueueAckMarshaller extends DataStreamMarshaller {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the type of Data Structure we marshal
|
* Return the type of Data Structure we marshal
|
||||||
|
|
|
@ -36,7 +36,7 @@ import org.apache.activemq.command.*;
|
||||||
*
|
*
|
||||||
* @version $Revision$
|
* @version $Revision$
|
||||||
*/
|
*/
|
||||||
public class JournalTopicAckMarshaller extends org.apache.activemq.openwire.DataStreamMarshaller {
|
public class JournalTopicAckMarshaller extends DataStreamMarshaller {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the type of Data Structure we marshal
|
* Return the type of Data Structure we marshal
|
||||||
|
|
|
@ -36,7 +36,7 @@ import org.apache.activemq.command.*;
|
||||||
*
|
*
|
||||||
* @version $Revision$
|
* @version $Revision$
|
||||||
*/
|
*/
|
||||||
public class JournalTraceMarshaller extends org.apache.activemq.openwire.DataStreamMarshaller {
|
public class JournalTraceMarshaller extends DataStreamMarshaller {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the type of Data Structure we marshal
|
* Return the type of Data Structure we marshal
|
||||||
|
|
|
@ -36,7 +36,7 @@ import org.apache.activemq.command.*;
|
||||||
*
|
*
|
||||||
* @version $Revision$
|
* @version $Revision$
|
||||||
*/
|
*/
|
||||||
public class JournalTransactionMarshaller extends org.apache.activemq.openwire.DataStreamMarshaller {
|
public class JournalTransactionMarshaller extends DataStreamMarshaller {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the type of Data Structure we marshal
|
* Return the type of Data Structure we marshal
|
||||||
|
|
|
@ -36,7 +36,7 @@ import org.apache.activemq.command.*;
|
||||||
*
|
*
|
||||||
* @version $Revision$
|
* @version $Revision$
|
||||||
*/
|
*/
|
||||||
public class KeepAliveInfoMarshaller extends org.apache.activemq.openwire.DataStreamMarshaller {
|
public class KeepAliveInfoMarshaller extends DataStreamMarshaller {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the type of Data Structure we marshal
|
* Return the type of Data Structure we marshal
|
||||||
|
|
|
@ -36,7 +36,7 @@ import org.apache.activemq.command.*;
|
||||||
*
|
*
|
||||||
* @version $Revision$
|
* @version $Revision$
|
||||||
*/
|
*/
|
||||||
public class MessageIdMarshaller extends org.apache.activemq.openwire.DataStreamMarshaller {
|
public class MessageIdMarshaller extends DataStreamMarshaller {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the type of Data Structure we marshal
|
* Return the type of Data Structure we marshal
|
||||||
|
|
|
@ -36,7 +36,7 @@ import org.apache.activemq.command.*;
|
||||||
*
|
*
|
||||||
* @version $Revision$
|
* @version $Revision$
|
||||||
*/
|
*/
|
||||||
public class ProducerIdMarshaller extends org.apache.activemq.openwire.DataStreamMarshaller {
|
public class ProducerIdMarshaller extends DataStreamMarshaller {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the type of Data Structure we marshal
|
* Return the type of Data Structure we marshal
|
||||||
|
|
|
@ -36,7 +36,7 @@ import org.apache.activemq.command.*;
|
||||||
*
|
*
|
||||||
* @version $Revision$
|
* @version $Revision$
|
||||||
*/
|
*/
|
||||||
public class SessionIdMarshaller extends org.apache.activemq.openwire.DataStreamMarshaller {
|
public class SessionIdMarshaller extends DataStreamMarshaller {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the type of Data Structure we marshal
|
* Return the type of Data Structure we marshal
|
||||||
|
|
|
@ -36,7 +36,7 @@ import org.apache.activemq.command.*;
|
||||||
*
|
*
|
||||||
* @version $Revision$
|
* @version $Revision$
|
||||||
*/
|
*/
|
||||||
public class SubscriptionInfoMarshaller extends org.apache.activemq.openwire.DataStreamMarshaller {
|
public class SubscriptionInfoMarshaller extends DataStreamMarshaller {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the type of Data Structure we marshal
|
* Return the type of Data Structure we marshal
|
||||||
|
|
|
@ -36,7 +36,7 @@ import org.apache.activemq.command.*;
|
||||||
*
|
*
|
||||||
* @version $Revision$
|
* @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
|
* Un-marshal an object instance from the data input stream
|
||||||
|
|
|
@ -36,7 +36,7 @@ import org.apache.activemq.command.*;
|
||||||
*
|
*
|
||||||
* @version $Revision$
|
* @version $Revision$
|
||||||
*/
|
*/
|
||||||
public class WireFormatInfoMarshaller extends org.apache.activemq.openwire.DataStreamMarshaller {
|
public class WireFormatInfoMarshaller extends DataStreamMarshaller {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the type of Data Structure we marshal
|
* Return the type of Data Structure we marshal
|
||||||
|
|
|
@ -16,11 +16,9 @@
|
||||||
*/
|
*/
|
||||||
package org.apache.activemq.filter;
|
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 TestSupport {
|
||||||
|
|
||||||
public class DestinationPathTest extends TestCase {
|
|
||||||
|
|
||||||
public void testPathParse() {
|
public void testPathParse() {
|
||||||
assertParse("FOO", new String[]{"FOO"});
|
assertParse("FOO", new String[]{"FOO"});
|
||||||
|
@ -35,11 +33,4 @@ public class DestinationPathTest extends TestCase {
|
||||||
String[] path = DestinationPath.getDestinationPaths(subject);
|
String[] path = DestinationPath.getDestinationPaths(subject);
|
||||||
assertArrayEqual(subject, expected, path);
|
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]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,6 +16,7 @@
|
||||||
*/
|
*/
|
||||||
package org.apache.activemq.openwire;
|
package org.apache.activemq.openwire;
|
||||||
|
|
||||||
|
import org.activeio.ByteSequence;
|
||||||
import org.apache.activemq.command.ActiveMQDestination;
|
import org.apache.activemq.command.ActiveMQDestination;
|
||||||
import org.apache.activemq.command.ActiveMQQueue;
|
import org.apache.activemq.command.ActiveMQQueue;
|
||||||
import org.apache.activemq.command.ActiveMQTextMessage;
|
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.ActiveMQTextMessageTest;
|
||||||
import org.apache.activemq.openwire.v1.BrokerInfoTest;
|
import org.apache.activemq.openwire.v1.BrokerInfoTest;
|
||||||
import org.apache.activemq.openwire.v1.MessageAckTest;
|
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.ByteArrayInputStream;
|
||||||
import java.io.ByteArrayOutputStream;
|
import java.io.ByteArrayOutputStream;
|
||||||
import java.io.DataInputStream;
|
import java.io.DataInputStream;
|
||||||
|
@ -43,17 +48,23 @@ import java.io.File;
|
||||||
import java.io.FileInputStream;
|
import java.io.FileInputStream;
|
||||||
import java.io.FileOutputStream;
|
import java.io.FileOutputStream;
|
||||||
import java.io.InputStream;
|
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.URI;
|
||||||
import java.net.URL;
|
import java.net.URL;
|
||||||
|
import java.util.*;
|
||||||
|
|
||||||
import junit.framework.TestCase;
|
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 moduleBaseDir;
|
||||||
static final File controlDir;
|
static final File controlDir;
|
||||||
static final File classFileDir;
|
static final File classFileDir;
|
||||||
private static Throwable singletonException = new Exception("shared exception");
|
|
||||||
|
|
||||||
static {
|
static {
|
||||||
File basedir = null;
|
File basedir = null;
|
||||||
|
@ -93,9 +104,98 @@ public abstract class DataFileGeneratorTestSupport extends TestCase {
|
||||||
|
|
||||||
System.out.println("Parsed: " + actual);
|
System.out.println("Parsed: " + actual);
|
||||||
|
|
||||||
assertEquals("Objects should be equal", expected.toString(), actual.toString());
|
assertBeansEqual("", new HashSet(), expected, actual);
|
||||||
|
}
|
||||||
|
|
||||||
// TODO generate a property based equality method?
|
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 {
|
protected void setUp() throws Exception {
|
||||||
|
|
|
@ -33,7 +33,7 @@ import org.apache.activemq.command.*;
|
||||||
* under src/gram/script and then use maven openwire:generate to regenerate
|
* under src/gram/script and then use maven openwire:generate to regenerate
|
||||||
* this file.
|
* this file.
|
||||||
*
|
*
|
||||||
* @version $Revision$
|
* @version $Revision: $
|
||||||
*/
|
*/
|
||||||
public class ActiveMQBytesMessageTest extends ActiveMQMessageTest {
|
public class ActiveMQBytesMessageTest extends ActiveMQMessageTest {
|
||||||
|
|
||||||
|
|
|
@ -33,7 +33,7 @@ import org.apache.activemq.command.*;
|
||||||
* under src/gram/script and then use maven openwire:generate to regenerate
|
* under src/gram/script and then use maven openwire:generate to regenerate
|
||||||
* this file.
|
* this file.
|
||||||
*
|
*
|
||||||
* @version $Revision$
|
* @version $Revision: $
|
||||||
*/
|
*/
|
||||||
public abstract class ActiveMQDestinationTestSupport extends DataFileGeneratorTestSupport {
|
public abstract class ActiveMQDestinationTestSupport extends DataFileGeneratorTestSupport {
|
||||||
|
|
||||||
|
|
|
@ -33,7 +33,7 @@ import org.apache.activemq.command.*;
|
||||||
* under src/gram/script and then use maven openwire:generate to regenerate
|
* under src/gram/script and then use maven openwire:generate to regenerate
|
||||||
* this file.
|
* this file.
|
||||||
*
|
*
|
||||||
* @version $Revision$
|
* @version $Revision: $
|
||||||
*/
|
*/
|
||||||
public class ActiveMQMapMessageTest extends ActiveMQMessageTest {
|
public class ActiveMQMapMessageTest extends ActiveMQMessageTest {
|
||||||
|
|
||||||
|
|
|
@ -33,7 +33,7 @@ import org.apache.activemq.command.*;
|
||||||
* under src/gram/script and then use maven openwire:generate to regenerate
|
* under src/gram/script and then use maven openwire:generate to regenerate
|
||||||
* this file.
|
* this file.
|
||||||
*
|
*
|
||||||
* @version $Revision$
|
* @version $Revision: $
|
||||||
*/
|
*/
|
||||||
public class ActiveMQMessageTest extends MessageTestSupport {
|
public class ActiveMQMessageTest extends MessageTestSupport {
|
||||||
|
|
||||||
|
|
|
@ -33,7 +33,7 @@ import org.apache.activemq.command.*;
|
||||||
* under src/gram/script and then use maven openwire:generate to regenerate
|
* under src/gram/script and then use maven openwire:generate to regenerate
|
||||||
* this file.
|
* this file.
|
||||||
*
|
*
|
||||||
* @version $Revision$
|
* @version $Revision: $
|
||||||
*/
|
*/
|
||||||
public class ActiveMQObjectMessageTest extends ActiveMQMessageTest {
|
public class ActiveMQObjectMessageTest extends ActiveMQMessageTest {
|
||||||
|
|
||||||
|
|
|
@ -33,7 +33,7 @@ import org.apache.activemq.command.*;
|
||||||
* under src/gram/script and then use maven openwire:generate to regenerate
|
* under src/gram/script and then use maven openwire:generate to regenerate
|
||||||
* this file.
|
* this file.
|
||||||
*
|
*
|
||||||
* @version $Revision$
|
* @version $Revision: $
|
||||||
*/
|
*/
|
||||||
public class ActiveMQQueueTest extends ActiveMQDestinationTestSupport {
|
public class ActiveMQQueueTest extends ActiveMQDestinationTestSupport {
|
||||||
|
|
||||||
|
|
|
@ -33,7 +33,7 @@ import org.apache.activemq.command.*;
|
||||||
* under src/gram/script and then use maven openwire:generate to regenerate
|
* under src/gram/script and then use maven openwire:generate to regenerate
|
||||||
* this file.
|
* this file.
|
||||||
*
|
*
|
||||||
* @version $Revision$
|
* @version $Revision: $
|
||||||
*/
|
*/
|
||||||
public class ActiveMQStreamMessageTest extends ActiveMQMessageTest {
|
public class ActiveMQStreamMessageTest extends ActiveMQMessageTest {
|
||||||
|
|
||||||
|
|
|
@ -33,7 +33,7 @@ import org.apache.activemq.command.*;
|
||||||
* under src/gram/script and then use maven openwire:generate to regenerate
|
* under src/gram/script and then use maven openwire:generate to regenerate
|
||||||
* this file.
|
* this file.
|
||||||
*
|
*
|
||||||
* @version $Revision$
|
* @version $Revision: $
|
||||||
*/
|
*/
|
||||||
public abstract class ActiveMQTempDestinationTestSupport extends ActiveMQDestinationTestSupport {
|
public abstract class ActiveMQTempDestinationTestSupport extends ActiveMQDestinationTestSupport {
|
||||||
|
|
||||||
|
|
|
@ -33,7 +33,7 @@ import org.apache.activemq.command.*;
|
||||||
* under src/gram/script and then use maven openwire:generate to regenerate
|
* under src/gram/script and then use maven openwire:generate to regenerate
|
||||||
* this file.
|
* this file.
|
||||||
*
|
*
|
||||||
* @version $Revision$
|
* @version $Revision: $
|
||||||
*/
|
*/
|
||||||
public class ActiveMQTempQueueTest extends ActiveMQTempDestinationTestSupport {
|
public class ActiveMQTempQueueTest extends ActiveMQTempDestinationTestSupport {
|
||||||
|
|
||||||
|
|
|
@ -33,7 +33,7 @@ import org.apache.activemq.command.*;
|
||||||
* under src/gram/script and then use maven openwire:generate to regenerate
|
* under src/gram/script and then use maven openwire:generate to regenerate
|
||||||
* this file.
|
* this file.
|
||||||
*
|
*
|
||||||
* @version $Revision$
|
* @version $Revision: $
|
||||||
*/
|
*/
|
||||||
public class ActiveMQTempTopicTest extends ActiveMQTempDestinationTestSupport {
|
public class ActiveMQTempTopicTest extends ActiveMQTempDestinationTestSupport {
|
||||||
|
|
||||||
|
|
|
@ -33,7 +33,7 @@ import org.apache.activemq.command.*;
|
||||||
* under src/gram/script and then use maven openwire:generate to regenerate
|
* under src/gram/script and then use maven openwire:generate to regenerate
|
||||||
* this file.
|
* this file.
|
||||||
*
|
*
|
||||||
* @version $Revision$
|
* @version $Revision: $
|
||||||
*/
|
*/
|
||||||
public class ActiveMQTextMessageTest extends ActiveMQMessageTest {
|
public class ActiveMQTextMessageTest extends ActiveMQMessageTest {
|
||||||
|
|
||||||
|
|
|
@ -33,7 +33,7 @@ import org.apache.activemq.command.*;
|
||||||
* under src/gram/script and then use maven openwire:generate to regenerate
|
* under src/gram/script and then use maven openwire:generate to regenerate
|
||||||
* this file.
|
* this file.
|
||||||
*
|
*
|
||||||
* @version $Revision$
|
* @version $Revision: $
|
||||||
*/
|
*/
|
||||||
public class ActiveMQTopicTest extends ActiveMQDestinationTestSupport {
|
public class ActiveMQTopicTest extends ActiveMQDestinationTestSupport {
|
||||||
|
|
||||||
|
|
|
@ -33,7 +33,7 @@ import org.apache.activemq.command.*;
|
||||||
* under src/gram/script and then use maven openwire:generate to regenerate
|
* under src/gram/script and then use maven openwire:generate to regenerate
|
||||||
* this file.
|
* this file.
|
||||||
*
|
*
|
||||||
* @version $Revision$
|
* @version $Revision: $
|
||||||
*/
|
*/
|
||||||
public abstract class BaseCommandTestSupport extends DataFileGeneratorTestSupport {
|
public abstract class BaseCommandTestSupport extends DataFileGeneratorTestSupport {
|
||||||
|
|
||||||
|
|
|
@ -33,7 +33,7 @@ import org.apache.activemq.command.*;
|
||||||
* under src/gram/script and then use maven openwire:generate to regenerate
|
* under src/gram/script and then use maven openwire:generate to regenerate
|
||||||
* this file.
|
* this file.
|
||||||
*
|
*
|
||||||
* @version $Revision$
|
* @version $Revision: $
|
||||||
*/
|
*/
|
||||||
public class BrokerIdTest extends DataFileGeneratorTestSupport {
|
public class BrokerIdTest extends DataFileGeneratorTestSupport {
|
||||||
|
|
||||||
|
|
|
@ -33,7 +33,7 @@ import org.apache.activemq.command.*;
|
||||||
* under src/gram/script and then use maven openwire:generate to regenerate
|
* under src/gram/script and then use maven openwire:generate to regenerate
|
||||||
* this file.
|
* this file.
|
||||||
*
|
*
|
||||||
* @version $Revision$
|
* @version $Revision: $
|
||||||
*/
|
*/
|
||||||
public class BrokerInfoTest extends BaseCommandTestSupport {
|
public class BrokerInfoTest extends BaseCommandTestSupport {
|
||||||
|
|
||||||
|
|
|
@ -33,7 +33,7 @@ import org.apache.activemq.command.*;
|
||||||
* under src/gram/script and then use maven openwire:generate to regenerate
|
* under src/gram/script and then use maven openwire:generate to regenerate
|
||||||
* this file.
|
* this file.
|
||||||
*
|
*
|
||||||
* @version $Revision$
|
* @version $Revision: $
|
||||||
*/
|
*/
|
||||||
public class ConnectionErrorTest extends BaseCommandTestSupport {
|
public class ConnectionErrorTest extends BaseCommandTestSupport {
|
||||||
|
|
||||||
|
|
|
@ -33,7 +33,7 @@ import org.apache.activemq.command.*;
|
||||||
* under src/gram/script and then use maven openwire:generate to regenerate
|
* under src/gram/script and then use maven openwire:generate to regenerate
|
||||||
* this file.
|
* this file.
|
||||||
*
|
*
|
||||||
* @version $Revision$
|
* @version $Revision: $
|
||||||
*/
|
*/
|
||||||
public class ConnectionIdTest extends DataFileGeneratorTestSupport {
|
public class ConnectionIdTest extends DataFileGeneratorTestSupport {
|
||||||
|
|
||||||
|
|
|
@ -33,7 +33,7 @@ import org.apache.activemq.command.*;
|
||||||
* under src/gram/script and then use maven openwire:generate to regenerate
|
* under src/gram/script and then use maven openwire:generate to regenerate
|
||||||
* this file.
|
* this file.
|
||||||
*
|
*
|
||||||
* @version $Revision$
|
* @version $Revision: $
|
||||||
*/
|
*/
|
||||||
public class ConnectionInfoTest extends BaseCommandTestSupport {
|
public class ConnectionInfoTest extends BaseCommandTestSupport {
|
||||||
|
|
||||||
|
|
|
@ -33,7 +33,7 @@ import org.apache.activemq.command.*;
|
||||||
* under src/gram/script and then use maven openwire:generate to regenerate
|
* under src/gram/script and then use maven openwire:generate to regenerate
|
||||||
* this file.
|
* this file.
|
||||||
*
|
*
|
||||||
* @version $Revision$
|
* @version $Revision: $
|
||||||
*/
|
*/
|
||||||
public class ConsumerIdTest extends DataFileGeneratorTestSupport {
|
public class ConsumerIdTest extends DataFileGeneratorTestSupport {
|
||||||
|
|
||||||
|
|
|
@ -33,7 +33,7 @@ import org.apache.activemq.command.*;
|
||||||
* under src/gram/script and then use maven openwire:generate to regenerate
|
* under src/gram/script and then use maven openwire:generate to regenerate
|
||||||
* this file.
|
* this file.
|
||||||
*
|
*
|
||||||
* @version $Revision$
|
* @version $Revision: $
|
||||||
*/
|
*/
|
||||||
public class ConsumerInfoTest extends BaseCommandTestSupport {
|
public class ConsumerInfoTest extends BaseCommandTestSupport {
|
||||||
|
|
||||||
|
|
|
@ -33,7 +33,7 @@ import org.apache.activemq.command.*;
|
||||||
* under src/gram/script and then use maven openwire:generate to regenerate
|
* under src/gram/script and then use maven openwire:generate to regenerate
|
||||||
* this file.
|
* this file.
|
||||||
*
|
*
|
||||||
* @version $Revision$
|
* @version $Revision: $
|
||||||
*/
|
*/
|
||||||
public class ControlCommandTest extends BaseCommandTestSupport {
|
public class ControlCommandTest extends BaseCommandTestSupport {
|
||||||
|
|
||||||
|
|
|
@ -33,7 +33,7 @@ import org.apache.activemq.command.*;
|
||||||
* under src/gram/script and then use maven openwire:generate to regenerate
|
* under src/gram/script and then use maven openwire:generate to regenerate
|
||||||
* this file.
|
* this file.
|
||||||
*
|
*
|
||||||
* @version $Revision$
|
* @version $Revision: $
|
||||||
*/
|
*/
|
||||||
public class DataArrayResponseTest extends ResponseTest {
|
public class DataArrayResponseTest extends ResponseTest {
|
||||||
|
|
||||||
|
|
|
@ -33,7 +33,7 @@ import org.apache.activemq.command.*;
|
||||||
* under src/gram/script and then use maven openwire:generate to regenerate
|
* under src/gram/script and then use maven openwire:generate to regenerate
|
||||||
* this file.
|
* this file.
|
||||||
*
|
*
|
||||||
* @version $Revision$
|
* @version $Revision: $
|
||||||
*/
|
*/
|
||||||
public class DataResponseTest extends ResponseTest {
|
public class DataResponseTest extends ResponseTest {
|
||||||
|
|
||||||
|
|
|
@ -33,7 +33,7 @@ import org.apache.activemq.command.*;
|
||||||
* under src/gram/script and then use maven openwire:generate to regenerate
|
* under src/gram/script and then use maven openwire:generate to regenerate
|
||||||
* this file.
|
* this file.
|
||||||
*
|
*
|
||||||
* @version $Revision$
|
* @version $Revision: $
|
||||||
*/
|
*/
|
||||||
public class DestinationInfoTest extends BaseCommandTestSupport {
|
public class DestinationInfoTest extends BaseCommandTestSupport {
|
||||||
|
|
||||||
|
|
|
@ -33,7 +33,7 @@ import org.apache.activemq.command.*;
|
||||||
* under src/gram/script and then use maven openwire:generate to regenerate
|
* under src/gram/script and then use maven openwire:generate to regenerate
|
||||||
* this file.
|
* this file.
|
||||||
*
|
*
|
||||||
* @version $Revision$
|
* @version $Revision: $
|
||||||
*/
|
*/
|
||||||
public class DiscoveryEventTest extends DataFileGeneratorTestSupport {
|
public class DiscoveryEventTest extends DataFileGeneratorTestSupport {
|
||||||
|
|
||||||
|
|
|
@ -33,7 +33,7 @@ import org.apache.activemq.command.*;
|
||||||
* under src/gram/script and then use maven openwire:generate to regenerate
|
* under src/gram/script and then use maven openwire:generate to regenerate
|
||||||
* this file.
|
* this file.
|
||||||
*
|
*
|
||||||
* @version $Revision$
|
* @version $Revision: $
|
||||||
*/
|
*/
|
||||||
public class ExceptionResponseTest extends ResponseTest {
|
public class ExceptionResponseTest extends ResponseTest {
|
||||||
|
|
||||||
|
|
|
@ -33,7 +33,7 @@ import org.apache.activemq.command.*;
|
||||||
* under src/gram/script and then use maven openwire:generate to regenerate
|
* under src/gram/script and then use maven openwire:generate to regenerate
|
||||||
* this file.
|
* this file.
|
||||||
*
|
*
|
||||||
* @version $Revision$
|
* @version $Revision: $
|
||||||
*/
|
*/
|
||||||
public class FlushCommandTest extends BaseCommandTestSupport {
|
public class FlushCommandTest extends BaseCommandTestSupport {
|
||||||
|
|
||||||
|
|
|
@ -33,7 +33,7 @@ import org.apache.activemq.command.*;
|
||||||
* under src/gram/script and then use maven openwire:generate to regenerate
|
* under src/gram/script and then use maven openwire:generate to regenerate
|
||||||
* this file.
|
* this file.
|
||||||
*
|
*
|
||||||
* @version $Revision$
|
* @version $Revision: $
|
||||||
*/
|
*/
|
||||||
public class IntegerResponseTest extends ResponseTest {
|
public class IntegerResponseTest extends ResponseTest {
|
||||||
|
|
||||||
|
|
|
@ -33,7 +33,7 @@ import org.apache.activemq.command.*;
|
||||||
* under src/gram/script and then use maven openwire:generate to regenerate
|
* under src/gram/script and then use maven openwire:generate to regenerate
|
||||||
* this file.
|
* this file.
|
||||||
*
|
*
|
||||||
* @version $Revision$
|
* @version $Revision: $
|
||||||
*/
|
*/
|
||||||
public class JournalQueueAckTest extends DataFileGeneratorTestSupport {
|
public class JournalQueueAckTest extends DataFileGeneratorTestSupport {
|
||||||
|
|
||||||
|
|
|
@ -33,7 +33,7 @@ import org.apache.activemq.command.*;
|
||||||
* under src/gram/script and then use maven openwire:generate to regenerate
|
* under src/gram/script and then use maven openwire:generate to regenerate
|
||||||
* this file.
|
* this file.
|
||||||
*
|
*
|
||||||
* @version $Revision$
|
* @version $Revision: $
|
||||||
*/
|
*/
|
||||||
public class JournalTopicAckTest extends DataFileGeneratorTestSupport {
|
public class JournalTopicAckTest extends DataFileGeneratorTestSupport {
|
||||||
|
|
||||||
|
|
|
@ -33,7 +33,7 @@ import org.apache.activemq.command.*;
|
||||||
* under src/gram/script and then use maven openwire:generate to regenerate
|
* under src/gram/script and then use maven openwire:generate to regenerate
|
||||||
* this file.
|
* this file.
|
||||||
*
|
*
|
||||||
* @version $Revision$
|
* @version $Revision: $
|
||||||
*/
|
*/
|
||||||
public class JournalTraceTest extends DataFileGeneratorTestSupport {
|
public class JournalTraceTest extends DataFileGeneratorTestSupport {
|
||||||
|
|
||||||
|
|
|
@ -33,7 +33,7 @@ import org.apache.activemq.command.*;
|
||||||
* under src/gram/script and then use maven openwire:generate to regenerate
|
* under src/gram/script and then use maven openwire:generate to regenerate
|
||||||
* this file.
|
* this file.
|
||||||
*
|
*
|
||||||
* @version $Revision$
|
* @version $Revision: $
|
||||||
*/
|
*/
|
||||||
public class JournalTransactionTest extends DataFileGeneratorTestSupport {
|
public class JournalTransactionTest extends DataFileGeneratorTestSupport {
|
||||||
|
|
||||||
|
|
|
@ -33,7 +33,7 @@ import org.apache.activemq.command.*;
|
||||||
* under src/gram/script and then use maven openwire:generate to regenerate
|
* under src/gram/script and then use maven openwire:generate to regenerate
|
||||||
* this file.
|
* this file.
|
||||||
*
|
*
|
||||||
* @version $Revision$
|
* @version $Revision: $
|
||||||
*/
|
*/
|
||||||
public class KeepAliveInfoTest extends DataFileGeneratorTestSupport {
|
public class KeepAliveInfoTest extends DataFileGeneratorTestSupport {
|
||||||
|
|
||||||
|
|
|
@ -33,7 +33,7 @@ import org.apache.activemq.command.*;
|
||||||
* under src/gram/script and then use maven openwire:generate to regenerate
|
* under src/gram/script and then use maven openwire:generate to regenerate
|
||||||
* this file.
|
* this file.
|
||||||
*
|
*
|
||||||
* @version $Revision$
|
* @version $Revision: $
|
||||||
*/
|
*/
|
||||||
public class LocalTransactionIdTest extends TransactionIdTestSupport {
|
public class LocalTransactionIdTest extends TransactionIdTestSupport {
|
||||||
|
|
||||||
|
|
|
@ -33,7 +33,7 @@ import org.apache.activemq.command.*;
|
||||||
* under src/gram/script and then use maven openwire:generate to regenerate
|
* under src/gram/script and then use maven openwire:generate to regenerate
|
||||||
* this file.
|
* this file.
|
||||||
*
|
*
|
||||||
* @version $Revision$
|
* @version $Revision: $
|
||||||
*/
|
*/
|
||||||
public class MessageAckTest extends BaseCommandTestSupport {
|
public class MessageAckTest extends BaseCommandTestSupport {
|
||||||
|
|
||||||
|
|
|
@ -33,7 +33,7 @@ import org.apache.activemq.command.*;
|
||||||
* under src/gram/script and then use maven openwire:generate to regenerate
|
* under src/gram/script and then use maven openwire:generate to regenerate
|
||||||
* this file.
|
* this file.
|
||||||
*
|
*
|
||||||
* @version $Revision$
|
* @version $Revision: $
|
||||||
*/
|
*/
|
||||||
public class MessageDispatchNotificationTest extends BaseCommandTestSupport {
|
public class MessageDispatchNotificationTest extends BaseCommandTestSupport {
|
||||||
|
|
||||||
|
|
|
@ -33,7 +33,7 @@ import org.apache.activemq.command.*;
|
||||||
* under src/gram/script and then use maven openwire:generate to regenerate
|
* under src/gram/script and then use maven openwire:generate to regenerate
|
||||||
* this file.
|
* this file.
|
||||||
*
|
*
|
||||||
* @version $Revision$
|
* @version $Revision: $
|
||||||
*/
|
*/
|
||||||
public class MessageDispatchTest extends BaseCommandTestSupport {
|
public class MessageDispatchTest extends BaseCommandTestSupport {
|
||||||
|
|
||||||
|
|
|
@ -33,7 +33,7 @@ import org.apache.activemq.command.*;
|
||||||
* under src/gram/script and then use maven openwire:generate to regenerate
|
* under src/gram/script and then use maven openwire:generate to regenerate
|
||||||
* this file.
|
* this file.
|
||||||
*
|
*
|
||||||
* @version $Revision$
|
* @version $Revision: $
|
||||||
*/
|
*/
|
||||||
public class MessageIdTest extends DataFileGeneratorTestSupport {
|
public class MessageIdTest extends DataFileGeneratorTestSupport {
|
||||||
|
|
||||||
|
|
|
@ -33,7 +33,7 @@ import org.apache.activemq.command.*;
|
||||||
* under src/gram/script and then use maven openwire:generate to regenerate
|
* under src/gram/script and then use maven openwire:generate to regenerate
|
||||||
* this file.
|
* this file.
|
||||||
*
|
*
|
||||||
* @version $Revision$
|
* @version $Revision: $
|
||||||
*/
|
*/
|
||||||
public abstract class MessageTestSupport extends BaseCommandTestSupport {
|
public abstract class MessageTestSupport extends BaseCommandTestSupport {
|
||||||
|
|
||||||
|
|
|
@ -33,7 +33,7 @@ import org.apache.activemq.command.*;
|
||||||
* under src/gram/script and then use maven openwire:generate to regenerate
|
* under src/gram/script and then use maven openwire:generate to regenerate
|
||||||
* this file.
|
* this file.
|
||||||
*
|
*
|
||||||
* @version $Revision$
|
* @version $Revision: $
|
||||||
*/
|
*/
|
||||||
public class ProducerIdTest extends DataFileGeneratorTestSupport {
|
public class ProducerIdTest extends DataFileGeneratorTestSupport {
|
||||||
|
|
||||||
|
|
|
@ -33,7 +33,7 @@ import org.apache.activemq.command.*;
|
||||||
* under src/gram/script and then use maven openwire:generate to regenerate
|
* under src/gram/script and then use maven openwire:generate to regenerate
|
||||||
* this file.
|
* this file.
|
||||||
*
|
*
|
||||||
* @version $Revision$
|
* @version $Revision: $
|
||||||
*/
|
*/
|
||||||
public class ProducerInfoTest extends BaseCommandTestSupport {
|
public class ProducerInfoTest extends BaseCommandTestSupport {
|
||||||
|
|
||||||
|
|
|
@ -33,7 +33,7 @@ import org.apache.activemq.command.*;
|
||||||
* under src/gram/script and then use maven openwire:generate to regenerate
|
* under src/gram/script and then use maven openwire:generate to regenerate
|
||||||
* this file.
|
* this file.
|
||||||
*
|
*
|
||||||
* @version $Revision$
|
* @version $Revision: $
|
||||||
*/
|
*/
|
||||||
public class RemoveInfoTest extends BaseCommandTestSupport {
|
public class RemoveInfoTest extends BaseCommandTestSupport {
|
||||||
|
|
||||||
|
|
|
@ -33,7 +33,7 @@ import org.apache.activemq.command.*;
|
||||||
* under src/gram/script and then use maven openwire:generate to regenerate
|
* under src/gram/script and then use maven openwire:generate to regenerate
|
||||||
* this file.
|
* this file.
|
||||||
*
|
*
|
||||||
* @version $Revision$
|
* @version $Revision: $
|
||||||
*/
|
*/
|
||||||
public class RemoveSubscriptionInfoTest extends BaseCommandTestSupport {
|
public class RemoveSubscriptionInfoTest extends BaseCommandTestSupport {
|
||||||
|
|
||||||
|
|
|
@ -33,7 +33,7 @@ import org.apache.activemq.command.*;
|
||||||
* under src/gram/script and then use maven openwire:generate to regenerate
|
* under src/gram/script and then use maven openwire:generate to regenerate
|
||||||
* this file.
|
* this file.
|
||||||
*
|
*
|
||||||
* @version $Revision$
|
* @version $Revision: $
|
||||||
*/
|
*/
|
||||||
public class ResponseTest extends BaseCommandTestSupport {
|
public class ResponseTest extends BaseCommandTestSupport {
|
||||||
|
|
||||||
|
|
|
@ -33,7 +33,7 @@ import org.apache.activemq.command.*;
|
||||||
* under src/gram/script and then use maven openwire:generate to regenerate
|
* under src/gram/script and then use maven openwire:generate to regenerate
|
||||||
* this file.
|
* this file.
|
||||||
*
|
*
|
||||||
* @version $Revision$
|
* @version $Revision: $
|
||||||
*/
|
*/
|
||||||
public class SessionIdTest extends DataFileGeneratorTestSupport {
|
public class SessionIdTest extends DataFileGeneratorTestSupport {
|
||||||
|
|
||||||
|
|
|
@ -33,7 +33,7 @@ import org.apache.activemq.command.*;
|
||||||
* under src/gram/script and then use maven openwire:generate to regenerate
|
* under src/gram/script and then use maven openwire:generate to regenerate
|
||||||
* this file.
|
* this file.
|
||||||
*
|
*
|
||||||
* @version $Revision$
|
* @version $Revision: $
|
||||||
*/
|
*/
|
||||||
public class SessionInfoTest extends BaseCommandTestSupport {
|
public class SessionInfoTest extends BaseCommandTestSupport {
|
||||||
|
|
||||||
|
|
|
@ -33,7 +33,7 @@ import org.apache.activemq.command.*;
|
||||||
* under src/gram/script and then use maven openwire:generate to regenerate
|
* under src/gram/script and then use maven openwire:generate to regenerate
|
||||||
* this file.
|
* this file.
|
||||||
*
|
*
|
||||||
* @version $Revision$
|
* @version $Revision: $
|
||||||
*/
|
*/
|
||||||
public class ShutdownInfoTest extends BaseCommandTestSupport {
|
public class ShutdownInfoTest extends BaseCommandTestSupport {
|
||||||
|
|
||||||
|
|
|
@ -33,7 +33,7 @@ import org.apache.activemq.command.*;
|
||||||
* under src/gram/script and then use maven openwire:generate to regenerate
|
* under src/gram/script and then use maven openwire:generate to regenerate
|
||||||
* this file.
|
* this file.
|
||||||
*
|
*
|
||||||
* @version $Revision$
|
* @version $Revision: $
|
||||||
*/
|
*/
|
||||||
public class SubscriptionInfoTest extends DataFileGeneratorTestSupport {
|
public class SubscriptionInfoTest extends DataFileGeneratorTestSupport {
|
||||||
|
|
||||||
|
|
|
@ -33,7 +33,7 @@ import org.apache.activemq.command.*;
|
||||||
* under src/gram/script and then use maven openwire:generate to regenerate
|
* under src/gram/script and then use maven openwire:generate to regenerate
|
||||||
* this file.
|
* this file.
|
||||||
*
|
*
|
||||||
* @version $Revision$
|
* @version $Revision: $
|
||||||
*/
|
*/
|
||||||
public abstract class TransactionIdTestSupport extends DataFileGeneratorTestSupport {
|
public abstract class TransactionIdTestSupport extends DataFileGeneratorTestSupport {
|
||||||
|
|
||||||
|
|
|
@ -33,7 +33,7 @@ import org.apache.activemq.command.*;
|
||||||
* under src/gram/script and then use maven openwire:generate to regenerate
|
* under src/gram/script and then use maven openwire:generate to regenerate
|
||||||
* this file.
|
* this file.
|
||||||
*
|
*
|
||||||
* @version $Revision$
|
* @version $Revision: $
|
||||||
*/
|
*/
|
||||||
public class TransactionInfoTest extends BaseCommandTestSupport {
|
public class TransactionInfoTest extends BaseCommandTestSupport {
|
||||||
|
|
||||||
|
|
|
@ -33,7 +33,7 @@ import org.apache.activemq.command.*;
|
||||||
* under src/gram/script and then use maven openwire:generate to regenerate
|
* under src/gram/script and then use maven openwire:generate to regenerate
|
||||||
* this file.
|
* this file.
|
||||||
*
|
*
|
||||||
* @version $Revision$
|
* @version $Revision: $
|
||||||
*/
|
*/
|
||||||
public class WireFormatInfoTest extends DataFileGeneratorTestSupport {
|
public class WireFormatInfoTest extends DataFileGeneratorTestSupport {
|
||||||
|
|
||||||
|
@ -50,7 +50,6 @@ public class WireFormatInfoTest extends DataFileGeneratorTestSupport {
|
||||||
protected void populateObject(Object object) throws Exception {
|
protected void populateObject(Object object) throws Exception {
|
||||||
super.populateObject(object);
|
super.populateObject(object);
|
||||||
WireFormatInfo info = (WireFormatInfo) object;
|
WireFormatInfo info = (WireFormatInfo) object;
|
||||||
info.setMagic("Magic:1".getBytes());
|
|
||||||
info.setVersion(1);
|
info.setVersion(1);
|
||||||
info.setOptions(2);
|
info.setOptions(2);
|
||||||
|
|
||||||
|
|
|
@ -33,7 +33,7 @@ import org.apache.activemq.command.*;
|
||||||
* under src/gram/script and then use maven openwire:generate to regenerate
|
* under src/gram/script and then use maven openwire:generate to regenerate
|
||||||
* this file.
|
* this file.
|
||||||
*
|
*
|
||||||
* @version $Revision$
|
* @version $Revision: $
|
||||||
*/
|
*/
|
||||||
public class XATransactionIdTest extends TransactionIdTestSupport {
|
public class XATransactionIdTest extends TransactionIdTestSupport {
|
||||||
|
|
||||||
|
|
|
@ -31,6 +31,9 @@ import javax.jms.JMSException;
|
||||||
import javax.jms.Message;
|
import javax.jms.Message;
|
||||||
import javax.jms.TextMessage;
|
import javax.jms.TextMessage;
|
||||||
|
|
||||||
|
import java.lang.reflect.Array;
|
||||||
|
import java.util.Arrays;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Useful base class for unit test cases
|
* Useful base class for unit test cases
|
||||||
|
@ -226,4 +229,19 @@ public class TestSupport extends TestCase {
|
||||||
protected String getSubject() {
|
protected String getSubject() {
|
||||||
return getClass().getName() + "." + getName();
|
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));
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue