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/06/15 10:07:41 UTC
svn commit: r954743 - in /camel/trunk/components/camel-spring/src/test:
java/org/apache/camel/spring/issues/
resources/org/apache/camel/spring/issues/
Author: davsclaus
Date: Tue Jun 15 08:07:41 2010
New Revision: 954743
URL: http://svn.apache.org/viewvc?rev=954743&view=rev
Log:
Added unit test based on user forum issue
Added:
camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/issues/MyStatefulBean.java (with props)
camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/issues/SpringSingletonScopedBeanIssueTest.java (with props)
camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/issues/SpringSingletonScopedBeanIssueTest.xml
- copied, changed from r954728, camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/issues/SpringPackageTest.xml
Added: camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/issues/MyStatefulBean.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/issues/MyStatefulBean.java?rev=954743&view=auto
==============================================================================
--- camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/issues/MyStatefulBean.java (added)
+++ camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/issues/MyStatefulBean.java Tue Jun 15 08:07:41 2010
@@ -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.issues;
+
+/**
+ * @version $Revision$
+ */
+public class MyStatefulBean {
+
+ private volatile String state = "";
+
+ public String doSomething(String body) {
+ state += body;
+ return state;
+ }
+
+}
Propchange: camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/issues/MyStatefulBean.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/issues/MyStatefulBean.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Added: camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/issues/SpringSingletonScopedBeanIssueTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/issues/SpringSingletonScopedBeanIssueTest.java?rev=954743&view=auto
==============================================================================
--- camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/issues/SpringSingletonScopedBeanIssueTest.java (added)
+++ camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/issues/SpringSingletonScopedBeanIssueTest.java Tue Jun 15 08:07:41 2010
@@ -0,0 +1,44 @@
+/**
+ * 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.issues;
+
+import org.apache.camel.component.mock.MockEndpoint;
+import org.apache.camel.spring.SpringTestSupport;
+import org.springframework.context.support.AbstractXmlApplicationContext;
+import org.springframework.context.support.ClassPathXmlApplicationContext;
+
+/**
+ * @version $Revision$
+ */
+public class SpringSingletonScopedBeanIssueTest extends SpringTestSupport {
+
+ @Override
+ protected AbstractXmlApplicationContext createApplicationContext() {
+ return new ClassPathXmlApplicationContext("org/apache/camel/spring/issues/SpringSingletonScopedBeanIssueTest.xml");
+ }
+
+ public void testSpringSingletonScopedBeanIssue() throws Exception {
+ MockEndpoint mock = getMockEndpoint("mock:result");
+ mock.expectedBodiesReceived("A", "AB", "ABC");
+
+ template.sendBody("direct:start", "A");
+ template.sendBody("direct:start", "B");
+ template.sendBody("direct:start", "C");
+
+ assertMockEndpointsSatisfied();
+ }
+}
Propchange: camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/issues/SpringSingletonScopedBeanIssueTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/issues/SpringSingletonScopedBeanIssueTest.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Copied: camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/issues/SpringSingletonScopedBeanIssueTest.xml (from r954728, camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/issues/SpringPackageTest.xml)
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/issues/SpringSingletonScopedBeanIssueTest.xml?p2=camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/issues/SpringSingletonScopedBeanIssueTest.xml&p1=camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/issues/SpringPackageTest.xml&r1=954728&r2=954743&rev=954743&view=diff
==============================================================================
--- camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/issues/SpringPackageTest.xml (original)
+++ camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/issues/SpringSingletonScopedBeanIssueTest.xml Tue Jun 15 08:07:41 2010
@@ -22,12 +22,14 @@
http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd
">
+ <bean id="myBean" class="org.apache.camel.spring.issues.MyStatefulBean" scope="singleton"/>
+
<camelContext id="camel" xmlns="http://camel.apache.org/schema/spring">
- <packageScan>
- <package>org.apache.camel.spring.issues</package>
- <excludes>**/*MyInjectionRouteBuilder*</excludes>
- <excludes>*componentscan*</excludes>
- </packageScan>
+ <route>
+ <from uri="direct:start"/>
+ <to uri="bean:myBean?method=doSomething"/>
+ <to uri="mock:result"/>
+ </route>
</camelContext>
</beans>