Class DisableAnnotationClient
java.lang.Object
org.eclipse.microprofile.fault.tolerance.tck.disableEnv.DisableAnnotationClient
A client to determine the impact of disabling annotations via config
Each method has an easy test to determine whether it's annotations are active or not.
- Author:
- Andrew Rouse
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionReturns a future which will be complete on method return if Asynchronous is disabled, or incomplete if Asynchronous is enabled.void
Always throwsTestException
, should increment counter by two if Retry is enabled, or one if it is notShould return normally if Fallback is enabled or throw TestException if notvoid
Always throws TestException on first invocation, throwsCircuitBreakerOpenException
on second if CircuitBreaker is enabledvoid
ThrowsTimeoutException
if Timeout is enabled or TestException otherwisefallback()
int
Returns the number of times thatfailAndRetryOnce()
has been executedint
Returns the number of times thatfailRetryOnceThenFallback()
has been executedvoid
waitWithBulkhead
(Barrier barrier) Blocks waiting forbarrier
to complete
-
Constructor Details
-
DisableAnnotationClient
public DisableAnnotationClient()
-
-
Method Details
-
failAndRetryOnce
Always throwsTestException
, should increment counter by two if Retry is enabled, or one if it is not -
getFailAndRetryOnceCounter
public int getFailAndRetryOnceCounter()Returns the number of times thatfailAndRetryOnce()
has been executed- Returns:
- failAndRetryOnceCounter
-
failRetryOnceThenFallback
Should return normally if Fallback is enabled or throw TestException if notShould increment counter by two if Retry is enabled or one if it is not
- Returns:
- nothing, always throws TestException
-
getFailRetryOnceThenFallbackCounter
public int getFailRetryOnceThenFallbackCounter()Returns the number of times thatfailRetryOnceThenFallback()
has been executed- Returns:
- failRetryOnceThenFallbackCounter
-
fallback
-
failWithCircuitBreaker
@CircuitBreaker(successThreshold=2, requestVolumeThreshold=1, failureRatio=1.0, delay=50000L) public void failWithCircuitBreaker()Always throws TestException on first invocation, throwsCircuitBreakerOpenException
on second if CircuitBreaker is enabledThrow test exception on second invocation if CircuitBreaker is disabled
-
failWithTimeout
ThrowsTimeoutException
if Timeout is enabled or TestException otherwise -
waitWithBulkhead
Blocks waiting forbarrier
to completeShould permit two simultaneous calls if bulkhead enabled, or more if bulkhead disabled.
- Parameters:
barrier
- the barrier to wait for
-
asyncWaitThenReturn
Returns a future which will be complete on method return if Asynchronous is disabled, or incomplete if Asynchronous is enabled.- Returns:
- Completed future
-