mirror of
https://github.com/ethauvin/kobalt.git
synced 2025-04-26 08:27:12 -07:00
TaskManagerTest.
This commit is contained in:
parent
114a75b0fb
commit
c9e595a3a0
2 changed files with 36 additions and 7 deletions
|
@ -1,6 +1,7 @@
|
|||
package com.beust.kobalt.internal
|
||||
|
||||
import com.beust.kobalt.TestModule
|
||||
import com.beust.kobalt.misc.KobaltLogger
|
||||
import com.google.common.collect.TreeMultimap
|
||||
import com.google.inject.Inject
|
||||
import org.testng.Assert
|
||||
|
@ -26,15 +27,19 @@ class TaskManagerTest @Inject constructor(val taskManager: TaskManager) {
|
|||
private fun runTasks(tasks: List<String>) : List<String> {
|
||||
val runBefore = TreeMultimap.create<String, String>().apply {
|
||||
put("assemble", "compile")
|
||||
put("compile", "clean")
|
||||
}
|
||||
val alwaysRunAfter = TreeMultimap.create<String, String>()
|
||||
val runAfter = TreeMultimap.create<String, String>().apply {
|
||||
put("clean", "compile")
|
||||
}
|
||||
val alwaysRunAfter = TreeMultimap.create<String, String>().apply {
|
||||
put("clean", "copyVersion")
|
||||
}
|
||||
val dependencies = TreeMultimap.create<String, String>().apply {
|
||||
listOf("assemble", "compile", "clean").forEach {
|
||||
put(it, it)
|
||||
}
|
||||
}
|
||||
val graph = taskManager.createGraph("", tasks, dependencies, runBefore, alwaysRunAfter,
|
||||
val graph = taskManager.createGraph("", tasks, dependencies, runBefore, runAfter, alwaysRunAfter,
|
||||
{ it }, { t -> true })
|
||||
val result = DryRunGraphExecutor(graph).run()
|
||||
return result
|
||||
|
@ -42,6 +47,9 @@ class TaskManagerTest @Inject constructor(val taskManager: TaskManager) {
|
|||
|
||||
@Test
|
||||
fun graphTest() {
|
||||
KobaltLogger.LOG_LEVEL = 3
|
||||
Assert.assertEquals(runTasks(listOf("clean")), listOf("clean", "copyVersion"))
|
||||
Assert.assertEquals(runTasks(listOf("compile")), listOf("compile"))
|
||||
Assert.assertEquals(runTasks(listOf("assemble")), listOf("compile", "assemble"))
|
||||
Assert.assertEquals(runTasks(listOf("clean", "assemble")), listOf("clean", "compile", "assemble"))
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue