/*
 * Created on Mar 5, 2004
 *
 * To change the template for this generated file go to
 * Window - Preferences - Java - Code Generation - Code and Comments
 */
package org.activemq.message;

import java.util.HashMap;

import javax.jms.JMSException;

import org.activemq.message.ActiveMQMapMessage;
import org.activemq.message.Packet;

import junit.framework.TestCase;

/**
 *
 * To change the template for this generated type comment go to
 * Window - Preferences - Java - Code Generation - Code and Comments
 */
public class ActiveMQMapMessageTest extends TestCase
{
	private String name = "testName";

	public static void main(String[] args)
	{
		junit.textui.TestRunner.run(ActiveMQMapMessageTest.class);
	}

	/*
	 * @see TestCase#setUp()
	 */
	protected void setUp() throws Exception
	{
		super.setUp();
	}

	/*
	 * @see TestCase#tearDown()
	 */
	protected void tearDown() throws Exception
	{
		super.tearDown();
	}

	/**
	 * Constructor for ActiveMQMapMessageTest.
	 * @param arg0
	 */
	public ActiveMQMapMessageTest(String arg0)
	{
		super(arg0);
	}

	public void testGetPacketType()
	{
		ActiveMQMapMessage msg = new ActiveMQMapMessage();
		assertTrue(msg.getPacketType()==Packet.ACTIVEMQ_MAP_MESSAGE);
	}

	public void testShallowCopy()
	{
		
        try {
            ActiveMQMapMessage msg = new ActiveMQMapMessage();
            msg.setString("fred", "fred");
            
            ActiveMQMapMessage msg2;
            
            msg2 = (ActiveMQMapMessage)msg.shallowCopy();
            assertTrue(msg2.getTable() != null && msg2.getTable()==msg.getTable());
        }
        catch (JMSException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
            assertTrue(false);
        }
        
	}

	public void testDeepCopy()
	{
		ActiveMQMapMessage msg = new ActiveMQMapMessage();
		
		
		try {
            ActiveMQMapMessage msg2 = (ActiveMQMapMessage)msg.deepCopy();
            assertTrue(msg2.getTable() != null && msg2.getTable()!=msg.getTable());
        }
        catch (JMSException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
            assertTrue(false);
        }
	}

	public void testSetTable()
	{
		ActiveMQMapMessage msg = new ActiveMQMapMessage();
		
		HashMap table = new HashMap();
		msg.setTable(table);
		try {
            assertTrue(msg.getTable()==table);
        }
        catch (JMSException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
            assertTrue(false);
        }
	}


	public void testGetBoolean()
	{
		ActiveMQMapMessage msg = new ActiveMQMapMessage();
		try {
			msg.setBoolean(name,true);
			msg.setReadOnly(true);
			assertTrue(msg.getBoolean(name));
			msg.clearBody();
			msg.setString(name,"true");
			assertTrue(msg.getBoolean(name));
		}catch(JMSException jmsEx){
			jmsEx.printStackTrace();
			assertTrue(false);
		}
	}

	public void testGetByte()
	{

		ActiveMQMapMessage msg = new ActiveMQMapMessage();
		try {
			msg.setByte(this.name,(byte)1);
			msg.setReadOnly(true);
			assertTrue(msg.getByte(this.name)==(byte)1);
		}catch(JMSException jmsEx){
			jmsEx.printStackTrace();
			assertTrue(false);
		}
	}

	public void testGetShort()
	{
		ActiveMQMapMessage msg = new ActiveMQMapMessage();
		try {
			msg.setByte(this.name,(byte)1);
			msg.setReadOnly(true);
			assertTrue(msg.getByte(this.name)==(byte)1);
		}catch(JMSException jmsEx){
			jmsEx.printStackTrace();
			assertTrue(false);
		}
	}

	public void testGetChar()
	{
		//TODO Implement getChar().
	}

	public void testGetInt()
	{
		//TODO Implement getInt().
	}

	public void testGetLong()
	{
		//TODO Implement getLong().
	}

	public void testGetFloat()
	{
		//TODO Implement getFloat().
	}

	public void testGetDouble()
	{
		//TODO Implement getDouble().
	}

	public void testGetString()
	{
		//TODO Implement getString().
	}

	public void testGetBytes()
	{
		//TODO Implement getBytes().
	}

	public void testGetObject()
	{
		//TODO Implement getObject().
	}

	public void testGetMapNames()
	{
		//TODO Implement getMapNames().
	}

	public void testSetBoolean()
	{
		//TODO Implement setBoolean().
	}

	public void testSetByte()
	{
		//TODO Implement setByte().
	}

	public void testSetShort()
	{
		//TODO Implement setShort().
	}

	public void testSetChar()
	{
		//TODO Implement setChar().
	}

	public void testSetInt()
	{
		//TODO Implement setInt().
	}

	public void testSetLong()
	{
		//TODO Implement setLong().
	}

	public void testSetFloat()
	{
		//TODO Implement setFloat().
	}

	public void testSetDouble()
	{
		//TODO Implement setDouble().
	}

	public void testSetString()
	{
		//TODO Implement setString().
	}

	/*
	 * Class to test for void setBytes(String, byte[])
	 */
	public void testSetBytesStringbyteArray()
	{
		//TODO Implement setBytes().
	}

	/*
	 * Class to test for void setBytes(String, byte[], int, int)
	 */
	public void testSetBytesStringbyteArrayintint()
	{
		//TODO Implement setBytes().
	}

	public void testSetObject()
	{
		//TODO Implement setObject().
	}

	public void testItemExists()
	{
		//TODO Implement itemExists().
	}

}
