Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merged revisions 1374582-1374584,1374709 via svnmerge from
https://svn.apache.org/repos/asf/camel/trunk ........ r1374582 | ningjiang | 2012-08-18 22:02:29 +0800 (Sat, 18 Aug 2012) | 1 line CAMEL-5518 fix the issue that Camel Proxy,Export ignores camelContextId property in Spring configuration ........ r1374583 | ningjiang | 2012-08-18 22:03:32 +0800 (Sat, 18 Aug 2012) | 1 line CAMEL-5519 fix the issue that camel template, endpoint etc ignore camelContextId property ........ r1374584 | ningjiang | 2012-08-18 22:04:14 +0800 (Sat, 18 Aug 2012) | 1 line CAMEL-5518 fix a failed test ........ r1374709 | ningjiang | 2012-08-19 16:24:55 +0800 (Sun, 19 Aug 2012) | 1 line CAMEL-5518 fix another failed test ........ git-svn-id: https://svn.apache.org/repos/asf/camel/branches/camel-2.10.x@1374891 13f79535-47bb-0310-9956-ffa450edef68
- Loading branch information
1 parent
ab69c97
commit b6d7f7c
Showing
9 changed files
with
212 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
40 changes: 40 additions & 0 deletions
40
...src/test/java/org/apache/camel/spring/produce/ProduceTemplateWithTwoCamelContextTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
/** | ||
* 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.produce; | ||
|
||
import org.apache.camel.EndpointInject; | ||
import org.apache.camel.ProducerTemplate; | ||
import org.apache.camel.component.mock.MockEndpoint; | ||
import org.springframework.beans.factory.annotation.Autowired; | ||
import org.springframework.test.context.ContextConfiguration; | ||
import org.springframework.test.context.junit38.AbstractJUnit38SpringContextTests; | ||
|
||
@ContextConfiguration | ||
public class ProduceTemplateWithTwoCamelContextTest extends AbstractJUnit38SpringContextTests { | ||
@Autowired | ||
protected ProducerTemplate producer; | ||
|
||
@EndpointInject(uri = "mock:result") | ||
protected MockEndpoint result; | ||
|
||
public void testProducerTemplate() throws Exception { | ||
result.expectedBodiesReceived("hello"); | ||
// lets send a message | ||
producer.sendBody("direct:start", "hello"); | ||
result.assertIsSatisfied(); | ||
} | ||
} |
49 changes: 49 additions & 0 deletions
49
...ing/src/test/java/org/apache/camel/spring/remoting/SpringRemotingTwoCamelContextTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
/** | ||
* 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.remoting; | ||
|
||
import junit.framework.TestCase; | ||
|
||
import org.apache.camel.CamelContext; | ||
import org.apache.camel.spring.SpringCamelContext; | ||
import org.springframework.context.support.AbstractXmlApplicationContext; | ||
import org.springframework.context.support.ClassPathXmlApplicationContext; | ||
|
||
public class SpringRemotingTwoCamelContextTest extends TestCase { | ||
|
||
public void testProxyWithTwoCamelContext() throws Exception { | ||
AbstractXmlApplicationContext applicationContext = createApplicationContext(); | ||
CamelContext camelContext = SpringCamelContext.springCamelContext(applicationContext); | ||
|
||
ISay proxy = applicationContext.getBean("sayProxy1", ISay.class); | ||
String rc = proxy.say(); | ||
assertEquals("context-1", rc); | ||
|
||
proxy = applicationContext.getBean("sayProxy2", ISay.class); | ||
rc = proxy.say(); | ||
assertEquals("context-2", rc); | ||
|
||
|
||
camelContext.stop(); | ||
applicationContext.destroy(); | ||
} | ||
|
||
protected AbstractXmlApplicationContext createApplicationContext() { | ||
return new ClassPathXmlApplicationContext("org/apache/camel/spring/remoting/spring-with-two-camelcontext.xml"); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
41 changes: 41 additions & 0 deletions
41
...ources/org/apache/camel/spring/produce/ProduceTemplateWithTwoCamelContextTest-context.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
<?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. | ||
--> | ||
<!-- START SNIPPET: example --> | ||
<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://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd | ||
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd | ||
http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd | ||
"> | ||
<template id="camelTemplate" camelContextId="camelContext2" xmlns="http://camel.apache.org/schema/spring"/> | ||
|
||
<camelContext id="camelContext1" xmlns="http://camel.apache.org/schema/spring"/> | ||
|
||
<camelContext id="camelContext2" xmlns="http://camel.apache.org/schema/spring"> | ||
<route> | ||
<from uri="direct:start"/> | ||
<to uri="mock:result"/> | ||
</route> | ||
</camelContext> | ||
|
||
|
||
|
||
</beans> | ||
<!-- END SNIPPET: example --> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
65 changes: 65 additions & 0 deletions
65
...ring/src/test/resources/org/apache/camel/spring/remoting/spring-with-two-camelcontext.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
<?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:camel="http://camel.apache.org/schema/spring" | ||
xsi:schemaLocation=" | ||
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 | ||
"> | ||
|
||
<camelContext id="context-1" xmlns="http://camel.apache.org/schema/spring"> | ||
<route> | ||
<from uri="direct:foo"/> | ||
<to uri="direct:sayImpl"/> | ||
</route> | ||
</camelContext> | ||
<camelContext id="context-2" xmlns="http://camel.apache.org/schema/spring"> | ||
<route> | ||
<from uri="direct:foo"/> | ||
<to uri="direct:sayImpl"/> | ||
</route> | ||
</camelContext> | ||
|
||
<camel:proxy id="sayProxy1" | ||
serviceInterface="org.apache.camel.spring.remoting.ISay" | ||
serviceUrl="direct:foo" | ||
camelContextId="context-1"/> | ||
|
||
<camel:proxy id="sayProxy2" | ||
serviceInterface="org.apache.camel.spring.remoting.ISay" | ||
serviceUrl="direct:foo" | ||
camelContextId="context-2"/> | ||
|
||
<bean id="sayService1" class="org.apache.camel.spring.remoting.SayService"> | ||
<property name="message" value="context-1" /> | ||
</bean> | ||
|
||
<bean id="sayService2" class="org.apache.camel.spring.remoting.SayService"> | ||
<property name="message" value="context-2" /> | ||
</bean> | ||
|
||
<camel:export id="say1" uri="direct:sayImpl" serviceRef="sayService1" | ||
serviceInterface="org.apache.camel.spring.remoting.ISay" | ||
camelContextId="context-1"/> | ||
|
||
<camel:export id="say2" uri="direct:sayImpl" serviceRef="sayService2" | ||
serviceInterface="org.apache.camel.spring.remoting.ISay" | ||
camelContextId="context-2"/> | ||
|
||
</beans> |