activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From clebertsuco...@apache.org
Subject [54/61] [abbrv] activemq-artemis git commit: fixing tests and removing new Executor().run(...) usages
Date Wed, 16 Mar 2016 15:22:23 GMT
fixing tests and removing new Executor().run(...) usages


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

Branch: refs/heads/refactor-openwire
Commit: 966454d09abb7883ed53e126aa94a7a136a24790
Parents: cdb904c
Author: Clebert Suconic <clebertsuconic@apache.org>
Authored: Wed Feb 24 13:17:03 2016 -0500
Committer: Clebert Suconic <clebertsuconic@apache.org>
Committed: Wed Mar 16 11:19:15 2016 -0400

----------------------------------------------------------------------
 .../FailoverConsumerOutstandingCommitTest.java  | 14 +++----
 .../FailoverConsumerUnconsumedTest.java         | 16 ++++----
 .../failover/FailoverDuplicateTest.java         |  8 ++--
 .../failover/FailoverPrefetchZeroTest.java      |  8 ++--
 .../failover/FailoverTransactionTest.java       | 40 ++++++++++----------
 .../TwoBrokerQueueClientsReconnectTest.java     |  8 ++--
 6 files changed, 47 insertions(+), 47 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/966454d0/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/transport/failover/FailoverConsumerOutstandingCommitTest.java
----------------------------------------------------------------------
diff --git a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/transport/failover/FailoverConsumerOutstandingCommitTest.java
b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/transport/failover/FailoverConsumerOutstandingCommitTest.java
index 705c033..5a160ab 100644
--- a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/transport/failover/FailoverConsumerOutstandingCommitTest.java
+++ b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/transport/failover/FailoverConsumerOutstandingCommitTest.java
@@ -139,7 +139,7 @@ public class FailoverConsumerOutstandingCommitTest extends OpenwireArtemisBaseTe
       });
 
       // may block if broker shutodwn happens quickly
-      Executors.newSingleThreadExecutor().execute(new Runnable() {
+      new Thread() {
          public void run() {
             LOG.info("producer started");
             try {
@@ -153,9 +153,9 @@ public class FailoverConsumerOutstandingCommitTest extends OpenwireArtemisBaseTe
             }
             LOG.info("producer done");
          }
-      });
+      }.start();
 
-      // will be stopped by the plugin
+   // will be stopped by the plugin
       brokerStopLatch.await();
       server.stop();
       server = createBroker();
@@ -253,7 +253,7 @@ public class FailoverConsumerOutstandingCommitTest extends OpenwireArtemisBaseTe
       });
 
       // may block if broker shutdown happens quickly
-      Executors.newSingleThreadExecutor().execute(new Runnable() {
+      new Thread() {
          public void run() {
             LOG.info("producer started");
             try {
@@ -267,7 +267,7 @@ public class FailoverConsumerOutstandingCommitTest extends OpenwireArtemisBaseTe
             }
             LOG.info("producer done");
          }
-      });
+      }.start();
 
       // will be stopped by the plugin
       brokerStopLatch.await();
