activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gtu...@apache.org
Subject svn commit: r1464068 - in /activemq/trunk/activemq-karaf-itest/src/test: java/org/apache/activemq/karaf/itest/ resources/org/apache/activemq/karaf/itest/
Date Wed, 03 Apr 2013 15:20:06 GMT
Author: gtully
Date: Wed Apr  3 15:20:06 2013
New Revision: 1464068

URL: http://svn.apache.org/r1464068
Log:
https://issues.apache.org/jira/browse/AMQ-4432 - validate camel spring route to deploy directory

Added:
    activemq/trunk/activemq-karaf-itest/src/test/java/org/apache/activemq/karaf/itest/AbstractJmsFeatureTest.java
      - copied, changed from r1463923, activemq/trunk/activemq-karaf-itest/src/test/java/org/apache/activemq/karaf/itest/ActiveMQBrokerFeatureTest.java
    activemq/trunk/activemq-karaf-itest/src/test/java/org/apache/activemq/karaf/itest/ActiveMQBrokerNdExternalCamelFeatureTest.java
      - copied, changed from r1463923, activemq/trunk/activemq-karaf-itest/src/test/java/org/apache/activemq/karaf/itest/ActiveMQBrokerNdCamelFeatureTest.java
    activemq/trunk/activemq-karaf-itest/src/test/resources/org/apache/activemq/karaf/itest/camel.xml
  (with props)
Modified:
    activemq/trunk/activemq-karaf-itest/src/test/java/org/apache/activemq/karaf/itest/ActiveMQBrokerFeatureTest.java
    activemq/trunk/activemq-karaf-itest/src/test/java/org/apache/activemq/karaf/itest/ActiveMQBrokerNdCamelFeatureTest.java
    activemq/trunk/activemq-karaf-itest/src/test/java/org/apache/activemq/karaf/itest/ObrFeatureTest.java

Copied: activemq/trunk/activemq-karaf-itest/src/test/java/org/apache/activemq/karaf/itest/AbstractJmsFeatureTest.java
(from r1463923, activemq/trunk/activemq-karaf-itest/src/test/java/org/apache/activemq/karaf/itest/ActiveMQBrokerFeatureTest.java)
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-karaf-itest/src/test/java/org/apache/activemq/karaf/itest/AbstractJmsFeatureTest.java?p2=activemq/trunk/activemq-karaf-itest/src/test/java/org/apache/activemq/karaf/itest/AbstractJmsFeatureTest.java&p1=activemq/trunk/activemq-karaf-itest/src/test/java/org/apache/activemq/karaf/itest/ActiveMQBrokerFeatureTest.java&r1=1463923&r2=1464068&rev=1464068&view=diff
==============================================================================
--- activemq/trunk/activemq-karaf-itest/src/test/java/org/apache/activemq/karaf/itest/ActiveMQBrokerFeatureTest.java
(original)
+++ activemq/trunk/activemq-karaf-itest/src/test/java/org/apache/activemq/karaf/itest/AbstractJmsFeatureTest.java
Wed Apr  3 15:20:06 2013
@@ -16,65 +16,21 @@
  */
 package org.apache.activemq.karaf.itest;
 
-import java.util.concurrent.Callable;
 import javax.jms.Connection;
 import javax.jms.MessageConsumer;
 import javax.jms.Session;
 import javax.jms.TextMessage;
 import org.apache.activemq.ActiveMQConnectionFactory;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.ops4j.pax.exam.Option;
