You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by ni...@apache.org on 2010/05/10 08:29:14 UTC

svn commit: r942665 - in /camel/trunk/components/camel-spring/src/test: java/org/apache/camel/spring/issues/ resources/org/apache/camel/spring/issues/

Author: ningjiang
Date: Mon May 10 06:29:14 2010
New Revision: 942665

URL: http://svn.apache.org/viewvc?rev=942665&view=rev
Log:
CAMEL-2697 Added a test case about the camel-spring Spring 3.0 issue based on the mailing list

Added:
    camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/issues/CamelRouteRefInjectionIssueTest.java   (with props)
    camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/issues/MyInjectionRouteBuilder.java   (with props)
    camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/issues/CamelRouteRefInjectionIssueTest.xml   (with props)

Added: camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/issues/CamelRouteRefInjectionIssueTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/issues/CamelRouteRefInjectionIssueTest.java?rev=942665&view=auto
==============================================================================
--- camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/issues/CamelRouteRefInjectionIssueTest.java (added)
+++ camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/issues/CamelRouteRefInjectionIssueTest.java Mon May 10 06:29:14 2010
@@ -0,0 +1,41 @@
+/**
+ * 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.Exchange;
+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;
+
+public class CamelRouteRefInjectionIssueTest  extends SpringTestSupport {
+
+    @Override
+    protected AbstractXmlApplicationContext createApplicationContext() {
+        return new ClassPathXmlApplicationContext("org/apache/camel/spring/issues/CamelRouteRefInjectionIssueTest.xml");
+    }
+    
+    public void testTheRouteRefInjection() throws Exception {
+        MockEndpoint mock = getMockEndpoint("mock:result");
+        mock.expectedBodiesReceived("Hello World!");
+        
+        template.sendBody("direct:start", "Hello World!");
+        assertMockEndpointsSatisfied();
+    }
+
+}

Propchange: camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/issues/CamelRouteRefInjectionIssueTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/issues/CamelRouteRefInjectionIssueTest.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/issues/MyInjectionRouteBuilder.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/issues/MyInjectionRouteBuilder.java?rev=942665&view=auto
==============================================================================
--- camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/issues/MyInjectionRouteBuilder.java (added)
+++ camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/issues/MyInjectionRouteBuilder.java Mon May 10 06:29:14 2010
@@ -0,0 +1,56 @@
+/**
+ * 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.CamelContext;
+import org.apache.camel.CamelContextAware;
+import org.apache.camel.Endpoint;
+import org.apache.camel.builder.RouteBuilder;
+
+/**
+ * @version $Revision$
+ */
+public class MyInjectionRouteBuilder extends RouteBuilder implements CamelContextAware {
+    
+    private String startEndpointUri;
+    private CamelContext camelContext;
+    
+    public void setStartEndpointUri(String startUri) {
+        startEndpointUri = startUri;
+    }
+    
+    public String getStartEndpointUri() {
+        return startEndpointUri;
+    }
+    
+    public Endpoint getStartEndpoint() {
+        return camelContext.getEndpoint(startEndpointUri);
+    }
+
+    public void configure() throws Exception {
+        from(getStartEndpoint()).to("mock:result");
+    }
+
+    public CamelContext getCamelContext() {
+        return camelContext;
+    }
+
+    public void setCamelContext(CamelContext context) {
+        camelContext = context;
+    }
+    
+}

Propchange: camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/issues/MyInjectionRouteBuilder.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/issues/MyInjectionRouteBuilder.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/issues/CamelRouteRefInjectionIssueTest.xml
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/issues/CamelRouteRefInjectionIssueTest.xml?rev=942665&view=auto
==============================================================================
--- camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/issues/CamelRouteRefInjectionIssueTest.xml (added)
+++ camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/issues/CamelRouteRefInjectionIssueTest.xml Mon May 10 06:29:14 2010
@@ -0,0 +1,33 @@
+<?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"
+       xsi:schemaLocation="
+       http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
+       http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd
+    ">
+
+    <camelContext id="camel" xmlns="http://camel.apache.org/schema/spring">
+        <routeBuilder ref="myRoute"/>
+    </camelContext>
+
+    <bean id="myRoute" class="org.apache.camel.spring.issues.MyInjectionRouteBuilder">
+        <property name="startEndpointUri" value="direct:start"/>
+    </bean>
+
+</beans>

Propchange: camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/issues/CamelRouteRefInjectionIssueTest.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/issues/CamelRouteRefInjectionIssueTest.xml
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Propchange: camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/issues/CamelRouteRefInjectionIssueTest.xml
------------------------------------------------------------------------------
    svn:mime-type = text/xml