diff --git a/idea/performanceTests/org/jetbrains/kotlin/idea/perf/AbstractPerformanceProjectsTest.kt b/idea/performanceTests/org/jetbrains/kotlin/idea/perf/AbstractPerformanceProjectsTest.kt index 3816dda59be..4b41e9123d9 100644 --- a/idea/performanceTests/org/jetbrains/kotlin/idea/perf/AbstractPerformanceProjectsTest.kt +++ b/idea/performanceTests/org/jetbrains/kotlin/idea/perf/AbstractPerformanceProjectsTest.kt @@ -163,7 +163,7 @@ abstract class AbstractPerformanceProjectsTest : UsefulTestCase() { testName = "open project${if (note.isNotEmpty()) " $note" else ""}", test = { val project = if (!simpleModule) { - val project = projectManagerEx.loadProject(name, path) + val project = loadProjectWithName(name = name, path = path) assertNotNull("project $name at $path is not loaded", project) val projectRootManager = ProjectRootManager.getInstance(project!!) @@ -187,11 +187,7 @@ abstract class AbstractPerformanceProjectsTest : UsefulTestCase() { dispatchAllInvocationEvents() - with(StartupManager.getInstance(project) as StartupManagerImpl) { - scheduleInitialVfsRefresh() - runStartupActivities() - runPostStartupActivities() - } + runStartupActivities(project) logMessage { "project $name is ${if (project.isInitialized) "initialized" else "not initialized"}" } diff --git a/idea/performanceTests/org/jetbrains/kotlin/idea/testFramework/projectRoutines.kt b/idea/performanceTests/org/jetbrains/kotlin/idea/testFramework/projectRoutines.kt index acdd883670f..f074c5d9e9f 100644 --- a/idea/performanceTests/org/jetbrains/kotlin/idea/testFramework/projectRoutines.kt +++ b/idea/performanceTests/org/jetbrains/kotlin/idea/testFramework/projectRoutines.kt @@ -5,6 +5,7 @@ package org.jetbrains.kotlin.idea.testFramework +import com.intellij.ide.startup.impl.StartupManagerImpl import com.intellij.lang.LanguageAnnotators import com.intellij.lang.LanguageExtensionPoint import com.intellij.lang.annotation.Annotator @@ -14,6 +15,7 @@ import com.intellij.openapi.extensions.ExtensionPointName import com.intellij.openapi.fileEditor.FileDocumentManager import com.intellij.openapi.project.Project import com.intellij.openapi.project.ex.ProjectManagerEx +import com.intellij.openapi.startup.StartupManager import com.intellij.psi.PsiDocumentManager import com.intellij.psi.impl.PsiDocumentManagerBase import com.intellij.testFramework.PlatformTestUtil @@ -61,12 +63,23 @@ fun dispatchAllInvocationEvents() { } } +fun loadProjectWithName(path: String, name: String): Project? = + ProjectManagerEx.getInstanceEx().loadProject(name, path) + fun closeProject(project: Project) { dispatchAllInvocationEvents() val projectManagerEx = ProjectManagerEx.getInstanceEx() projectManagerEx.forceCloseProject(project, true) } +fun runStartupActivities(project: Project) { + with(StartupManager.getInstance(project) as StartupManagerImpl) { + scheduleInitialVfsRefresh() + runStartupActivities() + runPostStartupActivities() + } +} + fun waitForAllEditorsFinallyLoaded(project: Project) { // routing is obsolete in 192 } diff --git a/idea/performanceTests/org/jetbrains/kotlin/idea/testFramework/projectRoutines.kt.191 b/idea/performanceTests/org/jetbrains/kotlin/idea/testFramework/projectRoutines.kt.191 index 972b4ea7c2f..5b42e2ea2ee 100644 --- a/idea/performanceTests/org/jetbrains/kotlin/idea/testFramework/projectRoutines.kt.191 +++ b/idea/performanceTests/org/jetbrains/kotlin/idea/testFramework/projectRoutines.kt.191 @@ -5,6 +5,7 @@ package org.jetbrains.kotlin.idea.testFramework +import com.intellij.ide.startup.impl.StartupManagerImpl import com.intellij.lang.LanguageAnnotators import com.intellij.lang.LanguageExtensionPoint import com.intellij.lang.annotation.Annotator @@ -17,6 +18,7 @@ import com.intellij.openapi.fileEditor.FileEditorManager import com.intellij.openapi.fileEditor.impl.text.TextEditorImpl import com.intellij.openapi.project.Project import com.intellij.openapi.project.ex.ProjectManagerEx +import com.intellij.openapi.startup.StartupManager import com.intellij.psi.PsiDocumentManager import com.intellij.psi.impl.PsiDocumentManagerBase import com.intellij.testFramework.PlatformTestUtil @@ -66,12 +68,23 @@ fun dispatchAllInvocationEvents() { } } +fun loadProjectWithName(path: String, name: String): Project? = + ProjectManagerEx.getInstanceEx().loadProject(name, path) + fun closeProject(project: Project) { dispatchAllInvocationEvents() val projectManagerEx = ProjectManagerEx.getInstanceEx() projectManagerEx.forceCloseProject(project, true) } +fun runStartupActivities(project: Project) { + with(StartupManager.getInstance(project) as StartupManagerImpl) { + scheduleInitialVfsRefresh() + runStartupActivities() + runPostStartupActivities() + } +} + fun waitForAllEditorsFinallyLoaded(project: Project) { waitForAllEditorsFinallyLoaded(project, 5, TimeUnit.MINUTES) } diff --git a/idea/performanceTests/org/jetbrains/kotlin/idea/testFramework/projectRoutines.kt.193 b/idea/performanceTests/org/jetbrains/kotlin/idea/testFramework/projectRoutines.kt.193 index 04379026723..0a49e9ea842 100644 --- a/idea/performanceTests/org/jetbrains/kotlin/idea/testFramework/projectRoutines.kt.193 +++ b/idea/performanceTests/org/jetbrains/kotlin/idea/testFramework/projectRoutines.kt.193 @@ -5,6 +5,7 @@ package org.jetbrains.kotlin.idea.testFramework +import com.intellij.ide.startup.impl.StartupManagerImpl import com.intellij.lang.LanguageAnnotators import com.intellij.lang.LanguageExtensionPoint import com.intellij.lang.annotation.Annotator @@ -14,12 +15,14 @@ import com.intellij.openapi.extensions.ExtensionPointName import com.intellij.openapi.fileEditor.FileDocumentManager import com.intellij.openapi.project.Project import com.intellij.openapi.project.ex.ProjectManagerEx +import com.intellij.openapi.startup.StartupManager import com.intellij.psi.PsiDocumentManager import com.intellij.psi.impl.PsiDocumentManagerBase import com.intellij.testFramework.ExtensionTestUtil import com.intellij.testFramework.runInEdtAndWait import com.intellij.util.ui.UIUtil import org.jetbrains.kotlin.idea.parameterInfo.HintType +import java.nio.file.Paths fun commitAllDocuments() { val fileDocumentManager = FileDocumentManager.getInstance() @@ -61,12 +64,23 @@ fun dispatchAllInvocationEvents() { } } +fun loadProjectWithName(path: String, name: String): Project? = + ProjectManagerEx.getInstanceEx().loadProject(Paths.get(path), name) + fun closeProject(project: Project) { dispatchAllInvocationEvents() val projectManagerEx = ProjectManagerEx.getInstanceEx() projectManagerEx.forceCloseProject(project, true) } +fun runStartupActivities(project: Project) { + with(StartupManager.getInstance(project) as StartupManagerImpl) { + //scheduleInitialVfsRefresh() + runStartupActivities() + runPostStartupActivities() + } +} + fun waitForAllEditorsFinallyLoaded(project: Project) { // routing is obsolete in 192 }