Updated Branches: refs/heads/master 090f7dbba -> d1cef6b41
Got rid of the deprecated JdbcTemplate#queryForInt & JdbcTemplate#queryForLong methods. Project: http://git-wip-us.apache.org/repos/asf/camel/repo Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/d1cef6b4 Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/d1cef6b4 Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/d1cef6b4 Branch: refs/heads/master Commit: d1cef6b419f4ae58715815d425016c9693b23337 Parents: 090f7db Author: Babak Vahdat <[email protected]> Authored: Sun Oct 27 09:54:59 2013 +0100 Committer: Babak Vahdat <[email protected]> Committed: Sun Oct 27 09:54:59 2013 +0100 ---------------------------------------------------------------------- .../MixedPropagationTransactedTest.java | 30 ++++++++++---------- .../MixedTransactionPropagationTest.java | 28 +++++++++--------- ...sactionalClientDataSourceTransactedTest.java | 4 +-- ...ExceptionAndRollbackUsingTransactedTest.java | 2 +- .../TransactionalClientDataSourceAsyncTest.java | 2 +- ...ransactionalClientDataSourceHandledTest.java | 2 +- ...lientDataSourceMinimalConfigurationTest.java | 4 +-- ...onalClientDataSourceMixedTransactedTest.java | 2 +- ...tionalClientDataSourceNotTransactedTest.java | 2 +- ...ientDataSourceOnExceptionRedeliveryTest.java | 2 +- ...sactionalClientDataSourceRedeliveryTest.java | 2 +- .../TransactionalClientDataSourceTest.java | 4 +-- ...SourceTransactedWithFileOnExceptionTest.java | 4 +-- ...lClientDataSourceTransactedWithFileTest.java | 7 ++--- ...ceWithOnExceptionHandledAndRollbackTest.java | 2 +- ...onHandledAndRollbackUsingTransactedTest.java | 2 +- ...ntDataSourceWithOnExceptionRollbackTest.java | 2 +- ...onalClientDataSourceWithOnExceptionTest.java | 2 +- .../TransactionalClientWithRollbackTest.java | 4 +-- ...lerAndContextScopedOnExceptionIssueTest.java | 8 +++--- .../jdbc/JdbcAggregationRepository.java | 4 +-- .../jdbc/JdbcMessageIdRepository.java | 2 +- .../sql/SqlConsumerDeleteBatchCompleteTest.java | 4 +-- .../sql/SqlConsumerDeleteFailedTest.java | 2 +- .../component/sql/SqlConsumerDeleteTest.java | 4 +-- .../sql/SqlConsumerDeleteTransformTest.java | 4 +-- .../component/sql/SqlProducerJSONTest.java | 2 +- .../component/sql/SqlProducerSeparatorTest.java | 2 +- .../camel/component/sql/SqlRouteTest.java | 8 +++--- .../component/sql/SqlTransactedRouteTest.java | 6 ++-- .../idempotent/JdbcIdempotentRepository.java | 3 +- 31 files changed, 77 insertions(+), 79 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/camel/blob/d1cef6b4/components/camel-spring/src/test/java/org/apache/camel/spring/interceptor/MixedPropagationTransactedTest.java ---------------------------------------------------------------------- diff --git a/components/camel-spring/src/test/java/org/apache/camel/spring/interceptor/MixedPropagationTransactedTest.java b/components/camel-spring/src/test/java/org/apache/camel/spring/interceptor/MixedPropagationTransactedTest.java index 60d9df0..bdcd5b1 100644 --- a/components/camel-spring/src/test/java/org/apache/camel/spring/interceptor/MixedPropagationTransactedTest.java +++ b/components/camel-spring/src/test/java/org/apache/camel/spring/interceptor/MixedPropagationTransactedTest.java @@ -51,33 +51,33 @@ public class MixedPropagationTransactedTest extends SpringTestSupport { public void testRequiredOnly() throws Exception { template.sendBody("direct:required", "Tiger in Action"); - int count = jdbc.queryForInt("select count(*) from books"); - assertEquals(1, jdbc.queryForInt("select count(*) from books where title = ?", "Tiger in Action")); + int count = jdbc.queryForObject("select count(*) from books", Integer.class); + assertEquals(new Integer(1), jdbc.queryForObject("select count(*) from books where title = ?", Integer.class, "Tiger in Action")); assertEquals("Number of books", 2, count); } public void testRequired2Only() throws Exception { template.sendBody("direct:required2", "Tiger in Action"); - int count = jdbc.queryForInt("select count(*) from books"); + int count = jdbc.queryForObject("select count(*) from books", Integer.class); // we do 2x the book service so we should get 2 tiger books - assertEquals(2, jdbc.queryForInt("select count(*) from books where title = ?", "Tiger in Action")); + assertEquals(new Integer(2), jdbc.queryForObject("select count(*) from books where title = ?", Integer.class, "Tiger in Action")); assertEquals("Number of books", 3, count); } public void testRequiresNewOnly() throws Exception { template.sendBody("direct:new", "Elephant in Action"); - int count = jdbc.queryForInt("select count(*) from books"); - assertEquals(1, jdbc.queryForInt("select count(*) from books where title = ?", "Elephant in Action")); + int count = jdbc.queryForObject("select count(*) from books", Integer.class); + assertEquals(new Integer(1), jdbc.queryForObject("select count(*) from books where title = ?", Integer.class, "Elephant in Action")); assertEquals("Number of books", 2, count); } public void testRequiredAndRequiresNew() throws Exception { template.sendBody("direct:requiredAndNew", "Tiger in Action"); - int count = jdbc.queryForInt("select count(*) from books"); - assertEquals(2, jdbc.queryForInt("select count(*) from books where title = ?", "Tiger in Action")); + int count = jdbc.queryForObject("select count(*) from books", Integer.class); + assertEquals(new Integer(2), jdbc.queryForObject("select count(*) from books where title = ?", Integer.class, "Tiger in Action")); assertEquals("Number of books", 3, count); } @@ -92,8 +92,8 @@ public class MixedPropagationTransactedTest extends SpringTestSupport { assertEquals("We don't have Donkeys, only Camels", e.getCause().getCause().getMessage()); } - int count = jdbc.queryForInt("select count(*) from books"); - assertEquals(0, jdbc.queryForInt("select count(*) from books where title = ?", "Donkey in Action")); + int count = jdbc.queryForObject("select count(*) from books", Integer.class); + assertEquals(new Integer(0), jdbc.queryForObject("select count(*) from books where title = ?", Integer.class, "Donkey in Action")); assertEquals("Number of books", 1, count); } @@ -108,8 +108,8 @@ public class MixedPropagationTransactedTest extends SpringTestSupport { assertEquals("We don't have Donkeys, only Camels", e.getCause().getCause().getMessage()); } - int count = jdbc.queryForInt("select count(*) from books"); - assertEquals(0, jdbc.queryForInt("select count(*) from books where title = ?", "Donkey in Action")); + int count = jdbc.queryForObject("select count(*) from books", Integer.class); + assertEquals(new Integer(0), jdbc.queryForObject("select count(*) from books where title = ?", Integer.class, "Donkey in Action")); assertEquals("Number of books", 1, count); } @@ -123,9 +123,9 @@ public class MixedPropagationTransactedTest extends SpringTestSupport { assertEquals("We don't have Donkeys, only Camels", e.getCause().getCause().getMessage()); } - int count = jdbc.queryForInt("select count(*) from books"); - assertEquals(1, jdbc.queryForInt("select count(*) from books where title = ?", "Tiger in Action")); - assertEquals(0, jdbc.queryForInt("select count(*) from books where title = ?", "Donkey in Action")); + int count = jdbc.queryForObject("select count(*) from books", Integer.class); + assertEquals(new Integer(1), jdbc.queryForObject("select count(*) from books where title = ?", Integer.class, "Tiger in Action")); + assertEquals(new Integer(0), jdbc.queryForObject("select count(*) from books where title = ?", Integer.class, "Donkey in Action")); // the tiger in action should be committed, but our 2nd route should rollback assertEquals("Number of books", 2, count); } http://git-wip-us.apache.org/repos/asf/camel/blob/d1cef6b4/components/camel-spring/src/test/java/org/apache/camel/spring/interceptor/MixedTransactionPropagationTest.java ---------------------------------------------------------------------- diff --git a/components/camel-spring/src/test/java/org/apache/camel/spring/interceptor/MixedTransactionPropagationTest.java b/components/camel-spring/src/test/java/org/apache/camel/spring/interceptor/MixedTransactionPropagationTest.java index 13e4874..4f9fcf2 100644 --- a/components/camel-spring/src/test/java/org/apache/camel/spring/interceptor/MixedTransactionPropagationTest.java +++ b/components/camel-spring/src/test/java/org/apache/camel/spring/interceptor/MixedTransactionPropagationTest.java @@ -50,7 +50,7 @@ public class MixedTransactionPropagationTest extends SpringTestSupport { public void testOkay() throws Exception { template.sendBody("direct:okay", "Hello World"); - int count = jdbc.queryForInt("select count(*) from books"); + int count = jdbc.queryForObject("select count(*) from books", Integer.class); assertEquals("Number of books", 3, count); } @@ -65,36 +65,36 @@ public class MixedTransactionPropagationTest extends SpringTestSupport { assertEquals("We don't have Donkeys, only Camels", e.getCause().getCause().getMessage()); } - int count = jdbc.queryForInt("select count(*) from books"); + int count = jdbc.queryForObject("select count(*) from books", Integer.class); assertEquals("Number of books", 1, count); } public void testMixedRollbackOnlyLast() throws Exception { template.sendBody("direct:mixed", "Hello World"); - int count = jdbc.queryForInt("select count(*) from books"); + int count = jdbc.queryForObject("select count(*) from books", Integer.class); assertEquals("Number of books", 3, count); // assert correct books in database - assertEquals(1, jdbc.queryForInt("select count(*) from books where title = 'Camel in Action'")); - assertEquals(1, jdbc.queryForInt("select count(*) from books where title = 'Tiger in Action'")); - assertEquals(1, jdbc.queryForInt("select count(*) from books where title = 'Elephant in Action'")); - assertEquals(0, jdbc.queryForInt("select count(*) from books where title = 'Lion in Action'")); - assertEquals(0, jdbc.queryForInt("select count(*) from books where title = 'Donkey in Action'")); + assertEquals(new Integer(1), jdbc.queryForObject("select count(*) from books where title = 'Camel in Action'", Integer.class)); + assertEquals(new Integer(1), jdbc.queryForObject("select count(*) from books where title = 'Tiger in Action'", Integer.class)); + assertEquals(new Integer(1), jdbc.queryForObject("select count(*) from books where title = 'Elephant in Action'", Integer.class)); + assertEquals(new Integer(0), jdbc.queryForObject("select count(*) from books where title = 'Lion in Action'", Integer.class)); + assertEquals(new Integer(0), jdbc.queryForObject("select count(*) from books where title = 'Donkey in Action'", Integer.class)); } public void testMixedCommit() throws Exception { template.sendBody("direct:mixed3", "Hello World"); - int count = jdbc.queryForInt("select count(*) from books"); + int count = jdbc.queryForObject("select count(*) from books", Integer.class); assertEquals("Number of books", 5, count); // assert correct books in database - assertEquals(1, jdbc.queryForInt("select count(*) from books where title = 'Camel in Action'")); - assertEquals(1, jdbc.queryForInt("select count(*) from books where title = 'Tiger in Action'")); - assertEquals(1, jdbc.queryForInt("select count(*) from books where title = 'Elephant in Action'")); - assertEquals(1, jdbc.queryForInt("select count(*) from books where title = 'Lion in Action'")); - assertEquals(1, jdbc.queryForInt("select count(*) from books where title = 'Crocodile in Action'")); + assertEquals(new Integer(1), jdbc.queryForObject("select count(*) from books where title = 'Camel in Action'", Integer.class)); + assertEquals(new Integer(1), jdbc.queryForObject("select count(*) from books where title = 'Tiger in Action'", Integer.class)); + assertEquals(new Integer(1), jdbc.queryForObject("select count(*) from books where title = 'Elephant in Action'", Integer.class)); + assertEquals(new Integer(1), jdbc.queryForObject("select count(*) from books where title = 'Lion in Action'", Integer.class)); + assertEquals(new Integer(1), jdbc.queryForObject("select count(*) from books where title = 'Crocodile in Action'", Integer.class)); } protected RouteBuilder createRouteBuilder() throws Exception { http://git-wip-us.apache.org/repos/asf/camel/blob/d1cef6b4/components/camel-spring/src/test/java/org/apache/camel/spring/interceptor/SpringTransactionalClientDataSourceTransactedTest.java ---------------------------------------------------------------------- diff --git a/components/camel-spring/src/test/java/org/apache/camel/spring/interceptor/SpringTransactionalClientDataSourceTransactedTest.java b/components/camel-spring/src/test/java/org/apache/camel/spring/interceptor/SpringTransactionalClientDataSourceTransactedTest.java index 9878daf..cd0d1d4 100644 --- a/components/camel-spring/src/test/java/org/apache/camel/spring/interceptor/SpringTransactionalClientDataSourceTransactedTest.java +++ b/components/camel-spring/src/test/java/org/apache/camel/spring/interceptor/SpringTransactionalClientDataSourceTransactedTest.java @@ -48,7 +48,7 @@ public class SpringTransactionalClientDataSourceTransactedTest extends SpringTes public void testTransactionSuccess() throws Exception { template.sendBody("direct:okay", "Hello World"); - int count = jdbc.queryForInt("select count(*) from books"); + int count = jdbc.queryForObject("select count(*) from books", Integer.class); assertEquals("Number of books", 3, count); } @@ -63,7 +63,7 @@ public class SpringTransactionalClientDataSourceTransactedTest extends SpringTes assertEquals("We don't have Donkeys, only Camels", e.getCause().getCause().getMessage()); } - int count = jdbc.queryForInt("select count(*) from books"); + int count = jdbc.queryForObject("select count(*) from books", Integer.class); assertEquals("Number of books", 1, count); } http://git-wip-us.apache.org/repos/asf/camel/blob/d1cef6b4/components/camel-spring/src/test/java/org/apache/camel/spring/interceptor/SpringTransactionalClientDataWithOnExceptionAndRollbackUsingTransactedTest.java ---------------------------------------------------------------------- diff --git a/components/camel-spring/src/test/java/org/apache/camel/spring/interceptor/SpringTransactionalClientDataWithOnExceptionAndRollbackUsingTransactedTest.java b/components/camel-spring/src/test/java/org/apache/camel/spring/interceptor/SpringTransactionalClientDataWithOnExceptionAndRollbackUsingTransactedTest.java index 349dce6..6a67913 100644 --- a/components/camel-spring/src/test/java/org/apache/camel/spring/interceptor/SpringTransactionalClientDataWithOnExceptionAndRollbackUsingTransactedTest.java +++ b/components/camel-spring/src/test/java/org/apache/camel/spring/interceptor/SpringTransactionalClientDataWithOnExceptionAndRollbackUsingTransactedTest.java @@ -34,7 +34,7 @@ public class SpringTransactionalClientDataWithOnExceptionAndRollbackUsingTransac assertMockEndpointsSatisfied(); - int count = jdbc.queryForInt("select count(*) from books"); + int count = jdbc.queryForObject("select count(*) from books", Integer.class); assertEquals("Number of books", 1, count); } http://git-wip-us.apache.org/repos/asf/camel/blob/d1cef6b4/components/camel-spring/src/test/java/org/apache/camel/spring/interceptor/TransactionalClientDataSourceAsyncTest.java ---------------------------------------------------------------------- diff --git a/components/camel-spring/src/test/java/org/apache/camel/spring/interceptor/TransactionalClientDataSourceAsyncTest.java b/components/camel-spring/src/test/java/org/apache/camel/spring/interceptor/TransactionalClientDataSourceAsyncTest.java index 641c498..b1d01f3 100644 --- a/components/camel-spring/src/test/java/org/apache/camel/spring/interceptor/TransactionalClientDataSourceAsyncTest.java +++ b/components/camel-spring/src/test/java/org/apache/camel/spring/interceptor/TransactionalClientDataSourceAsyncTest.java @@ -44,7 +44,7 @@ public class TransactionalClientDataSourceAsyncTest extends TransactionalClientD assertMockEndpointsSatisfied(); - int count = jdbc.queryForInt("select count(*) from books"); + int count = jdbc.queryForObject("select count(*) from books", Integer.class); assertEquals("Number of books", 1, count); } http://git-wip-us.apache.org/repos/asf/camel/blob/d1cef6b4/components/camel-spring/src/test/java/org/apache/camel/spring/interceptor/TransactionalClientDataSourceHandledTest.java ---------------------------------------------------------------------- diff --git a/components/camel-spring/src/test/java/org/apache/camel/spring/interceptor/TransactionalClientDataSourceHandledTest.java b/components/camel-spring/src/test/java/org/apache/camel/spring/interceptor/TransactionalClientDataSourceHandledTest.java index 97712d7..c32c38d 100644 --- a/components/camel-spring/src/test/java/org/apache/camel/spring/interceptor/TransactionalClientDataSourceHandledTest.java +++ b/components/camel-spring/src/test/java/org/apache/camel/spring/interceptor/TransactionalClientDataSourceHandledTest.java @@ -33,7 +33,7 @@ public class TransactionalClientDataSourceHandledTest extends TransactionalClien assertMockEndpointsSatisfied(); - int count = jdbc.queryForInt("select count(*) from books"); + int count = jdbc.queryForObject("select count(*) from books", Integer.class); // there should be 2 books as the first insert operation succeeded assertEquals("Number of books", 2, count); } http://git-wip-us.apache.org/repos/asf/camel/blob/d1cef6b4/components/camel-spring/src/test/java/org/apache/camel/spring/interceptor/TransactionalClientDataSourceMinimalConfigurationTest.java ---------------------------------------------------------------------- diff --git a/components/camel-spring/src/test/java/org/apache/camel/spring/interceptor/TransactionalClientDataSourceMinimalConfigurationTest.java b/components/camel-spring/src/test/java/org/apache/camel/spring/interceptor/TransactionalClientDataSourceMinimalConfigurationTest.java index 85e10bd..5447b61 100644 --- a/components/camel-spring/src/test/java/org/apache/camel/spring/interceptor/TransactionalClientDataSourceMinimalConfigurationTest.java +++ b/components/camel-spring/src/test/java/org/apache/camel/spring/interceptor/TransactionalClientDataSourceMinimalConfigurationTest.java @@ -48,7 +48,7 @@ public class TransactionalClientDataSourceMinimalConfigurationTest extends Sprin public void testTransactionSuccess() throws Exception { template.sendBody("direct:okay", "Hello World"); - int count = jdbc.queryForInt("select count(*) from books"); + int count = jdbc.queryForObject("select count(*) from books", Integer.class); assertEquals("Number of books", 3, count); } @@ -63,7 +63,7 @@ public class TransactionalClientDataSourceMinimalConfigurationTest extends Sprin assertEquals("We don't have Donkeys, only Camels", e.getCause().getCause().getMessage()); } - int count = jdbc.queryForInt("select count(*) from books"); + int count = jdbc.queryForObject("select count(*) from books", Integer.class); assertEquals("Number of books", 1, count); } http://git-wip-us.apache.org/repos/asf/camel/blob/d1cef6b4/components/camel-spring/src/test/java/org/apache/camel/spring/interceptor/TransactionalClientDataSourceMixedTransactedTest.java ---------------------------------------------------------------------- diff --git a/components/camel-spring/src/test/java/org/apache/camel/spring/interceptor/TransactionalClientDataSourceMixedTransactedTest.java b/components/camel-spring/src/test/java/org/apache/camel/spring/interceptor/TransactionalClientDataSourceMixedTransactedTest.java index 9e28633..b287f20 100644 --- a/components/camel-spring/src/test/java/org/apache/camel/spring/interceptor/TransactionalClientDataSourceMixedTransactedTest.java +++ b/components/camel-spring/src/test/java/org/apache/camel/spring/interceptor/TransactionalClientDataSourceMixedTransactedTest.java @@ -29,7 +29,7 @@ public class TransactionalClientDataSourceMixedTransactedTest extends Transactio // "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"); + int count = jdbc.queryForObject("select count(*) from books", Integer.class); // should get 2 books as the first operation will succeed and we are not transacted assertEquals("Number of books", 2, count); } http://git-wip-us.apache.org/repos/asf/camel/blob/d1cef6b4/components/camel-spring/src/test/java/org/apache/camel/spring/interceptor/TransactionalClientDataSourceNotTransactedTest.java ---------------------------------------------------------------------- diff --git a/components/camel-spring/src/test/java/org/apache/camel/spring/interceptor/TransactionalClientDataSourceNotTransactedTest.java b/components/camel-spring/src/test/java/org/apache/camel/spring/interceptor/TransactionalClientDataSourceNotTransactedTest.java index 30ea9d5..caa0689 100644 --- a/components/camel-spring/src/test/java/org/apache/camel/spring/interceptor/TransactionalClientDataSourceNotTransactedTest.java +++ b/components/camel-spring/src/test/java/org/apache/camel/spring/interceptor/TransactionalClientDataSourceNotTransactedTest.java @@ -35,7 +35,7 @@ public class TransactionalClientDataSourceNotTransactedTest extends Transactiona assertEquals("We don't have Donkeys, only Camels", e.getCause().getMessage()); } - int count = jdbc.queryForInt("select count(*) from books"); + int count = jdbc.queryForObject("select count(*) from books", Integer.class); // should get 2 books as the first operation will succeed and we are not transacted assertEquals("Number of books", 2, count); } http://git-wip-us.apache.org/repos/asf/camel/blob/d1cef6b4/components/camel-spring/src/test/java/org/apache/camel/spring/interceptor/TransactionalClientDataSourceOnExceptionRedeliveryTest.java ---------------------------------------------------------------------- diff --git a/components/camel-spring/src/test/java/org/apache/camel/spring/interceptor/TransactionalClientDataSourceOnExceptionRedeliveryTest.java b/components/camel-spring/src/test/java/org/apache/camel/spring/interceptor/TransactionalClientDataSourceOnExceptionRedeliveryTest.java index 6b9ddfa..96f7f11 100644 --- a/components/camel-spring/src/test/java/org/apache/camel/spring/interceptor/TransactionalClientDataSourceOnExceptionRedeliveryTest.java +++ b/components/camel-spring/src/test/java/org/apache/camel/spring/interceptor/TransactionalClientDataSourceOnExceptionRedeliveryTest.java @@ -34,7 +34,7 @@ public class TransactionalClientDataSourceOnExceptionRedeliveryTest extends Tran } }); - int count = jdbc.queryForInt("select count(*) from books"); + int count = jdbc.queryForObject("select count(*) from books", Integer.class); assertEquals("Number of books", 1, count); assertNotNull(out); http://git-wip-us.apache.org/repos/asf/camel/blob/d1cef6b4/components/camel-spring/src/test/java/org/apache/camel/spring/interceptor/TransactionalClientDataSourceRedeliveryTest.java ---------------------------------------------------------------------- diff --git a/components/camel-spring/src/test/java/org/apache/camel/spring/interceptor/TransactionalClientDataSourceRedeliveryTest.java b/components/camel-spring/src/test/java/org/apache/camel/spring/interceptor/TransactionalClientDataSourceRedeliveryTest.java index 4a65764..38838d6 100644 --- a/components/camel-spring/src/test/java/org/apache/camel/spring/interceptor/TransactionalClientDataSourceRedeliveryTest.java +++ b/components/camel-spring/src/test/java/org/apache/camel/spring/interceptor/TransactionalClientDataSourceRedeliveryTest.java @@ -34,7 +34,7 @@ public class TransactionalClientDataSourceRedeliveryTest extends TransactionalCl } }); - int count = jdbc.queryForInt("select count(*) from books"); + int count = jdbc.queryForObject("select count(*) from books", Integer.class); assertEquals("Number of books", 1, count); assertNotNull(out); http://git-wip-us.apache.org/repos/asf/camel/blob/d1cef6b4/components/camel-spring/src/test/java/org/apache/camel/spring/interceptor/TransactionalClientDataSourceTest.java ---------------------------------------------------------------------- diff --git a/components/camel-spring/src/test/java/org/apache/camel/spring/interceptor/TransactionalClientDataSourceTest.java b/components/camel-spring/src/test/java/org/apache/camel/spring/interceptor/TransactionalClientDataSourceTest.java index 6b0893a..a3d0c2d 100644 --- a/components/camel-spring/src/test/java/org/apache/camel/spring/interceptor/TransactionalClientDataSourceTest.java +++ b/components/camel-spring/src/test/java/org/apache/camel/spring/interceptor/TransactionalClientDataSourceTest.java @@ -30,7 +30,7 @@ public class TransactionalClientDataSourceTest extends TransactionClientDataSour public void testTransactionSuccess() throws Exception { template.sendBody("direct:okay", "Hello World"); - int count = jdbc.queryForInt("select count(*) from books"); + int count = jdbc.queryForObject("select count(*) from books", Integer.class); assertEquals("Number of books", 3, count); } // END SNIPPET: e3 @@ -47,7 +47,7 @@ public class TransactionalClientDataSourceTest extends TransactionClientDataSour assertEquals("We don't have Donkeys, only Camels", e.getCause().getCause().getMessage()); } - int count = jdbc.queryForInt("select count(*) from books"); + int count = jdbc.queryForObject("select count(*) from books", Integer.class); assertEquals("Number of books", 1, count); } // END SNIPPET: e4 http://git-wip-us.apache.org/repos/asf/camel/blob/d1cef6b4/components/camel-spring/src/test/java/org/apache/camel/spring/interceptor/TransactionalClientDataSourceTransactedWithFileOnExceptionTest.java ---------------------------------------------------------------------- diff --git a/components/camel-spring/src/test/java/org/apache/camel/spring/interceptor/TransactionalClientDataSourceTransactedWithFileOnExceptionTest.java b/components/camel-spring/src/test/java/org/apache/camel/spring/interceptor/TransactionalClientDataSourceTransactedWithFileOnExceptionTest.java index eb234c1..cd294cc 100644 --- a/components/camel-spring/src/test/java/org/apache/camel/spring/interceptor/TransactionalClientDataSourceTransactedWithFileOnExceptionTest.java +++ b/components/camel-spring/src/test/java/org/apache/camel/spring/interceptor/TransactionalClientDataSourceTransactedWithFileOnExceptionTest.java @@ -32,7 +32,7 @@ public class TransactionalClientDataSourceTransactedWithFileOnExceptionTest exte // wait for route to complete Thread.sleep(3000); - int count = jdbc.queryForInt("select count(*) from books"); + int count = jdbc.queryForObject("select count(*) from books", Integer.class); assertEquals("Number of books", 3, count); } @@ -49,7 +49,7 @@ public class TransactionalClientDataSourceTransactedWithFileOnExceptionTest exte Thread.sleep(3000); // should not be able to process the file so we still got 1 book as we did from the start - int count = jdbc.queryForInt("select count(*) from books"); + int count = jdbc.queryForObject("select count(*) from books", Integer.class); assertEquals("Number of books", 1, count); assertMockEndpointsSatisfied(); http://git-wip-us.apache.org/repos/asf/camel/blob/d1cef6b4/components/camel-spring/src/test/java/org/apache/camel/spring/interceptor/TransactionalClientDataSourceTransactedWithFileTest.java ---------------------------------------------------------------------- diff --git a/components/camel-spring/src/test/java/org/apache/camel/spring/interceptor/TransactionalClientDataSourceTransactedWithFileTest.java b/components/camel-spring/src/test/java/org/apache/camel/spring/interceptor/TransactionalClientDataSourceTransactedWithFileTest.java index 38120a1..71bd905 100644 --- a/components/camel-spring/src/test/java/org/apache/camel/spring/interceptor/TransactionalClientDataSourceTransactedWithFileTest.java +++ b/components/camel-spring/src/test/java/org/apache/camel/spring/interceptor/TransactionalClientDataSourceTransactedWithFileTest.java @@ -37,19 +37,18 @@ public class TransactionalClientDataSourceTransactedWithFileTest extends Transac // wait for route to complete Thread.sleep(3000); - int count = jdbc.queryForInt("select count(*) from books"); + int count = jdbc.queryForObject("select count(*) from books", Integer.class); assertEquals("Number of books", 3, count); } - // TODO: disabled as it can fail for no apparent reason on another box - public void xxxtestTransactionRollback() throws Exception { + public void testTransactionRollback() throws Exception { template.sendBodyAndHeader("file://target/transacted/fail", "Hello World", Exchange.FILE_NAME, "fail.txt"); // wait for route to complete Thread.sleep(3000); // should not be able to process the file so we still got 1 book as we did from the start - int count = jdbc.queryForInt("select count(*) from books"); + int count = jdbc.queryForObject("select count(*) from books", Integer.class); assertEquals("Number of books", 1, count); } http://git-wip-us.apache.org/repos/asf/camel/blob/d1cef6b4/components/camel-spring/src/test/java/org/apache/camel/spring/interceptor/TransactionalClientDataSourceWithOnExceptionHandledAndRollbackTest.java ---------------------------------------------------------------------- diff --git a/components/camel-spring/src/test/java/org/apache/camel/spring/interceptor/TransactionalClientDataSourceWithOnExceptionHandledAndRollbackTest.java b/components/camel-spring/src/test/java/org/apache/camel/spring/interceptor/TransactionalClientDataSourceWithOnExceptionHandledAndRollbackTest.java index 94c9568..0b78522 100644 --- a/components/camel-spring/src/test/java/org/apache/camel/spring/interceptor/TransactionalClientDataSourceWithOnExceptionHandledAndRollbackTest.java +++ b/components/camel-spring/src/test/java/org/apache/camel/spring/interceptor/TransactionalClientDataSourceWithOnExceptionHandledAndRollbackTest.java @@ -40,7 +40,7 @@ public class TransactionalClientDataSourceWithOnExceptionHandledAndRollbackTest assertMockEndpointsSatisfied(); - int count = jdbc.queryForInt("select count(*) from books"); + int count = jdbc.queryForObject("select count(*) from books", Integer.class); assertEquals("Number of books", 1, count); } http://git-wip-us.apache.org/repos/asf/camel/blob/d1cef6b4/components/camel-spring/src/test/java/org/apache/camel/spring/interceptor/TransactionalClientDataSourceWithOnExceptionHandledAndRollbackUsingTransactedTest.java ---------------------------------------------------------------------- diff --git a/components/camel-spring/src/test/java/org/apache/camel/spring/interceptor/TransactionalClientDataSourceWithOnExceptionHandledAndRollbackUsingTransactedTest.java b/components/camel-spring/src/test/java/org/apache/camel/spring/interceptor/TransactionalClientDataSourceWithOnExceptionHandledAndRollbackUsingTransactedTest.java index d209e53..f688811 100644 --- a/components/camel-spring/src/test/java/org/apache/camel/spring/interceptor/TransactionalClientDataSourceWithOnExceptionHandledAndRollbackUsingTransactedTest.java +++ b/components/camel-spring/src/test/java/org/apache/camel/spring/interceptor/TransactionalClientDataSourceWithOnExceptionHandledAndRollbackUsingTransactedTest.java @@ -34,7 +34,7 @@ public class TransactionalClientDataSourceWithOnExceptionHandledAndRollbackUsing assertMockEndpointsSatisfied(); - int count = jdbc.queryForInt("select count(*) from books"); + int count = jdbc.queryForObject("select count(*) from books", Integer.class); assertEquals("Number of books", 1, count); } http://git-wip-us.apache.org/repos/asf/camel/blob/d1cef6b4/components/camel-spring/src/test/java/org/apache/camel/spring/interceptor/TransactionalClientDataSourceWithOnExceptionRollbackTest.java ---------------------------------------------------------------------- diff --git a/components/camel-spring/src/test/java/org/apache/camel/spring/interceptor/TransactionalClientDataSourceWithOnExceptionRollbackTest.java b/components/camel-spring/src/test/java/org/apache/camel/spring/interceptor/TransactionalClientDataSourceWithOnExceptionRollbackTest.java index a72cd2e..00b09d9 100644 --- a/components/camel-spring/src/test/java/org/apache/camel/spring/interceptor/TransactionalClientDataSourceWithOnExceptionRollbackTest.java +++ b/components/camel-spring/src/test/java/org/apache/camel/spring/interceptor/TransactionalClientDataSourceWithOnExceptionRollbackTest.java @@ -44,7 +44,7 @@ public class TransactionalClientDataSourceWithOnExceptionRollbackTest extends Tr assertMockEndpointsSatisfied(); - int count = jdbc.queryForInt("select count(*) from books"); + int count = jdbc.queryForObject("select count(*) from books", Integer.class); assertEquals("Number of books", 1, count); } http://git-wip-us.apache.org/repos/asf/camel/blob/d1cef6b4/components/camel-spring/src/test/java/org/apache/camel/spring/interceptor/TransactionalClientDataSourceWithOnExceptionTest.java ---------------------------------------------------------------------- diff --git a/components/camel-spring/src/test/java/org/apache/camel/spring/interceptor/TransactionalClientDataSourceWithOnExceptionTest.java b/components/camel-spring/src/test/java/org/apache/camel/spring/interceptor/TransactionalClientDataSourceWithOnExceptionTest.java index e9e89ad..8df3fe0 100644 --- a/components/camel-spring/src/test/java/org/apache/camel/spring/interceptor/TransactionalClientDataSourceWithOnExceptionTest.java +++ b/components/camel-spring/src/test/java/org/apache/camel/spring/interceptor/TransactionalClientDataSourceWithOnExceptionTest.java @@ -43,7 +43,7 @@ public class TransactionalClientDataSourceWithOnExceptionTest extends Transactio assertMockEndpointsSatisfied(); - int count = jdbc.queryForInt("select count(*) from books"); + int count = jdbc.queryForObject("select count(*) from books", Integer.class); assertEquals("Number of books", 1, count); } http://git-wip-us.apache.org/repos/asf/camel/blob/d1cef6b4/components/camel-spring/src/test/java/org/apache/camel/spring/interceptor/TransactionalClientWithRollbackTest.java ---------------------------------------------------------------------- diff --git a/components/camel-spring/src/test/java/org/apache/camel/spring/interceptor/TransactionalClientWithRollbackTest.java b/components/camel-spring/src/test/java/org/apache/camel/spring/interceptor/TransactionalClientWithRollbackTest.java index 392a497..6aaabec 100644 --- a/components/camel-spring/src/test/java/org/apache/camel/spring/interceptor/TransactionalClientWithRollbackTest.java +++ b/components/camel-spring/src/test/java/org/apache/camel/spring/interceptor/TransactionalClientWithRollbackTest.java @@ -53,7 +53,7 @@ public class TransactionalClientWithRollbackTest extends SpringTestSupport { public void testTransactionSuccess() throws Exception { template.sendBody("direct:okay", "Hello World"); - int count = jdbc.queryForInt("select count(*) from books"); + int count = jdbc.queryForObject("select count(*) from books", Integer.class); assertEquals("Number of books", 3, count); } @@ -66,7 +66,7 @@ public class TransactionalClientWithRollbackTest extends SpringTestSupport { assertTrue(e.getCause().getCause() instanceof RollbackExchangeException); } - int count = jdbc.queryForInt("select count(*) from books"); + int count = jdbc.queryForObject("select count(*) from books", Integer.class); assertEquals("Number of books", 1, count); } http://git-wip-us.apache.org/repos/asf/camel/blob/d1cef6b4/components/camel-spring/src/test/java/org/apache/camel/spring/issues/SpringTransactionErrorHandlerAndContextScopedOnExceptionIssueTest.java ---------------------------------------------------------------------- diff --git a/components/camel-spring/src/test/java/org/apache/camel/spring/issues/SpringTransactionErrorHandlerAndContextScopedOnExceptionIssueTest.java b/components/camel-spring/src/test/java/org/apache/camel/spring/issues/SpringTransactionErrorHandlerAndContextScopedOnExceptionIssueTest.java index ad98c1d..b65a1a0 100644 --- a/components/camel-spring/src/test/java/org/apache/camel/spring/issues/SpringTransactionErrorHandlerAndContextScopedOnExceptionIssueTest.java +++ b/components/camel-spring/src/test/java/org/apache/camel/spring/issues/SpringTransactionErrorHandlerAndContextScopedOnExceptionIssueTest.java @@ -45,7 +45,7 @@ public class SpringTransactionErrorHandlerAndContextScopedOnExceptionIssueTest e } public void testSpringTXOnExceptionIssueCommit() throws Exception { - int count = jdbc.queryForInt("select count(*) from books"); + int count = jdbc.queryForObject("select count(*) from books", Integer.class); assertEquals("Number of books", 1, count); // we succeeded so no message to on exception @@ -57,12 +57,12 @@ public class SpringTransactionErrorHandlerAndContextScopedOnExceptionIssueTest e assertMockEndpointsSatisfied(); // we did commit so there should be 2 books - count = jdbc.queryForInt("select count(*) from books"); + count = jdbc.queryForObject("select count(*) from books", Integer.class); assertEquals("Number of books", 2, count); } public void testSpringTXOnExceptionIssueRollback() throws Exception { - int count = jdbc.queryForInt("select count(*) from books"); + int count = jdbc.queryForObject("select count(*) from books", Integer.class); assertEquals("Number of books", 1, count); getMockEndpoint("mock:onException").expectedMessageCount(1); @@ -81,7 +81,7 @@ public class SpringTransactionErrorHandlerAndContextScopedOnExceptionIssueTest e assertMockEndpointsSatisfied(); // we did rollback so there should be 1 books - count = jdbc.queryForInt("select count(*) from books"); + count = jdbc.queryForObject("select count(*) from books", Integer.class); assertEquals("Number of books", 1, count); } http://git-wip-us.apache.org/repos/asf/camel/blob/d1cef6b4/components/camel-sql/src/main/java/org/apache/camel/processor/aggregate/jdbc/JdbcAggregationRepository.java ---------------------------------------------------------------------- diff --git a/components/camel-sql/src/main/java/org/apache/camel/processor/aggregate/jdbc/JdbcAggregationRepository.java b/components/camel-sql/src/main/java/org/apache/camel/processor/aggregate/jdbc/JdbcAggregationRepository.java index 69c0346..c5facbe 100644 --- a/components/camel-sql/src/main/java/org/apache/camel/processor/aggregate/jdbc/JdbcAggregationRepository.java +++ b/components/camel-sql/src/main/java/org/apache/camel/processor/aggregate/jdbc/JdbcAggregationRepository.java @@ -139,8 +139,8 @@ public class JdbcAggregationRepository extends ServiceSupport implements Recover try { LOG.debug("Adding exchange with key: [{}]", key); - boolean present = jdbcTemplate.queryForInt( - "SELECT COUNT(*) FROM " + getRepositoryName() + " WHERE " + ID + " = ?", key) != 0; + boolean present = jdbcTemplate.queryForObject( + "SELECT COUNT(*) FROM " + getRepositoryName() + " WHERE " + ID + " = ?", Integer.class, key) != 0; // Recover existing exchange with that ID if (isReturnOldExchange() && present) { http://git-wip-us.apache.org/repos/asf/camel/blob/d1cef6b4/components/camel-sql/src/main/java/org/apache/camel/processor/idempotent/jdbc/JdbcMessageIdRepository.java ---------------------------------------------------------------------- diff --git a/components/camel-sql/src/main/java/org/apache/camel/processor/idempotent/jdbc/JdbcMessageIdRepository.java b/components/camel-sql/src/main/java/org/apache/camel/processor/idempotent/jdbc/JdbcMessageIdRepository.java index f87ac62..3aec5e8 100644 --- a/components/camel-sql/src/main/java/org/apache/camel/processor/idempotent/jdbc/JdbcMessageIdRepository.java +++ b/components/camel-sql/src/main/java/org/apache/camel/processor/idempotent/jdbc/JdbcMessageIdRepository.java @@ -86,7 +86,7 @@ public class JdbcMessageIdRepository extends AbstractJdbcMessageIdRepository<Str @Override protected int queryForInt(String key) { - return jdbcTemplate.queryForInt(queryString, processorName, key); + return jdbcTemplate.queryForObject(queryString, Integer.class, processorName, key); } @Override http://git-wip-us.apache.org/repos/asf/camel/blob/d1cef6b4/components/camel-sql/src/test/java/org/apache/camel/component/sql/SqlConsumerDeleteBatchCompleteTest.java ---------------------------------------------------------------------- diff --git a/components/camel-sql/src/test/java/org/apache/camel/component/sql/SqlConsumerDeleteBatchCompleteTest.java b/components/camel-sql/src/test/java/org/apache/camel/component/sql/SqlConsumerDeleteBatchCompleteTest.java index 8496903..9b4c720 100644 --- a/components/camel-sql/src/test/java/org/apache/camel/component/sql/SqlConsumerDeleteBatchCompleteTest.java +++ b/components/camel-sql/src/test/java/org/apache/camel/component/sql/SqlConsumerDeleteBatchCompleteTest.java @@ -63,12 +63,12 @@ public class SqlConsumerDeleteBatchCompleteTest extends CamelTestSupport { for (int i = 0; i < 5; i++) { // give it a little tine to delete Thread.sleep(1000); - int rows = jdbcTemplate.queryForInt("select count(*) from projects"); + int rows = jdbcTemplate.queryForObject("select count(*) from projects", Integer.class); if (rows == 0) { break; } } - assertEquals("Should have deleted all 3 rows", 0, jdbcTemplate.queryForInt("select count(*) from projects")); + assertEquals("Should have deleted all 3 rows", new Integer(0), jdbcTemplate.queryForObject("select count(*) from projects", Integer.class)); } @Override http://git-wip-us.apache.org/repos/asf/camel/blob/d1cef6b4/components/camel-sql/src/test/java/org/apache/camel/component/sql/SqlConsumerDeleteFailedTest.java ---------------------------------------------------------------------- diff --git a/components/camel-sql/src/test/java/org/apache/camel/component/sql/SqlConsumerDeleteFailedTest.java b/components/camel-sql/src/test/java/org/apache/camel/component/sql/SqlConsumerDeleteFailedTest.java index 778f338..6798145 100644 --- a/components/camel-sql/src/test/java/org/apache/camel/component/sql/SqlConsumerDeleteFailedTest.java +++ b/components/camel-sql/src/test/java/org/apache/camel/component/sql/SqlConsumerDeleteFailedTest.java @@ -75,7 +75,7 @@ public class SqlConsumerDeleteFailedTest extends CamelTestSupport { // give it a little tine to delete Thread.sleep(2000); - assertEquals("Should have deleted 2 rows", 1, jdbcTemplate.queryForInt("select count(*) from projects")); + assertEquals("Should have deleted 2 rows", new Integer(1), jdbcTemplate.queryForObject("select count(*) from projects", Integer.class)); assertEquals("Should be AMQ project that is BAD", "AMQ", jdbcTemplate.queryForObject("select PROJECT from projects where license = 'BAD'", String.class)); } http://git-wip-us.apache.org/repos/asf/camel/blob/d1cef6b4/components/camel-sql/src/test/java/org/apache/camel/component/sql/SqlConsumerDeleteTest.java ---------------------------------------------------------------------- diff --git a/components/camel-sql/src/test/java/org/apache/camel/component/sql/SqlConsumerDeleteTest.java b/components/camel-sql/src/test/java/org/apache/camel/component/sql/SqlConsumerDeleteTest.java index e111362..3213556 100644 --- a/components/camel-sql/src/test/java/org/apache/camel/component/sql/SqlConsumerDeleteTest.java +++ b/components/camel-sql/src/test/java/org/apache/camel/component/sql/SqlConsumerDeleteTest.java @@ -77,12 +77,12 @@ public class SqlConsumerDeleteTest extends CamelTestSupport { for (int i = 0; i < 5; i++) { // give it a little tine to delete Thread.sleep(1000); - int rows = jdbcTemplate.queryForInt("select count(*) from projects"); + int rows = jdbcTemplate.queryForObject("select count(*) from projects", Integer.class); if (rows == 0) { break; } } - assertEquals("Should have deleted all 3 rows", 0, jdbcTemplate.queryForInt("select count(*) from projects")); + assertEquals("Should have deleted all 3 rows", new Integer(0), jdbcTemplate.queryForObject("select count(*) from projects", Integer.class)); } @Override http://git-wip-us.apache.org/repos/asf/camel/blob/d1cef6b4/components/camel-sql/src/test/java/org/apache/camel/component/sql/SqlConsumerDeleteTransformTest.java ---------------------------------------------------------------------- diff --git a/components/camel-sql/src/test/java/org/apache/camel/component/sql/SqlConsumerDeleteTransformTest.java b/components/camel-sql/src/test/java/org/apache/camel/component/sql/SqlConsumerDeleteTransformTest.java index 058f73f..2660984 100644 --- a/components/camel-sql/src/test/java/org/apache/camel/component/sql/SqlConsumerDeleteTransformTest.java +++ b/components/camel-sql/src/test/java/org/apache/camel/component/sql/SqlConsumerDeleteTransformTest.java @@ -63,12 +63,12 @@ public class SqlConsumerDeleteTransformTest extends CamelTestSupport { for (int i = 0; i < 5; i++) { // give it a little tine to delete Thread.sleep(1000); - int rows = jdbcTemplate.queryForInt("select count(*) from projects"); + int rows = jdbcTemplate.queryForObject("select count(*) from projects", Integer.class); if (rows == 0) { break; } } - assertEquals("Should have deleted all 3 rows", 0, jdbcTemplate.queryForInt("select count(*) from projects")); + assertEquals("Should have deleted all 3 rows", new Integer(0), jdbcTemplate.queryForObject("select count(*) from projects", Integer.class)); } @Override http://git-wip-us.apache.org/repos/asf/camel/blob/d1cef6b4/components/camel-sql/src/test/java/org/apache/camel/component/sql/SqlProducerJSONTest.java ---------------------------------------------------------------------- diff --git a/components/camel-sql/src/test/java/org/apache/camel/component/sql/SqlProducerJSONTest.java b/components/camel-sql/src/test/java/org/apache/camel/component/sql/SqlProducerJSONTest.java index 8c8ef3a..5a7ecf1 100755 --- a/components/camel-sql/src/test/java/org/apache/camel/component/sql/SqlProducerJSONTest.java +++ b/components/camel-sql/src/test/java/org/apache/camel/component/sql/SqlProducerJSONTest.java @@ -65,7 +65,7 @@ public class SqlProducerJSONTest extends CamelTestSupport { mock.assertIsSatisfied(); - assertEquals(4, jdbcTemplate.queryForInt("select count(*) from projects")); + assertEquals(new Integer(4), jdbcTemplate.queryForObject("select count(*) from projects", Integer.class)); } @Override http://git-wip-us.apache.org/repos/asf/camel/blob/d1cef6b4/components/camel-sql/src/test/java/org/apache/camel/component/sql/SqlProducerSeparatorTest.java ---------------------------------------------------------------------- diff --git a/components/camel-sql/src/test/java/org/apache/camel/component/sql/SqlProducerSeparatorTest.java b/components/camel-sql/src/test/java/org/apache/camel/component/sql/SqlProducerSeparatorTest.java index 3182cd1..11936d8 100755 --- a/components/camel-sql/src/test/java/org/apache/camel/component/sql/SqlProducerSeparatorTest.java +++ b/components/camel-sql/src/test/java/org/apache/camel/component/sql/SqlProducerSeparatorTest.java @@ -61,7 +61,7 @@ public class SqlProducerSeparatorTest extends CamelTestSupport { mock.assertIsSatisfied(); - assertEquals(4, jdbcTemplate.queryForInt("select count(*) from projects")); + assertEquals(new Integer(4), jdbcTemplate.queryForObject("select count(*) from projects", Integer.class)); } @Override http://git-wip-us.apache.org/repos/asf/camel/blob/d1cef6b4/components/camel-sql/src/test/java/org/apache/camel/component/sql/SqlRouteTest.java ---------------------------------------------------------------------- diff --git a/components/camel-sql/src/test/java/org/apache/camel/component/sql/SqlRouteTest.java b/components/camel-sql/src/test/java/org/apache/camel/component/sql/SqlRouteTest.java index 10a4aa9..33e32ab 100755 --- a/components/camel-sql/src/test/java/org/apache/camel/component/sql/SqlRouteTest.java +++ b/components/camel-sql/src/test/java/org/apache/camel/component/sql/SqlRouteTest.java @@ -233,8 +233,8 @@ public class SqlRouteTest extends CamelTestSupport { } catch (RuntimeCamelException e) { assertTrue(e.getCause() instanceof UncategorizedSQLException); } - assertEquals(0, jdbcTemplate.queryForInt("select count(*) from projects where id = 9")); - assertEquals(0, jdbcTemplate.queryForInt("select count(*) from projects where id = 10")); + assertEquals(new Integer(0), jdbcTemplate.queryForObject("select count(*) from projects where id = 9", Integer.class)); + assertEquals(new Integer(0), jdbcTemplate.queryForObject("select count(*) from projects where id = 10", Integer.class)); } @Test @@ -247,8 +247,8 @@ public class SqlRouteTest extends CamelTestSupport { } catch (RuntimeCamelException e) { assertTrue(e.getCause() instanceof UncategorizedSQLException); } - assertEquals(0, jdbcTemplate.queryForInt("select count(*) from projects where id = 9")); - assertEquals(0, jdbcTemplate.queryForInt("select count(*) from projects where id = 10")); + assertEquals(new Integer(0), jdbcTemplate.queryForObject("select count(*) from projects where id = 9", Integer.class)); + assertEquals(new Integer(0), jdbcTemplate.queryForObject("select count(*) from projects where id = 10", Integer.class)); } @Before http://git-wip-us.apache.org/repos/asf/camel/blob/d1cef6b4/components/camel-sql/src/test/java/org/apache/camel/component/sql/SqlTransactedRouteTest.java ---------------------------------------------------------------------- diff --git a/components/camel-sql/src/test/java/org/apache/camel/component/sql/SqlTransactedRouteTest.java b/components/camel-sql/src/test/java/org/apache/camel/component/sql/SqlTransactedRouteTest.java index 0b485a4..d1b83ef 100644 --- a/components/camel-sql/src/test/java/org/apache/camel/component/sql/SqlTransactedRouteTest.java +++ b/components/camel-sql/src/test/java/org/apache/camel/component/sql/SqlTransactedRouteTest.java @@ -104,7 +104,7 @@ public class SqlTransactedRouteTest extends CamelTestSupport { assertFalse(exchange.isFailed()); - long count = jdbc.queryForLong("select count(*) from customer"); + long count = jdbc.queryForObject("select count(*) from customer", Long.class); assertEquals(2, count); Map<String, Object> map = jdbc.queryForMap("select * from customer where id = 'cust1'"); @@ -144,7 +144,7 @@ public class SqlTransactedRouteTest extends CamelTestSupport { assertTrue(exchange.isFailed()); - long count = jdbc.queryForLong("select count(*) from customer"); + long count = jdbc.queryForObject("select count(*) from customer", Long.class); assertEquals(0, count); } @@ -173,7 +173,7 @@ public class SqlTransactedRouteTest extends CamelTestSupport { assertTrue(exchange.isFailed()); - long count = jdbc.queryForLong("select count(*) from customer"); + long count = jdbc.queryForObject("select count(*) from customer", Long.class); assertEquals(0, count); } } \ No newline at end of file http://git-wip-us.apache.org/repos/asf/camel/blob/d1cef6b4/tests/camel-itest/src/test/java/org/apache/camel/itest/idempotent/JdbcIdempotentRepository.java ---------------------------------------------------------------------- diff --git a/tests/camel-itest/src/test/java/org/apache/camel/itest/idempotent/JdbcIdempotentRepository.java b/tests/camel-itest/src/test/java/org/apache/camel/itest/idempotent/JdbcIdempotentRepository.java index 210f8c2..c917ff0 100644 --- a/tests/camel-itest/src/test/java/org/apache/camel/itest/idempotent/JdbcIdempotentRepository.java +++ b/tests/camel-itest/src/test/java/org/apache/camel/itest/idempotent/JdbcIdempotentRepository.java @@ -43,7 +43,7 @@ public class JdbcIdempotentRepository implements IdempotentRepository<String> { } public boolean contains(String key) { - int numMatches = jdbc.queryForInt("SELECT count(0) FROM ProcessedPayments where paymentIdentifier = ?", key); + int numMatches = jdbc.queryForObject("SELECT count(0) FROM ProcessedPayments where paymentIdentifier = ?", Integer.class, key); return numMatches > 0; } @@ -53,7 +53,6 @@ public class JdbcIdempotentRepository implements IdempotentRepository<String> { } public boolean confirm(String key) { - // noop return true; }
