tomee-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rmannibu...@apache.org
Subject tomee git commit: no need of handling ourself scheduler support
Date Thu, 08 Jan 2015 13:26:42 GMT
Repository: tomee
Updated Branches:
  refs/heads/develop 7bdc9e2f0 -> a7006405b


no need of handling ourself scheduler support


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

Branch: refs/heads/develop
Commit: a7006405bc2e3a8de0843e075d2f427f2ceeb76d
Parents: 7bdc9e2
Author: Romain Manni-Bucau <rmannibucau@apache.org>
Authored: Thu Jan 8 14:26:35 2015 +0100
Committer: Romain Manni-Bucau <rmannibucau@apache.org>
Committed: Thu Jan 8 14:26:35 2015 +0100

----------------------------------------------------------------------
 .../resource/activemq/ActiveMQ5Factory.java     |  9 ------
 .../activemq/ActiveMQResourceAdapterTest.java   | 34 ++++++++++++++++++++
 2 files changed, 34 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tomee/blob/a7006405/container/openejb-core/src/main/java/org/apache/openejb/resource/activemq/ActiveMQ5Factory.java
----------------------------------------------------------------------
diff --git a/container/openejb-core/src/main/java/org/apache/openejb/resource/activemq/ActiveMQ5Factory.java
b/container/openejb-core/src/main/java/org/apache/openejb/resource/activemq/ActiveMQ5Factory.java
index fdfe64d..1c338dc 100644
--- a/container/openejb-core/src/main/java/org/apache/openejb/resource/activemq/ActiveMQ5Factory.java
+++ b/container/openejb-core/src/main/java/org/apache/openejb/resource/activemq/ActiveMQ5Factory.java
@@ -70,18 +70,12 @@ public class ActiveMQ5Factory implements BrokerFactoryHandler {
         if (null == broker || !broker.isStarted()) {
 
             final Properties properties = getLowerCaseProperties();
-            boolean scheduleSupport = false;
 
             final URISupport.CompositeData compositeData = URISupport.parseComposite(new
URI(brokerURI.getRawSchemeSpecificPart()));
             final Map<String, String> params = new HashMap<String, String>(compositeData.getParameters());
             final PersistenceAdapter persistenceAdapter;
             if ("true".equals(params.remove("usekahadb"))) {
                 persistenceAdapter = createPersistenceAdapter("org.apache.activemq.store.kahadb.KahaDBPersistenceAdapter",
"kahadb", params);
-
-                if ("true".equals(params.remove("scheduler"))) {
-                    scheduleSupport = true;
-                }
-
             } else if ("true".equals(params.remove("useleveldb"))) {
                 persistenceAdapter = createPersistenceAdapter("org.apache.activemq.store.leveldb.LevelDBPersistenceAdapter",
"leveldb", params);
             } else if (params.get("persistenceadapter") != null) {
@@ -95,8 +89,6 @@ public class ActiveMQ5Factory implements BrokerFactoryHandler {
             broker = BrokerFactory.createBroker(uri);
             brokers.put(brokerURI, broker);
 
-            broker.setSchedulerSupport(scheduleSupport);
-
             if (persistenceAdapter != null) {
                 broker.setPersistenceAdapter(persistenceAdapter);
                 // if user didn't set persistent to true then setPersistenceAdapter() alone
is ignored so forcing it with the factory
@@ -293,7 +285,6 @@ public class ActiveMQ5Factory implements BrokerFactoryHandler {
     }
 
     private void tomeeConfig(final BrokerService broker) {
-
         //Notify when an error occurs on shutdown.
         broker.setUseLoggingForShutdownErrors(Logger.getInstance(LogCategory.OPENEJB_STARTUP,
ActiveMQ5Factory.class).isErrorEnabled());
     }

http://git-wip-us.apache.org/repos/asf/tomee/blob/a7006405/container/openejb-core/src/test/java/org/apache/openejb/resource/activemq/ActiveMQResourceAdapterTest.java
----------------------------------------------------------------------
diff --git a/container/openejb-core/src/test/java/org/apache/openejb/resource/activemq/ActiveMQResourceAdapterTest.java
b/container/openejb-core/src/test/java/org/apache/openejb/resource/activemq/ActiveMQResourceAdapterTest.java
index dfad874..7764b80 100644
--- a/container/openejb-core/src/test/java/org/apache/openejb/resource/activemq/ActiveMQResourceAdapterTest.java
+++ b/container/openejb-core/src/test/java/org/apache/openejb/resource/activemq/ActiveMQResourceAdapterTest.java
@@ -18,12 +18,29 @@
 package org.apache.openejb.resource.activemq;
 
 import junit.framework.TestCase;
+import org.apache.activemq.broker.BrokerService;
 import org.apache.openejb.util.Duration;
 import org.apache.openejb.util.NetworkUtil;
+import org.apache.openejb.util.reflection.Reflections;
 
 import java.util.concurrent.TimeUnit;
 
 public class ActiveMQResourceAdapterTest extends TestCase {
+    @Override
+    protected void tearDown() throws Exception {
+        cleanup();
+    }
+    @Override
+    protected void setUp() throws Exception {
+        cleanup();
+    }
+
+    private void cleanup() throws Exception {
+        for (final BrokerService bs : ActiveMQFactory.getBrokers()) {
+            bs.stop();
+        }
+    }
+
     public void test() throws Exception {
         final ActiveMQResourceAdapter resourceAdapter = new ActiveMQResourceAdapter();
         resourceAdapter.setServerUrl("vm://localhost?waitForStart=30000&async=false");
@@ -36,4 +53,21 @@ public class ActiveMQResourceAdapterTest extends TestCase {
         //
         resourceAdapter.start(null);
     }
+
+    public void testSchedulerSupport() throws Exception {
+        final ActiveMQResourceAdapter resourceAdapter = new ActiveMQResourceAdapter();
+        resourceAdapter.setServerUrl("vm://localhost?waitForStart=30000&async=false");
+        resourceAdapter.setStartupTimeout(new Duration(10, TimeUnit.SECONDS));
+
+        final String brokerAddress = NetworkUtil.getLocalAddress("broker:(tcp://", ")?useJmx=false&schedulerSupport=true");
+        resourceAdapter.setBrokerXmlConfig(brokerAddress);
+        resourceAdapter.start(null);
+        assertTrue(Boolean.class.cast(Reflections.get(ActiveMQFactory.getBrokers().iterator().next(),
"schedulerSupport")));
+        resourceAdapter.stop();
+
+        resourceAdapter.setBrokerXmlConfig(NetworkUtil.getLocalAddress("broker:(tcp://",
")?useJmx=false&schedulerSupport=false"));
+        resourceAdapter.start(null);
+        assertFalse(Boolean.class.cast(Reflections.get(ActiveMQFactory.getBrokers().iterator().next(),
"schedulerSupport")));
+        resourceAdapter.stop();
+    }
 }


Mime
View raw message