activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From clebertsuco...@apache.org
Subject [3/3] activemq-artemis git commit: Move commons util tests to commons
Date Mon, 25 Jan 2016 17:09:45 GMT
Move commons util tests to commons


Project: http://git-wip-us.apache.org/repos/asf/activemq-artemis/repo
Commit: http://git-wip-us.apache.org/repos/asf/activemq-artemis/commit/ca34f7fb
Tree: http://git-wip-us.apache.org/repos/asf/activemq-artemis/tree/ca34f7fb
Diff: http://git-wip-us.apache.org/repos/asf/activemq-artemis/diff/ca34f7fb

Branch: refs/heads/master
Commit: ca34f7fbb2eee3e171825d2d86fb860cb1ad9400
Parents: 29ed1ea
Author: Ville Skyttä <ville.skytta@iki.fi>
Authored: Sun Jan 24 12:48:11 2016 +0200
Committer: Clebert Suconic <clebertsuconic@apache.org>
Committed: Mon Jan 25 11:23:07 2016 -0500

----------------------------------------------------------------------
 .../artemis/utils/ConcurrentHashSetTest.java    | 128 ++++++++
 .../utils/TypedPropertiesConversionTest.java    | 312 ++++++++++++++++++
 .../artemis/utils/TypedPropertiesTest.java      | 229 ++++++++++++++
 .../artemis/util/ConcurrentHashSetTest.java     | 131 --------
 .../util/TypedPropertiesConversionTest.java     | 314 -------------------
 .../artemis/util/TypedPropertiesTest.java       | 231 --------------
 6 files changed, 669 insertions(+), 676 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/ca34f7fb/artemis-commons/src/test/java/org/apache/activemq/artemis/utils/ConcurrentHashSetTest.java
----------------------------------------------------------------------
diff --git a/artemis-commons/src/test/java/org/apache/activemq/artemis/utils/ConcurrentHashSetTest.java b/artemis-commons/src/test/java/org/apache/activemq/artemis/utils/ConcurrentHashSetTest.java
new file mode 100644
index 0000000..6bc4fde
--- /dev/null
+++ b/artemis-commons/src/test/java/org/apache/activemq/artemis/utils/ConcurrentHashSetTest.java
@@ -0,0 +1,128 @@
+/*
+ * 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.activemq.artemis.utils;
+
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
+
+import java.util.Iterator;
+
+public class ConcurrentHashSetTest extends Assert {
+   // Constants -----------------------------------------------------
+
+   // Attributes ----------------------------------------------------
+
+   private ConcurrentSet<String> set;
+
+   private String element;
+
+   // Static --------------------------------------------------------
+
+   // Constructors --------------------------------------------------
+
+   // Public --------------------------------------------------------
+
+   @Test
+   public void testAdd() throws Exception {
+      Assert.assertTrue(set.add(element));
+      Assert.assertFalse(set.add(element));
+   }
+
+   @Test
+   public void testAddIfAbsent() throws Exception {
+      Assert.assertTrue(set.addIfAbsent(element));
+      Assert.assertFalse(set.addIfAbsent(element));
+   }
+
+   @Test
+   public void testRemove() throws Exception {
+      Assert.assertTrue(set.add(element));
+
+      Assert.assertTrue(set.remove(element));
+      Assert.assertFalse(set.remove(element));
+   }
+
+   @Test
+   public void testContains() throws Exception {
+      Assert.assertFalse(set.contains(element));
+
+      Assert.assertTrue(set.add(element));
+      Assert.assertTrue(set.contains(element));
+
+      Assert.assertTrue(set.remove(element));
+      Assert.assertFalse(set.contains(element));
+   }
+
+   @Test
+   public void testSize() throws Exception {
+      Assert.assertEquals(0, set.size());
+
+      Assert.assertTrue(set.add(element));
+      Assert.assertEquals(1, set.size());
+
+      Assert.assertTrue(set.remove(element));
+      Assert.assertEquals(0, set.size());
+   }
+
+   @Test
+   public void testClear() throws Exception {
+      Assert.assertTrue(set.add(element));
+
+      Assert.assertTrue(set.contains(element));
+      set.clear();
+      Assert.assertFalse(set.contains(element));
+   }
+
+   @Test
+   public void testIsEmpty() throws Exception {
+      Assert.assertTrue(set.isEmpty());
+
+      Assert.assertTrue(set.add(element));
+      Assert.assertFalse(set.isEmpty());
+
+      set.clear();
+      Assert.assertTrue(set.isEmpty());
+   }
+
+   @Test
+   public void testIterator() throws Exception {
+      set.add(element);
+
+      Iterator<String> iterator = set.iterator();
+      while (iterator.hasNext()) {
+         String e = iterator.next();
+         Assert.assertEquals(element, e);
+      }
+   }
+
+   // TestCase overrides --------------------------------------------
+
+   @Before
+   public void setUp() throws Exception {
+      set = new ConcurrentHashSet<>();
+      element = RandomUtil.randomString();
+   }
+
+   // Package protected ---------------------------------------------
+
+   // Protected -----------------------------------------------------
+
+   // Private -------------------------------------------------------
+
+   // Inner classes -------------------------------------------------
+}

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/ca34f7fb/artemis-commons/src/test/java/org/apache/activemq/artemis/utils/TypedPropertiesConversionTest.java
----------------------------------------------------------------------
diff --git a/artemis-commons/src/test/java/org/apache/activemq/artemis/utils/TypedPropertiesConversionTest.java b/artemis-commons/src/test/java/org/apache/activemq/artemis/utils/TypedPropertiesConversionTest.java
new file mode 100644
index 0000000..ff5d32d
--- /dev/null
+++ b/artemis-commons/src/test/java/org/apache/activemq/artemis/utils/TypedPropertiesConversionTest.java
@@ -0,0 +1,312 @@
+/*
+ * 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.activemq.artemis.utils;
+
+import org.apache.activemq.artemis.api.core.ActiveMQPropertyConversionException;
+import org.apache.activemq.artemis.api.core.SimpleString;
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
+
+public class TypedPropertiesConversionTest {
+
+   // Constants -----------------------------------------------------
+
+   // Attributes ----------------------------------------------------
+
+   private TypedProperties props;
+
+   private SimpleString key;
+
+   private final SimpleString unknownKey = new SimpleString("this.key.is.never.used");
+
+   // Static --------------------------------------------------------
+
+   // Constructors --------------------------------------------------
+
+   // Public --------------------------------------------------------
+
+   @Before
+   public void setUp() throws Exception {
+      key = RandomUtil.randomSimpleString();
+      props = new TypedProperties();
+   }
+
+   @Test
+   public void testBooleanProperty() throws Exception {
+      Boolean val = RandomUtil.randomBoolean();
+      props.putBooleanProperty(key, val);
+
+      Assert.assertEquals(val, props.getBooleanProperty(key));
+      Assert.assertEquals(new SimpleString(Boolean.toString(val)), props.getSimpleStringProperty(key));
+
+      props.putSimpleStringProperty(key, new SimpleString(Boolean.toString(val)));
+      Assert.assertEquals(val, props.getBooleanProperty(key));
+
+      try {
+         props.putByteProperty(key, RandomUtil.randomByte());
+         props.getBooleanProperty(key);
+         Assert.fail();
+      }
+      catch (ActiveMQPropertyConversionException e) {
+      }
+
+      Assert.assertFalse(props.getBooleanProperty(unknownKey));
+   }
+
+   @Test
+   public void testCharProperty() throws Exception {
+      Character val = RandomUtil.randomChar();
+      props.putCharProperty(key, val);
+
+      Assert.assertEquals(val, props.getCharProperty(key));
+      Assert.assertEquals(new SimpleString(Character.toString(val)), props.getSimpleStringProperty(key));
+
+      try {
+         props.putByteProperty(key, RandomUtil.randomByte());
+         props.getCharProperty(key);
+         Assert.fail();
+      }
+      catch (ActiveMQPropertyConversionException e) {
+      }
+
+      try {
+         props.getCharProperty(unknownKey);
+         Assert.fail();
+      }
+      catch (NullPointerException e) {
+      }
+   }
+
+   @Test
+   public void testByteProperty() throws Exception {
+      Byte val = RandomUtil.randomByte();
+      props.putByteProperty(key, val);
+
+      Assert.assertEquals(val, props.getByteProperty(key));
+      Assert.assertEquals(new SimpleString(Byte.toString(val)), props.getSimpleStringProperty(key));
+
+      props.putSimpleStringProperty(key, new SimpleString(Byte.toString(val)));
+      Assert.assertEquals(val, props.getByteProperty(key));
+
+      try {
+         props.putBooleanProperty(key, RandomUtil.randomBoolean());
+         props.getByteProperty(key);
+         Assert.fail();
+      }
+      catch (ActiveMQPropertyConversionException e) {
+      }
+
+      try {
+         props.getByteProperty(unknownKey);
+         Assert.fail();
+      }
+      catch (NumberFormatException e) {
+      }
+   }
+
+   @Test
+   public void testIntProperty() throws Exception {
+      Integer val = RandomUtil.randomInt();
+      props.putIntProperty(key, val);
+
+      Assert.assertEquals(val, props.getIntProperty(key));
+      Assert.assertEquals(new SimpleString(Integer.toString(val)), props.getSimpleStringProperty(key));
+
+      props.putSimpleStringProperty(key, new SimpleString(Integer.toString(val)));
+      Assert.assertEquals(val, props.getIntProperty(key));
+
+      Byte byteVal = RandomUtil.randomByte();
+      props.putByteProperty(key, byteVal);
+      Assert.assertEquals(Integer.valueOf(byteVal), props.getIntProperty(key));
+
+      try {
+         props.putBooleanProperty(key, RandomUtil.randomBoolean());
+         props.getIntProperty(key);
+         Assert.fail();
+      }
+      catch (ActiveMQPropertyConversionException e) {
+      }
+
+      try {
+         props.getIntProperty(unknownKey);
+         Assert.fail();
+      }
+      catch (NumberFormatException e) {
+      }
+   }
+
+   @Test
+   public void testLongProperty() throws Exception {
+      Long val = RandomUtil.randomLong();
+      props.putLongProperty(key, val);
+
+      Assert.assertEquals(val, props.getLongProperty(key));
+      Assert.assertEquals(new SimpleString(Long.toString(val)), props.getSimpleStringProperty(key));
+
+      props.putSimpleStringProperty(key, new SimpleString(Long.toString(val)));
+      Assert.assertEquals(val, props.getLongProperty(key));
+
+      Byte byteVal = RandomUtil.randomByte();
+      props.putByteProperty(key, byteVal);
+      Assert.assertEquals(Long.valueOf(byteVal), props.getLongProperty(key));
+
+      Short shortVal = RandomUtil.randomShort();
+      props.putShortProperty(key, shortVal);
+      Assert.assertEquals(Long.valueOf(shortVal), props.getLongProperty(key));
+
+      Integer intVal = RandomUtil.randomInt();
+      props.putIntProperty(key, intVal);
+      Assert.assertEquals(Long.valueOf(intVal), props.getLongProperty(key));
+
+      try {
+         props.putBooleanProperty(key, RandomUtil.randomBoolean());
+         props.getLongProperty(key);
+         Assert.fail();
+      }
+      catch (ActiveMQPropertyConversionException e) {
+      }
+
+      try {
+         props.getLongProperty(unknownKey);
+         Assert.fail();
+      }
+      catch (NumberFormatException e) {
+      }
+   }
+
+   @Test
+   public void testDoubleProperty() throws Exception {
+      Double val = RandomUtil.randomDouble();
+      props.putDoubleProperty(key, val);
+
+      Assert.assertEquals(val, props.getDoubleProperty(key));
+      Assert.assertEquals(new SimpleString(Double.toString(val)), props.getSimpleStringProperty(key));
+
+      props.putSimpleStringProperty(key, new SimpleString(Double.toString(val)));
+      Assert.assertEquals(val, props.getDoubleProperty(key));
+
+      try {
+         props.putBooleanProperty(key, RandomUtil.randomBoolean());
+         props.getDoubleProperty(key);
+         Assert.fail();
+      }
+      catch (ActiveMQPropertyConversionException e) {
+      }
+
+      try {
+         props.getDoubleProperty(unknownKey);
+         Assert.fail();
+      }
+      catch (Exception e) {
+      }
+   }
+
+   @Test
+   public void testFloatProperty() throws Exception {
+      Float val = RandomUtil.randomFloat();
+      props.putFloatProperty(key, val);
+
+      Assert.assertEquals(val, props.getFloatProperty(key));
+      Assert.assertEquals(Double.valueOf(val), props.getDoubleProperty(key));
+      Assert.assertEquals(new SimpleString(Float.toString(val)), props.getSimpleStringProperty(key));
+
+      props.putSimpleStringProperty(key, new SimpleString(Float.toString(val)));
+      Assert.assertEquals(val, props.getFloatProperty(key));
+
+      try {
+         props.putBooleanProperty(key, RandomUtil.randomBoolean());
+         props.getFloatProperty(key);
+         Assert.fail();
+      }
+      catch (ActiveMQPropertyConversionException e) {
+      }
+
+      try {
+         props.getFloatProperty(unknownKey);
+         Assert.fail();
+      }
+      catch (Exception e) {
+      }
+   }
+
+   @Test
+   public void testShortProperty() throws Exception {
+      Short val = RandomUtil.randomShort();
+      props.putShortProperty(key, val);
+
+      Assert.assertEquals(val, props.getShortProperty(key));
+      Assert.assertEquals(Integer.valueOf(val), props.getIntProperty(key));
+      Assert.assertEquals(new SimpleString(Short.toString(val)), props.getSimpleStringProperty(key));
+
+      props.putSimpleStringProperty(key, new SimpleString(Short.toString(val)));
+      Assert.assertEquals(val, props.getShortProperty(key));
+
+      Byte byteVal = RandomUtil.randomByte();
+      props.putByteProperty(key, byteVal);
+      Assert.assertEquals(Short.valueOf(byteVal), props.getShortProperty(key));
+
+      try {
+         props.putBooleanProperty(key, RandomUtil.randomBoolean());
+         props.getShortProperty(key);
+         Assert.fail();
+      }
+      catch (ActiveMQPropertyConversionException e) {
+      }
+
+      try {
+         props.getShortProperty(unknownKey);
+         Assert.fail();
+      }
+      catch (NumberFormatException e) {
+      }
+   }
+
+   @Test
+   public void testSimpleStringProperty() throws Exception {
+      SimpleString strVal = RandomUtil.randomSimpleString();
+      props.putSimpleStringProperty(key, strVal);
+      Assert.assertEquals(strVal, props.getSimpleStringProperty(key));
+   }
+
+   @Test
+   public void testBytesProperty() throws Exception {
+      byte[] val = RandomUtil.randomBytes();
+      props.putBytesProperty(key, val);
+
+      Assert.assertArrayEquals(val, props.getBytesProperty(key));
+
+      try {
+         props.putBooleanProperty(key, RandomUtil.randomBoolean());
+         props.getBytesProperty(key);
+         Assert.fail();
+      }
+      catch (ActiveMQPropertyConversionException e) {
+      }
+
+      Assert.assertNull(props.getBytesProperty(unknownKey));
+   }
+
+   // Package protected ---------------------------------------------
+
+   // Protected -----------------------------------------------------
+
+   // Private -------------------------------------------------------
+
+   // Inner classes -------------------------------------------------
+
+}

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/ca34f7fb/artemis-commons/src/test/java/org/apache/activemq/artemis/utils/TypedPropertiesTest.java
----------------------------------------------------------------------
diff --git a/artemis-commons/src/test/java/org/apache/activemq/artemis/utils/TypedPropertiesTest.java b/artemis-commons/src/test/java/org/apache/activemq/artemis/utils/TypedPropertiesTest.java
new file mode 100644
index 0000000..48c7630
--- /dev/null
+++ b/artemis-commons/src/test/java/org/apache/activemq/artemis/utils/TypedPropertiesTest.java
@@ -0,0 +1,229 @@
+/*
+ * 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.activemq.artemis.utils;
+
+import java.util.Iterator;
+
+import org.apache.activemq.artemis.api.core.ActiveMQBuffer;
+import org.apache.activemq.artemis.api.core.ActiveMQBuffers;
+import org.apache.activemq.artemis.api.core.SimpleString;
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
+
+public class TypedPropertiesTest {
+
+   private static void assertEqualsTypeProperties(final TypedProperties expected, final TypedProperties actual) {
+      Assert.assertNotNull(expected);
+      Assert.assertNotNull(actual);
+      Assert.assertEquals(expected.getEncodeSize(), actual.getEncodeSize());
+      Assert.assertEquals(expected.getPropertyNames(), actual.getPropertyNames());
+      Iterator<SimpleString> iterator = actual.getPropertyNames().iterator();
+      while (iterator.hasNext()) {
+         SimpleString key = iterator.next();
+         Object expectedValue = expected.getProperty(key);
+         Object actualValue = actual.getProperty(key);
+         if (expectedValue instanceof byte[] && actualValue instanceof byte[]) {
+            byte[] expectedBytes = (byte[]) expectedValue;
+            byte[] actualBytes = (byte[]) actualValue;
+            Assert.assertArrayEquals(expectedBytes, actualBytes);
+         }
+         else {
+            Assert.assertEquals(expectedValue, actualValue);
+         }
+      }
+   }
+
+   // Constructors --------------------------------------------------
+
+   // Public --------------------------------------------------------
+
+   private TypedProperties props;
+
+   private SimpleString key;
+
+   @Test
+   public void testCopyContructor() throws Exception {
+      props.putSimpleStringProperty(key, RandomUtil.randomSimpleString());
+
+      TypedProperties copy = new TypedProperties(props);
+
+      Assert.assertEquals(props.getEncodeSize(), copy.getEncodeSize());
+      Assert.assertEquals(props.getPropertyNames(), copy.getPropertyNames());
+
+      Assert.assertTrue(copy.containsProperty(key));
+      Assert.assertEquals(props.getProperty(key), copy.getProperty(key));
+   }
+
+   @Test
+   public void testRemove() throws Exception {
+      props.putSimpleStringProperty(key, RandomUtil.randomSimpleString());
+
+      Assert.assertTrue(props.containsProperty(key));
+      Assert.assertNotNull(props.getProperty(key));
+
+      props.removeProperty(key);
+
+      Assert.assertFalse(props.containsProperty(key));
+      Assert.assertNull(props.getProperty(key));
+   }
+
+   @Test
+   public void testClear() throws Exception {
+      props.putSimpleStringProperty(key, RandomUtil.randomSimpleString());
+
+      Assert.assertTrue(props.containsProperty(key));
+      Assert.assertNotNull(props.getProperty(key));
+
+      props.clear();
+
+      Assert.assertFalse(props.containsProperty(key));
+      Assert.assertNull(props.getProperty(key));
+   }
+
+   @Test
+   public void testKey() throws Exception {
+      props.putBooleanProperty(key, true);
+      boolean bool = (Boolean) props.getProperty(key);
+      Assert.assertEquals(true, bool);
+
+      props.putCharProperty(key, 'a');
+      char c = (Character) props.getProperty(key);
+      Assert.assertEquals('a', c);
+   }
+
+   @Test
+   public void testGetPropertyOnEmptyProperties() throws Exception {
+      Assert.assertFalse(props.containsProperty(key));
+      Assert.assertNull(props.getProperty(key));
+   }
+
+   @Test
+   public void testRemovePropertyOnEmptyProperties() throws Exception {
+      Assert.assertFalse(props.containsProperty(key));
+      Assert.assertNull(props.removeProperty(key));
+   }
+
+   @Test
+   public void testNullProperty() throws Exception {
+      props.putSimpleStringProperty(key, null);
+      Assert.assertTrue(props.containsProperty(key));
+      Assert.assertNull(props.getProperty(key));
+   }
+
+   @Test
+   public void testBytesPropertyWithNull() throws Exception {
+      props.putBytesProperty(key, null);
+
+      Assert.assertTrue(props.containsProperty(key));
+      byte[] bb = (byte[]) props.getProperty(key);
+      Assert.assertNull(bb);
+   }
+
+   @Test
+   public void testTypedProperties() throws Exception {
+      SimpleString longKey = RandomUtil.randomSimpleString();
+      long longValue = RandomUtil.randomLong();
+      SimpleString simpleStringKey = RandomUtil.randomSimpleString();
+      SimpleString simpleStringValue = RandomUtil.randomSimpleString();
+      TypedProperties otherProps = new TypedProperties();
+      otherProps.putLongProperty(longKey, longValue);
+      otherProps.putSimpleStringProperty(simpleStringKey, simpleStringValue);
+
+      props.putTypedProperties(otherProps);
+
+      long ll = props.getLongProperty(longKey);
+      Assert.assertEquals(longValue, ll);
+      SimpleString ss = props.getSimpleStringProperty(simpleStringKey);
+      Assert.assertEquals(simpleStringValue, ss);
+   }
+
+   @Test
+   public void testEmptyTypedProperties() throws Exception {
+      Assert.assertEquals(0, props.getPropertyNames().size());
+
+      props.putTypedProperties(new TypedProperties());
+
+      Assert.assertEquals(0, props.getPropertyNames().size());
+   }
+
+   @Test
+   public void testNullTypedProperties() throws Exception {
+      Assert.assertEquals(0, props.getPropertyNames().size());
+
+      props.putTypedProperties(null);
+
+      Assert.assertEquals(0, props.getPropertyNames().size());
+   }
+
+   @Test
+   public void testEncodeDecode() throws Exception {
+      props.putByteProperty(RandomUtil.randomSimpleString(), RandomUtil.randomByte());
+      props.putBytesProperty(RandomUtil.randomSimpleString(), RandomUtil.randomBytes());
+      props.putBytesProperty(RandomUtil.randomSimpleString(), null);
+      props.putBooleanProperty(RandomUtil.randomSimpleString(), RandomUtil.randomBoolean());
+      props.putShortProperty(RandomUtil.randomSimpleString(), RandomUtil.randomShort());
+      props.putIntProperty(RandomUtil.randomSimpleString(), RandomUtil.randomInt());
+      props.putLongProperty(RandomUtil.randomSimpleString(), RandomUtil.randomLong());
+      props.putFloatProperty(RandomUtil.randomSimpleString(), RandomUtil.randomFloat());
+      props.putDoubleProperty(RandomUtil.randomSimpleString(), RandomUtil.randomDouble());
+      props.putCharProperty(RandomUtil.randomSimpleString(), RandomUtil.randomChar());
+      props.putSimpleStringProperty(RandomUtil.randomSimpleString(), RandomUtil.randomSimpleString());
+      props.putSimpleStringProperty(RandomUtil.randomSimpleString(), null);
+      SimpleString keyToRemove = RandomUtil.randomSimpleString();
+      props.putSimpleStringProperty(keyToRemove, RandomUtil.randomSimpleString());
+
+      ActiveMQBuffer buffer = ActiveMQBuffers.dynamicBuffer(1024);
+      props.encode(buffer);
+
+      Assert.assertEquals(props.getEncodeSize(), buffer.writerIndex());
+
+      TypedProperties decodedProps = new TypedProperties();
+      decodedProps.decode(buffer);
+
+      TypedPropertiesTest.assertEqualsTypeProperties(props, decodedProps);
+
+      buffer.clear();
+
+      // After removing a property, you should still be able to encode the Property
+      props.removeProperty(keyToRemove);
+      props.encode(buffer);
+
+      Assert.assertEquals(props.getEncodeSize(), buffer.writerIndex());
+   }
+
+   @Test
+   public void testEncodeDecodeEmpty() throws Exception {
+      TypedProperties emptyProps = new TypedProperties();
+
+      ActiveMQBuffer buffer = ActiveMQBuffers.dynamicBuffer(1024);
+      emptyProps.encode(buffer);
+
+      Assert.assertEquals(props.getEncodeSize(), buffer.writerIndex());
+
+      TypedProperties decodedProps = new TypedProperties();
+      decodedProps.decode(buffer);
+
+      TypedPropertiesTest.assertEqualsTypeProperties(emptyProps, decodedProps);
+   }
+
+   @Before
+   public void setUp() throws Exception {
+      props = new TypedProperties();
+      key = RandomUtil.randomSimpleString();
+   }
+}

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/ca34f7fb/artemis-core-client/src/test/java/org/apache/activemq/artemis/util/ConcurrentHashSetTest.java
----------------------------------------------------------------------
diff --git a/artemis-core-client/src/test/java/org/apache/activemq/artemis/util/ConcurrentHashSetTest.java b/artemis-core-client/src/test/java/org/apache/activemq/artemis/util/ConcurrentHashSetTest.java
deleted file mode 100644
index 79ffa06..0000000
--- a/artemis-core-client/src/test/java/org/apache/activemq/artemis/util/ConcurrentHashSetTest.java
+++ /dev/null
@@ -1,131 +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.activemq.artemis.util;
-
-import org.apache.activemq.artemis.utils.ConcurrentHashSet;
-import org.apache.activemq.artemis.utils.ConcurrentSet;
-import org.apache.activemq.artemis.utils.RandomUtil;
-import org.junit.Assert;
-import org.junit.Before;
-import org.junit.Test;
-
-import java.util.Iterator;
-
-public class ConcurrentHashSetTest extends Assert {
-   // Constants -----------------------------------------------------
-
-   // Attributes ----------------------------------------------------
-
-   private ConcurrentSet<String> set;
-
-   private String element;
-
-   // Static --------------------------------------------------------
-
-   // Constructors --------------------------------------------------
-
-   // Public --------------------------------------------------------
-
-   @Test
-   public void testAdd() throws Exception {
-      Assert.assertTrue(set.add(element));
-      Assert.assertFalse(set.add(element));
-   }
-
-   @Test
-   public void testAddIfAbsent() throws Exception {
-      Assert.assertTrue(set.addIfAbsent(element));
-      Assert.assertFalse(set.addIfAbsent(element));
-   }
-
-   @Test
-   public void testRemove() throws Exception {
-      Assert.assertTrue(set.add(element));
-
-      Assert.assertTrue(set.remove(element));
-      Assert.assertFalse(set.remove(element));
-   }
-
-   @Test
-   public void testContains() throws Exception {
-      Assert.assertFalse(set.contains(element));
-
-      Assert.assertTrue(set.add(element));
-      Assert.assertTrue(set.contains(element));
-
-      Assert.assertTrue(set.remove(element));
-      Assert.assertFalse(set.contains(element));
-   }
-
-   @Test
-   public void testSize() throws Exception {
-      Assert.assertEquals(0, set.size());
-
-      Assert.assertTrue(set.add(element));
-      Assert.assertEquals(1, set.size());
-
-      Assert.assertTrue(set.remove(element));
-      Assert.assertEquals(0, set.size());
-   }
-
-   @Test
-   public void testClear() throws Exception {
-      Assert.assertTrue(set.add(element));
-
-      Assert.assertTrue(set.contains(element));
-      set.clear();
-      Assert.assertFalse(set.contains(element));
-   }
-
-   @Test
-   public void testIsEmpty() throws Exception {
-      Assert.assertTrue(set.isEmpty());
-
-      Assert.assertTrue(set.add(element));
-      Assert.assertFalse(set.isEmpty());
-
-      set.clear();
-      Assert.assertTrue(set.isEmpty());
-   }
-
-   @Test
-   public void testIterator() throws Exception {
-      set.add(element);
-
-      Iterator<String> iterator = set.iterator();
-      while (iterator.hasNext()) {
-         String e = iterator.next();
-         Assert.assertEquals(element, e);
-      }
-   }
-
-   // TestCase overrides --------------------------------------------
-
-   @Before
-   public void setUp() throws Exception {
-      set = new ConcurrentHashSet<>();
-      element = RandomUtil.randomString();
-   }
-
-   // Package protected ---------------------------------------------
-
-   // Protected -----------------------------------------------------
-
-   // Private -------------------------------------------------------
-
-   // Inner classes -------------------------------------------------
-}

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/ca34f7fb/artemis-core-client/src/test/java/org/apache/activemq/artemis/util/TypedPropertiesConversionTest.java
----------------------------------------------------------------------
diff --git a/artemis-core-client/src/test/java/org/apache/activemq/artemis/util/TypedPropertiesConversionTest.java b/artemis-core-client/src/test/java/org/apache/activemq/artemis/util/TypedPropertiesConversionTest.java
deleted file mode 100644
index e4e8c59..0000000
--- a/artemis-core-client/src/test/java/org/apache/activemq/artemis/util/TypedPropertiesConversionTest.java
+++ /dev/null
@@ -1,314 +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.activemq.artemis.util;
-
-import org.apache.activemq.artemis.api.core.ActiveMQPropertyConversionException;
-import org.apache.activemq.artemis.api.core.SimpleString;
-import org.apache.activemq.artemis.utils.RandomUtil;
-import org.apache.activemq.artemis.utils.TypedProperties;
-import org.junit.Assert;
-import org.junit.Before;
-import org.junit.Test;
-
-public class TypedPropertiesConversionTest {
-
-   // Constants -----------------------------------------------------
-
-   // Attributes ----------------------------------------------------
-
-   private TypedProperties props;
-
-   private SimpleString key;
-
-   private final SimpleString unknownKey = new SimpleString("this.key.is.never.used");
-
-   // Static --------------------------------------------------------
-
-   // Constructors --------------------------------------------------
-
-   // Public --------------------------------------------------------
-
-   @Before
-   public void setUp() throws Exception {
-      key = RandomUtil.randomSimpleString();
-      props = new TypedProperties();
-   }
-
-   @Test
-   public void testBooleanProperty() throws Exception {
-      Boolean val = RandomUtil.randomBoolean();
-      props.putBooleanProperty(key, val);
-
-      Assert.assertEquals(val, props.getBooleanProperty(key));
-      Assert.assertEquals(new SimpleString(Boolean.toString(val)), props.getSimpleStringProperty(key));
-
-      props.putSimpleStringProperty(key, new SimpleString(Boolean.toString(val)));
-      Assert.assertEquals(val, props.getBooleanProperty(key));
-
-      try {
-         props.putByteProperty(key, RandomUtil.randomByte());
-         props.getBooleanProperty(key);
-         Assert.fail();
-      }
-      catch (ActiveMQPropertyConversionException e) {
-      }
-
-      Assert.assertFalse(props.getBooleanProperty(unknownKey));
-   }
-
-   @Test
-   public void testCharProperty() throws Exception {
-      Character val = RandomUtil.randomChar();
-      props.putCharProperty(key, val);
-
-      Assert.assertEquals(val, props.getCharProperty(key));
-      Assert.assertEquals(new SimpleString(Character.toString(val)), props.getSimpleStringProperty(key));
-
-      try {
-         props.putByteProperty(key, RandomUtil.randomByte());
-         props.getCharProperty(key);
-         Assert.fail();
-      }
-      catch (ActiveMQPropertyConversionException e) {
-      }
-
-      try {
-         props.getCharProperty(unknownKey);
-         Assert.fail();
-      }
-      catch (NullPointerException e) {
-      }
-   }
-
-   @Test
-   public void testByteProperty() throws Exception {
-      Byte val = RandomUtil.randomByte();
-      props.putByteProperty(key, val);
-
-      Assert.assertEquals(val, props.getByteProperty(key));
-      Assert.assertEquals(new SimpleString(Byte.toString(val)), props.getSimpleStringProperty(key));
-
-      props.putSimpleStringProperty(key, new SimpleString(Byte.toString(val)));
-      Assert.assertEquals(val, props.getByteProperty(key));
-
-      try {
-         props.putBooleanProperty(key, RandomUtil.randomBoolean());
-         props.getByteProperty(key);
-         Assert.fail();
-      }
-      catch (ActiveMQPropertyConversionException e) {
-      }
-
-      try {
-         props.getByteProperty(unknownKey);
-         Assert.fail();
-      }
-      catch (NumberFormatException e) {
-      }
-   }
-
-   @Test
-   public void testIntProperty() throws Exception {
-      Integer val = RandomUtil.randomInt();
-      props.putIntProperty(key, val);
-
-      Assert.assertEquals(val, props.getIntProperty(key));
-      Assert.assertEquals(new SimpleString(Integer.toString(val)), props.getSimpleStringProperty(key));
-
-      props.putSimpleStringProperty(key, new SimpleString(Integer.toString(val)));
-      Assert.assertEquals(val, props.getIntProperty(key));
-
-      Byte byteVal = RandomUtil.randomByte();
-      props.putByteProperty(key, byteVal);
-      Assert.assertEquals(Integer.valueOf(byteVal), props.getIntProperty(key));
-
-      try {
-         props.putBooleanProperty(key, RandomUtil.randomBoolean());
-         props.getIntProperty(key);
-         Assert.fail();
-      }
-      catch (ActiveMQPropertyConversionException e) {
-      }
-
-      try {
-         props.getIntProperty(unknownKey);
-         Assert.fail();
-      }
-      catch (NumberFormatException e) {
-      }
-   }
-
-   @Test
-   public void testLongProperty() throws Exception {
-      Long val = RandomUtil.randomLong();
-      props.putLongProperty(key, val);
-
-      Assert.assertEquals(val, props.getLongProperty(key));
-      Assert.assertEquals(new SimpleString(Long.toString(val)), props.getSimpleStringProperty(key));
-
-      props.putSimpleStringProperty(key, new SimpleString(Long.toString(val)));
-      Assert.assertEquals(val, props.getLongProperty(key));
-
-      Byte byteVal = RandomUtil.randomByte();
-      props.putByteProperty(key, byteVal);
-      Assert.assertEquals(Long.valueOf(byteVal), props.getLongProperty(key));
-
-      Short shortVal = RandomUtil.randomShort();
-      props.putShortProperty(key, shortVal);
-      Assert.assertEquals(Long.valueOf(shortVal), props.getLongProperty(key));
-
-      Integer intVal = RandomUtil.randomInt();
-      props.putIntProperty(key, intVal);
-      Assert.assertEquals(Long.valueOf(intVal), props.getLongProperty(key));
-
-      try {
-         props.putBooleanProperty(key, RandomUtil.randomBoolean());
-         props.getLongProperty(key);
-         Assert.fail();
-      }
-      catch (ActiveMQPropertyConversionException e) {
-      }
-
-      try {
-         props.getLongProperty(unknownKey);
-         Assert.fail();
-      }
-      catch (NumberFormatException e) {
-      }
-   }
-
-   @Test
-   public void testDoubleProperty() throws Exception {
-      Double val = RandomUtil.randomDouble();
-      props.putDoubleProperty(key, val);
-
-      Assert.assertEquals(val, props.getDoubleProperty(key));
-      Assert.assertEquals(new SimpleString(Double.toString(val)), props.getSimpleStringProperty(key));
-
-      props.putSimpleStringProperty(key, new SimpleString(Double.toString(val)));
-      Assert.assertEquals(val, props.getDoubleProperty(key));
-
-      try {
-         props.putBooleanProperty(key, RandomUtil.randomBoolean());
-         props.getDoubleProperty(key);
-         Assert.fail();
-      }
-      catch (ActiveMQPropertyConversionException e) {
-      }
-
-      try {
-         props.getDoubleProperty(unknownKey);
-         Assert.fail();
-      }
-      catch (Exception e) {
-      }
-   }
-
-   @Test
-   public void testFloatProperty() throws Exception {
-      Float val = RandomUtil.randomFloat();
-      props.putFloatProperty(key, val);
-
-      Assert.assertEquals(val, props.getFloatProperty(key));
-      Assert.assertEquals(Double.valueOf(val), props.getDoubleProperty(key));
-      Assert.assertEquals(new SimpleString(Float.toString(val)), props.getSimpleStringProperty(key));
-
-      props.putSimpleStringProperty(key, new SimpleString(Float.toString(val)));
-      Assert.assertEquals(val, props.getFloatProperty(key));
-
-      try {
-         props.putBooleanProperty(key, RandomUtil.randomBoolean());
-         props.getFloatProperty(key);
-         Assert.fail();
-      }
-      catch (ActiveMQPropertyConversionException e) {
-      }
-
-      try {
-         props.getFloatProperty(unknownKey);
-         Assert.fail();
-      }
-      catch (Exception e) {
-      }
-   }
-
-   @Test
-   public void testShortProperty() throws Exception {
-      Short val = RandomUtil.randomShort();
-      props.putShortProperty(key, val);
-
-      Assert.assertEquals(val, props.getShortProperty(key));
-      Assert.assertEquals(Integer.valueOf(val), props.getIntProperty(key));
-      Assert.assertEquals(new SimpleString(Short.toString(val)), props.getSimpleStringProperty(key));
-
-      props.putSimpleStringProperty(key, new SimpleString(Short.toString(val)));
-      Assert.assertEquals(val, props.getShortProperty(key));
-
-      Byte byteVal = RandomUtil.randomByte();
-      props.putByteProperty(key, byteVal);
-      Assert.assertEquals(Short.valueOf(byteVal), props.getShortProperty(key));
-
-      try {
-         props.putBooleanProperty(key, RandomUtil.randomBoolean());
-         props.getShortProperty(key);
-         Assert.fail();
-      }
-      catch (ActiveMQPropertyConversionException e) {
-      }
-
-      try {
-         props.getShortProperty(unknownKey);
-         Assert.fail();
-      }
-      catch (NumberFormatException e) {
-      }
-   }
-
-   @Test
-   public void testSimpleStringProperty() throws Exception {
-      SimpleString strVal = RandomUtil.randomSimpleString();
-      props.putSimpleStringProperty(key, strVal);
-      Assert.assertEquals(strVal, props.getSimpleStringProperty(key));
-   }
-
-   @Test
-   public void testBytesProperty() throws Exception {
-      byte[] val = RandomUtil.randomBytes();
-      props.putBytesProperty(key, val);
-
-      Assert.assertArrayEquals(val, props.getBytesProperty(key));
-
-      try {
-         props.putBooleanProperty(key, RandomUtil.randomBoolean());
-         props.getBytesProperty(key);
-         Assert.fail();
-      }
-      catch (ActiveMQPropertyConversionException e) {
-      }
-
-      Assert.assertNull(props.getBytesProperty(unknownKey));
-   }
-
-   // Package protected ---------------------------------------------
-
-   // Protected -----------------------------------------------------
-
-   // Private -------------------------------------------------------
-
-   // Inner classes -------------------------------------------------
-
-}

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/ca34f7fb/artemis-core-client/src/test/java/org/apache/activemq/artemis/util/TypedPropertiesTest.java
----------------------------------------------------------------------
diff --git a/artemis-core-client/src/test/java/org/apache/activemq/artemis/util/TypedPropertiesTest.java b/artemis-core-client/src/test/java/org/apache/activemq/artemis/util/TypedPropertiesTest.java
deleted file mode 100644
index cc31e75..0000000
--- a/artemis-core-client/src/test/java/org/apache/activemq/artemis/util/TypedPropertiesTest.java
+++ /dev/null
@@ -1,231 +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.activemq.artemis.util;
-
-import java.util.Iterator;
-
-import org.apache.activemq.artemis.api.core.ActiveMQBuffer;
-import org.apache.activemq.artemis.api.core.ActiveMQBuffers;
-import org.apache.activemq.artemis.api.core.SimpleString;
-import org.apache.activemq.artemis.utils.RandomUtil;
-import org.apache.activemq.artemis.utils.TypedProperties;
-import org.junit.Assert;
-import org.junit.Before;
-import org.junit.Test;
-
-public class TypedPropertiesTest {
-
-   private static void assertEqualsTypeProperties(final TypedProperties expected, final TypedProperties actual) {
-      Assert.assertNotNull(expected);
-      Assert.assertNotNull(actual);
-      Assert.assertEquals(expected.getEncodeSize(), actual.getEncodeSize());
-      Assert.assertEquals(expected.getPropertyNames(), actual.getPropertyNames());
-      Iterator<SimpleString> iterator = actual.getPropertyNames().iterator();
-      while (iterator.hasNext()) {
-         SimpleString key = iterator.next();
-         Object expectedValue = expected.getProperty(key);
-         Object actualValue = actual.getProperty(key);
-         if (expectedValue instanceof byte[] && actualValue instanceof byte[]) {
-            byte[] expectedBytes = (byte[]) expectedValue;
-            byte[] actualBytes = (byte[]) actualValue;
-            Assert.assertArrayEquals(expectedBytes, actualBytes);
-         }
-         else {
-            Assert.assertEquals(expectedValue, actualValue);
-         }
-      }
-   }
-
-   // Constructors --------------------------------------------------
-
-   // Public --------------------------------------------------------
-
-   private TypedProperties props;
-
-   private SimpleString key;
-
-   @Test
-   public void testCopyContructor() throws Exception {
-      props.putSimpleStringProperty(key, RandomUtil.randomSimpleString());
-
-      TypedProperties copy = new TypedProperties(props);
-
-      Assert.assertEquals(props.getEncodeSize(), copy.getEncodeSize());
-      Assert.assertEquals(props.getPropertyNames(), copy.getPropertyNames());
-
-      Assert.assertTrue(copy.containsProperty(key));
-      Assert.assertEquals(props.getProperty(key), copy.getProperty(key));
-   }
-
-   @Test
-   public void testRemove() throws Exception {
-      props.putSimpleStringProperty(key, RandomUtil.randomSimpleString());
-
-      Assert.assertTrue(props.containsProperty(key));
-      Assert.assertNotNull(props.getProperty(key));
-
-      props.removeProperty(key);
-
-      Assert.assertFalse(props.containsProperty(key));
-      Assert.assertNull(props.getProperty(key));
-   }
-
-   @Test
-   public void testClear() throws Exception {
-      props.putSimpleStringProperty(key, RandomUtil.randomSimpleString());
-
-      Assert.assertTrue(props.containsProperty(key));
-      Assert.assertNotNull(props.getProperty(key));
-
-      props.clear();
-
-      Assert.assertFalse(props.containsProperty(key));
-      Assert.assertNull(props.getProperty(key));
-   }
-
-   @Test
-   public void testKey() throws Exception {
-      props.putBooleanProperty(key, true);
-      boolean bool = (Boolean) props.getProperty(key);
-      Assert.assertEquals(true, bool);
-
-      props.putCharProperty(key, 'a');
-      char c = (Character) props.getProperty(key);
-      Assert.assertEquals('a', c);
-   }
-
-   @Test
-   public void testGetPropertyOnEmptyProperties() throws Exception {
-      Assert.assertFalse(props.containsProperty(key));
-      Assert.assertNull(props.getProperty(key));
-   }
-
-   @Test
-   public void testRemovePropertyOnEmptyProperties() throws Exception {
-      Assert.assertFalse(props.containsProperty(key));
-      Assert.assertNull(props.removeProperty(key));
-   }
-
-   @Test
-   public void testNullProperty() throws Exception {
-      props.putSimpleStringProperty(key, null);
-      Assert.assertTrue(props.containsProperty(key));
-      Assert.assertNull(props.getProperty(key));
-   }
-
-   @Test
-   public void testBytesPropertyWithNull() throws Exception {
-      props.putBytesProperty(key, null);
-
-      Assert.assertTrue(props.containsProperty(key));
-      byte[] bb = (byte[]) props.getProperty(key);
-      Assert.assertNull(bb);
-   }
-
-   @Test
-   public void testTypedProperties() throws Exception {
-      SimpleString longKey = RandomUtil.randomSimpleString();
-      long longValue = RandomUtil.randomLong();
-      SimpleString simpleStringKey = RandomUtil.randomSimpleString();
-      SimpleString simpleStringValue = RandomUtil.randomSimpleString();
-      TypedProperties otherProps = new TypedProperties();
-      otherProps.putLongProperty(longKey, longValue);
-      otherProps.putSimpleStringProperty(simpleStringKey, simpleStringValue);
-
-      props.putTypedProperties(otherProps);
-
-      long ll = props.getLongProperty(longKey);
-      Assert.assertEquals(longValue, ll);
-      SimpleString ss = props.getSimpleStringProperty(simpleStringKey);
-      Assert.assertEquals(simpleStringValue, ss);
-   }
-
-   @Test
-   public void testEmptyTypedProperties() throws Exception {
-      Assert.assertEquals(0, props.getPropertyNames().size());
-
-      props.putTypedProperties(new TypedProperties());
-
-      Assert.assertEquals(0, props.getPropertyNames().size());
-   }
-
-   @Test
-   public void testNullTypedProperties() throws Exception {
-      Assert.assertEquals(0, props.getPropertyNames().size());
-
-      props.putTypedProperties(null);
-
-      Assert.assertEquals(0, props.getPropertyNames().size());
-   }
-
-   @Test
-   public void testEncodeDecode() throws Exception {
-      props.putByteProperty(RandomUtil.randomSimpleString(), RandomUtil.randomByte());
-      props.putBytesProperty(RandomUtil.randomSimpleString(), RandomUtil.randomBytes());
-      props.putBytesProperty(RandomUtil.randomSimpleString(), null);
-      props.putBooleanProperty(RandomUtil.randomSimpleString(), RandomUtil.randomBoolean());
-      props.putShortProperty(RandomUtil.randomSimpleString(), RandomUtil.randomShort());
-      props.putIntProperty(RandomUtil.randomSimpleString(), RandomUtil.randomInt());
-      props.putLongProperty(RandomUtil.randomSimpleString(), RandomUtil.randomLong());
-      props.putFloatProperty(RandomUtil.randomSimpleString(), RandomUtil.randomFloat());
-      props.putDoubleProperty(RandomUtil.randomSimpleString(), RandomUtil.randomDouble());
-      props.putCharProperty(RandomUtil.randomSimpleString(), RandomUtil.randomChar());
-      props.putSimpleStringProperty(RandomUtil.randomSimpleString(), RandomUtil.randomSimpleString());
-      props.putSimpleStringProperty(RandomUtil.randomSimpleString(), null);
-      SimpleString keyToRemove = RandomUtil.randomSimpleString();
-      props.putSimpleStringProperty(keyToRemove, RandomUtil.randomSimpleString());
-
-      ActiveMQBuffer buffer = ActiveMQBuffers.dynamicBuffer(1024);
-      props.encode(buffer);
-
-      Assert.assertEquals(props.getEncodeSize(), buffer.writerIndex());
-
-      TypedProperties decodedProps = new TypedProperties();
-      decodedProps.decode(buffer);
-
-      TypedPropertiesTest.assertEqualsTypeProperties(props, decodedProps);
-
-      buffer.clear();
-
-      // After removing a property, you should still be able to encode the Property
-      props.removeProperty(keyToRemove);
-      props.encode(buffer);
-
-      Assert.assertEquals(props.getEncodeSize(), buffer.writerIndex());
-   }
-
-   @Test
-   public void testEncodeDecodeEmpty() throws Exception {
-      TypedProperties emptyProps = new TypedProperties();
-
-      ActiveMQBuffer buffer = ActiveMQBuffers.dynamicBuffer(1024);
-      emptyProps.encode(buffer);
-
-      Assert.assertEquals(props.getEncodeSize(), buffer.writerIndex());
-
-      TypedProperties decodedProps = new TypedProperties();
-      decodedProps.decode(buffer);
-
-      TypedPropertiesTest.assertEqualsTypeProperties(emptyProps, decodedProps);
-   }
-
-   @Before
-   public void setUp() throws Exception {
-      props = new TypedProperties();
-      key = RandomUtil.randomSimpleString();
-   }
-}


Mime
View raw message