Package org.eclipse.scout.testing.client
Class BlockingTestUtility
- java.lang.Object
-
- org.eclipse.scout.testing.client.BlockingTestUtility
-
public final class BlockingTestUtility extends Object
Utility class to test code that enters a blocking condition.- See Also:
IBlockingCondition.waitFor(String...)
,IBlockingCondition.waitFor(long, TimeUnit, String...)
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interface
BlockingTestUtility.IBlockingConditionTimeoutHandle
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static BlockingTestUtility.IBlockingConditionTimeoutHandle
addBlockingConditionTimeoutListener(long timeout, TimeUnit unit)
Used byClientTestRunner
to detect unexpected blocking conditions (forms)static void
runBlockingAction(org.eclipse.scout.rt.platform.util.concurrent.IRunnable runnableGettingBlocked, org.eclipse.scout.rt.platform.util.concurrent.IRunnable runnableOnceBlocked)
Helper method to test code which will enter a blocking condition.static void
runBlockingAction(org.eclipse.scout.rt.platform.util.concurrent.IRunnable runnableGettingBlocked, org.eclipse.scout.rt.platform.util.concurrent.IRunnable runnableOnceBlocked, boolean awaitBackgroundJobs)
Helper method to test code which will enter a blocking condition.static void
runBlockingActionWithMessageBoxDefaultResult(org.eclipse.scout.rt.platform.util.concurrent.IRunnable runnable, int messageBoxResult)
Runs an action that will be blocked by a message box.static void
runBlockingActionWithMessageBoxHandler(org.eclipse.scout.rt.platform.util.concurrent.IRunnable runnable, ToIntFunction<IMessageBox> messageBoxHandler)
Runs an action that will be blocked by a message box.
-
-
-
Method Detail
-
runBlockingAction
public static void runBlockingAction(org.eclipse.scout.rt.platform.util.concurrent.IRunnable runnableGettingBlocked, org.eclipse.scout.rt.platform.util.concurrent.IRunnable runnableOnceBlocked)
Helper method to test code which will enter a blocking condition.calls
runBlockingAction(IRunnable, IRunnable, boolean)
with awaitBackgroundJobs=false
-
runBlockingAction
public static void runBlockingAction(org.eclipse.scout.rt.platform.util.concurrent.IRunnable runnableGettingBlocked, org.eclipse.scout.rt.platform.util.concurrent.IRunnable runnableOnceBlocked, boolean awaitBackgroundJobs)
Helper method to test code which will enter a blocking condition.If
runnableOnceBlocked
throws an exception, it is given toJUnitExceptionHandler
to make the JUnit test fail.- Parameters:
runnableGettingBlocked
-IRunnable
that will enter a blocking condition.runnableOnceBlocked
-IRunnable
to be executed once the 'runnableGettingBlocked' enters a blocking condition.awaitBackgroundJobs
- true waits for background jobs running in the same session to complete before runnableOnceBlocked is called
-
addBlockingConditionTimeoutListener
public static BlockingTestUtility.IBlockingConditionTimeoutHandle addBlockingConditionTimeoutListener(long timeout, TimeUnit unit)
Used byClientTestRunner
to detect unexpected blocking conditions (forms)Adds a blocking condition timeout listener on
IJobManager
for the currentIClientSession
- Returns:
- the handle for the listener containing the first exception caught. Call
IRegistrationHandle.dispose()
to remove the listener.
-
runBlockingActionWithMessageBoxDefaultResult
public static void runBlockingActionWithMessageBoxDefaultResult(org.eclipse.scout.rt.platform.util.concurrent.IRunnable runnable, int messageBoxResult)
Runs an action that will be blocked by a message box. All message boxes appearing during the execution of the action are answered by the specified option.If you need a distinguish multiple message boxes and give different answers, use
runBlockingActionWithMessageBoxHandler(IRunnable, ToIntFunction)
instead.- Parameters:
runnable
- The action to be executed that will cause the message box to appearmessageBoxResult
- The return value for the message box. SeeIMessageBox
for possible values.
-
runBlockingActionWithMessageBoxHandler
public static void runBlockingActionWithMessageBoxHandler(org.eclipse.scout.rt.platform.util.concurrent.IRunnable runnable, ToIntFunction<IMessageBox> messageBoxHandler)
Runs an action that will be blocked by a message box. For each message box, the handling function is called to determine the return value.If you need don't need to different return values for different message boxes, you can use
runBlockingActionWithMessageBoxDefaultResult(IRunnable, int)
instead. SeeIMessageBox
for possible values.- Parameters:
runnable
- The action to be executed that will cause the message box to appearmessageBoxHandler
- The handling function that will be used to determine the return value in the message box.
-
-