Author: davsclaus
Date: Sat Jun 4 07:20:44 2011
New Revision: 1131343
URL: http://svn.apache.org/viewvc?rev=1131343&view=rev
Log:
Added more osgi tests
Added:
camel/trunk/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/http/
camel/trunk/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/http/HttpTest.java
- copied, changed from r1131338,
camel/trunk/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/ahc/AhcTest.java
camel/trunk/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/http4/
camel/trunk/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/http4/Http4Test.java
Copied:
camel/trunk/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/http/HttpTest.java
(from r1131338,
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/http/HttpTest.java?p2=camel/trunk/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/http/HttpTest.java&p1=camel/trunk/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/ahc/AhcTest.java&r1=1131338&r2=1131343&rev=1131343&view=diff
==============================================================================
---
camel/trunk/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/ahc/AhcTest.java
(original)
+++
camel/trunk/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/http/HttpTest.java
Sat Jun 4 07:20:44 2011
@@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.apache.camel.itest.osgi.ahc;
+package org.apache.camel.itest.osgi.http;
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.itest.osgi.OSGiIntegrationTestSupport;
@@ -36,25 +36,25 @@ import static org.ops4j.pax.exam.contain
*
*/
@RunWith(JUnit4TestRunner.class)
-public class AhcTest extends OSGiIntegrationTestSupport {
+public class HttpTest extends OSGiIntegrationTestSupport {
@Test
- public void testAhcGet() throws Exception {
- String reply = template.requestBody("ahc:http://localhost:9081/foo",
null, String.class);
+ public void testHttpGet() throws Exception {
+ String reply = template.requestBody("http://localhost:9081/foo", null,
String.class);
assertEquals("Bye World", reply);
}
@Test
@Ignore("Error doing POST in OSGi")
- public void testAhcPost() throws Exception {
- String reply = template.requestBody("ahc:http://localhost:9081/foo",
"Hello World", String.class);
+ public void testHttpPost() throws Exception {
+ String reply = template.requestBody("http://localhost:9081/foo",
"Hello World", String.class);
assertEquals("Bye World", reply);
}
@Test
@Ignore("Requires online internet for testing")
- public void testAhcGoogle() throws Exception {
- String reply = template.requestBody("ahc:http://www.google.se", null,
String.class);
+ public void testHttpGoogle() throws Exception {
+ String reply = template.requestBody("http://www.google.se", null,
String.class);
assertNotNull(reply);
log.info(reply);
}
@@ -77,7 +77,7 @@ public class AhcTest extends OSGiIntegra
Helper.setLogLevel("WARN")),
// using the features to install the camel components
scanFeatures(getCamelKarafFeatureUrl(),
- "camel-core", "camel-test", "camel-jetty",
"camel-ahc"),
+ "camel-core", "camel-test", "camel-jetty",
"camel-http"),
workingDirectory("target/paxrunner/"),
Added:
camel/trunk/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/http4/Http4Test.java
URL:
http://svn.apache.org/viewvc/camel/trunk/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/http4/Http4Test.java?rev=1131343&view=auto
==============================================================================
---
camel/trunk/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/http4/Http4Test.java
(added)
+++
camel/trunk/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/http4/Http4Test.java
Sat Jun 4 07:20:44 2011
@@ -0,0 +1,89 @@
+/**
+ * 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.http4;
+
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.itest.osgi.OSGiIntegrationTestSupport;
+import org.apache.karaf.testing.Helper;
+import org.junit.Ignore;
+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 Http4Test extends OSGiIntegrationTestSupport {
+
+ @Test
+ public void testHttp4Get() throws Exception {
+ String reply = template.requestBody("http4://localhost:9081/foo",
null, String.class);
+ assertEquals("Bye World", reply);
+ }
+
+ @Test
+ @Ignore("Error doing POST in OSGi")
+ public void testHttp4Post() throws Exception {
+ String reply = template.requestBody("http4://localhost:9081/foo",
"Hello World", String.class);
+ assertEquals("Bye World", reply);
+ }
+
+ @Test
+ @Ignore("Requires online internet for testing")
+ public void testHttp4Google() throws Exception {
+ String reply = template.requestBody("http4://www.google.se", null,
String.class);
+ assertNotNull(reply);
+ log.info(reply);
+ }
+
+ protected RouteBuilder createRouteBuilder() {
+ return new RouteBuilder() {
+ public void configure() {
+ from("jetty:http://0.0.0.0:9081/foo")
+ .transform(constant("Bye World"));
+ }
+ };
+ }
+
+ @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-http4"),
+
+ workingDirectory("target/paxrunner/"),
+
+ felix(), equinox());
+
+ return options;
+ }
+
+}