Author: hadrian
Date: Sat Apr 12 19:51:58 2008
New Revision: 647518
URL: http://svn.apache.org/viewvc?rev=647518&view=rev
Log:
CAMEL-308. Patch applied with thanks!
Added:
activemq/camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/config/scan/
activemq/camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/config/scan/SpringComponentScanTest.java
activemq/camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/config/scan/component/
activemq/camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/config/scan/component/MyProcessor.java
activemq/camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/config/scan/route/
activemq/camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/config/scan/route/MyRouteBuilder.java
activemq/camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/config/scan/
activemq/camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/config/scan/componentScan.xml
Modified:
activemq/camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/camelContextFactoryBean.xml
Added:
activemq/camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/config/scan/SpringComponentScanTest.java
URL:
http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/config/scan/SpringComponentScanTest.java?rev=647518&view=auto
==============================================================================
---
activemq/camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/config/scan/SpringComponentScanTest.java
(added)
+++
activemq/camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/config/scan/SpringComponentScanTest.java
Sat Apr 12 19:51:58 2008
@@ -0,0 +1,46 @@
+/**
+ * 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.spring.config.scan;
+
+import org.apache.camel.CamelContext;
+import org.apache.camel.CamelTemplate;
+import org.apache.camel.ContextTestSupport;
+import org.apache.camel.Exchange;
+import org.apache.camel.component.mock.MockEndpoint;
+import org.springframework.context.ApplicationContext;
+import org.springframework.context.support.ClassPathXmlApplicationContext;
+
+public class SpringComponentScanTest extends ContextTestSupport {
+
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+ ApplicationContext c = new ClassPathXmlApplicationContext(
+
"org/apache/camel/spring/config/scan/componentScan.xml");
+ context = (CamelContext) c.getBean("camelContext");
+ template = new CamelTemplate<Exchange>(context);
+
+ }
+
+ public void testSpringComponentScanFeature() throws
InterruptedException {
+ template.sendBody("direct:start", "request");
+ MockEndpoint mock = getMockEndpoint("mock:end");
+ mock.expectedMessageCount(1);
+ mock.assertIsSatisfied();
+ }
+}
Added:
activemq/camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/config/scan/component/MyProcessor.java
URL:
http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/config/scan/component/MyProcessor.java?rev=647518&view=auto
==============================================================================
---
activemq/camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/config/scan/component/MyProcessor.java
(added)
+++
activemq/camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/config/scan/component/MyProcessor.java
Sat Apr 12 19:51:58 2008
@@ -0,0 +1,31 @@
+/**
+ * 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.spring.config.scan.component;
+
+import org.apache.camel.Exchange;
+import org.apache.camel.Processor;
+import org.springframework.stereotype.Component;
+
[EMAIL PROTECTED]
+public class MyProcessor implements Processor {
+
+ public void process(Exchange exchange) throws Exception {
+ exchange.getIn().setBody("foo");
+ }
+
+}
Added:
activemq/camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/config/scan/route/MyRouteBuilder.java
URL:
http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/config/scan/route/MyRouteBuilder.java?rev=647518&view=auto
==============================================================================
---
activemq/camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/config/scan/route/MyRouteBuilder.java
(added)
+++
activemq/camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/config/scan/route/MyRouteBuilder.java
Sat Apr 12 19:51:58 2008
@@ -0,0 +1,38 @@
+/**
+ * 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.spring.config.scan.route;
+
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.spring.config.scan.component.MyProcessor;
+import org.springframework.beans.factory.annotation.Autowired;
+
+public class MyRouteBuilder extends RouteBuilder {
+
+ MyProcessor component;
+
+ @Override
+ public void configure() throws Exception {
+ from("direct:start").process(component).to("mock:end");
+ }
+
+ @Autowired
+ public void setComponent(MyProcessor component) {
+ this.component = component;
+ }
+
+}
Modified:
activemq/camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/camelContextFactoryBean.xml
URL:
http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/camelContextFactoryBean.xml?rev=647518&r1=647517&r2=647518&view=diff
==============================================================================
---
activemq/camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/camelContextFactoryBean.xml
(original)
+++
activemq/camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/camelContextFactoryBean.xml
Sat Apr 12 19:51:58 2008
@@ -22,8 +22,6 @@
http://activemq.apache.org/camel/schema/spring
http://activemq.apache.org/camel/schema/spring/camel-spring.xsd
">
-
-
<!-- START SNIPPET: example -->
<bean id="camel" class="org.apache.camel.spring.CamelContextFactoryBean">
<property name="packages" value="org.apache.camel.spring.example"/>
Added:
activemq/camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/config/scan/componentScan.xml
URL:
http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/config/scan/componentScan.xml?rev=647518&view=auto
==============================================================================
---
activemq/camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/config/scan/componentScan.xml
(added)
+++
activemq/camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/config/scan/componentScan.xml
Sat Apr 12 19:51:58 2008
@@ -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.
+-->
+<beans xmlns="http://www.springframework.org/schema/beans"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns:context="http://www.springframework.org/schema/context"
+ xsi:schemaLocation="http://activemq.apache.org/camel/schema/spring
+ http://activemq.apache.org/camel/schema/spring/camel-spring.xsd
+ http://www.springframework.org/schema/beans
+ http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
+ http://www.springframework.org/schema/context
+
http://www.springframework.org/schema/context/spring-context-2.5.xsd">
+
+ <camelContext xmlns="http://activemq.apache.org/camel/schema/spring">
+ <package>org.apache.camel.spring.config.scan.route</package>
+ </camelContext>
+
+ <context:component-scan
+ base-package="org.apache.camel.spring.config.scan.component" />
+
+</beans>