Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,6 @@ public static NavigableSet<TransportVersion> allReleasedVersions() {
return RELEASED_VERSIONS;
}

/** Returns the oldest known {@link TransportVersion} */
public static TransportVersion getFirstVersion() {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree this should go. @jdconrad and I already discussed this. In every case what people want is TransportVersion.minimumCompatible().

return allReleasedVersions().getFirst();
}

/** Returns a random {@link TransportVersion} from all available versions. */
public static TransportVersion randomVersion() {
return RandomPicks.randomFrom(random(), allReleasedVersions());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,16 +21,6 @@
public class MlConfigVersionUtils {
private static final List<MlConfigVersion> ALL_VERSIONS = KnownMlConfigVersions.ALL_VERSIONS;

/** Returns all released versions */
public static List<MlConfigVersion> 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);
Expand Down Expand Up @@ -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));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,16 +23,6 @@
public class TransformConfigVersionUtils {
private static final List<TransformConfigVersion> ALL_VERSIONS = KnownTransformConfigVersions.ALL_VERSIONS;

/** Returns all released versions */
public static List<TransformConfigVersion> 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);
Expand Down Expand Up @@ -104,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));
}
}