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 2011/06/03 19:47:44 UTC

svn commit: r1131119 - in /camel/trunk: platforms/karaf/features/src/main/resources/ tests/camel-itest-karaf/src/test/java/org/apache/camel/itest/karaf/ tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/ahc/

Author: davsclaus
Date: Fri Jun  3 17:47:44 2011
New Revision: 1131119

URL: http://svn.apache.org/viewvc?rev=1131119&view=rev
Log:
CAMEL-2525: Added camel-ahc to features and added osgi tests

Added:
    camel/trunk/tests/camel-itest-karaf/src/test/java/org/apache/camel/itest/karaf/CamelAhcTest.java
      - copied, changed from r1131074, camel/trunk/tests/camel-itest-karaf/src/test/java/org/apache/camel/itest/karaf/CamelAmqpTest.java
    camel/trunk/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/ahc/
    camel/trunk/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/ahc/AhcTest.java
Modified:
    camel/trunk/platforms/karaf/features/src/main/resources/features.xml

Modified: camel/trunk/platforms/karaf/features/src/main/resources/features.xml
URL: http://svn.apache.org/viewvc/camel/trunk/platforms/karaf/features/src/main/resources/features.xml?rev=1131119&r1=1131118&r2=1131119&view=diff
==============================================================================
--- camel/trunk/platforms/karaf/features/src/main/resources/features.xml (original)
+++ camel/trunk/platforms/karaf/features/src/main/resources/features.xml Fri Jun  3 17:47:44 2011
@@ -157,6 +157,11 @@
     <feature version='${pom.version}'>camel-core</feature>
     <bundle>mvn:org.apache.camel/camel-jmx/${pom.version}</bundle>
   </feature>
+  <feature name='camel-ahc' version='${pom.version}' resolver='(obr)'>
+    <feature version='${pom.version}'>camel-core</feature>
+    <bundle dependency="true">mvn:com.ning/async-http-client/${ahc-version}</bundle>
+    <bundle>mvn:org.apache.camel/camel-ahc/${pom.version}</bundle>
+  </feature>
   <feature name='camel-amqp' version='${pom.version}' resolver='(obr)'>
     <bundle dependency="true">mvn:commons-lang/commons-lang/${commons-lang-version}</bundle>
     <bundle dependency="true">mvn:commons-collections/commons-collections/${commons-collections-version}</bundle>

Copied: camel/trunk/tests/camel-itest-karaf/src/test/java/org/apache/camel/itest/karaf/CamelAhcTest.java (from r1131074, camel/trunk/tests/camel-itest-karaf/src/test/java/org/apache/camel/itest/karaf/CamelAmqpTest.java)
URL: http://svn.apache.org/viewvc/camel/trunk/tests/camel-itest-karaf/src/test/java/org/apache/camel/itest/karaf/CamelAhcTest.java?p2=camel/trunk/tests/camel-itest-karaf/src/test/java/org/apache/camel/itest/karaf/CamelAhcTest.java&p1=camel/trunk/tests/camel-itest-karaf/src/test/java/org/apache/camel/itest/karaf/CamelAmqpTest.java&r1=1131074&r2=1131119&rev=1131119&view=diff
==============================================================================
--- camel/trunk/tests/camel-itest-karaf/src/test/java/org/apache/camel/itest/karaf/CamelAmqpTest.java (original)
+++ camel/trunk/tests/camel-itest-karaf/src/test/java/org/apache/camel/itest/karaf/CamelAhcTest.java Fri Jun  3 17:47:44 2011
@@ -23,9 +23,9 @@ import org.ops4j.pax.exam.junit.Configur
 import org.ops4j.pax.exam.junit.JUnit4TestRunner;
 
 @RunWith(JUnit4TestRunner.class)
-public class CamelAmqpTest extends AbstractFeatureTest {
+public class CamelAhcTest extends AbstractFeatureTest {
 
-    public static final String COMPONENT = extractName(CamelAmqpTest.class);
+    public static final String COMPONENT = extractName(CamelAhcTest.class);
 
     @Test
     public void test() throws Exception {

Added: camel/trunk/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/ahc/AhcTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/ahc/AhcTest.java?rev=1131119&view=auto
==============================================================================
--- camel/trunk/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/ahc/AhcTest.java (added)
+++ camel/trunk/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/ahc/AhcTest.java Fri Jun  3 17:47:44 2011
@@ -0,0 +1,73 @@
+/**
+ * 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.ahc;
+
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.itest.osgi.OSGiIntegrationTestSupport;
+import org.apache.karaf.testing.Helper;
+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.ops4j.pax.exam.CoreOptions.equinox;
+import static org.ops4j.pax.exam.CoreOptions.felix;
+import static org.ops4j.pax.exam.OptionUtils.combine;
+import static org.ops4j.pax.exam.container.def.PaxRunnerOptions.scanFeatures;
+import static org.ops4j.pax.exam.container.def.PaxRunnerOptions.workingDirectory;
+
+/**
+ *
+ */
+@RunWith(JUnit4TestRunner.class)
+public class AhcTest extends OSGiIntegrationTestSupport {
+
+    @Test
+    public void testAhc() throws Exception {
+        String reply = template.requestBody("ahc:http://localhost:9081/foo", "World", String.class);
+        assertEquals("Bye World", reply);
+    }
+
+    protected RouteBuilder createRouteBuilder() {
+        return new RouteBuilder() {
+            public void configure() {
+                from("jetty:http://localhost:9081/foo")
+                    .transform(body().prepend("Bye "));
+            }
+        };
+    }
+
+    @Configuration
+    public static Option[] configure() throws Exception {
+        Option[] options = combine(
+            // Default karaf environment
+            Helper.getDefaultOptions(
+                    // this is how you set the default log level when using pax logging (logProfile)
+                    Helper.setLogLevel("WARN")),
+            // using the features to install the camel components
+            scanFeatures(getCamelKarafFeatureUrl(),
+                          "camel-core", "camel-test", "camel-jetty", "camel-ahc"),
+
+            workingDirectory("target/paxrunner/"),
+
+            felix(), equinox());
+
+        return options;
+    }
+
+}