ActiveMQMapMessageTest xref

    1   /*
    2    * Created on Mar 5, 2004
    3    *
    4    * To change the template for this generated file go to
    5    * Window - Preferences - Java - Code Generation - Code and Comments
    6    */
    7   package org.codehaus.activemq.message;
    8
    9   import java.util.Hashtable;
    10
    11  import javax.jms.JMSException;
    12
    13  import org.codehaus.activemq.message.ActiveMQMapMessage;
    14  import org.codehaus.activemq.message.Packet;
    15
    16  import junit.framework.TestCase;
    17
    18  /***
    19   *
    20   * To change the template for this generated type comment go to
    21   * Window - Preferences - Java - Code Generation - Code and Comments
    22   */
    23  public class ActiveMQMapMessageTest extends TestCase
    24  {
    25  	private String name = "testName";
    26
    27  	public static void main(String[] args)
    28  	{
    29  		junit.textui.TestRunner.run(ActiveMQMapMessageTest.class);
    30  	}
    31
    32  	/*
    33  	 * @see TestCase#setUp()
    34  	 */
    35  	protected void setUp() throws Exception
    36  	{
    37  		super.setUp();
    38  	}
    39
    40  	/*
    41  	 * @see TestCase#tearDown()
    42  	 */
    43  	protected void tearDown() throws Exception
    44  	{
    45  		super.tearDown();
    46  	}
    47
    48  	/***
    49  	 * Constructor for ActiveMQMapMessageTest.
    50  	 * @param arg0
    51  	 */
    52  	public ActiveMQMapMessageTest(String arg0)
    53  	{
    54  		super(arg0);
    55  	}
    56
    57  	public void testGetPacketType()
    58  	{
    59  		ActiveMQMapMessage msg = new ActiveMQMapMessage();
    60  		assertTrue(msg.getPacketType()==Packet.ACTIVEMQ_MAP_MESSAGE);
    61  	}
    62
    63  	public void testShallowCopy()
    64  	{
    65
    66          try {
    67              ActiveMQMapMessage msg = new ActiveMQMapMessage();
    68              msg.setString("fred", "fred");
    69
    70              ActiveMQMapMessage msg2;
    71
    72              msg2 = (ActiveMQMapMessage)msg.shallowCopy();
    73              assertTrue(msg2.getTable() != null && msg2.getTable()==msg.getTable());
    74          }
    75          catch (JMSException e) {
    76              // TODO Auto-generated catch block
    77              e.printStackTrace();
    78              assertTrue(false);
    79          }
    80
    81  	}
    82
    83  	public void testDeepCopy()
    84  	{
    85  		ActiveMQMapMessage msg = new ActiveMQMapMessage();
    86
    87
    88  		try {
    89              ActiveMQMapMessage msg2 = (ActiveMQMapMessage)msg.deepCopy();
    90              assertTrue(msg2.getTable() != null && msg2.getTable()!=msg.getTable());
    91          }
    92          catch (JMSException e) {
    93              // TODO Auto-generated catch block
    94              e.printStackTrace();
    95              assertTrue(false);
    96          }
    97  	}
    98
    99  	public void testSetTable()
    100 	{
    101 		ActiveMQMapMessage msg = new ActiveMQMapMessage();
    102
    103 		Hashtable table = new Hashtable();
    104 		msg.setTable(table);
    105 		try {
    106             assertTrue(msg.getTable()==table);
    107         }
    108         catch (JMSException e) {
    109             // TODO Auto-generated catch block
    110             e.printStackTrace();
    111             assertTrue(false);
    112         }
    113 	}
    114
    115
    116 	public void testGetBoolean()
    117 	{
    118 		ActiveMQMapMessage msg = new ActiveMQMapMessage();
    119 		try {
    120 			msg.setBoolean(name,true);
    121 			msg.setReadOnly(true);
    122 			assertTrue(msg.getBoolean(name));
    123 			msg.clearBody();
    124 			msg.setString(name,"true");
    125 			assertTrue(msg.getBoolean(name));
    126 		}catch(JMSException jmsEx){
    127 			jmsEx.printStackTrace();
    128 			assertTrue(false);
    129 		}
    130 	}
    131
    132 	public void testGetByte()
    133 	{
    134
    135 		ActiveMQMapMessage msg = new ActiveMQMapMessage();
    136 		try {
    137 			msg.setByte(this.name,(byte)1);
    138 			msg.setReadOnly(true);
    139 			assertTrue(msg.getByte(this.name)==(byte)1);
    140 		}catch(JMSException jmsEx){
    141 			jmsEx.printStackTrace();
    142 			assertTrue(false);
    143 		}
    144 	}
    145
    146 	public void testGetShort()
    147 	{
    148 		ActiveMQMapMessage msg = new ActiveMQMapMessage();
    149 		try {
    150 			msg.setByte(this.name,(byte)1);
    151 			msg.setReadOnly(true);
    152 			assertTrue(msg.getByte(this.name)==(byte)1);
    153 		}catch(JMSException jmsEx){
    154 			jmsEx.printStackTrace();
    155 			assertTrue(false);
    156 		}
    157 	}
    158
    159 	public void testGetChar()
    160 	{
    161 		//TODO Implement getChar().
    162 	}
    163
    164 	public void testGetInt()
    165 	{
    166 		//TODO Implement getInt().
    167 	}
    168
    169 	public void testGetLong()
    170 	{
    171 		//TODO Implement getLong().
    172 	}
    173
    174 	public void testGetFloat()
    175 	{
    176 		//TODO Implement getFloat().
    177 	}
    178
    179 	public void testGetDouble()
    180 	{
    181 		//TODO Implement getDouble().
    182 	}
    183
    184 	public void testGetString()
    185 	{
    186 		//TODO Implement getString().
    187 	}
    188
    189 	public void testGetBytes()
    190 	{
    191 		//TODO Implement getBytes().
    192 	}
    193
    194 	public void testGetObject()
    195 	{
    196 		//TODO Implement getObject().
    197 	}
    198
    199 	public void testGetMapNames()
    200 	{
    201 		//TODO Implement getMapNames().
    202 	}
    203
    204 	public void testSetBoolean()
    205 	{
    206 		//TODO Implement setBoolean().
    207 	}
    208
    209 	public void testSetByte()
    210 	{
    211 		//TODO Implement setByte().
    212 	}
    213
    214 	public void testSetShort()
    215 	{
    216 		//TODO Implement setShort().
    217 	}
    218
    219 	public void testSetChar()
    220 	{
    221 		//TODO Implement setChar().
    222 	}
    223
    224 	public void testSetInt()
    225 	{
    226 		//TODO Implement setInt().
    227 	}
    228
    229 	public void testSetLong()
    230 	{
    231 		//TODO Implement setLong().
    232 	}
    233
    234 	public void testSetFloat()
    235 	{
    236 		//TODO Implement setFloat().
    237 	}
    238
    239 	public void testSetDouble()
    240 	{
    241 		//TODO Implement setDouble().
    242 	}
    243
    244 	public void testSetString()
    245 	{
    246 		//TODO Implement setString().
    247 	}
    248
    249 	/*
    250 	 * Class to test for void setBytes(String, byte[])
    251 	 */
    252 	public void testSetBytesStringbyteArray()
    253 	{
    254 		//TODO Implement setBytes().
    255 	}
    256
    257 	/*
    258 	 * Class to test for void setBytes(String, byte[], int, int)
    259 	 */
    260 	public void testSetBytesStringbyteArrayintint()
    261 	{
    262 		//TODO Implement setBytes().
    263 	}
    264
    265 	public void testSetObject()
    266 	{
    267 		//TODO Implement setObject().
    268 	}
    269
    270 	public void testItemExists()
    271 	{
    272 		//TODO Implement itemExists().
    273 	}
    274
    275 }