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.voidAlways 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 notvoidAlways throws TestException on first invocation, throwsCircuitBreakerOpenExceptionon second if CircuitBreaker is enabledvoidThrowsTimeoutExceptionif Timeout is enabled or TestException otherwisefallback()intReturns the number of times thatfailAndRetryOnce()has been executedintReturns the number of times thatfailRetryOnceThenFallback()has been executedvoidwaitForBulkheadExecutions(int count) Wait forcountexecutions ofwaitWithBulkhead(Future)to be in progress.voidwaitWithBulkhead(Future<?> waitingFuture) Blocks waiting forwaitingFutureto 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, throwsCircuitBreakerOpenExceptionon second if CircuitBreaker is enabledThrow test exception on second invocation if CircuitBreaker is disabled
-
failWithTimeout
ThrowsTimeoutExceptionif Timeout is enabled or TestException otherwise -
waitWithBulkhead
Blocks waiting forwaitingFutureto completeIf passed an already completed
Future, this method will return immediately.Should permit two simultaneous calls if bulkhead enabled, or more if bulkhead disabled.
- Parameters:
waitingFuture- the future to wait for
-
waitForBulkheadExecutions
public void waitForBulkheadExecutions(int count) Wait forcountexecutions ofwaitWithBulkhead(Future)to be in progress.- Parameters:
count- execution count
-
asyncWaitThenReturn
Returns a future which will be complete on method return if Asynchronous is disabled, or incomplete if Asynchronous is enabled.- Returns:
- Completed future
-