You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by da...@apache.org on 2010/09/20 13:14:35 UTC

svn commit: r998888 - in /camel/trunk/tests/camel-itest-osgi/src/test: java/org/apache/camel/itest/osgi/jms/ resources/org/apache/camel/itest/osgi/jaxb/ resources/org/apache/camel/itest/osgi/jetty/ resources/org/apache/camel/itest/osgi/jms/ resources/o...

Author: davsclaus
Date: Mon Sep 20 11:14:34 2010
New Revision: 998888

URL: http://svn.apache.org/viewvc?rev=998888&view=rev
Log:
CAMEL-3126: Adding more osgi tests.

Added:
    camel/trunk/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/jms/
    camel/trunk/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/jms/JmsTest.java
    camel/trunk/tests/camel-itest-osgi/src/test/resources/org/apache/camel/itest/osgi/jms/
    camel/trunk/tests/camel-itest-osgi/src/test/resources/org/apache/camel/itest/osgi/jms/CamelContext.xml
      - copied, changed from r998823, camel/trunk/tests/camel-itest-osgi/src/test/resources/org/apache/camel/itest/osgi/CamelContext.xml
Modified:
    camel/trunk/tests/camel-itest-osgi/src/test/resources/org/apache/camel/itest/osgi/jaxb/CamelContext.xml
    camel/trunk/tests/camel-itest-osgi/src/test/resources/org/apache/camel/itest/osgi/jetty/CamelContext1.xml
    camel/trunk/tests/camel-itest-osgi/src/test/resources/org/apache/camel/itest/osgi/jetty/CamelContext2.xml
    camel/trunk/tests/camel-itest-osgi/src/test/resources/org/apache/camel/itest/osgi/management/CamelContext.xml
    camel/trunk/tests/camel-itest-osgi/src/test/resources/org/apache/camel/itest/osgi/packages/CamelContext.xml

Added: camel/trunk/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/jms/JmsTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/jms/JmsTest.java?rev=998888&view=auto
==============================================================================
--- camel/trunk/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/jms/JmsTest.java (added)
+++ camel/trunk/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/jms/JmsTest.java Mon Sep 20 11:14:34 2010
@@ -0,0 +1,77 @@
+/**
+ * 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.
+ */
+package org.apache.camel.itest.osgi.jms;
+
+import org.apache.camel.itest.osgi.OSGiIntegrationSpringTestSupport;
+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 org.springframework.osgi.context.support.OsgiBundleXmlApplicationContext;
+
+import static org.ops4j.pax.exam.CoreOptions.equinox;
+import static org.ops4j.pax.exam.CoreOptions.felix;
+import static org.ops4j.pax.exam.CoreOptions.options;
+import static org.ops4j.pax.exam.container.def.PaxRunnerOptions.profile;
+import static org.ops4j.pax.exam.container.def.PaxRunnerOptions.scanFeatures;
+import static org.ops4j.pax.exam.container.def.PaxRunnerOptions.workingDirectory;
+
+/**
+ * @version $Revision$
+ */
+@RunWith(JUnit4TestRunner.class)
+public class JmsTest extends OSGiIntegrationSpringTestSupport {
+
+    @Override
+    protected OsgiBundleXmlApplicationContext createApplicationContext() {
+        return new OsgiBundleXmlApplicationContext(new String[]{"org/apache/camel/itest/osgi/jms/CamelContext.xml"});
+    }
+
+    @Test
+    public void testJms() throws Exception {
+        getMockEndpoint("mock:result").expectedBodiesReceived("Hello World");
+
+        template.sendBody("activemq:queue:foo", "Hello World");
+
+        assertMockEndpointsSatisfied();
+    }
+
+    @Configuration
+    public static Option[] configure() {
+        Option[] options = options(
+
+            // install the spring dm profile
+            profile("spring.dm").version("1.2.0"),
+            // this is how you set the default log level when using pax logging (logProfile)
+            org.ops4j.pax.exam.CoreOptions.systemProperty("org.ops4j.pax.logging.DefaultServiceLog.level").value("INFO"),
+
+            // using the features to install AMQ
+            scanFeatures("mvn:org.apache.activemq/activemq-karaf/5.4.0/xml/features", "activemq"),
+
+            // using the features to install the camel components
+            scanFeatures(getCamelKarafFeatureUrl(),
+                          "camel-core", "camel-spring", "camel-test", "camel-jms"),
+
+            workingDirectory("target/paxrunner/"),
+
+            felix(), equinox());
+
+        return options;
+    }
+
+}

