You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@activemq.apache.org by an...@apache.org on 2015/03/09 10:25:08 UTC

[1/5] activemq-6 git commit: Fixing ServiceLocator on the testsuite

Repository: activemq-6
Updated Branches:
  refs/heads/master 3c9956235 -> 10bb4568c


Fixing ServiceLocator on the testsuite

My previous commit broke the location of the ServiceUtil / TransactionManagerLocator
This commit is setting a new DummyTM on the integration-tests-suite and the proper TM Locator on the extra-tests


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

Branch: refs/heads/master
Commit: d101bcbf59bdbd1ad587b65c39903bcd70092fb4
Parents: 3c99562
Author: Clebert Suconic <cl...@apache.org>
Authored: Fri Mar 6 22:17:14 2015 -0500
Committer: Clebert Suconic <cl...@apache.org>
Committed: Fri Mar 6 22:57:04 2015 -0500

----------------------------------------------------------------------
 ...sions.transactions.TransactionManagerLocator |   1 +
 .../largemessage/LargeMessageTestBase.java      | 705 -------------------
 .../DummyTransactionManagerLocator.java         |  94 +++
 .../TransactionManagerLocatorTest.java          |  35 +
 ...sions.transactions.TransactionManagerLocator |   2 +-
 5 files changed, 131 insertions(+), 706 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/activemq-6/blob/d101bcbf/tests/extra-tests/src/test/resources/META-INF/services/org.apache.activemq.service.extensions.transactions.TransactionManagerLocator
----------------------------------------------------------------------
diff --git a/tests/extra-tests/src/test/resources/META-INF/services/org.apache.activemq.service.extensions.transactions.TransactionManagerLocator b/tests/extra-tests/src/test/resources/META-INF/services/org.apache.activemq.service.extensions.transactions.TransactionManagerLocator
new file mode 100644
index 0000000..e9ef6bf
--- /dev/null
+++ b/tests/extra-tests/src/test/resources/META-INF/services/org.apache.activemq.service.extensions.transactions.TransactionManagerLocator
@@ -0,0 +1 @@
+org.apache.activemq.tests.extras.jms.bridge.TransactionManagerLocatorImpl

