cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cschnei...@apache.org
Subject git commit: Improving JMS tests
Date Wed, 07 May 2014 10:36:42 GMT
Repository: cxf
Updated Branches:
  refs/heads/master 5af5c7b62 -> 148bbc8f4


Improving JMS tests


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

Branch: refs/heads/master
Commit: 148bbc8f4a30ecd801e87db7b6621c5d39deb478
Parents: 5af5c7b
Author: Christian Schneider <chris@die-schneider.net>
Authored: Wed May 7 12:36:26 2014 +0200
Committer: Christian Schneider <chris@die-schneider.net>
Committed: Wed May 7 12:36:26 2014 +0200

----------------------------------------------------------------------
 .../cxf/osgi/itests/soap/JmsServiceTest.java    | 12 ++++++---
 .../cxf/osgi/itests/soap/JmsTestActivator.java  | 26 +++++++++++---------
 2 files changed, 24 insertions(+), 14 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cxf/blob/148bbc8f/osgi/itests/src/test/java/org/apache/cxf/osgi/itests/soap/JmsServiceTest.java
----------------------------------------------------------------------
diff --git a/osgi/itests/src/test/java/org/apache/cxf/osgi/itests/soap/JmsServiceTest.java
b/osgi/itests/src/test/java/org/apache/cxf/osgi/itests/soap/JmsServiceTest.java
index 31cce39..797f89e 100644
--- a/osgi/itests/src/test/java/org/apache/cxf/osgi/itests/soap/JmsServiceTest.java
+++ b/osgi/itests/src/test/java/org/apache/cxf/osgi/itests/soap/JmsServiceTest.java
@@ -21,6 +21,8 @@ package org.apache.cxf.osgi.itests.soap;
 import java.io.InputStream;
 import java.util.Collections;
 
+import javax.jms.ConnectionFactory;
+
 import org.apache.activemq.spring.ActiveMQConnectionFactory;
 import org.apache.cxf.jaxws.JaxWsProxyFactoryBean;
 import org.apache.cxf.osgi.itests.CXFOSGiTestSupport;
@@ -37,7 +39,6 @@ import org.ops4j.pax.exam.spi.reactors.ExamReactorStrategy;
 import org.ops4j.pax.exam.spi.reactors.PerClass;
 import org.ops4j.pax.tinybundles.core.TinyBundles;
 import org.osgi.framework.Constants;
-
 import static org.ops4j.pax.exam.CoreOptions.maven;
 import static org.ops4j.pax.exam.CoreOptions.provision;
 import static org.ops4j.pax.exam.karaf.options.KarafDistributionOption.features;
@@ -58,11 +59,16 @@ public class JmsServiceTest extends CXFOSGiTestSupport {
         JaxWsProxyFactoryBean factory = new JaxWsProxyFactoryBean();
         factory.setServiceClass(Greeter.class);
         factory.setAddress("jms:queue:greeter");
+        ConnectionFactory connectionFactory = createConnectionFactory();
+        factory.setFeatures(Collections.singletonList(new ConnectionFactoryFeature(connectionFactory)));
+        return factory.create(Greeter.class);
+    }
+
+    private ActiveMQConnectionFactory createConnectionFactory() {
         ActiveMQConnectionFactory connectionFactory = new ActiveMQConnectionFactory();
         connectionFactory.setUserName("karaf");
         connectionFactory.setPassword("karaf");
-        factory.setFeatures(Collections.singletonList(new ConnectionFactoryFeature(connectionFactory)));
-        return factory.create(Greeter.class);
+        return connectionFactory;
     }
 
     @Configuration

http://git-wip-us.apache.org/repos/asf/cxf/blob/148bbc8f/osgi/itests/src/test/java/org/apache/cxf/osgi/itests/soap/JmsTestActivator.java
----------------------------------------------------------------------
diff --git a/osgi/itests/src/test/java/org/apache/cxf/osgi/itests/soap/JmsTestActivator.java
b/osgi/itests/src/test/java/org/apache/cxf/osgi/itests/soap/JmsTestActivator.java
index c04fcbe..f1d3f4c 100644
--- a/osgi/itests/src/test/java/org/apache/cxf/osgi/itests/soap/JmsTestActivator.java
+++ b/osgi/itests/src/test/java/org/apache/cxf/osgi/itests/soap/JmsTestActivator.java
@@ -20,6 +20,8 @@ package org.apache.cxf.osgi.itests.soap;
 
 import java.util.Collections;
 
+import javax.jms.ConnectionFactory;
+
 import org.apache.activemq.spring.ActiveMQConnectionFactory;
 import org.apache.cxf.endpoint.Server;
 import org.apache.cxf.jaxws.JaxWsServerFactoryBean;
@@ -32,22 +34,24 @@ public class JmsTestActivator implements BundleActivator {
 
     @Override
     public void start(BundleContext bc) throws Exception {
-        /*
-        ServiceTracker tracker = new ServiceTracker(bc, ConnectionFactory.class.getName(),
null);
-        */
-        // This can block the activator. Use an async approach in production code
-        /*
-        ConnectionFactory connectionFactory = (ConnectionFactory)tracker.getService();
-        */
-        ActiveMQConnectionFactory connectionFactory = new ActiveMQConnectionFactory();
-        connectionFactory.setUserName("karaf");
-        connectionFactory.setPassword("karaf");
+        ConnectionFactory connectionFactory = createConnectionFactory();
+        server = publishService(connectionFactory);
+    }
+
+    private Server publishService(ConnectionFactory connectionFactory) {
         JaxWsServerFactoryBean factory = new JaxWsServerFactoryBean();
         factory.setServiceClass(Greeter.class);
         factory.setAddress("jms:queue:greeter");
         factory.setFeatures(Collections.singletonList(new ConnectionFactoryFeature(connectionFactory)));
         factory.setServiceBean(new GreeterImpl());
-        server = factory.create();
+        return factory.create();
+    }
+
+    private ActiveMQConnectionFactory createConnectionFactory() {
+        ActiveMQConnectionFactory connectionFactory = new ActiveMQConnectionFactory();
+        connectionFactory.setUserName("karaf");
+        connectionFactory.setPassword("karaf");
+        return connectionFactory;
     }
 
     @Override


Mime
View raw message