You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by bv...@apache.org on 2013/01/21 21:47:53 UTC
svn commit: r1436609 - in /camel/branches/camel-2.10.x: ./
components/camel-cxf/src/test/java/org/apache/camel/component/cxf/util/
components/camel-jetty/src/test/java/org/apache/camel/component/jetty/jettyproducer/
components/camel-spring/src/test/jav...
Author: bvahdat
Date: Mon Jan 21 20:47:52 2013
New Revision: 1436609
URL: http://svn.apache.org/viewvc?rev=1436609&view=rev
Log:
Merged revisions 1436603 via svnmerge from
https://svn.apache.org/repos/asf/camel/trunk
........
r1436603 | bvahdat | 2013-01-21 21:42:44 +0100 (Mo, 21 Jan 2013) | 1 line
CAMEL-5983: Avoid the negative-tests to behave as false-positive.
........
Modified:
camel/branches/camel-2.10.x/ (props changed)
camel/branches/camel-2.10.x/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/util/CxfEndpointUtilsTest.java
camel/branches/camel-2.10.x/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/jettyproducer/JettyHttpProducerSimulate404ErrorTest.java
camel/branches/camel-2.10.x/components/camel-spring/src/test/java/org/apache/camel/spring/interceptor/MixedPropagationTransactedTest.java
camel/branches/camel-2.10.x/components/camel-spring/src/test/java/org/apache/camel/spring/interceptor/TransactionalClientDataSourceMixedTransactedTest.java
Propchange: camel/branches/camel-2.10.x/
------------------------------------------------------------------------------
Merged /camel/trunk:r1436603
Propchange: camel/branches/camel-2.10.x/
------------------------------------------------------------------------------
Binary property 'svnmerge-integrated' - no diff available.
Modified: camel/branches/camel-2.10.x/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/util/CxfEndpointUtilsTest.java
URL: http://svn.apache.org/viewvc/camel/branches/camel-2.10.x/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/util/CxfEndpointUtilsTest.java?rev=1436609&r1=1436608&r2=1436609&view=diff
==============================================================================
--- camel/branches/camel-2.10.x/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/util/CxfEndpointUtilsTest.java (original)
+++ camel/branches/camel-2.10.x/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/util/CxfEndpointUtilsTest.java Mon Jan 21 20:47:52 2013
@@ -21,6 +21,7 @@ import javax.xml.namespace.QName;
import org.apache.camel.CamelContext;
import org.apache.camel.Exchange;
import org.apache.camel.Processor;
+import org.apache.camel.Producer;
import org.apache.camel.component.cxf.CxfComponent;
import org.apache.camel.component.cxf.CxfEndpoint;
import org.apache.camel.component.cxf.DataFormat;
@@ -99,30 +100,26 @@ public class CxfEndpointUtilsTest extend
@Test
public void testCheckServiceClassProcedure() throws Exception {
CxfEndpoint endpoint = createEndpoint(getNoServiceClassURI());
- try {
- endpoint.createProducer();
- } catch (IllegalArgumentException exception) {
- assertNotNull("Should get a CamelException here", exception);
- }
+ assertNotNull(endpoint.createProducer());
}
@Test
public void testCheckServiceClassConsumer() throws Exception {
CxfEndpoint endpoint = createEndpoint(getNoServiceClassURI());
try {
- endpoint.createConsumer(new NullProcessor());
+ endpoint.createConsumer(new Processor() {
+
+ @Override
+ public void process(Exchange exchange) throws Exception {
+ // noop
+ }
+
+ });
+ fail("Should have thrown exception");
} catch (IllegalArgumentException exception) {
assertNotNull("Should get a CamelException here", exception);
assertTrue(exception.getMessage().startsWith("serviceClass must be specified"));
}
}
- class NullProcessor implements Processor {
-
- public void process(Exchange exchange) throws Exception {
- // Do nothing here
- }
-
- }
-
}
Modified: camel/branches/camel-2.10.x/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/jettyproducer/JettyHttpProducerSimulate404ErrorTest.java
URL: http://svn.apache.org/viewvc/camel/branches/camel-2.10.x/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/jettyproducer/JettyHttpProducerSimulate404ErrorTest.java?rev=1436609&r1=1436608&r2=1436609&view=diff
==============================================================================
--- camel/branches/camel-2.10.x/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/jettyproducer/JettyHttpProducerSimulate404ErrorTest.java (original)
+++ camel/branches/camel-2.10.x/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/jettyproducer/JettyHttpProducerSimulate404ErrorTest.java Mon Jan 21 20:47:52 2013
@@ -40,15 +40,14 @@ public class JettyHttpProducerSimulate40
// give Jetty time to startup properly
Thread.sleep(1000);
- try {
- template.request(url, null);
- } catch (Exception e) {
- HttpOperationFailedException cause = assertIsInstanceOf(HttpOperationFailedException.class, e.getCause());
- assertEquals(404, cause.getStatusCode());
- assertEquals("http//0.0.0.0:" + getPort() + "/bar", cause.getUri());
- assertEquals("Page not found", cause.getResponseBody());
- assertNotNull(cause.getResponseHeaders());
- }
+ Exchange exchange = template.request(url, null);
+
+ assertNotNull(exchange.getException());
+ HttpOperationFailedException cause = assertIsInstanceOf(HttpOperationFailedException.class, exchange.getException());
+ assertEquals(404, cause.getStatusCode());
+ assertEquals("http//0.0.0.0:" + getPort() + "/bar", cause.getUri());
+ assertEquals("Page not found", cause.getResponseBody());
+ assertNotNull(cause.getResponseHeaders());
}
@Override
Modified: camel/branches/camel-2.10.x/components/camel-spring/src/test/java/org/apache/camel/spring/interceptor/MixedPropagationTransactedTest.java
URL: http://svn.apache.org/viewvc/camel/branches/camel-2.10.x/components/camel-spring/src/test/java/org/apache/camel/spring/interceptor/MixedPropagationTransactedTest.java?rev=1436609&r1=1436608&r2=1436609&view=diff
==============================================================================
--- camel/branches/camel-2.10.x/components/camel-spring/src/test/java/org/apache/camel/spring/interceptor/MixedPropagationTransactedTest.java (original)
+++ camel/branches/camel-2.10.x/components/camel-spring/src/test/java/org/apache/camel/spring/interceptor/MixedPropagationTransactedTest.java Mon Jan 21 20:47:52 2013
@@ -81,9 +81,10 @@ public class MixedPropagationTransactedT
assertEquals("Number of books", 3, count);
}
- public void testRequiredOnlkyRollback() throws Exception {
+ public void testRequiredOnlyRollback() throws Exception {
try {
template.sendBody("direct:required", "Donkey in Action");
+ fail("Should have thrown exception");
} catch (RuntimeCamelException e) {
// expected as we fail
assertIsInstanceOf(RuntimeCamelException.class, e.getCause());
@@ -96,9 +97,10 @@ public class MixedPropagationTransactedT
assertEquals("Number of books", 1, count);
}
- public void testRequiresNewOnlkyRollback() throws Exception {
+ public void testRequiresNewOnlyRollback() throws Exception {
try {
template.sendBody("direct:new", "Donkey in Action");
+ fail("Should have thrown exception");
} catch (RuntimeCamelException e) {
// expected as we fail
assertIsInstanceOf(RuntimeCamelException.class, e.getCause());
@@ -111,21 +113,13 @@ public class MixedPropagationTransactedT
assertEquals("Number of books", 1, count);
}
- public void testRequiredAndNewRollback() throws Exception {
- try {
- template.sendBody("direct:new", "Tiger in Action");
- } catch (RuntimeCamelException e) {
- // expeced as we fail
- assertIsInstanceOf(RuntimeCamelException.class, e.getCause());
- assertTrue(e.getCause().getCause() instanceof IllegalArgumentException);
- assertEquals("We don't have Donkeys, only Camels", e.getCause().getCause().getMessage());
- }
+ public void testRequiredAndNew() throws Exception {
+ template.sendBody("direct:requiredAndNew", "Tiger in Action");
int count = jdbc.queryForInt("select count(*) from books");
- assertEquals(1, jdbc.queryForInt("select count(*) from books where title = ?", "Tiger in Action"));
+ assertEquals(2, jdbc.queryForInt("select count(*) from books where title = ?", "Tiger in Action"));
assertEquals(0, jdbc.queryForInt("select count(*) from books where title = ?", "Donkey in Action"));
- // the tiger in action should be committed, but our 2nd route should rollback
- assertEquals("Number of books", 2, count);
+ assertEquals("Number of books", 3, count);
}
protected RouteBuilder createRouteBuilder() throws Exception {
Modified: camel/branches/camel-2.10.x/components/camel-spring/src/test/java/org/apache/camel/spring/interceptor/TransactionalClientDataSourceMixedTransactedTest.java
URL: http://svn.apache.org/viewvc/camel/branches/camel-2.10.x/components/camel-spring/src/test/java/org/apache/camel/spring/interceptor/TransactionalClientDataSourceMixedTransactedTest.java?rev=1436609&r1=1436608&r2=1436609&view=diff
==============================================================================
--- camel/branches/camel-2.10.x/components/camel-spring/src/test/java/org/apache/camel/spring/interceptor/TransactionalClientDataSourceMixedTransactedTest.java (original)
+++ camel/branches/camel-2.10.x/components/camel-spring/src/test/java/org/apache/camel/spring/interceptor/TransactionalClientDataSourceMixedTransactedTest.java Mon Jan 21 20:47:52 2013
@@ -16,7 +16,6 @@
*/
package org.apache.camel.spring.interceptor;
-import org.apache.camel.RuntimeCamelException;
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.spring.SpringRouteBuilder;
@@ -26,13 +25,9 @@ import org.apache.camel.spring.SpringRou
public class TransactionalClientDataSourceMixedTransactedTest extends TransactionalClientDataSourceTest {
public void testTransactionRollback() throws Exception {
- try {
- template.sendBody("direct:fail", "Hello World");
- } catch (RuntimeCamelException e) {
- // expected as we fail
- assertTrue(e.getCause() instanceof IllegalArgumentException);
- assertEquals("We don't have Donkeys, only Camels", e.getCause().getMessage());
- }
+ // through the onException clause below we've marked the exceptions containing the message
+ // "Donkey" as being handled so that we don't count with any exception on the client side.
+ template.sendBody("direct:fail", "Hello World");
int count = jdbc.queryForInt("select count(*) from books");
// should get 2 books as the first operation will succeed and we are not transacted