diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index a40eb3c58..6f7007b96 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -11,7 +11,7 @@ jobs: Build-ad: strategy: matrix: - java: [8, 11, 14] + java: [11, 14] fail-fast: false name: Build and Test Anomaly detection Plugin diff --git a/build.gradle b/build.gradle index 0d1b20793..f457795c2 100644 --- a/build.gradle +++ b/build.gradle @@ -79,7 +79,7 @@ allprojects { } plugins.withId('java') { - sourceCompatibility = targetCompatibility = "1.8" + sourceCompatibility = targetCompatibility = JavaVersion.VERSION_11 } } diff --git a/src/test/java/org/opensearch/action/admin/indices/mapping/get/IndexAnomalyDetectorActionHandlerTests.java b/src/test/java/org/opensearch/action/admin/indices/mapping/get/IndexAnomalyDetectorActionHandlerTests.java index 1c1c792bc..d9e0eb35a 100644 --- a/src/test/java/org/opensearch/action/admin/indices/mapping/get/IndexAnomalyDetectorActionHandlerTests.java +++ b/src/test/java/org/opensearch/action/admin/indices/mapping/get/IndexAnomalyDetectorActionHandlerTests.java @@ -29,7 +29,6 @@ import java.util.concurrent.atomic.AtomicBoolean; import org.junit.AfterClass; -import org.junit.Assume; import org.junit.Before; import org.junit.BeforeClass; import org.junit.Ignore; @@ -182,8 +181,6 @@ public void testThreeCategoricalFields() throws IOException { @SuppressWarnings("unchecked") public void testMoreThanTenThousandSingleEntityDetectors() throws IOException { - Assume.assumeFalse(System.getProperty("java.specification.version").compareTo("1.8") == 0); - SearchResponse mockResponse = mock(SearchResponse.class); int totalHits = 1001; when(mockResponse.getHits()).thenReturn(TestHelpers.createSearchHits(totalHits)); @@ -538,8 +535,6 @@ public void doE @SuppressWarnings("unchecked") public void testMoreThanTenMultiEntityDetectors() throws IOException { - Assume.assumeFalse(System.getProperty("java.specification.version").compareTo("1.8") == 0); - String field = "a"; AnomalyDetector detector = TestHelpers.randomAnomalyDetectorUsingCategoryFields(detectorId, Arrays.asList(field)); SearchResponse detectorResponse = mock(SearchResponse.class); diff --git a/src/test/java/org/opensearch/action/admin/indices/mapping/get/ValidateAnomalyDetectorActionHandlerTests.java b/src/test/java/org/opensearch/action/admin/indices/mapping/get/ValidateAnomalyDetectorActionHandlerTests.java index 98829cd85..f9923541f 100644 --- a/src/test/java/org/opensearch/action/admin/indices/mapping/get/ValidateAnomalyDetectorActionHandlerTests.java +++ b/src/test/java/org/opensearch/action/admin/indices/mapping/get/ValidateAnomalyDetectorActionHandlerTests.java @@ -24,7 +24,6 @@ import java.util.Arrays; import java.util.Locale; -import org.junit.Assume; import org.junit.Before; import org.mockito.ArgumentCaptor; import org.mockito.Mock; @@ -126,8 +125,6 @@ public void setUp() throws Exception { @SuppressWarnings("unchecked") public void testValidateMoreThanThousandSingleEntityDetectorLimit() throws IOException { - Assume.assumeFalse(System.getProperty("java.specification.version").compareTo("1.8") == 0); - SearchResponse mockResponse = mock(SearchResponse.class); int totalHits = maxSingleEntityAnomalyDetectors + 1; when(mockResponse.getHits()).thenReturn(TestHelpers.createSearchHits(totalHits)); @@ -208,8 +205,6 @@ public void testValidateMoreThanThousandSingleEntityDetectorLimit() throws IOExc @SuppressWarnings("unchecked") public void testValidateMoreThanTenMultiEntityDetectorsLimit() throws IOException { - Assume.assumeFalse(System.getProperty("java.specification.version").compareTo("1.8") == 0); - String field = "a"; AnomalyDetector detector = TestHelpers.randomAnomalyDetectorUsingCategoryFields(detectorId, Arrays.asList(field)); diff --git a/src/test/java/org/opensearch/ad/transport/ADBatchAnomalyResultTransportActionTests.java b/src/test/java/org/opensearch/ad/transport/ADBatchAnomalyResultTransportActionTests.java index 56e6c33fe..3178e8681 100644 --- a/src/test/java/org/opensearch/ad/transport/ADBatchAnomalyResultTransportActionTests.java +++ b/src/test/java/org/opensearch/ad/transport/ADBatchAnomalyResultTransportActionTests.java @@ -21,7 +21,6 @@ import java.time.temporal.ChronoUnit; import java.util.concurrent.TimeUnit; -import org.junit.Assume; import org.junit.Before; import org.opensearch.action.ActionRequestValidationException; import org.opensearch.action.get.GetResponse; @@ -149,8 +148,6 @@ public void testDisableADPlugin() throws IOException { } public void testMultipleTasks() throws IOException, InterruptedException { - Assume.assumeFalse(System.getProperty("java.specification.version").compareTo("1.8") == 0); - updateTransientSettings(ImmutableMap.of(MAX_BATCH_TASK_PER_NODE.getKey(), 2)); DetectionDateRange dateRange = new DetectionDateRange(startTime, endTime); diff --git a/src/test/java/org/opensearch/ad/transport/AnomalyDetectorJobTransportActionTests.java b/src/test/java/org/opensearch/ad/transport/AnomalyDetectorJobTransportActionTests.java index b70c2aac7..ee9060207 100644 --- a/src/test/java/org/opensearch/ad/transport/AnomalyDetectorJobTransportActionTests.java +++ b/src/test/java/org/opensearch/ad/transport/AnomalyDetectorJobTransportActionTests.java @@ -35,7 +35,6 @@ import java.util.stream.Collectors; import org.junit.After; -import org.junit.Assume; import org.junit.Before; import org.junit.Ignore; import org.opensearch.OpenSearchStatusException; @@ -144,8 +143,6 @@ public void testStartHistoricalAnalysisWithUser() throws IOException { } public void testStartHistoricalAnalysisForSingleCategoryHCWithUser() throws IOException, InterruptedException { - Assume.assumeFalse(System.getProperty("java.specification.version").compareTo("1.8") == 0); - ingestTestData(testIndex, startTime, detectionIntervalInMinutes, type + "1", DEFAULT_IP, 2000, false); ingestTestData(testIndex, startTime, detectionIntervalInMinutes, type + "2", DEFAULT_IP, 2000, false); AnomalyDetector detector = TestHelpers @@ -195,9 +192,6 @@ public void testStartHistoricalAnalysisForSingleCategoryHCWithUser() throws IOEx } public void testStartHistoricalAnalysisForMultiCategoryHCWithUser() throws IOException, InterruptedException { - // TODO: this test consistently fails on JDK8 only (too slow?), but passes on JDK11+ - Assume.assumeFalse(System.getProperty("java.specification.version").compareTo("1.8") == 0); - ingestTestData(testIndex, startTime, detectionIntervalInMinutes, type + "1", DEFAULT_IP, 2000, false); ingestTestData(testIndex, startTime, detectionIntervalInMinutes, type + "2", DEFAULT_IP, 2000, false); ingestTestData(testIndex, startTime, detectionIntervalInMinutes, type + "3", "127.0.0.2", 2000, false);