http://git-wip-us.apache.org/repos/asf/activemq-6/blob/23e8edd9/activemq6-core-client/src/test/java/org/apache/activemq6/tests/util/RandomUtil.java
----------------------------------------------------------------------
diff --git 
a/activemq6-core-client/src/test/java/org/apache/activemq6/tests/util/RandomUtil.java
 
b/activemq6-core-client/src/test/java/org/apache/activemq6/tests/util/RandomUtil.java
new file mode 100644
index 0000000..de35d40
--- /dev/null
+++ 
b/activemq6-core-client/src/test/java/org/apache/activemq6/tests/util/RandomUtil.java
@@ -0,0 +1,169 @@
+/*
+ * Copyright 2005-2014 Red Hat, Inc.
+ * Red Hat 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.activemq6.tests.util;
+
+import javax.transaction.xa.Xid;
+import java.util.Random;
+import java.util.UUID;
+
+import org.apache.activemq6.api.core.HornetQBuffer;
+import org.apache.activemq6.api.core.HornetQBuffers;
+import org.apache.activemq6.api.core.SimpleString;
+import org.apache.activemq6.core.transaction.impl.XidImpl;
+
+/**
+ * @author <a href="mailto:[email protected]";>Jeff Mesnil</a>
+ */
+public final class RandomUtil
+{
+   // Constants -----------------------------------------------------
+
+   private static final Random random = new Random(System.currentTimeMillis());
+
+   // Attributes ----------------------------------------------------
+
+   // Static --------------------------------------------------------
+
+   public static String randomString()
+   {
+      return UUID.randomUUID().toString();
+   }
+
+   public static SimpleString randomSimpleString()
+   {
+      return new SimpleString(RandomUtil.randomString());
+   }
+
+   public static char randomChar()
+   {
+      return RandomUtil.randomString().charAt(0);
+   }
+
+   public static long randomLong()
+   {
+      return RandomUtil.random.nextLong();
+   }
+
+   public static long randomPositiveLong()
+   {
+      return Math.abs(RandomUtil.randomLong());
+   }
+
+   public static int randomInt()
+   {
+      return RandomUtil.random.nextInt();
+   }
+
+   public static int randomPositiveInt()
+   {
+      return Math.abs(RandomUtil.randomInt());
+   }
+
+
+   public static HornetQBuffer randomBuffer(final int size, final long... data)
+   {
+      HornetQBuffer buffer = HornetQBuffers.fixedBuffer(size + 8 * 
data.length);
+
+      for (long d : data)
+      {
+         buffer.writeLong(d);
+      }
+
+      for (int i = 0; i < size; i++)
+      {
+         buffer.writeByte(randomByte());
+      }
+
+      return buffer;
+   }
+
+
+   public static int randomInterval(final int min, final int max)
+   {
+      return min + randomMax(max - min);
+   }
+
+   public static int randomMax(final int max)
+   {
+      int value = randomPositiveInt() % max;
+
+      if (value == 0)
+      {
+         value = max;
+      }
+
+      return value;
+   }
+
+   public static int randomPort()
+   {
+      return RandomUtil.random.nextInt(65536);
+   }
+
+   public static short randomShort()
+   {
+      return (short) RandomUtil.random.nextInt(Short.MAX_VALUE);
+   }
+
+   public static byte randomByte()
+   {
+      return Integer.valueOf(RandomUtil.random.nextInt()).byteValue();
+   }
+
+   public static boolean randomBoolean()
+   {
+      return RandomUtil.random.nextBoolean();
+   }
+
+   public static byte[] randomBytes()
+   {
+      return RandomUtil.randomString().getBytes();
+   }
+
+   public static byte[] randomBytes(final int length)
+   {
+      byte[] bytes = new byte[length];
+      for (int i = 0; i < bytes.length; i++)
+      {
+         bytes[i] = RandomUtil.randomByte();
+      }
+      return bytes;
+   }
+
+   public static double randomDouble()
+   {
+      return RandomUtil.random.nextDouble();
+   }
+
+   public static float randomFloat()
+   {
+      return RandomUtil.random.nextFloat();
+   }
+
+   public static Xid randomXid()
+   {
+      return new XidImpl(RandomUtil.randomBytes(), RandomUtil.randomInt(), 
RandomUtil.randomBytes());
+   }
+
+   // Constructors --------------------------------------------------
+
+   // Public --------------------------------------------------------
+
+   // Package protected ---------------------------------------------
+
+   // Protected -----------------------------------------------------
+
+   // Private -------------------------------------------------------
+
+   // Inner classes -------------------------------------------------
+}

http://git-wip-us.apache.org/repos/asf/activemq-6/blob/23e8edd9/activemq6-core-client/src/test/java/org/apache/activemq6/tests/util/SilentTestCase.java
----------------------------------------------------------------------
diff --git 
a/activemq6-core-client/src/test/java/org/apache/activemq6/tests/util/SilentTestCase.java
 
b/activemq6-core-client/src/test/java/org/apache/activemq6/tests/util/SilentTestCase.java
new file mode 100644
index 0000000..159dcd0
--- /dev/null
+++ 
b/activemq6-core-client/src/test/java/org/apache/activemq6/tests/util/SilentTestCase.java
@@ -0,0 +1,55 @@
+/*
+ * Copyright 2005-2014 Red Hat, Inc.
+ * Red Hat 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.activemq6.tests.util;
+import org.junit.Before;
+import org.junit.After;
+
+import java.io.ByteArrayOutputStream;
+import java.io.PrintStream;
+
+import org.junit.Assert;
+
+/**
+ * Test case that hijacks sys-out and sys-err.
+ * <p>
+ * It is meant to avoid cluttering either during test execution when the 
tested code (expectedly)
+ * writes to these.
+ */
+public abstract class SilentTestCase extends Assert
+{
+   private PrintStream origSysOut;
+   private PrintStream origSysErr;
+
+   private PrintStream sysOut;
+   private PrintStream sysErr;
+
+   @Before
+   public void setUp() throws Exception
+   {
+
+      origSysOut = System.out;
+      origSysErr = System.err;
+      sysOut = new PrintStream(new ByteArrayOutputStream());
+      System.setOut(sysOut);
+      sysErr = new PrintStream(new ByteArrayOutputStream());
+      System.setErr(sysErr);
+   }
+
+   @After
+   public void tearDown() throws Exception
+   {
+      System.setOut(origSysOut);
+      System.setErr(origSysErr);
+
+   }
+}

http://git-wip-us.apache.org/repos/asf/activemq-6/blob/23e8edd9/activemq6-core-client/src/test/java/org/apache/activemq6/util/CompressionUtilTest.java
----------------------------------------------------------------------
diff --git 
a/activemq6-core-client/src/test/java/org/apache/activemq6/util/CompressionUtilTest.java
 
b/activemq6-core-client/src/test/java/org/apache/activemq6/util/CompressionUtilTest.java
new file mode 100644
index 0000000..58cebf9
--- /dev/null
+++ 
b/activemq6-core-client/src/test/java/org/apache/activemq6/util/CompressionUtilTest.java
@@ -0,0 +1,201 @@
+/*
+ * Copyright 2005-2014 Red Hat, Inc.
+ * Red Hat 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.activemq6.util;
+
+import org.junit.Test;
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.nio.charset.StandardCharsets;
+import java.util.ArrayList;
+import java.util.concurrent.atomic.AtomicLong;
+import java.util.zip.Deflater;
+
+import org.junit.Assert;
+
+import org.apache.activemq6.utils.DeflaterReader;
+import org.apache.activemq6.utils.InflaterReader;
+import org.apache.activemq6.utils.InflaterWriter;
+
+/**
+ * A CompressionUtilTest
+ *
+ * @author <a href="mailto:[email protected]";>Howard Gao</a>
+ *
+ */
+public class CompressionUtilTest extends Assert
+{
+
+   @Test
+   public void testDeflaterReader() throws Exception
+   {
+      String inputString = 
"blahblahblah??blahblahblahblahblah??blablahblah??blablahblah??bla";
+      byte[] input = inputString.getBytes(StandardCharsets.UTF_8);
+
+      ByteArrayInputStream inputStream = new ByteArrayInputStream(input);
+
+      AtomicLong counter = new AtomicLong(0);
+      DeflaterReader reader = new DeflaterReader(inputStream, counter);
+
+      ArrayList<Integer> zipHolder = new ArrayList<Integer>();
+      int b = reader.read();
+
+      while (b != -1)
+      {
+         zipHolder.add(b);
+         b = reader.read();
+      }
+
+      assertEquals(input.length, counter.get());
+
+      byte[] allCompressed = new byte[zipHolder.size()];
+      for (int i = 0; i < allCompressed.length; i++)
+      {
+         allCompressed[i] = (byte) zipHolder.get(i).intValue();
+      }
+
+      byte[] output = new byte[30];
+      Deflater compresser = new Deflater();
+      compresser.setInput(input);
+      compresser.finish();
+      int compressedDataLength = compresser.deflate(output);
+
+      compareByteArray(allCompressed, output, compressedDataLength);
+      reader.close();
+   }
+
+   @Test
+   public void testDeflaterReader2() throws Exception
+   {
+      String inputString = 
"blahblahblah??blahblahblahblahblah??blablahblah??blablahblah??bla";
+      byte[] input = inputString.getBytes(StandardCharsets.UTF_8);
+
+      ByteArrayInputStream inputStream = new ByteArrayInputStream(input);
+      AtomicLong counter = new AtomicLong(0);
+
+      DeflaterReader reader = new DeflaterReader(inputStream, counter);
+
+      byte[] buffer = new byte[7];
+      ArrayList<Integer> zipHolder = new ArrayList<Integer>();
+
+      int n = reader.read(buffer);
+      while (n != -1)
+      {
+         for (int i = 0; i < n; i++)
+         {
+            zipHolder.add((int)buffer[i]);
+         }
+         n = reader.read(buffer);
+      }
+
+      assertEquals(input.length, counter.get());
+
+      byte[] allCompressed = new byte[zipHolder.size()];
+      for (int i = 0; i < allCompressed.length; i++)
+      {
+         allCompressed[i] = (byte) zipHolder.get(i).intValue();
+      }
+
+      byte[] output = new byte[30];
+      Deflater compresser = new Deflater();
+      compresser.setInput(input);
+      compresser.finish();
+      int compressedDataLength = compresser.deflate(output);
+
+      compareByteArray(allCompressed, output, compressedDataLength);
+      reader.close();
+   }
+
+   @Test
+   public void testInflaterReader() throws Exception
+   {
+      String inputString = 
"blahblahblah??blahblahblahblahblah??blablahblah??blablahblah??bla";
+      byte[] input = inputString.getBytes(StandardCharsets.UTF_8);
+      byte[] output = new byte[30];
+      Deflater compresser = new Deflater();
+      compresser.setInput(input);
+      compresser.finish();
+      int compressedDataLength = compresser.deflate(output);
+
+      byte[] zipBytes = new byte[compressedDataLength];
+
+      System.arraycopy(output, 0, zipBytes, 0, compressedDataLength);
+      ByteArrayInputStream byteInput = new ByteArrayInputStream(zipBytes);
+
+      InflaterReader inflater = new InflaterReader(byteInput);
+      ArrayList<Integer> holder = new ArrayList<Integer>();
+      int read = inflater.read();
+
+      while (read != -1)
+      {
+         holder.add(read);
+         read = inflater.read();
+      }
+
+      byte[] result = new byte[holder.size()];
+
+      for (int i = 0; i < result.length; i++)
+      {
+         result[i] = holder.get(i).byteValue();
+      }
+
+      String txt = new String(result);
+
+      assertEquals(inputString, txt);
+      inflater.close();
+   }
+
+   @Test
+   public void testInflaterWriter() throws Exception
+   {
+      String inputString = 
"blahblahblah??blahblahblahblahblah??blablahblah??blablahblah??bla";
+      byte[] input = inputString.getBytes(StandardCharsets.UTF_8);
+      byte[] output = new byte[30];
+      Deflater compresser = new Deflater();
+      compresser.setInput(input);
+      compresser.finish();
+      int compressedDataLength = compresser.deflate(output);
+
+      byte[] zipBytes = new byte[compressedDataLength];
+
+      System.arraycopy(output, 0, zipBytes, 0, compressedDataLength);
+      ByteArrayInputStream byteInput = new ByteArrayInputStream(zipBytes);
+
+      ByteArrayOutputStream byteOutput = new ByteArrayOutputStream();
+      InflaterWriter writer = new InflaterWriter(byteOutput);
+
+      byte[] zipBuffer = new byte[12];
+
+      int n = byteInput.read(zipBuffer);
+      while (n > 0)
+      {
+         writer.write(zipBuffer, 0, n);
+         n = byteInput.read(zipBuffer);
+      }
+
+      writer.close();
+
+      byte[] outcome = byteOutput.toByteArray();
+      String outStr = new String(outcome);
+
+      assertEquals(inputString, outStr);
+   }
+
+   private void compareByteArray(byte[] first, byte[] second, int length)
+   {
+      for (int i = 0; i < length; i++)
+      {
+         assertEquals(first[i], second[i]);
+      }
+   }
+}

http://git-wip-us.apache.org/repos/asf/activemq-6/blob/23e8edd9/activemq6-core-client/src/test/java/org/apache/activemq6/util/ConcurrentHashSetTest.java
----------------------------------------------------------------------
diff --git 
a/activemq6-core-client/src/test/java/org/apache/activemq6/util/ConcurrentHashSetTest.java
 
