in src/test-integration/kotlin/org/jetbrains/teamcity/github/GitHubWebHookSuggestionTest.kt [101:152]
fun testVcsRootsParametrizedInSubprojectShouldNotBeShownInParentProject() {
val p1 = myFixture.createProject("P1")
val p2 = myFixture.createProject("P2", p1)
val p3 = myFixture.createProject("P3", p1)
val bt2 = registerBuildType("BT2", p2, "Ant")
val bt3 = registerBuildType("BT2", p3, "Ant")
val vcs = addGitVcsRoot(p1, "https://github.com/%owner%/%name%")
bt2.addVcsRoot(vcs)
bt2.addParameter(SimpleParameter("owner", "A"))
bt2.addParameter(SimpleParameter("name", "B"))
bt3.addVcsRoot(vcs)
bt3.addParameter(SimpleParameter("owner", "A"))
bt3.addParameter(SimpleParameter("name", "B"))
addGitHubConnection(p2)
addGitHubConnection(p3)
for (consumer in listOf(report(p1.buildTypes),
report(p2.buildTypes),
report(p3.buildTypes))) {
then(consumer.project.keys).hasSize(1)
then(p1.projects).containsAll(consumer.project.keys)
then(consumer.project.values.flatten()).hasSize(1)
then(consumer.vcsRoot).isEmpty() // Vcs Root belongs to parent project which does not have connection
then(consumer.buildType.keys).hasSize(1)
then(listOf<BuildType>(bt2, bt3)).containsAll(consumer.buildType.keys)
then(consumer.buildType.values.flatten()).hasSize(1)
then(consumer.all).hasSize(1)
then(consumer.all.map { it.additionalData["Project"] }).doesNotContain(p1).hasSize(1)
}
val consumer = report(p2.buildTypes).merge(report(p3.buildTypes))
then(consumer.project.keys).containsOnlyElementsOf(p1.projects).hasSize(2)
then(consumer.project.values.flatten().toSet()).hasSize(1)
then(consumer.project.values.flatten()).hasSize(2)
then(consumer.vcsRoot).isEmpty() // Vcs Root belongs to parent project which does not have connection
then(consumer.buildType.keys).containsOnly(bt2, bt3)
then(consumer.buildType.values.flatten().toSet()).hasSize(1)
then(consumer.buildType.values.flatten()).hasSize(2)
then(consumer.all).hasSize(1)
then(consumer.all.map { it.additionalData["Project"] }).doesNotContain(p1).hasSize(1)
}