CAMEL-7378: Fixed CS
Project: http://git-wip-us.apache.org/repos/asf/camel/repo Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/96350641 Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/96350641 Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/96350641 Branch: refs/heads/master Commit: 9635064159305c781f97ef26efdfa9758d4f44ce Parents: 97f4a7c Author: Claus Ibsen <davscl...@apache.org> Authored: Thu Apr 23 13:49:36 2015 +0200 Committer: Claus Ibsen <davscl...@apache.org> Committed: Thu Apr 23 13:49:36 2015 +0200 ---------------------------------------------------------------------- .../camel/component/mongodb/MongoDbEndpoint.java | 14 +++++++------- .../camel/component/mongodb/MongoDbProducer.java | 4 ++-- .../component/mongodb/MongoDbOutputTypeTest.java | 11 +++++------ 3 files changed, 14 insertions(+), 15 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/camel/blob/96350641/components/camel-mongodb/src/main/java/org/apache/camel/component/mongodb/MongoDbEndpoint.java ---------------------------------------------------------------------- diff --git a/components/camel-mongodb/src/main/java/org/apache/camel/component/mongodb/MongoDbEndpoint.java b/components/camel-mongodb/src/main/java/org/apache/camel/component/mongodb/MongoDbEndpoint.java index f31faa7..dc6ccb8 100644 --- a/components/camel-mongodb/src/main/java/org/apache/camel/component/mongodb/MongoDbEndpoint.java +++ b/components/camel-mongodb/src/main/java/org/apache/camel/component/mongodb/MongoDbEndpoint.java @@ -147,15 +147,15 @@ public class MongoDbEndpoint extends DefaultEndpoint { /** * Check if outputType is compatible with operation. DbCursor and DBObjectList applies to findAll. DBObject applies to others. */ - private void validateOutputType(){ - if(!ObjectHelper.isEmpty(outputType)){ - if(MongoDbOutputType.DBObjectList.equals(outputType) && !(MongoDbOperation.findAll.equals(operation)) ){ + private void validateOutputType() { + if (!ObjectHelper.isEmpty(outputType)) { + if (MongoDbOutputType.DBObjectList.equals(outputType) && !(MongoDbOperation.findAll.equals(operation))) { throw new IllegalArgumentException("outputType DBObjectList is only compatible with operation findAll"); } - if(MongoDbOutputType.DBCursor.equals(outputType) && !(MongoDbOperation.findAll.equals(operation)) ){ + if (MongoDbOutputType.DBCursor.equals(outputType) && !(MongoDbOperation.findAll.equals(operation))) { throw new IllegalArgumentException("outputType DBCursor is only compatible with operation findAll"); } - if(MongoDbOutputType.DBObject.equals(outputType) && (MongoDbOperation.findAll.equals(operation)) ){ + if (MongoDbOutputType.DBObject.equals(outputType) && (MongoDbOperation.findAll.equals(operation))) { throw new IllegalArgumentException("outputType DBObject is not compatible with operation findAll"); } } @@ -323,7 +323,7 @@ public class MongoDbEndpoint extends DefaultEndpoint { /** * Sets the name of the MongoDB collection to bind to this endpoint - * + * * @param collection collection name */ public void setCollection(String collection) { @@ -347,8 +347,8 @@ public class MongoDbEndpoint extends DefaultEndpoint { /** * Sets the operation this endpoint will execute against MongoDB. For possible values, see {@link MongoDbOperation}. + * * @param operation name of the operation as per catalogued values - * * @throws CamelMongoDbException */ public void setOperation(String operation) throws CamelMongoDbException { http://git-wip-us.apache.org/repos/asf/camel/blob/96350641/components/camel-mongodb/src/main/java/org/apache/camel/component/mongodb/MongoDbProducer.java ---------------------------------------------------------------------- diff --git a/components/camel-mongodb/src/main/java/org/apache/camel/component/mongodb/MongoDbProducer.java b/components/camel-mongodb/src/main/java/org/apache/camel/component/mongodb/MongoDbProducer.java index b6b9939..a70e52c 100644 --- a/components/camel-mongodb/src/main/java/org/apache/camel/component/mongodb/MongoDbProducer.java +++ b/components/camel-mongodb/src/main/java/org/apache/camel/component/mongodb/MongoDbProducer.java @@ -331,9 +331,9 @@ public class MongoDbProducer extends DefaultProducer { } Message resultMessage = prepareResponseMessage(exchange, MongoDbOperation.findAll); - if(MongoDbOutputType.DBCursor.equals(endpoint.getOutputType())){ + if (MongoDbOutputType.DBCursor.equals(endpoint.getOutputType())) { resultMessage.setBody(ret.iterator()); - }else{ + } else { resultMessage.setBody(ret.toArray()); resultMessage.setHeader(MongoDbConstants.RESULT_TOTAL_SIZE, ret.count()); resultMessage.setHeader(MongoDbConstants.RESULT_PAGE_SIZE, ret.size()); http://git-wip-us.apache.org/repos/asf/camel/blob/96350641/components/camel-mongodb/src/test/java/org/apache/camel/component/mongodb/MongoDbOutputTypeTest.java ---------------------------------------------------------------------- diff --git a/components/camel-mongodb/src/test/java/org/apache/camel/component/mongodb/MongoDbOutputTypeTest.java b/components/camel-mongodb/src/test/java/org/apache/camel/component/mongodb/MongoDbOutputTypeTest.java index 6cd4293..50c1eba 100644 --- a/components/camel-mongodb/src/test/java/org/apache/camel/component/mongodb/MongoDbOutputTypeTest.java +++ b/components/camel-mongodb/src/test/java/org/apache/camel/component/mongodb/MongoDbOutputTypeTest.java @@ -16,16 +16,16 @@ */ package org.apache.camel.component.mongodb; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + import com.mongodb.DBCursor; import com.mongodb.DBObject; import org.apache.camel.Exchange; import org.apache.camel.builder.RouteBuilder; import org.junit.Test; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - public class MongoDbOutputTypeTest extends AbstractMongoDbTest { @Test @@ -44,7 +44,7 @@ public class MongoDbOutputTypeTest extends AbstractMongoDbTest { Object result = template.requestBodyAndHeaders("direct:findAllDBCursor", (Object) null, headers); assertTrue("Result is not of type DBCursor", result instanceof DBCursor); - DBCursor resultCursor = ((DBCursor) result); + DBCursor resultCursor = (DBCursor) result; // Ensure that all returned documents contain all fields while (resultCursor.hasNext()) { DBObject dbObject = resultCursor.next(); @@ -55,7 +55,6 @@ public class MongoDbOutputTypeTest extends AbstractMongoDbTest { numToSkip = numToSkip + limit; } - } @Test