This is an automated email from the ASF dual-hosted git repository. davsclaus pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/camel.git
The following commit(s) were added to refs/heads/master by this push: new e0b070a Resolved a TODO (#4082) e0b070a is described below commit e0b070a8f3a745b0b4237cdb87177c4d044bd95e Author: Nayananga Anuradha Muhandiram <nayanangamuhandi...@gmail.com> AuthorDate: Tue Aug 11 00:22:18 2020 +0530 Resolved a TODO (#4082) --- .../org/apache/camel/component/minio/MinioChecks.java | 4 ++-- .../minio/integration/MinioComponentIntegrationTest.java | 15 ++++++++------- .../minio/integration/MinioConsumerIntegrationTest.java | 6 ++---- 3 files changed, 12 insertions(+), 13 deletions(-) diff --git a/components/camel-minio/src/main/java/org/apache/camel/component/minio/MinioChecks.java b/components/camel-minio/src/main/java/org/apache/camel/component/minio/MinioChecks.java index 6bd667b..81f3a45 100644 --- a/components/camel-minio/src/main/java/org/apache/camel/component/minio/MinioChecks.java +++ b/components/camel-minio/src/main/java/org/apache/camel/component/minio/MinioChecks.java @@ -42,13 +42,13 @@ public final class MinioChecks { } static void checkOffsetConfig(final MinioConfiguration configuration, final java.util.function.Consumer<Long> fn) { - if (isNotEmpty(configuration.getOffset())) { + if (configuration.getOffset() > 0) { fn.accept(configuration.getOffset()); } } static void checkLengthConfig(final MinioConfiguration configuration, final java.util.function.Consumer<Long> fn) { - if (isNotEmpty(configuration.getLength())) { + if (configuration.getLength() > 0) { fn.accept(configuration.getLength()); } } diff --git a/components/camel-minio/src/test/java/org/apache/camel/component/minio/integration/MinioComponentIntegrationTest.java b/components/camel-minio/src/test/java/org/apache/camel/component/minio/integration/MinioComponentIntegrationTest.java index 3191fd6..4ae951b 100644 --- a/components/camel-minio/src/test/java/org/apache/camel/component/minio/integration/MinioComponentIntegrationTest.java +++ b/components/camel-minio/src/test/java/org/apache/camel/component/minio/integration/MinioComponentIntegrationTest.java @@ -29,6 +29,7 @@ import org.junit.jupiter.api.Disabled; import org.junit.jupiter.api.Test; import static org.junit.jupiter.api.Assertions.assertNull; +import static org.junit.jupiter.api.Assertions.assertNotNull; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertTrue; @@ -44,7 +45,7 @@ public class MinioComponentIntegrationTest extends CamelTestSupport { @Test public void sendInOnly() throws Exception { - result.expectedMessageCount(2); + result.expectedMessageCount(1); Exchange exchange1 = template.send("direct:start", ExchangePattern.InOnly, exchange -> { exchange.getIn().setHeader(MinioConstants.OBJECT_NAME, "CamelUnitTest"); @@ -59,7 +60,6 @@ public class MinioComponentIntegrationTest extends CamelTestSupport { assertMockEndpointsSatisfied(); assertResultExchange(result.getExchanges().get(0)); - assertResultExchange(result.getExchanges().get(1)); assertResponseMessage(exchange1.getIn()); assertResponseMessage(exchange2.getIn()); @@ -83,13 +83,13 @@ public class MinioComponentIntegrationTest extends CamelTestSupport { private void assertResultExchange(Exchange resultExchange) { assertEquals("This is my bucket content.", resultExchange.getIn().getBody(String.class)); + assertEquals("mycamelbucket", resultExchange.getIn().getHeader(MinioConstants.BUCKET_NAME)); assertTrue(resultExchange.getIn().getHeader(MinioConstants.OBJECT_NAME, String.class).startsWith("CamelUnitTest")); - assertNull(resultExchange.getIn().getHeader(MinioConstants.BUCKET_NAME)); assertNull(resultExchange.getIn().getHeader(MinioConstants.VERSION_ID)); // not enabled on this bucket - assertNull(resultExchange.getIn().getHeader(MinioConstants.LAST_MODIFIED)); - assertNull(resultExchange.getIn().getHeader(MinioConstants.CONTENT_TYPE)); + assertNotNull(resultExchange.getIn().getHeader(MinioConstants.LAST_MODIFIED)); + assertEquals("application/octet-stream", resultExchange.getIn().getHeader(MinioConstants.CONTENT_TYPE)); assertNull(resultExchange.getIn().getHeader(MinioConstants.CONTENT_ENCODING)); - assertNull(resultExchange.getIn().getHeader(MinioConstants.CONTENT_LENGTH)); + assertEquals(26L, resultExchange.getIn().getHeader(MinioConstants.CONTENT_LENGTH)); assertNull(resultExchange.getIn().getHeader(MinioConstants.CONTENT_DISPOSITION)); assertNull(resultExchange.getIn().getHeader(MinioConstants.CONTENT_MD5)); assertNull(resultExchange.getIn().getHeader(MinioConstants.CACHE_CONTROL)); @@ -107,7 +107,8 @@ public class MinioComponentIntegrationTest extends CamelTestSupport { String minioEndpointUri = "minio://mycamelbucket?accessKey=Q3AM3UQ867SPQQA43P2F&secretKey=RAW(zuf+tfteSlswRu7BJ86wekitnifILbZam1KYY3TG)®ion=us-west-1&autoCreateBucket=false&endpoint=https://play.min.io"; - from("direct:start").to(minioEndpointUri).to("mock:result"); + from("direct:start").to(minioEndpointUri); + from(minioEndpointUri).to("mock:result"); } }; diff --git a/components/camel-minio/src/test/java/org/apache/camel/component/minio/integration/MinioConsumerIntegrationTest.java b/components/camel-minio/src/test/java/org/apache/camel/component/minio/integration/MinioConsumerIntegrationTest.java index 4884ebd..3843b62 100644 --- a/components/camel-minio/src/test/java/org/apache/camel/component/minio/integration/MinioConsumerIntegrationTest.java +++ b/components/camel-minio/src/test/java/org/apache/camel/component/minio/integration/MinioConsumerIntegrationTest.java @@ -78,10 +78,8 @@ public class MinioConsumerIntegrationTest extends CamelTestSupport { public void configure() { String minioEndpoint = "minio://mycamel?autoCreateBucket=false"; - from("direct:putObject").startupOrder(1).to(minioEndpoint).to("mock:result"); - - // TODO: Check why this is not working - from("minio://mycamel?moveAfterRead=true&destinationBucketName=camel-kafka-connector&autoCreateBucket=false").startupOrder(2).log("${body}"); + from("direct:putObject").startupOrder(1).to(minioEndpoint); + from("minio://mycamel?moveAfterRead=true&destinationBucketName=camel-kafka-connector&autoCreateBucket=false").startupOrder(2).to("mock:result"); } };