1
0
Fork 0
mirror of https://github.com/ethauvin/kobalt.git synced 2025-04-26 08:27:12 -07:00

Test fixes.

This commit is contained in:
Cedric Beust 2015-11-16 03:11:24 -08:00
parent 6de72727c3
commit 7088e781be
4 changed files with 19 additions and 21 deletions

View file

@ -0,0 +1,13 @@
package com.beust.kobalt
import com.beust.kobalt.api.Kobalt
import org.testng.annotations.BeforeSuite
import org.testng.annotations.Guice
@Guice(modules = arrayOf(TestModule::class))
open class KobaltTest {
@BeforeSuite
public fun bs() {
Kobalt.INJECTOR = com.google.inject.Guice.createInjector(TestModule())
}
}

View file

@ -1,20 +1,9 @@
package com.beust.kobalt.maven package com.beust.kobalt.maven
import com.beust.kobalt.maven.CompletedFuture import com.beust.kobalt.KobaltTest
import com.beust.kobalt.maven.DepFactory
import com.beust.kobalt.maven.LocalRepo
import com.beust.kobalt.misc.KobaltExecutors import com.beust.kobalt.misc.KobaltExecutors
import com.beust.kobalt.misc.MainModule
import com.beust.kobalt.TestModule
import com.beust.kobalt.api.Kobalt
import com.google.inject.Module
import com.google.inject.util.Modules
import org.testng.Assert import org.testng.Assert
import org.testng.IModuleFactory
import org.testng.ITestContext
import org.testng.annotations.BeforeClass import org.testng.annotations.BeforeClass
import org.testng.annotations.BeforeSuite
import org.testng.annotations.Guice
import org.testng.annotations.Test import org.testng.annotations.Test
import java.io.File import java.io.File
import java.util.concurrent.ExecutorService import java.util.concurrent.ExecutorService
@ -24,18 +13,12 @@ import kotlin.properties.Delegates
/** /**
* TODO: test snapshots https://repository.jboss.org/nexus/content/repositories/root_repository//commons-lang/commons-lang/2.7-SNAPSHOT/commons-lang-2.7-SNAPSHOT.jar * TODO: test snapshots https://repository.jboss.org/nexus/content/repositories/root_repository//commons-lang/commons-lang/2.7-SNAPSHOT/commons-lang-2.7-SNAPSHOT.jar
*/ */
@Guice(modules = arrayOf(TestModule::class))
public class DownloadTest @Inject constructor( public class DownloadTest @Inject constructor(
val depFactory: DepFactory, val depFactory: DepFactory,
val localRepo: LocalRepo, val localRepo: LocalRepo,
val executors: KobaltExecutors) { val executors: KobaltExecutors) : KobaltTest() {
var executor: ExecutorService by Delegates.notNull() var executor: ExecutorService by Delegates.notNull()
@BeforeSuite
public fun bs() {
Kobalt.INJECTOR = com.google.inject.Guice.createInjector(TestModule())
}
@BeforeClass @BeforeClass
public fun bc() { public fun bc() {
executor = executors.newExecutor("DependentTest", 5) executor = executors.newExecutor("DependentTest", 5)
@ -87,3 +70,4 @@ public class DownloadTest @Inject constructor(
Assert.assertTrue(file.exists()) Assert.assertTrue(file.exists())
} }
} }

View file

@ -22,7 +22,7 @@ class MavenIdTest {
@Test(dataProvider = "dp") @Test(dataProvider = "dp")
fun parseVersions(id: String, groupId: String, artifactId: String, version: String?, fun parseVersions(id: String, groupId: String, artifactId: String, version: String?,
packaging: String? /* , qualifier: String? */) { packaging: String?, qualifier: String?) {
val mi = MavenId(id) val mi = MavenId(id)
Assert.assertEquals(mi.groupId, groupId) Assert.assertEquals(mi.groupId, groupId)
Assert.assertEquals(mi.artifactId, artifactId) Assert.assertEquals(mi.artifactId, artifactId)

View file

@ -1,6 +1,7 @@
package com.beust.kobalt.maven package com.beust.kobalt.maven
import com.beust.kobalt.Args import com.beust.kobalt.Args
import com.beust.kobalt.KobaltTest
import com.beust.kobalt.ProjectGenerator import com.beust.kobalt.ProjectGenerator
import com.beust.kobalt.internal.PluginInfo import com.beust.kobalt.internal.PluginInfo
import com.google.inject.Inject import com.google.inject.Inject
@ -8,7 +9,7 @@ import org.testng.Assert
import org.testng.annotations.Test import org.testng.annotations.Test
import java.io.File import java.io.File
class PomTest @Inject constructor(val pluginInfo: PluginInfo){ class PomTest @Inject constructor(val pluginInfo: PluginInfo) : KobaltTest() {
@Test @Test
fun importPom() { fun importPom() {
val pomSrc = File("src/test/resources/pom.xml") val pomSrc = File("src/test/resources/pom.xml")