b/activemq6-core-client/src/test/java/org/apache/activemq6/util/ConcurrentHashSetTest.java
new file mode 100644
index 0000000..9c49640
--- /dev/null
+++ 
b/activemq6-core-client/src/test/java/org/apache/activemq6/util/ConcurrentHashSetTest.java
@@ -0,0 +1,157 @@
+/*
+ * Copyright 2005-2014 Red Hat, Inc.
+ * Red Hat 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.activemq6.util;
+import org.junit.Before;
+import org.junit.After;
+
+import org.junit.Test;
+
+import java.util.Iterator;
+
+import org.junit.Assert;
+
+
+import org.apache.activemq6.tests.util.RandomUtil;
+import org.apache.activemq6.utils.ConcurrentHashSet;
+import org.apache.activemq6.utils.ConcurrentSet;
+
+/**
+ * @author <a href="mailto:[email protected]";>Jeff Mesnil</a>
+ *
+ *
+ */
+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<String>();
+      element = RandomUtil.randomString();
+   }
+
+   @After
+   public void tearDown() throws Exception
+   {
+      set = null;
+      element = null;
+
+
+   }
+   // Package protected ---------------------------------------------
+
+   // Protected -----------------------------------------------------
+
+   // Private -------------------------------------------------------
+
+   // Inner classes -------------------------------------------------
+}

http://git-wip-us.apache.org/repos/asf/activemq-6/blob/23e8edd9/activemq6-core-client/src/test/java/org/apache/activemq6/util/TimeAndCounterIDGeneratorTest.java
----------------------------------------------------------------------
diff --git 
a/activemq6-core-client/src/test/java/org/apache/activemq6/util/TimeAndCounterIDGeneratorTest.java
 
