forked from tarantool/tarantool-java
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Add new CI targets for the following TNT versions: 1.9, 1.10, 2x, and 2.2 against JDKs versions 8, 11, and 12. - Add assume-style checks to skip Tarantool version incompatible tests. - Update testing tools versions in POM. - Update 'Building' section of README file how to run test w\o SQL part. Closes: tarantool#52, tarantool#143
- Loading branch information
1 parent
c16dc17
commit 9e64263
Showing
14 changed files
with
216 additions
and
66 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
package org.tarantool; | ||
|
||
import java.util.function.BiFunction; | ||
|
||
public enum ServerVersion { | ||
|
||
V_1_9("1", "9", "0"), | ||
V_1_10("1", "10", "0"), | ||
V_2_1("2", "1", "0"), | ||
V_2_2("2", "2", "0"); | ||
|
||
private final String majorVersion; | ||
private final String minorVersion; | ||
private final String patchVersion; | ||
|
||
ServerVersion(String majorVersion, | ||
String minorVersion, String patchVersion) { | ||
this.majorVersion = majorVersion; | ||
this.minorVersion = minorVersion; | ||
this.patchVersion = patchVersion; | ||
} | ||
|
||
public String getMajorVersion() { | ||
return majorVersion; | ||
} | ||
|
||
public String getMinorVersion() { | ||
return minorVersion; | ||
} | ||
|
||
public String getPatchVersion() { | ||
return patchVersion; | ||
} | ||
|
||
public boolean haveMinimalVersion(String versionString) { | ||
return compareVersions(versionString, (server, minimal) -> server >= minimal); | ||
} | ||
|
||
public boolean haveMaximalVersion(String versionString) { | ||
return compareVersions(versionString, (server, maximal) -> server <= maximal); | ||
} | ||
|
||
private boolean compareVersions(String versionString, BiFunction<Integer, Integer, Boolean> comparator) { | ||
int parsedVersion = toNumber(splitVersionParts(versionString)); | ||
int thisVersion = toNumber(new String[] { majorVersion, minorVersion, patchVersion }); | ||
return comparator.apply(parsedVersion, thisVersion); | ||
} | ||
|
||
/** | ||
* Translates version parts to format XXXYYYZZZ. | ||
* For example, {@code 1.2.1} translates to number {@code 1002001} | ||
* | ||
* @param parts version parts | ||
* @return version as number | ||
*/ | ||
private int toNumber(String[] parts) { | ||
int version = 0; | ||
for (int i = 0; i < 3; i++) { | ||
version = (version + Integer.parseInt(parts[i])) * 1000; | ||
} | ||
return version / 1000; | ||
} | ||
|
||
/** | ||
* Splits Tarantool version string into parts. | ||
* For example, {@code 2.1.1-423-g4007436aa} => {@code [2, 1, 1, 423, g4007436aa]}. | ||
* | ||
* @param version Tarantool version string | ||
* @return split parts | ||
*/ | ||
private String[] splitVersionParts(String version) { | ||
return version.split("[.\\-]"); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
package org.tarantool; | ||
|
||
import org.junit.jupiter.api.Assumptions; | ||
|
||
public class TestAssumptions { | ||
|
||
public static void assumeMinimalServerVersion(TarantoolConsole console, ServerVersion version) { | ||
Assumptions.assumeTrue(version.haveMinimalVersion(TestUtils.getTarantoolVersion(console))); | ||
} | ||
|
||
public static void assumeMaximalServerVersion(TarantoolConsole console, ServerVersion version) { | ||
Assumptions.assumeTrue(version.haveMaximalVersion(TestUtils.getTarantoolVersion(console))); | ||
} | ||
|
||
} |
Oops, something went wrong.