From 80c8fadaf0c61923d600cfc9db410618ebf5ee59 Mon Sep 17 00:00:00 2001 From: Joshua Adams Date: Tue, 6 Jan 2026 16:04:13 +0000 Subject: [PATCH 1/2] Remove unused methods Removes unused methods from TransportVersionUtils and TransformConfigVersionUtils --- .../org/elasticsearch/test/TransportVersionUtils.java | 5 ----- .../transform/utils/TransformConfigVersionUtils.java | 10 ---------- 2 files changed, 15 deletions(-) diff --git a/test/framework/src/main/java/org/elasticsearch/test/TransportVersionUtils.java b/test/framework/src/main/java/org/elasticsearch/test/TransportVersionUtils.java index 0a54661525d2e..9d7cc89284268 100644 --- a/test/framework/src/main/java/org/elasticsearch/test/TransportVersionUtils.java +++ b/test/framework/src/main/java/org/elasticsearch/test/TransportVersionUtils.java @@ -42,11 +42,6 @@ public static NavigableSet allReleasedVersions() { return RELEASED_VERSIONS; } - /** Returns the oldest known {@link TransportVersion} */ - public static TransportVersion getFirstVersion() { - return allReleasedVersions().getFirst(); - } - /** Returns a random {@link TransportVersion} from all available versions. */ public static TransportVersion randomVersion() { return RandomPicks.randomFrom(random(), allReleasedVersions()); diff --git a/x-pack/plugin/core/src/test/java/org/elasticsearch/xpack/core/transform/utils/TransformConfigVersionUtils.java b/x-pack/plugin/core/src/test/java/org/elasticsearch/xpack/core/transform/utils/TransformConfigVersionUtils.java index 77db5dd70297c..2d620a41535de 100644 --- a/x-pack/plugin/core/src/test/java/org/elasticsearch/xpack/core/transform/utils/TransformConfigVersionUtils.java +++ b/x-pack/plugin/core/src/test/java/org/elasticsearch/xpack/core/transform/utils/TransformConfigVersionUtils.java @@ -23,16 +23,6 @@ public class TransformConfigVersionUtils { private static final List ALL_VERSIONS = KnownTransformConfigVersions.ALL_VERSIONS; - /** Returns all released versions */ - public static List allReleasedVersions() { - return ALL_VERSIONS; - } - - /** Returns the oldest known {@link TransformConfigVersion} */ - public static TransformConfigVersion getFirstVersion() { - return ALL_VERSIONS.get(0); - } - /** Returns a random {@link TransformConfigVersion} from all available versions. */ public static TransformConfigVersion randomVersion() { return ESTestCase.randomFrom(ALL_VERSIONS); From f07f7bc1fe2ebcd45193fad5e565bdeb9c4d5aa4 Mon Sep 17 00:00:00 2001 From: Joshua Adams Date: Wed, 7 Jan 2026 12:27:00 +0000 Subject: [PATCH 2/2] Removes more methods --- .../core/ml/utils/MlConfigVersionUtils.java | 31 ------------------- .../utils/TransformConfigVersionUtils.java | 21 ------------- 2 files changed, 52 deletions(-) diff --git a/x-pack/plugin/core/src/test/java/org/elasticsearch/xpack/core/ml/utils/MlConfigVersionUtils.java b/x-pack/plugin/core/src/test/java/org/elasticsearch/xpack/core/ml/utils/MlConfigVersionUtils.java index 0d20302215dca..afdb07ca9b788 100644 --- a/x-pack/plugin/core/src/test/java/org/elasticsearch/xpack/core/ml/utils/MlConfigVersionUtils.java +++ b/x-pack/plugin/core/src/test/java/org/elasticsearch/xpack/core/ml/utils/MlConfigVersionUtils.java @@ -21,16 +21,6 @@ public class MlConfigVersionUtils { private static final List ALL_VERSIONS = KnownMlConfigVersions.ALL_VERSIONS; - /** Returns all released versions */ - public static List allReleasedVersions() { - return ALL_VERSIONS; - } - - /** Returns the oldest known {@link MlConfigVersion} */ - public static MlConfigVersion getFirstVersion() { - return ALL_VERSIONS.get(0); - } - /** Returns a random {@link MlConfigVersion} from all available versions. */ public static MlConfigVersion randomVersion() { return ESTestCase.randomFrom(ALL_VERSIONS); @@ -94,29 +84,8 @@ public static MlConfigVersion getPreviousVersion(MlConfigVersion version) { return ALL_VERSIONS.get(place - 1); } - public static MlConfigVersion getNextVersion(MlConfigVersion version) { - int place = Collections.binarySearch(ALL_VERSIONS, version); - if (place < 0) { - // version does not exist - need the item at the index this version should be inserted - place = -(place + 1); - } else { - // need the *next* version - place++; - } - - if (place < 0 || place >= ALL_VERSIONS.size()) { - throw new IllegalArgumentException("couldn't find any released versions after [" + version + "]"); - } - return ALL_VERSIONS.get(place); - } - /** Returns a random {@code MlConfigVersion} that is compatible with {@link MlConfigVersion#CURRENT} */ public static MlConfigVersion randomCompatibleVersion(Random random) { return randomVersionBetween(random, MlConfigVersion.FIRST_ML_VERSION, MlConfigVersion.CURRENT); } - - /** Returns a random {@code MlConfigVersion} that is compatible with the previous version to {@code version} */ - public static MlConfigVersion randomPreviousCompatibleVersion(Random random, MlConfigVersion version) { - return randomVersionBetween(random, MlConfigVersion.FIRST_ML_VERSION, getPreviousVersion(version)); - } } diff --git a/x-pack/plugin/core/src/test/java/org/elasticsearch/xpack/core/transform/utils/TransformConfigVersionUtils.java b/x-pack/plugin/core/src/test/java/org/elasticsearch/xpack/core/transform/utils/TransformConfigVersionUtils.java index 2d620a41535de..405caee2ab039 100644 --- a/x-pack/plugin/core/src/test/java/org/elasticsearch/xpack/core/transform/utils/TransformConfigVersionUtils.java +++ b/x-pack/plugin/core/src/test/java/org/elasticsearch/xpack/core/transform/utils/TransformConfigVersionUtils.java @@ -94,29 +94,8 @@ public static TransformConfigVersion getPreviousVersion(TransformConfigVersion v return ALL_VERSIONS.get(place - 1); } - public static TransformConfigVersion getNextVersion(TransformConfigVersion version) { - int place = Collections.binarySearch(ALL_VERSIONS, version); - if (place < 0) { - // version does not exist - need the item at the index this version should be inserted - place = -(place + 1); - } else { - // need the *next* version - place++; - } - - if (place < 0 || place >= ALL_VERSIONS.size()) { - throw new IllegalArgumentException("couldn't find any released versions after [" + version + "]"); - } - return ALL_VERSIONS.get(place); - } - /** Returns a random {@code TransformConfigVersion} that is compatible with {@link TransformConfigVersion#CURRENT} */ public static TransformConfigVersion randomCompatibleVersion(Random random) { return randomVersionBetween(random, TransformConfigVersion.FIRST_TRANSFORM_VERSION, TransformConfigVersion.CURRENT); } - - /** Returns a random {@code TransformConfigVersion} that is compatible with the previous version to {@code version} */ - public static TransformConfigVersion randomPreviousCompatibleVersion(Random random, TransformConfigVersion version) { - return randomVersionBetween(random, TransformConfigVersion.FIRST_TRANSFORM_VERSION, getPreviousVersion(version)); - } }