b/activemq6-core-client/src/test/java/org/apache/activemq6/util/TimeAndCounterIDGeneratorTest.java
new file mode 100644
index 0000000..29b17ef
--- /dev/null
+++ 
b/activemq6-core-client/src/test/java/org/apache/activemq6/util/TimeAndCounterIDGeneratorTest.java
@@ -0,0 +1,201 @@
+/*
+ * Copyright 2005-2014 Red Hat, Inc.
+ * Red Hat 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.activemq6.util;
+
+import org.junit.Test;
+
+import java.util.concurrent.CountDownLatch;
+
+import org.junit.Assert;
+
+
+import org.apache.activemq6.tests.CoreUnitTestCase;
+import org.apache.activemq6.utils.ConcurrentHashSet;
+import org.apache.activemq6.utils.TimeAndCounterIDGenerator;
+
+/**
+ * A TimeAndCounterIDGeneratorTest
+ *
+ * @author <a href="mailto:[email protected]";>Clebert Suconic</a> 
Created 24-Sep-08 3:42:25 PM
+ */
+public class TimeAndCounterIDGeneratorTest extends Assert
+{
+
+   // Constants -----------------------------------------------------
+
+   // Attributes ----------------------------------------------------
+
+   // Static --------------------------------------------------------
+
+   // Constructors --------------------------------------------------
+
+   // Public --------------------------------------------------------
+
+   @Test
+   public void testCalculation()
+   {
+      TimeAndCounterIDGenerator seq = new TimeAndCounterIDGenerator();
+      long max = 11000;
+
+      long lastNr = 0;
+
+      for (long i = 0; i < max; i++)
+      {
+         long seqNr = seq.generateID();
+
+         Assert.assertTrue("The sequence generator should aways generate 
crescent numbers", seqNr > lastNr);
+
+         lastNr = seqNr;
+      }
+
+   }
+
+   @Test
+   public void testCalculationRefresh()
+   {
+      TimeAndCounterIDGenerator seq = new TimeAndCounterIDGenerator();
+
+      long id1 = seq.generateID();
+      Assert.assertEquals(1, id1 & 0xffff);
+      Assert.assertEquals(2, seq.generateID() & 0xffff);
+
+      seq.refresh();
+
+      long id2 = seq.generateID();
+
+      Assert.assertTrue(id2 > id1);
+
+      Assert.assertEquals(1, id2 & 0xffff);
+
+   }
+
+   @Test
+   public void testCalculationOnMultiThread() throws Throwable
+   {
+      final ConcurrentHashSet<Long> hashSet = new ConcurrentHashSet<Long>();
+
+      final TimeAndCounterIDGenerator seq = new TimeAndCounterIDGenerator();
+
+      System.out.println("Time = " + 
TimeAndCounterIDGeneratorTest.hex(System.currentTimeMillis()) + ", " + seq);
+
+      final int NUMBER_OF_THREADS = 100;
+
+      final int NUMBER_OF_IDS = 10;
+
+      final CountDownLatch latchAlign = new CountDownLatch(NUMBER_OF_THREADS);
+
+      final CountDownLatch latchStart = new CountDownLatch(1);
+
+      class T1 extends Thread
+      {
+         Throwable e;
+
+         @Override
+         public void run()
+         {
+            try
+            {
+               latchAlign.countDown();
+               CoreUnitTestCase.waitForLatch(latchStart);
+
+               long lastValue = 0L;
+               for (int i = 0; i < NUMBER_OF_IDS; i++)
+               {
+                  long value = seq.generateID();
+                  Assert.assertTrue(TimeAndCounterIDGeneratorTest.hex(value) + 
" should be greater than " +
+                                    
TimeAndCounterIDGeneratorTest.hex(lastValue) +
+                                    " on seq " +
+                                    seq.toString(), value > lastValue);
+                  lastValue = value;
+
+                  hashSet.add(value);
+               }
+            }
+            catch (Throwable e)
+            {
+               this.e = e;
+            }
+         }
+
+      }
+
+      T1[] arrays = new T1[NUMBER_OF_THREADS];
+
+      for (int i = 0; i < arrays.length; i++)
+      {
+         arrays[i] = new T1();
+         arrays[i].start();
+      }
+
+      CoreUnitTestCase.waitForLatch(latchAlign);
+
+      latchStart.countDown();
+
+      for (T1 t : arrays)
+      {
+         t.join();
+         if (t.e != null)
+         {
+            throw t.e;
+         }
+      }
+
+      Assert.assertEquals(NUMBER_OF_THREADS * NUMBER_OF_IDS, hashSet.size());
+
+      hashSet.clear();
+
+   }
+
+   @Test
+   public void testWrapID() throws Throwable
+   {
+      TimeAndCounterIDGenerator seq = new TimeAndCounterIDGenerator();
+
+      System.out.println("Current Time = " + 
TimeAndCounterIDGeneratorTest.hex(System.currentTimeMillis()) + " " + seq);
+
+      seq.setInternalDate(System.currentTimeMillis() + 10000L); // 10 seconds 
in the future
+
+      seq.setInternalID(TimeAndCounterIDGenerator.ID_MASK); // 1 ID about to 
explode
+
+      try
+      {
+         // This is simulating a situation where we generated more than 268 
million messages on the same time interval
+         seq.generateID();
+         Assert.fail("It was supposed to throw an exception, as the counter 
was set to explode on this test");
+      }
+      catch (Exception e)
+      {
+      }
+
+      seq = new TimeAndCounterIDGenerator();
+
+      seq.setInternalDate(System.currentTimeMillis() - 10000L); // 10 seconds 
in the past
+
+      long timeMark = seq.getInternalTimeMark();
+
+      seq.setInternalID(TimeAndCounterIDGenerator.ID_MASK); // 1 ID about to 
explode
+
+      // This is ok... the time portion would be added to the next one 
generated 10 seconds ago
+      seq.generateID();
+
+      Assert.assertTrue(TimeAndCounterIDGeneratorTest.hex(timeMark) + " < " +
+                                 
TimeAndCounterIDGeneratorTest.hex(seq.getInternalTimeMark()),
+                        timeMark < seq.getInternalTimeMark());
+   }
+
+   private static String hex(final long value)
+   {
+      return String.format("%1$X", value);
+   }
+
+}

http://git-wip-us.apache.org/repos/asf/activemq-6/blob/23e8edd9/activemq6-core-client/src/test/java/org/apache/activemq6/util/TypedPropertiesConversionTest.java
----------------------------------------------------------------------
diff --git 
a/activemq6-core-client/src/test/java/org/apache/activemq6/util/TypedPropertiesConversionTest.java
 
b/activemq6-core-client/src/test/java/org/apache/activemq6/util/TypedPropertiesConversionTest.java
new file mode 100644
index 0000000..defac6d
--- /dev/null
+++ 
b/activemq6-core-client/src/test/java/org/apache/activemq6/util/TypedPropertiesConversionTest.java
@@ -0,0 +1,372 @@
+/*
+ * Copyright 2005-2014 Red Hat, Inc.
+ * Red Hat 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.activemq6.util;
+import org.apache.activemq6.api.core.HornetQPropertyConversionException;
+import org.apache.activemq6.api.core.SimpleString;
+import org.apache.activemq6.tests.util.RandomUtil;
+import org.apache.activemq6.utils.TypedProperties;
+import org.junit.After;
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
+
+/**
+ * A TypedPropertiesConversionTest
+ *
+ * @author jmesnil
+ *
+ *
+ */
+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();
+   }
+
+   @After
+   public void tearDown() throws Exception
+   {
+      key = null;
+      props = null;
+
+
+   }
+
+   @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 (HornetQPropertyConversionException 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 (HornetQPropertyConversionException 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 (HornetQPropertyConversionException 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 (HornetQPropertyConversionException 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 (HornetQPropertyConversionException 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 (HornetQPropertyConversionException 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 (HornetQPropertyConversionException 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 (HornetQPropertyConversionException 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 (HornetQPropertyConversionException e)
+      {
+      }
+
+      Assert.assertNull(props.getBytesProperty(unknownKey));
+   }
+
+   // Package protected ---------------------------------------------
+
+   // Protected -----------------------------------------------------
+
+   // Private -------------------------------------------------------
+
+   // Inner classes -------------------------------------------------
+
+}

http://git-wip-us.apache.org/repos/asf/activemq-6/blob/23e8edd9/activemq6-core-client/src/test/java/org/apache/activemq6/util/TypedPropertiesTest.java
----------------------------------------------------------------------
diff --git 
a/activemq6-core-client/src/test/java/org/apache/activemq6/util/TypedPropertiesTest.java
 
b/activemq6-core-client/src/test/java/org/apache/activemq6/util/TypedPropertiesTest.java
new file mode 100644
index 0000000..72a63f2
--- /dev/null
+++ 
b/activemq6-core-client/src/test/java/org/apache/activemq6/util/TypedPropertiesTest.java
@@ -0,0 +1,248 @@
+/*
+ * Copyright 2005-2014 Red Hat, Inc.
+ * Red Hat 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.activemq6.util;
+import java.util.Iterator;
+
+import org.apache.activemq6.api.core.HornetQBuffer;
+import org.apache.activemq6.api.core.HornetQBuffers;
+import org.apache.activemq6.api.core.SimpleString;
+import org.apache.activemq6.tests.util.RandomUtil;
+import org.apache.activemq6.utils.TypedProperties;
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
+
+/**
+ * @author <a href="mailto:[email protected]";>Jeff Mesnil</a>
+ */
+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());
+
+      HornetQBuffer buffer = HornetQBuffers.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();
+
+      HornetQBuffer buffer = HornetQBuffers.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-6/blob/23e8edd9/activemq6-core-client/src/test/java/org/apache/activemq6/util/XMLUtilTest.java
----------------------------------------------------------------------
diff --git 
a/activemq6-core-client/src/test/java/org/apache/activemq6/util/XMLUtilTest.java
 
b/activemq6-core-client/src/test/java/org/apache/activemq6/util/XMLUtilTest.java
new file mode 100644
index 0000000..6153bca
--- /dev/null
+++ 
b/activemq6-core-client/src/test/java/org/apache/activemq6/util/XMLUtilTest.java
@@ -0,0 +1,276 @@
+/*
+ * Copyright 2005-2014 Red Hat, Inc.
+ * Red Hat 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.activemq6.util;
+
+import org.junit.Test;
+
+import org.junit.Assert;
+
+import org.apache.activemq6.tests.util.SilentTestCase;
+import org.apache.activemq6.utils.XMLUtil;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+
+/**
+ * @author <a href="mailto:[email protected]";>Ovidiu Feodorov</a>
+ */
+public class XMLUtilTest extends SilentTestCase
+{
+   // Constructors --------------------------------------------------
+
+   // Public --------------------------------------------------------
+
+   @Test
+   public void testGetTextContext_1() throws Exception
+   {
+      String document = "<blah>foo</blah>";
+
+      Element e = org.apache.activemq6.utils.XMLUtil.stringToElement(document);
+
+      Assert.assertEquals("foo", 
org.apache.activemq6.utils.XMLUtil.getTextContent(e));
+   }
+
+   @Test
+   public void testGetTextContext_2() throws Exception
+   {
+      String document = "<blah someattribute=\"somevalue\">foo</blah>";
+
+      Element e = XMLUtil.stringToElement(document);
+
+      Assert.assertEquals("foo", 
org.apache.activemq6.utils.XMLUtil.getTextContent(e));
+   }
+
+   @Test
+   public void testGetTextContext_3() throws Exception
+   {
+      String document = "<blah someattribute=\"somevalue\"><a/></blah>";
+
+      Element e = org.apache.activemq6.utils.XMLUtil.stringToElement(document);
+
+      String s = org.apache.activemq6.utils.XMLUtil.getTextContent(e);
+
+      Element subelement = 
org.apache.activemq6.utils.XMLUtil.stringToElement(s);
+
+      Assert.assertEquals("a", subelement.getNodeName());
+   }
+
+   @Test
+   public void testGetTextContext_4() throws Exception
+   {
+      String document = "<blah someattribute=\"somevalue\"><a></a></blah>";
+
+      Element e = org.apache.activemq6.utils.XMLUtil.stringToElement(document);
+
+      String s = org.apache.activemq6.utils.XMLUtil.getTextContent(e);
+
+      Element subelement = 
org.apache.activemq6.utils.XMLUtil.stringToElement(s);
+
+      Assert.assertEquals("a", subelement.getNodeName());
+   }
+
+   @Test
+   public void testGetTextContext_5() throws Exception
+   {
+      String document = "<blah someattribute=\"somevalue\"><a><b/></a></blah>";
+
+      Element e = org.apache.activemq6.utils.XMLUtil.stringToElement(document);
+
+      String s = org.apache.activemq6.utils.XMLUtil.getTextContent(e);
+
+      Element subelement = 
org.apache.activemq6.utils.XMLUtil.stringToElement(s);
+
+      Assert.assertEquals("a", subelement.getNodeName());
+      NodeList nl = subelement.getChildNodes();
+
+      // try to find <b>
+      boolean found = false;
+      for (int i = 0; i < nl.getLength(); i++)
+      {
+         Node n = nl.item(i);
+         if ("b".equals(n.getNodeName()))
+         {
+            found = true;
+         }
+      }
+      Assert.assertTrue(found);
+   }
+
+   @Test
+   public void testEquivalent_1() throws Exception
+   {
+      String s = "<a/>";
+      String s2 = "<a/>";
+
+      XMLUtil.assertEquivalent(XMLUtil.stringToElement(s), 
org.apache.activemq6.utils.XMLUtil.stringToElement(s2));
+   }
+
+   @Test
+   public void testEquivalent_2() throws Exception
+   {
+      String s = "<a></a>";
+      String s2 = "<a/>";
+
+      XMLUtil.assertEquivalent(XMLUtil.stringToElement(s), 
org.apache.activemq6.utils.XMLUtil.stringToElement(s2));
+   }
+
+   @Test
+   public void testEquivalent_3() throws Exception
+   {
+      String s = "<a attr1=\"val1\" attr2=\"val2\"/>";
+      String s2 = "<a attr2=\"val2\"/>";
+
+      try
+      {
+         
org.apache.activemq6.utils.XMLUtil.assertEquivalent(org.apache.activemq6.utils.XMLUtil.stringToElement(s),
+                                                    
XMLUtil.stringToElement(s2));
+         Assert.fail("this should throw exception");
+      }
+      catch (IllegalArgumentException e)
+      {
+         // expected
+      }
+   }
+
+   @Test
+   public void testEquivalent_4() throws Exception
+   {
+      String s = "<a attr1=\"val1\" attr2=\"val2\"/>";
+      String s2 = "<a attr2=\"val2\" attr1=\"val1\"/>";
+
+      
org.apache.activemq6.utils.XMLUtil.assertEquivalent(org.apache.activemq6.utils.XMLUtil.stringToElement(s),
+                                                 
org.apache.activemq6.utils.XMLUtil.stringToElement(s2));
+   }
+
+   @Test
+   public void testEquivalent_5() throws Exception
+   {
+      String s = "<a><b/></a>";
+      String s2 = "<a><b/></a>";
+
+      
org.apache.activemq6.utils.XMLUtil.assertEquivalent(org.apache.activemq6.utils.XMLUtil.stringToElement(s),
+                                                 
org.apache.activemq6.utils.XMLUtil.stringToElement(s2));
+   }
+
+   @Test
+   public void testEquivalent_6() throws Exception
+   {
+      String s = "<enclosing><a attr1=\"val1\" attr2=\"val2\"/></enclosing>";
+      String s2 = "<enclosing><a attr2=\"val2\" attr1=\"val1\"/></enclosing>";
+
+      
org.apache.activemq6.utils.XMLUtil.assertEquivalent(XMLUtil.stringToElement(s),
+                                                 
org.apache.activemq6.utils.XMLUtil.stringToElement(s2));
+   }
+
+   @Test
+   public void testEquivalent_7() throws Exception
+   {
+      String s = "<a><b/><c/></a>";
+      String s2 = "<a><c/><b/></a>";
+
+      try
+      {
+         
org.apache.activemq6.utils.XMLUtil.assertEquivalent(org.apache.activemq6.utils.XMLUtil.stringToElement(s),
+                                                    
org.apache.activemq6.utils.XMLUtil.stringToElement(s2));
+         Assert.fail("this should throw exception");
+      }
+      catch (IllegalArgumentException e)
+      {
+         // OK
+         e.printStackTrace();
+      }
+   }
+
+   @Test
+   public void testEquivalent_8() throws Exception
+   {
+      String s = "<a><!-- some comment --><b/><!--some other comment 
--><c/><!-- blah --></a>";
+      String s2 = "<a><b/><!--blah blah--><c/></a>";
+
+      
org.apache.activemq6.utils.XMLUtil.assertEquivalent(XMLUtil.stringToElement(s),
+                                                 
org.apache.activemq6.utils.XMLUtil.stringToElement(s2));
+   }
+
+   @Test
+   public void testElementToString_1() throws Exception
+   {
+      String s = "<a b=\"something\">somethingelse</a>";
+      Element e = org.apache.activemq6.utils.XMLUtil.stringToElement(s);
+      String tostring = org.apache.activemq6.utils.XMLUtil.elementToString(e);
+      Element convertedAgain = 
org.apache.activemq6.utils.XMLUtil.stringToElement(tostring);
+      org.apache.activemq6.utils.XMLUtil.assertEquivalent(e, convertedAgain);
+   }
+
+   @Test
+   public void testElementToString_2() throws Exception
+   {
+      String s = "<a b=\"something\"></a>";
+      Element e = org.apache.activemq6.utils.XMLUtil.stringToElement(s);
+      String tostring = XMLUtil.elementToString(e);
+      Element convertedAgain = XMLUtil.stringToElement(tostring);
+      XMLUtil.assertEquivalent(e, convertedAgain);
+   }
+
+   @Test
+   public void testElementToString_3() throws Exception
+   {
+      String s = "<a b=\"something\"/>";
+      Element e = org.apache.activemq6.utils.XMLUtil.stringToElement(s);
+      String tostring = XMLUtil.elementToString(e);
+      Element convertedAgain = 
org.apache.activemq6.utils.XMLUtil.stringToElement(tostring);
+      org.apache.activemq6.utils.XMLUtil.assertEquivalent(e, convertedAgain);
+   }
+
+   @Test
+   public void testElementToString_4() throws Exception
+   {
+      String s = "<a><![CDATA[somedata]]></a>";
+      Element e = org.apache.activemq6.utils.XMLUtil.stringToElement(s);
+      String tostring = XMLUtil.elementToString(e);
+      Element convertedAgain = 
org.apache.activemq6.utils.XMLUtil.stringToElement(tostring);
+      org.apache.activemq6.utils.XMLUtil.assertEquivalent(e, convertedAgain);
+   }
+
+   @Test
+   public void testReplaceSystemProperties()
+   {
+      String before = "<configuration>\n" + "   <test 
name=\"${sysprop1}\">content1</test>\n"
+                      + "   <test name=\"test2\">content2</test>\n"
+                      + "   <test name=\"test3\">content3</test>\n"
+                      + "   <test name=\"test4\">${sysprop2}</test>\n"
+                      + "   <test name=\"test5\">content5</test>\n"
+                      + "   <test name=\"test6\">content6</test>\n"
+                      + "</configuration>";
+      String after = "<configuration>\n" + "   <test 
name=\"test1\">content1</test>\n"
+                     + "   <test name=\"test2\">content2</test>\n"
+                     + "   <test name=\"test3\">content3</test>\n"
+                     + "   <test name=\"test4\">content4</test>\n"
+                     + "   <test name=\"test5\">content5</test>\n"
+                     + "   <test name=\"test6\">content6</test>\n"
+                     + "</configuration>";
+      System.setProperty("sysprop1", "test1");
+      System.setProperty("sysprop2", "content4");
+      String replaced = 
org.apache.activemq6.utils.XMLUtil.replaceSystemProps(before);
+      Assert.assertEquals(after, replaced);
+   }
+
+   @Test
+   public void testStripCDATA() throws Exception
+   {
+      String xml = "<![CDATA[somedata]]>";
+      String stripped = XMLUtil.stripCDATA(xml);
+
+      Assert.assertEquals("somedata", stripped);
+   }
+
+}

http://git-wip-us.apache.org/repos/asf/activemq-6/blob/23e8edd9/activemq6-dto/pom.xml
----------------------------------------------------------------------
diff --git a/activemq6-dto/pom.xml b/activemq6-dto/pom.xml
new file mode 100644
index 0000000..632b361
--- /dev/null
+++ b/activemq6-dto/pom.xml
@@ -0,0 +1,147 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0"; 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 
http://maven.apache.org/maven-v4_0_0.xsd";>
+   <modelVersion>4.0.0</modelVersion>
+
+   <parent>
+      <groupId>org.apache.activemq6</groupId>
+      <artifactId>activemq6-pom</artifactId>
+      <version>6.0.0-SNAPSHOT</version>
+   </parent>
+
+   <artifactId>activemq6-dto</artifactId>
+   <packaging>jar</packaging>
+   <name>ActiveMQ6 DTO</name>
+
+   <properties>
+     <hornetq.basedir>${project.basedir}/..</hornetq.basedir>
+   </properties>
+
+   <dependencies>
+      <dependency>
+        <groupId>com.fasterxml.jackson.core</groupId>
+        <artifactId>jackson-databind</artifactId>
+        <version>${jackson-databind.version}</version>
+      </dependency>
+   </dependencies>
+
+   <build>
+     <resources>
+       <resource>
+         <directory>target/schema</directory>
+         <includes>
+           <include>**/*</include>
+         </includes>
+       </resource>
+       <resource>
+         <directory>src/main/resources</directory>
+         <includes>
+           <include>**/*</include>
+         </includes>
+         <filtering>true</filtering>
+       </resource>
+     </resources>
+
+     <plugins>
+       <plugin>
+         <artifactId>maven-antrun-plugin</artifactId>
+         <version>1.7</version>
+         <executions>
+           <execution>
+             <phase>generate-resources</phase>
+             <configuration>
+               <tasks>
+                 <taskdef name="schemagen" 
classname="com.sun.tools.jxc.SchemaGenTask"/>
+                 <mkdir 
dir="${project.build.directory}/schema/org/hornetq/dto"/>
+                 <echo message="Generating XSD to: 
${project.build.directory}/schema/org/hornetq/dto"/>
+                 <schemagen srcdir="${basedir}/.." 
destdir="${project.build.directory}/schema/org/hornetq/dto"
+                            includeantruntime="false">
+                   <schema namespace="http://hornetq.org/schema"; 
file="hornetq.xsd"/>
+                   <classpath refid="maven.compile.classpath"/>
+                   <include name="**/package-info.java"/>
+                   <include name="**/*DTO.java"/>
+                   <exclude name="**/.git/**"/>
+                   <exclude name="**/.svn/**"/>
+                 </schemagen>
+                 <copy todir="${project.build.directory}/classes">
+                   <fileset dir="${project.build.directory}/schema"/>
+                 </copy>
+               </tasks>
+             </configuration>
+             <goals>
+               <goal>run</goal>
+             </goals>
+           </execution>
+         </executions>
+         <dependencies>
+            <dependency>
+               <groupId>javax.xml.bind</groupId>
+               <artifactId>jaxb-api</artifactId>
+               <version>2.2.7</version>
+            </dependency>
+            <dependency>
+               <groupId>com.sun.xml.bind</groupId>
+               <artifactId>jaxb-impl</artifactId>
+               <version>2.2.7</version>
+            </dependency>
+            <dependency>
+               <groupId>com.sun.xml.bind</groupId>
+               <artifactId>jaxb-jxc</artifactId>
+               <version>2.2.7</version>
+            </dependency>
+         </dependencies>
+       </plugin>
+     </plugins>
+   </build>
+
+   <profiles>
+     <profile>
+       <id>jdk-1.5</id>
+       <activation>
+         <jdk>1.5</jdk>
+       </activation>
+       <dependencies>
+         <dependency>
+           <groupId>javax.xml.bind</groupId>
+           <artifactId>jaxb-api</artifactId>
+           <version>${jaxb-api-version}</version>
+         </dependency>
+         <dependency>
+           <groupId>com.sun.xml.bind</groupId>
+           <artifactId>jaxb-impl</artifactId>
+           <version>${jaxb-version}</version>
+         </dependency>
+       </dependencies>
+     </profile>
+
+    <profile>
+       <id>ibmjdk</id>
+       <activation>
+         <file>
+           <exists>${java.home}/../lib/tools.jar</exists>
+         </file>
+       </activation>
+       <build>
+         <pluginManagement>
+           <plugins>
+             <plugin>
+               <groupId>org.apache.maven.plugins</groupId>
+               <artifactId>maven-antrun-plugin</artifactId>
+               <dependencies>
+                 <dependency>
+                   <groupId>com.sun</groupId>
+                   <artifactId>tools</artifactId>
+                   <!--the real JDK version could be 1.5 or 1.6-->
+                   <version>1.5.0</version>
+                   <scope>system</scope>
+                   <optional>true</optional>
+                   <systemPath>${java.home}/../lib/tools.jar</systemPath>
+                 </dependency>
+               </dependencies>
+             </plugin>
+           </plugins>
+         </pluginManagement>
+       </build>
+     </profile>
+   </profiles>
+
+</project>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/activemq-6/blob/23e8edd9/activemq6-dto/src/main/java/org/apache/activemq6/dto/BasicSecurityDTO.java
----------------------------------------------------------------------
diff --git 
a/activemq6-dto/src/main/java/org/apache/activemq6/dto/BasicSecurityDTO.java 
b/activemq6-dto/src/main/java/org/apache/activemq6/dto/BasicSecurityDTO.java
new file mode 100644
index 0000000..f414634
--- /dev/null
+++ b/activemq6-dto/src/main/java/org/apache/activemq6/dto/BasicSecurityDTO.java
@@ -0,0 +1,23 @@
+/*
+ * Copyright 2005-2014 Red Hat, Inc.
+ * Red Hat 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.activemq6.dto;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlRootElement;
+
+@XmlRootElement(name = "basic-security")
+@XmlAccessorType(XmlAccessType.FIELD)
+public class BasicSecurityDTO extends SecurityDTO
+{
+}

http://git-wip-us.apache.org/repos/asf/activemq-6/blob/23e8edd9/activemq6-dto/src/main/java/org/apache/activemq6/dto/BrokerDTO.java
----------------------------------------------------------------------
diff --git 
a/activemq6-dto/src/main/java/org/apache/activemq6/dto/BrokerDTO.java 
b/activemq6-dto/src/main/java/org/apache/activemq6/dto/BrokerDTO.java
new file mode 100644
index 0000000..9f9a720
--- /dev/null
+++ b/activemq6-dto/src/main/java/org/apache/activemq6/dto/BrokerDTO.java
@@ -0,0 +1,40 @@
+/*
+ * Copyright 2005-2014 Red Hat, Inc.
+ * Red Hat 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.activemq6.dto;
+
+import com.fasterxml.jackson.annotation.JsonTypeInfo;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElementRef;
+import javax.xml.bind.annotation.XmlRootElement;
+
+@XmlRootElement(name = "broker")
+@XmlAccessorType(XmlAccessType.FIELD)
+@JsonTypeInfo(use = JsonTypeInfo.Id.CUSTOM, include = 
JsonTypeInfo.As.PROPERTY, property = "@class")
+public class BrokerDTO
+{
+
+   @XmlElementRef
+   public CoreDTO core;
+
+   @XmlElementRef(required = false)
+   public JmsDTO jms;
+
+   @XmlElementRef
+   public SecurityDTO security;
+
+   @XmlElementRef
+   public NamingDTO naming;
+
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/activemq-6/blob/23e8edd9/activemq6-dto/src/main/java/org/apache/activemq6/dto/CoreDTO.java
----------------------------------------------------------------------
diff --git a/activemq6-dto/src/main/java/org/apache/activemq6/dto/CoreDTO.java 
b/activemq6-dto/src/main/java/org/apache/activemq6/dto/CoreDTO.java
new file mode 100644
index 0000000..682f51a
--- /dev/null
+++ b/activemq6-dto/src/main/java/org/apache/activemq6/dto/CoreDTO.java
@@ -0,0 +1,28 @@
+/*
+ * Copyright 2005-2014 Red Hat, Inc.
+ * Red Hat 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.activemq6.dto;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlAttribute;
+import javax.xml.bind.annotation.XmlRootElement;
+
+@XmlRootElement(name = "core")
+@XmlAccessorType(XmlAccessType.FIELD)
+public class CoreDTO
+{
+
+   @XmlAttribute
+   public String configuration;
+
+}

http://git-wip-us.apache.org/repos/asf/activemq-6/blob/23e8edd9/activemq6-dto/src/main/java/org/apache/activemq6/dto/JmsDTO.java
----------------------------------------------------------------------
diff --git a/activemq6-dto/src/main/java/org/apache/activemq6/dto/JmsDTO.java 
b/activemq6-dto/src/main/java/org/apache/activemq6/dto/JmsDTO.java
new file mode 100644
index 0000000..370c14c
--- /dev/null
+++ b/activemq6-dto/src/main/java/org/apache/activemq6/dto/JmsDTO.java
@@ -0,0 +1,29 @@
+/*
+ * Copyright 2005-2014 Red Hat, Inc.
+ * Red Hat 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.activemq6.dto;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlAttribute;
+import javax.xml.bind.annotation.XmlRootElement;
+
+@XmlRootElement(name = "jms")
+@XmlAccessorType(XmlAccessType.FIELD)
+public class JmsDTO
+{
+
+   @XmlAttribute
+   public String configuration;
+
+}
+

http://git-wip-us.apache.org/repos/asf/activemq-6/blob/23e8edd9/activemq6-dto/src/main/java/org/apache/activemq6/dto/NamingDTO.java
----------------------------------------------------------------------
diff --git 
a/activemq6-dto/src/main/java/org/apache/activemq6/dto/NamingDTO.java 
b/activemq6-dto/src/main/java/org/apache/activemq6/dto/NamingDTO.java
new file mode 100644
index 0000000..e28351b
--- /dev/null
+++ b/activemq6-dto/src/main/java/org/apache/activemq6/dto/NamingDTO.java
@@ -0,0 +1,35 @@
+/*
+ * Copyright 2005-2014 Red Hat, Inc.
+ * Red Hat 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.activemq6.dto;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlAttribute;
+import javax.xml.bind.annotation.XmlRootElement;
+
+@XmlRootElement(name = "naming")
+@XmlAccessorType(XmlAccessType.FIELD)
+public class NamingDTO
+{
+   @XmlAttribute
+   public String bindAddress = "localhost";
+
+   @XmlAttribute
+   public int port = 1099;
+
+   @XmlAttribute
+   public String rmiBindAddress = "localhost";
+
+   @XmlAttribute
+   public int rmiPort = 1098;
+}

http://git-wip-us.apache.org/repos/asf/activemq-6/blob/23e8edd9/activemq6-dto/src/main/java/org/apache/activemq6/dto/SecurityDTO.java
----------------------------------------------------------------------
diff --git 
a/activemq6-dto/src/main/java/org/apache/activemq6/dto/SecurityDTO.java 
b/activemq6-dto/src/main/java/org/apache/activemq6/dto/SecurityDTO.java
new file mode 100644
index 0000000..d0042cd
--- /dev/null
+++ b/activemq6-dto/src/main/java/org/apache/activemq6/dto/SecurityDTO.java
@@ -0,0 +1,26 @@
+/*
+ * Copyright 2005-2014 Red Hat, Inc.
+ * Red Hat 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.activemq6.dto;
+
+import com.fasterxml.jackson.annotation.JsonTypeInfo;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlType;
+
+@XmlType(name = "security")
+@XmlAccessorType(XmlAccessType.FIELD)
+@JsonTypeInfo(use = JsonTypeInfo.Id.CUSTOM, include = 
JsonTypeInfo.As.PROPERTY, property = "@class")
+public class SecurityDTO
+{
+}

http://git-wip-us.apache.org/repos/asf/activemq-6/blob/23e8edd9/activemq6-dto/src/main/java/org/apache/activemq6/dto/XmlUtil.java
----------------------------------------------------------------------
diff --git a/activemq6-dto/src/main/java/org/apache/activemq6/dto/XmlUtil.java 
b/activemq6-dto/src/main/java/org/apache/activemq6/dto/XmlUtil.java
new file mode 100644
index 0000000..923d8d5
--- /dev/null
+++ b/activemq6-dto/src/main/java/org/apache/activemq6/dto/XmlUtil.java
@@ -0,0 +1,106 @@
+/*
+ * Copyright 2005-2014 Red Hat, Inc.
+ * Red Hat 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.activemq6.dto;
+
+import javax.xml.XMLConstants;
+import javax.xml.bind.JAXBContext;
+import javax.xml.bind.Unmarshaller;
+import javax.xml.stream.XMLInputFactory;
+import javax.xml.stream.XMLStreamReader;
+import javax.xml.stream.util.StreamReaderDelegate;
+import javax.xml.transform.stream.StreamSource;
+import javax.xml.validation.Schema;
+import javax.xml.validation.SchemaFactory;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.InputStream;
+import java.util.Properties;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+public class XmlUtil
+{
+
+   /**
+    * Changes ${property} with values from a properties object
+    */
+   static class PropertiesFilter extends StreamReaderDelegate
+   {
+
+      static final Pattern pattern = Pattern.compile("\\$\\{([^\\}]+)\\}");
+      private final Properties props;
+
+      public PropertiesFilter(XMLStreamReader parent, Properties props)
+      {
+         super(parent);
+         this.props = props;
+      }
+
+      public String getAttributeValue(int index)
+      {
+         return filter(super.getAttributeValue(index));
+      }
+
+      public String filter(String str)
+      {
+         int start = 0;
+         while (true)
+         {
+            Matcher matcher = pattern.matcher(str);
+            if (!matcher.find(start))
+            {
+               break;
+            }
+            String group = matcher.group(1);
+            String property = props.getProperty(group);
+            if (property != null)
+            {
+               str = matcher.replaceFirst(Matcher.quoteReplacement(property));
+            }
+            else
+            {
+               start = matcher.end();
+            }
+         }
+         return str;
+      }
+
+   }
+
+   private static final XMLInputFactory factory = 
XMLInputFactory.newInstance();
+
+   public static <T> T decode(Class<T> clazz, File configuration) throws 
Exception
+   {
+      JAXBContext jaxbContext = 
JAXBContext.newInstance("org.apache.activemq6.dto");
+
+      Unmarshaller unmarshaller = jaxbContext.createUnmarshaller();
+      SchemaFactory sf = 
SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
+      
sf.setFeature("http://apache.org/xml/features/validation/schema-full-checking";, 
false);
+      InputStream xsdStream = 
XmlUtil.class.getClassLoader().getResourceAsStream("org.apache.activemq6/dto/hornetq.xsd");
+      StreamSource xsdSource = new StreamSource(xsdStream);
+      Schema schema = sf.newSchema(xsdSource);
+      unmarshaller.setSchema(schema);
+
+      XMLStreamReader reader = factory.createXMLStreamReader(new 
FileInputStream(configuration));
+      //TODO - support properties files
+      Properties props = System.getProperties();
+
+      if (props != null)
+      {
+         reader = new PropertiesFilter(reader, props);
+      }
+
+      return clazz.cast(unmarshaller.unmarshal(reader));
+   }
+
+}

http://git-wip-us.apache.org/repos/asf/activemq-6/blob/23e8edd9/activemq6-dto/src/main/java/org/apache/activemq6/dto/package-info.java
----------------------------------------------------------------------
diff --git 
a/activemq6-dto/src/main/java/org/apache/activemq6/dto/package-info.java 
b/activemq6-dto/src/main/java/org/apache/activemq6/dto/package-info.java
new file mode 100644
index 0000000..698e2cc
--- /dev/null
+++ b/activemq6-dto/src/main/java/org/apache/activemq6/dto/package-info.java
@@ -0,0 +1,19 @@
+/*
+ * Copyright 2005-2014 Red Hat, Inc.
+ * Red Hat 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.
+ */
+/**
+ * The JAXB POJOs for the XML configuration of HornetQ broker
+ */
[email protected](
+        namespace = "http://hornetq.org/schema";,
+        elementFormDefault = javax.xml.bind.annotation.XmlNsForm.QUALIFIED)
+package org.apache.activemq6.dto;
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/activemq-6/blob/23e8edd9/activemq6-dto/src/main/resources/org/apache/activemq6/dto/jaxb.index
----------------------------------------------------------------------
diff --git 
a/activemq6-dto/src/main/resources/org/apache/activemq6/dto/jaxb.index 
b/activemq6-dto/src/main/resources/org/apache/activemq6/dto/jaxb.index
new file mode 100644
index 0000000..3cec94b
--- /dev/null
+++ b/activemq6-dto/src/main/resources/org/apache/activemq6/dto/jaxb.index
@@ -0,0 +1,19 @@
+## ---------------------------------------------------------------------------
+## Copyright 2005-2014 Red Hat, Inc.
+## Red Hat 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.
+## ---------------------------------------------------------------------------
+BrokerDTO
+CoreDTO
+JmsDTO
+SecurityDTO
+BasicSecurityDTO
+NamingDTO
+

http://git-wip-us.apache.org/repos/asf/activemq-6/blob/23e8edd9/activemq6-jms-client/pom.xml
----------------------------------------------------------------------
diff --git a/activemq6-jms-client/pom.xml b/activemq6-jms-client/pom.xml
new file mode 100644
index 0000000..f8565e2
--- /dev/null
+++ b/activemq6-jms-client/pom.xml
@@ -0,0 +1,76 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0"; 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 
http://maven.apache.org/maven-v4_0_0.xsd";>
+   <modelVersion>4.0.0</modelVersion>
+
+   <parent>
+      <groupId>org.apache.activemq6</groupId>
+      <artifactId>activemq6-pom</artifactId>
+      <version>6.0.0-SNAPSHOT</version>
+   </parent>
+
+   <artifactId>activemq6-jms-client</artifactId>
+   <packaging>jar</packaging>
+   <name>ActiveMQ6 JMS Client</name>
+
+   <properties>
+      <hornetq.basedir>${project.basedir}/..</hornetq.basedir>
+   </properties>
+
+   <dependencies>
+      <dependency>
+         <groupId>org.jboss.logging</groupId>
+         <artifactId>jboss-logging-processor</artifactId>
+      </dependency>
+      <dependency>
+         <groupId>org.apache.activemq6</groupId>
+         <artifactId>activemq6-core-client</artifactId>
+         <version>${project.version}</version>
+      </dependency>
+      <dependency>
+         <groupId>org.jboss.spec.javax.jms</groupId>
+         <artifactId>jboss-jms-api_2.0_spec</artifactId>
+      </dependency>
+      <dependency>
+         <groupId>javax.inject</groupId>
+         <artifactId>javax.inject</artifactId>
+      </dependency>
+   </dependencies>
+
+   <profiles>
+      <profile>
+         <id>release</id>
+         <build>
+            <plugins>
+               <plugin>
+                  <groupId>org.apache.maven.plugins</groupId>
+                  <artifactId>maven-javadoc-plugin</artifactId>
+                  <version>2.9</version>
+                  <configuration>
+                     <doclet>org.jboss.apiviz.APIviz</doclet>
+                     <docletArtifact>
+                        <groupId>org.jboss.apiviz</groupId>
+                        <artifactId>apiviz</artifactId>
+                        <version>1.3.2.GA</version>
+                     </docletArtifact>
+                     <useStandardDocletOptions>true</useStandardDocletOptions>
+                     <minmemory>128m</minmemory>
+                     <maxmemory>512m</maxmemory>
+                     <quiet>false</quiet>
+                     <aggregate>true</aggregate>
+                     
<excludePackageNames>org.hornetq.core:org.hornetq.utils</excludePackageNames>
+                  </configuration>
+                  <executions>
+                     <execution>
+                        <id>javadocs</id>
+                        <goals>
+                           <goal>jar</goal>
+                        </goals>
+                     </execution>
+                  </executions>
+               </plugin>
+            </plugins>
+         </build>
+      </profile>
+   </profiles>
+
+</project>

Reply via email to