Skip to content

Commit

Permalink
more test cases for integrator
Browse files Browse the repository at this point in the history
  • Loading branch information
pslusarz committed Sep 13, 2015
1 parent f29e4b2 commit d72a0f4
Showing 1 changed file with 52 additions and 0 deletions.
52 changes: 52 additions & 0 deletions src/test/groovy/org/di/engine/UpdaterTest.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -51,4 +51,56 @@ class UpdaterTest {
updater.updateRank(3)
assert 0 == new StalenessCalculator(updater.graph).metric
}

@Test
void twoStaleDependenciesOnSameLevel() {
Updater updater = new Updater(new SourceRepositoryForTesting( {
project {
name = "parent"
version = 3
versions = [1,2,3]
}
project {
name = "left-child"
depends ("parent", 1)
}

project {
name = "right-child"
depends ("parent", 2)
}
}
))

assert 3 == new StalenessCalculator(updater.graph).metric
updater.update()
assert 0 == new StalenessCalculator(updater.graph).metric
}

@Test
void twoStaleDependenciesAtDifferentLevels() {
Updater updater = new Updater(new SourceRepositoryForTesting( {
project {
name = "parent"
version = 3
versions = [1,2,3]
}
project {
name = "child"
version = 2
versions = [1,2]
depends ("parent", 1)
}
project {
name = "grandchild"
depends ("child", 1)
}
}
))

assert 5 == new StalenessCalculator(updater.graph).metric
updater.update()
assert 0 == new StalenessCalculator(updater.graph).metric //new version of "child"
assert updater.graph.nodes.find{it.name == "grandchild"}.outgoing[0].dependency.version.value == 3 //new version of child was produced
}
}

0 comments on commit d72a0f4

Please sign in to comment.