You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by ac...@apache.org on 2020/03/18 12:46:28 UTC
[camel] 01/02: Camel-AWS2-S3: Migrated tests to Junit5
This is an automated email from the ASF dual-hosted git repository.
acosentino pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/camel.git
commit 8907fac9a32ba078b774052ae6fffc78e902ddf1
Author: Andrea Cosentino <an...@gmail.com>
AuthorDate: Wed Mar 18 13:22:01 2020 +0100
Camel-AWS2-S3: Migrated tests to Junit5
---
components/camel-aws2-s3/pom.xml | 7 +------
.../camel/component/aws2/s3/AWSS3ClientFactoryTest.java | 11 ++++++-----
.../aws2/s3/S3ComponentVerifierExtensionTest.java | 12 +++++++-----
.../aws2/s3/integration/S3ComponentIntegrationTest.java | 15 ++++++++++-----
.../integration/S3CopyObjectOperationIntegrationTest.java | 9 +++++----
.../S3DeleteBucketOperationIntegrationTest.java | 9 +++++----
.../S3ListObjectsOperationIntegrationTest.java | 11 +++++++----
.../S3MultipartUploadOperationIntegrationTest.java | 9 +++++----
.../S3ObjectRangeOperationIntegrationTest.java | 8 ++++----
9 files changed, 50 insertions(+), 41 deletions(-)
diff --git a/components/camel-aws2-s3/pom.xml b/components/camel-aws2-s3/pom.xml
index a06177a..6f8b990 100644
--- a/components/camel-aws2-s3/pom.xml
+++ b/components/camel-aws2-s3/pom.xml
@@ -53,13 +53,8 @@
<!-- for testing -->
<dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
<groupId>org.apache.camel</groupId>
- <artifactId>camel-test-spring</artifactId>
+ <artifactId>camel-test-spring-junit5</artifactId>
<scope>test</scope>
</dependency>
<dependency>
diff --git a/components/camel-aws2-s3/src/test/java/org/apache/camel/component/aws2/s3/AWSS3ClientFactoryTest.java b/components/camel-aws2-s3/src/test/java/org/apache/camel/component/aws2/s3/AWSS3ClientFactoryTest.java
index e4484f2..51fcee4 100644
--- a/components/camel-aws2-s3/src/test/java/org/apache/camel/component/aws2/s3/AWSS3ClientFactoryTest.java
+++ b/components/camel-aws2-s3/src/test/java/org/apache/camel/component/aws2/s3/AWSS3ClientFactoryTest.java
@@ -16,12 +16,13 @@
*/
package org.apache.camel.component.aws2.s3;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+
import org.apache.camel.component.aws2.s3.client.AWS2CamelS3InternalClient;
import org.apache.camel.component.aws2.s3.client.AWS2S3ClientFactory;
import org.apache.camel.component.aws2.s3.client.impl.AWS2S3ClientIAMOptimizedImpl;
import org.apache.camel.component.aws2.s3.client.impl.AWS2S3ClientStandardImpl;
-import org.junit.Assert;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
public class AWSS3ClientFactoryTest {
@@ -29,7 +30,7 @@ public class AWSS3ClientFactoryTest {
public void getStandardS3ClientDefault() {
AWS2S3Configuration s3Configuration = new AWS2S3Configuration();
AWS2CamelS3InternalClient awss3Client = AWS2S3ClientFactory.getAWSS3Client(s3Configuration);
- Assert.assertTrue(awss3Client instanceof AWS2S3ClientStandardImpl);
+ assertTrue(awss3Client instanceof AWS2S3ClientStandardImpl);
}
@Test
@@ -37,7 +38,7 @@ public class AWSS3ClientFactoryTest {
AWS2S3Configuration s3Configuration = new AWS2S3Configuration();
s3Configuration.setUseIAMCredentials(false);
AWS2CamelS3InternalClient awss3Client = AWS2S3ClientFactory.getAWSS3Client(s3Configuration);
- Assert.assertTrue(awss3Client instanceof AWS2S3ClientStandardImpl);
+ assertTrue(awss3Client instanceof AWS2S3ClientStandardImpl);
}
@Test
@@ -45,6 +46,6 @@ public class AWSS3ClientFactoryTest {
AWS2S3Configuration s3Configuration = new AWS2S3Configuration();
s3Configuration.setUseIAMCredentials(true);
AWS2CamelS3InternalClient awss3Client = AWS2S3ClientFactory.getAWSS3Client(s3Configuration);
- Assert.assertTrue(awss3Client instanceof AWS2S3ClientIAMOptimizedImpl);
+ assertTrue(awss3Client instanceof AWS2S3ClientIAMOptimizedImpl);
}
}
diff --git a/components/camel-aws2-s3/src/test/java/org/apache/camel/component/aws2/s3/S3ComponentVerifierExtensionTest.java b/components/camel-aws2-s3/src/test/java/org/apache/camel/component/aws2/s3/S3ComponentVerifierExtensionTest.java
index 26d0dea..4e655c2 100644
--- a/components/camel-aws2-s3/src/test/java/org/apache/camel/component/aws2/s3/S3ComponentVerifierExtensionTest.java
+++ b/components/camel-aws2-s3/src/test/java/org/apache/camel/component/aws2/s3/S3ComponentVerifierExtensionTest.java
@@ -16,14 +16,16 @@
*/
package org.apache.camel.component.aws2.s3;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+
import java.util.HashMap;
import java.util.Map;
import org.apache.camel.Component;
import org.apache.camel.component.extension.ComponentVerifierExtension;
-import org.apache.camel.test.junit4.CamelTestSupport;
-import org.junit.Assert;
-import org.junit.Test;
+import org.apache.camel.test.junit5.CamelTestSupport;
+import org.junit.jupiter.api.Test;
+
public class S3ComponentVerifierExtensionTest extends CamelTestSupport {
@@ -49,7 +51,7 @@ public class S3ComponentVerifierExtensionTest extends CamelTestSupport {
ComponentVerifierExtension.Result result = verifier.verify(ComponentVerifierExtension.Scope.PARAMETERS, parameters);
- Assert.assertEquals(ComponentVerifierExtension.Result.Status.OK, result.getStatus());
+ assertEquals(ComponentVerifierExtension.Result.Status.OK, result.getStatus());
}
@Test
@@ -65,7 +67,7 @@ public class S3ComponentVerifierExtensionTest extends CamelTestSupport {
ComponentVerifierExtension.Result result = verifier.verify(ComponentVerifierExtension.Scope.CONNECTIVITY, parameters);
- Assert.assertEquals(ComponentVerifierExtension.Result.Status.ERROR, result.getStatus());
+ assertEquals(ComponentVerifierExtension.Result.Status.ERROR, result.getStatus());
}
}
diff --git a/components/camel-aws2-s3/src/test/java/org/apache/camel/component/aws2/s3/integration/S3ComponentIntegrationTest.java b/components/camel-aws2-s3/src/test/java/org/apache/camel/component/aws2/s3/integration/S3ComponentIntegrationTest.java
index c45f67c..0bbad7f 100644
--- a/components/camel-aws2-s3/src/test/java/org/apache/camel/component/aws2/s3/integration/S3ComponentIntegrationTest.java
+++ b/components/camel-aws2-s3/src/test/java/org/apache/camel/component/aws2/s3/integration/S3ComponentIntegrationTest.java
@@ -16,6 +16,11 @@
*/
package org.apache.camel.component.aws2.s3.integration;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertNull;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+
import org.apache.camel.EndpointInject;
import org.apache.camel.Exchange;
import org.apache.camel.ExchangePattern;
@@ -25,11 +30,12 @@ import org.apache.camel.ProducerTemplate;
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.component.aws2.s3.AWS2S3Constants;
import org.apache.camel.component.mock.MockEndpoint;
-import org.apache.camel.test.junit4.CamelTestSupport;
-import org.junit.Ignore;
-import org.junit.Test;
+import org.apache.camel.test.junit5.CamelTestSupport;
+import org.junit.jupiter.api.Disabled;
+import org.junit.jupiter.api.Test;
+
-@Ignore("Must be manually tested. Provide your own accessKey and secretKey!")
+@Disabled("Must be manually tested. Provide your own accessKey and secretKey!")
public class S3ComponentIntegrationTest extends CamelTestSupport {
@EndpointInject("direct:start")
@@ -84,7 +90,6 @@ public class S3ComponentIntegrationTest extends CamelTestSupport {
}
private void assertResultExchange(Exchange resultExchange) {
- assertIsInstanceOf(String.class, resultExchange.getIn().getBody());
assertEquals("This is my bucket content.", resultExchange.getIn().getBody(String.class));
assertEquals("mycamelbucket", resultExchange.getIn().getHeader(AWS2S3Constants.BUCKET_NAME));
assertTrue(resultExchange.getIn().getHeader(AWS2S3Constants.KEY, String.class).startsWith("CamelUnitTest"));
diff --git a/components/camel-aws2-s3/src/test/java/org/apache/camel/component/aws2/s3/integration/S3CopyObjectOperationIntegrationTest.java b/components/camel-aws2-s3/src/test/java/org/apache/camel/component/aws2/s3/integration/S3CopyObjectOperationIntegrationTest.java
index ee5502d..dfb9b24 100644
--- a/components/camel-aws2-s3/src/test/java/org/apache/camel/component/aws2/s3/integration/S3CopyObjectOperationIntegrationTest.java
+++ b/components/camel-aws2-s3/src/test/java/org/apache/camel/component/aws2/s3/integration/S3CopyObjectOperationIntegrationTest.java
@@ -25,15 +25,16 @@ import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.component.aws2.s3.AWS2S3Constants;
import org.apache.camel.component.aws2.s3.AWS2S3Operations;
import org.apache.camel.component.mock.MockEndpoint;
-import org.apache.camel.test.junit4.CamelTestSupport;
-import org.junit.Ignore;
-import org.junit.Test;
+import org.apache.camel.test.junit5.CamelTestSupport;
+import org.junit.jupiter.api.Disabled;
+import org.junit.jupiter.api.Test;
+
import software.amazon.awssdk.auth.credentials.AwsBasicCredentials;
import software.amazon.awssdk.auth.credentials.StaticCredentialsProvider;
import software.amazon.awssdk.regions.Region;
import software.amazon.awssdk.services.s3.S3Client;
-@Ignore("Must be manually tested. Provide your own accessKey and secretKey!")
+@Disabled("Must be manually tested. Provide your own accessKey and secretKey!")
public class S3CopyObjectOperationIntegrationTest extends CamelTestSupport {
@BindToRegistry("amazonS3Client")
diff --git a/components/camel-aws2-s3/src/test/java/org/apache/camel/component/aws2/s3/integration/S3DeleteBucketOperationIntegrationTest.java b/components/camel-aws2-s3/src/test/java/org/apache/camel/component/aws2/s3/integration/S3DeleteBucketOperationIntegrationTest.java
index 52c3a1c..124a571 100644
--- a/components/camel-aws2-s3/src/test/java/org/apache/camel/component/aws2/s3/integration/S3DeleteBucketOperationIntegrationTest.java
+++ b/components/camel-aws2-s3/src/test/java/org/apache/camel/component/aws2/s3/integration/S3DeleteBucketOperationIntegrationTest.java
@@ -25,15 +25,16 @@ import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.component.aws2.s3.AWS2S3Constants;
import org.apache.camel.component.aws2.s3.AWS2S3Operations;
import org.apache.camel.component.mock.MockEndpoint;
-import org.apache.camel.test.junit4.CamelTestSupport;
-import org.junit.Ignore;
-import org.junit.Test;
+import org.apache.camel.test.junit5.CamelTestSupport;
+import org.junit.jupiter.api.Disabled;
+import org.junit.jupiter.api.Test;
+
import software.amazon.awssdk.auth.credentials.AwsBasicCredentials;
import software.amazon.awssdk.auth.credentials.StaticCredentialsProvider;
import software.amazon.awssdk.regions.Region;
import software.amazon.awssdk.services.s3.S3Client;
-@Ignore("Must be manually tested. Provide your own accessKey and secretKey!")
+@Disabled("Must be manually tested. Provide your own accessKey and secretKey!")
public class S3DeleteBucketOperationIntegrationTest extends CamelTestSupport {
@BindToRegistry("amazonS3Client")
diff --git a/components/camel-aws2-s3/src/test/java/org/apache/camel/component/aws2/s3/integration/S3ListObjectsOperationIntegrationTest.java b/components/camel-aws2-s3/src/test/java/org/apache/camel/component/aws2/s3/integration/S3ListObjectsOperationIntegrationTest.java
index 0342cd9..3738a52 100644
--- a/components/camel-aws2-s3/src/test/java/org/apache/camel/component/aws2/s3/integration/S3ListObjectsOperationIntegrationTest.java
+++ b/components/camel-aws2-s3/src/test/java/org/apache/camel/component/aws2/s3/integration/S3ListObjectsOperationIntegrationTest.java
@@ -16,6 +16,8 @@
*/
package org.apache.camel.component.aws2.s3.integration;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+
import java.util.List;
import org.apache.camel.BindToRegistry;
@@ -28,16 +30,17 @@ import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.component.aws2.s3.AWS2S3Constants;
import org.apache.camel.component.aws2.s3.AWS2S3Operations;
import org.apache.camel.component.mock.MockEndpoint;
-import org.apache.camel.test.junit4.CamelTestSupport;
-import org.junit.Ignore;
-import org.junit.Test;
+import org.apache.camel.test.junit5.CamelTestSupport;
+import org.junit.jupiter.api.Disabled;
+import org.junit.jupiter.api.Test;
+
import software.amazon.awssdk.auth.credentials.AwsBasicCredentials;
import software.amazon.awssdk.auth.credentials.StaticCredentialsProvider;
import software.amazon.awssdk.regions.Region;
import software.amazon.awssdk.services.s3.S3Client;
import software.amazon.awssdk.services.s3.model.S3Object;
-@Ignore("Must be manually tested. Provide your own accessKey and secretKey!")
+@Disabled("Must be manually tested. Provide your own accessKey and secretKey!")
public class S3ListObjectsOperationIntegrationTest extends CamelTestSupport {
@BindToRegistry("amazonS3Client")
diff --git a/components/camel-aws2-s3/src/test/java/org/apache/camel/component/aws2/s3/integration/S3MultipartUploadOperationIntegrationTest.java b/components/camel-aws2-s3/src/test/java/org/apache/camel/component/aws2/s3/integration/S3MultipartUploadOperationIntegrationTest.java
index aed2710..8fb3d27 100644
--- a/components/camel-aws2-s3/src/test/java/org/apache/camel/component/aws2/s3/integration/S3MultipartUploadOperationIntegrationTest.java
+++ b/components/camel-aws2-s3/src/test/java/org/apache/camel/component/aws2/s3/integration/S3MultipartUploadOperationIntegrationTest.java
@@ -26,15 +26,16 @@ import org.apache.camel.ProducerTemplate;
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.component.aws2.s3.AWS2S3Constants;
import org.apache.camel.component.mock.MockEndpoint;
-import org.apache.camel.test.junit4.CamelTestSupport;
-import org.junit.Ignore;
-import org.junit.Test;
+import org.apache.camel.test.junit5.CamelTestSupport;
+import org.junit.jupiter.api.Disabled;
+import org.junit.jupiter.api.Test;
+
import software.amazon.awssdk.auth.credentials.AwsBasicCredentials;
import software.amazon.awssdk.auth.credentials.StaticCredentialsProvider;
import software.amazon.awssdk.regions.Region;
import software.amazon.awssdk.services.s3.S3Client;
-@Ignore("Must be manually tested. Provide your own accessKey and secretKey!")
+@Disabled("Must be manually tested. Provide your own accessKey and secretKey!")
public class S3MultipartUploadOperationIntegrationTest extends CamelTestSupport {
@BindToRegistry("amazonS3Client")
diff --git a/components/camel-aws2-s3/src/test/java/org/apache/camel/component/aws2/s3/integration/S3ObjectRangeOperationIntegrationTest.java b/components/camel-aws2-s3/src/test/java/org/apache/camel/component/aws2/s3/integration/S3ObjectRangeOperationIntegrationTest.java
index b864077..91e7e38 100644
--- a/components/camel-aws2-s3/src/test/java/org/apache/camel/component/aws2/s3/integration/S3ObjectRangeOperationIntegrationTest.java
+++ b/components/camel-aws2-s3/src/test/java/org/apache/camel/component/aws2/s3/integration/S3ObjectRangeOperationIntegrationTest.java
@@ -31,9 +31,9 @@ import org.apache.camel.ProducerTemplate;
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.component.aws2.s3.AWS2S3Constants;
import org.apache.camel.component.mock.MockEndpoint;
-import org.apache.camel.test.junit4.CamelTestSupport;
-import org.junit.Ignore;
-import org.junit.Test;
+import org.apache.camel.test.junit5.CamelTestSupport;
+import org.junit.jupiter.api.Disabled;
+import org.junit.jupiter.api.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import software.amazon.awssdk.auth.credentials.AwsBasicCredentials;
@@ -43,7 +43,7 @@ import software.amazon.awssdk.regions.Region;
import software.amazon.awssdk.services.s3.S3Client;
import software.amazon.awssdk.services.s3.model.GetObjectResponse;
-@Ignore("Must be manually tested. Provide your own accessKey and secretKey!")
+@Disabled("Must be manually tested. Provide your own accessKey and secretKey!")
public class S3ObjectRangeOperationIntegrationTest extends CamelTestSupport {
private static final Logger LOG = LoggerFactory.getLogger(S3ObjectRangeOperationIntegrationTest.class);