http://git-wip-us.apache.org/repos/asf/activemq-6/blob/d101bcbf/tests/integration-tests/src/test/java/org/apache/activemq/tests/largemessage/LargeMessageTestBase.java
----------------------------------------------------------------------
diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/tests/largemessage/LargeMessageTestBase.java b/tests/integration-tests/src/test/java/org/apache/activemq/tests/largemessage/LargeMessageTestBase.java
deleted file mode 100644
index 89cb696..0000000
--- a/tests/integration-tests/src/test/java/org/apache/activemq/tests/largemessage/LargeMessageTestBase.java
+++ /dev/null
@@ -1,705 +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.tests.largemessage;
-
-import javax.transaction.xa.XAResource;
-import javax.transaction.xa.Xid;
-import java.io.IOException;
-import java.io.OutputStream;
-import java.util.concurrent.CountDownLatch;
-import java.util.concurrent.TimeUnit;
-import java.util.concurrent.atomic.AtomicInteger;
-import java.util.concurrent.atomic.AtomicLong;
-
-import org.apache.activemq.api.core.ActiveMQBuffer;
-import org.apache.activemq.api.core.ActiveMQBuffers;
-import org.apache.activemq.api.core.ActiveMQException;
-import org.apache.activemq.api.core.Message;
-import org.apache.activemq.api.core.SimpleString;
-import org.apache.activemq.api.core.client.ClientConsumer;
-import org.apache.activemq.api.core.client.ClientMessage;
-import org.apache.activemq.api.core.client.ClientProducer;
-import org.apache.activemq.api.core.client.ClientSession;
-import org.apache.activemq.api.core.client.ClientSessionFactory;
-import org.apache.activemq.api.core.client.MessageHandler;
-import org.apache.activemq.api.core.client.ServerLocator;
-import org.apache.activemq.core.server.ActiveMQServer;
-import org.apache.activemq.core.server.Queue;
-import org.apache.activemq.tests.integration.IntegrationTestLogger;
-import org.apache.activemq.tests.util.ServiceTestBase;
-import org.apache.activemq.tests.util.UnitTestCase;
-import org.apache.activemq.utils.DataConstants;
-import org.junit.After;
-import org.junit.Assert;
-
-/**
- * A LargeMessageTestBase
- *
- * @author <a href="mailto:clebert.suconic@jboss.org">Clebert Suconic</a>
- *         <p/>
- *         Created Oct 29, 2008 11:43:52 AM
- */
-public abstract class LargeMessageTestBase extends ServiceTestBase
-{
-
-   // Constants -----------------------------------------------------
-   private static final IntegrationTestLogger log = IntegrationTestLogger.LOGGER;
-
-   protected final SimpleString ADDRESS = new SimpleString("SimpleAddress");
-
-   protected ActiveMQServer server;
-
-   // Attributes ----------------------------------------------------
-
-   // Static --------------------------------------------------------
-
-   // Constructors --------------------------------------------------
-
-   // Public --------------------------------------------------------
-
-   // Package protected ---------------------------------------------
-
-   // Protected -----------------------------------------------------
-
-   @Override
-   @After
-   public void tearDown() throws Exception
-   {
-      if (server != null && server.isStarted())
-      {
-         try
-         {
-            server.stop();
-         }
-         catch (Exception e)
-         {
-            LargeMessageTestBase.log.warn(e.getMessage(), e);
-         }
-      }
-
-      server = null;
-
-      super.tearDown();
-   }
-
-   protected void testChunks(final boolean isXA,
-                             final boolean restartOnXA,
-                             final boolean rollbackFirstSend,
-                             final boolean useStreamOnConsume,
-                             final boolean realFiles,
-                             final boolean preAck,
-                             final boolean sendingBlocking,
-                             final boolean testBrowser,
-                             final boolean useMessageConsumer,
-                             final int numberOfMessages,
-                             final long numberOfBytes,
-                             final int waitOnConsumer,
-                             final long delayDelivery) throws Exception
-   {
-      testChunks(isXA,
-                 restartOnXA,
-                 rollbackFirstSend,
-                 useStreamOnConsume,
-                 realFiles,
-                 preAck,
-                 sendingBlocking,
-                 testBrowser,
-                 useMessageConsumer,
-                 numberOfMessages,
-                 numberOfBytes,
-                 waitOnConsumer,
-                 delayDelivery,
-                 -1,
-                 10 * 1024);
-   }
-
-   protected void testChunks(final boolean isXA,
-                             final boolean restartOnXA,
-                             final boolean rollbackFirstSend,
-                             final boolean useStreamOnConsume,
-                             final boolean realFiles,
-                             final boolean preAck,
-                             final boolean sendingBlocking,
-                             final boolean testBrowser,
-                             final boolean useMessageConsumer,
-                             final int numberOfMessages,
-                             final long numberOfBytes,
-                             final int waitOnConsumer,
-                             final long delayDelivery,
-                             final int producerWindow,
-                             final int minSize) throws Exception
-   {
-      clearDataRecreateServerDirs();
-
-      server = createServer(realFiles);
-      server.start();
-
-      ServerLocator locator = createInVMNonHALocator();
-      try
-      {
-
-         if (sendingBlocking)
-         {
-            locator.setBlockOnNonDurableSend(true);
-            locator.setBlockOnDurableSend(true);
-            locator.setBlockOnAcknowledge(true);
-         }
-
-         if (producerWindow > 0)
-         {
-            locator.setConfirmationWindowSize(producerWindow);
-         }
-
-         locator.setMinLargeMessageSize(minSize);
-
-         ClientSessionFactory sf = locator.createSessionFactory();
-
-         ClientSession session;
-
-         Xid xid = null;
-         session = sf.createSession(null, null, isXA, false, false, preAck, 0);
-
-         if (isXA)
-         {
-            xid = newXID();
-            session.start(xid, XAResource.TMNOFLAGS);
-         }
-
-         session.createQueue(ADDRESS, ADDRESS, null, true);
-
-         ClientProducer producer = session.createProducer(ADDRESS);
-
-         if (rollbackFirstSend)
-         {
-            sendMessages(numberOfMessages, numberOfBytes, delayDelivery, session, producer);
-
-            if (isXA)
-            {
-               session.end(xid, XAResource.TMSUCCESS);
-               session.prepare(xid);
-
-               session.close();
-
-               if (realFiles && restartOnXA)
-               {
-                  server.stop();
-                  server.start();
-                  sf = locator.createSessionFactory();
-               }
-
-               session = sf.createSession(null, null, isXA, false, false, preAck, 0);
-
-               Xid[] xids = session.recover(XAResource.TMSTARTRSCAN);
-               Assert.assertEquals(1, xids.length);
-               Assert.assertEquals(xid, xids[0]);
-
-               session.rollback(xid);
-               producer = session.createProducer(ADDRESS);
-               xid = newXID();
-               session.start(xid, XAResource.TMNOFLAGS);
-            }
-            else
-            {
-               session.rollback();
-            }
-
-            validateNoFilesOnLargeDir();
-         }
-
-         sendMessages(numberOfMessages, numberOfBytes, delayDelivery, session, producer);
-
-         if (isXA)
-         {
-            session.end(xid, XAResource.TMSUCCESS);
-            session.prepare(xid);
-
-            session.close();
-
-            if (realFiles && restartOnXA)
-            {
-               server.stop();
-               server.start();
-               //we need to recreate sf's
-               sf = locator.createSessionFactory();
-            }
-
-            session = sf.createSession(null, null, isXA, false, false, preAck, 0);
-
-            Xid[] xids = session.recover(XAResource.TMSTARTRSCAN);
-            Assert.assertEquals(1, xids.length);
-            Assert.assertEquals(xid, xids[0]);
-
-            producer = session.createProducer(ADDRESS);
-
-            session.commit(xid, false);
-            xid = newXID();
-            session.start(xid, XAResource.TMNOFLAGS);
-         }
-         else
-         {
-            session.commit();
-         }
-
-         session.close();
-
-         if (realFiles)
-         {
-            server.stop();
-
-            server = createServer(realFiles);
-            server.start();
-
-            sf = locator.createSessionFactory();
-         }
-
-         session = sf.createSession(null, null, isXA, false, false, preAck, 0);
-
-         if (isXA)
-         {
-            xid = newXID();
-            session.start(xid, XAResource.TMNOFLAGS);
-         }
-
-         ClientConsumer consumer = null;
-
-         for (int iteration = testBrowser ? 0 : 1; iteration < 2; iteration++)
-         {
-            session.stop();
-
-            // first time with a browser
-            consumer = session.createConsumer(ADDRESS, null, iteration == 0);
-
-            if (useMessageConsumer)
-            {
-               final CountDownLatch latchDone = new CountDownLatch(numberOfMessages);
-               final AtomicInteger errors = new AtomicInteger(0);
-
-               MessageHandler handler = new MessageHandler()
-               {
-                  int msgCounter;
-
-                  public void onMessage(final ClientMessage message)
-                  {
-                     try
-                     {
-                        if (delayDelivery > 0)
-                        {
-                           long originalTime = (Long) message.getObjectProperty(new SimpleString("original-time"));
-                           Assert.assertTrue(System.currentTimeMillis() - originalTime + "<" + delayDelivery,
-                                             System.currentTimeMillis() - originalTime >= delayDelivery);
-                        }
-
-                        if (!preAck)
-                        {
-                           message.acknowledge();
-                        }
-
-                        Assert.assertNotNull(message);
-
-                        if (delayDelivery <= 0)
-                        {
-                           // right now there is no guarantee of ordered delivered on multiple scheduledMessages with
-                           // the same
-                           // scheduled delivery time
-                           Assert.assertEquals(msgCounter,
-                                               ((Integer) message.getObjectProperty(new SimpleString("counter-message"))).intValue());
-                        }
-
-                        if (useStreamOnConsume)
-                        {
-                           final AtomicLong bytesRead = new AtomicLong(0);
-                           message.saveToOutputStream(new OutputStream()
-                           {
-
-                              @Override
-                              public void write(final byte[] b) throws IOException
-                              {
-                                 if (b[0] == UnitTestCase.getSamplebyte(bytesRead.get()))
-                                 {
-                                    bytesRead.addAndGet(b.length);
-                                    LargeMessageTestBase.log.debug("Read position " + bytesRead.get() + " on consumer");
-                                 }
-                                 else
-                                 {
-                                    LargeMessageTestBase.log.warn("Received invalid packet at position " + bytesRead.get());
-                                 }
-                              }
-
-                              @Override
-                              public void write(final int b) throws IOException
-                              {
-                                 if (b == UnitTestCase.getSamplebyte(bytesRead.get()))
-                                 {
-                                    bytesRead.incrementAndGet();
-                                 }
-                                 else
-                                 {
-                                    LargeMessageTestBase.log.warn("byte not as expected!");
-                                 }
-                              }
-                           });
-
-                           Assert.assertEquals(numberOfBytes, bytesRead.get());
-                        }
-                        else
-                        {
-
-                           ActiveMQBuffer buffer = message.getBodyBuffer();
-                           buffer.resetReaderIndex();
-                           for (long b = 0; b < numberOfBytes; b++)
-                           {
-                              if (b % (1024L * 1024L) == 0)
-                              {
-                                 LargeMessageTestBase.log.debug("Read " + b + " bytes");
-                              }
-
-                              Assert.assertEquals(UnitTestCase.getSamplebyte(b), buffer.readByte());
-                           }
-
-                           try
-                           {
-                              buffer.readByte();
-                              Assert.fail("Supposed to throw an exception");
-                           }
-                           catch (Exception e)
-                           {
-                           }
-                        }
-                     }
-                     catch (Throwable e)
-                     {
-                        e.printStackTrace();
-                        LargeMessageTestBase.log.warn("Got an error", e);
-                        errors.incrementAndGet();
-                     }
-                     finally
-                     {
-                        latchDone.countDown();
-                        msgCounter++;
-                     }
-                  }
-               };
-
-               session.start();
-
-               consumer.setMessageHandler(handler);
-
-               Assert.assertTrue(latchDone.await(waitOnConsumer, TimeUnit.SECONDS));
-               Assert.assertEquals(0, errors.get());
-            }
-            else
-            {
-
-               session.start();
-
-               for (int i = 0; i < numberOfMessages; i++)
-               {
-                  System.currentTimeMillis();
-
-                  ClientMessage message = consumer.receive(waitOnConsumer + delayDelivery);
-
-                  Assert.assertNotNull(message);
-
-                  System.currentTimeMillis();
-
-                  if (delayDelivery > 0)
-                  {
-                     long originalTime = (Long) message.getObjectProperty(new SimpleString("original-time"));
-                     Assert.assertTrue(System.currentTimeMillis() - originalTime + "<" + delayDelivery,
-                                       System.currentTimeMillis() - originalTime >= delayDelivery);
-                  }
-
-                  if (!preAck)
-                  {
-                     message.acknowledge();
-                  }
-
-                  Assert.assertNotNull(message);
-
-                  if (delayDelivery <= 0)
-                  {
-                     // right now there is no guarantee of ordered delivered on multiple scheduledMessages with the same
-                     // scheduled delivery time
-                     Assert.assertEquals(i,
-                                         ((Integer) message.getObjectProperty(new SimpleString("counter-message"))).intValue());
-                  }
-
-                  if (useStreamOnConsume)
-                  {
-                     final AtomicLong bytesRead = new AtomicLong(0);
-                     message.saveToOutputStream(new OutputStream()
-                     {
-
-                        @Override
-                        public void write(final byte[] b) throws IOException
-                        {
-                           if (b[0] == UnitTestCase.getSamplebyte(bytesRead.get()))
-                           {
-                              bytesRead.addAndGet(b.length);
-                           }
-                           else
-                           {
-                              LargeMessageTestBase.log.warn("Received invalid packet at position " + bytesRead.get());
-                           }
-
-                        }
-
-                        @Override
-                        public void write(final int b) throws IOException
-                        {
-                           if (bytesRead.get() % (1024L * 1024L) == 0)
-                           {
-                              LargeMessageTestBase.log.debug("Read " + bytesRead.get() + " bytes");
-                           }
-                           if (b == (byte) 'a')
-                           {
-                              bytesRead.incrementAndGet();
-                           }
-                           else
-                           {
-                              LargeMessageTestBase.log.warn("byte not as expected!");
-                           }
-                        }
-                     });
-
-                     Assert.assertEquals(numberOfBytes, bytesRead.get());
-                  }
-                  else
-                  {
-                     ActiveMQBuffer buffer = message.getBodyBuffer();
-                     buffer.resetReaderIndex();
-
-                     for (long b = 0; b < numberOfBytes; b++)
-                     {
-                        if (b % (1024L * 1024L) == 0L)
-                        {
-                           LargeMessageTestBase.log.debug("Read " + b + " bytes");
-                        }
-                        Assert.assertEquals(UnitTestCase.getSamplebyte(b), buffer.readByte());
-                     }
-                  }
-
-               }
-
-            }
-            consumer.close();
-
-            if (iteration == 0)
-            {
-               if (isXA)
-               {
-                  session.end(xid, XAResource.TMSUCCESS);
-                  session.rollback(xid);
-                  xid = newXID();
-                  session.start(xid, XAResource.TMNOFLAGS);
-               }
-               else
-               {
-                  session.rollback();
-               }
-            }
-            else
-            {
-               if (isXA)
-               {
-                  session.end(xid, XAResource.TMSUCCESS);
-                  session.commit(xid, true);
-                  xid = newXID();
-                  session.start(xid, XAResource.TMNOFLAGS);
-               }
-               else
-               {
-                  session.commit();
-               }
-            }
-         }
-
-         session.close();
-
-         Assert.assertEquals(0, ((Queue) server.getPostOffice().getBinding(ADDRESS).getBindable()).getDeliveringCount());
-         Assert.assertEquals(0, getMessageCount((Queue) server.getPostOffice().getBinding(ADDRESS).getBindable()));
-
-         validateNoFilesOnLargeDir();
-
-      }
-      finally
-      {
-         locator.close();
-         try
-         {
-            server.stop();
-         }
-         catch (Throwable ignored)
-         {
-         }
-      }
-   }
-
-   /**
-    * @param numberOfMessages
-    * @param numberOfBytes
-    * @param delayDelivery
-    * @param session
-    * @param producer
-    * @throws FileNotFoundException
-    * @throws IOException
-    * @throws org.apache.activemq.api.core.ActiveMQException
-    */
-   private void sendMessages(final int numberOfMessages,
-                             final long numberOfBytes,
-                             final long delayDelivery,
-                             final ClientSession session,
-                             final ClientProducer producer) throws Exception
-   {
-      LargeMessageTestBase.log.debug("NumberOfBytes = " + numberOfBytes);
-      for (int i = 0; i < numberOfMessages; i++)
-      {
-         ClientMessage message = session.createMessage(true);
-
-         // If the test is using more than 1M, we will only use the Streaming, as it require too much memory from the
-         // test
-         if (numberOfBytes > 1024 * 1024 || i % 2 == 0)
-         {
-            LargeMessageTestBase.log.debug("Sending message (stream)" + i);
-            message.setBodyInputStream(UnitTestCase.createFakeLargeStream(numberOfBytes));
-         }
-         else
-         {
-            LargeMessageTestBase.log.debug("Sending message (array)" + i);
-            byte[] bytes = new byte[(int) numberOfBytes];
-            for (int j = 0; j < bytes.length; j++)
-            {
-               bytes[j] = UnitTestCase.getSamplebyte(j);
-            }
-            message.getBodyBuffer().writeBytes(bytes);
-         }
-         message.putIntProperty(new SimpleString("counter-message"), i);
-         if (delayDelivery > 0)
-         {
-            long time = System.currentTimeMillis();
-            message.putLongProperty(new SimpleString("original-time"), time);
-            message.putLongProperty(Message.HDR_SCHEDULED_DELIVERY_TIME, time + delayDelivery);
-
-            producer.send(message);
-         }
-         else
-         {
-            producer.send(message);
-         }
-      }
-   }
-
-   protected ActiveMQBuffer createLargeBuffer(final int numberOfIntegers)
-   {
-      ActiveMQBuffer body = ActiveMQBuffers.fixedBuffer(DataConstants.SIZE_INT * numberOfIntegers);
-
-      for (int i = 0; i < numberOfIntegers; i++)
-      {
-         body.writeInt(i);
-      }
-
-      return body;
-
-   }
-
-   protected ClientMessage createLargeClientMessage(final ClientSession session, final int numberOfBytes) throws Exception
-   {
-      return createLargeClientMessage(session, numberOfBytes, true);
-   }
-
-   protected ClientMessage createLargeClientMessage(final ClientSession session, final byte[] buffer, final boolean durable) throws Exception
-   {
-      ClientMessage msgs = session.createMessage(durable);
-      msgs.getBodyBuffer().writeBytes(buffer);
-      return msgs;
-   }
-
-   protected ClientMessage createLargeClientMessage(final ClientSession session,
-                                                    final long numberOfBytes,
-                                                    final boolean persistent) throws Exception
-   {
-
-      ClientMessage clientMessage = session.createMessage(persistent);
-
-      clientMessage.setBodyInputStream(UnitTestCase.createFakeLargeStream(numberOfBytes));
-
-      return clientMessage;
-   }
-
-   /**
-    * @param session
-    * @param queueToRead
-    * @param numberOfBytes
-    * @throws org.apache.activemq.api.core.ActiveMQException
-    * @throws FileNotFoundException
-    * @throws IOException
-    */
-   protected void readMessage(final ClientSession session, final SimpleString queueToRead, final int numberOfBytes) throws ActiveMQException,
-      IOException
-   {
-      session.start();
-
-      ClientConsumer consumer = session.createConsumer(queueToRead);
-
-      ClientMessage clientMessage = consumer.receive(5000);
-
-      Assert.assertNotNull(clientMessage);
-
-      clientMessage.acknowledge();
-
-      session.commit();
-
-      consumer.close();
-   }
-
-   protected OutputStream createFakeOutputStream() throws Exception
-   {
-
-      return new OutputStream()
-      {
-         private boolean closed = false;
-
-         private int count;
-
-         @Override
-         public void close() throws IOException
-         {
-            super.close();
-            closed = true;
-         }
-
-         @Override
-         public void write(final int b) throws IOException
-         {
-            if (count++ % 1024 * 1024 == 0)
-            {
-               LargeMessageTestBase.log.debug("OutputStream received " + count + " bytes");
-            }
-            if (closed)
-            {
-               throw new IOException("Stream was closed");
-            }
-         }
-
-      };
-
-   }
-
-   // Private -------------------------------------------------------
-
-   // Inner classes -------------------------------------------------
-}

