Author: davsclaus
Date: Mon Apr 11 08:18:51 2011
New Revision: 1090969
URL: http://svn.apache.org/viewvc?rev=1090969&view=rev
Log:
CAMEL-3849: Added camel-cache osgi unit test.
Added:
camel/trunk/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/cache/
camel/trunk/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/cache/CacheTest.java
- copied, changed from r1090950,
camel/trunk/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/exec/ExecTest.java
Copied:
camel/trunk/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/cache/CacheTest.java
(from r1090950,
camel/trunk/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/exec/ExecTest.java)
URL:
http://svn.apache.org/viewvc/camel/trunk/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/cache/CacheTest.java?p2=camel/trunk/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/cache/CacheTest.java&p1=camel/trunk/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/exec/ExecTest.java&r1=1090950&r2=1090969&rev=1090969&view=diff
==============================================================================
---
camel/trunk/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/exec/ExecTest.java
(original)
+++
camel/trunk/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/cache/CacheTest.java
Mon Apr 11 08:18:51 2011
@@ -14,12 +14,11 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.apache.camel.itest.osgi.exec;
+package org.apache.camel.itest.osgi.cache;
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;
@@ -33,13 +32,16 @@ import static org.ops4j.pax.exam.contain
import static
org.ops4j.pax.exam.container.def.PaxRunnerOptions.workingDirectory;
@RunWith(JUnit4TestRunner.class)
-@Ignore("We need a test which runs on all platforms")
-public class ExecTest extends OSGiIntegrationTestSupport {
+public class CacheTest extends OSGiIntegrationTestSupport {
@Test
- public void testExec() throws Exception {
- getMockEndpoint("mock:result").expectedBodiesReceived("test");
- template.sendBody("direct:exec", "test");
+ public void testCache() throws Exception {
+ // add to cache first
+ template.sendBody("direct:add", "Hello World");
+
+ // then get from cache and assert
+ getMockEndpoint("mock:result").expectedBodiesReceived("Hello World");
+ template.sendBody("direct:get", null);
assertMockEndpointsSatisfied();
}
@@ -47,7 +49,16 @@ public class ExecTest extends OSGiIntegr
protected RouteBuilder createRouteBuilder() {
return new RouteBuilder() {
public void configure() {
- from("direct:exec").to("exec:echo?args=-n
test").to("mock:result");
+ from("direct:add")
+ .setHeader("CACHE_OPERATION", constant("ADD"))
+ .setHeader("CACHE_KEY", constant("foo"))
+ .to("cache:foo");
+
+ from("direct:get")
+ .setHeader("CACHE_OPERATION", constant("GET"))
+ .setHeader("CACHE_KEY", constant("foo"))
+ .to("cache:foo")
+ .to("mock:result");
}
};
}
@@ -62,7 +73,7 @@ public class ExecTest extends OSGiIntegr
Helper.setLogLevel("WARN")),
// using the features to install the camel components
scanFeatures(getCamelKarafFeatureUrl(),
- "camel-core", "camel-spring", "camel-test",
"camel-exec"),
+ "camel-core", "camel-spring", "camel-test",
"camel-cache"),
workingDirectory("target/paxrunner/"),