mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
[rdct-tests]: RDCT-880, RDCT-881 do not use xDoTools and fix/refactor DeployDistributedUi*Test after app level connection
GitOrigin-RevId: 615b1c780e09bc902100fe2ebee17e5f3a31545c
This commit is contained in:
committed by
intellij-monorepo-bot
parent
b7fea7d2ed
commit
e6c8afdc10
@@ -38,6 +38,7 @@ import kotlinx.coroutines.*
|
||||
import org.jetbrains.annotations.ApiStatus
|
||||
import org.jetbrains.annotations.TestOnly
|
||||
import java.awt.Component
|
||||
import java.awt.Frame
|
||||
import java.awt.Window
|
||||
import java.awt.image.BufferedImage
|
||||
import java.io.File
|
||||
@@ -201,6 +202,23 @@ open class DistributedTestHost(coroutineScope: CoroutineScope) {
|
||||
true
|
||||
}
|
||||
|
||||
// actually doesn't really preserve clientId, not really important here
|
||||
// https://youtrack.jetbrains.com/issue/RDCT-653/setSuspendPreserveClientId-with-custom-dispatcher-doesnt-preserve-ClientId
|
||||
session.visibleFrameNames.setSuspendPreserveClientId(handlerScheduler = Dispatchers.Default.asRdScheduler) { _, _ ->
|
||||
Window.getWindows().filter { it.isShowing }.filterIsInstance<Frame>().map { it.title }.also {
|
||||
LOG.info("Visible frame names: ${it.joinToString(", ", "[", "]")}")
|
||||
}
|
||||
}
|
||||
|
||||
// actually doesn't really preserve clientId, not really important here
|
||||
// https://youtrack.jetbrains.com/issue/RDCT-653/setSuspendPreserveClientId-with-custom-dispatcher-doesnt-preserve-ClientId
|
||||
session.projectsNames.setSuspendPreserveClientId(handlerScheduler = Dispatchers.Default.asRdScheduler) { _, _ ->
|
||||
ProjectManagerEx.getOpenProjects().map { it.name }.also {
|
||||
LOG.info("Projects: ${it.joinToString(", ", "[", "]")}")
|
||||
}
|
||||
}
|
||||
|
||||
// causes problems if not scheduled on ui thread
|
||||
session.closeProjectIfOpened.setSuspendPreserveClientId { _, _ ->
|
||||
runLogged("Close project if it is opened") {
|
||||
ProjectManagerEx.getOpenProjects().forEach {
|
||||
@@ -235,6 +253,12 @@ open class DistributedTestHost(coroutineScope: CoroutineScope) {
|
||||
makeScreenshot(fileName)
|
||||
}
|
||||
|
||||
// actually doesn't really preserve clientId, not really important here
|
||||
// https://youtrack.jetbrains.com/issue/RDCT-653/setSuspendPreserveClientId-with-custom-dispatcher-doesnt-preserve-ClientId
|
||||
session.projectsAreInitialised.setSuspendPreserveClientId(handlerScheduler = Dispatchers.Default.asRdScheduler) { _, _ ->
|
||||
ProjectManagerEx.getOpenProjects().map { it.isInitialized }.all { true }
|
||||
}
|
||||
|
||||
session.showNotification.advise(lifetime) { actionTitle ->
|
||||
showNotification("${session.agentInfo.id}: $actionTitle")
|
||||
}
|
||||
|
||||
+40
-12
@@ -55,7 +55,7 @@ class DistributedTestModel private constructor(
|
||||
|
||||
private val __RdTestSessionNullableSerializer = RdTestSession.nullable()
|
||||
|
||||
const val serializationHash = 5203196433846444594L
|
||||
const val serializationHash = 6176834208377331615L
|
||||
|
||||
}
|
||||
override val serializersOwner: ISerializersOwner get() = DistributedTestModel
|
||||
@@ -238,14 +238,17 @@ class RdTestSession private constructor(
|
||||
val debugCategories: List<String>,
|
||||
private val _ready: RdProperty<Boolean?>,
|
||||
private val _sendException: RdSignal<RdTestSessionException>,
|
||||
private val _shutdown: RdSignal<Unit>,
|
||||
private val _exitApp: RdSignal<Unit>,
|
||||
private val _showNotification: RdSignal<String>,
|
||||
private val _closeProject: RdCall<Unit, Boolean>,
|
||||
private val _closeProjectIfOpened: RdCall<Unit, Boolean>,
|
||||
private val _runNextAction: RdCall<String, String?>,
|
||||
private val _requestFocus: RdCall<String, Boolean>,
|
||||
private val _visibleFrameNames: RdCall<Unit, List<String>>,
|
||||
private val _projectsNames: RdCall<Unit, List<String>>,
|
||||
private val _makeScreenshot: RdCall<String, Boolean>,
|
||||
private val _isResponding: RdCall<Unit, Boolean>
|
||||
private val _isResponding: RdCall<Unit, Boolean>,
|
||||
private val _projectsAreInitialised: RdCall<Unit, Boolean>
|
||||
) : RdBindableBase() {
|
||||
//companion
|
||||
|
||||
@@ -263,15 +266,18 @@ class RdTestSession private constructor(
|
||||
val debugCategories = buffer.readList { buffer.readString() }
|
||||
val _ready = RdProperty.read(ctx, buffer, __BoolNullableSerializer)
|
||||
val _sendException = RdSignal.read(ctx, buffer, RdTestSessionException)
|
||||
val _shutdown = RdSignal.read(ctx, buffer, FrameworkMarshallers.Void)
|
||||
val _exitApp = RdSignal.read(ctx, buffer, FrameworkMarshallers.Void)
|
||||
val _showNotification = RdSignal.read(ctx, buffer, FrameworkMarshallers.String)
|
||||
val _closeProject = RdCall.read(ctx, buffer, FrameworkMarshallers.Void, FrameworkMarshallers.Bool)
|
||||
val _closeProjectIfOpened = RdCall.read(ctx, buffer, FrameworkMarshallers.Void, FrameworkMarshallers.Bool)
|
||||
val _runNextAction = RdCall.read(ctx, buffer, FrameworkMarshallers.String, __StringNullableSerializer)
|
||||
val _requestFocus = RdCall.read(ctx, buffer, FrameworkMarshallers.String, FrameworkMarshallers.Bool)
|
||||
val _visibleFrameNames = RdCall.read(ctx, buffer, FrameworkMarshallers.Void, __StringListSerializer)
|
||||
val _projectsNames = RdCall.read(ctx, buffer, FrameworkMarshallers.Void, __StringListSerializer)
|
||||
val _makeScreenshot = RdCall.read(ctx, buffer, FrameworkMarshallers.String, FrameworkMarshallers.Bool)
|
||||
val _isResponding = RdCall.read(ctx, buffer, FrameworkMarshallers.Void, FrameworkMarshallers.Bool)
|
||||
return RdTestSession(agentInfo, testClassName, testMethodName, traceCategories, debugCategories, _ready, _sendException, _shutdown, _showNotification, _closeProject, _closeProjectIfOpened, _runNextAction, _requestFocus, _makeScreenshot, _isResponding).withId(_id)
|
||||
val _projectsAreInitialised = RdCall.read(ctx, buffer, FrameworkMarshallers.Void, FrameworkMarshallers.Bool)
|
||||
return RdTestSession(agentInfo, testClassName, testMethodName, traceCategories, debugCategories, _ready, _sendException, _exitApp, _showNotification, _closeProject, _closeProjectIfOpened, _runNextAction, _requestFocus, _visibleFrameNames, _projectsNames, _makeScreenshot, _isResponding, _projectsAreInitialised).withId(_id)
|
||||
}
|
||||
|
||||
override fun write(ctx: SerializationCtx, buffer: AbstractBuffer, value: RdTestSession) {
|
||||
@@ -283,31 +289,38 @@ class RdTestSession private constructor(
|
||||
buffer.writeList(value.debugCategories) { v -> buffer.writeString(v) }
|
||||
RdProperty.write(ctx, buffer, value._ready)
|
||||
RdSignal.write(ctx, buffer, value._sendException)
|
||||
RdSignal.write(ctx, buffer, value._shutdown)
|
||||
RdSignal.write(ctx, buffer, value._exitApp)
|
||||
RdSignal.write(ctx, buffer, value._showNotification)
|
||||
RdCall.write(ctx, buffer, value._closeProject)
|
||||
RdCall.write(ctx, buffer, value._closeProjectIfOpened)
|
||||
RdCall.write(ctx, buffer, value._runNextAction)
|
||||
RdCall.write(ctx, buffer, value._requestFocus)
|
||||
RdCall.write(ctx, buffer, value._visibleFrameNames)
|
||||
RdCall.write(ctx, buffer, value._projectsNames)
|
||||
RdCall.write(ctx, buffer, value._makeScreenshot)
|
||||
RdCall.write(ctx, buffer, value._isResponding)
|
||||
RdCall.write(ctx, buffer, value._projectsAreInitialised)
|
||||
}
|
||||
|
||||
private val __BoolNullableSerializer = FrameworkMarshallers.Bool.nullable()
|
||||
private val __StringNullableSerializer = FrameworkMarshallers.String.nullable()
|
||||
private val __StringListSerializer = FrameworkMarshallers.String.list()
|
||||
|
||||
}
|
||||
//fields
|
||||
val ready: IProperty<Boolean?> get() = _ready
|
||||
val sendException: IAsyncSignal<RdTestSessionException> get() = _sendException
|
||||
val shutdown: IAsyncSignal<Unit> get() = _shutdown
|
||||
val exitApp: IAsyncSignal<Unit> get() = _exitApp
|
||||
val showNotification: ISignal<String> get() = _showNotification
|
||||
val closeProject: RdCall<Unit, Boolean> get() = _closeProject
|
||||
val closeProjectIfOpened: RdCall<Unit, Boolean> get() = _closeProjectIfOpened
|
||||
val runNextAction: RdCall<String, String?> get() = _runNextAction
|
||||
val requestFocus: RdCall<String, Boolean> get() = _requestFocus
|
||||
val visibleFrameNames: RdCall<Unit, List<String>> get() = _visibleFrameNames
|
||||
val projectsNames: RdCall<Unit, List<String>> get() = _projectsNames
|
||||
val makeScreenshot: RdCall<String, Boolean> get() = _makeScreenshot
|
||||
val isResponding: RdCall<Unit, Boolean> get() = _isResponding
|
||||
val projectsAreInitialised: RdCall<Unit, Boolean> get() = _projectsAreInitialised
|
||||
//methods
|
||||
//initializer
|
||||
init {
|
||||
@@ -316,26 +329,32 @@ class RdTestSession private constructor(
|
||||
|
||||
init {
|
||||
_sendException.async = true
|
||||
_shutdown.async = true
|
||||
_exitApp.async = true
|
||||
_closeProject.async = true
|
||||
_closeProjectIfOpened.async = true
|
||||
_runNextAction.async = true
|
||||
_requestFocus.async = true
|
||||
_visibleFrameNames.async = true
|
||||
_projectsNames.async = true
|
||||
_makeScreenshot.async = true
|
||||
_isResponding.async = true
|
||||
_projectsAreInitialised.async = true
|
||||
}
|
||||
|
||||
init {
|
||||
bindableChildren.add("ready" to _ready)
|
||||
bindableChildren.add("sendException" to _sendException)
|
||||
bindableChildren.add("shutdown" to _shutdown)
|
||||
bindableChildren.add("exitApp" to _exitApp)
|
||||
bindableChildren.add("showNotification" to _showNotification)
|
||||
bindableChildren.add("closeProject" to _closeProject)
|
||||
bindableChildren.add("closeProjectIfOpened" to _closeProjectIfOpened)
|
||||
bindableChildren.add("runNextAction" to _runNextAction)
|
||||
bindableChildren.add("requestFocus" to _requestFocus)
|
||||
bindableChildren.add("visibleFrameNames" to _visibleFrameNames)
|
||||
bindableChildren.add("projectsNames" to _projectsNames)
|
||||
bindableChildren.add("makeScreenshot" to _makeScreenshot)
|
||||
bindableChildren.add("isResponding" to _isResponding)
|
||||
bindableChildren.add("projectsAreInitialised" to _projectsAreInitialised)
|
||||
}
|
||||
|
||||
//secondary constructor
|
||||
@@ -359,7 +378,10 @@ class RdTestSession private constructor(
|
||||
RdCall<Unit, Boolean>(FrameworkMarshallers.Void, FrameworkMarshallers.Bool),
|
||||
RdCall<String, String?>(FrameworkMarshallers.String, __StringNullableSerializer),
|
||||
RdCall<String, Boolean>(FrameworkMarshallers.String, FrameworkMarshallers.Bool),
|
||||
RdCall<Unit, List<String>>(FrameworkMarshallers.Void, __StringListSerializer),
|
||||
RdCall<Unit, List<String>>(FrameworkMarshallers.Void, __StringListSerializer),
|
||||
RdCall<String, Boolean>(FrameworkMarshallers.String, FrameworkMarshallers.Bool),
|
||||
RdCall<Unit, Boolean>(FrameworkMarshallers.Void, FrameworkMarshallers.Bool),
|
||||
RdCall<Unit, Boolean>(FrameworkMarshallers.Void, FrameworkMarshallers.Bool)
|
||||
)
|
||||
|
||||
@@ -376,14 +398,17 @@ class RdTestSession private constructor(
|
||||
print("debugCategories = "); debugCategories.print(printer); println()
|
||||
print("ready = "); _ready.print(printer); println()
|
||||
print("sendException = "); _sendException.print(printer); println()
|
||||
print("shutdown = "); _shutdown.print(printer); println()
|
||||
print("exitApp = "); _exitApp.print(printer); println()
|
||||
print("showNotification = "); _showNotification.print(printer); println()
|
||||
print("closeProject = "); _closeProject.print(printer); println()
|
||||
print("closeProjectIfOpened = "); _closeProjectIfOpened.print(printer); println()
|
||||
print("runNextAction = "); _runNextAction.print(printer); println()
|
||||
print("requestFocus = "); _requestFocus.print(printer); println()
|
||||
print("visibleFrameNames = "); _visibleFrameNames.print(printer); println()
|
||||
print("projectsNames = "); _projectsNames.print(printer); println()
|
||||
print("makeScreenshot = "); _makeScreenshot.print(printer); println()
|
||||
print("isResponding = "); _isResponding.print(printer); println()
|
||||
print("projectsAreInitialised = "); _projectsAreInitialised.print(printer); println()
|
||||
}
|
||||
printer.print(")")
|
||||
}
|
||||
@@ -397,14 +422,17 @@ class RdTestSession private constructor(
|
||||
debugCategories,
|
||||
_ready.deepClonePolymorphic(),
|
||||
_sendException.deepClonePolymorphic(),
|
||||
_shutdown.deepClonePolymorphic(),
|
||||
_exitApp.deepClonePolymorphic(),
|
||||
_showNotification.deepClonePolymorphic(),
|
||||
_closeProject.deepClonePolymorphic(),
|
||||
_closeProjectIfOpened.deepClonePolymorphic(),
|
||||
_runNextAction.deepClonePolymorphic(),
|
||||
_requestFocus.deepClonePolymorphic(),
|
||||
_visibleFrameNames.deepClonePolymorphic(),
|
||||
_projectsNames.deepClonePolymorphic(),
|
||||
_makeScreenshot.deepClonePolymorphic(),
|
||||
_isResponding.deepClonePolymorphic()
|
||||
_isResponding.deepClonePolymorphic(),
|
||||
_projectsAreInitialised.deepClonePolymorphic()
|
||||
)
|
||||
}
|
||||
//contexts
|
||||
|
||||
+3
@@ -64,8 +64,11 @@ object DistributedTestModel : Ext(TestRoot) {
|
||||
call("closeProjectIfOpened", void, bool).async
|
||||
call("runNextAction", string, string.nullable).async
|
||||
call("requestFocus", string, bool).async
|
||||
call("visibleFrameNames", void, immutableList(string)).async
|
||||
call("projectsNames", void, immutableList(string)).async
|
||||
call("makeScreenshot", string, bool).async
|
||||
call("isResponding", void, bool).async
|
||||
call("projectsAreInitialised", void, bool).async
|
||||
}
|
||||
|
||||
init {
|
||||
|
||||
Reference in New Issue
Block a user