[TestFramework] IJ-CR-159827 fix: move ListenerAssertion from the external system to the platform test framework

(cherry picked from commit 79011bc79b63fef6f25bdb55948b0277493cdc17)

GitOrigin-RevId: a3a6b1dd4a752c910e073a3689373257e238edba
This commit is contained in:
Sergei Vorobyov
2025-03-28 17:16:27 +01:00
committed by intellij-monorepo-bot
parent 7f2b6094f7
commit 90e6f37f08
9 changed files with 18 additions and 13 deletions

View File

@@ -2,7 +2,7 @@
package com.intellij.openapi.externalSystem.service
import com.intellij.openapi.externalSystem.model.task.ExternalSystemTaskState
import com.intellij.openapi.externalSystem.util.ListenerAssertion
import com.intellij.platform.testFramework.assertion.listenerAssertion.ListenerAssertion
import com.intellij.openapi.progress.ProcessCanceledException
class AbstractExternalSystemTaskTest : AbstractExternalSystemTaskTestCase() {

View File

@@ -71,17 +71,21 @@ private fun CoroutineScope.getConfigurationDeferred(project: Project, callback:
// we perform several phases of awaiting here,
// because we need to be prepared for idempotent side effects from saving
return async {
while (true) {
// Ideally, we should do `while (true)` here to converge the process of configuration.
// However, some clients (maven) schedule MergingUpdateQueue updates during save, which leads to infinite configuration,
// as we think that MUQ updates may modify the state.
// So instead we just invoke the save process at least 3 times, hoping that everyone manages to finalize their state by this moment
repeat(3) { phaseNum ->
val wasModified = Observation.awaitConfiguration(project, callback)
if (wasModified) {
saveSettings(componentManager = ApplicationManager.getApplication(), forceSavingAllSettings = true)
saveProjectsAndApp(forceSavingAllSettings = true, onlyProject = project)
callback?.invoke("Configuration phase is completed. Initiating another phase to cover possible side effects...") // NON-NLS
callback?.invoke("Configuration phase $phaseNum is completed. Initiating another phase to cover possible side effects...") // NON-NLS
}
else {
callback?.invoke("All configuration phases are completed.") // NON-NLS
break
return@repeat
}
callback?.invoke("All configuration phases are completed.") // NON-NLS
}
}
}

View File

@@ -1,5 +1,5 @@
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package com.intellij.openapi.externalSystem.util
// Copyright 2000-2025 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package com.intellij.platform.testFramework.assertion.listenerAssertion
import org.junit.jupiter.api.Assertions
import org.opentest4j.AssertionFailedError

View File

@@ -2,7 +2,7 @@
package org.jetbrains.plugins.gradle.importing.syncAction
import com.intellij.gradle.toolingExtension.modelAction.GradleModelFetchPhase
import com.intellij.openapi.externalSystem.util.ListenerAssertion
import com.intellij.platform.testFramework.assertion.listenerAssertion.ListenerAssertion
import com.intellij.openapi.util.Disposer
import com.intellij.openapi.util.use
import com.intellij.platform.backend.workspace.workspaceModel

View File

@@ -1,7 +1,7 @@
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package org.jetbrains.plugins.gradle.importing.syncAction
import com.intellij.openapi.externalSystem.util.ListenerAssertion
import com.intellij.platform.testFramework.assertion.listenerAssertion.ListenerAssertion
import com.intellij.openapi.util.Disposer
import com.intellij.openapi.util.use
import org.jetbrains.plugins.gradle.importing.TestModel

View File

@@ -2,7 +2,7 @@
package org.jetbrains.plugins.gradle.importing.syncAction
import com.intellij.gradle.toolingExtension.modelAction.GradleModelFetchPhase
import com.intellij.openapi.externalSystem.util.ListenerAssertion
import com.intellij.platform.testFramework.assertion.listenerAssertion.ListenerAssertion
import com.intellij.openapi.observable.operation.OperationExecutionStatus
import com.intellij.openapi.progress.ProgressManager
import com.intellij.openapi.util.Disposer

View File

@@ -1,7 +1,7 @@
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package org.jetbrains.plugins.gradle.importing.syncAction
import com.intellij.openapi.externalSystem.util.ListenerAssertion
import com.intellij.platform.testFramework.assertion.listenerAssertion.ListenerAssertion
import com.intellij.openapi.externalSystem.util.ExternalSystemUtil
import com.intellij.openapi.util.Disposer
import com.intellij.openapi.util.io.getResolvedPath

View File

@@ -3,7 +3,7 @@ package org.jetbrains.plugins.gradle.importing.syncAction
import com.intellij.gradle.toolingExtension.modelAction.GradleModelFetchPhase
import com.intellij.openapi.externalSystem.model.project.ExternalSystemSourceType
import com.intellij.openapi.externalSystem.util.ListenerAssertion
import com.intellij.platform.testFramework.assertion.listenerAssertion.ListenerAssertion
import com.intellij.openapi.util.Disposer
import com.intellij.openapi.util.use
import com.intellij.platform.backend.workspace.workspaceModel

View File

@@ -15,6 +15,7 @@ import com.intellij.openapi.util.io.FileUtil;
import com.intellij.util.containers.ContainerUtil;
import com.intellij.util.containers.DisposableWrapperList;
import com.intellij.util.messages.MessageBusConnection;
import com.intellij.util.ui.update.MergingQueueUtil;
import com.intellij.util.ui.update.MergingUpdateQueue;
import com.intellij.util.ui.update.Update;
import org.jetbrains.annotations.NonNls;
@@ -183,7 +184,7 @@ public final class MavenShortcutsManager implements Disposable {
}
}
myUpdateQueue.queue(new Update(MavenShortcutsManager.this) {
MergingQueueUtil.queueTracked(myUpdateQueue, new Update(MavenShortcutsManager.this) {
@Override
public void run() {
List<MavenProject> projectToUpdate;