Repository: camel
Updated Branches:
  refs/heads/master bdf10d544 -> 046d99e3f


Work on a new camel-itest-osgi that uses camel-test-karaf for testing.


Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/046d99e3
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/046d99e3
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/046d99e3

Branch: refs/heads/master
Commit: 046d99e3f223a6fd421efc813bdcafff7f2d6a5a
Parents: fb35ca3
Author: Claus Ibsen <davscl...@apache.org>
Authored: Mon Apr 18 13:38:40 2016 +0200
Committer: Claus Ibsen <davscl...@apache.org>
Committed: Mon Apr 18 13:39:42 2016 +0200

----------------------------------------------------------------------
 .../org/apache/camel/itest/CamelGroovyTest.java | 57 ++++++++++++++++++++
 .../org/apache/camel/itest/CamelGroovyTest.xml  | 35 ++++++++++++
 2 files changed, 92 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/046d99e3/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/CamelGroovyTest.java
----------------------------------------------------------------------
diff --git 
a/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/CamelGroovyTest.java
 
b/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/CamelGroovyTest.java
new file mode 100644
index 0000000..9e0b342
--- /dev/null
+++ 
b/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/CamelGroovyTest.java
@@ -0,0 +1,57 @@
+/**
+ * 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;
+
+import java.net.URL;
+
+import org.apache.camel.CamelContext;
+import org.apache.camel.component.mock.MockEndpoint;
+import org.apache.camel.test.karaf.AbstractFeatureTest;
+import org.apache.camel.test.karaf.CamelKarafTestSupport;
+import org.apache.camel.util.ObjectHelper;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.ops4j.pax.exam.Configuration;
+import org.ops4j.pax.exam.Option;
+import org.ops4j.pax.exam.junit.PaxExam;
+
+@RunWith(PaxExam.class)
+public class CamelGroovyTest extends AbstractFeatureTest {
+
+    @Test
+    public void testCamelGroovy() throws Exception {
+        URL url = 
ObjectHelper.loadResourceAsURL("org/apache/camel/itest/CamelGroovyTest.xml", 
CamelGroovyTest.class.getClassLoader());
+        installBlueprintAsBundle("CamelGroovyTest", url, true);
+
+        // lookup Camel from OSGi
+        CamelContext camel = getOsgiService(bundleContext, CamelContext.class);
+
+        // test camel
+        MockEndpoint mock = camel.getEndpoint("mock:result", 
MockEndpoint.class);
+        mock.expectedBodiesReceived(6);
+
+        camel.createProducerTemplate().sendBody("direct:start", 3);
+
+        mock.assertIsSatisfied();
+    }
+
+    @Configuration
+    public Option[] configure() {
+        return CamelKarafTestSupport.configure("camel-script-groovy");
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/046d99e3/tests/camel-itest-osgi/src/test/resources/org/apache/camel/itest/CamelGroovyTest.xml
----------------------------------------------------------------------
diff --git 
a/tests/camel-itest-osgi/src/test/resources/org/apache/camel/itest/CamelGroovyTest.xml
 
b/tests/camel-itest-osgi/src/test/resources/org/apache/camel/itest/CamelGroovyTest.xml
new file mode 100644
index 0000000..475ff30
--- /dev/null
+++ 
b/tests/camel-itest-osgi/src/test/resources/org/apache/camel/itest/CamelGroovyTest.xml
@@ -0,0 +1,35 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+    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.
+-->
+<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0";
+           xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
+           xsi:schemaLocation="
+             http://www.osgi.org/xmlns/blueprint/v1.0.0 
https://www.osgi.org/xmlns/blueprint/v1.0.0/blueprint.xsd";>
+
+  <camelContext id="myCamel" xmlns="http://camel.apache.org/schema/blueprint";>
+
+    <route>
+      <from uri="direct:start"/>
+      <transform>
+        <groovy>2 * body</groovy>
+      </transform>
+      <to uri="mock:result"/>
+    </route>
+
+  </camelContext>
+
+</blueprint>

Reply via email to