浏览代码

Remove use of Joda from test framework (#78851)

The test base class ESTestCase provides methods to get a random
timezone. It has methods for Joda, java.time and java.util timezones.
This commit reworks the test helper methods to no longer use Joda. Due
to backcompat tests for sql, the random timezones need to be limited to
those that are still useable by Joda. To filter the available timezones
not available in Joda, the unsupported timezone ids are hardcoded in
testcase initialization.
Ryan Ernst 4 年之前
父节点
当前提交
61ed2e7515

+ 1 - 1
client/rest-high-level/src/test/java/org/elasticsearch/client/rollup/job/config/DateHistogramGroupConfigTests.java

@@ -80,7 +80,7 @@ public class DateHistogramGroupConfigTests extends AbstractXContentTestCase<Date
     static DateHistogramGroupConfig randomDateHistogramGroupConfig() {
         final String field = randomAlphaOfLength(randomIntBetween(3, 10));
         final DateHistogramInterval delay = randomBoolean() ? new DateHistogramInterval(randomPositiveTimeValue()) : null;
-        final String timezone = randomBoolean() ? randomDateTimeZone().toString() : null;
+        final String timezone = randomBoolean() ? randomZone().toString() : null;
         int i = randomIntBetween(0,2);
         final DateHistogramInterval interval;
         switch (i) {

+ 0 - 33
server/src/test/java/org/elasticsearch/common/time/DateUtilsTests.java

@@ -9,20 +9,15 @@
 package org.elasticsearch.common.time;
 
 import org.elasticsearch.test.ESTestCase;
-import org.joda.time.DateTimeZone;
 
 import java.time.Instant;
 import java.time.LocalDate;
 import java.time.Month;
 import java.time.Year;
 import java.time.YearMonth;
-import java.time.ZoneId;
 import java.time.ZoneOffset;
 import java.time.ZonedDateTime;
 import java.time.temporal.ChronoField;
-import java.util.Arrays;
-import java.util.HashSet;
-import java.util.Set;
 
 import static org.elasticsearch.common.time.DateUtils.clampToNanosRange;
 import static org.elasticsearch.common.time.DateUtils.toInstant;
@@ -34,34 +29,6 @@ import static org.hamcrest.Matchers.equalTo;
 import static org.hamcrest.Matchers.is;
 
 public class DateUtilsTests extends ESTestCase {
-    // list of ignored timezones.
-    // These should be cleaned up when all tested jdks (oracle, adoptopenjdk, openjdk etc) have the timezone db included
-    // see when a timezone was included in jdk version here https://www.oracle.com/java/technologies/tzdata-versions.html
-    private static final Set<String> IGNORE = new HashSet<>(Arrays.asList(
-        "Eire", "Europe/Dublin", // dublin timezone in joda does not account for DST
-        "Asia/Qostanay", // part of tzdata2018h
-        "America/Godthab", // part of tzdata2020a (maps to America/Nuuk)
-        "America/Nuuk"// part of tzdata2020a
-    ));
-
-
-    public void testTimezoneIds() {
-        assertNull(DateUtils.dateTimeZoneToZoneId(null));
-        assertNull(DateUtils.zoneIdToDateTimeZone(null));
-        for (String jodaId : DateTimeZone.getAvailableIDs()) {
-            if (IGNORE.contains(jodaId)) continue;
-            DateTimeZone jodaTz = DateTimeZone.forID(jodaId);
-            ZoneId zoneId = DateUtils.dateTimeZoneToZoneId(jodaTz); // does not throw
-            long now = 0;
-            assertThat(jodaId, zoneId.getRules().getOffset(Instant.ofEpochMilli(now)).getTotalSeconds() * 1000,
-                equalTo(jodaTz.getOffset(now)));
-            if (DateUtils.DEPRECATED_SHORT_TIMEZONES.containsKey(jodaTz.getID())) {
-                assertWarnings("Use of short timezone id " + jodaId + " is deprecated. Use " + zoneId.getId() + " instead");
-            }
-            // roundtrip does not throw either
-            assertNotNull(DateUtils.zoneIdToDateTimeZone(zoneId));
-        }
-    }
 
     public void testInstantToLong() {
         assertThat(toLong(Instant.EPOCH), is(0L));

+ 3 - 3
test/framework/src/main/java/org/elasticsearch/test/AbstractQueryTestCase.java

@@ -43,11 +43,11 @@ import org.elasticsearch.index.query.QueryRewriteContext;
 import org.elasticsearch.index.query.Rewriteable;
 import org.elasticsearch.index.query.SearchExecutionContext;
 import org.elasticsearch.index.query.support.QueryParsers;
-import org.joda.time.DateTime;
-import org.joda.time.DateTimeZone;
 
 import java.io.IOException;
 import java.time.Instant;
+import java.time.ZoneOffset;
+import java.time.ZonedDateTime;
 import java.util.ArrayList;
 import java.util.Collections;
 import java.util.Deque;
@@ -637,7 +637,7 @@ public abstract class AbstractQueryTestCase<QB extends AbstractQueryBuilder<QB>>
                 value = randomBoolean();
                 break;
             case DATE_FIELD_NAME:
-                value = new DateTime(System.currentTimeMillis(), DateTimeZone.UTC).toString();
+                value = ZonedDateTime.ofInstant(Instant.ofEpochMilli(System.currentTimeMillis()), ZoneOffset.UTC).toString();
                 break;
             case DATE_NANOS_FIELD_NAME:
                 value = Instant.now().toString();

+ 23 - 43
test/framework/src/main/java/org/elasticsearch/test/ESTestCase.java

@@ -37,7 +37,6 @@ import org.apache.lucene.util.TestRuleMarkFailure;
 import org.apache.lucene.util.TimeUnits;
 import org.elasticsearch.Version;
 import org.elasticsearch.bootstrap.BootstrapForTesting;
-import org.elasticsearch.jdk.JavaVersion;
 import org.elasticsearch.client.Requests;
 import org.elasticsearch.cluster.ClusterModule;
 import org.elasticsearch.cluster.metadata.IndexMetadata;
@@ -101,7 +100,6 @@ import org.elasticsearch.test.junit.listeners.ReproduceInfoPrinter;
 import org.elasticsearch.threadpool.ThreadPool;
 import org.elasticsearch.transport.LeakTracker;
 import org.elasticsearch.transport.nio.MockNioTransportPlugin;
-import org.joda.time.DateTimeZone;
 import org.junit.After;
 import org.junit.AfterClass;
 import org.junit.Before;
@@ -172,7 +170,6 @@ import static org.hamcrest.Matchers.hasItem;
 @LuceneTestCase.SuppressReproduceLine
 public abstract class ESTestCase extends LuceneTestCase {
 
-    protected static final List<String> JODA_TIMEZONE_IDS;
     protected static final List<String> JAVA_TIMEZONE_IDS;
     protected static final List<String> JAVA_ZONE_IDS;
 
@@ -228,18 +225,29 @@ public abstract class ESTestCase extends LuceneTestCase {
 
         BootstrapForTesting.ensureInitialized();
 
-        // filter out joda timezones that are deprecated for the java time migration
-        List<String> jodaTZIds = DateTimeZone.getAvailableIDs().stream()
-            .filter(s -> DateUtils.DEPRECATED_SHORT_TZ_IDS.contains(s) == false).sorted().collect(Collectors.toList());
-        JODA_TIMEZONE_IDS = Collections.unmodifiableList(jodaTZIds);
+        /*
+         * We need to exclude time zones not supported by joda (like SystemV* timezones)
+         * because they cannot be converted back to DateTimeZone which we currently
+         * still need to do internally e.g. in bwc serialization and in the extract() method
+         * //TODO remove once tests do not send time zone ids back to versions of ES using Joda
+         */
+        Set<String> unsupportedJodaTZIds = Set.of(
+            "ACT", "AET", "AGT", "ART", "AST", "BET", "BST", "CAT", "CNT", "CST", "CTT", "EAT", "ECT", "EST",
+            "HST", "IET", "IST", "JST", "MIT", "MST", "NET", "NST", "PLT", "PNT", "PRT", "PST", "SST", "VST"
+        );
+        Predicate<String> unsupportedZoneIdsPredicate = tz -> tz.startsWith("System/") || tz.equals("Eire");
+        Predicate<String> unsupportedTZIdsPredicate = unsupportedJodaTZIds::contains;
 
-        List<String> javaTZIds = Arrays.asList(TimeZone.getAvailableIDs());
-        Collections.sort(javaTZIds);
-        JAVA_TIMEZONE_IDS = Collections.unmodifiableList(javaTZIds);
+        JAVA_TIMEZONE_IDS = Arrays.stream(TimeZone.getAvailableIDs())
+            .filter(unsupportedTZIdsPredicate.negate())
+            .filter(unsupportedZoneIdsPredicate.negate())
+            .sorted()
+            .collect(Collectors.toUnmodifiableList());
 
-        List<String> javaZoneIds = new ArrayList<>(ZoneId.getAvailableZoneIds());
-        Collections.sort(javaZoneIds);
-        JAVA_ZONE_IDS = Collections.unmodifiableList(javaZoneIds);
+        JAVA_ZONE_IDS = ZoneId.getAvailableZoneIds().stream()
+            .filter(unsupportedZoneIdsPredicate.negate())
+            .sorted()
+            .collect(Collectors.toUnmodifiableList());
     }
     @SuppressForbidden(reason = "force log4j and netty sysprops")
     private static void setTestSysProps() {
@@ -868,13 +876,6 @@ public abstract class ESTestCase extends LuceneTestCase {
         return randomTimeValue(1, 1000);
     }
 
-    /**
-     * generate a random DateTimeZone from the ones available in joda library
-     */
-    public static DateTimeZone randomDateTimeZone() {
-        return DateTimeZone.forID(randomFrom(JODA_TIMEZONE_IDS));
-    }
-
     /**
      * generate a random epoch millis in a range 1 to 9999-12-31T23:59:59.999
      */
@@ -886,35 +887,14 @@ public abstract class ESTestCase extends LuceneTestCase {
      * generate a random TimeZone from the ones available in java.util
      */
     public static TimeZone randomTimeZone() {
-        return TimeZone.getTimeZone(randomJodaAndJavaSupportedTimezone(JAVA_TIMEZONE_IDS));
+        return TimeZone.getTimeZone(randomFrom(JAVA_TIMEZONE_IDS));
     }
 
     /**
      * generate a random TimeZone from the ones available in java.time
      */
     public static ZoneId randomZone() {
-        // work around a JDK bug, where java 8 cannot parse the timezone GMT0 back into a temporal accessor
-        // see https://bugs.openjdk.java.net/browse/JDK-8138664
-        if (JavaVersion.current().getVersion().get(0) == 8) {
-            ZoneId timeZone;
-            do {
-                timeZone = ZoneId.of(randomJodaAndJavaSupportedTimezone(JAVA_ZONE_IDS));
-            } while (timeZone.equals(ZoneId.of("GMT0")));
-            return timeZone;
-        } else {
-            return ZoneId.of(randomJodaAndJavaSupportedTimezone(JAVA_ZONE_IDS));
-        }
-    }
-
-    /**
-     * We need to exclude time zones not supported by joda (like SystemV* timezones)
-     * because they cannot be converted back to DateTimeZone which we currently
-     * still need to do internally e.g. in bwc serialization and in the extract() method
-     * //TODO remove once joda is not supported
-     */
-    private static String randomJodaAndJavaSupportedTimezone(List<String> zoneIds) {
-        return randomValueOtherThanMany(id -> JODA_TIMEZONE_IDS.contains(id) == false,
-            () -> randomFrom(zoneIds));
+        return ZoneId.of(randomFrom(JAVA_ZONE_IDS));
     }
 
     /**

+ 1 - 1
x-pack/plugin/eql/src/test/java/org/elasticsearch/xpack/eql/execution/search/CriterionOrdinalExtractionTests.java

@@ -91,7 +91,7 @@ public class CriterionOrdinalExtractionTests extends ESTestCase {
     }
 
     public void testTiebreakerNotComparable() throws Exception {
-        final Object o = randomDateTimeZone();
+        final Object o = randomZone();
         HitExtractor badExtractor = new HitExtractor() {
             @Override
             public Object extract(SearchHit hit) {

+ 4 - 21
x-pack/plugin/sql/qa/jdbc/src/main/java/org/elasticsearch/xpack/sql/qa/jdbc/JdbcIntegrationTestCase.java

@@ -8,12 +8,12 @@ package org.elasticsearch.xpack.sql.qa.jdbc;
 
 import org.elasticsearch.client.Request;
 import org.elasticsearch.client.Response;
-import org.elasticsearch.core.CheckedConsumer;
 import org.elasticsearch.common.Strings;
-import org.elasticsearch.xcontent.XContentBuilder;
 import org.elasticsearch.common.xcontent.XContentHelper;
-import org.elasticsearch.xcontent.json.JsonXContent;
+import org.elasticsearch.core.CheckedConsumer;
 import org.elasticsearch.test.rest.ESRestTestCase;
+import org.elasticsearch.xcontent.XContentBuilder;
+import org.elasticsearch.xcontent.json.JsonXContent;
 import org.elasticsearch.xpack.sql.jdbc.EsDataSource;
 import org.junit.After;
 
@@ -22,13 +22,8 @@ import java.io.InputStream;
 import java.sql.Connection;
 import java.sql.DriverManager;
 import java.sql.SQLException;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.HashSet;
-import java.util.List;
 import java.util.Map;
 import java.util.Properties;
-import java.util.Set;
 
 public abstract class JdbcIntegrationTestCase extends ESRestTestCase {
 
@@ -131,24 +126,12 @@ public abstract class JdbcIntegrationTestCase extends ESRestTestCase {
      */
     protected Properties connectionProperties() {
         Properties connectionProperties = new Properties();
-        connectionProperties.put(JdbcTestUtils.JDBC_TIMEZONE, randomKnownTimeZone());
+        connectionProperties.put(JdbcTestUtils.JDBC_TIMEZONE, randomZone().getId());
         // in the tests, don't be lenient towards multi values
         connectionProperties.put("field.multi.value.leniency", "false");
         return connectionProperties;
     }
 
-    public static String randomKnownTimeZone() {
-        // We use system default timezone for the connection that is selected randomly by TestRuleSetupAndRestoreClassEnv
-        // from all available JDK timezones. While Joda and JDK are generally in sync, some timezones might not be known
-        // to the current version of Joda and in this case the test might fail. To avoid that, we specify a timezone
-        // known for both Joda and JDK
-        Set<String> timeZones = new HashSet<>(JODA_TIMEZONE_IDS);
-        timeZones.retainAll(JAVA_TIMEZONE_IDS);
-        List<String> ids = new ArrayList<>(timeZones);
-        Collections.sort(ids);
-        return randomFrom(ids);
-    }
-
     private static Map<String, Object> searchStats() throws IOException {
         Response response = client().performRequest(new Request("GET", "/_stats/search"));
         try (InputStream content = response.getEntity().getContent()) {

+ 14 - 10
x-pack/plugin/sql/qa/jdbc/src/main/java/org/elasticsearch/xpack/sql/qa/jdbc/ResultSetTestCase.java

@@ -9,14 +9,14 @@ package org.elasticsearch.xpack.sql.qa.jdbc;
 import org.elasticsearch.client.Request;
 import org.elasticsearch.common.CheckedBiConsumer;
 import org.elasticsearch.common.CheckedBiFunction;
-import org.elasticsearch.core.CheckedConsumer;
-import org.elasticsearch.core.CheckedFunction;
 import org.elasticsearch.common.CheckedSupplier;
 import org.elasticsearch.common.Strings;
+import org.elasticsearch.core.CheckedConsumer;
+import org.elasticsearch.core.CheckedFunction;
 import org.elasticsearch.core.Tuple;
+import org.elasticsearch.test.ESTestCase;
 import org.elasticsearch.xcontent.XContentBuilder;
 import org.elasticsearch.xcontent.json.JsonXContent;
-import org.elasticsearch.test.ESTestCase;
 import org.elasticsearch.xpack.sql.jdbc.EsType;
 import org.junit.Before;
 
@@ -112,7 +112,11 @@ public abstract class ResultSetTestCase extends JdbcIntegrationTestCase {
 
     @Before
     public void chooseRandomTimeZone() {
-        this.timeZoneId = randomKnownTimeZone();
+        this.timeZoneId = randomZone().getId();
+    }
+
+    static String randomTimeZoneId() {
+        return randomZone().getId();
     }
 
     public void testMultiValueFieldWithMultiValueLeniencyEnabled() throws IOException, SQLException {
@@ -1209,7 +1213,7 @@ public abstract class ResultSetTestCase extends JdbcIntegrationTestCase {
         long randomLongDate = randomMillisUpToYear9999();
         setupDataForDateTimeTests(randomLongDate);
 
-        String anotherTZId = randomValueOtherThan(timeZoneId, JdbcIntegrationTestCase::randomKnownTimeZone);
+        String anotherTZId = randomValueOtherThan(timeZoneId, ResultSetTestCase::randomTimeZoneId);
         Calendar c = Calendar.getInstance(TimeZone.getTimeZone(anotherTZId), Locale.ROOT);
 
         doWithQuery(SELECT_ALL_FIELDS, results -> {
@@ -1241,7 +1245,7 @@ public abstract class ResultSetTestCase extends JdbcIntegrationTestCase {
         long randomLongDateNanos = randomTimeInNanos();
         setupDataForDateTimeTests(randomLongDate, randomLongDateNanos);
 
-        String anotherTZId = randomValueOtherThan(timeZoneId, JdbcIntegrationTestCase::randomKnownTimeZone);
+        String anotherTZId = randomValueOtherThan(timeZoneId, ResultSetTestCase::randomTimeZoneId);
         Calendar cNanos = Calendar.getInstance(TimeZone.getTimeZone(anotherTZId), Locale.ROOT);
 
         doWithQuery(SELECT_ALL_FIELDS, results -> {
@@ -1316,7 +1320,7 @@ public abstract class ResultSetTestCase extends JdbcIntegrationTestCase {
         long randomLongDate = randomMillisUpToYear9999();
         setupDataForDateTimeTests(randomLongDate);
 
-        String anotherTZId = randomValueOtherThan(timeZoneId, JdbcIntegrationTestCase::randomKnownTimeZone);
+        String anotherTZId = randomValueOtherThan(timeZoneId, ResultSetTestCase::randomTimeZoneId);
         Calendar c = Calendar.getInstance(TimeZone.getTimeZone(anotherTZId), Locale.ROOT);
 
         doWithQuery(SELECT_ALL_FIELDS, results -> {
@@ -1347,7 +1351,7 @@ public abstract class ResultSetTestCase extends JdbcIntegrationTestCase {
         long randomLongDateNanos = randomTimeInNanos();
         setupDataForDateTimeTests(randomLongDate, randomLongDateNanos);
 
-        String anotherTZId = randomValueOtherThan(timeZoneId, JdbcIntegrationTestCase::randomKnownTimeZone);
+        String anotherTZId = randomValueOtherThan(timeZoneId, ResultSetTestCase::randomTimeZoneId);
         Calendar cNanos = Calendar.getInstance(TimeZone.getTimeZone(anotherTZId), Locale.ROOT);
 
         doWithQuery(SELECT_ALL_FIELDS, results -> {
@@ -1435,7 +1439,7 @@ public abstract class ResultSetTestCase extends JdbcIntegrationTestCase {
         long randomLongDateNanos = randomTimeInNanos();
         setupDataForDateTimeTests(randomLongDate, randomLongDateNanos);
 
-        String anotherTZId = randomValueOtherThan(timeZoneId, JdbcIntegrationTestCase::randomKnownTimeZone);
+        String anotherTZId = randomValueOtherThan(timeZoneId, ResultSetTestCase::randomTimeZoneId);
         Calendar c = Calendar.getInstance(TimeZone.getTimeZone(anotherTZId), Locale.ROOT);
 
         doWithQuery(SELECT_ALL_FIELDS, results -> {
@@ -1458,7 +1462,7 @@ public abstract class ResultSetTestCase extends JdbcIntegrationTestCase {
         long randomLongDateNanos = randomTimeInNanos();
         setupDataForDateTimeTests(randomLongDate, randomLongDateNanos);
 
-        String anotherTZId = randomValueOtherThan(timeZoneId, JdbcIntegrationTestCase::randomKnownTimeZone);
+        String anotherTZId = randomValueOtherThan(timeZoneId, ResultSetTestCase::randomTimeZoneId);
         Calendar cNanos = Calendar.getInstance(TimeZone.getTimeZone(anotherTZId), Locale.ROOT);
 
         doWithQuery(SELECT_ALL_FIELDS, results -> {

+ 1 - 2
x-pack/plugin/sql/qa/server/security/src/test/java/org/elasticsearch/xpack/sql/qa/security/JdbcSecurityIT.java

@@ -27,7 +27,6 @@ import java.util.Properties;
 
 import static org.elasticsearch.xpack.sql.qa.jdbc.JdbcAssert.assertResultSets;
 import static org.elasticsearch.xpack.sql.qa.jdbc.JdbcIntegrationTestCase.elasticsearchAddress;
-import static org.elasticsearch.xpack.sql.qa.jdbc.JdbcIntegrationTestCase.randomKnownTimeZone;
 import static org.elasticsearch.xpack.sql.qa.security.RestSqlIT.SSL_ENABLED;
 import static org.hamcrest.Matchers.containsString;
 
@@ -44,7 +43,7 @@ public class JdbcSecurityIT extends SqlSecurityTestCase {
 
     static Connection es(Properties properties) throws SQLException {
         Properties props = new Properties();
-        props.put("timezone", randomKnownTimeZone());
+        props.put("timezone", randomZone().getId());
         props.putAll(properties);
         String scheme = SSL_ENABLED ? "https" : "http";
         return DriverManager.getConnection("jdbc:es://" + scheme + "://" + elasticsearchAddress(), props);

+ 1 - 2
x-pack/plugin/sql/qa/server/src/main/java/org/elasticsearch/xpack/sql/qa/CustomDateFormatTestCase.java

@@ -17,7 +17,6 @@ import org.elasticsearch.common.time.DateUtils;
 import org.elasticsearch.xcontent.XContentBuilder;
 import org.elasticsearch.xcontent.json.JsonXContent;
 import org.elasticsearch.xpack.sql.proto.Mode;
-import org.elasticsearch.xpack.sql.qa.jdbc.JdbcIntegrationTestCase;
 import org.elasticsearch.xpack.sql.qa.rest.BaseRestSqlTestCase;
 import org.elasticsearch.xpack.sql.qa.rest.RestSqlTestCase;
 
@@ -44,7 +43,7 @@ public abstract class CustomDateFormatTestCase extends BaseRestSqlTestCase {
     public void testCustomDateFormatsWithNowFunctions() throws IOException {
         createIndex();
         String[] docs = new String[customFormats.length];
-        String zID = JdbcIntegrationTestCase.randomKnownTimeZone();
+        String zID = randomZone().getId();
         StringBuilder datesConditions = new StringBuilder();
 
         for (int i = 0; i < customFormats.length; i++) {

+ 1 - 18
x-pack/plugin/sql/qa/server/src/main/java/org/elasticsearch/xpack/sql/qa/jdbc/JdbcIntegrationTestCase.java

@@ -21,12 +21,7 @@ import java.io.IOException;
 import java.sql.Connection;
 import java.sql.DriverManager;
 import java.sql.SQLException;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.HashSet;
-import java.util.List;
 import java.util.Properties;
-import java.util.Set;
 
 import static org.elasticsearch.xpack.ql.TestUtils.assertNoSearchContexts;
 import static org.elasticsearch.xpack.sql.qa.jdbc.JdbcTestUtils.JDBC_TIMEZONE;
@@ -110,7 +105,7 @@ public abstract class JdbcIntegrationTestCase extends ESRestTestCase {
      */
     protected Properties connectionProperties() {
         Properties connectionProperties = new Properties();
-        connectionProperties.put(JDBC_TIMEZONE, randomKnownTimeZone());
+        connectionProperties.put(JDBC_TIMEZONE, randomZone().getId());
         // in the tests, don't be lenient towards multi values
         connectionProperties.put("field.multi.value.leniency", "false");
         return connectionProperties;
@@ -147,16 +142,4 @@ public abstract class JdbcIntegrationTestCase extends ESRestTestCase {
         request.setJsonEntity(Strings.toString(updateMapping));
         client().performRequest(request);
     }
-
-    public static String randomKnownTimeZone() {
-        // We use system default timezone for the connection that is selected randomly by TestRuleSetupAndRestoreClassEnv
-        // from all available JDK timezones. While Joda and JDK are generally in sync, some timezones might not be known
-        // to the current version of Joda and in this case the test might fail. To avoid that, we specify a timezone
-        // known for both Joda and JDK
-        Set<String> timeZones = new HashSet<>(JODA_TIMEZONE_IDS);
-        timeZones.retainAll(JAVA_TIMEZONE_IDS);
-        List<String> ids = new ArrayList<>(timeZones);
-        Collections.sort(ids);
-        return randomFrom(ids);
-    }
 }