Class DisableAnnotationClient

java.lang.Object
org.eclipse.microprofile.fault.tolerance.tck.disableEnv.DisableAnnotationClient

@ApplicationScoped public class DisableAnnotationClient extends Object
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 Details

    • DisableAnnotationClient

      public DisableAnnotationClient()
  • Method Details

    • failAndRetryOnce

      @Retry(maxRetries=1) public void failAndRetryOnce()
      Always throws TestException, should increment counter by two if Retry is enabled, or one if it is not
    • getFailAndRetryOnceCounter

      public int getFailAndRetryOnceCounter()
      Returns the number of times that failAndRetryOnce() has been executed
      Returns:
      failAndRetryOnceCounter
    • failRetryOnceThenFallback

      @Retry(maxRetries=1) @Fallback(fallbackMethod="fallback") public String failRetryOnceThenFallback()
      Should return normally if Fallback is enabled or throw TestException if not

      Should 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 that failRetryOnceThenFallback() has been executed
      Returns:
      failRetryOnceThenFallbackCounter
    • fallback

      public String fallback()
    • failWithCircuitBreaker

      @CircuitBreaker(successThreshold=2, requestVolumeThreshold=1, failureRatio=1.0, delay=50000L) public void failWithCircuitBreaker()
      Always throws TestException on first invocation, throws CircuitBreakerOpenException on second if CircuitBreaker is enabled

      Throw test exception on second invocation if CircuitBreaker is disabled

    • failWithTimeout

      @Timeout(500L) public void failWithTimeout()
      Throws TimeoutException if Timeout is enabled or TestException otherwise
    • waitWithBulkhead

      @Bulkhead(2) public void waitWithBulkhead(Barrier barrier)
      Blocks waiting for barrier to complete

      Should permit two simultaneous calls if bulkhead enabled, or more if bulkhead disabled.

      Parameters:
      barrier - the barrier to wait for
    • asyncWaitThenReturn

      @Asynchronous public Future<String> asyncWaitThenReturn()
      Returns a future which will be complete on method return if Asynchronous is disabled, or incomplete if Asynchronous is enabled.
      Returns:
      Completed future