You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@uima.apache.org by cw...@apache.org on 2011/02/15 17:58:53 UTC
svn commit: r1070966 -
/uima/uima-as/trunk/uimaj-as-activemq/src/test/java/org/apache/uima/ee/test/utils/ActiveMQSupport.java
Author: cwiklik
Date: Tue Feb 15 16:58:53 2011
New Revision: 1070966
URL: http://svn.apache.org/viewvc?rev=1070966&view=rev
Log:
UIMA-2038 start and stop broker for each test to allow for better test isolation
Modified:
uima/uima-as/trunk/uimaj-as-activemq/src/test/java/org/apache/uima/ee/test/utils/ActiveMQSupport.java
Modified: uima/uima-as/trunk/uimaj-as-activemq/src/test/java/org/apache/uima/ee/test/utils/ActiveMQSupport.java
URL: http://svn.apache.org/viewvc/uima/uima-as/trunk/uimaj-as-activemq/src/test/java/org/apache/uima/ee/test/utils/ActiveMQSupport.java?rev=1070966&r1=1070965&r2=1070966&view=diff
==============================================================================
--- uima/uima-as/trunk/uimaj-as-activemq/src/test/java/org/apache/uima/ee/test/utils/ActiveMQSupport.java (original)
+++ uima/uima-as/trunk/uimaj-as-activemq/src/test/java/org/apache/uima/ee/test/utils/ActiveMQSupport.java Tue Feb 15 16:58:53 2011
@@ -71,46 +71,11 @@ public class ActiveMQSupport extends Tes
public static Semaphore brokerSemaphore = new Semaphore(1);
protected synchronized void setUp() throws Exception {
- System.out.println("\nSetting Up New Test - Thread Id:" + Thread.currentThread().getId());
super.setUp();
- if (brokerThreadGroup == null) {
- brokerThreadGroup = new ThreadGroup("BrokerThreadGroup");
-
- // Acquire a semaphore to force this thread to wait until the broker
- // starts and initializes
- brokerSemaphore.acquire();
-
- brokerThread = new Thread(brokerThreadGroup, "BrokerThread") {
- public void run() {
- try {
- broker = createBroker();
- broker.start();
- broker.setMasterConnectorURI(uri);
- addHttpConnector(8888);
-
- brokerSemaphore.release(); // broker started
- } catch (Exception e) {
- if (UIMAFramework.getLogger(CLASS_NAME).isLoggable(Level.WARNING)) {
- UIMAFramework.getLogger(CLASS_NAME).logrb(Level.WARNING, CLASS_NAME.getName(),
- "setUp", JmsConstants.JMS_LOG_RESOURCE_BUNDLE,
- "UIMAJMS_exception__WARNING", e);
- }
- }
- }
- };
-
- brokerThread.start();
- try {
- // wait for the broker to start and initialize. The semaphore is
- // released
- // in the run method above
- brokerSemaphore.acquire();
- } finally {
- brokerSemaphore.release();
- }
- } else {
- cleanBroker(broker);
- }
+ broker = createBroker();
+ broker.start();
+ broker.setMasterConnectorURI(uri);
+ addHttpConnector(8888);
}
protected void cleanBroker( BrokerService targetBroker) throws Exception {
// Remove messages from all queues
@@ -282,6 +247,7 @@ public class ActiveMQSupport extends Tes
removeHttpConnector();
broker.deleteAllMessages();
broker.stop();
+ broker.waitUntilStopped();
System.out.println(">>> Broker Stopped");
}
}
@@ -290,7 +256,7 @@ public class ActiveMQSupport extends Tes
super.tearDown();
System.clearProperty("activemq.broker.jmx.domain");
System.clearProperty("BrokerURL");
-
+ stopBroker();
}