You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@karaf.apache.org by jb...@apache.org on 2015/01/20 11:25:34 UTC
karaf git commit: Improve JmsTest itest with using OSGi service
lookup instead of sleep
Repository: karaf
Updated Branches:
refs/heads/master e76a12b9a -> 23346643c
Improve JmsTest itest with using OSGi service lookup instead of sleep
Project: http://git-wip-us.apache.org/repos/asf/karaf/repo
Commit: http://git-wip-us.apache.org/repos/asf/karaf/commit/23346643
Tree: http://git-wip-us.apache.org/repos/asf/karaf/tree/23346643
Diff: http://git-wip-us.apache.org/repos/asf/karaf/diff/23346643
Branch: refs/heads/master
Commit: 23346643cafcf89a01b1a664f3774afe21a1c13e
Parents: e76a12b
Author: Jean-Baptiste Onofré <jb...@apache.org>
Authored: Tue Jan 20 11:25:01 2015 +0100
Committer: Jean-Baptiste Onofré <jb...@apache.org>
Committed: Tue Jan 20 11:25:01 2015 +0100
----------------------------------------------------------------------
itests/pom.xml | 6 ++++++
itests/src/test/java/org/apache/karaf/itests/JmsTest.java | 8 +++++---
2 files changed, 11 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/karaf/blob/23346643/itests/pom.xml
----------------------------------------------------------------------
diff --git a/itests/pom.xml b/itests/pom.xml
index 1e43d30..5675be5 100644
--- a/itests/pom.xml
+++ b/itests/pom.xml
@@ -61,6 +61,12 @@
</dependency>
<dependency>
+ <groupId>org.apache.geronimo.specs</groupId>
+ <artifactId>geronimo-jms_1.1_spec</artifactId>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
<groupId>org.ops4j.pax.exam</groupId>
<artifactId>pax-exam-container-karaf</artifactId>
<scope>test</scope>
http://git-wip-us.apache.org/repos/asf/karaf/blob/23346643/itests/src/test/java/org/apache/karaf/itests/JmsTest.java
----------------------------------------------------------------------
diff --git a/itests/src/test/java/org/apache/karaf/itests/JmsTest.java b/itests/src/test/java/org/apache/karaf/itests/JmsTest.java
index e2ef126..0d4efa8 100644
--- a/itests/src/test/java/org/apache/karaf/itests/JmsTest.java
+++ b/itests/src/test/java/org/apache/karaf/itests/JmsTest.java
@@ -23,6 +23,7 @@ import org.ops4j.pax.exam.spi.reactors.PerClass;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.assertEquals;
+import javax.jms.ConnectionFactory;
import javax.management.MBeanServerConnection;
import javax.management.ObjectName;
import javax.management.remote.JMXConnector;
@@ -44,8 +45,8 @@ public class JmsTest extends KarafTestSupport {
public void testCommands() throws Exception {
// jms:create command
System.out.println(executeCommand("jms:create -t ActiveMQ -u karaf -p karaf --url tcp://localhost:61616 test"));
- // give time to fileinstall to load the blueprint file
- Thread.sleep(5000);
+ // give time to fileinstall to load the blueprint file by looking for the connection factory OSGi service
+ getOsgiService(ConnectionFactory.class, "name=test" , 30000);
// jms:connectionfactories command
String connectionFactories = executeCommand("jms:connectionfactories");
System.out.println(connectionFactories);
@@ -98,7 +99,8 @@ public class JmsTest extends KarafTestSupport {
ObjectName name = new ObjectName("org.apache.karaf:type=jms,name=root");
// create operation
connection.invoke(name, "create", new String[]{ "testMBean", "activemq", "tcp://localhost:61616", "karaf", "karaf" }, new String[]{ "java.lang.String", "java.lang.String", "java.lang.String", "java.lang.String", "java.lang.String" });
- Thread.sleep(5000);
+ // give time to fileinstall to load the blueprint file by looking for the connection factory OSGi service
+ getOsgiService(ConnectionFactory.class, "name=testMBean" , 30000);
List<String> connectionFactories = (List<String>) connection.getAttribute(name, "Connectionfactories");
assertEquals(true, connectionFactories.size() >= 1);
// send operation