From 94be0342bff70f9e470236076b4be68382af6ef9 Mon Sep 17 00:00:00 2001 From: dblock Date: Mon, 28 Feb 2022 19:46:32 +0000 Subject: [PATCH] Run CI/CD on Java 8, 11, 14 and 17. Signed-off-by: dblock --- .github/workflows/ci.yml | 6 +++++- .../org/opensearch/commons/InjectSecurityTest.java | 14 +++++++++++--- 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c35e0c0a..8c295255 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -11,7 +11,11 @@ jobs: build: strategy: matrix: - java: [14] + java: + - 8 + - 11 + - 14 + - 17 name: Build and Test runs-on: ubuntu-latest diff --git a/src/test/java/org/opensearch/commons/InjectSecurityTest.java b/src/test/java/org/opensearch/commons/InjectSecurityTest.java index 5a69de07..818aa9c7 100644 --- a/src/test/java/org/opensearch/commons/InjectSecurityTest.java +++ b/src/test/java/org/opensearch/commons/InjectSecurityTest.java @@ -15,7 +15,7 @@ import static org.opensearch.commons.ConfigConstants.OPENSEARCH_SECURITY_USE_INJECTED_USER_FOR_PLUGINS; import java.util.Arrays; -import java.util.Map; +import java.util.HashMap; import org.junit.jupiter.api.Test; import org.opensearch.common.settings.Settings; @@ -114,7 +114,11 @@ public void testInjectProperty() { assertTrue(helper.injectProperty("property1", true)); assertTrue(helper.injectProperty("property2", "some value")); assertTrue(helper.injectProperty("property3", "")); - assertTrue(helper.injectProperty("property4", Map.of("key", "value"))); + assertTrue(helper.injectProperty("property4", new HashMap() { + { + put("key", "value"); + } + })); // verify the set properties are not null and equal to what was set assertNull(threadContext.getTransient("property")); assertNotNull(threadContext.getTransient("property1")); @@ -124,7 +128,11 @@ public void testInjectProperty() { assertNotNull(threadContext.getTransient("property3")); assertEquals("", threadContext.getTransient("property3")); assertNotNull(threadContext.getTransient("property4")); - assertEquals(Map.of("key", "value"), threadContext.getTransient("property4")); + assertEquals(new HashMap() { + { + put("key", "value"); + } + }, threadContext.getTransient("property4")); } assertEquals("1", threadContext.getHeader("default")); assertEquals("opendistro", threadContext.getHeader("name"));