From 0590b425ca82c393f288ab5d9be760f39ed9c1bc Mon Sep 17 00:00:00 2001 From: Dai MIKURUBE Date: Thu, 17 Aug 2023 16:25:34 +0900 Subject: [PATCH 1/3] Test with multiple Jackson versions --- .github/workflows/check.yml | 6 ++++-- build.gradle | 18 ++++++++++++++++++ 2 files changed, 22 insertions(+), 2 deletions(-) diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml index fe41fb0..5e3ab3a 100644 --- a/.github/workflows/check.yml +++ b/.github/workflows/check.yml @@ -8,6 +8,8 @@ jobs: if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name != github.repository strategy: fail-fast: false + matrix: + jacksonVersion: [ "2.6.7.5", "2.7.9", "2.8.11", "2.9.10", "2.10.5", "2.11.4", "2.12.7", "2.13.5", "2.14.3", "2.15.2" ] steps: - uses: actions/checkout@v3 - name: Set up OpenJDK 8 @@ -16,5 +18,5 @@ jobs: java-version: 8 distribution: "temurin" cache: "gradle" - - name: Check - run: ./gradlew --stacktrace check + - name: Check with Jackson ${{ matrix.jacksonVersion }} + run: ./gradlew --stacktrace -PjacksonVersionForJacksonTest=${{ matrix.jacksonVersion }} check diff --git a/build.gradle b/build.gradle index f5e11f6..4f58038 100644 --- a/build.gradle +++ b/build.gradle @@ -6,6 +6,12 @@ plugins { id "checkstyle" } +ext { + if (!project.hasProperty("jacksonVersionForJacksonTest")) { + jacksonVersionForJacksonTest = "2.6.7" + } +} + repositories { mavenCentral() } @@ -72,12 +78,24 @@ dependencies { testImplementation "joda-time:joda-time:2.9.2" testImplementation "ch.qos.logback:logback-classic:1.3.5" + testImplementation platform("com.fasterxml.jackson:jackson-bom:$jacksonVersionForJacksonTest") + testImplementation "com.fasterxml.jackson.core:jackson-annotations" + testImplementation "com.fasterxml.jackson.core:jackson-core" + testImplementation "com.fasterxml.jackson.core:jackson-databind" + testImplementation "com.fasterxml.jackson.datatype:jackson-datatype-jdk8" // Required for java.util.Optional. + legacyTestImplementation "junit:junit:4.13.2" legacyTestImplementation "org.embulk:embulk-core:0.10.44" legacyTestImplementation "org.embulk:embulk-deps:0.10.44" legacyTestImplementation "org.embulk:embulk-junit4:0.10.44" legacyTestImplementation "ch.qos.logback:logback-classic:1.3.5" + + legacyTestImplementation platform("com.fasterxml.jackson:jackson-bom:$jacksonVersionForJacksonTest") + legacyTestImplementation "com.fasterxml.jackson.core:jackson-annotations" + legacyTestImplementation "com.fasterxml.jackson.core:jackson-core" + legacyTestImplementation "com.fasterxml.jackson.core:jackson-databind" + legacyTestImplementation "com.fasterxml.jackson.datatype:jackson-datatype-jdk8" // Required for java.util.Optional. } javadoc { From ae41f3d4f451cf6b80836465c8ae135b909e04f9 Mon Sep 17 00:00:00 2001 From: Dai MIKURUBE Date: Wed, 23 Aug 2023 15:23:44 +0900 Subject: [PATCH 2/3] Fix tests to match the causes, not the Exception messages --- .../java/org/embulk/util/config/TestDataSourceImpl.java | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/src/test/java/org/embulk/util/config/TestDataSourceImpl.java b/src/test/java/org/embulk/util/config/TestDataSourceImpl.java index 6e9b8c3..5ab495c 100644 --- a/src/test/java/org/embulk/util/config/TestDataSourceImpl.java +++ b/src/test/java/org/embulk/util/config/TestDataSourceImpl.java @@ -58,9 +58,7 @@ public void testFailToGetNestedAsList() { try { impl.get(List.class, "object"); } catch (final ConfigException ex) { - assertTrue(ex.getMessage().startsWith( - "com.fasterxml.jackson.databind.JsonMappingException: " - + "Can not deserialize instance of java.util.ArrayList out of START_OBJECT token")); + assertTrue(ex.getCause() instanceof com.fasterxml.jackson.core.JsonProcessingException); return; } fail("ConfigException should be thrown by getting a String value as a List."); @@ -72,9 +70,7 @@ public void testFailToGetStringAsList() { try { impl.get(List.class, "string"); } catch (final ConfigException ex) { - assertTrue(ex.getMessage().startsWith( - "com.fasterxml.jackson.databind.JsonMappingException: " - + "Can not deserialize instance of java.util.ArrayList out of VALUE_STRING token")); + assertTrue(ex.getCause() instanceof com.fasterxml.jackson.core.JsonProcessingException); return; } fail("ConfigException should be thrown by getting a String value as a List."); From 6f4f237c0e27a3434520ff0a1ca643b499fea7a8 Mon Sep 17 00:00:00 2001 From: Dai MIKURUBE Date: Fri, 25 Aug 2023 10:39:16 +0900 Subject: [PATCH 3/3] Set the default jacksonVersionForJacksonTest to 2.6.7.5 --- build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.gradle b/build.gradle index 4f58038..9e28a07 100644 --- a/build.gradle +++ b/build.gradle @@ -8,7 +8,7 @@ plugins { ext { if (!project.hasProperty("jacksonVersionForJacksonTest")) { - jacksonVersionForJacksonTest = "2.6.7" + jacksonVersionForJacksonTest = "2.6.7.5" } }