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 17:09:49 UTC
svn commit: r998954 - in /camel/trunk:
camel-core/src/test/java/org/apache/camel/component/mock/
components/camel-core-osgi/src/main/java/org/apache/camel/core/osgi/
components/camel-spring/src/main/java/org/apache/camel/osgi/
tests/camel-itest-osgi/sr...
Author: davsclaus
Date: Mon Sep 20 15:09:48 2010
New Revision: 998954
URL: http://svn.apache.org/viewvc?rev=998954&view=rev
Log:
CAMEL-3126: Added more osgi tests for camel-core components.
Added:
camel/trunk/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/core/bean/
camel/trunk/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/core/bean/BeanRouteTest.java
camel/trunk/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/core/bean/FooService.java
camel/trunk/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/core/bean/MyFooBean.java
camel/trunk/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/core/browse/
camel/trunk/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/core/browse/BrowseRouteTest.java
- copied, changed from r998929, camel/trunk/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/core/language/SimpleTest.java
camel/trunk/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/core/dataset/
camel/trunk/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/core/dataset/DataSetRouteTest.java
camel/trunk/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/core/language/LanguageRouteTest.java
- copied, changed from r998929, camel/trunk/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/core/language/SimpleTest.java
camel/trunk/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/core/log/
camel/trunk/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/core/log/LogRouteTest.java
camel/trunk/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/core/mock/
camel/trunk/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/core/mock/MockXPathTest.java
- copied, changed from r998929, camel/trunk/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/core/language/SimpleTest.java
camel/trunk/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/core/properties/
camel/trunk/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/core/properties/PropertiesRouteTest.java
- copied, changed from r998929, camel/trunk/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/jasypt/JasyptTest.java
camel/trunk/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/core/ref/
camel/trunk/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/core/ref/RefFileEndpointTest.java
camel/trunk/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/core/timer/
camel/trunk/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/core/timer/TimerFiredTest.java
camel/trunk/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/spring/bean/
camel/trunk/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/spring/bean/SpringBeanRouteTest.java
camel/trunk/tests/camel-itest-osgi/src/test/resources/org/apache/camel/itest/osgi/core/properties/
camel/trunk/tests/camel-itest-osgi/src/test/resources/org/apache/camel/itest/osgi/core/properties/myproperties.properties
- copied, changed from r998929, camel/trunk/tests/camel-itest-osgi/src/test/resources/org/apache/camel/itest/osgi/jasypt/myproperties.properties
camel/trunk/tests/camel-itest-osgi/src/test/resources/org/apache/camel/itest/osgi/spring/bean/
camel/trunk/tests/camel-itest-osgi/src/test/resources/org/apache/camel/itest/osgi/spring/bean/CamelContext.xml
- copied, changed from r998929, camel/trunk/tests/camel-itest-osgi/src/test/resources/org/apache/camel/itest/osgi/CamelContext.xml
Modified:
camel/trunk/camel-core/src/test/java/org/apache/camel/component/mock/MockXpathTest.java
camel/trunk/components/camel-core-osgi/src/main/java/org/apache/camel/core/osgi/OsgiDefaultCamelContext.java
camel/trunk/components/camel-spring/src/main/java/org/apache/camel/osgi/CamelContextFactory.java
camel/trunk/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/OSGiIntegrationTestSupport.java
Modified: camel/trunk/camel-core/src/test/java/org/apache/camel/component/mock/MockXpathTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/test/java/org/apache/camel/component/mock/MockXpathTest.java?rev=998954&r1=998953&r2=998954&view=diff
==============================================================================
--- camel/trunk/camel-core/src/test/java/org/apache/camel/component/mock/MockXpathTest.java (original)
+++ camel/trunk/camel-core/src/test/java/org/apache/camel/component/mock/MockXpathTest.java Mon Sep 20 15:09:48 2010
@@ -32,7 +32,6 @@ public class MockXpathTest extends Conte
template.sendBody("direct:start", "<foo>bar</foo>");
-
assertMockEndpointsSatisfied();
}
Modified: camel/trunk/components/camel-core-osgi/src/main/java/org/apache/camel/core/osgi/OsgiDefaultCamelContext.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-core-osgi/src/main/java/org/apache/camel/core/osgi/OsgiDefaultCamelContext.java?rev=998954&r1=998953&r2=998954&view=diff
==============================================================================
--- camel/trunk/components/camel-core-osgi/src/main/java/org/apache/camel/core/osgi/OsgiDefaultCamelContext.java (original)
+++ camel/trunk/components/camel-core-osgi/src/main/java/org/apache/camel/core/osgi/OsgiDefaultCamelContext.java Mon Sep 20 15:09:48 2010
@@ -24,16 +24,26 @@ import org.osgi.framework.BundleContext;
public class OsgiDefaultCamelContext extends DefaultCamelContext {
private final BundleContext bundleContext;
+ private final Registry registry;
public OsgiDefaultCamelContext(BundleContext bundleContext) {
+ this(bundleContext, null);
+ }
+
+ public OsgiDefaultCamelContext(BundleContext bundleContext, Registry registry) {
super();
this.bundleContext = bundleContext;
+ this.registry = registry;
OsgiCamelContextHelper.osgiUpdate(this, bundleContext);
}
@Override
protected Registry createRegistry() {
- return OsgiCamelContextHelper.wrapRegistry(this, super.createRegistry(), bundleContext);
+ if (registry != null) {
+ return OsgiCamelContextHelper.wrapRegistry(this, registry, bundleContext);
+ } else {
+ return OsgiCamelContextHelper.wrapRegistry(this, super.createRegistry(), bundleContext);
+ }
}
@Override
Modified: camel/trunk/components/camel-spring/src/main/java/org/apache/camel/osgi/CamelContextFactory.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-spring/src/main/java/org/apache/camel/osgi/CamelContextFactory.java?rev=998954&r1=998953&r2=998954&view=diff
==============================================================================
--- camel/trunk/components/camel-spring/src/main/java/org/apache/camel/osgi/CamelContextFactory.java (original)
+++ camel/trunk/components/camel-spring/src/main/java/org/apache/camel/osgi/CamelContextFactory.java Mon Sep 20 15:09:48 2010
@@ -18,6 +18,7 @@ package org.apache.camel.osgi;
import org.apache.camel.core.osgi.OsgiDefaultCamelContext;
import org.apache.camel.impl.DefaultCamelContext;
+import org.apache.camel.spi.Registry;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.osgi.framework.BundleContext;
@@ -30,6 +31,7 @@ import org.springframework.osgi.context.
public class CamelContextFactory implements BundleContextAware {
private static final transient Log LOG = LogFactory.getLog(CamelContextFactory.class);
private BundleContext bundleContext;
+ private Registry registry;
public BundleContext getBundleContext() {
return bundleContext;
@@ -41,14 +43,28 @@ public class CamelContextFactory impleme
}
this.bundleContext = bundleContext;
}
-
+
+ public Registry getRegistry() {
+ return registry;
+ }
+
+ public void setRegistry(Registry registry) {
+ if (LOG.isDebugEnabled()) {
+ LOG.debug("Using Registry: " + registry);
+ }
+ this.registry = registry;
+ }
+
protected DefaultCamelContext newCamelContext() {
- return new OsgiDefaultCamelContext(bundleContext);
+ if (registry != null) {
+ return new OsgiDefaultCamelContext(bundleContext, registry);
+ } else {
+ return new OsgiDefaultCamelContext(bundleContext);
+ }
}
public DefaultCamelContext createContext() {
- LOG.debug("Creating DefaultCamelContext");
- return newCamelContext();
+ return newCamelContext();
}
-
+
}
Modified: camel/trunk/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/OSGiIntegrationTestSupport.java
URL: http://svn.apache.org/viewvc/camel/trunk/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/OSGiIntegrationTestSupport.java?rev=998954&r1=998953&r2=998954&view=diff
==============================================================================
--- camel/trunk/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/OSGiIntegrationTestSupport.java (original)
+++ camel/trunk/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/OSGiIntegrationTestSupport.java Mon Sep 20 15:09:48 2010
@@ -52,14 +52,16 @@ public class OSGiIntegrationTestSupport
}
throw new RuntimeException("Bundle " + symbolicName + " does not exist");
}
-
protected CamelContext createCamelContext() throws Exception {
+ LOG.info("Get the bundleContext is " + bundleContext);
+ LOG.info("Application installed as bundle id: " + bundleContext.getBundle().getBundleId());
+
setThreadContextClassLoader();
+
CamelContextFactory factory = new CamelContextFactory();
factory.setBundleContext(bundleContext);
- LOG.info("Get the bundleContext is " + bundleContext);
- LOG.info("Application installed as bundle id: " + bundleContext.getBundle().getBundleId());
+ factory.setRegistry(createRegistry());
return factory.createContext();
}
Added: camel/trunk/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/core/bean/BeanRouteTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/core/bean/BeanRouteTest.java?rev=998954&view=auto
==============================================================================
--- camel/trunk/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/core/bean/BeanRouteTest.java (added)
+++ camel/trunk/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/core/bean/BeanRouteTest.java Mon Sep 20 15:09:48 2010
@@ -0,0 +1,82 @@
+/**
+ * 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.core.bean;
+
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.impl.JndiRegistry;
+import org.apache.camel.itest.osgi.OSGiIntegrationTestSupport;
+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.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;
+
+@RunWith(JUnit4TestRunner.class)
+public class BeanRouteTest extends OSGiIntegrationTestSupport {
+
+ @Test
+ public void testBean() throws Exception {
+ getMockEndpoint("mock:result").expectedBodiesReceived("Hello World");
+
+ template.sendBody("direct:start", "World");
+
+ assertMockEndpointsSatisfied();
+ }
+
+ @Override
+ protected JndiRegistry createRegistry() throws Exception {
+ JndiRegistry jndi = super.createRegistry();
+ jndi.bind("foo", new MyFooBean());
+ return jndi;
+ }
+
+ @Override
+ protected RouteBuilder createRouteBuilder() throws Exception {
+ return new RouteBuilder() {
+ public void configure() throws Exception {
+ from("direct:start").to("bean:foo").to("mock:result");
+ }
+ };
+ }
+
+ @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 the camel components
+ scanFeatures(getCamelKarafFeatureUrl(),
+ "camel-core", "camel-test"),
+
+ workingDirectory("target/paxrunner/"),
+
+ felix(), equinox());
+
+ return options;
+ }
+
+}
Added: camel/trunk/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/core/bean/FooService.java
URL: http://svn.apache.org/viewvc/camel/trunk/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/core/bean/FooService.java?rev=998954&view=auto
==============================================================================
--- camel/trunk/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/core/bean/FooService.java (added)
+++ camel/trunk/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/core/bean/FooService.java Mon Sep 20 15:09:48 2010
@@ -0,0 +1,26 @@
+/**
+ * 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.core.bean;
+
+/**
+ * @version $Revision$
+ */
+public interface FooService {
+
+ String hello(String s);
+
+}
Added: camel/trunk/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/core/bean/MyFooBean.java
URL: http://svn.apache.org/viewvc/camel/trunk/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/core/bean/MyFooBean.java?rev=998954&view=auto
==============================================================================
--- camel/trunk/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/core/bean/MyFooBean.java (added)
+++ camel/trunk/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/core/bean/MyFooBean.java Mon Sep 20 15:09:48 2010
@@ -0,0 +1,33 @@
+/**
+ * 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.core.bean;
+
+/**
+ * @version $Revision$
+ */
+public class MyFooBean implements FooService {
+
+ public String hello(String s) {
+ return "Hello " + s;
+ }
+
+ @Override
+ public String toString() {
+ return "MyFooBean";
+ }
+
+}
Copied: camel/trunk/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/core/browse/BrowseRouteTest.java (from r998929, camel/trunk/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/core/language/SimpleTest.java)
URL: http://svn.apache.org/viewvc/camel/trunk/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/core/browse/BrowseRouteTest.java?p2=camel/trunk/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/core/browse/BrowseRouteTest.java&p1=camel/trunk/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/core/language/SimpleTest.java&r1=998929&r2=998954&rev=998954&view=diff
==============================================================================
--- camel/trunk/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/core/language/SimpleTest.java (original)
+++ camel/trunk/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/core/browse/BrowseRouteTest.java Mon Sep 20 15:09:48 2010
@@ -14,11 +14,12 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.apache.camel.itest.osgi.core.language;
+package org.apache.camel.itest.osgi.core.browse;
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.component.mock.MockEndpoint;
import org.apache.camel.itest.osgi.OSGiIntegrationTestSupport;
+import org.apache.camel.spi.BrowsableEndpoint;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.ops4j.pax.exam.Option;
@@ -33,25 +34,33 @@ import static org.ops4j.pax.exam.contain
import static org.ops4j.pax.exam.container.def.PaxRunnerOptions.workingDirectory;
@RunWith(JUnit4TestRunner.class)
-public class SimpleTest extends OSGiIntegrationTestSupport {
+public class BrowseRouteTest extends OSGiIntegrationTestSupport {
@Test
- public void testSimpleLanguage() throws Exception {
- MockEndpoint result = getMockEndpoint("mock:result");
- result.expectedBodiesReceived("Hello IS processed!");
- template.sendBody("direct:simple", "Hello");
- result.assertIsSatisfied();
+ public void testBrowseRoute() throws Exception {
+ MockEndpoint mock = getMockEndpoint("mock:result");
+ mock.expectedBodiesReceived("Hello World", "Bye World");
+
+ template.sendBody("direct:start", "Hello World");
+ template.sendBody("direct:start", "Bye World");
+
+ assertMockEndpointsSatisfied();
+
+ BrowsableEndpoint list = context.getEndpoint("browse:foo", BrowsableEndpoint.class);
+
+ mock.getExchanges().get(0).equals(list.getExchanges().get(0));
+ mock.getExchanges().get(1).equals(list.getExchanges().get(1));
}
-
- protected RouteBuilder createRouteBuilder() {
+ @Override
+ protected RouteBuilder createRouteBuilder() throws Exception {
return new RouteBuilder() {
- public void configure() {
- from("direct:simple").setBody().simple("${body} IS processed!").to("mock:result");
+ public void configure() throws Exception {
+ from("direct:start").to("browse:foo").to("mock:result");
}
};
}
-
+
@Configuration
public static Option[] configure() {
Option[] options = options(
Added: camel/trunk/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/core/dataset/DataSetRouteTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/core/dataset/DataSetRouteTest.java?rev=998954&view=auto
==============================================================================
--- camel/trunk/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/core/dataset/DataSetRouteTest.java (added)
+++ camel/trunk/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/core/dataset/DataSetRouteTest.java Mon Sep 20 15:09:48 2010
@@ -0,0 +1,86 @@
+/**
+ * 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.core.dataset;
+
+import javax.naming.Context;
+
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.component.dataset.SimpleDataSet;
+import org.apache.camel.itest.osgi.OSGiIntegrationTestSupport;
+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.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;
+
+@RunWith(JUnit4TestRunner.class)
+public class DataSetRouteTest extends OSGiIntegrationTestSupport {
+
+ protected SimpleDataSet dataSet = new SimpleDataSet(20);
+
+ @Test
+ public void testDataSet() throws Exception {
+ // data set will itself set its assertions so we should just
+ // assert that all mocks is ok
+ assertMockEndpointsSatisfied();
+ }
+
+ @Override
+ protected Context createJndiContext() throws Exception {
+ Context context = super.createJndiContext();
+ context.bind("foo", dataSet);
+ return context;
+ }
+
+ @Override
+ protected RouteBuilder createRouteBuilder() throws Exception {
+ return new RouteBuilder() {
+ public void configure() throws Exception {
+ // start this first to make sure the "direct:foo" consumer is ready
+ from("direct:foo").to("dataset:foo?minRate=50");
+ from("dataset:foo?minRate=50").to("direct:foo");
+ }
+ };
+ }
+
+ @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 the camel components
+ scanFeatures(getCamelKarafFeatureUrl(),
+ "camel-core", "camel-test"),
+
+ workingDirectory("target/paxrunner/"),
+
+ felix(), equinox());
+
+ return options;
+ }
+
+}
Copied: camel/trunk/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/core/language/LanguageRouteTest.java (from r998929, camel/trunk/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/core/language/SimpleTest.java)
URL: http://svn.apache.org/viewvc/camel/trunk/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/core/language/LanguageRouteTest.java?p2=camel/trunk/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/core/language/LanguageRouteTest.java&p1=camel/trunk/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/core/language/SimpleTest.java&r1=998929&r2=998954&rev=998954&view=diff
==============================================================================
--- camel/trunk/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/core/language/SimpleTest.java (original)
+++ camel/trunk/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/core/language/LanguageRouteTest.java Mon Sep 20 15:09:48 2010
@@ -17,7 +17,6 @@
package org.apache.camel.itest.osgi.core.language;
import org.apache.camel.builder.RouteBuilder;
-import org.apache.camel.component.mock.MockEndpoint;
import org.apache.camel.itest.osgi.OSGiIntegrationTestSupport;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -33,25 +32,27 @@ import static org.ops4j.pax.exam.contain
import static org.ops4j.pax.exam.container.def.PaxRunnerOptions.workingDirectory;
@RunWith(JUnit4TestRunner.class)
-public class SimpleTest extends OSGiIntegrationTestSupport {
-
+public class LanguageRouteTest extends OSGiIntegrationTestSupport {
+
@Test
- public void testSimpleLanguage() throws Exception {
- MockEndpoint result = getMockEndpoint("mock:result");
- result.expectedBodiesReceived("Hello IS processed!");
- template.sendBody("direct:simple", "Hello");
- result.assertIsSatisfied();
+ public void testLanguage() throws Exception {
+ getMockEndpoint("mock:result").expectedBodiesReceived("Hello World");
+
+ template.sendBody("direct:start", "World");
+
+ assertMockEndpointsSatisfied();
}
-
- protected RouteBuilder createRouteBuilder() {
+ @Override
+ protected RouteBuilder createRouteBuilder() throws Exception {
return new RouteBuilder() {
- public void configure() {
- from("direct:simple").setBody().simple("${body} IS processed!").to("mock:result");
+ @Override
+ public void configure() throws Exception {
+ from("direct:start").to("language:simple:Hello ${body}").to("mock:result");
}
};
}
-
+
@Configuration
public static Option[] configure() {
Option[] options = options(
Added: camel/trunk/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/core/log/LogRouteTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/core/log/LogRouteTest.java?rev=998954&view=auto
==============================================================================
--- camel/trunk/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/core/log/LogRouteTest.java (added)
+++ camel/trunk/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/core/log/LogRouteTest.java Mon Sep 20 15:09:48 2010
@@ -0,0 +1,85 @@
+/**
+ * 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.core.log;
+
+import org.apache.camel.itest.osgi.OSGiIntegrationTestSupport;
+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.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;
+
+@RunWith(JUnit4TestRunner.class)
+public class LogRouteTest extends OSGiIntegrationTestSupport {
+
+ @Test
+ public void testSendMessageToLog() throws Exception {
+ template.sendBody("log:org.apache.camel.TEST", "<level>default</level>");
+ }
+
+ @Test
+ public void testSendMessageToInfoLog() throws Exception {
+ template.sendBody("log:org.apache.camel.TEST?level=INFO", "<level>INFO</level>");
+ }
+
+ @Test
+ public void testSendMessageToWarnLog() throws Exception {
+ template.sendBody("log:org.apache.camel.TEST?level=warn", "<level>WARN</level>");
+ }
+
+ @Test
+ public void testSendMessageToBadLevel() throws Exception {
+ try {
+ template.sendBody("log:org.apache.camel.TEST?level=noSuchLevel", "<level>noSuchLevel</level>");
+ fail("Shoudl have failed!");
+ } catch (Exception e) {
+ LOG.debug("Caught expected exception: " + e, e);
+ }
+ }
+
+ @Override
+ public boolean isUseRouteBuilder() {
+ return false;
+ }
+
+ @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 the camel components
+ scanFeatures(getCamelKarafFeatureUrl(),
+ "camel-core", "camel-test"),
+
+ workingDirectory("target/paxrunner/"),
+
+ felix(), equinox());
+
+ return options;
+ }
+
+}
Copied: camel/trunk/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/core/mock/MockXPathTest.java (from r998929, camel/trunk/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/core/language/SimpleTest.java)
URL: http://svn.apache.org/viewvc/camel/trunk/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/core/mock/MockXPathTest.java?p2=camel/trunk/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/core/mock/MockXPathTest.java&p1=camel/trunk/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/core/language/SimpleTest.java&r1=998929&r2=998954&rev=998954&view=diff
==============================================================================
--- camel/trunk/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/core/language/SimpleTest.java (original)
+++ camel/trunk/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/core/mock/MockXPathTest.java Mon Sep 20 15:09:48 2010
@@ -14,11 +14,12 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.apache.camel.itest.osgi.core.language;
+package org.apache.camel.itest.osgi.core.mock;
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.component.mock.MockEndpoint;
import org.apache.camel.itest.osgi.OSGiIntegrationTestSupport;
+import org.apache.camel.model.language.XPathExpression;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.ops4j.pax.exam.Option;
@@ -33,25 +34,32 @@ import static org.ops4j.pax.exam.contain
import static org.ops4j.pax.exam.container.def.PaxRunnerOptions.workingDirectory;
@RunWith(JUnit4TestRunner.class)
-public class SimpleTest extends OSGiIntegrationTestSupport {
-
+public class MockXPathTest extends OSGiIntegrationTestSupport {
+
@Test
- public void testSimpleLanguage() throws Exception {
+ public void testXPathAssertion() throws Exception {
MockEndpoint result = getMockEndpoint("mock:result");
- result.expectedBodiesReceived("Hello IS processed!");
- template.sendBody("direct:simple", "Hello");
- result.assertIsSatisfied();
+ result.expectedMessageCount(1);
+
+ XPathExpression xpath = new XPathExpression("/foo = 'bar'");
+ xpath.setResultType(Boolean.class);
+ result.allMessages().body().matches(xpath);
+
+ template.sendBody("direct:start", "<foo>bar</foo>");
+
+ assertMockEndpointsSatisfied();
}
-
- protected RouteBuilder createRouteBuilder() {
+ @Override
+ protected RouteBuilder createRouteBuilder() throws Exception {
return new RouteBuilder() {
- public void configure() {
- from("direct:simple").setBody().simple("${body} IS processed!").to("mock:result");
+ @Override
+ public void configure() throws Exception {
+ from("direct:start").to("mock:result");
}
};
}
-
+
@Configuration
public static Option[] configure() {
Option[] options = options(
Copied: camel/trunk/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/core/properties/PropertiesRouteTest.java (from r998929, camel/trunk/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/jasypt/JasyptTest.java)
URL: http://svn.apache.org/viewvc/camel/trunk/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/core/properties/PropertiesRouteTest.java?p2=camel/trunk/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/core/properties/PropertiesRouteTest.java&p1=camel/trunk/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/jasypt/JasyptTest.java&r1=998929&r2=998954&rev=998954&view=diff
==============================================================================
--- camel/trunk/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/jasypt/JasyptTest.java (original)
+++ camel/trunk/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/core/properties/PropertiesRouteTest.java Mon Sep 20 15:09:48 2010
@@ -14,10 +14,9 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.apache.camel.itest.osgi.jasypt;
+package org.apache.camel.itest.osgi.core.properties;
import org.apache.camel.builder.RouteBuilder;
-import org.apache.camel.component.jasypt.JasyptPropertiesParser;
import org.apache.camel.component.properties.PropertiesComponent;
import org.apache.camel.itest.osgi.OSGiIntegrationTestSupport;
import org.junit.Test;
@@ -34,11 +33,11 @@ import static org.ops4j.pax.exam.contain
import static org.ops4j.pax.exam.container.def.PaxRunnerOptions.workingDirectory;
@RunWith(JUnit4TestRunner.class)
-public class JasyptTest extends OSGiIntegrationTestSupport {
+public class PropertiesRouteTest extends OSGiIntegrationTestSupport {
@Test
- public void testJasyptProperties() throws Exception {
- getMockEndpoint("mock:tiger").expectedBodiesReceived("Hello World");
+ public void testProperties() throws Exception {
+ getMockEndpoint("mock:result").expectedBodiesReceived("Hello World");
template.sendBody("direct:start", "Hello World");
@@ -46,23 +45,16 @@ public class JasyptTest extends OSGiInte
}
protected RouteBuilder createRouteBuilder() {
- // create the jasypt properties parser
- JasyptPropertiesParser jasypt = new JasyptPropertiesParser();
- // and set the master password
- jasypt.setPassword("secret");
-
// create the properties component
PropertiesComponent pc = new PropertiesComponent();
- pc.setLocation("classpath:org/apache/camel/itest/osgi/jasypt/myproperties.properties");
- // and use the jasypt properties parser so we can decrypt values
- pc.setPropertiesParser(jasypt);
+ pc.setLocation("classpath:org/apache/camel/itest/osgi/core/properties/myproperties.properties");
// add properties component to camel context
context.addComponent("properties", pc);
return new RouteBuilder() {
public void configure() {
- from("direct:start").to("{{cool.result}}");
+ from("direct:start").to("{{cool}}");
}
};
}
@@ -77,7 +69,7 @@ public class JasyptTest extends OSGiInte
// using the features to install the camel components
scanFeatures(getCamelKarafFeatureUrl(),
- "camel-core", "camel-test", "camel-jasypt"),
+ "camel-core", "camel-test"),
workingDirectory("target/paxrunner/"),
Added: camel/trunk/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/core/ref/RefFileEndpointTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/core/ref/RefFileEndpointTest.java?rev=998954&view=auto
==============================================================================
--- camel/trunk/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/core/ref/RefFileEndpointTest.java (added)
+++ camel/trunk/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/core/ref/RefFileEndpointTest.java Mon Sep 20 15:09:48 2010
@@ -0,0 +1,92 @@
+/**
+ * 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.core.ref;
+
+import org.apache.camel.Exchange;
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.component.file.FileConsumer;
+import org.apache.camel.impl.JndiRegistry;
+import org.apache.camel.itest.osgi.OSGiIntegrationTestSupport;
+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.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;
+
+@RunWith(JUnit4TestRunner.class)
+public class RefFileEndpointTest extends OSGiIntegrationTestSupport {
+
+ private JndiRegistry jndi;
+
+ @Test
+ public void testRefFileEndpoint() throws Exception {
+ getMockEndpoint("mock:result").expectedMessageCount(1);
+
+ template.sendBodyAndHeader("file:target/foo", "Hello World", Exchange.FILE_NAME, "hello.txt");
+
+ assertMockEndpointsSatisfied();
+
+ FileConsumer consumer = (FileConsumer) context.getRoute("foo").getConsumer();
+ assertEquals(3000, consumer.getDelay());
+ assertEquals(250, consumer.getInitialDelay());
+ }
+
+ @Override
+ protected JndiRegistry createRegistry() throws Exception {
+ jndi = super.createRegistry();
+ return jndi;
+ }
+
+ @Override
+ protected RouteBuilder createRouteBuilder() throws Exception {
+ return new RouteBuilder() {
+ public void configure() throws Exception {
+ deleteDirectory("target/foo");
+ jndi.bind("foo", context.getEndpoint("file:target/foo?initialDelay=250&delay=3000&delete=true"));
+
+ from("ref:foo").routeId("foo").to("mock:result");
+ }
+ };
+ }
+
+ @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 the camel components
+ scanFeatures(getCamelKarafFeatureUrl(),
+ "camel-core", "camel-test"),
+
+ workingDirectory("target/paxrunner/"),
+
+ felix(), equinox());
+
+ return options;
+ }
+
+}
Added: camel/trunk/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/core/timer/TimerFiredTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/core/timer/TimerFiredTest.java?rev=998954&view=auto
==============================================================================
--- camel/trunk/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/core/timer/TimerFiredTest.java (added)
+++ camel/trunk/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/core/timer/TimerFiredTest.java Mon Sep 20 15:09:48 2010
@@ -0,0 +1,80 @@
+/**
+ * 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.core.timer;
+
+import org.apache.camel.Exchange;
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.component.mock.MockEndpoint;
+import org.apache.camel.itest.osgi.OSGiIntegrationTestSupport;
+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.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;
+
+@RunWith(JUnit4TestRunner.class)
+public class TimerFiredTest extends OSGiIntegrationTestSupport {
+
+ @Test
+ public void testFired() throws Exception {
+ MockEndpoint mock = getMockEndpoint("mock:result");
+ mock.expectedMinimumMessageCount(1);
+
+ assertMockEndpointsSatisfied();
+
+ Exchange exchange = mock.getExchanges().get(0);
+ assertEquals("hello", exchange.getProperty(Exchange.TIMER_NAME));
+ assertNotNull(exchange.getProperty(Exchange.TIMER_FIRED_TIME));
+ assertNotNull(exchange.getIn().getHeader("firedTime"));
+ }
+
+ @Override
+ protected RouteBuilder createRouteBuilder() throws Exception {
+ return new RouteBuilder() {
+ public void configure() throws Exception {
+ from("timer://hello").to("mock:result");
+ }
+ };
+ }
+
+ @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 the camel components
+ scanFeatures(getCamelKarafFeatureUrl(),
+ "camel-core", "camel-test"),
+
+ workingDirectory("target/paxrunner/"),
+
+ felix(), equinox());
+
+ return options;
+ }
+
+}
Added: camel/trunk/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/spring/bean/SpringBeanRouteTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/spring/bean/SpringBeanRouteTest.java?rev=998954&view=auto
==============================================================================
--- camel/trunk/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/spring/bean/SpringBeanRouteTest.java (added)
+++ camel/trunk/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/spring/bean/SpringBeanRouteTest.java Mon Sep 20 15:09:48 2010
@@ -0,0 +1,69 @@
+/**
+ * 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.spring.bean;
+
+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;
+
+@RunWith(JUnit4TestRunner.class)
+public class SpringBeanRouteTest extends OSGiIntegrationSpringTestSupport {
+
+ @Test
+ public void testBean() throws Exception {
+ getMockEndpoint("mock:result").expectedBodiesReceived("Hello World");
+
+ template.sendBody("direct:start", "World");
+
+ assertMockEndpointsSatisfied();
+ }
+
+ @Override
+ protected OsgiBundleXmlApplicationContext createApplicationContext() {
+ return new OsgiBundleXmlApplicationContext(new String[]{"org/apache/camel/itest/osgi/spring/bean/CamelContext.xml"});
+ }
+
+ @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 the camel components
+ scanFeatures(getCamelKarafFeatureUrl(),
+ "camel-core", "camel-spring", "camel-test"),
+
+ workingDirectory("target/paxrunner/"),
+
+ felix(), equinox());
+
+ return options;
+ }
+}
Copied: camel/trunk/tests/camel-itest-osgi/src/test/resources/org/apache/camel/itest/osgi/core/properties/myproperties.properties (from r998929, camel/trunk/tests/camel-itest-osgi/src/test/resources/org/apache/camel/itest/osgi/jasypt/myproperties.properties)
URL: http://svn.apache.org/viewvc/camel/trunk/tests/camel-itest-osgi/src/test/resources/org/apache/camel/itest/osgi/core/properties/myproperties.properties?p2=camel/trunk/tests/camel-itest-osgi/src/test/resources/org/apache/camel/itest/osgi/core/properties/myproperties.properties&p1=camel/trunk/tests/camel-itest-osgi/src/test/resources/org/apache/camel/itest/osgi/jasypt/myproperties.properties&r1=998929&r2=998954&rev=998954&view=diff
==============================================================================
--- camel/trunk/tests/camel-itest-osgi/src/test/resources/org/apache/camel/itest/osgi/jasypt/myproperties.properties (original)
+++ camel/trunk/tests/camel-itest-osgi/src/test/resources/org/apache/camel/itest/osgi/core/properties/myproperties.properties Mon Sep 20 15:09:48 2010
@@ -15,8 +15,6 @@
## limitations under the License.
## ---------------------------------------------------------------------------
-# refer to a mock endpoint name by that encrypted password
-cool.result=mock:{{cool.password}}
+# refer to mock endpoint
+cool=mock:result
-# here is a password which is encrypted
-cool.password=ENC(bsW9uV37gQ0QHFu7KO03Ww==)
Copied: camel/trunk/tests/camel-itest-osgi/src/test/resources/org/apache/camel/itest/osgi/spring/bean/CamelContext.xml (from r998929, 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/spring/bean/CamelContext.xml?p2=camel/trunk/tests/camel-itest-osgi/src/test/resources/org/apache/camel/itest/osgi/spring/bean/CamelContext.xml&p1=camel/trunk/tests/camel-itest-osgi/src/test/resources/org/apache/camel/itest/osgi/CamelContext.xml&r1=998929&r2=998954&rev=998954&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/spring/bean/CamelContext.xml Mon Sep 20 15:09:48 2010
@@ -23,9 +23,12 @@
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">
+ <bean id="foo" class="org.apache.camel.itest.osgi.core.bean.MyFooBean"/>
+
<camelContext xmlns="http://camel.apache.org/schema/spring">
<camel:route>
<camel:from uri="direct:start"/>
+ <camel:to uri="bean:foo"/>
<camel:to uri="mock:result"/>
</camel:route>
</camelContext>