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

Fix the tests.

This commit is contained in:
Cedric Beust 2016-07-30 09:46:38 -07:00
parent 7c39abc785
commit 8168d263e0
6 changed files with 12 additions and 12 deletions

View file

@ -6,13 +6,16 @@ import com.beust.kobalt.app.BuildFileCompiler
import com.beust.kobalt.internal.JvmCompilerPlugin
import com.beust.kobalt.internal.KobaltPluginXml
import com.beust.kobalt.internal.PluginInfo
import com.beust.kobalt.internal.TaskManager
import com.beust.kobalt.internal.build.BuildFile
import com.beust.kobalt.maven.aether.KobaltAether
import org.testng.annotations.BeforeClass
import java.io.File
import java.nio.file.Paths
open class BaseTest(open val aether: KobaltAether) {
open class BaseTest {
val aether : KobaltAether get() = Kobalt.INJECTOR.getInstance(KobaltAether::class.java)
val taskManager : TaskManager get() = Kobalt.INJECTOR.getInstance(TaskManager::class.java)
val context = KobaltContext(Args())
@BeforeClass

View file

@ -1,8 +1,6 @@
package com.beust.kobalt
import com.beust.kobalt.api.KobaltContext
import com.beust.kobalt.maven.aether.KobaltAether
import com.google.inject.Inject
import org.assertj.core.api.Assertions.assertThat
import org.testng.annotations.DataProvider
import org.testng.annotations.Guice
@ -10,7 +8,7 @@ import org.testng.annotations.Test
import java.io.File
@Guice(modules = arrayOf(TestModule::class))
class ContextTest @Inject constructor(override val aether: KobaltAether): BaseTest(aether) {
class ContextTest : BaseTest() {
val GROUP = "org.testng"
val ARTIFACT = "testng"

View file

@ -8,10 +8,11 @@ import org.testng.annotations.BeforeClass
import org.testng.annotations.DataProvider
import org.testng.annotations.Guice
import org.testng.annotations.Test
import javax.inject.Inject
@Guice(modules = arrayOf(TestModule::class))
class BuildOrderTest @Inject constructor(val taskManager: TaskManager) {
class BuildOrderTest {
val taskManager: TaskManager get() = Kobalt.INJECTOR.getInstance(TaskManager::class.java)
@BeforeClass
fun beforeClass() {
Kobalt.init(TestModule())

View file

@ -6,15 +6,13 @@ import com.beust.kobalt.TestModule
import com.beust.kobalt.api.Kobalt
import com.beust.kobalt.api.Project
import com.beust.kobalt.app.BuildFileCompiler
import com.beust.kobalt.maven.aether.KobaltAether
import com.google.inject.Inject
import org.assertj.core.api.Assertions.assertThat
import org.testng.annotations.Guice
import org.testng.annotations.Test
@Guice(modules = arrayOf(TestModule::class))
class ProfileTest @Inject constructor(val compilerFactory: BuildFileCompiler.IFactory,
override val aether: KobaltAether) : BaseTest(aether) {
class ProfileTest @Inject constructor(val compilerFactory: BuildFileCompiler.IFactory) : BaseTest() {
private fun runTestWithProfile(enabled: Boolean) : Project {
val buildFileString = """

View file

@ -1,5 +1,6 @@
package com.beust.kobalt.internal
import com.beust.kobalt.BaseTest
import com.beust.kobalt.TestModule
import com.google.common.collect.ArrayListMultimap
import com.google.common.collect.Multimap
@ -10,7 +11,7 @@ import org.testng.annotations.Guice
import org.testng.annotations.Test
@Guice(modules = arrayOf(TestModule::class))
class TaskManagerTest @Inject constructor(val taskManager: TaskManager) {
class TaskManagerTest : BaseTest() {
class DryRunGraphExecutor<T>(val graph: DynamicGraph<T>) {
fun run() : List<T> {

View file

@ -6,7 +6,6 @@ import com.beust.kobalt.TestModule
import com.beust.kobalt.api.IClasspathDependency
import com.beust.kobalt.api.Kobalt
import com.beust.kobalt.app.BuildFileCompiler
import com.beust.kobalt.maven.aether.KobaltAether
import com.beust.kobalt.maven.aether.Scope
import com.google.inject.Inject
import org.assertj.core.api.Assertions.assertThat
@ -16,7 +15,7 @@ import org.testng.annotations.Test
@Guice(modules = arrayOf(TestModule::class))
class DependencyManagerTest @Inject constructor(val dependencyManager: DependencyManager,
val dependencyManager2: DependencyManager2,
val compilerFactory: BuildFileCompiler.IFactory, override val aether: KobaltAether) : BaseTest(aether) {
val compilerFactory: BuildFileCompiler.IFactory) : BaseTest() {
private fun assertContains(dependencies: List<IClasspathDependency>, vararg ids: String) {
ids.forEach { id ->