http://git-wip-us.apache.org/repos/asf/activemq-6/blob/d101bcbf/tests/integration-tests/src/test/java/org/apache/activemq/tests/util/transactions/DummyTransactionManagerLocator.java
----------------------------------------------------------------------
diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/tests/util/transactions/DummyTransactionManagerLocator.java b/tests/integration-tests/src/test/java/org/apache/activemq/tests/util/transactions/DummyTransactionManagerLocator.java
new file mode 100644
index 0000000..1841cf8
--- /dev/null
+++ b/tests/integration-tests/src/test/java/org/apache/activemq/tests/util/transactions/DummyTransactionManagerLocator.java
@@ -0,0 +1,94 @@
+/**
+ * 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.tests.util.transactions;
+
+import javax.transaction.HeuristicMixedException;
+import javax.transaction.HeuristicRollbackException;
+import javax.transaction.InvalidTransactionException;
+import javax.transaction.NotSupportedException;
+import javax.transaction.RollbackException;
+import javax.transaction.SystemException;
+import javax.transaction.Transaction;
+import javax.transaction.TransactionManager;
+
+import org.apache.activemq.service.extensions.transactions.TransactionManagerLocator;
+
+/**
+ * @author <a href="mailto:andy.taylor@jboss.org">Andy Taylor</a>
+ */
+public class DummyTransactionManagerLocator implements TransactionManagerLocator,TransactionManager
+{
+   @Override
+   public void begin() throws NotSupportedException, SystemException
+   {
+
+   }
+
+   @Override
+   public void commit() throws HeuristicMixedException, HeuristicRollbackException, IllegalStateException, RollbackException, SecurityException, SystemException
+   {
+
+   }
+
+   @Override
+   public int getStatus() throws SystemException
+   {
+      return 0;
+   }
+
+   @Override
+   public Transaction getTransaction() throws SystemException
+   {
+      return null;
+   }
+
+   @Override
+   public void resume(Transaction transaction) throws IllegalStateException, InvalidTransactionException, SystemException
+   {
+
+   }
+
+   @Override
+   public void rollback() throws IllegalStateException, SecurityException, SystemException
+   {
+
+   }
+
+   @Override
+   public void setRollbackOnly() throws IllegalStateException, SystemException
+   {
+
+   }
+
+   @Override
+   public void setTransactionTimeout(int i) throws SystemException
+   {
+
+   }
+
+   @Override
+   public Transaction suspend() throws SystemException
+   {
+      return null;
+   }
+
+   @Override
+   public TransactionManager getTransactionManager()
+   {
+      return this;
+   }
+}

http://git-wip-us.apache.org/repos/asf/activemq-6/blob/d101bcbf/tests/integration-tests/src/test/java/org/apache/activemq/tests/util/transactions/TransactionManagerLocatorTest.java
----------------------------------------------------------------------
diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/tests/util/transactions/TransactionManagerLocatorTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/tests/util/transactions/TransactionManagerLocatorTest.java
new file mode 100644
index 0000000..9e91b1a
--- /dev/null
+++ b/tests/integration-tests/src/test/java/org/apache/activemq/tests/util/transactions/TransactionManagerLocatorTest.java
@@ -0,0 +1,35 @@
+/**
+ * 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.tests.util.transactions;
+
+import org.apache.activemq.service.extensions.ServiceUtils;
+import org.junit.Assert;
+import org.junit.Test;
+
+/**
+ * *
+ * @author <a href="mailto:andy.taylor@jboss.org">Andy Taylor</a>
+ */
+public class TransactionManagerLocatorTest extends Assert
+{
+   @Test
+   public void getTM()
+   {
+      assertNotNull(ServiceUtils.getTransactionManager());
+      assertEquals(ServiceUtils.getTransactionManager().getClass(), DummyTransactionManagerLocator.class);
+   }
+}

http://git-wip-us.apache.org/repos/asf/activemq-6/blob/d101bcbf/tests/integration-tests/src/test/resources/META-INF/services/org.apache.activemq.service.extensions.transactions.TransactionManagerLocator
----------------------------------------------------------------------
diff --git a/tests/integration-tests/src/test/resources/META-INF/services/org.apache.activemq.service.extensions.transactions.TransactionManagerLocator b/tests/integration-tests/src/test/resources/META-INF/services/org.apache.activemq.service.extensions.transactions.TransactionManagerLocator
index e9ef6bf..209f66f 100644
--- a/tests/integration-tests/src/test/resources/META-INF/services/org.apache.activemq.service.extensions.transactions.TransactionManagerLocator
+++ b/tests/integration-tests/src/test/resources/META-INF/services/org.apache.activemq.service.extensions.transactions.TransactionManagerLocator
@@ -1 +1 @@
-org.apache.activemq.tests.extras.jms.bridge.TransactionManagerLocatorImpl
+org.apache.activemq.tests.util.transactions.DummyTransactionManagerLocator


[2/5] activemq-6 git commit: Fixing Logger errors on the testsuite

Posted by an...@apache.org.
Fixing Logger errors on the testsuite

Fixing the classpath so some tests would find the LogManager configured
Fixing the dependency on the AssertionLoggerHandler so all the tests could also see it without further errors


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

Branch: refs/heads/master
Commit: 11dadb5a2a22a0287f99ca836cbb60125f443896
Parents: d101bcb
Author: Clebert Suconic <cl...@apache.org>
Authored: Fri Mar 6 23:15:07 2015 -0500
Committer: Clebert Suconic <cl...@apache.org>
Committed: Fri Mar 6 23:29:15 2015 -0500

----------------------------------------------------------------------
 activemq-commons/pom.xml                        |   5 +
 .../activemq/utils/AssertionLoggerHandler.java  | 145 +++++++++++++++++
 .../activemq-amqp-protocol/pom.xml              |  14 ++
 activemq-protocols/activemq-proton-plug/pom.xml |  16 ++
 .../WrongRoleFileConfigurationParserTest.java   |   2 +-
 .../tests/logging/AssertionLoggerHandler.java   | 159 -------------------
 .../src/test/resources/logging.properties       |   2 +-
 activemq-service-extensions/pom.xml             |  16 ++
 activemq-web/pom.xml                            |  16 ++
 tests/config/logging.properties                 |   2 +-
 tests/config/logging.properties.trace           |   2 +-
 tests/extra-tests/pom.xml                       |   7 +
 tests/integration-tests/pom.xml                 |  10 ++
 .../tests/integration/client/PagingTest.java    |   2 +-
 .../server/AddressFullLoggingTest.java          |   2 +-
 .../integration/server/FileLockTimeoutTest.java |   2 +-
 .../integration/server/SimpleStartStopTest.java |   2 +-
 tests/joram-tests/pom.xml                       |   9 ++
 tests/performance-tests/pom.xml                 |   9 ++
 tests/soak-tests/pom.xml                        |   9 ++
 tests/stress-tests/pom.xml                      |   9 ++
 tests/timing-tests/pom.xml                      |   9 ++
 tests/unit-tests/pom.xml                        |   9 ++
 23 files changed, 291 insertions(+), 167 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/activemq-6/blob/11dadb5a/activemq-commons/pom.xml
----------------------------------------------------------------------
diff --git a/activemq-commons/pom.xml b/activemq-commons/pom.xml
index 2d1d754..1296b07 100644
--- a/activemq-commons/pom.xml
+++ b/activemq-commons/pom.xml
@@ -37,6 +37,11 @@
          <artifactId>jboss-logging-processor</artifactId>
       </dependency>
       <dependency>
+         <groupId>org.jboss.logmanager</groupId>
+         <artifactId>jboss-logmanager</artifactId>
+         <scope>compile</scope>
+      </dependency>
+      <dependency>
          <groupId>org.jboss.logging</groupId>
          <artifactId>jboss-logging</artifactId>
       </dependency>

http://git-wip-us.apache.org/repos/asf/activemq-6/blob/11dadb5a/activemq-commons/src/main/java/org/apache/activemq/utils/AssertionLoggerHandler.java
----------------------------------------------------------------------
diff --git a/activemq-commons/src/main/java/org/apache/activemq/utils/AssertionLoggerHandler.java b/activemq-commons/src/main/java/org/apache/activemq/utils/AssertionLoggerHandler.java
new file mode 100644
index 0000000..109617c
--- /dev/null
+++ b/activemq-commons/src/main/java/org/apache/activemq/utils/AssertionLoggerHandler.java
@@ -0,0 +1,145 @@
+/**
+ * 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.utils;
+
+import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.logging.Level;
+
+import org.jboss.logmanager.ExtHandler;
+import org.jboss.logmanager.ExtLogRecord;
+
+/**
+ * This class contains a tool where programs could intercept for LogMessage given an interval of time between {@link #startCapture()}
+ * and {@link #stopCapture()}
+ * <p/>
+ * Be careful with this use as this is intended for testing only (such as testcases) *
+ *
+ * @author <a href="mailto:ehugonne@redhat.com">Emmanuel Hugonnet</a> (c) 2013 Red Hat, inc.
+ */
+public class AssertionLoggerHandler extends ExtHandler
+{
+
+   private static final Map<String, ExtLogRecord> messages = new ConcurrentHashMap<>();
+   private static boolean capture = false;
+
+   /**
+    * {@inheritDoc}
+    */
+   @Override
+   public void flush()
+   {
+   }
+
+   /**
+    * {@inheritDoc}
+    */
+   @Override
+   public void close() throws SecurityException
+   {
+   }
+
+   @Override
+   protected void doPublish(final ExtLogRecord record)
+   {
+      if (capture)
+      {
+         messages.put(record.getFormattedMessage(), record);
+      }
+   }
+
+
+   /**
+    * is there any record matching Level?
+    *
+    * @param level
+    * @return
+    */
+   public static boolean hasLevel(Level level)
+   {
+      for (ExtLogRecord record : messages.values())
+      {
+         if (record.getLevel().equals(level))
+         {
+            return true;
+         }
+      }
+
+      return false;
+   }
+
+   /**
+    * Find a line that contains the parameters passed as an argument
+    *
+    * @param text
+    * @return
+    */
+   public static boolean findText(final String... text)
+   {
+      for (Map.Entry<String, ExtLogRecord> entry : messages.entrySet())
+      {
+         String key = entry.getKey();
+         boolean found = true;
+
+         for (String txtCheck : text)
+         {
+            found = key.contains(txtCheck);
+            if (!found)
+            {
+               // If the main log message doesn't contain what we're looking for let's look in the message from the exception (if there is one).
+               Throwable throwable = entry.getValue().getThrown();
+               if (throwable != null && throwable.getMessage() != null)
+               {
+                  found = throwable.getMessage().contains(txtCheck);
+                  if (!found)
+                  {
+                     break;
+                  }
+               }
+               else
+               {
+                  break;
+               }
+            }
+         }
+
+         if (found)
+         {
+            return true;
+         }
+      }
+
+      return false;
+   }
+
+   public static final void clear()
+   {
+      messages.clear();
+   }
+
+   public static final void startCapture()
+   {
+      clear();
+      capture = true;
+   }
+
+   public static final void stopCapture()
+   {
+      capture = false;
+      clear();
+   }
+}

http://git-wip-us.apache.org/repos/asf/activemq-6/blob/11dadb5a/activemq-protocols/activemq-amqp-protocol/pom.xml
----------------------------------------------------------------------
diff --git a/activemq-protocols/activemq-amqp-protocol/pom.xml b/activemq-protocols/activemq-amqp-protocol/pom.xml
index 6f6d68b..11993b8 100644
--- a/activemq-protocols/activemq-amqp-protocol/pom.xml
+++ b/activemq-protocols/activemq-amqp-protocol/pom.xml
@@ -48,6 +48,20 @@
       <!--
           JBoss Logging
       -->
+
+      <dependency>
+         <groupId>org.jboss.logmanager</groupId>
+         <artifactId>jboss-logmanager</artifactId>
+         <scope>test</scope>
+      </dependency>
+
+      <!-- this is for the log assertion -->
+      <dependency>
+         <groupId>org.apache.activemq</groupId>
+         <artifactId>activemq-commons</artifactId>
+         <version>${project.version}</version>
+      </dependency>
+
       <dependency>
          <groupId>org.jboss.logging</groupId>
          <artifactId>jboss-logging</artifactId>

