Class AsyncTaskManager.BarrierTask<T>
java.lang.Object
org.eclipse.microprofile.fault.tolerance.tck.util.AsyncTaskManager.BarrierTask<T>
- Type Parameters:
T
- the return type of the task
- Enclosing class:
- AsyncTaskManager
A task which runs using a barrier
Use this interface to check that the task waits on the barrier and completes as expected
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
Assert that the task waits on its barrier within WAIT_TIME_MSvoid
Assert that the task completes within WAIT_TIME_MSvoid
Assert that the task does not wait on its barriervoid
Assert that the task does not complete within EXPECTED_FAIL_TIME_MSvoid
assertResult
(org.hamcrest.Matcher<? super T> matcher) Assert that the task completes without exception within WAIT_TIME_MS and that the value returned is matched by the provided matchervoid
Assert that the task completes without exception within WAIT_TIME_MSvoid
assertThrows
(Class<? extends Throwable> exceptionClass) Assert that the task completes, throwing an exception of the specified class within WAIT_TIME_MSGet the result of the taskGet the result of the taskboolean
Whether this task is awaiting its barrier right nowvoid
Open the barrier used by the task
-
Constructor Details
-
BarrierTask
-
-
Method Details
-
openBarrier
public void openBarrier()Open the barrier used by the task -
assertAwaits
public void assertAwaits()Assert that the task waits on its barrier within WAIT_TIME_MS -
assertNotAwaiting
public void assertNotAwaiting()Assert that the task does not wait on its barrierThis method always takes EXPECTED_FAIL_TIME_MS ms.
If you need to check multiple tasks, use
AsyncTaskManager.assertAllNotAwaiting(Collection)
instead. -
assertCompletes
public void assertCompletes()Assert that the task completes within WAIT_TIME_MS -
assertNotCompleting
public void assertNotCompleting()Assert that the task does not complete within EXPECTED_FAIL_TIME_MS -
assertSuccess
public void assertSuccess()Assert that the task completes without exception within WAIT_TIME_MS -
assertThrows
Assert that the task completes, throwing an exception of the specified class within WAIT_TIME_MS- Parameters:
exceptionClass
- the class of the expected exception
-
assertResult
Assert that the task completes without exception within WAIT_TIME_MS and that the value returned is matched by the provided matcher- Parameters:
matcher
- theMatcher
used to assert the returned value
-
getResult
Get the result of the taskAsserts that the task completes within WAIT_TIME_MS.
- Returns:
- the task result
- Throws:
ExecutionException
- if the task threw an exception instead of returning
-
getResult
Get the result of the taskAsserts that the task completes within the given time
- Parameters:
time
- the time to wait for the task to completeunit
- the unit fortime
- Returns:
- the task result
- Throws:
ExecutionException
- if the task threw an exception instead of returning
-
isAwaiting
public boolean isAwaiting()Whether this task is awaiting its barrier right nowThis method returns immediately.
- Returns:
true
if this task is currently waiting on its barrier, otherwisefalse
-