@@ -364,7 +364,7 @@ public class FailoverConsumerOutstandingCommitTest extends OpenwireArtemisBaseTe
 
    public static void stopServerInTransaction() {
       if (doByteman.get()) {
-         Executors.newSingleThreadExecutor().execute(new Runnable() {
+         new Thread() {
             public void run() {
                LOG.info("Stopping broker in transaction...");
                try {
@@ -377,7 +377,7 @@ public class FailoverConsumerOutstandingCommitTest extends OpenwireArtemisBaseTe
                   brokerStopLatch.countDown();
                }
             }
-         });
+         }.start();
       }
    }
 }

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/966454d0/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/transport/failover/FailoverConsumerUnconsumedTest.java
----------------------------------------------------------------------
diff --git a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/transport/failover/FailoverConsumerUnconsumedTest.java
b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/transport/failover/FailoverConsumerUnconsumedTest.java
index 10927f2..fb9479c 100644
--- a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/transport/failover/FailoverConsumerUnconsumedTest.java
+++ b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/transport/failover/FailoverConsumerUnconsumedTest.java
@@ -180,7 +180,7 @@ public class FailoverConsumerUnconsumedTest extends OpenwireArtemisBaseTest
{
 
       final CountDownLatch shutdownConsumerAdded = new CountDownLatch(1);
 
-      Executors.newSingleThreadExecutor().execute(new Runnable() {
+      new Thread() {
          public void run() {
             try {
                LOG.info("add last consumer...");
@@ -204,7 +204,7 @@ public class FailoverConsumerUnconsumedTest extends OpenwireArtemisBaseTest
{
                e.printStackTrace();
             }
          }
-      });
+      }.start();
 
       brokerStopLatch.await();
       doByteman.set(false);
@@ -272,7 +272,7 @@ public class FailoverConsumerUnconsumedTest extends OpenwireArtemisBaseTest
{
 
       final CountDownLatch shutdownConsumerAdded = new CountDownLatch(1);
 
-      Executors.newSingleThreadExecutor().execute(new Runnable() {
+      new Thread() {
          public void run() {
             try {
                LOG.info("add last consumer...");
@@ -284,7 +284,7 @@ public class FailoverConsumerUnconsumedTest extends OpenwireArtemisBaseTest
{
                e.printStackTrace();
             }
          }
-      });
+      }.start();
 
       // verify interrupt
       assertTrue("add messages dispatched and unconsumed are cleaned up", Wait.waitFor(new
Wait.Condition() {
@@ -364,7 +364,7 @@ public class FailoverConsumerUnconsumedTest extends OpenwireArtemisBaseTest
{
       if (doByteman.get()) {
          if (consumerCount.incrementAndGet() == maxConsumers) {
             context.getContext().setDontSendReponse(true);
-            Executors.newSingleThreadExecutor().execute(new Runnable() {
+            new Thread() {
                public void run() {
                   try {
                      broker.stop();
@@ -374,7 +374,7 @@ public class FailoverConsumerUnconsumedTest extends OpenwireArtemisBaseTest
{
                      e.printStackTrace();
                   }
                }
-            });
+            }.start();
          }
       }
    }
@@ -383,7 +383,7 @@ public class FailoverConsumerUnconsumedTest extends OpenwireArtemisBaseTest
{
       if (doByteman.get()) {
          if (consumerCount.incrementAndGet() == maxConsumers + (watchTopicAdvisories.get()
? 1 : 0)) {
             context.getContext().setDontSendReponse(true);
-            Executors.newSingleThreadExecutor().execute(new Runnable() {
+            new Thread() {
                public void run() {
                   try {
                      broker.stop();
@@ -394,7 +394,7 @@ public class FailoverConsumerUnconsumedTest extends OpenwireArtemisBaseTest
{
                      e.printStackTrace();
                   }
                }
-            });
+            }.start();
          }
       }
    }

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/966454d0/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/transport/failover/FailoverDuplicateTest.java
----------------------------------------------------------------------
diff --git a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/transport/failover/FailoverDuplicateTest.java
b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/transport/failover/FailoverDuplicateTest.java
index 89d006a..2e40459 100644
--- a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/transport/failover/FailoverDuplicateTest.java
+++ b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/transport/failover/FailoverDuplicateTest.java
@@ -131,7 +131,7 @@ public class FailoverDuplicateTest extends OpenwireArtemisBaseTest {
 
       final CountDownLatch sendDoneLatch = new CountDownLatch(1);
       // broker will die on send reply so this will hang till restart
-      Executors.newSingleThreadExecutor().execute(new Runnable() {
+      new Thread() {
          @Override
          public void run() {
             LOG.info("doing async send...");
@@ -145,7 +145,7 @@ public class FailoverDuplicateTest extends OpenwireArtemisBaseTest {
             sendDoneLatch.countDown();
             LOG.info("done async send");
          }
-      });
+      }.start();
 
       Assert.assertTrue("one message got through on time", gotMessageLatch.await(20, TimeUnit.SECONDS));
       // send more messages, blow producer audit
@@ -215,7 +215,7 @@ public class FailoverDuplicateTest extends OpenwireArtemisBaseTest {
       if (doByteman.get()) {
          if (first.compareAndSet(false, true)) {
             context.getContext().setDontSendReponse(true);
-            Executors.newSingleThreadExecutor().execute(new Runnable() {
+            new Thread() {
                @Override
                public void run() {
                   try {
@@ -229,7 +229,7 @@ public class FailoverDuplicateTest extends OpenwireArtemisBaseTest {
                      e.printStackTrace();
                   }
                }
-            });
+            }.start();
          }
       }
    }

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/966454d0/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/transport/failover/FailoverPrefetchZeroTest.java
----------------------------------------------------------------------
diff --git a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/transport/failover/FailoverPrefetchZeroTest.java
b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/transport/failover/FailoverPrefetchZeroTest.java
index 5981845..64c1ccd 100644
--- a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/transport/failover/FailoverPrefetchZeroTest.java
+++ b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/transport/failover/FailoverPrefetchZeroTest.java
@@ -101,7 +101,7 @@ public class FailoverPrefetchZeroTest extends OpenwireArtemisBaseTest
{
 
       final CountDownLatch receiveDone = new CountDownLatch(1);
       final Vector<Message> received = new Vector<>();
-      Executors.newSingleThreadExecutor().execute(new Runnable() {
+      new Thread() {
          public void run() {
             try {
                LOG.info("receive one...");
@@ -116,7 +116,7 @@ public class FailoverPrefetchZeroTest extends OpenwireArtemisBaseTest
{
                e.printStackTrace();
             }
          }
-      });
+      }.start();
 
       // will be stopped by the plugin
       assertTrue("pull completed on broker", pullDone.await(30, TimeUnit.SECONDS));
@@ -146,7 +146,7 @@ public class FailoverPrefetchZeroTest extends OpenwireArtemisBaseTest
{
       if (doByteman.get()) {
          context.getContext().setDontSendReponse(true);
          pullDone.countDown();
-         Executors.newSingleThreadExecutor().execute(new Runnable() {
+         new Thread() {
             public void run() {
                try {
                   broker.stop();
@@ -158,7 +158,7 @@ public class FailoverPrefetchZeroTest extends OpenwireArtemisBaseTest
{
                   brokerStopLatch.countDown();
                }
             }
-         });
+         }.start();
       }
    }
 

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/966454d0/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/transport/failover/FailoverTransactionTest.java
----------------------------------------------------------------------
diff --git a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/transport/failover/FailoverTransactionTest.java
b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/transport/failover/FailoverTransactionTest.java
index a3e023a..6cd6942 100644
--- a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/transport/failover/FailoverTransactionTest.java
+++ b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/transport/failover/FailoverTransactionTest.java
@@ -162,7 +162,7 @@ public class FailoverTransactionTest extends OpenwireArtemisBaseTest {
 
       final CountDownLatch commitDoneLatch = new CountDownLatch(1);
       // broker will die on commit reply so this will hang till restart
-      Executors.newSingleThreadExecutor().execute(new Runnable() {
+      new Thread() {
          public void run() {
             LOG.info("doing async commit...");
             try {
@@ -175,7 +175,7 @@ public class FailoverTransactionTest extends OpenwireArtemisBaseTest {
             commitDoneLatch.countDown();
             LOG.info("done async commit");
          }
-      });
+      }.start();
 
       // will be stopped by the plugin
       brokerStopLatch.await();
@@ -256,7 +256,7 @@ public class FailoverTransactionTest extends OpenwireArtemisBaseTest {
       MessageConsumer consumer = session.createConsumer(destination);
       final CountDownLatch sendDoneLatch = new CountDownLatch(1);
       // broker will die on send reply so this will hang till restart
-      Executors.newSingleThreadExecutor().execute(new Runnable() {
+      new Thread() {
          public void run() {
             LOG.info("doing async send...");
             try {
@@ -270,7 +270,7 @@ public class FailoverTransactionTest extends OpenwireArtemisBaseTest {
             sendDoneLatch.countDown();
             LOG.info("done async send");
          }
-      });
+      }.start();
 
       // will be stopped by the plugin
       brokerStopLatch.await();
@@ -345,7 +345,7 @@ public class FailoverTransactionTest extends OpenwireArtemisBaseTest {
       MessageConsumer consumer = session.createConsumer(destination);
       final CountDownLatch sendDoneLatch = new CountDownLatch(1);
       // proxy connection will die on send reply so this will hang on failover reconnect
till open
-      Executors.newSingleThreadExecutor().execute(new Runnable() {
+      new Thread() {
          public void run() {
             LOG.info("doing async send...");
             try {
@@ -358,7 +358,7 @@ public class FailoverTransactionTest extends OpenwireArtemisBaseTest {
             sendDoneLatch.countDown();
             LOG.info("done async send");
          }
-      });
+      }.start();
 
       // will be closed by the plugin
       Assert.assertTrue("proxy was closed", proxy.waitUntilClosed(30));
@@ -568,7 +568,7 @@ public class FailoverTransactionTest extends OpenwireArtemisBaseTest {
       final Vector<Message> receivedMessages = new Vector<>();
       final CountDownLatch commitDoneLatch = new CountDownLatch(1);
       final AtomicBoolean gotTransactionRolledBackException = new AtomicBoolean(false);
-      Executors.newSingleThreadExecutor().execute(new Runnable() {
+      new Thread() {
          public void run() {
             LOG.info("doing async commit after consume...");
             try {
@@ -615,7 +615,7 @@ public class FailoverTransactionTest extends OpenwireArtemisBaseTest {
                e.printStackTrace();
             }
          }
-      });
+      }.start();
 
       // will be stopped by the plugin
       brokerStopLatch.await();
@@ -684,7 +684,7 @@ public class FailoverTransactionTest extends OpenwireArtemisBaseTest {
                            targetClass = "org.apache.activemq.artemis.core.protocol.openwire.OpenWireConnection$CommandProcessor",
                            targetMethod = "processRemoveConsumer",
                            targetLocation = "ENTRY",
-                           action = "org.apache.activemq.transport.failover.FailoverTransactionTest.stopBrokerOnCounter($0)")
+                           action = "org.apache.activemq.transport.failover.FailoverTransactionTest.stopBrokerOnCounter()")
            }
    )
    public void testPoolingNConsumesAfterReconnect() throws Exception {
@@ -873,7 +873,7 @@ public class FailoverTransactionTest extends OpenwireArtemisBaseTest {
 
       final CountDownLatch commitDone = new CountDownLatch(1);
       // will block pending re-deliveries
-      Executors.newSingleThreadExecutor().execute(new Runnable() {
+      new Thread() {
          public void run() {
             LOG.info("doing async commit...");
             try {
@@ -883,7 +883,7 @@ public class FailoverTransactionTest extends OpenwireArtemisBaseTest {
             catch (JMSException ignored) {
             }
          }
-      });
+      }.start();
 
       broker.stop();
       broker = createBroker();
@@ -928,7 +928,7 @@ public class FailoverTransactionTest extends OpenwireArtemisBaseTest {
       final Vector<Exception> exceptions = new Vector<>();
 
       // commit may fail if other consumer gets the message on restart
-      Executors.newSingleThreadExecutor().execute(new Runnable() {
+      new Thread() {
          public void run() {
             LOG.info("doing async commit...");
             try {
@@ -941,7 +941,7 @@ public class FailoverTransactionTest extends OpenwireArtemisBaseTest {
                commitDone.countDown();
             }
          }
-      });
+      }.start();
 
       Assert.assertTrue("commit completed ", commitDone.await(15, TimeUnit.SECONDS));
 
@@ -975,7 +975,7 @@ public class FailoverTransactionTest extends OpenwireArtemisBaseTest {
    public static void holdResponseAndStopBroker(final OpenWireConnection.CommandProcessor
context) {
       if (doByteman.get()) {
          context.getContext().setDontSendReponse(true);
-         Executors.newSingleThreadExecutor().execute(new Runnable() {
+         new Thread() {
             public void run() {
                LOG.info("Stopping broker post commit...");
                try {
@@ -988,7 +988,7 @@ public class FailoverTransactionTest extends OpenwireArtemisBaseTest {
                   brokerStopLatch.countDown();
                }
             }
-         });
+         }.start();
       }
    }
 
@@ -997,7 +997,7 @@ public class FailoverTransactionTest extends OpenwireArtemisBaseTest {
          if (firstSend) {
             firstSend = false;
             context.getContext().setDontSendReponse(true);
-            Executors.newSingleThreadExecutor().execute(new Runnable() {
+            new Thread() {
                public void run() {
                   LOG.info("Stopping connection post send...");
                   try {
@@ -1007,15 +1007,15 @@ public class FailoverTransactionTest extends OpenwireArtemisBaseTest
{
                      e.printStackTrace();
                   }
                }
-            });
+            }.start();
          }
       }
    }
 
-   public static void stopBrokerOnCounter(final AMQConnectionContext context) {
+   public static void stopBrokerOnCounter() {
       if (doByteman.get()) {
          if (count++ == 1) {
-            Executors.newSingleThreadExecutor().execute(new Runnable() {
+            new Thread() {
                public void run() {
                   try {
                      broker.stop();
@@ -1027,7 +1027,7 @@ public class FailoverTransactionTest extends OpenwireArtemisBaseTest
{
                      brokerStopLatch.countDown();
                   }
                }
-            });
+            }.start();
          }
       }
    }

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/966454d0/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/usecases/TwoBrokerQueueClientsReconnectTest.java
----------------------------------------------------------------------
diff --git a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/usecases/TwoBrokerQueueClientsReconnectTest.java
b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/usecases/TwoBrokerQueueClientsReconnectTest.java
index e78ab2f..534e68b 100644
--- a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/usecases/TwoBrokerQueueClientsReconnectTest.java
+++ b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/usecases/TwoBrokerQueueClientsReconnectTest.java
@@ -390,7 +390,7 @@ public class TwoBrokerQueueClientsReconnectTest extends JmsMultipleBrokersTestSu
             super.send(producerExchange, messageSend);
             if (first.compareAndSet(false, true)) {
                producerExchange.getConnectionContext().setDontSendReponse(true);
-               Executors.newSingleThreadExecutor().execute(new Runnable() {
+               new Thread() {
                   @Override
                   public void run() {
                      try {
@@ -403,7 +403,7 @@ public class TwoBrokerQueueClientsReconnectTest extends JmsMultipleBrokersTestSu
                         e.printStackTrace();
                      }
                   }
-               });
+               }.start();
             }
          }
       }});
@@ -465,7 +465,7 @@ public class TwoBrokerQueueClientsReconnectTest extends JmsMultipleBrokersTestSu
             super.send(producerExchange, messageSend);
             if (first.compareAndSet(false, true)) {
                producerExchange.getConnectionContext().setDontSendReponse(true);
-               Executors.newSingleThreadExecutor().execute(new Runnable() {
+               new Thread() {
                   @Override
                   public void run() {
                      try {
@@ -478,7 +478,7 @@ public class TwoBrokerQueueClientsReconnectTest extends JmsMultipleBrokersTestSu
                         e.printStackTrace();
                      }
                   }
-               });
+               }.start();
             }
          }
       }});


Mime
View raw message