http://git-wip-us.apache.org/repos/asf/activemq-6/blob/11dadb5a/activemq-protocols/activemq-proton-plug/pom.xml
----------------------------------------------------------------------
diff --git a/activemq-protocols/activemq-proton-plug/pom.xml b/activemq-protocols/activemq-proton-plug/pom.xml
index e241126..cc545b2 100644
--- a/activemq-protocols/activemq-proton-plug/pom.xml
+++ b/activemq-protocols/activemq-proton-plug/pom.xml
@@ -48,6 +48,22 @@
       <!--
           JBoss Logging
       -->
+
+
+      <dependency>
+         <groupId>org.jboss.logmanager</groupId>
+         <artifactId>jboss-logmanager</artifactId>
+         <scope>test</scope>
+      </dependency>
+
+      <!-- this is for the log assertion -->
+      <dependency>
+         <groupId>org.apache.activemq</groupId>
+         <artifactId>activemq-commons</artifactId>
+         <version>${project.version}</version>
+         <scope>test</scope>
+      </dependency>
+
       <dependency>
          <groupId>org.jboss.logging</groupId>
          <artifactId>jboss-logging</artifactId>

http://git-wip-us.apache.org/repos/asf/activemq-6/blob/11dadb5a/activemq-server/src/test/java/org/apache/activemq/core/config/impl/WrongRoleFileConfigurationParserTest.java
----------------------------------------------------------------------
diff --git a/activemq-server/src/test/java/org/apache/activemq/core/config/impl/WrongRoleFileConfigurationParserTest.java b/activemq-server/src/test/java/org/apache/activemq/core/config/impl/WrongRoleFileConfigurationParserTest.java
index 0773d3f..b95ec5c 100644
--- a/activemq-server/src/test/java/org/apache/activemq/core/config/impl/WrongRoleFileConfigurationParserTest.java
+++ b/activemq-server/src/test/java/org/apache/activemq/core/config/impl/WrongRoleFileConfigurationParserTest.java
@@ -20,7 +20,7 @@ import java.io.ByteArrayInputStream;
 import java.nio.charset.StandardCharsets;
 
 import org.apache.activemq.core.deployers.impl.FileConfigurationParser;
-import org.apache.activemq.tests.logging.AssertionLoggerHandler;
+import org.apache.activemq.utils.AssertionLoggerHandler;
 import org.apache.activemq.tests.util.UnitTestCase;
 import org.junit.AfterClass;
 import org.junit.BeforeClass;

http://git-wip-us.apache.org/repos/asf/activemq-6/blob/11dadb5a/activemq-server/src/test/java/org/apache/activemq/tests/logging/AssertionLoggerHandler.java
----------------------------------------------------------------------
diff --git a/activemq-server/src/test/java/org/apache/activemq/tests/logging/AssertionLoggerHandler.java b/activemq-server/src/test/java/org/apache/activemq/tests/logging/AssertionLoggerHandler.java
deleted file mode 100644
index 8188495..0000000
--- a/activemq-server/src/test/java/org/apache/activemq/tests/logging/AssertionLoggerHandler.java
+++ /dev/null
@@ -1,159 +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.tests.logging;
-
-import java.util.Arrays;
-import java.util.Map;
-import java.util.concurrent.ConcurrentHashMap;
-import java.util.logging.Level;
-
-import org.jboss.logmanager.ExtHandler;
-import org.jboss.logmanager.ExtLogRecord;
-import org.junit.Assert;
-
-/**
- * @author <a href="mailto:ehugonne@redhat.com">Emmanuel Hugonnet</a> (c) 2013 Red Hat, inc.
- */
-public class AssertionLoggerHandler extends ExtHandler
-{
-
-   private static final Map<String, ExtLogRecord> messages = new ConcurrentHashMap<>();
-   private static boolean capture = false;
-
-   /**
-    * {@inheritDoc}
-    */
-   @Override
-   public void flush()
-   {
-   }
-
-   /**
-    * {@inheritDoc}
-    */
-   @Override
-   public void close() throws SecurityException
-   {
-   }
-
-   @Override
-   protected void doPublish(final ExtLogRecord record)
-   {
-      if (capture)
-      {
-         messages.put(record.getFormattedMessage(), record);
-      }
-   }
-
-
-   /**
-    * is there any record matching Level?
-     * @param level
-    * @return
-    */
-   public static boolean hasLevel(Level level)
-   {
-      for (ExtLogRecord record : messages.values())
-      {
-         if (record.getLevel().equals(level))
-         {
-            return true;
-         }
-      }
-
-      return false;
-   }
-
-   /**
-    * Find a line that contains the parameters passed as an argument
-    *
-    * @param text
-    * @return
-    */
-   public static boolean findText(final String... text)
-   {
-      for (Map.Entry<String, ExtLogRecord> entry : messages.entrySet())
-      {
-         String key = entry.getKey();
-         boolean found = true;
-
-         for (String txtCheck : text)
-         {
-            found = key.contains(txtCheck);
-            if (!found)
-            {
-               // If the main log message doesn't contain what we're looking for let's look in the message from the exception (if there is one).
-               Throwable throwable = entry.getValue().getThrown();
-               if (throwable != null && throwable.getMessage() != null)
-               {
-                  found = throwable.getMessage().contains(txtCheck);
-                  if (!found)
-                  {
-                     break;
-                  }
-               }
-               else
-               {
-                  break;
-               }
-            }
-         }
-
-         if (found)
-         {
-            return true;
-         }
-      }
-
-      return false;
-   }
-
-   public static void assertMessageWasLoggedWithLevel(String expectedMessage, Level expectedLevel)
-   {
-      if (!messages.containsKey(expectedMessage))
-      {
-         throw new AssertionError((Arrays.toString(messages.keySet().toArray())));
-      }
-      Assert.assertEquals(expectedLevel, messages.get(expectedMessage).getLevel());
-   }
-
-   public static void assertMessageWasLoggedWithLevel(String assertionMessage, String expectedMessage, Level expectedLevel)
-   {
-      if (!messages.containsKey(expectedMessage))
-      {
-         throw new AssertionError(assertionMessage);
-      }
-      Assert.assertEquals(assertionMessage, expectedLevel, messages.get(expectedMessage).getLevel());
-   }
-
-   public static final void clear()
-   {
-      messages.clear();
-   }
-
-   public static final void startCapture()
-   {
-      clear();
-      capture = true;
-   }
-
-   public static final void stopCapture()
-   {
-      capture = false;
-      clear();
-   }
-}

http://git-wip-us.apache.org/repos/asf/activemq-6/blob/11dadb5a/activemq-server/src/test/resources/logging.properties
----------------------------------------------------------------------
diff --git a/activemq-server/src/test/resources/logging.properties b/activemq-server/src/test/resources/logging.properties
index 4b42bc4..1ac02cc 100644
--- a/activemq-server/src/test/resources/logging.properties
+++ b/activemq-server/src/test/resources/logging.properties
@@ -45,7 +45,7 @@ handler.FILE.formatter=PATTERN
 
 
 # Console handler configuration
-handler.TEST=org.apache.activemq.tests.logging.AssertionLoggerHandler
+handler.TEST=org.apache.activemq.utils.AssertionLoggerHandler
 handler.TEST.level=TRACE
 handler.TEST.formatter=PATTERN
 

http://git-wip-us.apache.org/repos/asf/activemq-6/blob/11dadb5a/activemq-service-extensions/pom.xml
----------------------------------------------------------------------
diff --git a/activemq-service-extensions/pom.xml b/activemq-service-extensions/pom.xml
index 8fd86d0..da50e32 100644
--- a/activemq-service-extensions/pom.xml
+++ b/activemq-service-extensions/pom.xml
@@ -55,6 +55,22 @@
          <artifactId>junit</artifactId>
          <scope>test</scope>
       </dependency>
+
+
+      <dependency>
+         <groupId>org.jboss.logmanager</groupId>
+         <artifactId>jboss-logmanager</artifactId>
+         <scope>test</scope>
+      </dependency>
+
+      <!-- this is for the log assertion -->
+      <dependency>
+         <groupId>org.apache.activemq</groupId>
+         <artifactId>activemq-commons</artifactId>
+         <version>${project.version}</version>
+      </dependency>
+
+
    </dependencies>
 
    <properties>

http://git-wip-us.apache.org/repos/asf/activemq-6/blob/11dadb5a/activemq-web/pom.xml
----------------------------------------------------------------------
diff --git a/activemq-web/pom.xml b/activemq-web/pom.xml
index 9b99cf9..53b3166 100644
--- a/activemq-web/pom.xml
+++ b/activemq-web/pom.xml
@@ -56,6 +56,22 @@
          <artifactId>jboss-logmanager</artifactId>
          <scope>test</scope>
       </dependency>
+
+
+      <dependency>
+         <groupId>org.jboss.logmanager</groupId>
+         <artifactId>jboss-logmanager</artifactId>
+         <scope>test</scope>
+      </dependency>
+
+      <!-- this is for the log assertion -->
+      <dependency>
+         <groupId>org.apache.activemq</groupId>
+         <artifactId>activemq-commons</artifactId>
+         <version>${project.version}</version>
+      </dependency>
+
+
    </dependencies>
 
 

http://git-wip-us.apache.org/repos/asf/activemq-6/blob/11dadb5a/tests/config/logging.properties
----------------------------------------------------------------------
diff --git a/tests/config/logging.properties b/tests/config/logging.properties
index fb5d487..3062239 100644
--- a/tests/config/logging.properties
+++ b/tests/config/logging.properties
@@ -51,7 +51,7 @@ handler.FILE.fileName=target/activemq.log
 handler.FILE.formatter=PATTERN
 
 # Console handler configuration
-handler.TEST=org.apache.activemq.tests.logging.AssertionLoggerHandler
+handler.TEST=org.apache.activemq.utils.AssertionLoggerHandler
 handler.TEST.level=TRACE
 handler.TEST.formatter=PATTERN
 

http://git-wip-us.apache.org/repos/asf/activemq-6/blob/11dadb5a/tests/config/logging.properties.trace
----------------------------------------------------------------------
diff --git a/tests/config/logging.properties.trace b/tests/config/logging.properties.trace
index bc3b050..c6c948d 100644
--- a/tests/config/logging.properties.trace
+++ b/tests/config/logging.properties.trace
@@ -53,7 +53,7 @@ handler.FILE.fileName=target/activemq.log
 handler.FILE.formatter=PATTERN
 
 # Console handler configuration
-handler.TEST=org.apache.activemq.tests.logging.AssertionLoggerHandler
+handler.TEST=org.apache.activemq.utils.AssertionLoggerHandler
 handler.TEST.level=TRACE
 handler.TEST.formatter=PATTERN
 

http://git-wip-us.apache.org/repos/asf/activemq-6/blob/11dadb5a/tests/extra-tests/pom.xml
----------------------------------------------------------------------
diff --git a/tests/extra-tests/pom.xml b/tests/extra-tests/pom.xml
index 3329bf3..b439ae8 100644
--- a/tests/extra-tests/pom.xml
+++ b/tests/extra-tests/pom.xml
@@ -169,6 +169,13 @@
          <artifactId>junit</artifactId>
       </dependency>
 
+      <!-- this is for the log assertion -->
+      <dependency>
+         <groupId>org.apache.activemq</groupId>
+         <artifactId>activemq-commons</artifactId>
+         <version>${project.version}</version>
+         <scope>test</scope>
+      </dependency>
 
 
       <!-- Needed for JMS Bridge Tests -->

