vcs tests: refresh the created nested root to make it visible to VFS

This commit is contained in:
Kirill Likhodedov
2017-03-18 11:35:21 +00:00
parent 4a1c6f1344
commit 0d48daf0e6
@@ -37,6 +37,7 @@ import com.intellij.openapi.vcs.VcsConfiguration
import com.intellij.openapi.vcs.VcsRootChecker
import com.intellij.openapi.vcs.changes.committed.MockAbstractVcs
import com.intellij.openapi.vcs.roots.VcsRootPlatformTest.DOT_MOCK
import com.intellij.openapi.vfs.LocalFileSystem
import com.intellij.vcs.test.VcsPlatformTest
import com.intellij.vcsUtil.VcsUtil.getFilePath
import java.io.File
@@ -68,6 +69,8 @@ class VcsRootProblemNotifierTest : VcsPlatformTest() {
}
}
override fun getDebugLogCategories() = super.getDebugLogCategories().plus("#com.intellij.openapi.vcs.roots")
fun `test root is added automatically in simple case`() {
assertTrue(File(myProjectPath, DOT_MOCK).mkdir())
@@ -78,9 +81,7 @@ class VcsRootProblemNotifierTest : VcsPlatformTest() {
}
fun `test nothing is added automatically if two roots detected`() {
assertTrue(File(myProjectPath, DOT_MOCK).mkdir())
val subRoot = File(myProjectPath, "lib")
assertTrue(File(subRoot, DOT_MOCK).mkdirs())
val subRoot = createNestedRoots()
rootProblemNotifier.rescanAndNotifyIfNeeded()
@@ -111,9 +112,7 @@ class VcsRootProblemNotifierTest : VcsPlatformTest() {
// IDEA-CR-18592
fun `test single root is not added automatically if there is ignored root`() {
assertTrue(File(myProjectPath, DOT_MOCK).mkdir())
val subRoot = File(myProjectPath, "lib")
assertTrue(File(subRoot, DOT_MOCK).mkdirs())
val subRoot = createNestedRoots()
VcsConfiguration.getInstance(myProject).addIgnoredUnregisteredRoots(listOf(FileUtil.toSystemIndependentName(subRoot.path)))
rootProblemNotifier.rescanAndNotifyIfNeeded()
@@ -125,6 +124,14 @@ class VcsRootProblemNotifierTest : VcsPlatformTest() {
""".trimIndent())
}
private fun createNestedRoots(): File {
assertTrue(File(myProjectPath, DOT_MOCK).mkdir())
val subRoot = File(myProjectPath, "lib")
assertTrue(File(subRoot, DOT_MOCK).mkdirs())
LocalFileSystem.getInstance().refreshAndFindFileByIoFile(subRoot)
return subRoot
}
private fun getExtensionPoint() = Extensions.getRootArea().getExtensionPoint(VcsRootChecker.EXTENSION_POINT_NAME)
private class MockRootChecker(private val vcs: MockAbstractVcs) : VcsRootChecker() {