This is an automated email from the ASF dual-hosted git repository. orpiske pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/camel.git
commit 5a8a7fd7173adfb6026662f693f1f457353ea911 Author: Otavio Rodolfo Piske <[email protected]> AuthorDate: Tue Mar 8 12:39:46 2022 +0100 CAMEL-17763: cleaned up unused exceptions in camel-mongodb --- .../mongodb/MongoDbEndpointClientTest.java | 6 ++-- .../mongodb/MongoDbEndpointHostsTest.java | 4 +-- .../integration/MongoDbAggregateOperationIT.java | 4 +-- .../integration/MongoDbBigDecimalConverterIT.java | 2 +- .../integration/MongoDbBulkWriteOperationIT.java | 8 ++--- .../integration/MongoDbConnectionBeansIT.java | 2 +- .../mongodb/integration/MongoDbConversionsIT.java | 8 ++--- .../MongoDbCredentialsFromUriConnectionIT.java | 4 +-- .../mongodb/integration/MongoDbDynamicityIT.java | 2 +- .../integration/MongoDbExceptionHandlingIT.java | 8 ++--- .../integration/MongoDbFindOperationIT.java | 22 ++++++------ .../integration/MongoDbHeaderHandlingIT.java | 10 +++--- .../mongodb/integration/MongoDbIndexIT.java | 2 +- .../mongodb/integration/MongoDbInsertBatchIT.java | 2 +- .../mongodb/integration/MongoDbOperationsIT.java | 40 +++++++++++----------- .../mongodb/integration/MongoDbOutputTypeIT.java | 6 ++-- .../integration/MongoDbSpringDslOperationsIT.java | 4 +-- .../mongodb/integration/MongoDbStopEndpointIT.java | 4 +-- .../MongoDbTailableCursorConsumerIT.java | 2 +- .../meta/integration/MongoDbMetaExtensionIT.java | 2 +- .../integration/MongoDbIdempotentRepositoryIT.java | 14 ++++---- 21 files changed, 78 insertions(+), 78 deletions(-) diff --git a/components/camel-mongodb/src/test/java/org/apache/camel/component/mongodb/MongoDbEndpointClientTest.java b/components/camel-mongodb/src/test/java/org/apache/camel/component/mongodb/MongoDbEndpointClientTest.java index abff7ff..befd579 100644 --- a/components/camel-mongodb/src/test/java/org/apache/camel/component/mongodb/MongoDbEndpointClientTest.java +++ b/components/camel-mongodb/src/test/java/org/apache/camel/component/mongodb/MongoDbEndpointClientTest.java @@ -27,7 +27,7 @@ import static org.junit.jupiter.api.Assertions.*; class MongoDbEndpointClientTest extends CamelTestSupport { @Override - protected void bindToRegistry(Registry registry) throws Exception { + protected void bindToRegistry(Registry registry) { registry.bind("mongoClient", MongoClients.create("mongodb://localhost")); } @@ -44,10 +44,10 @@ class MongoDbEndpointClientTest extends CamelTestSupport { } @Override - protected RouteBuilder createRouteBuilder() throws Exception { + protected RouteBuilder createRouteBuilder() { return new RouteBuilder() { @Override - public void configure() throws Exception { + public void configure() { from("direct:dbFromBean").to("mongodb:mongoClient?database=test&collection=test&operation=findAll"); } }; diff --git a/components/camel-mongodb/src/test/java/org/apache/camel/component/mongodb/MongoDbEndpointHostsTest.java b/components/camel-mongodb/src/test/java/org/apache/camel/component/mongodb/MongoDbEndpointHostsTest.java index ac07211..35b9927 100644 --- a/components/camel-mongodb/src/test/java/org/apache/camel/component/mongodb/MongoDbEndpointHostsTest.java +++ b/components/camel-mongodb/src/test/java/org/apache/camel/component/mongodb/MongoDbEndpointHostsTest.java @@ -37,10 +37,10 @@ class MongoDbEndpointHostsTest extends CamelTestSupport { } @Override - protected RouteBuilder createRouteBuilder() throws Exception { + protected RouteBuilder createRouteBuilder() { return new RouteBuilder() { @Override - public void configure() throws Exception { + public void configure() { from("direct:dbFromHost").to("mongodb:dummy?hosts=localhost&database=test&collection=test&operation=findAll"); } }; diff --git a/components/camel-mongodb/src/test/java/org/apache/camel/component/mongodb/integration/MongoDbAggregateOperationIT.java b/components/camel-mongodb/src/test/java/org/apache/camel/component/mongodb/integration/MongoDbAggregateOperationIT.java index dcd9e97..9a8b0b33 100644 --- a/components/camel-mongodb/src/test/java/org/apache/camel/component/mongodb/integration/MongoDbAggregateOperationIT.java +++ b/components/camel-mongodb/src/test/java/org/apache/camel/component/mongodb/integration/MongoDbAggregateOperationIT.java @@ -34,7 +34,7 @@ import static org.junit.jupiter.api.Assertions.assertTrue; public class MongoDbAggregateOperationIT extends AbstractMongoDbITSupport { @Test - public void testAggregate() throws Exception { + public void testAggregate() { // Test that the collection has 0 documents in it assertEquals(0, testCollection.countDocuments()); pumpDataIntoTestCollection(); @@ -111,7 +111,7 @@ public class MongoDbAggregateOperationIT extends AbstractMongoDbITSupport { } @Override - protected RouteBuilder createRouteBuilder() throws Exception { + protected RouteBuilder createRouteBuilder() { return new RouteBuilder() { public void configure() { from("direct:aggregate") diff --git a/components/camel-mongodb/src/test/java/org/apache/camel/component/mongodb/integration/MongoDbBigDecimalConverterIT.java b/components/camel-mongodb/src/test/java/org/apache/camel/component/mongodb/integration/MongoDbBigDecimalConverterIT.java index 0e10c5d..6cad896 100644 --- a/components/camel-mongodb/src/test/java/org/apache/camel/component/mongodb/integration/MongoDbBigDecimalConverterIT.java +++ b/components/camel-mongodb/src/test/java/org/apache/camel/component/mongodb/integration/MongoDbBigDecimalConverterIT.java @@ -53,7 +53,7 @@ public class MongoDbBigDecimalConverterIT extends AbstractMongoDbITSupport { } @Override - protected RouteBuilder createRouteBuilder() throws Exception { + protected RouteBuilder createRouteBuilder() { return new RouteBuilder() { public void configure() { from("direct:insert") diff --git a/components/camel-mongodb/src/test/java/org/apache/camel/component/mongodb/integration/MongoDbBulkWriteOperationIT.java b/components/camel-mongodb/src/test/java/org/apache/camel/component/mongodb/integration/MongoDbBulkWriteOperationIT.java index 0bb1a65..7c95993 100644 --- a/components/camel-mongodb/src/test/java/org/apache/camel/component/mongodb/integration/MongoDbBulkWriteOperationIT.java +++ b/components/camel-mongodb/src/test/java/org/apache/camel/component/mongodb/integration/MongoDbBulkWriteOperationIT.java @@ -40,7 +40,7 @@ import static org.junit.jupiter.api.Assertions.fail; public class MongoDbBulkWriteOperationIT extends AbstractMongoDbITSupport { @Test - public void testBulkWrite() throws Exception { + public void testBulkWrite() { // Test that the collection has 0 documents in it assertEquals(0, testCollection.countDocuments()); pumpDataIntoTestCollection(); @@ -69,7 +69,7 @@ public class MongoDbBulkWriteOperationIT extends AbstractMongoDbITSupport { } @Test - public void testOrderedBulkWriteWithError() throws Exception { + public void testOrderedBulkWriteWithError() { // Test that the collection has 0 documents in it assertEquals(0, testCollection.countDocuments()); pumpDataIntoTestCollection(); @@ -94,7 +94,7 @@ public class MongoDbBulkWriteOperationIT extends AbstractMongoDbITSupport { } @Test - public void testUnorderedBulkWriteWithError() throws Exception { + public void testUnorderedBulkWriteWithError() { // Test that the collection has 0 documents in it assertEquals(0, testCollection.countDocuments()); pumpDataIntoTestCollection(); @@ -118,7 +118,7 @@ public class MongoDbBulkWriteOperationIT extends AbstractMongoDbITSupport { } @Override - protected RouteBuilder createRouteBuilder() throws Exception { + protected RouteBuilder createRouteBuilder() { return new RouteBuilder() { public void configure() { from("direct:bulkWrite").to( diff --git a/components/camel-mongodb/src/test/java/org/apache/camel/component/mongodb/integration/MongoDbConnectionBeansIT.java b/components/camel-mongodb/src/test/java/org/apache/camel/component/mongodb/integration/MongoDbConnectionBeansIT.java index 5a10501..0fca614 100644 --- a/components/camel-mongodb/src/test/java/org/apache/camel/component/mongodb/integration/MongoDbConnectionBeansIT.java +++ b/components/camel-mongodb/src/test/java/org/apache/camel/component/mongodb/integration/MongoDbConnectionBeansIT.java @@ -77,7 +77,7 @@ public class MongoDbConnectionBeansIT extends AbstractMongoDbITSupport { } @Test - public void checkConnectionOnComponent() throws Exception { + public void checkConnectionOnComponent() { Endpoint endpoint = context.getEndpoint("mongodb:justARouteName"); assertIsInstanceOf(MongoDbEndpoint.class, endpoint); diff --git a/components/camel-mongodb/src/test/java/org/apache/camel/component/mongodb/integration/MongoDbConversionsIT.java b/components/camel-mongodb/src/test/java/org/apache/camel/component/mongodb/integration/MongoDbConversionsIT.java index 7a39f20..1dab32f 100644 --- a/components/camel-mongodb/src/test/java/org/apache/camel/component/mongodb/integration/MongoDbConversionsIT.java +++ b/components/camel-mongodb/src/test/java/org/apache/camel/component/mongodb/integration/MongoDbConversionsIT.java @@ -37,7 +37,7 @@ import static org.junit.jupiter.api.Assertions.assertNotNull; public class MongoDbConversionsIT extends AbstractMongoDbITSupport { @Test - public void testInsertMap() throws InterruptedException { + public void testInsertMap() { assertEquals(0, testCollection.countDocuments()); Map<String, Object> m1 = new HashMap<>(); @@ -111,7 +111,7 @@ public class MongoDbConversionsIT extends AbstractMongoDbITSupport { } @Override - protected RouteBuilder createRouteBuilder() throws Exception { + protected RouteBuilder createRouteBuilder() { return new RouteBuilder() { public void configure() { @@ -140,7 +140,7 @@ public class MongoDbConversionsIT extends AbstractMongoDbITSupport { } @Test - public void shouldConvertJsonStringListToBSONList() throws InterruptedException { + public void shouldConvertJsonStringListToBSONList() { String jsonListArray = "[{\"key\":\"value1\"}, {\"key\":\"value2\"}]"; List<Bson> bsonList = MongoDbBasicConverters.fromStringToList(jsonListArray); assertNotNull(bsonList); @@ -153,7 +153,7 @@ public class MongoDbConversionsIT extends AbstractMongoDbITSupport { } @Test - public void shouldNotConvertJsonStringListToBSONList() throws InterruptedException { + public void shouldNotConvertJsonStringListToBSONList() { String jsonSingleValue = "{\"key\":\"value1\"}"; List<Bson> bsonList = MongoDbBasicConverters.fromStringToList(jsonSingleValue); assertNull(bsonList); diff --git a/components/camel-mongodb/src/test/java/org/apache/camel/component/mongodb/integration/MongoDbCredentialsFromUriConnectionIT.java b/components/camel-mongodb/src/test/java/org/apache/camel/component/mongodb/integration/MongoDbCredentialsFromUriConnectionIT.java index 212d919..71ee0a2 100644 --- a/components/camel-mongodb/src/test/java/org/apache/camel/component/mongodb/integration/MongoDbCredentialsFromUriConnectionIT.java +++ b/components/camel-mongodb/src/test/java/org/apache/camel/component/mongodb/integration/MongoDbCredentialsFromUriConnectionIT.java @@ -42,7 +42,7 @@ public class MongoDbCredentialsFromUriConnectionIT extends MongoDbOperationsIT { } @Override - protected CamelContext createCamelContext() throws Exception { + protected CamelContext createCamelContext() { //This is necessary to avoid creating connection bean for the mongodb component and test credentials instead @SuppressWarnings("deprecation") CamelContext ctx = new DefaultCamelContext(); @@ -67,7 +67,7 @@ public class MongoDbCredentialsFromUriConnectionIT extends MongoDbOperationsIT { } @Override - protected RouteBuilder createRouteBuilder() throws Exception { + protected RouteBuilder createRouteBuilder() { return new RouteBuilder() { public void configure() { diff --git a/components/camel-mongodb/src/test/java/org/apache/camel/component/mongodb/integration/MongoDbDynamicityIT.java b/components/camel-mongodb/src/test/java/org/apache/camel/component/mongodb/integration/MongoDbDynamicityIT.java index 0db7eaf..82092fc 100644 --- a/components/camel-mongodb/src/test/java/org/apache/camel/component/mongodb/integration/MongoDbDynamicityIT.java +++ b/components/camel-mongodb/src/test/java/org/apache/camel/component/mongodb/integration/MongoDbDynamicityIT.java @@ -149,7 +149,7 @@ public class MongoDbDynamicityIT extends AbstractMongoDbITSupport { } @Override - protected RouteBuilder createRouteBuilder() throws Exception { + protected RouteBuilder createRouteBuilder() { return new RouteBuilder() { public void configure() { diff --git a/components/camel-mongodb/src/test/java/org/apache/camel/component/mongodb/integration/MongoDbExceptionHandlingIT.java b/components/camel-mongodb/src/test/java/org/apache/camel/component/mongodb/integration/MongoDbExceptionHandlingIT.java index fd5fad57..1ccfcb2 100644 --- a/components/camel-mongodb/src/test/java/org/apache/camel/component/mongodb/integration/MongoDbExceptionHandlingIT.java +++ b/components/camel-mongodb/src/test/java/org/apache/camel/component/mongodb/integration/MongoDbExceptionHandlingIT.java @@ -29,7 +29,7 @@ import static org.junit.jupiter.api.Assertions.fail; public class MongoDbExceptionHandlingIT extends AbstractMongoDbITSupport { @Test - public void testInduceParseException() throws Exception { + public void testInduceParseException() { // Test that the collection has 0 documents in it assertEquals(0, testCollection.countDocuments()); pumpDataIntoTestCollection(); @@ -44,7 +44,7 @@ public class MongoDbExceptionHandlingIT extends AbstractMongoDbITSupport { } @Test - public void testInduceParseAndThenOkException() throws Exception { + public void testInduceParseAndThenOkException() { // Test that the collection has 0 documents in it assertEquals(0, testCollection.countDocuments()); pumpDataIntoTestCollection(); @@ -64,7 +64,7 @@ public class MongoDbExceptionHandlingIT extends AbstractMongoDbITSupport { } @Test - public void testErroneousDynamicOperation() throws Exception { + public void testErroneousDynamicOperation() { // Test that the collection has 0 documents in it assertEquals(0, testCollection.countDocuments()); pumpDataIntoTestCollection(); @@ -80,7 +80,7 @@ public class MongoDbExceptionHandlingIT extends AbstractMongoDbITSupport { } @Override - protected RouteBuilder createRouteBuilder() throws Exception { + protected RouteBuilder createRouteBuilder() { return new RouteBuilder() { public void configure() { diff --git a/components/camel-mongodb/src/test/java/org/apache/camel/component/mongodb/integration/MongoDbFindOperationIT.java b/components/camel-mongodb/src/test/java/org/apache/camel/component/mongodb/integration/MongoDbFindOperationIT.java index 4b5b77b..70b1abd 100644 --- a/components/camel-mongodb/src/test/java/org/apache/camel/component/mongodb/integration/MongoDbFindOperationIT.java +++ b/components/camel-mongodb/src/test/java/org/apache/camel/component/mongodb/integration/MongoDbFindOperationIT.java @@ -98,7 +98,7 @@ public class MongoDbFindOperationIT extends CamelTestSupport { } @Override - protected CamelContext createCamelContext() throws Exception { + protected CamelContext createCamelContext() { MongoDbComponent component = new MongoDbComponent(); component.setMongoConnection(mongo); @@ -128,7 +128,7 @@ public class MongoDbFindOperationIT extends CamelTestSupport { } @Test - public void testFindAllNoCriteriaOperation() throws Exception { + public void testFindAllNoCriteriaOperation() { // Test that the collection has 0 documents in it assertEquals(0, testCollection.countDocuments()); pumpDataIntoTestCollection(); @@ -158,7 +158,7 @@ public class MongoDbFindOperationIT extends CamelTestSupport { } @Test - public void testFindAllAllowDiskUse() throws Exception { + public void testFindAllAllowDiskUse() { // Test that the collection has 0 documents in it assertEquals(0, testCollection.countDocuments()); pumpDataIntoTestCollection(); @@ -179,7 +179,7 @@ public class MongoDbFindOperationIT extends CamelTestSupport { } @Test - public void testFindAllWithQueryAndNoFIlter() throws Exception { + public void testFindAllWithQueryAndNoFIlter() { // Test that the collection has 0 documents in it assertEquals(0, testCollection.countDocuments()); pumpDataIntoTestCollection(); @@ -207,7 +207,7 @@ public class MongoDbFindOperationIT extends CamelTestSupport { } @Test - public void testFindAllWithQueryAndFilter() throws Exception { + public void testFindAllWithQueryAndFilter() { // Test that the collection has 0 documents in it assertEquals(0, testCollection.countDocuments()); pumpDataIntoTestCollection(); @@ -236,7 +236,7 @@ public class MongoDbFindOperationIT extends CamelTestSupport { } @Test - public void testFindAllNoCriteriaWithFilterOperation() throws Exception { + public void testFindAllNoCriteriaWithFilterOperation() { // Test that the collection has 0 documents in it assertEquals(0, testCollection.countDocuments()); pumpDataIntoTestCollection(); @@ -267,7 +267,7 @@ public class MongoDbFindOperationIT extends CamelTestSupport { } @Test - public void testFindAllIterationOperation() throws Exception { + public void testFindAllIterationOperation() { // Test that the collection has 0 documents in it assertEquals(0, testCollection.countDocuments()); pumpDataIntoTestCollection(); @@ -343,7 +343,7 @@ public class MongoDbFindOperationIT extends CamelTestSupport { } @Test - public void testFindOneByQuery() throws Exception { + public void testFindOneByQuery() { // Test that the collection has 0 documents in it assertEquals(0, testCollection.countDocuments()); pumpDataIntoTestCollection(); @@ -359,7 +359,7 @@ public class MongoDbFindOperationIT extends CamelTestSupport { } @Test - public void testFindOneById() throws Exception { + public void testFindOneById() { // Test that the collection has 0 documents in it assertEquals(0, testCollection.countDocuments()); pumpDataIntoTestCollection(); @@ -377,7 +377,7 @@ public class MongoDbFindOperationIT extends CamelTestSupport { } @Test - public void testFindOneByIdWithObjectId() throws Exception { + public void testFindOneByIdWithObjectId() { // Test that the collection has 0 documents in it assertEquals(0, testCollection.countDocuments()); Document insertObject = new Document("scientist", "Einstein"); @@ -398,7 +398,7 @@ public class MongoDbFindOperationIT extends CamelTestSupport { } @Override - protected RouteBuilder createRouteBuilder() throws Exception { + protected RouteBuilder createRouteBuilder() { return new RouteBuilder() { public void configure() { diff --git a/components/camel-mongodb/src/test/java/org/apache/camel/component/mongodb/integration/MongoDbHeaderHandlingIT.java b/components/camel-mongodb/src/test/java/org/apache/camel/component/mongodb/integration/MongoDbHeaderHandlingIT.java index f79f4f7..c80a5ea 100644 --- a/components/camel-mongodb/src/test/java/org/apache/camel/component/mongodb/integration/MongoDbHeaderHandlingIT.java +++ b/components/camel-mongodb/src/test/java/org/apache/camel/component/mongodb/integration/MongoDbHeaderHandlingIT.java @@ -39,7 +39,7 @@ public class MongoDbHeaderHandlingIT extends AbstractMongoDbITSupport { assertEquals(0, testCollection.countDocuments()); Exchange result = template.request("direct:count", new Processor() { @Override - public void process(Exchange exchange) throws Exception { + public void process(Exchange exchange) { exchange.getIn().setBody("irrelevant body"); exchange.getIn().setHeader("abc", "def"); } @@ -53,7 +53,7 @@ public class MongoDbHeaderHandlingIT extends AbstractMongoDbITSupport { public void testInHeadersTransferredToOutOnInsert() { Exchange result = template.request("direct:insert", new Processor() { @Override - public void process(Exchange exchange) throws Exception { + public void process(Exchange exchange) { exchange.getIn().setBody("{\"_id\":\"testInsertString\", \"scientist\":\"Einstein\"}"); exchange.getIn().setHeader("abc", "def"); } @@ -87,7 +87,7 @@ public class MongoDbHeaderHandlingIT extends AbstractMongoDbITSupport { // with the CamelMongoDbWriteResult header Exchange resultExch = template.request("direct:save", new Processor() { @Override - public void process(Exchange exchange) throws Exception { + public void process(Exchange exchange) { exchange.getIn().setBody(record1); } }); @@ -105,7 +105,7 @@ public class MongoDbHeaderHandlingIT extends AbstractMongoDbITSupport { public void testWriteResultAsHeaderWithReadOp() { Exchange resultExch = template.request("direct:getDbStats", new Processor() { @Override - public void process(Exchange exchange) throws Exception { + public void process(Exchange exchange) { exchange.getIn().setBody("irrelevantBody"); exchange.getIn().setHeader("abc", "def"); } @@ -116,7 +116,7 @@ public class MongoDbHeaderHandlingIT extends AbstractMongoDbITSupport { } @Override - protected RouteBuilder createRouteBuilder() throws Exception { + protected RouteBuilder createRouteBuilder() { return new RouteBuilder() { public void configure() { diff --git a/components/camel-mongodb/src/test/java/org/apache/camel/component/mongodb/integration/MongoDbIndexIT.java b/components/camel-mongodb/src/test/java/org/apache/camel/component/mongodb/integration/MongoDbIndexIT.java index 16b7be4..7058596 100644 --- a/components/camel-mongodb/src/test/java/org/apache/camel/component/mongodb/integration/MongoDbIndexIT.java +++ b/components/camel-mongodb/src/test/java/org/apache/camel/component/mongodb/integration/MongoDbIndexIT.java @@ -203,7 +203,7 @@ public class MongoDbIndexIT extends AbstractMongoDbITSupport { } @Override - protected RouteBuilder createRouteBuilder() throws Exception { + protected RouteBuilder createRouteBuilder() { return new RouteBuilder() { public void configure() { from("direct:dynamicityEnabled").to( diff --git a/components/camel-mongodb/src/test/java/org/apache/camel/component/mongodb/integration/MongoDbInsertBatchIT.java b/components/camel-mongodb/src/test/java/org/apache/camel/component/mongodb/integration/MongoDbInsertBatchIT.java index 8d60e52..b5d4a53 100644 --- a/components/camel-mongodb/src/test/java/org/apache/camel/component/mongodb/integration/MongoDbInsertBatchIT.java +++ b/components/camel-mongodb/src/test/java/org/apache/camel/component/mongodb/integration/MongoDbInsertBatchIT.java @@ -64,7 +64,7 @@ public class MongoDbInsertBatchIT extends AbstractMongoDbITSupport { } @Override - protected RouteBuilder createRouteBuilder() throws Exception { + protected RouteBuilder createRouteBuilder() { return new RouteBuilder() { public void configure() { from("direct:insert") diff --git a/components/camel-mongodb/src/test/java/org/apache/camel/component/mongodb/integration/MongoDbOperationsIT.java b/components/camel-mongodb/src/test/java/org/apache/camel/component/mongodb/integration/MongoDbOperationsIT.java index cc7cd93..d5d7782 100644 --- a/components/camel-mongodb/src/test/java/org/apache/camel/component/mongodb/integration/MongoDbOperationsIT.java +++ b/components/camel-mongodb/src/test/java/org/apache/camel/component/mongodb/integration/MongoDbOperationsIT.java @@ -53,7 +53,7 @@ import static org.junit.jupiter.api.Assertions.assertTrue; public class MongoDbOperationsIT extends AbstractMongoDbITSupport { @Test - public void testCountOperation() throws Exception { + public void testCountOperation() { // Test that the collection has 0 documents in it assertEquals(0, testCollection.countDocuments()); Object result = template.requestBody("direct:count", "irrelevantBody"); @@ -77,7 +77,7 @@ public class MongoDbOperationsIT extends AbstractMongoDbITSupport { } @Test - public void testInsertString() throws Exception { + public void testInsertString() { assertEquals(0, testCollection.countDocuments()); Object result = template.requestBody("direct:insert", new Document(MONGO_ID, "testInsertString").append("scientist", "Einstein").toJson()); @@ -87,14 +87,14 @@ public class MongoDbOperationsIT extends AbstractMongoDbITSupport { } @Test - public void testStoreOidOnInsert() throws Exception { + public void testStoreOidOnInsert() { Document document = new Document(); ObjectId oid = template.requestBody("direct:testStoreOidOnInsert", document, ObjectId.class); assertEquals(document.get(MONGO_ID), oid); } @Test - public void testStoreOidsOnInsert() throws Exception { + public void testStoreOidsOnInsert() { Document firsDocument = new Document(); Document secondDoocument = new Document(); List<?> oids @@ -104,7 +104,7 @@ public class MongoDbOperationsIT extends AbstractMongoDbITSupport { } @Test - public void testSave() throws Exception { + public void testSave() { // Prepare test assertEquals(0, testCollection.countDocuments()); Object[] req = new Object[] { @@ -149,21 +149,21 @@ public class MongoDbOperationsIT extends AbstractMongoDbITSupport { } @Test - public void testStoreOidOnSaveWithoutId() throws Exception { + public void testStoreOidOnSaveWithoutId() { Document document = new Document(); ObjectId oid = template.requestBody("direct:testStoreOidOnSave", document, ObjectId.class); assertNotNull(oid); } @Test - public void testStoreOidOnSave() throws Exception { + public void testStoreOidOnSave() { Document document = new Document(MONGO_ID, new ObjectId("5847e39e0824d6b54194e197")); ObjectId oid = template.requestBody("direct:testStoreOidOnSave", document, ObjectId.class); assertEquals(document.get(MONGO_ID), oid); } @Test - public void testUpdate() throws Exception { + public void testUpdate() { // Prepare test assertEquals(0, testCollection.countDocuments()); for (int i = 1; i <= 100; i++) { @@ -191,7 +191,7 @@ public class MongoDbOperationsIT extends AbstractMongoDbITSupport { Exchange resultExchange = template.request("direct:update", new Processor() { @Override - public void process(Exchange exchange) throws Exception { + public void process(Exchange exchange) { exchange.getIn().setBody(new Bson[] { extraField, updateObj }); exchange.getIn().setHeader(MongoDbConstants.MULTIUPDATE, true); } @@ -206,7 +206,7 @@ public class MongoDbOperationsIT extends AbstractMongoDbITSupport { } @Test - public void testUpdateFromString() throws Exception { + public void testUpdateFromString() { // Prepare test assertEquals(0, testCollection.countDocuments()); for (int i = 1; i <= 100; i++) { @@ -238,7 +238,7 @@ public class MongoDbOperationsIT extends AbstractMongoDbITSupport { Exchange resultExchange = template.request("direct:update", new Processor() { @Override - public void process(Exchange exchange) throws Exception { + public void process(Exchange exchange) { exchange.getIn().setBody(updates); exchange.getIn().setHeader(MongoDbConstants.MULTIUPDATE, true); } @@ -253,7 +253,7 @@ public class MongoDbOperationsIT extends AbstractMongoDbITSupport { } @Test - public void testUpdateUsingFieldsFilterHeader() throws Exception { + public void testUpdateUsingFieldsFilterHeader() { // Prepare test assertEquals(0, testCollection.countDocuments()); for (int i = 1; i <= 100; i++) { @@ -290,7 +290,7 @@ public class MongoDbOperationsIT extends AbstractMongoDbITSupport { } @Test - public void testRemove() throws Exception { + public void testRemove() { // Prepare test assertEquals(0, testCollection.countDocuments()); for (int i = 1; i <= 100; i++) { @@ -314,7 +314,7 @@ public class MongoDbOperationsIT extends AbstractMongoDbITSupport { Exchange resultExchange = template.request("direct:remove", new Processor() { @Override - public void process(Exchange exchange) throws Exception { + public void process(Exchange exchange) { exchange.getIn().setBody(extraField); } }); @@ -329,7 +329,7 @@ public class MongoDbOperationsIT extends AbstractMongoDbITSupport { } @Test - public void testAggregate() throws Exception { + public void testAggregate() { // Test that the collection has 0 documents in it assertEquals(0, testCollection.countDocuments()); pumpDataIntoTestCollection(); @@ -347,7 +347,7 @@ public class MongoDbOperationsIT extends AbstractMongoDbITSupport { } @Test - public void testDbStats() throws Exception { + public void testDbStats() { assertEquals(0, testCollection.countDocuments()); Object result = template.requestBody("direct:getDbStats", "irrelevantBody"); assertTrue(result instanceof Document, "Result is not of type Document"); @@ -355,7 +355,7 @@ public class MongoDbOperationsIT extends AbstractMongoDbITSupport { } @Test - public void testColStats() throws Exception { + public void testColStats() { assertEquals(0, testCollection.countDocuments()); // Add some records to the collection (and do it via camel-mongodb) @@ -374,7 +374,7 @@ public class MongoDbOperationsIT extends AbstractMongoDbITSupport { } @Test - public void testCommand() throws Exception { + public void testCommand() { // Call hostInfo, command working with every configuration Object result = template.requestBody("direct:command", "{\"hostInfo\":\"1\"}"); assertTrue(result instanceof Document, "Result is not of type Document"); @@ -382,7 +382,7 @@ public class MongoDbOperationsIT extends AbstractMongoDbITSupport { } @Test - public void testOperationHeader() throws Exception { + public void testOperationHeader() { // Test that the collection has 0 documents in it assertEquals(0, testCollection.countDocuments()); @@ -403,7 +403,7 @@ public class MongoDbOperationsIT extends AbstractMongoDbITSupport { } @Override - protected RouteBuilder createRouteBuilder() throws Exception { + protected RouteBuilder createRouteBuilder() { return new RouteBuilder() { public void configure() { diff --git a/components/camel-mongodb/src/test/java/org/apache/camel/component/mongodb/integration/MongoDbOutputTypeIT.java b/components/camel-mongodb/src/test/java/org/apache/camel/component/mongodb/integration/MongoDbOutputTypeIT.java index e66cd07..b6bb6a7 100644 --- a/components/camel-mongodb/src/test/java/org/apache/camel/component/mongodb/integration/MongoDbOutputTypeIT.java +++ b/components/camel-mongodb/src/test/java/org/apache/camel/component/mongodb/integration/MongoDbOutputTypeIT.java @@ -95,7 +95,7 @@ public class MongoDbOutputTypeIT extends AbstractMongoDbITSupport { try { RouteBuilder taillableRouteBuilder = new RouteBuilder() { @Override - public void configure() throws Exception { + public void configure() { from("mongodb:myDb?database={{mongodb.testDb}}&collection={{mongodb.testCollection}}&operation=findById&dynamicity=true&outputType=MongoIterable") .to("mock:dummy"); } @@ -113,7 +113,7 @@ public class MongoDbOutputTypeIT extends AbstractMongoDbITSupport { try { RouteBuilder taillableRouteBuilder = new RouteBuilder() { @Override - public void configure() throws Exception { + public void configure() { from("mongodb:myDb?database={{mongodb.testDb}}&collection={{mongodb.cappedTestCollection}}&tailTrackIncreasingField=increasing&outputType=MongoIterable") .id("tailableCursorConsumer1").autoStartup(false).to("mock:test"); } @@ -127,7 +127,7 @@ public class MongoDbOutputTypeIT extends AbstractMongoDbITSupport { } @Override - protected RouteBuilder createRouteBuilder() throws Exception { + protected RouteBuilder createRouteBuilder() { return new RouteBuilder() { public void configure() { diff --git a/components/camel-mongodb/src/test/java/org/apache/camel/component/mongodb/integration/MongoDbSpringDslOperationsIT.java b/components/camel-mongodb/src/test/java/org/apache/camel/component/mongodb/integration/MongoDbSpringDslOperationsIT.java index d294bed..aa7a62b 100644 --- a/components/camel-mongodb/src/test/java/org/apache/camel/component/mongodb/integration/MongoDbSpringDslOperationsIT.java +++ b/components/camel-mongodb/src/test/java/org/apache/camel/component/mongodb/integration/MongoDbSpringDslOperationsIT.java @@ -42,10 +42,10 @@ public class MongoDbSpringDslOperationsIT extends MongoDbOperationsIT { } @Override - protected RouteBuilder createRouteBuilder() throws Exception { + protected RouteBuilder createRouteBuilder() { return new RouteBuilder() { @Override - public void configure() throws Exception { + public void configure() { // Nothing, all routes are initialized by the Spring DSL context // file } diff --git a/components/camel-mongodb/src/test/java/org/apache/camel/component/mongodb/integration/MongoDbStopEndpointIT.java b/components/camel-mongodb/src/test/java/org/apache/camel/component/mongodb/integration/MongoDbStopEndpointIT.java index 5ef8aee..f3c743f 100644 --- a/components/camel-mongodb/src/test/java/org/apache/camel/component/mongodb/integration/MongoDbStopEndpointIT.java +++ b/components/camel-mongodb/src/test/java/org/apache/camel/component/mongodb/integration/MongoDbStopEndpointIT.java @@ -33,7 +33,7 @@ public class MongoDbStopEndpointIT extends AbstractMongoDbITSupport { MongoDbEndpoint endpoint; @Override - protected RouteBuilder createRouteBuilder() throws Exception { + protected RouteBuilder createRouteBuilder() { return new RouteBuilder() { public void configure() { from("direct:insertJsonString").routeId("insert").to(endpoint); @@ -44,7 +44,7 @@ public class MongoDbStopEndpointIT extends AbstractMongoDbITSupport { } @Test - public void testStopEndpoint() throws Exception { + public void testStopEndpoint() { assertEquals(0, testCollection.countDocuments()); template.requestBody("direct:insertJsonString", "{\"scientist\": \"Newton\", \"_id\": \"" + MY_ID + "\"}"); diff --git a/components/camel-mongodb/src/test/java/org/apache/camel/component/mongodb/integration/MongoDbTailableCursorConsumerIT.java b/components/camel-mongodb/src/test/java/org/apache/camel/component/mongodb/integration/MongoDbTailableCursorConsumerIT.java index 336f2d0..b878907 100644 --- a/components/camel-mongodb/src/test/java/org/apache/camel/component/mongodb/integration/MongoDbTailableCursorConsumerIT.java +++ b/components/camel-mongodb/src/test/java/org/apache/camel/component/mongodb/integration/MongoDbTailableCursorConsumerIT.java @@ -426,7 +426,7 @@ public class MongoDbTailableCursorConsumerIT extends AbstractMongoDbITSupport { context.addRoutes(new RouteBuilder() { @Override - public void configure() throws Exception { + public void configure() { from("mongodb:myDb?database={{mongodb.testDb}}&collection={{mongodb.cappedTestCollection}}&tailTrackIncreasingField=increasing") .id("tailableCursorConsumer1") diff --git a/components/camel-mongodb/src/test/java/org/apache/camel/component/mongodb/meta/integration/MongoDbMetaExtensionIT.java b/components/camel-mongodb/src/test/java/org/apache/camel/component/mongodb/meta/integration/MongoDbMetaExtensionIT.java index 9a6b6e8..cf6972d 100644 --- a/components/camel-mongodb/src/test/java/org/apache/camel/component/mongodb/meta/integration/MongoDbMetaExtensionIT.java +++ b/components/camel-mongodb/src/test/java/org/apache/camel/component/mongodb/meta/integration/MongoDbMetaExtensionIT.java @@ -52,7 +52,7 @@ public class MongoDbMetaExtensionIT extends AbstractMongoDbITSupport { } @Test - public void testValidMetaData() throws Exception { + public void testValidMetaData() { // When final String database = "test"; final String collection = "validatedCollection"; diff --git a/components/camel-mongodb/src/test/java/org/apache/camel/component/mongodb/processor/idempotent/integration/MongoDbIdempotentRepositoryIT.java b/components/camel-mongodb/src/test/java/org/apache/camel/component/mongodb/processor/idempotent/integration/MongoDbIdempotentRepositoryIT.java index 6bcf03f..a8d9aa4 100644 --- a/components/camel-mongodb/src/test/java/org/apache/camel/component/mongodb/processor/idempotent/integration/MongoDbIdempotentRepositoryIT.java +++ b/components/camel-mongodb/src/test/java/org/apache/camel/component/mongodb/processor/idempotent/integration/MongoDbIdempotentRepositoryIT.java @@ -45,7 +45,7 @@ public class MongoDbIdempotentRepositoryIT extends AbstractMongoDbITSupport { } @Test - public void add() throws Exception { + public void add() { String randomUUIDString = UUID.randomUUID().toString(); boolean added = repo.add(randomUUIDString); @@ -54,7 +54,7 @@ public class MongoDbIdempotentRepositoryIT extends AbstractMongoDbITSupport { } @Test - public void addAndContains() throws Exception { + public void addAndContains() { String randomUUIDString = UUID.randomUUID().toString(); repo.add(randomUUIDString); @@ -65,7 +65,7 @@ public class MongoDbIdempotentRepositoryIT extends AbstractMongoDbITSupport { } @Test - public void addAndRemove() throws Exception { + public void addAndRemove() { String randomUUIDString = UUID.randomUUID().toString(); repo.add(randomUUIDString); @@ -77,7 +77,7 @@ public class MongoDbIdempotentRepositoryIT extends AbstractMongoDbITSupport { } @Test - public void addDuplicatedFails() throws Exception { + public void addDuplicatedFails() { String randomUUIDString = UUID.randomUUID().toString(); repo.add(randomUUIDString); @@ -89,7 +89,7 @@ public class MongoDbIdempotentRepositoryIT extends AbstractMongoDbITSupport { } @Test - public void deleteMissingiIsFailse() throws Exception { + public void deleteMissingiIsFailse() { String randomUUIDString = UUID.randomUUID().toString(); assertEquals(0, testCollection.countDocuments()); boolean removed = repo.remove(randomUUIDString); @@ -97,14 +97,14 @@ public class MongoDbIdempotentRepositoryIT extends AbstractMongoDbITSupport { } @Test - public void containsMissingReturnsFalse() throws Exception { + public void containsMissingReturnsFalse() { String randomUUIDString = UUID.randomUUID().toString(); boolean found = repo.contains(randomUUIDString); assertTrue(!found, "Non existing item is not found"); } @Test - public void confirmAllwaysReturnsTrue() throws Exception { + public void confirmAllwaysReturnsTrue() { String randomUUIDString = UUID.randomUUID().toString(); boolean found = repo.confirm(randomUUIDString); assertTrue(found, "Confirm always returns true");