http://git-wip-us.apache.org/repos/asf/activemq-6/blob/11dadb5a/tests/integration-tests/pom.xml
----------------------------------------------------------------------
diff --git a/tests/integration-tests/pom.xml b/tests/integration-tests/pom.xml
index 3c32bfe..93b8f97 100644
--- a/tests/integration-tests/pom.xml
+++ b/tests/integration-tests/pom.xml
@@ -223,6 +223,16 @@
          <version>1.0.1</version>
          <scope>test</scope>
       </dependency>
+
+      <!-- this is for the log assertion -->
+      <dependency>
+         <groupId>org.apache.activemq</groupId>
+         <artifactId>activemq-commons</artifactId>
+         <version>${project.version}</version>
+         <scope>test</scope>
+      </dependency>
+
+
    </dependencies>
 
    <build>

http://git-wip-us.apache.org/repos/asf/activemq-6/blob/11dadb5a/tests/integration-tests/src/test/java/org/apache/activemq/tests/integration/client/PagingTest.java
----------------------------------------------------------------------
diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/tests/integration/client/PagingTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/tests/integration/client/PagingTest.java
index 0e4751d..4e53b91 100644
--- a/tests/integration-tests/src/test/java/org/apache/activemq/tests/integration/client/PagingTest.java
+++ b/tests/integration-tests/src/test/java/org/apache/activemq/tests/integration/client/PagingTest.java
@@ -73,7 +73,7 @@ import org.apache.activemq.core.server.impl.ActiveMQServerImpl;
 import org.apache.activemq.core.settings.impl.AddressFullMessagePolicy;
 import org.apache.activemq.core.settings.impl.AddressSettings;
 import org.apache.activemq.tests.integration.IntegrationTestLogger;
-import org.apache.activemq.tests.logging.AssertionLoggerHandler;
+import org.apache.activemq.utils.AssertionLoggerHandler;
 import org.apache.activemq.tests.util.ServiceTestBase;
 import org.apache.activemq.tests.util.UnitTestCase;
 import org.junit.Assert;

http://git-wip-us.apache.org/repos/asf/activemq-6/blob/11dadb5a/tests/integration-tests/src/test/java/org/apache/activemq/tests/integration/server/AddressFullLoggingTest.java
----------------------------------------------------------------------
diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/tests/integration/server/AddressFullLoggingTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/tests/integration/server/AddressFullLoggingTest.java
index b887a07..7d73029 100644
--- a/tests/integration-tests/src/test/java/org/apache/activemq/tests/integration/server/AddressFullLoggingTest.java
+++ b/tests/integration-tests/src/test/java/org/apache/activemq/tests/integration/server/AddressFullLoggingTest.java
@@ -33,7 +33,7 @@ import org.apache.activemq.api.core.client.ServerLocator;
 import org.apache.activemq.core.server.ActiveMQServer;
 import org.apache.activemq.core.settings.impl.AddressFullMessagePolicy;
 import org.apache.activemq.core.settings.impl.AddressSettings;
-import org.apache.activemq.tests.logging.AssertionLoggerHandler;
+import org.apache.activemq.utils.AssertionLoggerHandler;
 import org.apache.activemq.tests.util.ServiceTestBase;
 import org.junit.AfterClass;
 import org.junit.Assert;

http://git-wip-us.apache.org/repos/asf/activemq-6/blob/11dadb5a/tests/integration-tests/src/test/java/org/apache/activemq/tests/integration/server/FileLockTimeoutTest.java
----------------------------------------------------------------------
diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/tests/integration/server/FileLockTimeoutTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/tests/integration/server/FileLockTimeoutTest.java
index 588feb6..1f295d3 100644
--- a/tests/integration-tests/src/test/java/org/apache/activemq/tests/integration/server/FileLockTimeoutTest.java
+++ b/tests/integration-tests/src/test/java/org/apache/activemq/tests/integration/server/FileLockTimeoutTest.java
@@ -27,7 +27,7 @@ import org.apache.activemq.core.config.ha.SharedStoreMasterPolicyConfiguration;
 import org.apache.activemq.core.server.ActiveMQServer;
 import org.apache.activemq.core.server.JournalType;
 import org.apache.activemq.tests.integration.IntegrationTestLogger;
-import org.apache.activemq.tests.logging.AssertionLoggerHandler;
+import org.apache.activemq.utils.AssertionLoggerHandler;
 import org.apache.activemq.tests.util.ServiceTestBase;
 import org.junit.AfterClass;
 import org.junit.Assert;

http://git-wip-us.apache.org/repos/asf/activemq-6/blob/11dadb5a/tests/integration-tests/src/test/java/org/apache/activemq/tests/integration/server/SimpleStartStopTest.java
----------------------------------------------------------------------
diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/tests/integration/server/SimpleStartStopTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/tests/integration/server/SimpleStartStopTest.java
index 265cb16..b5386c5 100644
--- a/tests/integration-tests/src/test/java/org/apache/activemq/tests/integration/server/SimpleStartStopTest.java
+++ b/tests/integration-tests/src/test/java/org/apache/activemq/tests/integration/server/SimpleStartStopTest.java
@@ -22,7 +22,7 @@ import java.util.concurrent.atomic.AtomicInteger;
 
 import org.apache.activemq.core.persistence.impl.journal.JournalRecordIds;
 import org.apache.activemq.core.server.ActiveMQServer;
-import org.apache.activemq.tests.logging.AssertionLoggerHandler;
+import org.apache.activemq.utils.AssertionLoggerHandler;
 import org.apache.activemq.tests.util.ServiceTestBase;
 import org.jboss.logmanager.Level;
 import org.junit.Test;

http://git-wip-us.apache.org/repos/asf/activemq-6/blob/11dadb5a/tests/joram-tests/pom.xml
----------------------------------------------------------------------
diff --git a/tests/joram-tests/pom.xml b/tests/joram-tests/pom.xml
index 81c0fd3..05d7e65 100644
--- a/tests/joram-tests/pom.xml
+++ b/tests/joram-tests/pom.xml
@@ -79,6 +79,15 @@
          <groupId>org.apache.geronimo.specs</groupId>
          <artifactId>geronimo-jms_2.0_spec</artifactId>
       </dependency>
+
+      <!-- this is for the log assertion -->
+      <dependency>
+         <groupId>org.apache.activemq</groupId>
+         <artifactId>activemq-commons</artifactId>
+         <version>${project.version}</version>
+         <scope>test</scope>
+      </dependency>
+
    </dependencies>
 
    <build>

http://git-wip-us.apache.org/repos/asf/activemq-6/blob/11dadb5a/tests/performance-tests/pom.xml
----------------------------------------------------------------------
diff --git a/tests/performance-tests/pom.xml b/tests/performance-tests/pom.xml
index 3e6dc27..5e3c3f0 100644
--- a/tests/performance-tests/pom.xml
+++ b/tests/performance-tests/pom.xml
@@ -101,6 +101,15 @@
          <groupId>org.apache.geronimo.specs</groupId>
          <artifactId>geronimo-jms_2.0_spec</artifactId>
       </dependency>
+
+      <!-- this is for the log assertion -->
+      <dependency>
+         <groupId>org.apache.activemq</groupId>
+         <artifactId>activemq-commons</artifactId>
+         <version>${project.version}</version>
+         <scope>test</scope>
+      </dependency>
+
    </dependencies>
 
    <build>

http://git-wip-us.apache.org/repos/asf/activemq-6/blob/11dadb5a/tests/soak-tests/pom.xml
----------------------------------------------------------------------
diff --git a/tests/soak-tests/pom.xml b/tests/soak-tests/pom.xml
index a789581..4e9d351 100644
--- a/tests/soak-tests/pom.xml
+++ b/tests/soak-tests/pom.xml
@@ -112,6 +112,15 @@
          <groupId>org.apache.geronimo.specs</groupId>
          <artifactId>geronimo-jms_2.0_spec</artifactId>
       </dependency>
+
+      <!-- this is for the log assertion -->
+      <dependency>
+         <groupId>org.apache.activemq</groupId>
+         <artifactId>activemq-commons</artifactId>
+         <version>${project.version}</version>
+         <scope>test</scope>
+      </dependency>
+
    </dependencies>
 
    <build>

http://git-wip-us.apache.org/repos/asf/activemq-6/blob/11dadb5a/tests/stress-tests/pom.xml
----------------------------------------------------------------------
diff --git a/tests/stress-tests/pom.xml b/tests/stress-tests/pom.xml
index b51dbbf..fb71b42 100644
--- a/tests/stress-tests/pom.xml
+++ b/tests/stress-tests/pom.xml
@@ -112,6 +112,15 @@
          <groupId>org.apache.geronimo.specs</groupId>
          <artifactId>geronimo-jms_2.0_spec</artifactId>
       </dependency>
+
+      <!-- this is for the log assertion -->
+      <dependency>
+         <groupId>org.apache.activemq</groupId>
+         <artifactId>activemq-commons</artifactId>
+         <version>${project.version}</version>
+         <scope>test</scope>
+      </dependency>
+
    </dependencies>
 
    <build>

http://git-wip-us.apache.org/repos/asf/activemq-6/blob/11dadb5a/tests/timing-tests/pom.xml
----------------------------------------------------------------------
diff --git a/tests/timing-tests/pom.xml b/tests/timing-tests/pom.xml
index 7a1def1..7d95726 100644
--- a/tests/timing-tests/pom.xml
+++ b/tests/timing-tests/pom.xml
@@ -90,6 +90,15 @@
          <groupId>org.apache.geronimo.specs</groupId>
          <artifactId>geronimo-jms_2.0_spec</artifactId>
       </dependency>
+
+      <!-- this is for the log assertion -->
+      <dependency>
+         <groupId>org.apache.activemq</groupId>
+         <artifactId>activemq-commons</artifactId>
+         <version>${project.version}</version>
+         <scope>test</scope>
+      </dependency>
+
    </dependencies>
 
    <build>

http://git-wip-us.apache.org/repos/asf/activemq-6/blob/11dadb5a/tests/unit-tests/pom.xml
----------------------------------------------------------------------
diff --git a/tests/unit-tests/pom.xml b/tests/unit-tests/pom.xml
index 87a4fb2..39927ef 100644
--- a/tests/unit-tests/pom.xml
+++ b/tests/unit-tests/pom.xml
@@ -94,6 +94,15 @@
             <groupId>org.jboss.logmanager</groupId>
             <artifactId>jboss-logmanager</artifactId>
       </dependency>
+
+      <!-- this is for the log assertion -->
+      <dependency>
+         <groupId>org.apache.activemq</groupId>
+         <artifactId>activemq-commons</artifactId>
+         <version>${project.version}</version>
+         <scope>test</scope>
+      </dependency>
+
    </dependencies>
 
    <build>


[3/5] activemq-6 git commit: fixing source distribution to exclude extra-tests and data

Posted by an...@apache.org.
fixing source distribution to exclude extra-tests and data


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

Branch: refs/heads/master
Commit: 02a2e8d14a1a1ca3804ad82114a00bf1ed859c85
Parents: 11dadb5
Author: Clebert Suconic <cl...@apache.org>
Authored: Fri Mar 6 23:55:16 2015 -0500
Committer: Clebert Suconic <cl...@apache.org>
Committed: Fri Mar 6 23:55:16 2015 -0500

----------------------------------------------------------------------
 .../activemq/src/main/assembly/source-assembly.xml       | 11 ++++-------
 1 file changed, 4 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/activemq-6/blob/02a2e8d1/distribution/activemq/src/main/assembly/source-assembly.xml