-import org.ops4j.pax.exam.junit.Configuration;
-import org.ops4j.pax.exam.junit.JUnit4TestRunner;
 
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
-
-@RunWith(JUnit4TestRunner.class)
-public class ActiveMQBrokerFeatureTest extends AbstractFeatureTest {
-
-    @Configuration
-    public static Option[] configure() {
-        return configureBrokerStart(configure("activemq"));
-    }
-
-    @Test
-    public void test() throws Throwable {
-
-        withinReason(new Callable<Boolean>() {
-            @Override
-            public Boolean call() throws Exception {
-                assertEquals("brokerName = amq-broker", executeCommand("activemq:list").trim());
-                return true;
-            }
-        });
-
-
-        withinReason(new Callable<Boolean>(){
-            @Override
-            public Boolean call() throws Exception {
-                assertTrue(executeCommand("activemq:bstat").trim().contains("BrokerName =
amq-broker"));
-                return true;
-            }
-        });
-
-        // produce and consume
-        final String nameAndPayload = String.valueOf(System.currentTimeMillis());
-        produceMessage(nameAndPayload);
-
-        System.err.println(executeCommand("activemq:bstat").trim());
-
-        assertEquals("got our message", nameAndPayload, consumeMessage(nameAndPayload));
-    }
+public abstract class AbstractJmsFeatureTest extends AbstractFeatureTest {
 
     protected String consumeMessage(String nameAndPayload) throws Exception {
         ActiveMQConnectionFactory factory = new ActiveMQConnectionFactory();
-        Connection connection = factory.createConnection(USER,PASSWORD);
+        Connection connection = factory.createConnection(AbstractFeatureTest.USER, AbstractFeatureTest.PASSWORD);
         connection.start();
         Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
         MessageConsumer consumer = session.createConsumer(session.createQueue(nameAndPayload));
-        TextMessage message = (TextMessage) consumer.receive(4000);
+        TextMessage message = (TextMessage) consumer.receive(10000);
         System.err.println("message: " + message);
         connection.close();
         return message.getText();
@@ -82,11 +38,10 @@ public class ActiveMQBrokerFeatureTest e
 
     protected void produceMessage(String nameAndPayload) throws Exception {
         ActiveMQConnectionFactory factory = new ActiveMQConnectionFactory();
-        Connection connection = factory.createConnection(USER,PASSWORD);
+        Connection connection = factory.createConnection(AbstractFeatureTest.USER, AbstractFeatureTest.PASSWORD);
         connection.start();
         Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
         session.createProducer(session.createQueue(nameAndPayload)).send(session.createTextMessage(nameAndPayload));
         connection.close();
     }
-
-}
+}
\ No newline at end of file

Modified: activemq/trunk/activemq-karaf-itest/src/test/java/org/apache/activemq/karaf/itest/ActiveMQBrokerFeatureTest.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-karaf-itest/src/test/java/org/apache/activemq/karaf/itest/ActiveMQBrokerFeatureTest.java?rev=1464068&r1=1464067&r2=1464068&view=diff
==============================================================================
--- activemq/trunk/activemq-karaf-itest/src/test/java/org/apache/activemq/karaf/itest/ActiveMQBrokerFeatureTest.java
(original)
+++ activemq/trunk/activemq-karaf-itest/src/test/java/org/apache/activemq/karaf/itest/ActiveMQBrokerFeatureTest.java
Wed Apr  3 15:20:06 2013
@@ -17,11 +17,6 @@
 package org.apache.activemq.karaf.itest;
 
 import java.util.concurrent.Callable;
-import javax.jms.Connection;
-import javax.jms.MessageConsumer;
-import javax.jms.Session;
-import javax.jms.TextMessage;
-import org.apache.activemq.ActiveMQConnectionFactory;
 import org.junit.Test;
 import org.junit.runner.RunWith;
 import org.ops4j.pax.exam.Option;
@@ -32,7 +27,7 @@ import static org.junit.Assert.assertEqu
 import static org.junit.Assert.assertTrue;
 
 @RunWith(JUnit4TestRunner.class)
-public class ActiveMQBrokerFeatureTest extends AbstractFeatureTest {
+public class ActiveMQBrokerFeatureTest extends AbstractJmsFeatureTest {
 
     @Configuration
     public static Option[] configure() {
@@ -68,25 +63,4 @@ public class ActiveMQBrokerFeatureTest e
         assertEquals("got our message", nameAndPayload, consumeMessage(nameAndPayload));
     }
 
-    protected String consumeMessage(String nameAndPayload) throws Exception {
-        ActiveMQConnectionFactory factory = new ActiveMQConnectionFactory();
-        Connection connection = factory.createConnection(USER,PASSWORD);
-        connection.start();
-        Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
-        MessageConsumer consumer = session.createConsumer(session.createQueue(nameAndPayload));
-        TextMessage message = (TextMessage) consumer.receive(4000);
-        System.err.println("message: " + message);
-        connection.close();
-        return message.getText();
-    }
-
-    protected void produceMessage(String nameAndPayload) throws Exception {
-        ActiveMQConnectionFactory factory = new ActiveMQConnectionFactory();
-        Connection connection = factory.createConnection(USER,PASSWORD);
-        connection.start();
-        Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
-        session.createProducer(session.createQueue(nameAndPayload)).send(session.createTextMessage(nameAndPayload));
-        connection.close();
-    }
-
 }

Modified: activemq/trunk/activemq-karaf-itest/src/test/java/org/apache/activemq/karaf/itest/ActiveMQBrokerNdCamelFeatureTest.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-karaf-itest/src/test/java/org/apache/activemq/karaf/itest/ActiveMQBrokerNdCamelFeatureTest.java?rev=1464068&r1=1464067&r2=1464068&view=diff
==============================================================================
--- activemq/trunk/activemq-karaf-itest/src/test/java/org/apache/activemq/karaf/itest/ActiveMQBrokerNdCamelFeatureTest.java
(original)
+++ activemq/trunk/activemq-karaf-itest/src/test/java/org/apache/activemq/karaf/itest/ActiveMQBrokerNdCamelFeatureTest.java
Wed Apr  3 15:20:06 2013
@@ -17,11 +17,6 @@
 package org.apache.activemq.karaf.itest;
 
 import java.util.concurrent.Callable;
-import javax.jms.Connection;
-import javax.jms.MessageConsumer;
-import javax.jms.Session;
-import javax.jms.TextMessage;
-import org.apache.activemq.ActiveMQConnectionFactory;
 import org.junit.Test;
 import org.junit.runner.RunWith;
 import org.ops4j.pax.exam.MavenUtils;
@@ -32,11 +27,10 @@ import org.ops4j.pax.exam.junit.JUnit4Te
 
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertTrue;
-import static org.openengsb.labs.paxexam.karaf.options.KarafDistributionOption.editConfigurationFilePut;
 import static org.ops4j.pax.exam.CoreOptions.scanFeatures;
 
 @RunWith(JUnit4TestRunner.class)
-public class ActiveMQBrokerNdCamelFeatureTest extends AbstractFeatureTest {
+public class ActiveMQBrokerNdCamelFeatureTest extends AbstractJmsFeatureTest {
 
     @Configuration
     public static Option[] configure() {
@@ -74,26 +68,4 @@ public class ActiveMQBrokerNdCamelFeatur
         produceMessage("camel_in");
         assertEquals("got our message", "camel_in", consumeMessage("camel_out"));
     }
-
-    protected String consumeMessage(String nameAndPayload) throws Exception {
-        ActiveMQConnectionFactory factory = new ActiveMQConnectionFactory();
-        Connection connection = factory.createConnection(USER,PASSWORD);
-        connection.start();
-        Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
-        MessageConsumer consumer = session.createConsumer(session.createQueue(nameAndPayload));
-        TextMessage message = (TextMessage) consumer.receive(10000);
-        System.err.println("message: " + message);
-        connection.close();
-        return message.getText();
-    }
-
-    protected void produceMessage(String nameAndPayload) throws Exception {
-        ActiveMQConnectionFactory factory = new ActiveMQConnectionFactory();
-        Connection connection = factory.createConnection(USER,PASSWORD);
-        connection.start();
-        Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
-        session.createProducer(session.createQueue(nameAndPayload)).send(session.createTextMessage(nameAndPayload));
-        connection.close();
-    }
-
 }

Copied: activemq/trunk/activemq-karaf-itest/src/test/java/org/apache/activemq/karaf/itest/ActiveMQBrokerNdExternalCamelFeatureTest.java
(from r1463923, activemq/trunk/activemq-karaf-itest/src/test/java/org/apache/activemq/karaf/itest/ActiveMQBrokerNdCamelFeatureTest.java)
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-karaf-itest/src/test/java/org/apache/activemq/karaf/itest/ActiveMQBrokerNdExternalCamelFeatureTest.java?p2=activemq/trunk/activemq-karaf-itest/src/test/java/org/apache/activemq/karaf/itest/ActiveMQBrokerNdExternalCamelFeatureTest.java&p1=activemq/trunk/activemq-karaf-itest/src/test/java/org/apache/activemq/karaf/itest/ActiveMQBrokerNdCamelFeatureTest.java&r1=1463923&r2=1464068&rev=1464068&view=diff
==============================================================================
--- activemq/trunk/activemq-karaf-itest/src/test/java/org/apache/activemq/karaf/itest/ActiveMQBrokerNdCamelFeatureTest.java
(original)
+++ activemq/trunk/activemq-karaf-itest/src/test/java/org/apache/activemq/karaf/itest/ActiveMQBrokerNdExternalCamelFeatureTest.java
Wed Apr  3 15:20:06 2013
@@ -16,12 +16,8 @@
  */
 package org.apache.activemq.karaf.itest;
 
+import java.io.File;
 import java.util.concurrent.Callable;
-import javax.jms.Connection;
-import javax.jms.MessageConsumer;
-import javax.jms.Session;
-import javax.jms.TextMessage;
-import org.apache.activemq.ActiveMQConnectionFactory;
 import org.junit.Test;
 import org.junit.runner.RunWith;
 import org.ops4j.pax.exam.MavenUtils;
@@ -29,26 +25,29 @@ import org.ops4j.pax.exam.Option;
 import org.ops4j.pax.exam.junit.Configuration;
 import org.ops4j.pax.exam.junit.JUnit4TestRunner;
 
-
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertTrue;
-import static org.openengsb.labs.paxexam.karaf.options.KarafDistributionOption.editConfigurationFilePut;
+import static org.openengsb.labs.paxexam.karaf.options.KarafDistributionOption.replaceConfigurationFile;
 import static org.ops4j.pax.exam.CoreOptions.scanFeatures;
 
 @RunWith(JUnit4TestRunner.class)
-public class ActiveMQBrokerNdCamelFeatureTest extends AbstractFeatureTest {
+public class ActiveMQBrokerNdExternalCamelFeatureTest extends AbstractJmsFeatureTest {
 
     @Configuration
     public static Option[] configure() {
-        Option[] baseOptions = configure("activemq");
+        Option[] baseOptions = append(
+                replaceConfigurationFile("deploy/camel.xml", new File(basedir + "/src/test/resources/org/apache/activemq/karaf/itest/camel.xml")),
+                configure("activemq"));
         return configureBrokerStart(append(scanFeatures(getCamelFeatureUrl(
                 MavenUtils.getArtifactVersion("org.apache.camel.karaf", "apache-camel")
-        ), "activemq-camel"), baseOptions), "activemq-nd-camel");
+        ), "activemq-camel"), baseOptions));
     }
 
     @Test
     public void test() throws Throwable {
         System.err.println(executeCommand("features:list").trim());
+        System.err.println(executeCommand("osgi:ls").trim());
+        System.err.println(executeCommand("osgi:list").trim());
 
         withinReason(new Callable<Boolean>() {
             @Override
@@ -75,25 +74,4 @@ public class ActiveMQBrokerNdCamelFeatur
         assertEquals("got our message", "camel_in", consumeMessage("camel_out"));
     }
 
-    protected String consumeMessage(String nameAndPayload) throws Exception {
-        ActiveMQConnectionFactory factory = new ActiveMQConnectionFactory();
-        Connection connection = factory.createConnection(USER,PASSWORD);
-        connection.start();
-        Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
-        MessageConsumer consumer = session.createConsumer(session.createQueue(nameAndPayload));
-        TextMessage message = (TextMessage) consumer.receive(10000);
-        System.err.println("message: " + message);
-        connection.close();
-        return message.getText();
-    }
-
-    protected void produceMessage(String nameAndPayload) throws Exception {
-        ActiveMQConnectionFactory factory = new ActiveMQConnectionFactory();
-        Connection connection = factory.createConnection(USER,PASSWORD);
-        connection.start();
-        Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
-        session.createProducer(session.createQueue(nameAndPayload)).send(session.createTextMessage(nameAndPayload));
-        connection.close();
-    }
-
 }

Modified: activemq/trunk/activemq-karaf-itest/src/test/java/org/apache/activemq/karaf/itest/ObrFeatureTest.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-karaf-itest/src/test/java/org/apache/activemq/karaf/itest/ObrFeatureTest.java?rev=1464068&r1=1464067&r2=1464068&view=diff
==============================================================================
--- activemq/trunk/activemq-karaf-itest/src/test/java/org/apache/activemq/karaf/itest/ObrFeatureTest.java
(original)
+++ activemq/trunk/activemq-karaf-itest/src/test/java/org/apache/activemq/karaf/itest/ObrFeatureTest.java
Wed Apr  3 15:20:06 2013
@@ -16,6 +16,7 @@
  */
 package org.apache.activemq.karaf.itest;
 
+import javax.jms.Destination;
 import org.junit.Test;
 import org.junit.runner.RunWith;
 import org.ops4j.pax.exam.MavenUtils;

Added: activemq/trunk/activemq-karaf-itest/src/test/resources/org/apache/activemq/karaf/itest/camel.xml
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-karaf-itest/src/test/resources/org/apache/activemq/karaf/itest/camel.xml?rev=1464068&view=auto
==============================================================================
--- activemq/trunk/activemq-karaf-itest/src/test/resources/org/apache/activemq/karaf/itest/camel.xml
(added)
+++ activemq/trunk/activemq-karaf-itest/src/test/resources/org/apache/activemq/karaf/itest/camel.xml
Wed Apr  3 15:20:06 2013
@@ -0,0 +1,50 @@
+<!--
+
+    Licensed to the Apache Software Foundation (ASF) under one or more
+    contributor license agreements.  See the NOTICE file distributed with
+    this work for additional information regarding copyright ownership.
+    The ASF licenses this file to You under the Apache License, Version 2.0
+    (the "License"); you may not use this file except in compliance with
+    the License.  You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+    Unless required by applicable law or agreed to in writing, software
+    distributed under the License is distributed on an "AS IS" BASIS,
+    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+    See the License for the specific language governing permissions and
+    limitations under the License.
+
+-->
+
+<beans
+  xmlns="http://www.springframework.org/schema/beans"
+  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+  xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
+   http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd">
+
+    <bean id="activemqConnectionFactory" class="org.apache.activemq.ActiveMQConnectionFactory">
+        <property name="brokerURL" value="tcp://localhost:61616?jms.dispatchAsync=false"/>
+        <property name="userName" value="karaf" />
+        <property name="password" value="karaf" />
+
+    </bean>
+
+    <bean id="pooledConnectionFactory" class="org.apache.activemq.pool.XaPooledConnectionFactory">
+        <property name="connectionFactory" ref="activemqConnectionFactory"/>
+    </bean>
+
+    <bean id="activemq" class="org.apache.activemq.camel.component.ActiveMQComponent"
+          depends-on="pooledConnectionFactory">
+        <property name="connectionFactory" ref="pooledConnectionFactory"/>
+        <property name="cacheLevel" value="0"/>
+    </bean>
+
+    <camelContext id="camel" xmlns="http://camel.apache.org/schema/spring">
+        <route id="queueToDbTransacted">
+            <from uri="activemq:queue:camel_in"/>
+            <to uri="activemq:queue:camel_out"/>
+        </route>
+    </camelContext>
+
+</beans>

Propchange: activemq/trunk/activemq-karaf-itest/src/test/resources/org/apache/activemq/karaf/itest/camel.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: activemq/trunk/activemq-karaf-itest/src/test/resources/org/apache/activemq/karaf/itest/camel.xml
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Propchange: activemq/trunk/activemq-karaf-itest/src/test/resources/org/apache/activemq/karaf/itest/camel.xml
------------------------------------------------------------------------------
    svn:mime-type = text/xml



Mime
View raw message