Author: davsclaus
Date: Sun Aug 7 18:57:42 2011
New Revision: 1154748
URL: http://svn.apache.org/viewvc?rev=1154748&view=rev
Log:
CAMEL-4031: resource based components no longer depend on Spring JARs.
Added:
camel/trunk/camel-core/src/main/java/org/apache/camel/component/test/
- copied from r1154746,
camel/trunk/components/camel-spring/src/main/java/org/apache/camel/component/test/
camel/trunk/camel-core/src/main/resources/META-INF/services/org/apache/camel/component/test
camel/trunk/camel-core/src/test/data/message1.xml
- copied unchanged from r1154746,
camel/trunk/components/camel-spring/src/test/data/message1.xml
camel/trunk/camel-core/src/test/data/message2.xml
- copied unchanged from r1154746,
camel/trunk/components/camel-spring/src/test/data/message2.xml
camel/trunk/camel-core/src/test/java/org/apache/camel/component/test/
camel/trunk/camel-core/src/test/java/org/apache/camel/component/test/TestEndpointTest.java
camel/trunk/components/camel-spring/src/test/java/org/apache/camel/component/test/SpringTestEndpointTest.java
(contents, props changed)
- copied, changed from r1154746,
camel/trunk/components/camel-spring/src/test/java/org/apache/camel/component/test/TestEndpointTest.java
camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/component/test/SpringTestEndpointTest.xml
(contents, props changed)
- copied, changed from r1154746,
camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/component/test/TestEndpointTest-context.xml
Removed:
camel/trunk/components/camel-spring/src/main/java/org/apache/camel/component/test/
camel/trunk/components/camel-spring/src/main/resources/META-INF/services/org/apache/camel/component/test
camel/trunk/components/camel-spring/src/test/java/org/apache/camel/component/test/TestEndpointTest.java
camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/component/test/TestEndpointTest-context.xml
Modified:
camel/trunk/camel-core/src/main/java/org/apache/camel/component/test/TestEndpoint.java
camel/trunk/camel-core/src/main/java/org/apache/camel/component/test/package.html
Modified:
camel/trunk/camel-core/src/main/java/org/apache/camel/component/test/TestEndpoint.java
URL:
http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/component/test/TestEndpoint.java?rev=1154748&r1=1154746&r2=1154748&view=diff
==============================================================================
---
camel/trunk/camel-core/src/main/java/org/apache/camel/component/test/TestEndpoint.java
(original)
+++
camel/trunk/camel-core/src/main/java/org/apache/camel/component/test/TestEndpoint.java
Sun Aug 7 18:57:42 2011
@@ -48,10 +48,12 @@ public class TestEndpoint extends MockEn
@Override
protected void doStart() throws Exception {
LOG.debug("Consuming expected messages from: {}",
expectedMessageEndpoint);
+
final List<Object> expectedBodies = new ArrayList<Object>();
EndpointHelper.pollEndpoint(expectedMessageEndpoint, new Processor() {
public void process(Exchange exchange) throws Exception {
Object body = getInBody(exchange);
+ LOG.trace("Received message body {}", body);
expectedBodies.add(body);
}
}, timeout);
Modified:
camel/trunk/camel-core/src/main/java/org/apache/camel/component/test/package.html
URL:
http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/component/test/package.html?rev=1154748&r1=1154746&r2=1154748&view=diff
==============================================================================
---
camel/trunk/camel-core/src/main/java/org/apache/camel/component/test/package.html
(original)
+++
camel/trunk/camel-core/src/main/java/org/apache/camel/component/test/package.html
Sun Aug 7 18:57:42 2011
@@ -19,7 +19,7 @@
</head>
<body>
-A <a href="http://activemq.apache.org/camel/test.html">Test Endpoint</a> for
Pattern Based Testing
+A <a href="http://camel.apache.org/test.html">Test Endpoint</a> for Pattern
Based Testing
</body>
</html>
Added:
camel/trunk/camel-core/src/main/resources/META-INF/services/org/apache/camel/component/test
URL:
http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/resources/META-INF/services/org/apache/camel/component/test?rev=1154748&view=auto
==============================================================================
---
camel/trunk/camel-core/src/main/resources/META-INF/services/org/apache/camel/component/test
(added)
+++
camel/trunk/camel-core/src/main/resources/META-INF/services/org/apache/camel/component/test
Sun Aug 7 18:57:42 2011
@@ -0,0 +1,18 @@
+#
+# 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.
+#
+
+class=org.apache.camel.component.test.TestComponent
\ No newline at end of file
Added:
camel/trunk/camel-core/src/test/java/org/apache/camel/component/test/TestEndpointTest.java
URL:
http://svn.apache.org/viewvc/camel/trunk/camel-core/src/test/java/org/apache/camel/component/test/TestEndpointTest.java?rev=1154748&view=auto
==============================================================================
---
camel/trunk/camel-core/src/test/java/org/apache/camel/component/test/TestEndpointTest.java
(added)
+++
camel/trunk/camel-core/src/test/java/org/apache/camel/component/test/TestEndpointTest.java
Sun Aug 7 18:57:42 2011
@@ -0,0 +1,50 @@
+/**
+ * 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.component.test;
+
+import org.apache.camel.ContextTestSupport;
+import org.apache.camel.builder.RouteBuilder;
+
+/**
+ *
+ */
+public class TestEndpointTest extends ContextTestSupport {
+
+ public void testMocksAreValid() throws Exception {
+ // perform the test, and send in 2 messages we expect
+ Thread.sleep(500);
+ template.sendBody("seda:foo", "Hello World");
+ template.sendBody("seda:foo", "Bye World");
+
+ assertMockEndpointsSatisfied();
+ }
+
+ @Override
+ protected RouteBuilder createRouteBuilder() throws Exception {
+ return new RouteBuilder() {
+ @Override
+ public void configure() throws Exception {
+ // send 2 bodies to the seda:foo which is the messages we
expect
+ template.sendBody("seda:foo", "Hello World");
+ template.sendBody("seda:foo", "Bye World");
+
+ from("seda:foo")
+ .to("test:seda:foo");
+ }
+ };
+ }
+}
Copied:
camel/trunk/components/camel-spring/src/test/java/org/apache/camel/component/test/SpringTestEndpointTest.java
(from r1154746,
camel/trunk/components/camel-spring/src/test/java/org/apache/camel/component/test/TestEndpointTest.java)
URL:
http://svn.apache.org/viewvc/camel/trunk/components/camel-spring/src/test/java/org/apache/camel/component/test/SpringTestEndpointTest.java?p2=camel/trunk/components/camel-spring/src/test/java/org/apache/camel/component/test/SpringTestEndpointTest.java&p1=camel/trunk/components/camel-spring/src/test/java/org/apache/camel/component/test/TestEndpointTest.java&r1=1154746&r2=1154748&rev=1154748&view=diff
==============================================================================
---
camel/trunk/components/camel-spring/src/test/java/org/apache/camel/component/test/TestEndpointTest.java
(original)
+++
camel/trunk/components/camel-spring/src/test/java/org/apache/camel/component/test/SpringTestEndpointTest.java
Sun Aug 7 18:57:42 2011
@@ -17,22 +17,16 @@
package org.apache.camel.component.test;
import org.apache.camel.CamelContext;
-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;
+
+import static
org.apache.camel.spring.processor.SpringTestHelper.createSpringCamelContext;
/**
* @version
*/
-@ContextConfiguration
-public class TestEndpointTest extends AbstractJUnit38SpringContextTests {
-
- @Autowired
- protected CamelContext camelContext;
+public class SpringTestEndpointTest extends TestEndpointTest {
- public void testMocksAreValid() throws Exception {
- assertNotNull(camelContext);
- MockEndpoint.assertIsSatisfied(camelContext);
+ protected CamelContext createCamelContext() throws Exception {
+ return createSpringCamelContext(this,
"org/apache/camel/component/test/SpringTestEndpointTest.xml");
}
+
}
Propchange:
camel/trunk/components/camel-spring/src/test/java/org/apache/camel/component/test/SpringTestEndpointTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange:
camel/trunk/components/camel-spring/src/test/java/org/apache/camel/component/test/SpringTestEndpointTest.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Copied:
camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/component/test/SpringTestEndpointTest.xml
(from r1154746,
camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/component/test/TestEndpointTest-context.xml)
URL:
http://svn.apache.org/viewvc/camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/component/test/SpringTestEndpointTest.xml?p2=camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/component/test/SpringTestEndpointTest.xml&p1=camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/component/test/TestEndpointTest-context.xml&r1=1154746&r2=1154748&rev=1154748&view=diff
==============================================================================
---
camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/component/test/TestEndpointTest-context.xml
(original)
+++
camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/component/test/SpringTestEndpointTest.xml
Sun Aug 7 18:57:42 2011
@@ -25,8 +25,8 @@
<!-- START SNIPPET: example -->
<camelContext xmlns="http://camel.apache.org/schema/spring">
<route>
- <from
uri="file://src/test/data?noop=true&readLock=none&initialDelay=5000"/>
- <to
uri="test:file://src/test/data?noop=true&readLock=none&initialDelay=5000"/>
+ <from uri="seda:foo"/>
+ <to uri="test:seda:foo"/>
</route>
</camelContext>
<!-- END SNIPPET: example -->
Propchange:
camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/component/test/SpringTestEndpointTest.xml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange:
camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/component/test/SpringTestEndpointTest.xml
------------------------------------------------------------------------------
svn:keywords = Rev Date
Propchange:
camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/component/test/SpringTestEndpointTest.xml
------------------------------------------------------------------------------
svn:mime-type = text/xml