You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by ro...@apache.org on 2014/12/22 17:56:15 UTC

[07/16] qpid-jms git commit: remove tmp module with old client work

http://git-wip-us.apache.org/repos/asf/qpid-jms/blob/6f106f64/qpid-jms-client-tmp/src/test/java/org/apache/qpid/jms/impl/DestinationHelperTest.java
----------------------------------------------------------------------
diff --git a/qpid-jms-client-tmp/src/test/java/org/apache/qpid/jms/impl/DestinationHelperTest.java b/qpid-jms-client-tmp/src/test/java/org/apache/qpid/jms/impl/DestinationHelperTest.java
deleted file mode 100644
index df36d80..0000000
--- a/qpid-jms-client-tmp/src/test/java/org/apache/qpid/jms/impl/DestinationHelperTest.java
+++ /dev/null
@@ -1,356 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you 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.qpid.jms.impl;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertSame;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
-
-import java.util.HashSet;
-import java.util.Set;
-
-import javax.jms.Destination;
-import javax.jms.Queue;
-import javax.jms.TemporaryQueue;
-import javax.jms.TemporaryTopic;
-import javax.jms.Topic;
-
-import org.apache.qpid.jms.QpidJmsTestCase;
-import org.junit.Before;
-import org.junit.Test;
-import org.mockito.Mockito;
-
-public class DestinationHelperTest extends QpidJmsTestCase
-{
-    private DestinationHelper _helper;
-
-    @Before
-    @Override
-    public void setUp() throws Exception
-    {
-        super.setUp();
-        _helper = new DestinationHelper();
-    }
-
-    @Test
-    public void testDecodeDestinationWithNullAddressAndNullConsumerDestReturnsNull() throws Exception
-    {
-        assertNull(_helper.decodeDestination(null, DestinationHelper.QUEUE_ATTRIBUTES_STRING, null, false));
-    }
-
-    @Test
-    public void testDecodeDestinationWithNullAddressWithConsumerDestReturnsSameConsumerDestObject() throws Exception
-    {
-        String consumerDestString = "consumerDest";
-        Queue consumerDest = _helper.createQueue(consumerDestString);
-        assertSame(consumerDest,_helper.decodeDestination(null, DestinationHelper.QUEUE_ATTRIBUTES_STRING, consumerDest, false));
-    }
-
-    @Test
-    public void testDecodeDestinationWithNullAddressWithConsumerDestReturnsNullWhenUsingConsumerDestForTypeOnly() throws Exception
-    {
-        String consumerDestString = "consumerDest";
-        Queue consumerDest = _helper.createQueue(consumerDestString);
-        assertNull(_helper.decodeDestination(null, DestinationHelper.QUEUE_ATTRIBUTES_STRING, consumerDest, true));
-    }
-
-    @Test
-    public void testDecodeDestinationWithoutTypeAnnotationWithoutConsumerDest() throws Exception
-    {
-        String testAddress = "testAddress";
-        Destination dest = _helper.decodeDestination(testAddress, null, null, false);
-        assertNotNull(dest);
-
-        assertTrue(dest instanceof DestinationImpl);
-        assertEquals(testAddress, ((DestinationImpl) dest).getAddress());
-    }
-
-    @Test
-    public void testDecodeDestinationWithoutTypeAnnotationWithQueueConsumerDest() throws Exception
-    {
-        String testAddress = "testAddress";
-        String consumerDestString = "consumerDest";
-        Queue consumerDest = _helper.createQueue(consumerDestString);
-        Destination dest = _helper.decodeDestination(testAddress, null, consumerDest, false);
-        assertNotNull(dest);
-
-        assertTrue(dest instanceof QueueImpl);
-        assertEquals(testAddress, ((Queue)dest).getQueueName());
-    }
-
-    @Test
-    public void testDecodeDestinationWithoutTypeAnnotationWithTopicConsumerDest() throws Exception
-    {
-        String testAddress = "testAddress";
-        String consumerDestString = "consumerDest";
-        Topic consumerDest = _helper.createTopic(consumerDestString);
-        Destination dest = _helper.decodeDestination(testAddress, null, consumerDest, false);
-        assertNotNull(dest);
-
-        assertTrue(dest instanceof TopicImpl);
-        assertEquals(testAddress, ((Topic)dest).getTopicName());
-    }
-
-    @Test
-    public void testDecodeDestinationWithoutTypeAnnotationWithDestinationConsumerDest() throws Exception
-    {
-        String testAddress = "testAddress";
-        Destination consumerDest = new DestinationImpl(testAddress);
-        Destination dest = _helper.decodeDestination(testAddress, null, consumerDest, false);
-        assertNotNull(dest);
-
-        assertTrue(dest instanceof DestinationImpl);
-        assertEquals(testAddress, ((DestinationImpl) dest).getAddress());
-    }
-
-    @Test
-    public void testDecodeDestinationWithQueueTypeAnnotationWithoutConsumerDest() throws Exception
-    {
-        String testAddress = "testAddress";
-        String testTypeAnnotation = "queue";
-
-        Destination dest = _helper.decodeDestination(testAddress, testTypeAnnotation, null, false);
-        assertNotNull(dest);
-        assertTrue(dest instanceof DestinationImpl);
-        assertTrue(dest instanceof QueueImpl);
-        assertTrue(dest instanceof Queue);
-        assertEquals(testAddress, ((Queue) dest).getQueueName());
-    }
-
-    @Test
-    public void testDecodeDestinationWithTopicTypeAnnotationWithoutConsumerDest() throws Exception
-    {
-        String testAddress = "testAddress";
-        String testTypeAnnotation = "topic";
-
-        Destination dest = _helper.decodeDestination(testAddress, testTypeAnnotation, null, false);
-        assertNotNull(dest);
-        assertTrue(dest instanceof DestinationImpl);
-        assertTrue(dest instanceof TopicImpl);
-        assertTrue(dest instanceof Topic);
-        assertEquals(testAddress, ((Topic) dest).getTopicName());
-    }
-
-    @Test
-    public void testDecodeDestinationWithTempTopicTypeAnnotationThrowsIAE() throws Exception
-    {
-        //TODO: complete implementation when TempTopics implemented
-        String testAddress = "testAddress";
-        String testTypeAnnotation = "topic,temporary";
-        String testTypeAnnotationBackwards = "temporary,topic";
-
-        try
-        {
-            _helper.decodeDestination(testAddress, testTypeAnnotation, null, false);
-            fail("expected exception not thrown");
-        }
-        catch(IllegalArgumentException iae)
-        {
-            //expected
-        }
-
-        try
-        {
-            _helper.decodeDestination(testAddress, testTypeAnnotationBackwards, null, false);
-            fail("expected exception not thrown");
-        }
-        catch(IllegalArgumentException iae)
-        {
-            //expected
-        }
-    }
-
-    @Test
-    public void testDecodeDestinationWithTempQueueTypeAnnotationThrowsIAE() throws Exception
-    {
-        //TODO: complete implementation when TempQueues implemented
-        String testAddress = "testAddress";
-        String testTypeAnnotation = "queue,temporary";
-        String testTypeAnnotationBackwards = "temporary,queue";
-
-        try
-        {
-            _helper.decodeDestination(testAddress, testTypeAnnotation, null, false);
-            fail("expected exception not thrown");
-        }
-        catch(IllegalArgumentException iae)
-        {
-            //expected
-        }
-
-        try
-        {
-            _helper.decodeDestination(testAddress, testTypeAnnotationBackwards, null, false);
-            fail("expected exception not thrown");
-        }
-        catch(IllegalArgumentException iae)
-        {
-            //expected
-        }
-    }
-
-    @Test
-    public void testConvertToQpidDestinationWithNullReturnsNull() throws Exception
-    {
-        assertNull(_helper.convertToQpidDestination(null));
-    }
-
-    @Test
-    public void testConvertToQpidDestinationWithQpidDestinationReturnsSameObject() throws Exception
-    {
-        String testAddress = "testAddress";
-        Queue queue = _helper.createQueue(testAddress);
-
-        Destination dest = _helper.convertToQpidDestination(queue);
-        assertNotNull(dest);
-        assertSame(queue, dest);
-    }
-
-    @Test
-    public void testConvertToQpidDestinationWithNonQpidQueue() throws Exception
-    {
-        String testAddress = "testAddress";
-        Queue mockQueue = Mockito.mock(Queue.class);
-        Mockito.when(mockQueue.getQueueName()).thenReturn(testAddress);
-
-        Destination dest = _helper.convertToQpidDestination(mockQueue);
-        assertNotNull(dest);
-        assertTrue(dest instanceof Queue);
-        assertEquals(testAddress, ((Queue)dest).getQueueName());
-    }
-
-    @Test
-    public void testConvertToQpidDestinationWithNonQpidTopic() throws Exception
-    {
-        String testAddress = "testAddress";
-        Topic mockTopic = Mockito.mock(Topic.class);
-        Mockito.when(mockTopic.getTopicName()).thenReturn(testAddress);
-
-        Destination dest = _helper.convertToQpidDestination(mockTopic);
-        assertNotNull(dest);
-        assertTrue(dest instanceof Topic);
-        assertEquals(testAddress, ((Topic)dest).getTopicName());
-    }
-
-    @Test
-    public void testConvertToQpidDestinationWithNonQpidTempQueueThrowsIAE() throws Exception
-    {
-        //TODO: complete implementation when TempQueues implemented
-        String testAddress = "testAddress";
-        TemporaryQueue mockTempQueue = Mockito.mock(TemporaryQueue.class);
-        Mockito.when(mockTempQueue.getQueueName()).thenReturn(testAddress);
-
-        try
-        {
-            _helper.convertToQpidDestination(mockTempQueue);
-            fail("excepted exception not thrown");
-        }
-        catch(IllegalArgumentException iae)
-        {
-            //expected
-        }
-    }
-
-    @Test
-    public void testConvertToQpidDestinationWithNonQpidTempTopic() throws Exception
-    {
-        //TODO: complete implementation when TempTopics implemented
-        String testAddress = "testAddress";
-        TemporaryTopic mockTempTopic = Mockito.mock(TemporaryTopic.class);
-        Mockito.when(mockTempTopic.getTopicName()).thenReturn(testAddress);
-
-        try
-        {
-            _helper.convertToQpidDestination(mockTempTopic);
-            fail("excepted exception not thrown");
-        }
-        catch(IllegalArgumentException iae)
-        {
-            //expected
-        }
-    }
-
-    @Test
-    public void testDecodeAddressWithNullReturnsNull() throws Exception
-    {
-        assertNull(_helper.decodeAddress(null));
-    }
-
-    @Test
-    public void testDecodeAddressWithQpidQueue() throws Exception
-    {
-        String testAddress = "testAddress";
-        Queue queue = _helper.createQueue(testAddress);
-
-        assertEquals(testAddress, _helper.decodeAddress(queue));
-    }
-
-    @Test
-    public void testDecodeAddressWithNonQpidQueueReturnsConvertedAddress() throws Exception
-    {
-        String testAddress = "testAddress";
-        Queue mockQueue = Mockito.mock(Queue.class);
-        Mockito.when(mockQueue.getQueueName()).thenReturn(testAddress);
-
-        assertEquals(testAddress, _helper.decodeAddress(mockQueue));
-    }
-
-    @Test
-    public void testSplitAttributeWithExtranerousCommas() throws Exception
-    {
-        Set<String> set = new HashSet<String>();
-        set.add(DestinationHelper.QUEUE_ATTRIBUTE);
-        set.add(DestinationHelper.TEMPORARY_ATTRIBUTE);
-
-        //test a single comma separator produces expected set
-        assertEquals(set, _helper.splitAttributes(DestinationHelper.QUEUE_ATTRIBUTES_STRING
-                                                  + ","
-                                                  + DestinationHelper.TEMPORARY_ATTRIBUTE));
-
-        //test trailing comma doesn't alter produced set
-        assertEquals(set, _helper.splitAttributes(DestinationHelper.QUEUE_ATTRIBUTES_STRING
-                                                  + ","
-                                                  + DestinationHelper.TEMPORARY_ATTRIBUTE
-                                                  + ","));
-        //test leading comma doesn't alter produced set
-        assertEquals(set, _helper.splitAttributes(","
-                                                  + DestinationHelper.QUEUE_ATTRIBUTES_STRING
-                                                  + ","
-                                                  + DestinationHelper.TEMPORARY_ATTRIBUTE));
-        //test consecutive central commas don't alter produced set
-        assertEquals(set, _helper.splitAttributes(DestinationHelper.QUEUE_ATTRIBUTES_STRING
-                                                  + ",,"
-                                                  + DestinationHelper.TEMPORARY_ATTRIBUTE));
-        //test consecutive trailing commas don't alter produced set
-        assertEquals(set, _helper.splitAttributes(DestinationHelper.QUEUE_ATTRIBUTES_STRING
-                                                  + ","
-                                                  + DestinationHelper.TEMPORARY_ATTRIBUTE
-                                                  + ",,"));
-        //test consecutive leading commas don't alter produced set
-        assertEquals(set, _helper.splitAttributes(","
-                                                  + DestinationHelper.QUEUE_ATTRIBUTES_STRING
-                                                  + ","
-                                                  + DestinationHelper.TEMPORARY_ATTRIBUTE));
-    }
-}