----------------------------------------------------------------------
diff --git a/distribution/activemq/src/main/assembly/source-assembly.xml b/distribution/activemq/src/main/assembly/source-assembly.xml
index 21f3cba..a55157e 100644
--- a/distribution/activemq/src/main/assembly/source-assembly.xml
+++ b/distribution/activemq/src/main/assembly/source-assembly.xml
@@ -37,13 +37,10 @@
          <!-- TODO These excludes were lifted from maven-resources-apache-source-release-assembly-descriptor-1.0.4. We
          should use this descriptor directly in future -->
          <excludes>
-            <exclude>tests/integration-tests/</exclude>
-            <exclude>tests/jms-tests/</exclude>
-            <exclude>tests/byteman-tests/</exclude>
-            <exclude>tests/concurrent-tests/</exclude>
-            <exclude>tests/performance-tests/</exclude>
-            <exclude>tests/soak-tests/</exclude>
-            <exclude>tests/stress-tests/</exclude>
+            <exclude>tests/extra-tests/</exclude>
+            
+            <!-- in case some of the build generates data, this needs to be ignored -->
+            <exclude>data/</exclude>
 
             <!--  build output  -->
             <exclude>


[5/5] activemq-6 git commit: merge #158 - Fixing ServiceLocator and Logger errors

Posted by an...@apache.org.
merge #158 - Fixing ServiceLocator and Logger errors


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

Branch: refs/heads/master
Commit: 10bb4568c3de38ad202afb2a2270afc513250739
Parents: 3c99562 440ae2e
Author: Andy Taylor <an...@gmail.com>
Authored: Mon Mar 9 09:24:10 2015 +0000
Committer: Andy Taylor <an...@gmail.com>
Committed: Mon Mar 9 09:24:10 2015 +0000

----------------------------------------------------------------------
 activemq-commons/pom.xml                        |   5 +
 .../activemq/utils/AssertionLoggerHandler.java  | 145 ++++
 .../activemq-amqp-protocol/pom.xml              |  14 +
 activemq-protocols/activemq-proton-plug/pom.xml |  16 +
 .../WrongRoleFileConfigurationParserTest.java   |   2 +-
 .../tests/logging/AssertionLoggerHandler.java   | 159 -----
 .../src/test/resources/logging.properties       |   2 +-
 activemq-service-extensions/pom.xml             |  16 +
 activemq-web/pom.xml                            |  16 +
 .../src/main/assembly/source-assembly.xml       |  11 +-
 tests/config/logging.properties                 |   2 +-
 tests/config/logging.properties.trace           |   2 +-
 tests/extra-tests/pom.xml                       |   7 +
 .../activemq/tests/extras/jms/xa/XATest.java    | 192 +++--
 ...sions.transactions.TransactionManagerLocator |   1 +
 tests/integration-tests/pom.xml                 |  10 +
 .../tests/integration/client/PagingTest.java    |   2 +-
 .../server/AddressFullLoggingTest.java          |   2 +-
 .../integration/server/FileLockTimeoutTest.java |   2 +-
 .../integration/server/SimpleStartStopTest.java |   2 +-
 .../largemessage/LargeMessageTestBase.java      | 705 -------------------
 .../DummyTransactionManagerLocator.java         |  94 +++
 .../TransactionManagerLocatorTest.java          |  35 +
 ...sions.transactions.TransactionManagerLocator |   2 +-
 tests/joram-tests/pom.xml                       |   9 +
 tests/performance-tests/pom.xml                 |   9 +
 tests/soak-tests/pom.xml                        |   9 +
 tests/stress-tests/pom.xml                      |   9 +
 tests/timing-tests/pom.xml                      |   9 +
 tests/unit-tests/pom.xml                        |   9 +
 30 files changed, 520 insertions(+), 978 deletions(-)
----------------------------------------------------------------------



[4/5] activemq-6 git commit: Fixing checkstyle on XATest

Posted by an...@apache.org.
Fixing checkstyle on XATest

This test wasn't compiled by the default profile for that reason I missed this.


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

Branch: refs/heads/master
Commit: 440ae2e14648e22b297eeba68503e1115735aec6
Parents: 02a2e8d
Author: Clebert Suconic <cl...@apache.org>
Authored: Sat Mar 7 00:14:20 2015 -0500
Committer: Clebert Suconic <cl...@apache.org>
Committed: Sat Mar 7 00:14:22 2015 -0500

----------------------------------------------------------------------
 .../activemq/tests/extras/jms/xa/XATest.java    | 192 +++++++++----------
 1 file changed, 94 insertions(+), 98 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/activemq-6/blob/440ae2e1/tests/extra-tests/src/test/java/org/apache/activemq/tests/extras/jms/xa/XATest.java
----------------------------------------------------------------------
diff --git a/tests/extra-tests/src/test/java/org/apache/activemq/tests/extras/jms/xa/XATest.java b/tests/extra-tests/src/test/java/org/apache/activemq/tests/extras/jms/xa/XATest.java
index 4847e34..d036b76 100644
--- a/tests/extra-tests/src/test/java/org/apache/activemq/tests/extras/jms/xa/XATest.java
+++ b/tests/extra-tests/src/test/java/org/apache/activemq/tests/extras/jms/xa/XATest.java
@@ -36,7 +36,6 @@ import javax.transaction.xa.Xid;
 import com.arjuna.ats.arjuna.coordinator.TransactionReaper;
 import com.arjuna.ats.arjuna.coordinator.TxControl;
 import com.arjuna.ats.internal.jta.transaction.arjunacore.TransactionManagerImple;
-
 import org.apache.activemq.api.jms.ActiveMQJMSClient;
 import org.apache.activemq.core.client.impl.ClientSessionInternal;
 import org.apache.activemq.tests.extras.ExtrasTestLogger;
@@ -48,14 +47,11 @@ import org.junit.Before;
 import org.junit.Test;
 
 /**
- *
  * A XATestBase
  *
  * @author <a href="mailto:tim.fox@jboss.com">Tim Fox</a>
  * @author <a href="mailto:clebert.suconic@jboss.com">Clebert Suconic</a>
  * @version <tt>$Revision: 1.1 $</tt>
- *
- *
  */
 public class XATest extends JMSTestBase
 {
@@ -70,7 +66,7 @@ public class XATest extends JMSTestBase
    protected Transaction suspendedTx;
 
    protected XAConnectionFactory xacf;
-   
+
    protected Queue queue1;
 
    // Constructors --------------------------------------------------
@@ -84,7 +80,7 @@ public class XATest extends JMSTestBase
       super.setUp();
 
       xacf = ActiveMQJMSClient.createConnectionFactory("tcp://localhost:61616", "test");
-      
+
       queue1 = createQueue("queue1");
       TxControl.enable();
 
@@ -176,10 +172,10 @@ public class XATest extends JMSTestBase
          conn2.start();
          Session sessReceiver = conn2.createSession(false, Session.AUTO_ACKNOWLEDGE);
          MessageConsumer cons = sessReceiver.createConsumer(queue1);
-         TextMessage m2 = (TextMessage)cons.receive(1000);
+         TextMessage m2 = (TextMessage) cons.receive(1000);
          Assert.assertNotNull(m2);
          Assert.assertEquals("XATest1", m2.getText());
-         m2 = (TextMessage)cons.receive(1000);
+         m2 = (TextMessage) cons.receive(1000);
          Assert.assertNotNull(m2);
          Assert.assertEquals("XATest2", m2.getText());
       }
@@ -238,10 +234,10 @@ public class XATest extends JMSTestBase
          conn2.start();
          Session sessReceiver = conn2.createSession(false, Session.AUTO_ACKNOWLEDGE);
          MessageConsumer cons = sessReceiver.createConsumer(queue1);
-         TextMessage m2 = (TextMessage)cons.receive(5000);
+         TextMessage m2 = (TextMessage) cons.receive(5000);
          Assert.assertNotNull(m2);
          Assert.assertEquals("XATest1", m2.getText());
-         m2 = (TextMessage)cons.receive(5000);
+         m2 = (TextMessage) cons.receive(5000);
          Assert.assertNotNull(m2);
          Assert.assertEquals("XATest2", m2.getText());
       }
@@ -419,12 +415,12 @@ public class XATest extends JMSTestBase
 
          MessageConsumer cons = sess.createConsumer(queue1);
 
-         TextMessage m2 = (TextMessage)cons.receive(5000);
+         TextMessage m2 = (TextMessage) cons.receive(5000);
 
          Assert.assertNotNull(m2);
          Assert.assertEquals("XATest1", m2.getText());
 
-         m2 = (TextMessage)cons.receive(5000);
+         m2 = (TextMessage) cons.receive(5000);
 
          Assert.assertNotNull(m2);
          Assert.assertEquals("XATest2", m2.getText());
@@ -497,12 +493,12 @@ public class XATest extends JMSTestBase
 
          MessageConsumer cons = sess.createConsumer(queue1);
 
-         TextMessage m2 = (TextMessage)cons.receive(5000);
+         TextMessage m2 = (TextMessage) cons.receive(5000);
 
          Assert.assertNotNull(m2);
          Assert.assertEquals("XATest1", m2.getText());
 
-         m2 = (TextMessage)cons.receive(5000);
+         m2 = (TextMessage) cons.receive(5000);
 
          Assert.assertNotNull(m2);
          Assert.assertEquals("XATest2", m2.getText());
@@ -576,10 +572,10 @@ public class XATest extends JMSTestBase
 
          MessageConsumer cons = sess.createConsumer(queue1);
 
-         TextMessage m2 = (TextMessage)cons.receive(5000);
+         TextMessage m2 = (TextMessage) cons.receive(5000);
          Assert.assertNotNull(m2);
          Assert.assertEquals("XATest1", m2.getText());
-         m2 = (TextMessage)cons.receive(5000);
+         m2 = (TextMessage) cons.receive(5000);
          Assert.assertNotNull(m2);
          Assert.assertEquals("XATest2", m2.getText());
 
@@ -596,10 +592,10 @@ public class XATest extends JMSTestBase
          tx.enlistResource(res);
          tx.enlistResource(res2);
 
-         TextMessage m3 = (TextMessage)cons.receive(5000);
+         TextMessage m3 = (TextMessage) cons.receive(5000);
          Assert.assertNotNull(m3);
          Assert.assertEquals("XATest1", m3.getText());
-         m3 = (TextMessage)cons.receive(5000);
+         m3 = (TextMessage) cons.receive(5000);
          Assert.assertNotNull(m3);
          Assert.assertEquals("XATest2", m3.getText());
 
@@ -657,10 +653,10 @@ public class XATest extends JMSTestBase
 
          MessageConsumer cons = sess.createConsumer(queue1);
 
-         TextMessage m2 = (TextMessage)cons.receive(5000);
+         TextMessage m2 = (TextMessage) cons.receive(5000);
          Assert.assertNotNull(m2);
          Assert.assertEquals("XATest1", m2.getText());
-         m2 = (TextMessage)cons.receive(5000);
+         m2 = (TextMessage) cons.receive(5000);
          Assert.assertNotNull(m2);
          Assert.assertEquals("XATest2", m2.getText());
 
@@ -677,10 +673,10 @@ public class XATest extends JMSTestBase
          tx.enlistResource(res);
          tx.enlistResource(res2);
 
-         TextMessage m3 = (TextMessage)cons.receive(5000);
+         TextMessage m3 = (TextMessage) cons.receive(5000);
          Assert.assertNotNull(m3);
          Assert.assertEquals("XATest1", m3.getText());
-         m3 = (TextMessage)cons.receive(5000);
+         m3 = (TextMessage) cons.receive(5000);
          Assert.assertNotNull(m3);
          Assert.assertEquals("XATest2", m3.getText());
 
@@ -739,10 +735,10 @@ public class XATest extends JMSTestBase
          conn2.start();
          Session sessReceiver = conn2.createSession(false, Session.AUTO_ACKNOWLEDGE);
          MessageConsumer cons = sessReceiver.createConsumer(queue1);
