From 44bf3e8b3269c80ed025711706e1091e10a90747 Mon Sep 17 00:00:00 2001 From: Stefano Fornari Date: Sun, 9 Jul 2023 10:46:08 +0200 Subject: [PATCH 1/7] - Adding AssertJ - Bumping java to 16 otherwise I had an error with logback - added some more builder/IDE files to ignore --- .gitignore | 3 +++ THIRD-PARTY | 1 + build.gradle | 7 +++--- .../s3/config/S3NioSpiConfigurationTest.java | 25 +++++++++++++------ 4 files changed, 25 insertions(+), 11 deletions(-) diff --git a/.gitignore b/.gitignore index 798f0816..643be44b 100644 --- a/.gitignore +++ b/.gitignore @@ -1,11 +1,14 @@ # Ignore Gradle project-specific cache directory .gradle .idea +.vscode gradle gradle.properties # Ignore Gradle build output directory build +bin +target #MacOS .DS_Store diff --git a/THIRD-PARTY b/THIRD-PARTY index 442da8a0..5e942444 100644 --- a/THIRD-PARTY +++ b/THIRD-PARTY @@ -1,6 +1,7 @@ The Amazon AWS Java NIO SPI for S3 Product includes the following third-party software/licensing: ** Junit 4.x -- https://junit.org/junit4/ +** AssertJ 3.x -- https://assertj.github.io/ ** Logback Classic 1.2.x -- https://logback.qos.ch/ -- Copyright © 2021 QOS.ch ** Logback Core 1.2.x -- https://logback.qos.ch/ -- Copyright © 2021 QOS.ch diff --git a/build.gradle b/build.gradle index 44dec322..f52c990c 100644 --- a/build.gradle +++ b/build.gradle @@ -25,8 +25,8 @@ archivesBaseName = 'nio-spi-for-s3' version = '1.2.3' apply plugin: 'java' -sourceCompatibility = 1.8 -targetCompatibility = 1.8 +sourceCompatibility = 16 +targetCompatibility = 16 java { @@ -36,7 +36,7 @@ java { compileJava { // see https://docs.gradle.org/6.6/userguide/building_java_projects.html#sec:java_cross_compilation - options.release = 8 + options.release = 16 } dependencies { @@ -46,6 +46,7 @@ dependencies { // Use JUnit test framework. testImplementation 'junit:junit:4.13.2' testImplementation 'org.mockito:mockito-core:5.4.0' + testImplementation 'org.assertj:assertj-core:3.24.2' implementation platform('software.amazon.awssdk:bom:2.20.99') diff --git a/src/test/java/software/amazon/nio/spi/s3/config/S3NioSpiConfigurationTest.java b/src/test/java/software/amazon/nio/spi/s3/config/S3NioSpiConfigurationTest.java index 10840655..a5c49b84 100644 --- a/src/test/java/software/amazon/nio/spi/s3/config/S3NioSpiConfigurationTest.java +++ b/src/test/java/software/amazon/nio/spi/s3/config/S3NioSpiConfigurationTest.java @@ -11,6 +11,9 @@ import java.util.Properties; import static org.junit.Assert.*; +import static org.assertj.core.api.BDDAssertions.then; + +import static software.amazon.nio.spi.s3.config.S3NioSpiConfiguration.*; public class S3NioSpiConfigurationTest { @@ -22,29 +25,35 @@ public class S3NioSpiConfigurationTest { @Before public void setup(){ - overrides.setProperty(S3NioSpiConfiguration.S3_SPI_READ_MAX_FRAGMENT_SIZE_PROPERTY, "1111"); - overrides.setProperty(S3NioSpiConfiguration.S3_SPI_READ_MAX_FRAGMENT_NUMBER_PROPERTY, "2"); + overrides.setProperty(S3_SPI_READ_MAX_FRAGMENT_SIZE_PROPERTY, "1111"); + overrides.setProperty(S3_SPI_READ_MAX_FRAGMENT_NUMBER_PROPERTY, "2"); overriddenConfig = new S3NioSpiConfiguration(overrides); - badOverrides.setProperty(S3NioSpiConfiguration.S3_SPI_READ_MAX_FRAGMENT_NUMBER_PROPERTY, "abcd"); - badOverrides.setProperty(S3NioSpiConfiguration.S3_SPI_READ_MAX_FRAGMENT_SIZE_PROPERTY, "abcd"); + badOverrides.setProperty(S3_SPI_READ_MAX_FRAGMENT_NUMBER_PROPERTY, "abcd"); + badOverrides.setProperty(S3_SPI_READ_MAX_FRAGMENT_SIZE_PROPERTY, "abcd"); badOverriddenConfig = new S3NioSpiConfiguration(badOverrides); } + @Test + public void constructors() { + then(String.valueOf(config.getMaxFragmentNumber())).isEqualTo(S3_SPI_READ_MAX_FRAGMENT_NUMBER_DEFAULT); + then(String.valueOf(config.getMaxFragmentSize())).isEqualTo(S3_SPI_READ_MAX_FRAGMENT_SIZE_DEFAULT); + } + @Test public void getS3SpiReadMaxFragmentSize() { - assertEquals(Integer.parseInt(S3NioSpiConfiguration.S3_SPI_READ_MAX_FRAGMENT_SIZE_DEFAULT), config.getMaxFragmentSize()); + assertEquals(Integer.parseInt(S3_SPI_READ_MAX_FRAGMENT_SIZE_DEFAULT), config.getMaxFragmentSize()); assertEquals(1111, overriddenConfig.getMaxFragmentSize()); - assertEquals(Integer.parseInt(S3NioSpiConfiguration.S3_SPI_READ_MAX_FRAGMENT_SIZE_DEFAULT), badOverriddenConfig.getMaxFragmentSize()); + assertEquals(Integer.parseInt(S3_SPI_READ_MAX_FRAGMENT_SIZE_DEFAULT), badOverriddenConfig.getMaxFragmentSize()); } @Test public void getS3SpiReadMaxFragmentNumber() { - assertEquals(Integer.parseInt(S3NioSpiConfiguration.S3_SPI_READ_MAX_FRAGMENT_NUMBER_DEFAULT), config.getMaxFragmentNumber()); + assertEquals(Integer.parseInt(S3_SPI_READ_MAX_FRAGMENT_NUMBER_DEFAULT), config.getMaxFragmentNumber()); assertEquals(2, overriddenConfig.getMaxFragmentNumber()); - assertEquals(Integer.parseInt(S3NioSpiConfiguration.S3_SPI_READ_MAX_FRAGMENT_NUMBER_DEFAULT), badOverriddenConfig.getMaxFragmentNumber()); + assertEquals(Integer.parseInt(S3_SPI_READ_MAX_FRAGMENT_NUMBER_DEFAULT), badOverriddenConfig.getMaxFragmentNumber()); } @Test From c7eafa5a87b243f6123fe1c7d59e9788e50f1218 Mon Sep 17 00:00:00 2001 From: Stefano Fornari Date: Sun, 9 Jul 2023 10:55:52 +0200 Subject: [PATCH 2/7] cleanup --- .gitignore | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index 643be44b..0ea32e23 100644 --- a/.gitignore +++ b/.gitignore @@ -1,14 +1,18 @@ # Ignore Gradle project-specific cache directory .gradle .idea -.vscode gradle gradle.properties # Ignore Gradle build output directory build bin + +# Ignore maven build output target -#MacOS +# Ignore other IDEs files +.vscode + +# MacOS .DS_Store From 768ae71bd185cb086c3e16493c870cb98dc1f946 Mon Sep 17 00:00:00 2001 From: Stefano Fornari Date: Sun, 9 Jul 2023 11:18:11 +0200 Subject: [PATCH 3/7] trying 11... --- build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.gradle b/build.gradle index f52c990c..99681f58 100644 --- a/build.gradle +++ b/build.gradle @@ -36,7 +36,7 @@ java { compileJava { // see https://docs.gradle.org/6.6/userguide/building_java_projects.html#sec:java_cross_compilation - options.release = 16 + options.release = 11 } dependencies { From 8535ed61866f6bac11173a632eec3cd7de8e05f1 Mon Sep 17 00:00:00 2001 From: Stefano Fornari Date: Sun, 9 Jul 2023 11:23:04 +0200 Subject: [PATCH 4/7] reverting to 1.8 --- build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.gradle b/build.gradle index 99681f58..c3a9c34b 100644 --- a/build.gradle +++ b/build.gradle @@ -36,7 +36,7 @@ java { compileJava { // see https://docs.gradle.org/6.6/userguide/building_java_projects.html#sec:java_cross_compilation - options.release = 11 + options.release = 1.8 } dependencies { From 4f95d122981ec356138c05e3cef3bdc644144c0f Mon Sep 17 00:00:00 2001 From: Stefano Fornari Date: Sun, 9 Jul 2023 11:26:38 +0200 Subject: [PATCH 5/7] reverting to 1.8 --- build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.gradle b/build.gradle index c3a9c34b..fcc152dd 100644 --- a/build.gradle +++ b/build.gradle @@ -36,7 +36,7 @@ java { compileJava { // see https://docs.gradle.org/6.6/userguide/building_java_projects.html#sec:java_cross_compilation - options.release = 1.8 + options.release = 8 } dependencies { From 8415e4259db23869fa577bc5e371ee435c375ae1 Mon Sep 17 00:00:00 2001 From: Stefano Fornari Date: Sun, 9 Jul 2023 12:27:05 +0200 Subject: [PATCH 6/7] Revert "Auxiliary commit to revert individual files from 44bf3e8b3269c80ed025711706e1091e10a90747" This reverts commit 2697125d74b4c9bb0fb5c06be847cdb3531d569c. --- build.gradle | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/build.gradle b/build.gradle index fcc152dd..44dec322 100644 --- a/build.gradle +++ b/build.gradle @@ -25,8 +25,8 @@ archivesBaseName = 'nio-spi-for-s3' version = '1.2.3' apply plugin: 'java' -sourceCompatibility = 16 -targetCompatibility = 16 +sourceCompatibility = 1.8 +targetCompatibility = 1.8 java { @@ -46,7 +46,6 @@ dependencies { // Use JUnit test framework. testImplementation 'junit:junit:4.13.2' testImplementation 'org.mockito:mockito-core:5.4.0' - testImplementation 'org.assertj:assertj-core:3.24.2' implementation platform('software.amazon.awssdk:bom:2.20.99') From c7ef382da2976049d960ec0a1d88ab4fac0e7e1d Mon Sep 17 00:00:00 2001 From: Stefano Fornari Date: Sun, 9 Jul 2023 12:30:38 +0200 Subject: [PATCH 7/7] adding Assertj --- build.gradle | 1 + 1 file changed, 1 insertion(+) diff --git a/build.gradle b/build.gradle index 44dec322..3440f0fa 100644 --- a/build.gradle +++ b/build.gradle @@ -46,6 +46,7 @@ dependencies { // Use JUnit test framework. testImplementation 'junit:junit:4.13.2' testImplementation 'org.mockito:mockito-core:5.4.0' + testImplementation 'org.assertj:assertj-core:3.24.2' implementation platform('software.amazon.awssdk:bom:2.20.99')