http://git-wip-us.apache.org/repos/asf/qpid-jms/blob/6f106f64/qpid-jms-client-tmp/src/test/java/org/apache/qpid/jms/impl/ImmediateWaitUntil.java
----------------------------------------------------------------------
diff --git a/qpid-jms-client-tmp/src/test/java/org/apache/qpid/jms/impl/ImmediateWaitUntil.java b/qpid-jms-client-tmp/src/test/java/org/apache/qpid/jms/impl/ImmediateWaitUntil.java
deleted file mode 100644
index 808786d..0000000
--- a/qpid-jms-client-tmp/src/test/java/org/apache/qpid/jms/impl/ImmediateWaitUntil.java
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you 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.qpid.jms.impl;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
-
-import org.junit.Assert;
-import org.mockito.Matchers;
-import org.mockito.Mockito;
-import org.mockito.invocation.InvocationOnMock;
-import org.mockito.stubbing.Answer;
-
-public class ImmediateWaitUntil implements Answer<Void>
-{
-    @Override
-    public Void answer(InvocationOnMock invocation) throws Throwable
-    {
-        //verify the arg types / expected values
-        Object[] args = invocation.getArguments();
-        assertEquals(2, args.length);
-        assertTrue(args[0] instanceof Predicate);
-        assertTrue(args[1] instanceof Long);
-
-        Predicate predicate = (Predicate)args[0];
-
-        if(predicate.test())
-        {
-            return null;
-        }
-        else
-        {
-            throw new JmsTimeoutException(0, "ImmediateWaitUntil predicate test returned false: " + predicate);
-        }
-    }
-
-    public static void mockWaitUntil(ConnectionImpl connectionImpl) throws JmsTimeoutException, JmsInterruptedException
-    {
-        Assert.assertFalse("This method cant mock the method on a real object", connectionImpl.getClass() == ConnectionImpl.class);
-
-        Mockito.doAnswer(new ImmediateWaitUntil()).when(connectionImpl).waitUntil(Matchers.isA(Predicate.class), Matchers.anyLong());
-    }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/qpid-jms/blob/6f106f64/qpid-jms-client-tmp/src/test/java/org/apache/qpid/jms/impl/MapMessageImplTest.java
----------------------------------------------------------------------
diff --git a/qpid-jms-client-tmp/src/test/java/org/apache/qpid/jms/impl/MapMessageImplTest.java b/qpid-jms-client-tmp/src/test/java/org/apache/qpid/jms/impl/MapMessageImplTest.java
deleted file mode 100644
index f8771ce..0000000
--- a/qpid-jms-client-tmp/src/test/java/org/apache/qpid/jms/impl/MapMessageImplTest.java
+++ /dev/null
@@ -1,1018 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you 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.qpid.jms.impl;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Enumeration;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import javax.jms.JMSException;
-import javax.jms.MessageFormatException;
-import javax.jms.MessageNotWriteableException;
-
-import org.apache.qpid.jms.QpidJmsTestCase;
-import org.apache.qpid.jms.engine.AmqpConnection;
-import org.apache.qpid.jms.engine.AmqpMapMessage;
-import org.apache.qpid.jms.test.testpeer.describedtypes.sections.AmqpValueDescribedType;
-import org.apache.qpid.proton.Proton;
-import org.apache.qpid.proton.amqp.Binary;
-import org.apache.qpid.proton.amqp.messaging.AmqpValue;
-import org.apache.qpid.proton.codec.impl.DataImpl;
-import org.apache.qpid.proton.engine.Delivery;
-import org.apache.qpid.proton.message.Message;
-import org.junit.Before;
-import org.junit.Test;
-import org.mockito.Mockito;
-
-public class MapMessageImplTest extends QpidJmsTestCase
-{
-    private Delivery _mockDelivery;
-    private ConnectionImpl _mockConnectionImpl;
-    private SessionImpl _mockSessionImpl;
-    private AmqpConnection _mockAmqpConnection;
-
-    @Before
-    @Override
-    public void setUp() throws Exception
-    {
-        super.setUp();
-        _mockAmqpConnection = Mockito.mock(AmqpConnection.class);
-        _mockConnectionImpl = Mockito.mock(ConnectionImpl.class);
-        _mockSessionImpl = Mockito.mock(SessionImpl.class);
-        Mockito.when(_mockSessionImpl.getDestinationHelper()).thenReturn(new DestinationHelper());
-    }
-
-    // ======= general =========
-
-    @Test
-    public void testGetMapNamesWithNewMessageToSendReturnsEmptyEnumeration() throws Exception
-    {
-        MapMessageImpl mapMessageImpl = new MapMessageImpl(_mockSessionImpl,_mockConnectionImpl);
-        Enumeration<?> names = mapMessageImpl.getMapNames();
-
-        assertFalse("Expected new message to have no map names", names.hasMoreElements());
-    }
-
-    /**
-     * Test that we are able to retrieve the names and values of map entries on a received message
-     */
-    @Test
-    public void testGetMapNamesUsingReceivedMessageReturnsExpectedEnumeration() throws Exception
-    {
-        Map<String,String> origMap = new HashMap<String,String>();
-        String myKey1 = "key1";
-        String myKey2 = "key2";
-        origMap.put(myKey1, "value1");
-        origMap.put(myKey2, "value2");
-
-        Message message = Proton.message();
-        message.setBody(new AmqpValue(origMap));
-        AmqpMapMessage amqpMapMessage = new AmqpMapMessage(message, _mockDelivery, _mockAmqpConnection);
-
-        MapMessageImpl mapMessageImpl = new MapMessageImpl(amqpMapMessage, _mockSessionImpl,_mockConnectionImpl, null);
-        Enumeration<?> names = mapMessageImpl.getMapNames();
-
-        int count = 0;
-        List<Object> elements = new ArrayList<Object>();
-        while(names.hasMoreElements())
-        {
-            count++;
-            elements.add(names.nextElement());
-        }
-        assertEquals("expected 2 map keys in enumeration", 2,count);
-        assertTrue("expected key was not found: " + myKey1, elements.contains(myKey1));
-        assertTrue("expected key was not found: " + myKey2, elements.contains(myKey2));
-    }
-
-    /**
-     * Test that we enforce the requirement that map message key names not be null or the empty string.
-     */
-    @Test
-    public void testSetObjectWithNullOrEmptyKeyNameThrowsIAE() throws Exception
-    {
-        MapMessageImpl mapMessageImpl = new MapMessageImpl(_mockSessionImpl,_mockConnectionImpl);
-        try
-        {
-            mapMessageImpl.setObject(null, "value");
-            fail("Expected exception not thrown");
-        }
-        catch(IllegalArgumentException iae)
-        {
-            //expected
-        }
-
-        try
-        {
-            mapMessageImpl.setObject("", "value");
-            fail("Expected exception not thrown");
-        }
-        catch(IllegalArgumentException iae)
-        {
-            //expected
-        }
-    }
-
-    /**
-     * Test that we are not able to write to a received message without calling {@link MapMessageImpl#clearBody()}
-     */
-    @Test
-    public void testReceivedMessageIsReadOnlyAndThrowsMNWE() throws Exception
-    {
-        Map<String,String> origMap = new HashMap<String,String>();
-        String myKey1 = "key1";
-        origMap.put(myKey1, "value1");
-
-        Message message = Proton.message();
-        message.setBody(new AmqpValue(origMap));
-        AmqpMapMessage amqpMapMessage = new AmqpMapMessage(message, _mockDelivery, _mockAmqpConnection);
-
-        MapMessageImpl mapMessageImpl = new MapMessageImpl(amqpMapMessage, _mockSessionImpl,_mockConnectionImpl, null);
-
-        try
-        {
-            mapMessageImpl.setObject("name", "value");
-            fail("expected exception to be thrown");
-        }
-        catch(MessageNotWriteableException mnwe)
-        {
-            //expected
-        }
-    }
-
-    /**
-     * Test that calling {@link MapMessageImpl#clearBody()} makes a received message writable
-     */
-    @Test
-    public void testClearBodyMakesReceivedMessageWritable() throws Exception
-    {
-        Map<String,String> origMap = new HashMap<String,String>();
-        String myKey1 = "key1";
-        origMap.put(myKey1, "value1");
-
-        Message message = Proton.message();
-        message.setBody(new AmqpValue(origMap));
-        AmqpMapMessage amqpMapMessage = new AmqpMapMessage(message, _mockDelivery, _mockAmqpConnection);
-
-        MapMessageImpl mapMessageImpl = new MapMessageImpl(amqpMapMessage, _mockSessionImpl,_mockConnectionImpl, null);
-
-        assertFalse("expected message to be read-only", mapMessageImpl.isBodyWritable());
-        mapMessageImpl.clearBody();
-        assertTrue("expected message to be writable", mapMessageImpl.isBodyWritable());
-        mapMessageImpl.setObject("name", "value");
-    }
-
-    /**
-     * Test that calling {@link MapMessageImpl#clearBody()} clears the underlying message body map.
-     */
-    @Test
-    public void testClearBodyClearsUnderlyingMessageMap() throws Exception
-    {
-        Map<String,String> origMap = new HashMap<String,String>();
-        String myKey1 = "key1";
-        origMap.put(myKey1, "value1");
-
-        Message message = Proton.message();
-        message.setBody(new AmqpValue(origMap));
-        AmqpMapMessage amqpMapMessage = new AmqpMapMessage(message, _mockDelivery, _mockAmqpConnection);
-
-        MapMessageImpl mapMessageImpl = new MapMessageImpl(amqpMapMessage, _mockSessionImpl,_mockConnectionImpl, null);
-
-        assertTrue("key should exist: " + myKey1, mapMessageImpl.itemExists(myKey1));
-        mapMessageImpl.clearBody();
-        assertTrue("expected map to be emptied", origMap.isEmpty());
-        assertFalse("key should not exist", mapMessageImpl.itemExists(myKey1));
-    }
-
-    /**
-     * When a map entry is not set, the behaviour of JMS specifies that it is equivalent to a null value,
-     * and the accessors should either return null, throw NPE, or behave in the same fashion as <primitive>.valueOf(String).
-     *
-     * Test that this is the case.
-     */
-    @Test
-    public void testGetMissingMapEntryResultsInExpectedBehaviour() throws Exception
-    {
-        MapMessageImpl mapMessageImpl = new MapMessageImpl(_mockSessionImpl,_mockConnectionImpl);
-
-        String name = "does_not_exist";
-
-        //expect null
-        assertNull(mapMessageImpl.getBytes(name));
-        assertNull(mapMessageImpl.getString(name));
-
-        //expect false from Boolean.valueOf(null).
-        assertFalse(mapMessageImpl.getBoolean(name));
-
-        //expect an NFE from the primitive integral <type>.valueOf(null) conversions
-        assertGetMapEntryThrowsNumberFormatException(mapMessageImpl, name, Byte.class);
-        assertGetMapEntryThrowsNumberFormatException(mapMessageImpl, name, Short.class);
-        assertGetMapEntryThrowsNumberFormatException(mapMessageImpl, name, Integer.class);
-        assertGetMapEntryThrowsNumberFormatException(mapMessageImpl, name, Long.class);
-
-        //expect an NPE from the primitive float, double, and char <type>.valuleOf(null) conversions
-        assertGetMapEntryThrowsNullPointerException(mapMessageImpl, name, Float.class);
-        assertGetMapEntryThrowsNullPointerException(mapMessageImpl, name, Double.class);
-        assertGetMapEntryThrowsNullPointerException(mapMessageImpl, name, Character.class);
-    }
-
-    // ======= object =========
-
-    /**
-     * Test that the {@link MapMessageImpl#setObject(String, Object)} method rejects Objects of unexpected types
-     */
-    @Test
-    public void testSetObjectWithIllegalTypeThrowsMFE() throws Exception
-    {
-        MapMessageImpl mapMessageImpl = new MapMessageImpl(_mockSessionImpl,_mockConnectionImpl);
-        try
-        {
-            mapMessageImpl.setObject("myPKey", new Exception());
-            fail("Expected exception not thrown");
-        }
-        catch(MessageFormatException mfe)
-        {
-            //expected
-        }
-    }
-
-    @Test
-    public void testSetGetObject() throws Exception
-    {
-        MapMessageImpl mapMessageImpl = new MapMessageImpl(_mockSessionImpl,_mockConnectionImpl);
-        String keyName = "myProperty";
-
-        Object entryValue = null;
-        mapMessageImpl.setObject(keyName, entryValue);
-        assertEquals(entryValue, mapMessageImpl.getObject(keyName));
-
-        entryValue = Boolean.valueOf(false);
-        mapMessageImpl.setObject(keyName, entryValue);
-        assertEquals(entryValue, mapMessageImpl.getObject(keyName));
-
-        entryValue = Byte.valueOf((byte)1);
-        mapMessageImpl.setObject(keyName, entryValue);
-        assertEquals(entryValue, mapMessageImpl.getObject(keyName));
-
-        entryValue = Short.valueOf((short)2);
-        mapMessageImpl.setObject(keyName, entryValue);
-        assertEquals(entryValue, mapMessageImpl.getObject(keyName));
-
-        entryValue = Integer.valueOf(3);
-        mapMessageImpl.setObject(keyName, entryValue);
-        assertEquals(entryValue, mapMessageImpl.getObject(keyName));
-
-        entryValue = Long.valueOf(4);
-        mapMessageImpl.setObject(keyName, entryValue);
-        assertEquals(entryValue, mapMessageImpl.getObject(keyName));
-
-        entryValue = Float.valueOf(5.01F);
-        mapMessageImpl.setObject(keyName, entryValue);
-        assertEquals(entryValue, mapMessageImpl.getObject(keyName));
-
-        entryValue = Double.valueOf(6.01);
-        mapMessageImpl.setObject(keyName, entryValue);
-        assertEquals(entryValue, mapMessageImpl.getObject(keyName));
-
-        entryValue = "string";
-        mapMessageImpl.setObject(keyName, entryValue);
-        assertEquals(entryValue, mapMessageImpl.getObject(keyName));
-
-        entryValue = Character.valueOf('c');
-        mapMessageImpl.setObject(keyName, entryValue);
-        assertEquals(entryValue, mapMessageImpl.getObject(keyName));
-
-        byte[] bytes = new byte[] { (byte)1, (byte) 0, (byte)1};
-        mapMessageImpl.setObject(keyName, bytes);
-        Object retrieved = mapMessageImpl.getObject(keyName);
-        assertTrue(retrieved instanceof byte[]);
-        assertTrue(Arrays.equals(bytes, (byte[])retrieved));
-    }
-
-    // ======= Strings =========
-
-    @Test
-    public void testSetGetString() throws Exception
-    {
-        MapMessageImpl mapMessageImpl = new MapMessageImpl(_mockSessionImpl,_mockConnectionImpl);
-
-        //null value
-        String name = "myNullString";
-        String value = null;
-
-        assertFalse(mapMessageImpl.itemExists(name));
-        mapMessageImpl.setString(name, value);
-        assertTrue(mapMessageImpl.itemExists(name));
-        assertEquals(value, mapMessageImpl.getString(name));
-
-        //non-null value
-        name = "myName";
-        value = "myValue";
-
-        assertFalse(mapMessageImpl.itemExists(name));
-        mapMessageImpl.setString(name, value);
-        assertTrue(mapMessageImpl.itemExists(name));
-        assertEquals(value, mapMessageImpl.getString(name));
-    }
-
-    /**
-     * Set a String, then retrieve it as all of the legal type combinations to verify it is parsed correctly
-     */
-    @Test
-    public void testSetStringGetLegal() throws Exception
-    {
-        MapMessageImpl mapMessageImpl = new MapMessageImpl(_mockSessionImpl,_mockConnectionImpl);
-
-        String name = "myStringName";
-        String value;
-
-        //boolean
-        value =  "true";
-        mapMessageImpl.setString(name, value);
-        assertGetMapEntryEquals(mapMessageImpl, name, Boolean.valueOf(value), Boolean.class);
-
-        //byte
-        value =  String.valueOf(Byte.MAX_VALUE);
-        mapMessageImpl.setString(name, value);
-        assertGetMapEntryEquals(mapMessageImpl, name, Byte.valueOf(value), Byte.class);
-
-        //short
-        value =  String.valueOf(Short.MAX_VALUE);
-        mapMessageImpl.setString(name, value);
-        assertGetMapEntryEquals(mapMessageImpl, name, Short.valueOf(value), Short.class);
-
-        //int
-        value =  String.valueOf(Integer.MAX_VALUE);
-        mapMessageImpl.setString(name, value);
-        assertGetMapEntryEquals(mapMessageImpl, name, Integer.valueOf(value), Integer.class);
-
-        //long
-        value =  String.valueOf(Long.MAX_VALUE);
-        mapMessageImpl.setString(name, value);
-        assertGetMapEntryEquals(mapMessageImpl, name, Long.valueOf(value), Long.class);
-
-        //float
-        value =  String.valueOf(Float.MAX_VALUE);
-        mapMessageImpl.setString(name, value);
-        assertGetMapEntryEquals(mapMessageImpl, name, Float.valueOf(value), Float.class);
-
-        //double
-        value =  String.valueOf(Double.MAX_VALUE);
-        mapMessageImpl.setString(name, value);
-        assertGetMapEntryEquals(mapMessageImpl, name, Double.valueOf(value), Double.class);
-    }
-
-    /**
-     * Set a String, then retrieve it as all of the illegal type combinations to verify it fails as expected
-     */
-    @Test
-    public void testSetStringGetIllegal() throws Exception
-    {
-        MapMessageImpl mapMessageImpl = new MapMessageImpl(_mockSessionImpl,_mockConnectionImpl);
-
-        String name = "myName";
-        String value = "myStringValue";
-
-        mapMessageImpl.setString(name, value);
-
-        assertGetMapEntryThrowsMessageFormatException(mapMessageImpl, name, byte[].class);
-        assertGetMapEntryThrowsMessageFormatException(mapMessageImpl, name, Character.class);
-    }
-
-    // ======= boolean =========
-
-    /**
-     * Set a boolean, then retrieve it as all of the legal type combinations to verify it is parsed correctly
-     */
-    @Test
-    public void testSetBooleanGetLegal() throws Exception
-    {
-        MapMessageImpl mapMessageImpl = new MapMessageImpl(_mockSessionImpl,_mockConnectionImpl);
-
-        String name = "myName";
-        boolean value = true;
-
-        mapMessageImpl.setBoolean(name, value);
-        assertEquals("value not as expected", value, mapMessageImpl.getBoolean(name));
-
-        assertGetMapEntryEquals(mapMessageImpl, name, String.valueOf(value), String.class);
-    }
-
-    /**
-     * Set a boolean, then retrieve it as all of the illegal type combinations to verify it fails as expected
-     */
-    @Test
-    public void testSetBooleanGetIllegal() throws Exception
-    {
-        MapMessageImpl mapMessageImpl = new MapMessageImpl(_mockSessionImpl,_mockConnectionImpl);
-
-        String name = "myName";
-        boolean value = true;
-
-        mapMessageImpl.setBoolean(name, value);
-
-        assertGetMapEntryThrowsMessageFormatException(mapMessageImpl, name, byte[].class);
-        assertGetMapEntryThrowsMessageFormatException(mapMessageImpl, name, Character.class);
-        assertGetMapEntryThrowsMessageFormatException(mapMessageImpl, name, Byte.class);
-        assertGetMapEntryThrowsMessageFormatException(mapMessageImpl, name, Short.class);
-        assertGetMapEntryThrowsMessageFormatException(mapMessageImpl, name, Integer.class);
-        assertGetMapEntryThrowsMessageFormatException(mapMessageImpl, name, Long.class);
-        assertGetMapEntryThrowsMessageFormatException(mapMessageImpl, name, Float.class);
-        assertGetMapEntryThrowsMessageFormatException(mapMessageImpl, name, Double.class);
-    }
-
-    // ======= byte =========
-
-    /**
-     * Set a byte, then retrieve it as all of the legal type combinations to verify it is parsed correctly
-     */
-    @Test
-    public void testSetByteGetLegalProperty() throws Exception
-    {
-        MapMessageImpl mapMessageImpl = new MapMessageImpl(_mockSessionImpl,_mockConnectionImpl);
-
-        String name = "myName";
-        byte value = (byte)1;
-
-        mapMessageImpl.setByte(name, value);
-        assertEquals(value, mapMessageImpl.getByte(name));
-
-        assertGetMapEntryEquals(mapMessageImpl, name, String.valueOf(value), String.class);
-        assertGetMapEntryEquals(mapMessageImpl, name, Short.valueOf(value), Short.class);
-        assertGetMapEntryEquals(mapMessageImpl, name, Integer.valueOf(value), Integer.class);
-        assertGetMapEntryEquals(mapMessageImpl, name, Long.valueOf(value), Long.class);
-    }
-
-    /**
-     * Set a byte, then retrieve it as all of the illegal type combinations to verify it is fails as expected
-     */
-    @Test
-    public void testSetByteGetIllegal() throws Exception
-    {
-        MapMessageImpl mapMessageImpl = new MapMessageImpl(_mockSessionImpl,_mockConnectionImpl);
-
-        String name = "myName";
-        byte value = (byte)1;
-
-        mapMessageImpl.setByte(name, value);
-
-        assertGetMapEntryThrowsMessageFormatException(mapMessageImpl, name, byte[].class);
-        assertGetMapEntryThrowsMessageFormatException(mapMessageImpl, name, Character.class);
-        assertGetMapEntryThrowsMessageFormatException(mapMessageImpl, name, Boolean.class);
-        assertGetMapEntryThrowsMessageFormatException(mapMessageImpl, name, Float.class);
-        assertGetMapEntryThrowsMessageFormatException(mapMessageImpl, name, Double.class);
-    }
-
-
-    // ======= short =========
-
-    /**
-     * Set a short, then retrieve it as all of the legal type combinations to verify it is parsed correctly
-     */
-    @Test
-    public void testSetShortGetLegal() throws Exception
-    {
-        MapMessageImpl mapMessageImpl = new MapMessageImpl(_mockSessionImpl,_mockConnectionImpl);
-
-        String name = "myName";
-        short value = (short)1;
-
-        mapMessageImpl.setShort(name, value);
-        assertEquals(value, mapMessageImpl.getShort(name));
-
-        assertGetMapEntryEquals(mapMessageImpl, name, String.valueOf(value), String.class);
-        assertGetMapEntryEquals(mapMessageImpl, name, Integer.valueOf(value), Integer.class);
-        assertGetMapEntryEquals(mapMessageImpl, name, Long.valueOf(value), Long.class);
-    }
-
-    /**
-     * Set a short, then retrieve it as all of the illegal type combinations to verify it fails as expected
-     */
-    @Test
-    public void testSetShortGetIllegal() throws Exception
-    {
-        MapMessageImpl mapMessageImpl = new MapMessageImpl(_mockSessionImpl,_mockConnectionImpl);
-
-        String name = "myName";
-        short value = (short)1;
-
-        mapMessageImpl.setShort(name, value);
-
-        assertGetMapEntryThrowsMessageFormatException(mapMessageImpl, name, byte[].class);
-        assertGetMapEntryThrowsMessageFormatException(mapMessageImpl, name, Character.class);
-        assertGetMapEntryThrowsMessageFormatException(mapMessageImpl, name, Boolean.class);
-        assertGetMapEntryThrowsMessageFormatException(mapMessageImpl, name, Byte.class);
-        assertGetMapEntryThrowsMessageFormatException(mapMessageImpl, name, Float.class);
-        assertGetMapEntryThrowsMessageFormatException(mapMessageImpl, name, Double.class);
-    }
-
-
-    // ======= int =========
-
-    /**
-     * Set an int, then retrieve it as all of the legal type combinations to verify it is parsed correctly
-     */
-    @Test
-    public void testSetIntGetLegal() throws Exception
-    {
-        MapMessageImpl mapMessageImpl = new MapMessageImpl(_mockSessionImpl,_mockConnectionImpl);
-
-        String name = "myName";
-        int value = (int)1;
-
-        mapMessageImpl.setInt(name, value);
-        assertEquals(value, mapMessageImpl.getInt(name));
-
-        assertGetMapEntryEquals(mapMessageImpl, name, String.valueOf(value), String.class);
-        assertGetMapEntryEquals(mapMessageImpl, name, Long.valueOf(value), Long.class);
-    }
-
-    /**
-     * Set an int, then retrieve it as all of the illegal type combinations to verify it fails as expected
-     */
-    @Test
-    public void testSetIntGetIllegal() throws Exception
-    {
-        MapMessageImpl mapMessageImpl = new MapMessageImpl(_mockSessionImpl,_mockConnectionImpl);
-
-        String name = "myName";
-        int value = (int)1;
-
-        mapMessageImpl.setInt(name, value);
-
-        assertGetMapEntryThrowsMessageFormatException(mapMessageImpl, name, byte[].class);
-        assertGetMapEntryThrowsMessageFormatException(mapMessageImpl, name, Character.class);
-        assertGetMapEntryThrowsMessageFormatException(mapMessageImpl, name, Boolean.class);
-        assertGetMapEntryThrowsMessageFormatException(mapMessageImpl, name, Byte.class);
-        assertGetMapEntryThrowsMessageFormatException(mapMessageImpl, name, Short.class);
-        assertGetMapEntryThrowsMessageFormatException(mapMessageImpl, name, Float.class);
-        assertGetMapEntryThrowsMessageFormatException(mapMessageImpl, name, Double.class);
-    }
-
-    // ======= long =========
-
-    /**
-     * Set a long, then retrieve it as all of the legal type combinations to verify it is parsed correctly
-     */
-    @Test
-    public void testSetLongGetLegal() throws Exception
-    {
-        MapMessageImpl mapMessageImpl = new MapMessageImpl(_mockSessionImpl,_mockConnectionImpl);
-
-        String name = "myName";
-        long value = Long.MAX_VALUE;
-
-        mapMessageImpl.setLong(name, value);
-        assertEquals(value, mapMessageImpl.getLong(name));
-
-        assertGetMapEntryEquals(mapMessageImpl, name, String.valueOf(value), String.class);
-    }
-
-    /**
-     * Set an long, then retrieve it as all of the illegal type combinations to verify it fails as expected
-     */
-    @Test
-    public void testSetLongGetIllegal() throws Exception
-    {
-        MapMessageImpl mapMessageImpl = new MapMessageImpl(_mockSessionImpl,_mockConnectionImpl);
-
-        String name = "myName";
-        long value = Long.MAX_VALUE;
-
-        mapMessageImpl.setLong(name, value);
-
-        assertGetMapEntryThrowsMessageFormatException(mapMessageImpl, name, byte[].class);
-        assertGetMapEntryThrowsMessageFormatException(mapMessageImpl, name, Character.class);
-        assertGetMapEntryThrowsMessageFormatException(mapMessageImpl, name, Boolean.class);
-        assertGetMapEntryThrowsMessageFormatException(mapMessageImpl, name, Byte.class);
-        assertGetMapEntryThrowsMessageFormatException(mapMessageImpl, name, Short.class);
-        assertGetMapEntryThrowsMessageFormatException(mapMessageImpl, name, Integer.class);
-        assertGetMapEntryThrowsMessageFormatException(mapMessageImpl, name, Float.class);
-        assertGetMapEntryThrowsMessageFormatException(mapMessageImpl, name, Double.class);
-    }
-
-    // ======= float =========
-
-    /**
-     * Set a float, then retrieve it as all of the legal type combinations to verify it is parsed correctly
-     */
-    @Test
-    public void testSetFloatGetLegal() throws Exception
-    {
-        MapMessageImpl mapMessageImpl = new MapMessageImpl(_mockSessionImpl,_mockConnectionImpl);
-
-        String name = "myName";
-        float value = Float.MAX_VALUE;
-
-        mapMessageImpl.setFloat(name, value);
-        assertEquals(value, mapMessageImpl.getFloat(name), 0.0);
-
-        assertGetMapEntryEquals(mapMessageImpl, name, String.valueOf(value), String.class);
-        assertGetMapEntryEquals(mapMessageImpl, name, Double.valueOf(value), Double.class);
-    }
-
-    /**
-     * Set a float, then retrieve it as all of the illegal type combinations to verify it fails as expected
-     */
-    @Test
-    public void testSetFloatGetIllegal() throws Exception
-    {
-        MapMessageImpl mapMessageImpl = new MapMessageImpl(_mockSessionImpl,_mockConnectionImpl);
-
-        String name = "myName";
-        float value = Float.MAX_VALUE;
-
-        mapMessageImpl.setFloat(name, value);
-
-        assertGetMapEntryThrowsMessageFormatException(mapMessageImpl, name, byte[].class);
-        assertGetMapEntryThrowsMessageFormatException(mapMessageImpl, name, Character.class);
-        assertGetMapEntryThrowsMessageFormatException(mapMessageImpl, name, Boolean.class);
-        assertGetMapEntryThrowsMessageFormatException(mapMessageImpl, name, Byte.class);
-        assertGetMapEntryThrowsMessageFormatException(mapMessageImpl, name, Short.class);
-        assertGetMapEntryThrowsMessageFormatException(mapMessageImpl, name, Integer.class);
-        assertGetMapEntryThrowsMessageFormatException(mapMessageImpl, name, Long.class);
-    }
-
-    // ======= double  =========
-
-    /**
-     * Set a double, then retrieve it as all of the legal type combinations to verify it is parsed correctly
-     */
-    @Test
-    public void testSetDoubleGetLegal() throws Exception
-    {
-        MapMessageImpl mapMessageImpl = new MapMessageImpl(_mockSessionImpl,_mockConnectionImpl);
-
-        String name = "myName";
-        double value = Double.MAX_VALUE;
-
-        mapMessageImpl.setDouble(name, value);
-        assertEquals(value, mapMessageImpl.getDouble(name), 0.0);
-
-        assertGetMapEntryEquals(mapMessageImpl, name, String.valueOf(value), String.class);
-    }
-
-    /**
-     * Set a double, then retrieve it as all of the illegal type combinations to verify it fails as expected
-     */
-    @Test
-    public void testSetDoubleGetIllegal() throws Exception
-    {
-        MapMessageImpl mapMessageImpl = new MapMessageImpl(_mockSessionImpl,_mockConnectionImpl);
-
-        String name = "myName";
-        double value = Double.MAX_VALUE;
-
-        mapMessageImpl.setDouble(name, value);
-
-        assertGetMapEntryThrowsMessageFormatException(mapMessageImpl, name, byte[].class);
-        assertGetMapEntryThrowsMessageFormatException(mapMessageImpl, name, Character.class);
-        assertGetMapEntryThrowsMessageFormatException(mapMessageImpl, name, Boolean.class);
-        assertGetMapEntryThrowsMessageFormatException(mapMessageImpl, name, Byte.class);
-        assertGetMapEntryThrowsMessageFormatException(mapMessageImpl, name, Short.class);
-        assertGetMapEntryThrowsMessageFormatException(mapMessageImpl, name, Integer.class);
-        assertGetMapEntryThrowsMessageFormatException(mapMessageImpl, name, Long.class);
-        assertGetMapEntryThrowsMessageFormatException(mapMessageImpl, name, Float.class);
-    }
-
-    // ======= character =========
-
-    /**
-     * Set a char, then retrieve it as all of the legal type combinations to verify it is parsed correctly
-     */
-    @Test
-    public void testSetCharGetLegal() throws Exception
-    {
-        MapMessageImpl mapMessageImpl = new MapMessageImpl(_mockSessionImpl,_mockConnectionImpl);
-
-        String name = "myName";
-        char value = 'c';
-
-        mapMessageImpl.setChar(name, value);
-        assertEquals(value, mapMessageImpl.getChar(name));
-
-        assertGetMapEntryEquals(mapMessageImpl, name, String.valueOf(value), String.class);
-    }
-
-    /**
-     * Set a char, then retrieve it as all of the illegal type combinations to verify it fails as expected
-     */
-    @Test
-    public void testSetCharGetIllegal() throws Exception
-    {
-        MapMessageImpl mapMessageImpl = new MapMessageImpl(_mockSessionImpl,_mockConnectionImpl);
-
-        String name = "myName";
-        char value = 'c';
-
-        mapMessageImpl.setChar(name, value);
-
-        assertGetMapEntryThrowsMessageFormatException(mapMessageImpl, name, byte[].class);
-        assertGetMapEntryThrowsMessageFormatException(mapMessageImpl, name, Boolean.class);
-        assertGetMapEntryThrowsMessageFormatException(mapMessageImpl, name, Byte.class);
-        assertGetMapEntryThrowsMessageFormatException(mapMessageImpl, name, Short.class);
-        assertGetMapEntryThrowsMessageFormatException(mapMessageImpl, name, Integer.class);
-        assertGetMapEntryThrowsMessageFormatException(mapMessageImpl, name, Long.class);
-        assertGetMapEntryThrowsMessageFormatException(mapMessageImpl, name, Float.class);
-        assertGetMapEntryThrowsMessageFormatException(mapMessageImpl, name, Double.class);
-    }
-
-    //========= bytes ========
-
-    /**
-     * Set bytes, then retrieve it as all of the legal type combinations to verify it is parsed correctly
-     */
-    @Test
-    public void testSetBytesGetLegal() throws Exception
-    {
-        MapMessageImpl mapMessageImpl = new MapMessageImpl(_mockSessionImpl,_mockConnectionImpl);
-
-        String name = "myName";
-        byte[] value = "myBytes".getBytes();
-
-        mapMessageImpl.setBytes(name, value);
-        assertTrue(Arrays.equals(value, mapMessageImpl.getBytes(name)));
-    }
-
-    /**
-     * Set bytes, then retrieve it as all of the illegal type combinations to verify it fails as expected
-     */
-    @Test
-    public void testSetBytesGetIllegal() throws Exception
-    {
-        MapMessageImpl mapMessageImpl = new MapMessageImpl(_mockSessionImpl,_mockConnectionImpl);
-
-        String name = "myName";
-        byte[] value = "myBytes".getBytes();
-
-        mapMessageImpl.setBytes(name, value);
-
-        assertGetMapEntryThrowsMessageFormatException(mapMessageImpl, name, Character.class);
-        assertGetMapEntryThrowsMessageFormatException(mapMessageImpl, name, String.class);
-        assertGetMapEntryThrowsMessageFormatException(mapMessageImpl, name, Boolean.class);
-        assertGetMapEntryThrowsMessageFormatException(mapMessageImpl, name, Byte.class);
-        assertGetMapEntryThrowsMessageFormatException(mapMessageImpl, name, Short.class);
-        assertGetMapEntryThrowsMessageFormatException(mapMessageImpl, name, Integer.class);
-        assertGetMapEntryThrowsMessageFormatException(mapMessageImpl, name, Long.class);
-        assertGetMapEntryThrowsMessageFormatException(mapMessageImpl, name, Float.class);
-        assertGetMapEntryThrowsMessageFormatException(mapMessageImpl, name, Double.class);
-    }
-
-    /**
-     * Verify that for a message received with an AmqpValue containing a Map with a
-     * Binary entry value, we are able to read it back as a byte[].
-     */
-    @Test
-    public void testReceivedMapWithBinaryEntryReturnsByteArray() throws Exception
-    {
-        String myKey1 = "key1";
-        String bytesSource = "myBytesAmqpValue";
-
-        Map<String,Object> origMap = new HashMap<String,Object>();
-        byte[] bytes = bytesSource.getBytes();
-        origMap.put(myKey1, new Binary(bytes));
-
-        org.apache.qpid.proton.codec.Data payloadData = new DataImpl();
-        payloadData.putDescribedType(new AmqpValueDescribedType(origMap));
-        Binary b = payloadData.encode();
-
-        System.out.println("Using encoded AMQP message payload: " + b);
-
-        Message message = Proton.message();
-        int decoded = message.decode(b.getArray(), b.getArrayOffset(), b.getLength());
-        assertEquals(decoded, b.getLength());
-
-        AmqpMapMessage amqpMapMessage = new AmqpMapMessage(message, _mockDelivery, _mockAmqpConnection);
-
-        MapMessageImpl mapMessageImpl = new MapMessageImpl(amqpMapMessage, _mockSessionImpl,_mockConnectionImpl, null);
-
-        //retrieve the bytes using getBytes, check they match expectation
-        byte[] receivedBytes = mapMessageImpl.getBytes(myKey1);
-        assertTrue(Arrays.equals(bytes, receivedBytes));
-
-        //retrieve the bytes using getObject, check they match expectation
-        Object o = mapMessageImpl.getObject(myKey1);
-        assertTrue(o instanceof byte[]);
-        assertTrue(Arrays.equals(bytes, (byte[]) o));
-    }
-
-    /**
-     * Verify that setting bytes takes a copy of the array.
-     * Set bytes, then modify them, then retrieve the map entry and verify the two differ.
-     */
-    @Test
-    public void testSetBytesTakesSnapshot() throws Exception
-    {
-        MapMessageImpl mapMessageImpl = new MapMessageImpl(_mockSessionImpl,_mockConnectionImpl);
-
-        String name = "myName";
-        byte[] orig = "myBytes".getBytes();
-        byte[] copy = Arrays.copyOf(orig, orig.length);
-
-        //set the original bytes
-        mapMessageImpl.setBytes(name, orig);
-
-        //corrupt the original bytes
-        orig[0] = (byte)0;
-
-        //verify retrieving the bytes still matches the copy but not the original array
-        byte[] retrieved = mapMessageImpl.getBytes(name);
-        assertFalse(Arrays.equals(orig, retrieved));
-        assertTrue(Arrays.equals(copy, retrieved));
-    }
-
-    /**
-     * Verify that getting bytes returns a copy of the array.
-     * Set bytes, then get them, modify the retrieved value, then get them again and verify the two differ.
-     */
-    @Test
-    public void testGetBytesReturnsSnapshot() throws Exception
-    {
-        MapMessageImpl mapMessageImpl = new MapMessageImpl(_mockSessionImpl,_mockConnectionImpl);
-
-        String name = "myName";
-        byte[] orig = "myBytes".getBytes();
-
-        //set the original bytes
-        mapMessageImpl.setBytes(name, orig);
-
-        //retrieve them
-        byte[] retrieved1 = mapMessageImpl.getBytes(name);;
-
-        //corrupt the retrieved bytes
-        retrieved1[0] = (byte)0;
-
-        //verify retrieving the bytes again still matches the original array, but not the previously retrieved (and now corrupted) bytes.
-        byte[] retrieved2 = mapMessageImpl.getBytes(name);
-        assertTrue(Arrays.equals(orig, retrieved2));
-        assertFalse(Arrays.equals(retrieved1, retrieved2));
-    }
-
-    /**
-     * Verify that setting bytes takes a copy of the array.
-     * Set bytes, then modify them, then retrieve the map entry and verify the two differ.
-     */
-    @Test
-    public void testSetBytesWithOffsetAndLength() throws Exception
-    {
-        MapMessageImpl mapMessageImpl = new MapMessageImpl(_mockSessionImpl,_mockConnectionImpl);
-
-        String name = "myName";
-        byte[] orig = "myBytesAll".getBytes();
-
-        //extract the segment containing 'Bytes'
-        int offset = 2;
-        int length = 5;
-        byte[] segment = Arrays.copyOfRange(orig, offset, offset + length);
-
-        //set the same section from the original bytes
-        mapMessageImpl.setBytes(name, orig, offset, length);
-
-        //verify the retrieved bytes from the map match the segment but not the full original array
-        byte[] retrieved = mapMessageImpl.getBytes(name);
-        assertFalse(Arrays.equals(orig, retrieved));
-        assertTrue(Arrays.equals(segment, retrieved));
-    }
-
-    @Test
-    public void testSetBytesWithNull() throws Exception
-    {
-        MapMessageImpl mapMessageImpl = new MapMessageImpl(_mockSessionImpl,_mockConnectionImpl);
-
-        String name = "myName";
-        mapMessageImpl.setBytes(name, null);
-        assertNull(mapMessageImpl.getBytes(name));
-    }
-
-    //========= utility methods ========
-
-    private void assertGetMapEntryEquals(MapMessageImpl testMessage, String name,
-                                         Object expectedValue,
-                                         Class<?> clazz) throws JMSException
-    {
-        Object actualValue = getMapEntryUsingTypeMethod(testMessage, name, clazz);
-        assertEquals(expectedValue, actualValue);
-    }
-
-    private void assertGetMapEntryThrowsMessageFormatException(MapMessageImpl testMessage,
-                                                               String name,
-                                                               Class<?> clazz) throws JMSException
-    {
-        try
-        {
-            getMapEntryUsingTypeMethod(testMessage, name, clazz);
-
-            fail("expected exception to be thrown");
-        }
-        catch(MessageFormatException jmsMFE)
-        {
-            //expected
-        }
-    }
-
-    private void assertGetMapEntryThrowsNumberFormatException(MapMessageImpl testMessage,
-                                                              String name,
-                                                              Class<?> clazz) throws JMSException
-    {
-        try
-        {
-            getMapEntryUsingTypeMethod(testMessage, name, clazz);
-
-            fail("expected exception to be thrown");
-        }
-        catch(NumberFormatException nfe)
-        {
-            //expected
-        }
-    }
-
-    private void assertGetMapEntryThrowsNullPointerException(MapMessageImpl testMessage,
-                                                            String name,
-                                                            Class<?> clazz) throws JMSException
-    {
-        try
-        {
-            getMapEntryUsingTypeMethod(testMessage, name, clazz);
-
-            fail("expected exception to be thrown");
-        }
-        catch(NullPointerException npe)
-        {
-            //expected
-        }
-    }
-
-    private Object getMapEntryUsingTypeMethod(MapMessageImpl testMessage, String name, Class<?> clazz) throws JMSException
-    {
-        if(clazz == Boolean.class)
-        {
-            return testMessage.getBoolean(name);
-        }
-        else if(clazz == Byte.class)
-        {
-            return testMessage.getByte(name);
-        }
-        else if(clazz == Character.class)
-        {
-            return testMessage.getChar(name);
-        }
-        else if(clazz == Short.class)
-        {
-            return testMessage.getShort(name);
-        }
-        else if(clazz == Integer.class)
-        {
-            return testMessage.getInt(name);
-        }
-        else if(clazz == Long.class)
-        {
-            return testMessage.getLong(name);
-        }
-        else if(clazz == Float.class)
-        {
-            return testMessage.getFloat(name);
-        }
-        else if(clazz == Double.class)
-        {
-            return testMessage.getDouble(name);
-        }
-        else if(clazz == String.class)
-        {
-            return testMessage.getString(name);
-        }
-        else if(clazz == byte[].class)
-        {
-            return testMessage.getBytes(name);
-        }
-        else
-        {
-            throw new RuntimeException("Unexpected entry type class");
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/qpid-jms/blob/6f106f64/qpid-jms-client-tmp/src/test/java/org/apache/qpid/jms/impl/MessageFactoryImplTest.java
----------------------------------------------------------------------
diff --git a/qpid-jms-client-tmp/src/test/java/org/apache/qpid/jms/impl/MessageFactoryImplTest.java b/qpid-jms-client-tmp/src/test/java/org/apache/qpid/jms/impl/MessageFactoryImplTest.java
deleted file mode 100644
index c2f6559..0000000
--- a/qpid-jms-client-tmp/src/test/java/org/apache/qpid/jms/impl/MessageFactoryImplTest.java
+++ /dev/null
@@ -1,121 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you 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.qpid.jms.impl;
-
-import static org.junit.Assert.*;
-
-import javax.jms.JMSException;
-import javax.jms.Message;
-
-import org.apache.qpid.jms.QpidJmsTestCase;
-import org.apache.qpid.jms.engine.AmqpBytesMessage;
-import org.apache.qpid.jms.engine.AmqpGenericMessage;
-import org.apache.qpid.jms.engine.AmqpListMessage;
-import org.apache.qpid.jms.engine.AmqpMapMessage;
-import org.apache.qpid.jms.engine.AmqpMessage;
-import org.apache.qpid.jms.engine.AmqpObjectMessage;
-import org.apache.qpid.jms.engine.AmqpTextMessage;
-import org.junit.Before;
-import org.junit.Test;
-import org.mockito.Mockito;
-
-public class MessageFactoryImplTest extends QpidJmsTestCase
-{
-
-    private ConnectionImpl _mockConnection;
-    private SessionImpl _mockSession;
-    private MessageFactoryImpl _messageFactoryImpl;
-
-    @Before
-    @Override
-    public void setUp() throws Exception
-    {
-        super.setUp();
-        _mockConnection = Mockito.mock(ConnectionImpl.class);
-        _mockSession = Mockito.mock(SessionImpl.class);
-        Mockito.when(_mockSession.getDestinationHelper()).thenReturn(new DestinationHelper());
-        _messageFactoryImpl = new MessageFactoryImpl();
-    }
-
-    @Test
-    public void testCreateJmsMessageWithAmqpGenericMessage() throws Exception
-    {
-        AmqpMessage amqpMessage = Mockito.mock(AmqpGenericMessage.class);
-        Message jmsMessage = _messageFactoryImpl.createJmsMessage(amqpMessage, _mockSession, _mockConnection, null);
-        assertEquals(GenericAmqpMessageImpl.class, jmsMessage.getClass());
-    }
-
-    @Test
-    public void testCreateJmsMessageWithAmqpTextMessage() throws Exception
-    {
-        AmqpMessage amqpMessage = Mockito.mock(AmqpTextMessage.class);
-        Message jmsMessage = _messageFactoryImpl.createJmsMessage(amqpMessage, _mockSession, _mockConnection, null);
-        assertEquals(TextMessageImpl.class, jmsMessage.getClass());
-    }
-
-    @Test
-    public void testCreateJmsMessageWithAmqpBytesMessage() throws Exception
-    {
-        AmqpMessage amqpMessage = Mockito.mock(AmqpBytesMessage.class);
-        Message jmsMessage = _messageFactoryImpl.createJmsMessage(amqpMessage, _mockSession, _mockConnection, null);
-        assertEquals(BytesMessageImpl.class, jmsMessage.getClass());
-    }
-
-    @Test
-    public void testCreateJmsMessageWithAmqpObjectMessage() throws Exception
-    {
-        AmqpMessage amqpMessage = Mockito.mock(AmqpObjectMessage.class);
-        Message jmsMessage = _messageFactoryImpl.createJmsMessage(amqpMessage, _mockSession, _mockConnection, null);
-        assertEquals(ObjectMessageImpl.class, jmsMessage.getClass());
-    }
-
-    @Test
-    public void testCreateJmsMessageWithAmqpListMessage() throws Exception
-    {
-        AmqpMessage amqpMessage = Mockito.mock(AmqpListMessage.class);
-        Message jmsMessage = _messageFactoryImpl.createJmsMessage(amqpMessage, _mockSession, _mockConnection, null);
-        assertEquals(StreamMessageImpl.class, jmsMessage.getClass());
-    }
-
-    @Test
-    public void testCreateJmsMessageWithAmqpMapMessage() throws Exception
-    {
-        AmqpMessage amqpMessage = Mockito.mock(AmqpMapMessage.class);
-        Message jmsMessage = _messageFactoryImpl.createJmsMessage(amqpMessage, _mockSession, _mockConnection, null);
-        assertEquals(MapMessageImpl.class, jmsMessage.getClass());
-    }
-
-    @Test
-    public void testCreateJmsMessageWithUnknownMessageTypeThrowsException() throws Exception
-    {
-        //AmqpMessage is the abstract supertype, factory doesn't expect it, so using a mock of it
-        AmqpMessage amqpMessage = Mockito.mock(AmqpMessage.class);
-        try
-        {
-            _messageFactoryImpl.createJmsMessage(amqpMessage, _mockSession, _mockConnection, null);
-            fail("expected exception was not thrown");
-        }
-        catch(JMSException jmse)
-        {
-            //expected
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/qpid-jms/blob/6f106f64/qpid-jms-client-tmp/src/test/java/org/apache/qpid/jms/impl/MessageIdHelperTest.java
----------------------------------------------------------------------
diff --git a/qpid-jms-client-tmp/src/test/java/org/apache/qpid/jms/impl/MessageIdHelperTest.java b/qpid-jms-client-tmp/src/test/java/org/apache/qpid/jms/impl/MessageIdHelperTest.java
deleted file mode 100644
index d11be9c..0000000
--- a/qpid-jms-client-tmp/src/test/java/org/apache/qpid/jms/impl/MessageIdHelperTest.java
+++ /dev/null
@@ -1,548 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you 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.qpid.jms.impl;
-
-import static org.junit.Assert.*;
-
-import java.math.BigInteger;
-import java.nio.ByteBuffer;
-import java.util.UUID;
-
-import org.apache.qpid.jms.QpidJmsTestCase;
-import org.junit.Before;
-import org.junit.Test;
-
-public class MessageIdHelperTest extends QpidJmsTestCase
-{
-    private MessageIdHelper _messageIdHelper;
-
-    @Before
-    public void setUp() throws Exception
-    {
-        super.setUp();
-
-        _messageIdHelper = new MessageIdHelper();
-    }
-
-    /**
-     * Test that {@link MessageIdHelper#hasMessageIdPrefix(String)} returns true for strings that begin "ID:"
-     */
-    @Test
-    public void testHasIdPrefixWithPrefix()
-    {
-        String myId = "ID:something";
-        assertTrue("'ID:' prefix should have been identified", _messageIdHelper.hasMessageIdPrefix(myId));
-    }
-
-    /**
-     * Test that {@link MessageIdHelper#hasMessageIdPrefix(String)} returns false for string beings "ID" without colon.
-     */
-    @Test
-    public void testHasIdPrefixWithIDButNoColonPrefix()
-    {
-        String myIdNoColon = "IDsomething";
-        assertFalse("'ID' prefix should not have been identified without trailing colon", _messageIdHelper.hasMessageIdPrefix(myIdNoColon));
-    }
-
-    /**
-     * Test that {@link MessageIdHelper#hasMessageIdPrefix(String)} returns false for null
-     */
-    @Test
-    public void testHasIdPrefixWithNull()
-    {
-        String nullString = null;
-        assertFalse("null string should not result in identification as having the prefix", _messageIdHelper.hasMessageIdPrefix(nullString));
-    }
-
-    /**
-     * Test that {@link MessageIdHelper#hasMessageIdPrefix(String)} returns false for strings that doesnt have "ID:" anywhere
-     */
-    @Test
-    public void testHasIdPrefixWithoutPrefix()
-    {
-        String myNonId = "something";
-        assertFalse("string without 'ID:' anywhere should not have been identified as having the prefix", _messageIdHelper.hasMessageIdPrefix(myNonId));
-    }
-
-    /**
-     * Test that {@link MessageIdHelper#hasMessageIdPrefix(String)} returns false for strings has lowercase "id:" prefix
-     */
-    @Test
-    public void testHasIdPrefixWithLowercaseID()
-    {
-        String myLowerCaseNonId = "id:something";
-        assertFalse("lowercase 'id:' prefix should not result in identification as having 'ID:' prefix", _messageIdHelper.hasMessageIdPrefix(myLowerCaseNonId));
-    }
-
-    /**
-     * Test that {@link MessageIdHelper#stripMessageIdPrefix(String)} strips "ID:" from strings that do begin "ID:"
-     */
-    @Test
-    public void testStripMessageIdPrefixWithPrefix()
-    {
-        String myIdWithoutPrefix = "something";
-        String myId = "ID:" + myIdWithoutPrefix;
-        assertEquals("'ID:' prefix should have been stripped", myIdWithoutPrefix, _messageIdHelper.stripMessageIdPrefix(myId));
-    }
-
-    /**
-     * Test that {@link MessageIdHelper#stripMessageIdPrefix(String)} only strips one "ID:" from strings that
-     * begin "ID:ID:...."
-     */
-    @Test
-    public void testStripMessageIdPrefixWithDoublePrefix()
-    {
-        String myIdWithSinglePrefix = "ID:something";
-        String myIdWithDoublePrefix = "ID:" + myIdWithSinglePrefix;
-        assertEquals("'ID:' prefix should only have been stripped once", myIdWithSinglePrefix, _messageIdHelper.stripMessageIdPrefix(myIdWithDoublePrefix));
-    }
-
-    /**
-     * Test that {@link MessageIdHelper#stripMessageIdPrefix(String)} does not alter strings that begins "ID" without a colon.
-     */
-    @Test
-    public void testStripMessageIdPrefixWithIDButNoColonPrefix()
-    {
-        String myIdNoColon = "IDsomething";
-        assertEquals("string without 'ID:' prefix should have been returned unchanged", myIdNoColon, _messageIdHelper.stripMessageIdPrefix(myIdNoColon));
-    }
-
-    /**
-     * Test that {@link MessageIdHelper#stripMessageIdPrefix(String)} returns null if given null;
-     */
-    @Test
-    public void testStripMessageIdPrefixWithNull()
-    {
-        String nullString = null;
-        assertNull("null string should have been returned", _messageIdHelper.stripMessageIdPrefix(nullString));
-    }
-
-    /**
-     * Test that {@link MessageIdHelper#stripMessageIdPrefix(String)} does not alter string that doesn't begin "ID:"
-     */
-    @Test
-    public void testStripMessageIdPrefixWithoutIDAnywhere()
-    {
-        String myNonId = "something";
-        assertEquals("string without 'ID:' anywhere should have been returned unchanged", myNonId, _messageIdHelper.stripMessageIdPrefix(myNonId));
-    }
-
-    /**
-     * Test that {@link MessageIdHelper#stripMessageIdPrefix(String)} does not alter string with lowercase "id:"
-     */
-    @Test
-    public void testStripMessageIdPrefixWithLowercaseID()
-    {
-        String myLowerCaseNonId = "id:something";
-        assertEquals("string with lowercase 'id:' prefix should have been returned unchanged", myLowerCaseNonId, _messageIdHelper.stripMessageIdPrefix(myLowerCaseNonId));
-    }
-
-    /**
-     * Test that {@link MessageIdHelper#toBaseMessageIdString(String)} returns null if given null
-     */
-    @Test
-    public void testToBaseMessageIdStringWithNull()
-    {
-        String nullString = null;
-        assertNull("null string should have been returned", _messageIdHelper.toBaseMessageIdString(nullString));
-    }
-
-    /**
-     * Test that {@link MessageIdHelper#toBaseMessageIdString(String)} throws an IAE if given an unexpected object type.
-     */
-    @Test
-    public void testToBaseMessageIdStringThrowsIAEWithUnexpectedType()
-    {
-        try
-        {
-            _messageIdHelper.toBaseMessageIdString(new Object());
-            fail("expected exception not thrown");
-        }
-        catch(IllegalArgumentException iae)
-        {
-            //expected
-        }
-    }
-
-    /**
-     * Test that {@link MessageIdHelper#toBaseMessageIdString(String)} returns the given
-     * basic string unchanged
-     */
-    @Test
-    public void testToBaseMessageIdStringWithString()
-    {
-        String stringMessageId = "myIdString";
-
-        String baseMessageIdString = _messageIdHelper.toBaseMessageIdString(stringMessageId);
-        assertNotNull("null string should not have been returned", baseMessageIdString);
-        assertEquals("expected base id string was not returned", stringMessageId, baseMessageIdString);
-    }
-
-    /**
-     * Test that {@link MessageIdHelper#toBaseMessageIdString(String)} returns a string
-     * indicating an AMQP encoded string, when the given string happens to already begin with
-     * the {@link MessageIdHelper#AMQP_UUID_PREFIX}.
-     */
-    @Test
-    public void testToBaseMessageIdStringWithStringBeginningWithEncodingPrefixForUUID()
-    {
-        String uuidStringMessageId = MessageIdHelper.AMQP_UUID_PREFIX + UUID.randomUUID();
-        String expected = MessageIdHelper.AMQP_STRING_PREFIX + uuidStringMessageId;
-
-        String baseMessageIdString = _messageIdHelper.toBaseMessageIdString(uuidStringMessageId);
-        assertNotNull("null string should not have been returned", baseMessageIdString);
-        assertEquals("expected base id string was not returned", expected, baseMessageIdString);
-    }
-
-    /**
-     * Test that {@link MessageIdHelper#toBaseMessageIdString(String)} returns a string
-     * indicating an AMQP encoded string, when the given string happens to already begin with
-     * the {@link MessageIdHelper#AMQP_ULONG_PREFIX}.
-     */
-    @Test
-    public void testToBaseMessageIdStringWithStringBeginningWithEncodingPrefixForLong()
-    {
-        String longStringMessageId = MessageIdHelper.AMQP_ULONG_PREFIX + Long.valueOf(123456789L);
-        String expected = MessageIdHelper.AMQP_STRING_PREFIX + longStringMessageId;
-
-        String baseMessageIdString = _messageIdHelper.toBaseMessageIdString(longStringMessageId);
-        assertNotNull("null string should not have been returned", baseMessageIdString);
-        assertEquals("expected base id string was not returned", expected, baseMessageIdString);
-    }
-
-    /**
-     * Test that {@link MessageIdHelper#toBaseMessageIdString(String)} returns a string
-     * indicating an AMQP encoded string, when the given string happens to already begin with
-     * the {@link MessageIdHelper#AMQP_BINARY_PREFIX}.
-     */
-    @Test
-    public void testToBaseMessageIdStringWithStringBeginningWithEncodingPrefixForBinary()
-    {
-        String binaryStringMessageId = MessageIdHelper.AMQP_BINARY_PREFIX + "0123456789ABCDEF";
-        String expected = MessageIdHelper.AMQP_STRING_PREFIX + binaryStringMessageId;
-
-        String baseMessageIdString = _messageIdHelper.toBaseMessageIdString(binaryStringMessageId);
-        assertNotNull("null string should not have been returned", baseMessageIdString);
-        assertEquals("expected base id string was not returned", expected, baseMessageIdString);
-    }
-
-    /**
-     * Test that {@link MessageIdHelper#toBaseMessageIdString(String)} returns a string
-     * indicating an AMQP encoded string (effectively twice), when the given string happens to already begin with
-     * the {@link MessageIdHelper#AMQP_STRING_PREFIX}.
-     */
-    @Test
-    public void testToBaseMessageIdStringWithStringBeginningWithEncodingPrefixForString()
-    {
-        String stringMessageId = MessageIdHelper.AMQP_STRING_PREFIX + "myStringId";
-        String expected = MessageIdHelper.AMQP_STRING_PREFIX + stringMessageId;
-
-        String baseMessageIdString = _messageIdHelper.toBaseMessageIdString(stringMessageId);
-        assertNotNull("null string should not have been returned", baseMessageIdString);
-        assertEquals("expected base id string was not returned", expected, baseMessageIdString);
-    }
-
-    /**
-     * Test that {@link MessageIdHelper#toBaseMessageIdString(String)} returns a string
-     * indicating an AMQP encoded UUID when given a UUID object.
-     */
-    @Test
-    public void testToBaseMessageIdStringWithUUID()
-    {
-        UUID uuidMessageId = UUID.randomUUID();
-        String expected = MessageIdHelper.AMQP_UUID_PREFIX + uuidMessageId.toString();
-
-        String baseMessageIdString = _messageIdHelper.toBaseMessageIdString(uuidMessageId);
-        assertNotNull("null string should not have been returned", baseMessageIdString);
-        assertEquals("expected base id string was not returned", expected, baseMessageIdString);
-    }
-
-    /**
-     * Test that {@link MessageIdHelper#toBaseMessageIdString(String)} returns a string
-     * indicating an AMQP encoded ulong when given a Long object.
-     */
-    @Test
-    public void testToBaseMessageIdStringWithLong()
-    {
-        Long longMessageId = Long.valueOf(123456789L);
-        String expected = MessageIdHelper.AMQP_ULONG_PREFIX + longMessageId.toString();
-
-        String baseMessageIdString = _messageIdHelper.toBaseMessageIdString(longMessageId);
-        assertNotNull("null string should not have been returned", baseMessageIdString);
-        assertEquals("expected base id string was not returned", expected, baseMessageIdString);
-    }
-
-
-    /**
-     * Test that {@link MessageIdHelper#toBaseMessageIdString(String)} returns a string
-     * indicating an AMQP encoded ulong when given a BigInteger object.
-     */
-    @Test
-    public void testToBaseMessageIdStringWithBigInteger()
-    {
-        BigInteger bigIntMessageId = BigInteger.valueOf(123456789L);
-        String expected = MessageIdHelper.AMQP_ULONG_PREFIX + bigIntMessageId.toString();
-
-        String baseMessageIdString = _messageIdHelper.toBaseMessageIdString(bigIntMessageId);
-        assertNotNull("null string should not have been returned", baseMessageIdString);
-        assertEquals("expected base id string was not returned", expected, baseMessageIdString);
-    }
-
-
-    /**
-     * Test that {@link MessageIdHelper#toBaseMessageIdString(String)} returns a string
-     * indicating an AMQP encoded binary when given a ByteBuffer object.
-     */
-    @Test
-    public void testToBaseMessageIdStringWithByteBufferBinary()
-    {
-        byte[] bytes = new byte[] { (byte)0x00, (byte)0xAB, (byte) 0x09, (byte) 0xFF};
-        ByteBuffer buf = ByteBuffer.wrap(bytes);
-
-        String expected = MessageIdHelper.AMQP_BINARY_PREFIX + "00AB09FF";
-
-        String baseMessageIdString = _messageIdHelper.toBaseMessageIdString(buf);
-        assertNotNull("null string should not have been returned", baseMessageIdString);
-        assertEquals("expected base id string was not returned", expected, baseMessageIdString);
-    }
-
-    /**
-     * Test that {@link MessageIdHelper#toIdObject(String)} returns a ulong
-     * (represented as a BigInteger) when given a string indicating an
-     * encoded AMQP ulong id.
-     */
-    @Test
-    public void testToIdObjectWithEncodedUlong() throws Exception
-    {
-        BigInteger longId = BigInteger.valueOf(123456789L);
-        String provided = MessageIdHelper.AMQP_ULONG_PREFIX + "123456789";
-
-        Object idObject = _messageIdHelper.toIdObject(provided);
-        assertNotNull("null object should not have been returned", idObject);
-        assertEquals("expected id object was not returned", longId, idObject);
-    }
-
-    /**
-     * Test that {@link MessageIdHelper#toIdObject(String)} returns binary
-     * (represented as a ByteBuffer) when given a string indicating an
-     * encoded AMQP binary id, using upper case hex characters
-     */
-    @Test
-    public void testToIdObjectWithEncodedBinaryUppercaseHexString() throws Exception
-    {
-        byte[] bytes = new byte[] { (byte)0x00, (byte)0xAB, (byte) 0x09, (byte) 0xFF};
-        ByteBuffer binaryId = ByteBuffer.wrap(bytes);
-
-        String provided = MessageIdHelper.AMQP_BINARY_PREFIX + "00AB09FF";
-
-        Object idObject = _messageIdHelper.toIdObject(provided);
-        assertNotNull("null object should not have been returned", idObject);
-        assertEquals("expected id object was not returned", binaryId, idObject);
-    }
-
-    /**
-     * Test that {@link MessageIdHelper#toIdObject(String)} returns null
-     * when given null.
-     */
-    @Test
-    public void testToIdObjectWithNull() throws Exception
-    {
-        assertNull("null object should have been returned", _messageIdHelper.toIdObject(null));
-    }
-
-    /**
-     * Test that {@link MessageIdHelper#toIdObject(String)} returns binary
-     * (represented as a ByteBuffer) when given a string indicating an
-     * encoded AMQP binary id, using lower case hex characters.
-     */
-    @Test
-    public void testToIdObjectWithEncodedBinaryLowercaseHexString() throws Exception
-    {
-        byte[] bytes = new byte[] { (byte)0x00, (byte)0xAB, (byte) 0x09, (byte) 0xFF};
-        ByteBuffer binaryId = ByteBuffer.wrap(bytes);
-
-        String provided = MessageIdHelper.AMQP_BINARY_PREFIX + "00ab09ff";
-
-        Object idObject = _messageIdHelper.toIdObject(provided);
-        assertNotNull("null object should not have been returned", idObject);
-        assertEquals("expected id object was not returned", binaryId, idObject);
-    }
-
-    /**
-     * Test that {@link MessageIdHelper#toIdObject(String)} returns a UUID
-     * when given a string indicating an encoded AMQP uuid id.
-     */
-    @Test
-    public void testToIdObjectWithEncodedUuid() throws Exception
-    {
-        UUID uuid = UUID.randomUUID();
-        String provided = MessageIdHelper.AMQP_UUID_PREFIX + uuid.toString();
-
-        Object idObject = _messageIdHelper.toIdObject(provided);
-        assertNotNull("null object should not have been returned", idObject);
-        assertEquals("expected id object was not returned", uuid, idObject);
-    }
-
-    /**
-     * Test that {@link MessageIdHelper#toIdObject(String)} returns a string
-     * when given a string without any type encoding prefix.
-     */
-    @Test
-    public void testToIdObjectWithStringContainingNoEncodingPrefix() throws Exception
-    {
-        String stringId = "myStringId";
-
-        Object idObject = _messageIdHelper.toIdObject(stringId);
-        assertNotNull("null object should not have been returned", idObject);
-        assertEquals("expected id object was not returned", stringId, idObject);
-    }
-
-    /**
-     * Test that {@link MessageIdHelper#toIdObject(String)} returns the remainder of the
-     * provided string after removing the {@link MessageIdHelper#AMQP_STRING_PREFIX} prefix.
-     */
-    @Test
-    public void testToIdObjectWithStringContainingStringEncodingPrefix() throws Exception
-    {
-        String suffix = "myStringSuffix";
-        String stringId = MessageIdHelper.AMQP_STRING_PREFIX + suffix;
-
-        Object idObject = _messageIdHelper.toIdObject(stringId);
-        assertNotNull("null object should not have been returned", idObject);
-        assertEquals("expected id object was not returned", suffix, idObject);
-    }
-
-    /**
-     * Test that when given a string with with the {@link MessageIdHelper#AMQP_STRING_PREFIX} prefix
-     * and then additionally the {@link MessageIdHelper#AMQP_UUID_PREFIX}, the
-     * {@link MessageIdHelper#toIdObject(String)} method returns the remainder of the provided string
-     *  after removing the {@link MessageIdHelper#AMQP_STRING_PREFIX} prefix.
-     */
-    @Test
-    public void testToIdObjectWithStringContainingStringEncodingPrefixAndThenUuidPrefix() throws Exception
-    {
-        String encodedUuidString = MessageIdHelper.AMQP_UUID_PREFIX + UUID.randomUUID().toString();
-        String stringId = MessageIdHelper.AMQP_STRING_PREFIX + encodedUuidString;
-
-        Object idObject = _messageIdHelper.toIdObject(stringId);
-        assertNotNull("null object should not have been returned", idObject);
-        assertEquals("expected id object was not returned", encodedUuidString, idObject);
-    }
-
-    /**
-     * Test that {@link MessageIdHelper#toIdObject(String)} throws an
-     * {@link IdConversionException} when presented with an encoded binary hex string
-     * of uneven length (after the prefix) that thus can't be converted due to each
-     * byte using 2 characters
-     */
-    @Test
-    public void testToIdObjectWithStringContainingBinaryHexThrowsICEWithUnevenLengthString()
-    {
-        String unevenHead = MessageIdHelper.AMQP_BINARY_PREFIX + "123";
-
-        try
-        {
-            _messageIdHelper.toIdObject(unevenHead);
-            fail("expected exception was not thrown");
-        }
-        catch(IdConversionException iae)
-        {
-            //expected
-            String msg = iae.getCause().getMessage();
-            assertTrue("Message was not as expected: " + msg, msg.contains("even length"));
-        }
-    }
-
-    /**
-     * Test that {@link MessageIdHelper#toIdObject(String)} throws an
-     * {@link IdConversionException} when presented with an encoded binary hex
-     * string (after the prefix) that contains characters other than 0-9
-     * and A-F and a-f, and thus can't be converted
-     */
-    @Test
-    public void testToIdObjectWithStringContainingBinaryHexThrowsICEWithNonHexCharacters()
-    {
-
-        //char before '0'
-        char nonHexChar = '/';
-        String nonHexString = MessageIdHelper.AMQP_BINARY_PREFIX + nonHexChar + nonHexChar;
-
-        try
-        {
-            _messageIdHelper.toIdObject(nonHexString);
-            fail("expected exception was not thrown");
-        }
-        catch(IdConversionException ice)
-        {
-            //expected
-            String msg = ice.getCause().getMessage();
-            assertTrue("Message was not as expected: " + msg, msg.contains("non-hex"));
-        }
-
-        //char after '9', before 'A'
-        nonHexChar = ':';
-        nonHexString = MessageIdHelper.AMQP_BINARY_PREFIX + nonHexChar + nonHexChar;
-
-        try
-        {
-            _messageIdHelper.toIdObject(nonHexString);
-            fail("expected exception was not thrown");
-        }
-        catch(IdConversionException ice)
-        {
-            //expected
-            String msg = ice.getCause().getMessage();
-            assertTrue("Message was not as expected: " + msg, msg.contains("non-hex"));
-        }
-
-        //char after 'F', before 'a'
-        nonHexChar = 'G';
-        nonHexString = MessageIdHelper.AMQP_BINARY_PREFIX + nonHexChar + nonHexChar;
-
-        try
-        {
-            _messageIdHelper.toIdObject(nonHexString);
-            fail("expected exception was not thrown");
-        }
-        catch(IdConversionException ice)
-        {
-            //expected
-            String msg = ice.getCause().getMessage();
-            assertTrue("Message was not as expected: " + msg, msg.contains("non-hex"));
-        }
-
-        //char after 'f'
-        nonHexChar = 'g';
-        nonHexString = MessageIdHelper.AMQP_BINARY_PREFIX + nonHexChar + nonHexChar;
-
-        try
-        {
-            _messageIdHelper.toIdObject(nonHexString);
-            fail("expected exception was not thrown");
-        }
-        catch(IdConversionException ice)
-        {
-            //expected
-            String msg = ice.getCause().getMessage();
-            assertTrue("Message was not as expected: " + msg, msg.contains("non-hex"));
-        }
-    }
-}


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org