-         TextMessage m2 = (TextMessage)cons.receive(5000);
+         TextMessage m2 = (TextMessage) cons.receive(5000);
          Assert.assertNotNull(m2);
          Assert.assertEquals("XATest1", m2.getText());
-         m2 = (TextMessage)cons.receive(5000);
+         m2 = (TextMessage) cons.receive(5000);
          Assert.assertNotNull(m2);
          Assert.assertEquals("XATest2", m2.getText());
       }
@@ -790,11 +786,11 @@ public class XATest extends JMSTestBase
 
          MessageConsumer cons = sess.createConsumer(queue1);
 
-         TextMessage m2 = (TextMessage)cons.receive(5000);
+         TextMessage m2 = (TextMessage) cons.receive(5000);
 
          Assert.assertNotNull(m2);
          Assert.assertEquals("XATest1", m2.getText());
-         m2 = (TextMessage)cons.receive(5000);
+         m2 = (TextMessage) cons.receive(5000);
 
          Assert.assertNotNull(m2);
          Assert.assertEquals("XATest2", m2.getText());
@@ -859,12 +855,12 @@ public class XATest extends JMSTestBase
 
          MessageConsumer cons = sess.createConsumer(queue1);
 
-         TextMessage m2 = (TextMessage)cons.receive(5000);
+         TextMessage m2 = (TextMessage) cons.receive(5000);
 
          Assert.assertNotNull(m2);
          Assert.assertEquals("XATest1", m2.getText());
 
-         m2 = (TextMessage)cons.receive(5000);
+         m2 = (TextMessage) cons.receive(5000);
 
          Assert.assertNotNull(m2);
          Assert.assertEquals("XATest2", m2.getText());
@@ -880,12 +876,12 @@ public class XATest extends JMSTestBase
          tx = tm.getTransaction();
          tx.enlistResource(res);
 
-         TextMessage m3 = (TextMessage)cons.receive(5000);
+         TextMessage m3 = (TextMessage) cons.receive(5000);
 
          Assert.assertNotNull(m3);
          Assert.assertEquals("XATest1", m3.getText());
 
-         m3 = (TextMessage)cons.receive(5000);
+         m3 = (TextMessage) cons.receive(5000);
 
          Assert.assertNotNull(m3);
          Assert.assertEquals("XATest2", m3.getText());
@@ -947,7 +943,7 @@ public class XATest extends JMSTestBase
 
          // Receive the messages, one on each consumer
          MessageConsumer cons1 = sess1.createConsumer(queue1);
-         TextMessage r1 = (TextMessage)cons1.receive(5000);
+         TextMessage r1 = (TextMessage) cons1.receive(5000);
 
          Assert.assertNotNull(r1);
          Assert.assertEquals("jellyfish1", r1.getText());
@@ -955,7 +951,7 @@ public class XATest extends JMSTestBase
          cons1.close();
 
          MessageConsumer cons2 = sess2.createConsumer(queue1);
-         TextMessage r2 = (TextMessage)cons2.receive(5000);
+         TextMessage r2 = (TextMessage) cons2.receive(5000);
 
          Assert.assertNotNull(r2);
          Assert.assertEquals("jellyfish2", r2.getText());
@@ -970,7 +966,7 @@ public class XATest extends JMSTestBase
          MessageConsumer cons = sess.createConsumer(queue1);
          conn2.start();
 
-         TextMessage r3 = (TextMessage)cons.receive(100);
+         TextMessage r3 = (TextMessage) cons.receive(100);
          Assert.assertNull(r3);
 
       }
@@ -1012,9 +1008,9 @@ public class XATest extends JMSTestBase
 
          // Create 2 sessions and enlist them
          XASession sess1 = conn.createXASession();
-         ClientSessionInternal res1 = (ClientSessionInternal)sess1.getXAResource();
+         ClientSessionInternal res1 = (ClientSessionInternal) sess1.getXAResource();
          XASession sess2 = conn.createXASession();
-         ClientSessionInternal res2 = (ClientSessionInternal)sess2.getXAResource();
+         ClientSessionInternal res2 = (ClientSessionInternal) sess2.getXAResource();
          res1.setForceNotSameRM(true);
          res2.setForceNotSameRM(true);
 
@@ -1024,7 +1020,7 @@ public class XATest extends JMSTestBase
 
          // Receive the messages, one on each consumer
          MessageConsumer cons1 = sess1.createConsumer(queue1);
-         TextMessage r1 = (TextMessage)cons1.receive(5000);
+         TextMessage r1 = (TextMessage) cons1.receive(5000);
 
          Assert.assertNotNull(r1);
          Assert.assertEquals("jellyfish1", r1.getText());
@@ -1032,7 +1028,7 @@ public class XATest extends JMSTestBase
          cons1.close();
 
          MessageConsumer cons2 = sess2.createConsumer(queue1);
-         TextMessage r2 = (TextMessage)cons2.receive(5000);
+         TextMessage r2 = (TextMessage) cons2.receive(5000);
 
          Assert.assertNotNull(r2);
          Assert.assertEquals("jellyfish2", r2.getText());
@@ -1047,7 +1043,7 @@ public class XATest extends JMSTestBase
          MessageConsumer cons = sess.createConsumer(queue1);
          conn2.start();
 
-         TextMessage r3 = (TextMessage)cons.receive(100);
+         TextMessage r3 = (TextMessage) cons.receive(100);
          Assert.assertNull(r3);
 
       }
@@ -1095,9 +1091,9 @@ public class XATest extends JMSTestBase
 
          // Create 2 sessions and enlist them
          XASession sess1 = conn.createXASession();
-         ClientSessionInternal res1 = (ClientSessionInternal)sess1.getXAResource();
+         ClientSessionInternal res1 = (ClientSessionInternal) sess1.getXAResource();
          XASession sess2 = conn.createXASession();
-         ClientSessionInternal res2 = (ClientSessionInternal)sess2.getXAResource();
+         ClientSessionInternal res2 = (ClientSessionInternal) sess2.getXAResource();
 
          Transaction tx = tm.getTransaction();
          tx.enlistResource(res1);
@@ -1105,12 +1101,12 @@ public class XATest extends JMSTestBase
 
          // Receive the messages, two on each consumer
          MessageConsumer cons1 = sess1.createConsumer(queue1);
-         TextMessage r1 = (TextMessage)cons1.receive(5000);
+         TextMessage r1 = (TextMessage) cons1.receive(5000);
 
          Assert.assertNotNull(r1);
          Assert.assertEquals("jellyfish1", r1.getText());
 
-         r1 = (TextMessage)cons1.receive(5000);
+         r1 = (TextMessage) cons1.receive(5000);
 
          Assert.assertNotNull(r1);
          Assert.assertEquals("jellyfish2", r1.getText());
@@ -1118,12 +1114,12 @@ public class XATest extends JMSTestBase
          cons1.close();
 
          MessageConsumer cons2 = sess2.createConsumer(queue1);
-         TextMessage r2 = (TextMessage)cons2.receive(5000);
+         TextMessage r2 = (TextMessage) cons2.receive(5000);
 
          Assert.assertNotNull(r2);
          Assert.assertEquals("jellyfish3", r2.getText());
 
-         r2 = (TextMessage)cons2.receive(5000);
+         r2 = (TextMessage) cons2.receive(5000);
 
          Assert.assertNotNull(r2);
          Assert.assertEquals("jellyfish4", r2.getText());
@@ -1147,7 +1143,7 @@ public class XATest extends JMSTestBase
          MessageConsumer cons = sess.createConsumer(queue1);
          conn2.start();
 
-         TextMessage r = (TextMessage)cons.receive(5000);
+         TextMessage r = (TextMessage) cons.receive(5000);
          Assert.assertNotNull(r);
 
          boolean session1First = false;
@@ -1167,19 +1163,19 @@ public class XATest extends JMSTestBase
 
          if (session1First)
          {
-            r = (TextMessage)cons.receive(5000);
+            r = (TextMessage) cons.receive(5000);
 
             Assert.assertNotNull(r);
 
             Assert.assertEquals("jellyfish2", r.getText());
 
-            r = (TextMessage)cons.receive(5000);
+            r = (TextMessage) cons.receive(5000);
 
             Assert.assertNotNull(r);
 
             Assert.assertEquals("jellyfish3", r.getText());
 
-            r = (TextMessage)cons.receive(5000);
+            r = (TextMessage) cons.receive(5000);
 
             Assert.assertNotNull(r);
 
@@ -1188,26 +1184,26 @@ public class XATest extends JMSTestBase
          }
          else
          {
-            r = (TextMessage)cons.receive(5000);
+            r = (TextMessage) cons.receive(5000);
 
             Assert.assertNotNull(r);
 
             Assert.assertEquals("jellyfish4", r.getText());
 
-            r = (TextMessage)cons.receive(5000);
+            r = (TextMessage) cons.receive(5000);
 
             Assert.assertNotNull(r);
 
             Assert.assertEquals("jellyfish1", r.getText());
 
-            r = (TextMessage)cons.receive(5000);
+            r = (TextMessage) cons.receive(5000);
 
             Assert.assertNotNull(r);
 
             Assert.assertEquals("jellyfish2", r.getText());
          }
 
-         r = (TextMessage)cons.receive(100);
+         r = (TextMessage) cons.receive(100);
 
          Assert.assertNull(r);
 
@@ -1254,9 +1250,9 @@ public class XATest extends JMSTestBase
 
          // Create 2 sessions and enlist them
          XASession sess1 = conn.createXASession();
-         ClientSessionInternal res1 = (ClientSessionInternal)sess1.getXAResource();
+         ClientSessionInternal res1 = (ClientSessionInternal) sess1.getXAResource();
          XASession sess2 = conn.createXASession();
-         ClientSessionInternal res2 = (ClientSessionInternal)sess2.getXAResource();
+         ClientSessionInternal res2 = (ClientSessionInternal) sess2.getXAResource();
          res1.setForceNotSameRM(true);
          res2.setForceNotSameRM(true);
 
@@ -1266,12 +1262,12 @@ public class XATest extends JMSTestBase
 
          // Receive the messages, two on each consumer
          MessageConsumer cons1 = sess1.createConsumer(queue1);
-         TextMessage r1 = (TextMessage)cons1.receive(5000);
+         TextMessage r1 = (TextMessage) cons1.receive(5000);
 
          Assert.assertNotNull(r1);
          Assert.assertEquals("jellyfish1", r1.getText());
 
-         r1 = (TextMessage)cons1.receive(5000);
+         r1 = (TextMessage) cons1.receive(5000);
 
          Assert.assertNotNull(r1);
          Assert.assertEquals("jellyfish2", r1.getText());
@@ -1282,12 +1278,12 @@ public class XATest extends JMSTestBase
          Thread.sleep(500);
 
          MessageConsumer cons2 = sess2.createConsumer(queue1);
-         TextMessage r2 = (TextMessage)cons2.receive(5000);
+         TextMessage r2 = (TextMessage) cons2.receive(5000);
 
          Assert.assertNotNull(r2);
          Assert.assertEquals("jellyfish3", r2.getText());
 
-         r2 = (TextMessage)cons2.receive(5000);
+         r2 = (TextMessage) cons2.receive(5000);
 
          Assert.assertNotNull(r2);
          Assert.assertEquals("jellyfish4", r2.getText());
@@ -1311,7 +1307,7 @@ public class XATest extends JMSTestBase
          MessageConsumer cons = sess.createConsumer(queue1);
          conn2.start();
 
-         TextMessage r = (TextMessage)cons.receive(5000);
+         TextMessage r = (TextMessage) cons.receive(5000);
          Assert.assertNotNull(r);
 
          boolean session1First = false;