Modified: camel/trunk/tests/camel-itest-osgi/src/test/resources/org/apache/camel/itest/osgi/jaxb/CamelContext.xml
URL: http://svn.apache.org/viewvc/camel/trunk/tests/camel-itest-osgi/src/test/resources/org/apache/camel/itest/osgi/jaxb/CamelContext.xml?rev=998888&r1=998887&r2=998888&view=diff
==============================================================================
--- camel/trunk/tests/camel-itest-osgi/src/test/resources/org/apache/camel/itest/osgi/jaxb/CamelContext.xml (original)
+++ camel/trunk/tests/camel-itest-osgi/src/test/resources/org/apache/camel/itest/osgi/jaxb/CamelContext.xml Mon Sep 20 11:14:34 2010
@@ -18,12 +18,10 @@
 
 <beans xmlns="http://www.springframework.org/schema/beans"
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-       xmlns:osgi="http://camel.apache.org/schema/osgi"
        xmlns:camel="http://camel.apache.org/schema/spring"
        xsi:schemaLocation="
        http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
-       http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd
-       http://camel.apache.org/schema/osgi http://camel.apache.org/schema/osgi/camel-osgi.xsd">
+       http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd">
 
   <camelContext xmlns="http://camel.apache.org/schema/spring">
     <camel:route>

Modified: camel/trunk/tests/camel-itest-osgi/src/test/resources/org/apache/camel/itest/osgi/jetty/CamelContext1.xml
URL: http://svn.apache.org/viewvc/camel/trunk/tests/camel-itest-osgi/src/test/resources/org/apache/camel/itest/osgi/jetty/CamelContext1.xml?rev=998888&r1=998887&r2=998888&view=diff
==============================================================================
--- camel/trunk/tests/camel-itest-osgi/src/test/resources/org/apache/camel/itest/osgi/jetty/CamelContext1.xml (original)
+++ camel/trunk/tests/camel-itest-osgi/src/test/resources/org/apache/camel/itest/osgi/jetty/CamelContext1.xml Mon Sep 20 11:14:34 2010
@@ -18,12 +18,10 @@
 
 <beans xmlns="http://www.springframework.org/schema/beans"
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-       xmlns:osgi="http://camel.apache.org/schema/osgi"
        xmlns:camel="http://camel.apache.org/schema/spring"
        xsi:schemaLocation="
        http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
-       http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd
-       http://camel.apache.org/schema/osgi http://camel.apache.org/schema/osgi/camel-osgi.xsd">
+       http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd">
   
   <bean id="jettyProcessor" class="org.apache.camel.itest.osgi.jetty.JettyProcessor">
      <property name="prefix" value="camelContext1"/>

Modified: camel/trunk/tests/camel-itest-osgi/src/test/resources/org/apache/camel/itest/osgi/jetty/CamelContext2.xml
URL: http://svn.apache.org/viewvc/camel/trunk/tests/camel-itest-osgi/src/test/resources/org/apache/camel/itest/osgi/jetty/CamelContext2.xml?rev=998888&r1=998887&r2=998888&view=diff
==============================================================================
--- camel/trunk/tests/camel-itest-osgi/src/test/resources/org/apache/camel/itest/osgi/jetty/CamelContext2.xml (original)
+++ camel/trunk/tests/camel-itest-osgi/src/test/resources/org/apache/camel/itest/osgi/jetty/CamelContext2.xml Mon Sep 20 11:14:34 2010
@@ -18,12 +18,10 @@
 
 <beans xmlns="http://www.springframework.org/schema/beans"
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-       xmlns:osgi="http://camel.apache.org/schema/osgi"
        xmlns:camel="http://camel.apache.org/schema/spring"
        xsi:schemaLocation="
        http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
-       http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd
-       http://camel.apache.org/schema/osgi http://camel.apache.org/schema/osgi/camel-osgi.xsd">
+       http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd">
 
    <bean id="jettyProcessor" class="org.apache.camel.itest.osgi.jetty.JettyProcessor">
      <property name="prefix" value="camelContext2"/>

