Updated Branches: refs/heads/camel-2.12.x 3526a9746 -> c6da2c92a refs/heads/master dbbc807f2 -> 0eb26100e
Fixed tests Project: http://git-wip-us.apache.org/repos/asf/camel/repo Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/0eb26100 Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/0eb26100 Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/0eb26100 Branch: refs/heads/master Commit: 0eb26100e7864997563b62154ee3c9f41587d007 Parents: dbbc807 Author: Claus Ibsen <davscl...@apache.org> Authored: Fri Nov 8 10:45:26 2013 +0100 Committer: Claus Ibsen <davscl...@apache.org> Committed: Fri Nov 8 10:45:26 2013 +0100 ---------------------------------------------------------------------- .../camel/itest/jms/JmsValidatorTest.java | 41 +++++++------------- .../camel/itest/jms/SpringJmsValidatorTest.java | 37 +++++------------- .../camel/itest/jms/SpringJmsValidatorTest.xml | 13 +++++++ 3 files changed, 37 insertions(+), 54 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/camel/blob/0eb26100/tests/camel-itest/src/test/java/org/apache/camel/itest/jms/JmsValidatorTest.java ---------------------------------------------------------------------- diff --git a/tests/camel-itest/src/test/java/org/apache/camel/itest/jms/JmsValidatorTest.java b/tests/camel-itest/src/test/java/org/apache/camel/itest/jms/JmsValidatorTest.java index 7e4de81..2e7fdbd 100644 --- a/tests/camel-itest/src/test/java/org/apache/camel/itest/jms/JmsValidatorTest.java +++ b/tests/camel-itest/src/test/java/org/apache/camel/itest/jms/JmsValidatorTest.java @@ -21,7 +21,6 @@ import javax.naming.Context; import org.apache.activemq.camel.component.ActiveMQComponent; import org.apache.camel.ValidationException; import org.apache.camel.builder.RouteBuilder; -import org.apache.camel.spi.BrowsableEndpoint; import org.apache.camel.test.junit4.CamelTestSupport; import org.apache.camel.util.jndi.JndiContext; import org.junit.Test; @@ -33,42 +32,26 @@ public class JmsValidatorTest extends CamelTestSupport { @Test public void testJmsValidator() throws Exception { - String body = "<?xml version=\"1.0\"?>\n<p>Hello world!</p>"; + getMockEndpoint("mock:valid").expectedMessageCount(1); + getMockEndpoint("mock:invalid").expectedMessageCount(0); + getMockEndpoint("mock:finally").expectedMessageCount(1); + String body = "<?xml version=\"1.0\"?>\n<p>Hello world!</p>"; template.sendBody("jms:queue:inbox", body); - // wait a sec - Thread.sleep(1000); - - // it should end up in the valid and finally queue - BrowsableEndpoint bev = context.getEndpoint("jms:queue:valid", BrowsableEndpoint.class); - assertEquals(1, bev.getExchanges().size()); - - BrowsableEndpoint beiv = context.getEndpoint("jms:queue:invalid", BrowsableEndpoint.class); - assertEquals(0, beiv.getExchanges().size()); - - BrowsableEndpoint bef = context.getEndpoint("jms:queue:finally", BrowsableEndpoint.class); - assertEquals(1, bef.getExchanges().size()); + assertMockEndpointsSatisfied(); } @Test public void testJmsValidatorInvalid() throws Exception { - String body = "<?xml version=\"1.0\"?>\n<foo>Kaboom</foo>"; + getMockEndpoint("mock:valid").expectedMessageCount(0); + getMockEndpoint("mock:invalid").expectedMessageCount(1); + getMockEndpoint("mock:finally").expectedMessageCount(1); + String body = "<?xml version=\"1.0\"?>\n<foo>Kaboom</foo>"; template.sendBody("jms:queue:inbox", body); - // wait a sec - Thread.sleep(1000); - - // it should end up in the invalid and finally queue - BrowsableEndpoint bev = context.getEndpoint("jms:queue:valid", BrowsableEndpoint.class); - assertEquals(0, bev.getExchanges().size()); - - BrowsableEndpoint beiv = context.getEndpoint("jms:queue:invalid", BrowsableEndpoint.class); - assertEquals(1, beiv.getExchanges().size()); - - BrowsableEndpoint bef = context.getEndpoint("jms:queue:finally", BrowsableEndpoint.class); - assertEquals(1, bef.getExchanges().size()); + assertMockEndpointsSatisfied(); } @Override @@ -97,6 +80,10 @@ public class JmsValidatorTest extends CamelTestSupport { .doFinally() .to("jms:queue:finally") .end(); + + from("jms:queue:valid").to("mock:valid"); + from("jms:queue:invalid").to("mock:invalid"); + from("jms:queue:finally").to("mock:finally"); } }; } http://git-wip-us.apache.org/repos/asf/camel/blob/0eb26100/tests/camel-itest/src/test/java/org/apache/camel/itest/jms/SpringJmsValidatorTest.java ---------------------------------------------------------------------- diff --git a/tests/camel-itest/src/test/java/org/apache/camel/itest/jms/SpringJmsValidatorTest.java b/tests/camel-itest/src/test/java/org/apache/camel/itest/jms/SpringJmsValidatorTest.java index ab70890..e48ad85 100644 --- a/tests/camel-itest/src/test/java/org/apache/camel/itest/jms/SpringJmsValidatorTest.java +++ b/tests/camel-itest/src/test/java/org/apache/camel/itest/jms/SpringJmsValidatorTest.java @@ -16,7 +16,6 @@ */ package org.apache.camel.itest.jms; -import org.apache.camel.spi.BrowsableEndpoint; import org.apache.camel.test.spring.CamelSpringTestSupport; import org.junit.Test; import org.springframework.context.support.AbstractXmlApplicationContext; @@ -34,42 +33,26 @@ public class SpringJmsValidatorTest extends CamelSpringTestSupport { @Test public void testJmsValidator() throws Exception { - String body = "<?xml version=\"1.0\"?>\n<p>Hello world!</p>"; + getMockEndpoint("mock:valid").expectedMessageCount(1); + getMockEndpoint("mock:invalid").expectedMessageCount(0); + getMockEndpoint("mock:finally").expectedMessageCount(1); + String body = "<?xml version=\"1.0\"?>\n<p>Hello world!</p>"; template.sendBody("jms:queue:inbox", body); - // wait a sec - Thread.sleep(1000); - - // it should end up in the valid and finally queue - BrowsableEndpoint bev = context.getEndpoint("jms:queue:valid", BrowsableEndpoint.class); - assertEquals(1, bev.getExchanges().size()); - - BrowsableEndpoint beiv = context.getEndpoint("jms:queue:invalid", BrowsableEndpoint.class); - assertEquals(0, beiv.getExchanges().size()); - - BrowsableEndpoint bef = context.getEndpoint("jms:queue:finally", BrowsableEndpoint.class); - assertEquals(1, bef.getExchanges().size()); + assertMockEndpointsSatisfied(); } @Test public void testJmsValidatorInvalid() throws Exception { - String body = "<?xml version=\"1.0\"?>\n<foo>Kaboom</foo>"; + getMockEndpoint("mock:valid").expectedMessageCount(0); + getMockEndpoint("mock:invalid").expectedMessageCount(1); + getMockEndpoint("mock:finally").expectedMessageCount(1); + String body = "<?xml version=\"1.0\"?>\n<foo>Kaboom</foo>"; template.sendBody("jms:queue:inbox", body); - // wait a sec - Thread.sleep(1000); - - // it should end up in the invalid and finally queue - BrowsableEndpoint bev = context.getEndpoint("jms:queue:valid", BrowsableEndpoint.class); - assertEquals(0, bev.getExchanges().size()); - - BrowsableEndpoint beiv = context.getEndpoint("jms:queue:invalid", BrowsableEndpoint.class); - assertEquals(1, beiv.getExchanges().size()); - - BrowsableEndpoint bef = context.getEndpoint("jms:queue:finally", BrowsableEndpoint.class); - assertEquals(1, bef.getExchanges().size()); + assertMockEndpointsSatisfied(); } } \ No newline at end of file http://git-wip-us.apache.org/repos/asf/camel/blob/0eb26100/tests/camel-itest/src/test/resources/org/apache/camel/itest/jms/SpringJmsValidatorTest.xml ---------------------------------------------------------------------- diff --git a/tests/camel-itest/src/test/resources/org/apache/camel/itest/jms/SpringJmsValidatorTest.xml b/tests/camel-itest/src/test/resources/org/apache/camel/itest/jms/SpringJmsValidatorTest.xml index ca1889a..73548a7 100644 --- a/tests/camel-itest/src/test/resources/org/apache/camel/itest/jms/SpringJmsValidatorTest.xml +++ b/tests/camel-itest/src/test/resources/org/apache/camel/itest/jms/SpringJmsValidatorTest.xml @@ -42,6 +42,19 @@ </doFinally> </doTry> </route> + + <route> + <from uri="jms:queue:valid"/> + <to uri="mock:valid"/> + </route> + <route> + <from uri="jms:queue:invalid"/> + <to uri="mock:invalid"/> + </route> + <route> + <from uri="jms:queue:finally"/> + <to uri="mock:finally"/> + </route> </camelContext> </beans>