mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
[maven] IDEA-381950 fix MavenProjectsNavigatorTest
GitOrigin-RevId: 98abc08194727e18f1c0fbb880c57fcab826c0be
This commit is contained in:
committed by
intellij-monorepo-bot
parent
28097b60e1
commit
483c4cf763
-18
@@ -6,10 +6,8 @@ import com.intellij.build.events.BuildEvent
|
||||
import com.intellij.build.events.FailureResult
|
||||
import com.intellij.build.events.FinishBuildEvent
|
||||
import com.intellij.build.events.SuccessResult
|
||||
import com.intellij.openapi.Disposable
|
||||
import com.intellij.openapi.components.service
|
||||
import com.intellij.openapi.externalSystem.service.execution.ExternalSystemRunConfigurationViewManager
|
||||
import com.intellij.openapi.util.Disposer
|
||||
import com.intellij.openapi.util.io.toCanonicalPath
|
||||
import com.intellij.openapi.vfs.LocalFileSystem
|
||||
import com.intellij.util.io.copyRecursively
|
||||
@@ -30,11 +28,9 @@ import kotlin.io.path.listDirectoryEntries
|
||||
|
||||
class RealMavenExecutionTest : MavenExecutionTest() {
|
||||
private val myEvents: MutableList<BuildEvent> = CopyOnWriteArrayList()
|
||||
private lateinit var myDisposable: Disposable
|
||||
|
||||
override fun setUp() {
|
||||
super.setUp()
|
||||
myDisposable = Disposer.newDisposable(testRootDisposable)
|
||||
project.service<ExternalSystemRunConfigurationViewManager>().addListener(object : BuildProgressListener {
|
||||
override fun onEvent(buildId: Any, event: BuildEvent) {
|
||||
myEvents.add(event)
|
||||
@@ -42,20 +38,6 @@ class RealMavenExecutionTest : MavenExecutionTest() {
|
||||
}, myDisposable)
|
||||
}
|
||||
|
||||
override fun tearDown() {
|
||||
try {
|
||||
if (::myDisposable.isInitialized) {
|
||||
Disposer.dispose(myDisposable)
|
||||
}
|
||||
}
|
||||
catch (e: Throwable) {
|
||||
addSuppressedException(e)
|
||||
}
|
||||
finally {
|
||||
super.tearDown()
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
fun testExternalExecutor() = runBlocking {
|
||||
createProjectSubFile("src/main/java/A.java", "public class A {}")
|
||||
|
||||
+1
-1
@@ -33,7 +33,7 @@ class MavenProjectsNavigatorTest : MavenMultiVersionImportingTestCase() {
|
||||
override fun invokeLater(runnable: Runnable) {
|
||||
runnable.run()
|
||||
}
|
||||
}, testRootDisposable)
|
||||
}, myDisposable)
|
||||
initProjectsManager(false)
|
||||
|
||||
withContext(Dispatchers.EDT) {
|
||||
|
||||
+7
-7
@@ -74,7 +74,7 @@ abstract class MavenImportingTestCase : MavenTestCase() {
|
||||
private var myNotificationAware: AutoImportProjectNotificationAware? = null
|
||||
private var myProjectTracker: AutoImportProjectTracker? = null
|
||||
private var isAutoReloadEnabled = false
|
||||
private lateinit var myDisposable: Disposable
|
||||
protected lateinit var myDisposable: Disposable
|
||||
|
||||
// plugin resolution is slow and many tests do not need it
|
||||
protected open fun skipPluginResolution(): Boolean {
|
||||
@@ -94,7 +94,7 @@ abstract class MavenImportingTestCase : MavenTestCase() {
|
||||
return PluginResolutionResult(emptySet())
|
||||
}
|
||||
}
|
||||
project.replaceService(MavenPluginResolver::class.java, pluginResolver, project)
|
||||
project.replaceService(MavenPluginResolver::class.java, pluginResolver, myDisposable)
|
||||
}
|
||||
myCodeStyleSettingsTracker = CodeStyleSettingsTracker { currentCodeStyleSettings }
|
||||
val settingsFile = MavenUtil.resolveGlobalSettingsFile(BundledMaven3)
|
||||
@@ -109,6 +109,11 @@ abstract class MavenImportingTestCase : MavenTestCase() {
|
||||
@Throws(Exception::class)
|
||||
override fun tearDown() {
|
||||
runAll(
|
||||
ThrowableRunnable<Throwable> {
|
||||
if (::myDisposable.isInitialized) {
|
||||
Disposer.dispose(myDisposable)
|
||||
}
|
||||
},
|
||||
ThrowableRunnable<Throwable> { WriteAction.runAndWait<RuntimeException> { JavaAwareProjectJdkTableImpl.removeInternalJdkInTests() } },
|
||||
ThrowableRunnable<Throwable> { TestDialogManager.setTestDialog(TestDialog.DEFAULT) },
|
||||
ThrowableRunnable<Throwable> { removeFromLocalRepository("test") },
|
||||
@@ -125,11 +130,6 @@ abstract class MavenImportingTestCase : MavenTestCase() {
|
||||
myCodeStyleSettingsTracker!!.checkForSettingsDamage()
|
||||
}
|
||||
},
|
||||
ThrowableRunnable<Throwable> {
|
||||
if (::myDisposable.isInitialized) {
|
||||
Disposer.dispose(myDisposable)
|
||||
}
|
||||
},
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user