Class CircuitBreakerTest

java.lang.Object
org.jboss.arquillian.testng.Arquillian
org.eclipse.microprofile.fault.tolerance.tck.CircuitBreakerTest
All Implemented Interfaces:
org.testng.IHookable, org.testng.ITestNGListener

public class CircuitBreakerTest extends org.jboss.arquillian.testng.Arquillian
Test CircuitBreaker Thresholds and delays.
Author:
Neil Young
  • Nested Class Summary

    Nested classes/interfaces inherited from class org.jboss.arquillian.testng.Arquillian

    org.jboss.arquillian.testng.Arquillian.UpdateResultListener
  • Field Summary

    Fields inherited from class org.jboss.arquillian.testng.Arquillian

    ARQUILLIAN_DATA_PROVIDER
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static org.jboss.shrinkwrap.api.spec.WebArchive
     
    void
    A test to exercise Circuit Breaker thresholds, with a default SuccessThreshold With requestVolumeThreshold = 4, failureRatio=0.75, successThreshold = 2, delay = 50000 the expected behaviour is, Execution Behaviour ========= ========= 1 TestException 2 TestException 3 TestException 4 TestException 5 CircuitBreakerOpenException 6 CircuitBreakerOpenException 7 CircuitBreakerOpenException
    void
    A test to exercise Circuit Breaker thresholds, with a default SuccessThreshold With requestVolumeThreshold = 4, failureRatio=0.75 and successThreshold = 1 the expected behaviour is, Execution Behaviour ========= ========= 1 TestException 2 TestException 3 TestException 4 TestException 5 CircuitBreakerOpenException Pause for longer than CircuitBreaker delay, so that it transitions to half-open 6 SUCCEED (CircuitBreaker will be re-closed as successThreshold is 1.
    void
    A test to exercise Circuit Breaker thresholds, with a default SuccessThreshold With requestVolumeThreshold = 4, failureRatio=0.75 and successThreshold = 3 the expected behaviour is, Execution Behaviour ========= ========= 1 TestException 2 TestException 3 TestException 4 TestException 5 CircuitBreakerOpenException Pause for longer than CircuitBreaker delay, so that it transitions to half-open 6 SUCCEED 7 SUCCEED 8 TestException (CircuitBreaker will be re-opened) 9 CircuitBreakerOpenException
    void
    A test to exercise Circuit Breaker thresholds, with a SuccessThreshold of 2 With requestVolumeThreshold = 4, failureRatio=0.75 and successThreshold = 2 the expected behaviour is, Execution Behaviour ========= ========= 1 TestException 2 TestException 3 TestException 4 TestException Pause for longer than CircuitBreaker delay, so that it transitions to half-open 5 SUCCEED 6 SUCCEED (CircuitBreaker will be re-closed as successThreshold is 2) 7 SUCCEED
    void
    Analogous to testCircuitClosedThenOpen but using a Class level rather than method level annotation.
    void
    Analogous to testCircuitClosedThenOpen but with a Class level annotation specified that is overridden by a Method level annotation on serviceC.
    void
    Analogous to testCircuitReClose but with a Class level annotation specified that is overridden by a Method level annotation on serviceD.
    void
    A test to exercise Circuit Breaker rolling window With requestVolumeThreshold = 4, failureRatio=0.5, expected behaviour is, Execution Behaviour ========= ========= 1 Success 2 TestException 3 TestException 4 Success 5 CircuitBreakerOpenException
    void
    A test to exercise Circuit Breaker rolling window With requestVolumeThreshold = 4, failureRatio=0.5, expected behaviour is, Execution Behaviour ========= ========= 1 Success 2 TestException 3 Success 4 Success 5 TestException 6 CircuitBreakerOpenException

    Methods inherited from class org.jboss.arquillian.testng.Arquillian

    arquillianAfterClass, arquillianAfterSuite, arquillianAfterTest, arquillianArgumentProvider, arquillianBeforeClass, arquillianBeforeSuite, arquillianBeforeTest, run

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • CircuitBreakerTest

      public CircuitBreakerTest()
  • Method Details

    • deploy

      @Deployment public static org.jboss.shrinkwrap.api.spec.WebArchive deploy()
    • testCircuitClosedThenOpen

      public void testCircuitClosedThenOpen()
      A test to exercise Circuit Breaker thresholds, with a default SuccessThreshold With requestVolumeThreshold = 4, failureRatio=0.75, successThreshold = 2, delay = 50000 the expected behaviour is, Execution Behaviour ========= ========= 1 TestException 2 TestException 3 TestException 4 TestException 5 CircuitBreakerOpenException 6 CircuitBreakerOpenException 7 CircuitBreakerOpenException
    • testCircuitReClose

      public void testCircuitReClose()
      A test to exercise Circuit Breaker thresholds, with a SuccessThreshold of 2 With requestVolumeThreshold = 4, failureRatio=0.75 and successThreshold = 2 the expected behaviour is, Execution Behaviour ========= ========= 1 TestException 2 TestException 3 TestException 4 TestException Pause for longer than CircuitBreaker delay, so that it transitions to half-open 5 SUCCEED 6 SUCCEED (CircuitBreaker will be re-closed as successThreshold is 2) 7 SUCCEED
    • testCircuitDefaultSuccessThreshold

      public void testCircuitDefaultSuccessThreshold()
      A test to exercise Circuit Breaker thresholds, with a default SuccessThreshold With requestVolumeThreshold = 4, failureRatio=0.75 and successThreshold = 1 the expected behaviour is, Execution Behaviour ========= ========= 1 TestException 2 TestException 3 TestException 4 TestException 5 CircuitBreakerOpenException Pause for longer than CircuitBreaker delay, so that it transitions to half-open 6 SUCCEED (CircuitBreaker will be re-closed as successThreshold is 1. The impact of the success of the service and the closure of the Circuit is to reset the rolling failure window to an empty state. Therefore another 4 requests need to be made - of which at least 3 need to fail - for the Circuit to open again) 7 TestException 8 TestException 9 TestException 10 TestException 11 CircuitBreakerOpenException
    • testCircuitHighSuccessThreshold

      public void testCircuitHighSuccessThreshold()
      A test to exercise Circuit Breaker thresholds, with a default SuccessThreshold With requestVolumeThreshold = 4, failureRatio=0.75 and successThreshold = 3 the expected behaviour is, Execution Behaviour ========= ========= 1 TestException 2 TestException 3 TestException 4 TestException 5 CircuitBreakerOpenException Pause for longer than CircuitBreaker delay, so that it transitions to half-open 6 SUCCEED 7 SUCCEED 8 TestException (CircuitBreaker will be re-opened) 9 CircuitBreakerOpenException
    • testClassLevelCircuitBase

      public void testClassLevelCircuitBase()
      Analogous to testCircuitClosedThenOpen but using a Class level rather than method level annotation. With requestVolumeThreshold = 4, failureRatio=0.75, successThreshold = 2 , delay = 50000 the expected behaviour is, Execution Behaviour ========= ========= 1 TestException 2 TestException 3 TestException 4 TestException 5 CircuitBreakerOpenException 6 CircuitBreakerOpenException 7 CircuitBreakerOpenException
    • testClassLevelCircuitOverride

      public void testClassLevelCircuitOverride()
      Analogous to testCircuitClosedThenOpen but with a Class level annotation specified that is overridden by a Method level annotation on serviceC. With successThreshold = 2, requestVolumeThreshold = 2, failureRatio=1, delay = 50000 the expected behaviour is, Execution Behaviour ========= ========= 1 TestException 2 TestException 3 CircuitBreakerOpenException 4 CircuitBreakerOpenException 5 CircuitBreakerOpenException 6 CircuitBreakerOpenException 7 CircuitBreakerOpenException
    • testClassLevelCircuitOverrideNoDelay

      public void testClassLevelCircuitOverrideNoDelay()
      Analogous to testCircuitReClose but with a Class level annotation specified that is overridden by a Method level annotation on serviceD. With successThreshold = 2, requestVolumeThreshold = 4, failureRatio=0.75, delay = 1 the expected behaviour is, Execution Behaviour ========= ========= 1 TestException 2 TestException 3 TestException 4 TestException Pause for longer than CircuitBreaker delay, so that it transitions to half-open 5 SUCCEED 6 SUCCEED (CircuitBreaker will be re-closed as successThreshold is 2) 7 SUCCEED
    • testRollingWindowCircuitOpen

      public void testRollingWindowCircuitOpen()
      A test to exercise Circuit Breaker rolling window With requestVolumeThreshold = 4, failureRatio=0.5, expected behaviour is, Execution Behaviour ========= ========= 1 Success 2 TestException 3 TestException 4 Success 5 CircuitBreakerOpenException
    • testRollingWindowCircuitOpen2

      public void testRollingWindowCircuitOpen2()
      A test to exercise Circuit Breaker rolling window With requestVolumeThreshold = 4, failureRatio=0.5, expected behaviour is, Execution Behaviour ========= ========= 1 Success 2 TestException 3 Success 4 Success 5 TestException 6 CircuitBreakerOpenException