@@ -1331,19 +1327,19 @@ public class XATest extends JMSTestBase
 
          if (session1First)
          {
-            r = (TextMessage)cons.receive(5000);
+            r = (TextMessage) cons.receive(5000);
 
             Assert.assertNotNull(r);
 
             Assert.assertEquals("jellyfish2", r.getText());
 
-            r = (TextMessage)cons.receive(5000);
+            r = (TextMessage) cons.receive(5000);
 
             Assert.assertNotNull(r);
 
             Assert.assertEquals("jellyfish3", r.getText());
 
-            r = (TextMessage)cons.receive(5000);
+            r = (TextMessage) cons.receive(5000);
 
             Assert.assertNotNull(r);
 
@@ -1352,26 +1348,26 @@ public class XATest extends JMSTestBase
          }
          else
          {
-            r = (TextMessage)cons.receive(5000);
+            r = (TextMessage) cons.receive(5000);
 
             Assert.assertNotNull(r);
 
             Assert.assertEquals("jellyfish4", r.getText());
 
-            r = (TextMessage)cons.receive(5000);
+            r = (TextMessage) cons.receive(5000);
 
             Assert.assertNotNull(r);
 
             Assert.assertEquals("jellyfish1", r.getText());
 
-            r = (TextMessage)cons.receive(5000);
+            r = (TextMessage) cons.receive(5000);
 
             Assert.assertNotNull(r);
 
             Assert.assertEquals("jellyfish2", r.getText());
          }
 
-         r = (TextMessage)cons.receive(100);
+         r = (TextMessage) cons.receive(100);
 
          Assert.assertNull(r);
       }
@@ -1424,27 +1420,27 @@ public class XATest extends JMSTestBase
          tx.enlistResource(res2);
 
          MessageConsumer cons1 = sess1.createConsumer(queue1);
-         TextMessage r1 = (TextMessage)cons1.receive(5000);
+         TextMessage r1 = (TextMessage) cons1.receive(5000);
 
          Assert.assertNotNull(r1);
          Assert.assertEquals("jellyfish1", r1.getText());
 
-         r1 = (TextMessage)cons1.receive(5000);
+         r1 = (TextMessage) cons1.receive(5000);
 
          Assert.assertNotNull(r1);
          Assert.assertEquals("jellyfish2", r1.getText());
 
-         r1 = (TextMessage)cons1.receive(5000);
+         r1 = (TextMessage) cons1.receive(5000);
 
          Assert.assertNotNull(r1);
          Assert.assertEquals("jellyfish3", r1.getText());
 
-         r1 = (TextMessage)cons1.receive(5000);
+         r1 = (TextMessage) cons1.receive(5000);
 
          Assert.assertNotNull(r1);
          Assert.assertEquals("jellyfish4", r1.getText());
 
-         r1 = (TextMessage)cons1.receive(100);
+         r1 = (TextMessage) cons1.receive(100);
 
          Assert.assertNull(r1);
 
@@ -1476,31 +1472,31 @@ public class XATest extends JMSTestBase
          MessageConsumer cons = sess.createConsumer(queue1);
          conn2.start();
 
-         TextMessage r = (TextMessage)cons.receive(5000);
+         TextMessage r = (TextMessage) cons.receive(5000);
 
          Assert.assertNotNull(r);
 
          Assert.assertEquals("jellyfish1", r.getText());
 
-         r = (TextMessage)cons.receive(5000);
+         r = (TextMessage) cons.receive(5000);
 
          Assert.assertNotNull(r);
 
          Assert.assertEquals("jellyfish2", r.getText());
 
-         r = (TextMessage)cons.receive(5000);
+         r = (TextMessage) cons.receive(5000);
 
          Assert.assertNotNull(r);
 
          Assert.assertEquals("jellyfish3", r.getText());
 
-         r = (TextMessage)cons.receive(5000);
+         r = (TextMessage) cons.receive(5000);
 
          Assert.assertNotNull(r);
 
          Assert.assertEquals("jellyfish4", r.getText());
 
-         r = (TextMessage)cons.receive(100);
+         r = (TextMessage) cons.receive(100);
 
          Assert.assertNull(r);
       }
@@ -1565,11 +1561,11 @@ public class XATest extends JMSTestBase
          MessageConsumer cons = sess.createConsumer(queue1);
          conn2.start();
 
-         TextMessage r1 = (TextMessage)cons.receive(5000);
+         TextMessage r1 = (TextMessage) cons.receive(5000);
          Assert.assertNotNull(r1);
          Assert.assertEquals("echidna1", r1.getText());
 
-         TextMessage r2 = (TextMessage)cons.receive(5000);
+         TextMessage r2 = (TextMessage) cons.receive(5000);
          Assert.assertNotNull(r2);
          Assert.assertEquals("echidna2", r2.getText());
 
@@ -1606,9 +1602,9 @@ public class XATest extends JMSTestBase
 
          // Create 2 sessions and enlist them
          XASession sess1 = conn.createXASession();
-         ClientSessionInternal res1 = (ClientSessionInternal)sess1.getXAResource();
+         ClientSessionInternal res1 = (ClientSessionInternal) sess1.getXAResource();
          XASession sess2 = conn.createXASession();
-         ClientSessionInternal res2 = (ClientSessionInternal)sess2.getXAResource();
+         ClientSessionInternal res2 = (ClientSessionInternal) sess2.getXAResource();
          res1.setForceNotSameRM(true);
          res2.setForceNotSameRM(true);
 
@@ -1637,11 +1633,11 @@ public class XATest extends JMSTestBase
          MessageConsumer cons = sess.createConsumer(queue1);
          conn2.start();
 
-         TextMessage r1 = (TextMessage)cons.receive(5000);
+         TextMessage r1 = (TextMessage) cons.receive(5000);
          Assert.assertNotNull(r1);
          Assert.assertEquals("echidna1", r1.getText());
 
-         TextMessage r2 = (TextMessage)cons.receive(5000);
+         TextMessage r2 = (TextMessage) cons.receive(5000);
          Assert.assertNotNull(r2);
          Assert.assertEquals("echidna2", r2.getText());
 
@@ -1708,7 +1704,7 @@ public class XATest extends JMSTestBase
          MessageConsumer cons = sess.createConsumer(queue1);
          conn2.start();
 
-         TextMessage r1 = (TextMessage)cons.receive(100);
+         TextMessage r1 = (TextMessage) cons.receive(100);
          Assert.assertNull(r1);
 
       }
@@ -1742,9 +1738,9 @@ public class XATest extends JMSTestBase
 
          // Create 2 sessions and enlist them
          XASession sess1 = conn.createXASession();
-         ClientSessionInternal res1 = (ClientSessionInternal)sess1.getXAResource();
+         ClientSessionInternal res1 = (ClientSessionInternal) sess1.getXAResource();
          XASession sess2 = conn.createXASession();
-         ClientSessionInternal res2 = (ClientSessionInternal)sess2.getXAResource();
+         ClientSessionInternal res2 = (ClientSessionInternal) sess2.getXAResource();
          res1.setForceNotSameRM(true);
          res2.setForceNotSameRM(true);
 
@@ -1773,7 +1769,7 @@ public class XATest extends JMSTestBase
          MessageConsumer cons = sess.createConsumer(queue1);
          conn2.start();
 
-         TextMessage r1 = (TextMessage)cons.receive(100);
+         TextMessage r1 = (TextMessage) cons.receive(100);
          Assert.assertNull(r1);
       }
       finally
@@ -1823,7 +1819,7 @@ public class XATest extends JMSTestBase
 
          // Receive one message in one tx
 
-         TextMessage r1 = (TextMessage)cons1.receive(5000);
+         TextMessage r1 = (TextMessage) cons1.receive(5000);
          Assert.assertNotNull(r1);
          Assert.assertEquals("jellyfish1", r1.getText());
 
@@ -1838,7 +1834,7 @@ public class XATest extends JMSTestBase
          tx2.enlistResource(res1);
 
          // Receive 2nd message in a different tx
-         TextMessage r2 = (TextMessage)cons1.receive(5000);
+         TextMessage r2 = (TextMessage) cons1.receive(5000);
          Assert.assertNotNull(r2);
          Assert.assertEquals("jellyfish2", r2.getText());
 
@@ -1853,7 +1849,7 @@ public class XATest extends JMSTestBase
          Session sess = conn2.createSession(false, Session.AUTO_ACKNOWLEDGE);
          conn2.start();
          MessageConsumer cons = sess.createConsumer(queue1);
-         TextMessage r3 = (TextMessage)cons.receive(100);
+         TextMessage r3 = (TextMessage) cons.receive(100);
          Assert.assertNull(r3);
 
          // now resume the first tx and then commit it
@@ -1908,7 +1904,7 @@ public class XATest extends JMSTestBase
 
          // Receive one message in one tx
 
-         TextMessage r1 = (TextMessage)cons1.receive(5000);
+         TextMessage r1 = (TextMessage) cons1.receive(5000);
          Assert.assertNotNull(r1);
          Assert.assertEquals("jellyfish1", r1.getText());
 
@@ -1923,7 +1919,7 @@ public class XATest extends JMSTestBase
          tx2.enlistResource(res1);
 
          // Receive 2nd message in a different tx
-         TextMessage r2 = (TextMessage)cons1.receive(5000);
+         TextMessage r2 = (TextMessage) cons1.receive(5000);
          Assert.assertNotNull(r2);
          Assert.assertEquals("jellyfish2", r2.getText());
 
@@ -1941,11 +1937,11 @@ public class XATest extends JMSTestBase
          conn2.start();
          MessageConsumer cons = sess.createConsumer(queue1);
 
-         TextMessage r3 = (TextMessage)cons.receive(5000);
+         TextMessage r3 = (TextMessage) cons.receive(5000);
 
          Assert.assertNotNull(r3);
          Assert.assertEquals("jellyfish2", r3.getText());
-         r3 = (TextMessage)cons.receive(100);
+         r3 = (TextMessage) cons.receive(100);
          Assert.assertNull(r3);
 
          // rollback the other tx
@@ -1953,10 +1949,10 @@ public class XATest extends JMSTestBase
          tm.rollback();
 
          // Verify the first message is now available
-         r3 = (TextMessage)cons.receive(5000);
+         r3 = (TextMessage) cons.receive(5000);
          Assert.assertNotNull(r3);
          Assert.assertEquals("jellyfish1", r3.getText());
-         r3 = (TextMessage)cons.receive(100);
+         r3 = (TextMessage) cons.receive(100);
          Assert.assertNull(r3);
 
       }
@@ -2024,10 +2020,10 @@ public class XATest extends JMSTestBase
          Session sess = conn2.createSession(false, Session.AUTO_ACKNOWLEDGE);
          conn2.start();
          MessageConsumer cons = sess.createConsumer(queue1);
-         TextMessage r1 = (TextMessage)cons.receive(5000);
+         TextMessage r1 = (TextMessage) cons.receive(5000);
          Assert.assertNotNull(r1);
          Assert.assertEquals("kangaroo2", r1.getText());
-         TextMessage r2 = (TextMessage)cons.receive(100);
+         TextMessage r2 = (TextMessage) cons.receive(100);
          Assert.assertNull(r2);
 
          // now resume the first tx and then commit it
@@ -2036,7 +2032,7 @@ public class XATest extends JMSTestBase
          tm.commit();
 
          // verify that the first text message is received
-         TextMessage r3 = (TextMessage)cons.receive(5000);
+         TextMessage r3 = (TextMessage) cons.receive(5000);
          Assert.assertNotNull(r3);
          Assert.assertEquals("kangaroo1", r3.getText());