Author: davsclaus
Date: Sat May 7 09:13:22 2011
New Revision: 1100484
URL: http://svn.apache.org/viewvc?rev=1100484&view=rev
Log:
CAMEL-3032: Do not use test-jar in pom.xml.
Modified:
camel/trunk/components/camel-castor/pom.xml
camel/trunk/components/camel-castor/src/test/java/org/apache/camel/dataformat/castor/SpringMarshalDomainObjectTest.java
Modified: camel/trunk/components/camel-castor/pom.xml
URL:
http://svn.apache.org/viewvc/camel/trunk/components/camel-castor/pom.xml?rev=1100484&r1=1100483&r2=1100484&view=diff
==============================================================================
--- camel/trunk/components/camel-castor/pom.xml (original)
+++ camel/trunk/components/camel-castor/pom.xml Sat May 7 09:13:22 2011
@@ -58,13 +58,6 @@
<artifactId>camel-spring</artifactId>
<scope>test</scope>
</dependency>
- <dependency>
- <groupId>org.apache.camel</groupId>
- <artifactId>camel-spring</artifactId>
- <type>test-jar</type>
- <scope>test</scope>
- </dependency>
-
<dependency>
<groupId>org.slf4j</groupId>
Modified:
camel/trunk/components/camel-castor/src/test/java/org/apache/camel/dataformat/castor/SpringMarshalDomainObjectTest.java
URL:
http://svn.apache.org/viewvc/camel/trunk/components/camel-castor/src/test/java/org/apache/camel/dataformat/castor/SpringMarshalDomainObjectTest.java?rev=1100484&r1=1100483&r2=1100484&view=diff
==============================================================================
---
camel/trunk/components/camel-castor/src/test/java/org/apache/camel/dataformat/castor/SpringMarshalDomainObjectTest.java
(original)
+++
camel/trunk/components/camel-castor/src/test/java/org/apache/camel/dataformat/castor/SpringMarshalDomainObjectTest.java
Sat May 7 09:13:22 2011
@@ -16,30 +16,62 @@
*/
package org.apache.camel.dataformat.castor;
-import org.apache.camel.CamelContext;
-import org.apache.camel.Service;
-import org.apache.camel.spring.SpringCamelContext;
-import org.springframework.context.support.AbstractXmlApplicationContext;
+import org.apache.camel.component.mock.MockEndpoint;
+import org.apache.camel.test.junit4.CamelSpringTestSupport;
+import org.junit.Test;
+import org.springframework.context.support.AbstractApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
-public class SpringMarshalDomainObjectTest extends MarshalDomainObjectTest {
+public class SpringMarshalDomainObjectTest extends CamelSpringTestSupport {
- protected CamelContext createCamelContext() throws Exception {
- setUseRouteBuilder(false);
+ @Test
+ public void testMarshalDomainObject() throws Exception {
+ // some platform cannot test using Castor as it uses a SUN dependent
Xerces
+ if (isJavaVendor("IBM")) {
+ return;
+ }
+
+ MockEndpoint mock = getMockEndpoint("mock:result");
+ mock.expectedMessageCount(1);
+
+ PurchaseOrder order = new PurchaseOrder();
+ order.setName("Tiger");
+ order.setAmount(1);
+ order.setPrice(99.95);
- final AbstractXmlApplicationContext applicationContext =
- new
ClassPathXmlApplicationContext("org/apache/camel/dataformat/castor/SpringMarshalDomainObjectTest.xml");
- setCamelContextService(new Service() {
- public void start() throws Exception {
- applicationContext.start();
- }
-
- public void stop() throws Exception {
- applicationContext.stop();
- }
- });
+ template.sendBody("direct:in", order);
- return SpringCamelContext.springCamelContext(applicationContext);
+ mock.assertIsSatisfied();
+ }
+
+ @Test
+ public void testMarshalDomainObjectTwice() throws Exception {
+ // some platform cannot test using Castor as it uses a SUN dependent
Xerces
+ if (isJavaVendor("IBM")) {
+ return;
+ }
+
+ MockEndpoint mock = getMockEndpoint("mock:result");
+ mock.expectedMessageCount(2);
+
+ PurchaseOrder order = new PurchaseOrder();
+ order.setName("Tiger");
+ order.setAmount(1);
+ order.setPrice(99.95);
+
+ template.sendBody("direct:in", order);
+ template.sendBody("direct:in", order);
+
+ mock.assertIsSatisfied();
+
+ String body1 =
mock.getExchanges().get(0).getIn().getBody(String.class);
+ String body2 =
mock.getExchanges().get(1).getIn().getBody(String.class);
+ assertEquals("The body should marshalled to the same", body1, body2);
+ }
+
+ @Override
+ protected AbstractApplicationContext createApplicationContext() {
+ return new
ClassPathXmlApplicationContext("org/apache/camel/dataformat/castor/SpringMarshalDomainObjectTest.xml");
}
}