Copied: camel/trunk/tests/camel-itest-osgi/src/test/resources/org/apache/camel/itest/osgi/jms/CamelContext.xml (from r998823, camel/trunk/tests/camel-itest-osgi/src/test/resources/org/apache/camel/itest/osgi/CamelContext.xml)
URL: http://svn.apache.org/viewvc/camel/trunk/tests/camel-itest-osgi/src/test/resources/org/apache/camel/itest/osgi/jms/CamelContext.xml?p2=camel/trunk/tests/camel-itest-osgi/src/test/resources/org/apache/camel/itest/osgi/jms/CamelContext.xml&p1=camel/trunk/tests/camel-itest-osgi/src/test/resources/org/apache/camel/itest/osgi/CamelContext.xml&r1=998823&r2=998888&rev=998888&view=diff
==============================================================================
--- camel/trunk/tests/camel-itest-osgi/src/test/resources/org/apache/camel/itest/osgi/CamelContext.xml (original)
+++ camel/trunk/tests/camel-itest-osgi/src/test/resources/org/apache/camel/itest/osgi/jms/CamelContext.xml Mon Sep 20 11:14:34 2010
@@ -25,9 +25,17 @@
 
     <camelContext xmlns="http://camel.apache.org/schema/spring">
         <camel:route>
-            <camel:from uri="direct:start"/>
+            <camel:from uri="activemq:queue:foo"/>
             <camel:to uri="mock:result"/>
         </camel:route>
     </camelContext>
 
+    <bean id="activemq" class="org.apache.camel.component.jms.JmsComponent">
+        <property name="connectionFactory">
+            <bean class="org.apache.activemq.ActiveMQConnectionFactory">
+                <property name="brokerURL" value="vm://localhost?broker.persistent=false"/>
+            </bean>
+        </property>
+    </bean>
+
 </beans>

Modified: camel/trunk/tests/camel-itest-osgi/src/test/resources/org/apache/camel/itest/osgi/management/CamelContext.xml
URL: http://svn.apache.org/viewvc/camel/trunk/tests/camel-itest-osgi/src/test/resources/org/apache/camel/itest/osgi/management/CamelContext.xml?rev=998888&r1=998887&r2=998888&view=diff
==============================================================================
--- camel/trunk/tests/camel-itest-osgi/src/test/resources/org/apache/camel/itest/osgi/management/CamelContext.xml (original)
+++ camel/trunk/tests/camel-itest-osgi/src/test/resources/org/apache/camel/itest/osgi/management/CamelContext.xml Mon Sep 20 11:14:34 2010
@@ -18,12 +18,10 @@
 
 <beans xmlns="http://www.springframework.org/schema/beans"
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-       xmlns:osgi="http://camel.apache.org/schema/osgi"
        xmlns:camel="http://camel.apache.org/schema/spring"
        xsi:schemaLocation="
        http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
-       http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd
-       http://camel.apache.org/schema/osgi http://camel.apache.org/schema/osgi/camel-osgi.xsd">
+       http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd">
 
   <camelContext xmlns="http://camel.apache.org/schema/spring">
     <camel:route>

Modified: camel/trunk/tests/camel-itest-osgi/src/test/resources/org/apache/camel/itest/osgi/packages/CamelContext.xml
URL: http://svn.apache.org/viewvc/camel/trunk/tests/camel-itest-osgi/src/test/resources/org/apache/camel/itest/osgi/packages/CamelContext.xml?rev=998888&r1=998887&r2=998888&view=diff
==============================================================================
--- camel/trunk/tests/camel-itest-osgi/src/test/resources/org/apache/camel/itest/osgi/packages/CamelContext.xml (original)
+++ camel/trunk/tests/camel-itest-osgi/src/test/resources/org/apache/camel/itest/osgi/packages/CamelContext.xml Mon Sep 20 11:14:34 2010
@@ -18,13 +18,11 @@
 
 <beans xmlns="http://www.springframework.org/schema/beans"
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-       xmlns:osgi="http://camel.apache.org/schema/osgi"
        xmlns:camel="http://camel.apache.org/schema/spring"
        xmlns:context="http://www.springframework.org/schema/context"
        xsi:schemaLocation="
        http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
        http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd
-       http://camel.apache.org/schema/osgi http://camel.apache.org/schema/osgi/camel-osgi.xsd
        http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd">
   
   <!-- context:component-scan base-package="org.apache.camel.itest.osgi.packages" /-->