mirror of
https://github.com/ethauvin/kobalt.git
synced 2025-04-26 08:27:12 -07:00
Better StringVersion.
This commit is contained in:
parent
71d4cce999
commit
c7714a5286
11 changed files with 119 additions and 189 deletions
|
@ -7,7 +7,7 @@ import com.beust.kobalt.api.KobaltContext
|
||||||
import com.beust.kobalt.api.Project
|
import com.beust.kobalt.api.Project
|
||||||
import com.beust.kobalt.maven.aether.AetherDependency
|
import com.beust.kobalt.maven.aether.AetherDependency
|
||||||
import com.beust.kobalt.misc.KFiles
|
import com.beust.kobalt.misc.KFiles
|
||||||
import com.beust.kobalt.misc.Versions
|
import com.beust.kobalt.misc.StringVersion
|
||||||
import com.beust.kobalt.misc.runCommand
|
import com.beust.kobalt.misc.runCommand
|
||||||
import com.beust.kobalt.misc.warn
|
import com.beust.kobalt.misc.warn
|
||||||
import org.testng.remote.RemoteArgs
|
import org.testng.remote.RemoteArgs
|
||||||
|
@ -59,7 +59,7 @@ class TestNgRunner : GenericTestRunner() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
val VERSION_6_10 = 600100000L
|
val VERSION_6_10 = StringVersion("6.10")
|
||||||
|
|
||||||
override fun runTests(project: Project, context: KobaltContext, classpath: List<IClasspathDependency>,
|
override fun runTests(project: Project, context: KobaltContext, classpath: List<IClasspathDependency>,
|
||||||
configName: String): Boolean {
|
configName: String): Boolean {
|
||||||
|
@ -68,7 +68,7 @@ class TestNgRunner : GenericTestRunner() {
|
||||||
|
|
||||||
val testngDependency = (project.testDependencies.filter { it.id.contains("testng") }
|
val testngDependency = (project.testDependencies.filter { it.id.contains("testng") }
|
||||||
.firstOrNull() as AetherDependency).version
|
.firstOrNull() as AetherDependency).version
|
||||||
val testngDependencyVersion = Versions.toLongVersion(testngDependency)
|
val testngDependencyVersion = StringVersion(testngDependency)
|
||||||
val result =
|
val result =
|
||||||
if (testngDependencyVersion >= VERSION_6_10) {
|
if (testngDependencyVersion >= VERSION_6_10) {
|
||||||
context.logger.log(project.name, 1, "Modern TestNG, displaying colors")
|
context.logger.log(project.name, 1, "Modern TestNG, displaying colors")
|
||||||
|
@ -91,7 +91,6 @@ class TestNgRunner : GenericTestRunner() {
|
||||||
transitiveClosure(listOf(jf, tr, testng))
|
transitiveClosure(listOf(jf, tr, testng))
|
||||||
}
|
}
|
||||||
|
|
||||||
val v = Versions.toLongVersion("6.10")
|
|
||||||
val cp = (classpath + dep).distinct().map { it.jarFile.get() }
|
val cp = (classpath + dep).distinct().map { it.jarFile.get() }
|
||||||
.joinToString(File.pathSeparator)
|
.joinToString(File.pathSeparator)
|
||||||
val passedArgs = listOf(
|
val passedArgs = listOf(
|
||||||
|
|
|
@ -1,11 +1,8 @@
|
||||||
package com.beust.kobalt.maven
|
package com.beust.kobalt.maven
|
||||||
|
|
||||||
import com.beust.kobalt.internal.KobaltSettings
|
import com.beust.kobalt.internal.KobaltSettings
|
||||||
import com.beust.kobalt.misc.KFiles
|
|
||||||
import com.beust.kobalt.misc.Versions
|
|
||||||
import com.google.inject.Inject
|
import com.google.inject.Inject
|
||||||
import java.io.File
|
import java.io.File
|
||||||
import java.util.*
|
|
||||||
import javax.inject.Singleton
|
import javax.inject.Singleton
|
||||||
|
|
||||||
@Singleton
|
@Singleton
|
||||||
|
@ -13,42 +10,7 @@ open class LocalRepo @Inject constructor(val kobaltSettings: KobaltSettings) {
|
||||||
val localRepo: File
|
val localRepo: File
|
||||||
get() = kobaltSettings.localCache
|
get() = kobaltSettings.localCache
|
||||||
|
|
||||||
fun existsPom(d: LocalDep, v: String) : Boolean {
|
fun toFullPath(path: String): String = File(localRepo, path).absolutePath
|
||||||
return File(d.toAbsolutePomFile(v)).exists()
|
|
||||||
}
|
|
||||||
|
|
||||||
fun existsJar(d: LocalDep, v: String) : Boolean {
|
|
||||||
return File(d.toAbsoluteJarFilePath(v)).exists()
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* If the dependency is local, return the correct version for it
|
|
||||||
*/
|
|
||||||
fun findLocalVersion(groupId: String, artifactId: String, packaging: String? = null) : String? {
|
|
||||||
// No version: look at all the directories under group/artifactId, pick the latest and see
|
|
||||||
// if it contains a maven and jar file
|
|
||||||
val dir = toFullPath(KFiles.joinDir(groupId.replace(".", File.separator), artifactId))
|
|
||||||
val files = File(dir).listFiles()
|
|
||||||
|
|
||||||
if (files != null) {
|
|
||||||
val directories = files.filter { it.isDirectory }
|
|
||||||
if (directories.size > 0) {
|
|
||||||
Collections.sort(directories, { f1, f2 ->
|
|
||||||
val v1 = Versions.toLongVersion(f1.name)
|
|
||||||
val v2 = Versions.toLongVersion(f2.name)
|
|
||||||
v2.compareTo(v1) // we want the most recent at position 0
|
|
||||||
})
|
|
||||||
val result = directories[0].name
|
|
||||||
val newDep = LocalDep(MavenId.create(groupId, artifactId, packaging, null, result), this)
|
|
||||||
if (existsPom(newDep, result) && existsJar(newDep, result)) {
|
|
||||||
return result
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return null
|
|
||||||
}
|
|
||||||
|
|
||||||
fun toFullPath(path: String) = File(localRepo, path).absolutePath
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -7,7 +7,7 @@ import com.beust.kobalt.maven.CompletedFuture
|
||||||
import com.beust.kobalt.maven.LocalDep
|
import com.beust.kobalt.maven.LocalDep
|
||||||
import com.beust.kobalt.maven.LocalRepo
|
import com.beust.kobalt.maven.LocalRepo
|
||||||
import com.beust.kobalt.maven.MavenId
|
import com.beust.kobalt.maven.MavenId
|
||||||
import com.beust.kobalt.misc.Versions
|
import com.beust.kobalt.misc.StringVersion
|
||||||
import com.beust.kobalt.misc.warn
|
import com.beust.kobalt.misc.warn
|
||||||
import org.eclipse.aether.artifact.Artifact
|
import org.eclipse.aether.artifact.Artifact
|
||||||
import java.io.File
|
import java.io.File
|
||||||
|
@ -69,8 +69,7 @@ class AetherDependency(val artifact: Artifact, override val optional: Boolean =
|
||||||
override val excluded = arrayListOf<Dependencies.ExcludeConfig>()
|
override val excluded = arrayListOf<Dependencies.ExcludeConfig>()
|
||||||
|
|
||||||
override fun compareTo(other: AetherDependency): Int {
|
override fun compareTo(other: AetherDependency): Int {
|
||||||
return Versions.toLongVersion(artifact.version).compareTo(Versions.toLongVersion(
|
return StringVersion(artifact.version).compareTo(StringVersion(other.artifact.version))
|
||||||
other.artifact.version))
|
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun hashCode() = id.hashCode()
|
override fun hashCode() = id.hashCode()
|
||||||
|
|
|
@ -34,7 +34,7 @@ class CheckVersions @Inject constructor(val depManager: DependencyManager,
|
||||||
versions?.highestVersion.toString()
|
versions?.highestVersion.toString()
|
||||||
}
|
}
|
||||||
if (highest != dep.id
|
if (highest != dep.id
|
||||||
&& Versions.toLongVersion(highest) > Versions.toLongVersion(dep.version)) {
|
&& StringVersion(highest) > StringVersion(dep.version)) {
|
||||||
newVersions.add(artifact.groupId + ":" + artifact.artifactId + ":" + highest)
|
newVersions.add(artifact.groupId + ":" + artifact.artifactId + ":" + highest)
|
||||||
}
|
}
|
||||||
} catch(e: KobaltException) {
|
} catch(e: KobaltException) {
|
||||||
|
|
|
@ -0,0 +1,46 @@
|
||||||
|
package com.beust.kobalt.misc
|
||||||
|
|
||||||
|
import java.lang.Long
|
||||||
|
import java.lang.NumberFormatException
|
||||||
|
import java.util.*
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Compare string versions, e.g. "1.2.0", "0.9", etc...
|
||||||
|
*/
|
||||||
|
class StringVersion(val version: String) : Comparable<StringVersion> {
|
||||||
|
override fun compareTo(other: StringVersion): Int {
|
||||||
|
val s1 = arrayListOf<String>().apply { addAll(version.split('.')) }
|
||||||
|
val s2 = arrayListOf<String>().apply { addAll(other.version.split('.')) }
|
||||||
|
|
||||||
|
// Normalize both strings, so they have the same length, e.g. 1 -> 1.0.0
|
||||||
|
val max = Math.max(s1.size, s2.size)
|
||||||
|
val shorterList : ArrayList<String> = if (s1.size == max) s2 else s1
|
||||||
|
repeat(max - shorterList.size) {
|
||||||
|
shorterList.add("0")
|
||||||
|
}
|
||||||
|
|
||||||
|
// Compare each section
|
||||||
|
repeat(max) { index ->
|
||||||
|
try {
|
||||||
|
fun parse(s: String) = Long.parseLong(s.filter(Char::isDigit))
|
||||||
|
|
||||||
|
val v1 = parse(s1[index])
|
||||||
|
val v2 = parse(s2[index])
|
||||||
|
if (v1 < v2) return -1
|
||||||
|
else if (v1 > v2) return 1
|
||||||
|
} catch(ex: NumberFormatException) {
|
||||||
|
warn("Couldn't parse version $version or $other")
|
||||||
|
return -1
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun equals(other: Any?) =
|
||||||
|
if (other is StringVersion) this.compareTo(other) == 0
|
||||||
|
else false
|
||||||
|
|
||||||
|
override fun hashCode() = version.hashCode()
|
||||||
|
|
||||||
|
override fun toString() = version
|
||||||
|
}
|
|
@ -1,79 +1,10 @@
|
||||||
package com.beust.kobalt.misc
|
package com.beust.kobalt.misc
|
||||||
|
|
||||||
import com.beust.kobalt.maven.MavenId
|
import com.beust.kobalt.maven.MavenId
|
||||||
import com.google.common.base.CharMatcher
|
import java.lang.*
|
||||||
import java.lang.Character
|
|
||||||
import java.lang.IllegalStateException
|
|
||||||
import java.lang.Integer
|
|
||||||
import java.lang.Math
|
|
||||||
import java.lang.NumberFormatException
|
|
||||||
import java.math.BigInteger
|
import java.math.BigInteger
|
||||||
import java.util.*
|
import java.util.*
|
||||||
|
|
||||||
/**
|
|
||||||
* Allow to compare string versions.
|
|
||||||
*/
|
|
||||||
class StringVersion(val version: String) {
|
|
||||||
val array = version.split('.')
|
|
||||||
|
|
||||||
enum class Compare { LT, EQ, GT }
|
|
||||||
|
|
||||||
fun compareTo(other: String) : Compare {
|
|
||||||
val s1 = arrayListOf<String>().apply { addAll(version.split('.')) }
|
|
||||||
val s2 = arrayListOf<String>().apply { addAll(other.split('.')) }
|
|
||||||
val max = Math.max(s1.size, s2.size)
|
|
||||||
val shorterList : ArrayList<String> = if (s1.size == max) s2 else s1
|
|
||||||
repeat(max - shorterList.size) {
|
|
||||||
shorterList.add("0")
|
|
||||||
}
|
|
||||||
|
|
||||||
repeat(max) { index ->
|
|
||||||
try {
|
|
||||||
val v1 = Integer.parseInt(s1[index])
|
|
||||||
val v2 = Integer.parseInt(s2[index])
|
|
||||||
if (v1 < v2) return Compare.LT
|
|
||||||
else if (v1 > v2) return Compare.GT
|
|
||||||
} catch(ex: NumberFormatException) {
|
|
||||||
warn("Couldn't parse version $version or $other")
|
|
||||||
return Compare.LT
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return Compare.EQ
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
class Versions {
|
|
||||||
companion object {
|
|
||||||
/**
|
|
||||||
* Turn "6.9.4" into 600090004
|
|
||||||
*/
|
|
||||||
fun toLongVersion(version: String) : Long {
|
|
||||||
val count = version.countChar('.')
|
|
||||||
val normalizedVersion =
|
|
||||||
if (count == 2) version else if (count == 1) version + ".0"
|
|
||||||
else version + ".0.0"
|
|
||||||
|
|
||||||
fun parseLong(s: String, radix: Int) : Long {
|
|
||||||
try {
|
|
||||||
return java.lang.Long.parseLong(s, radix)
|
|
||||||
} catch(ex: NumberFormatException) {
|
|
||||||
warn("Couldn't parse version \"$version\"")
|
|
||||||
return 0L
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return normalizedVersion
|
|
||||||
.split('.')
|
|
||||||
.take(3)
|
|
||||||
.map {
|
|
||||||
val s = CharMatcher.inRange('0', '9').or(CharMatcher.`is`('.')).retainFrom(it)
|
|
||||||
parseLong(s, 10)
|
|
||||||
}
|
|
||||||
.fold(0L, { n, s -> s + n * 10000 })
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
class Version(val version: String, val snapshotTimestamp: String? = null): Comparable<Version> {
|
class Version(val version: String, val snapshotTimestamp: String? = null): Comparable<Version> {
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
|
|
|
@ -39,8 +39,8 @@ class UpdateKobalt @Inject constructor(val github: GithubApi2, val wrapperProper
|
||||||
|
|
||||||
try {
|
try {
|
||||||
val latestVersionString = latestVersionFuture.get()
|
val latestVersionString = latestVersionFuture.get()
|
||||||
val latestVersion = Versions.toLongVersion(latestVersionString)
|
val latestVersion = StringVersion(latestVersionString)
|
||||||
val current = Versions.toLongVersion(Kobalt.version)
|
val current = StringVersion(Kobalt.version)
|
||||||
val distFile = File(KFiles.distributionsDir)
|
val distFile = File(KFiles.distributionsDir)
|
||||||
if (latestVersion > current) {
|
if (latestVersion > current) {
|
||||||
if (distFile.exists()) {
|
if (distFile.exists()) {
|
||||||
|
|
|
@ -12,7 +12,7 @@ import com.beust.kobalt.internal.build.BuildFile
|
||||||
import com.beust.kobalt.maven.DependencyManager
|
import com.beust.kobalt.maven.DependencyManager
|
||||||
import com.beust.kobalt.misc.KFiles
|
import com.beust.kobalt.misc.KFiles
|
||||||
import com.beust.kobalt.misc.KobaltExecutors
|
import com.beust.kobalt.misc.KobaltExecutors
|
||||||
import com.beust.kobalt.misc.Versions
|
import com.beust.kobalt.misc.StringVersion
|
||||||
import com.beust.kobalt.misc.log
|
import com.beust.kobalt.misc.log
|
||||||
import com.google.inject.Inject
|
import com.google.inject.Inject
|
||||||
import java.io.File
|
import java.io.File
|
||||||
|
@ -90,7 +90,7 @@ class RemoteDependencyData @Inject constructor(val executors: KobaltExecutors, v
|
||||||
val currentLatest = latestVersions[shortId]
|
val currentLatest = latestVersions[shortId]
|
||||||
if (currentLatest == null) latestVersions[shortId] = mid.version!!
|
if (currentLatest == null) latestVersions[shortId] = mid.version!!
|
||||||
else mid.version?.let { v ->
|
else mid.version?.let { v ->
|
||||||
if (Versions.toLongVersion(currentLatest) < Versions.toLongVersion(v)) {
|
if (StringVersion(currentLatest) < StringVersion(v)) {
|
||||||
latestVersions[shortId] = v
|
latestVersions[shortId] = v
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,56 @@
|
||||||
|
package com.beust.kobalt.internal
|
||||||
|
|
||||||
|
import com.beust.kobalt.misc.StringVersion
|
||||||
|
import org.assertj.core.api.Assertions.assertThat
|
||||||
|
import org.testng.annotations.DataProvider
|
||||||
|
import org.testng.annotations.Test
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Make sure we parse version numbers correctly.
|
||||||
|
*/
|
||||||
|
class StringVersionTest {
|
||||||
|
|
||||||
|
@DataProvider
|
||||||
|
fun versionsEqual() : Array<Array<String>>
|
||||||
|
= arrayOf(
|
||||||
|
arrayOf("1.0", "1"),
|
||||||
|
arrayOf("1", "1"),
|
||||||
|
arrayOf("1.0.0", "1"),
|
||||||
|
arrayOf("1.0", "1.0.0")
|
||||||
|
)
|
||||||
|
|
||||||
|
@Test(dataProvider = "versionsEqual")
|
||||||
|
fun versionComparisonsEqual(v1: String, v2: String) {
|
||||||
|
val sv1 = StringVersion(v1)
|
||||||
|
val sv2 = StringVersion(v2)
|
||||||
|
assertThat(sv1).isEqualTo(sv2)
|
||||||
|
assertThat(sv2).isEqualTo(sv1)
|
||||||
|
}
|
||||||
|
|
||||||
|
@DataProvider
|
||||||
|
fun versionsNotEqual() : Array<Array<String>>
|
||||||
|
= arrayOf(
|
||||||
|
arrayOf("0.9", "1"),
|
||||||
|
arrayOf("0.9.2", "1"),
|
||||||
|
arrayOf("1", "1.2.3"),
|
||||||
|
arrayOf("1.2", "1.2.3"),
|
||||||
|
arrayOf("1.2.2", "1.2.3"),
|
||||||
|
arrayOf("1.2.3", "1.2.4"),
|
||||||
|
arrayOf("1", "1.2.3.4"),
|
||||||
|
arrayOf("1.2", "1.2.3.4"),
|
||||||
|
arrayOf("1.2.3", "1.2.3.4"),
|
||||||
|
arrayOf("1.2.3.3", "1.2.3.4"),
|
||||||
|
arrayOf("1.2.3.4", "1.2.3.5"),
|
||||||
|
arrayOf("4.5.0.201609210915-r", "4.5.0.201609210916-r")
|
||||||
|
)
|
||||||
|
|
||||||
|
@Test(dataProvider = "versionsNotEqual")
|
||||||
|
fun versionComparisonsNotEqual(v1: String, v2: String) {
|
||||||
|
val sv1 = StringVersion(v1)
|
||||||
|
val sv2 = StringVersion(v2)
|
||||||
|
assertThat(sv1).isLessThan(sv2)
|
||||||
|
assertThat(sv2).isGreaterThan(sv1)
|
||||||
|
assertThat(sv1).isNotEqualTo(sv2)
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,63 +0,0 @@
|
||||||
package com.beust.kobalt.internal
|
|
||||||
|
|
||||||
import com.beust.kobalt.misc.StringVersion
|
|
||||||
import com.beust.kobalt.misc.Versions
|
|
||||||
import org.assertj.core.api.Assertions.assertThat
|
|
||||||
import org.testng.annotations.DataProvider
|
|
||||||
import org.testng.annotations.Test
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Make sure we parse version numbers correctly.
|
|
||||||
*/
|
|
||||||
class VersionTest {
|
|
||||||
|
|
||||||
@DataProvider
|
|
||||||
fun dp() : Array<Array<Any>>
|
|
||||||
= arrayOf(
|
|
||||||
arrayOf("0.938", 9380000),
|
|
||||||
arrayOf("1.2", 100020000L),
|
|
||||||
arrayOf("1.2.3", 100020003L)
|
|
||||||
)
|
|
||||||
|
|
||||||
@Test(dataProvider = "dp")
|
|
||||||
fun versionConversionShouldWork(version: String, expected: Long) {
|
|
||||||
assertThat(Versions.toLongVersion(version)).isEqualTo(expected)
|
|
||||||
}
|
|
||||||
|
|
||||||
@DataProvider
|
|
||||||
fun versionsEqual() : Array<Array<String>>
|
|
||||||
= arrayOf(
|
|
||||||
arrayOf("1", "1"),
|
|
||||||
arrayOf("1.0", "1"),
|
|
||||||
arrayOf("1.0.0", "1"),
|
|
||||||
arrayOf("1.0", "1.0.0")
|
|
||||||
)
|
|
||||||
|
|
||||||
@Test(dataProvider = "versionsEqual")
|
|
||||||
fun versionComparisonsEqual(v1: String, v2: String) {
|
|
||||||
assertThat(StringVersion(v1).compareTo(v2)).isEqualTo(StringVersion.Compare.EQ)
|
|
||||||
assertThat(StringVersion(v2).compareTo(v1)).isEqualTo(StringVersion.Compare.EQ)
|
|
||||||
}
|
|
||||||
|
|
||||||
@DataProvider
|
|
||||||
fun versionsNotEqual() : Array<Array<Any>>
|
|
||||||
= arrayOf(
|
|
||||||
arrayOf("1", "1.2.3", StringVersion.Compare.LT),
|
|
||||||
arrayOf("1.2", "1.2.3", StringVersion.Compare.LT),
|
|
||||||
arrayOf("1.2.2", "1.2.3", StringVersion.Compare.LT),
|
|
||||||
arrayOf("1.2.4", "1.2.3", StringVersion.Compare.GT),
|
|
||||||
arrayOf("1", "1.2.3.4", StringVersion.Compare.LT),
|
|
||||||
arrayOf("1.2", "1.2.3.4", StringVersion.Compare.LT),
|
|
||||||
arrayOf("1.2.3", "1.2.3.4", StringVersion.Compare.LT),
|
|
||||||
arrayOf("1.2.3.3", "1.2.3.4", StringVersion.Compare.LT),
|
|
||||||
arrayOf("1.2.3.5", "1.2.3.4", StringVersion.Compare.GT)
|
|
||||||
)
|
|
||||||
|
|
||||||
@Test(dataProvider = "versionsNotEqual")
|
|
||||||
fun versionComparisonsNotEqual(v1: String, v2: String, expected: StringVersion.Compare) {
|
|
||||||
assertThat(StringVersion(v1).compareTo(v2)).isEqualTo(expected)
|
|
||||||
assertThat(StringVersion(v2).compareTo(v1)).isEqualTo(
|
|
||||||
if (expected == StringVersion.Compare.LT) StringVersion.Compare.GT else StringVersion.Compare.LT)
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -2,7 +2,7 @@ package com.beust.kobalt.maven
|
||||||
|
|
||||||
import com.beust.kobalt.TestModule
|
import com.beust.kobalt.TestModule
|
||||||
import com.beust.kobalt.misc.KobaltExecutors
|
import com.beust.kobalt.misc.KobaltExecutors
|
||||||
import com.beust.kobalt.misc.Versions
|
import com.beust.kobalt.misc.StringVersion
|
||||||
import org.testng.Assert
|
import org.testng.Assert
|
||||||
import org.testng.annotations.*
|
import org.testng.annotations.*
|
||||||
import java.util.concurrent.ExecutorService
|
import java.util.concurrent.ExecutorService
|
||||||
|
@ -40,10 +40,10 @@ class DependencyTest @Inject constructor(val executors: KobaltExecutors) {
|
||||||
|
|
||||||
@Test(dataProvider = "dpVersions")
|
@Test(dataProvider = "dpVersions")
|
||||||
fun versionSorting(k: String, v: String) {
|
fun versionSorting(k: String, v: String) {
|
||||||
val dep1 = Versions.toLongVersion(k)
|
val dep1 = StringVersion(k)
|
||||||
val dep2 = Versions.toLongVersion(v)
|
val dep2 = StringVersion(v)
|
||||||
Assert.assertTrue(dep1.compareTo(dep2) < 0)
|
Assert.assertTrue(dep1 < dep2)
|
||||||
Assert.assertTrue(dep2.compareTo(dep1) > 0)
|
Assert.assertTrue(dep2 > dep1)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue