Package org.eclipse.microprofile.fault.tolerance.tck.disableEnv

# Class DisableTest

java.lang.Object
org.jboss.arquillian.testng.Arquillian
org.eclipse.microprofile.fault.tolerance.tck.disableEnv.DisableTest

All Implemented Interfaces:
  `org.testng.IHookable`, `org.testng.ITestNGListener`

public class DisableTest extends org.jboss.arquillian.testng.Arquillian
Test the impact of the MP_Fault_Tolerance_NonFallback_Enabled environment variable. The test assumes that the container supports both the MicroProfile Configuration API and the MicroProfile Fault Tolerance API. The MP_Fault_Tolerance_NonFallback_Enabled Variable is set to "false" in the manifest of the deployed application.

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
`DisableTest()`

## Method Summary

Modifier and Type
Method
Description
`static org.jboss.shrinkwrap.api.spec.WebArchive`
`deploy()`
`void`
`testCircuitClosedThenOpen()`
A test to exercise Circuit Breaker thresholds, with a default SuccessThreshold If MP_Fault_Tolerance_NonFallback_Enabled is set to false in the Container environment, then the CircuitBreaker will not operate, no CircuitBreakerOpenExceptions will be thrown and execution will fail 7 times.
`void`
`testFallbackSuccess()`
Test that a Fallback service is driven when a Service fails.
`void`
`testRetryDisabled()`
Test maxRetries on @Retry.
`void`
`testTimeout()`
A test to exercise the default timeout.

### 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

### DisableTest

public DisableTest()

## Method Details

### deploy

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

### testRetryDisabled

public void testRetryDisabled()
Test maxRetries on @Retry. ServiceA is annotated with maxRetries = 1 so serviceA is expected to execute 2 times but if MP_Fault_Tolerance_NonFallback_Enabled is set to false in the Container environment, then no retries should be attempted.

### testFallbackSuccess

public void testFallbackSuccess()
Test that a Fallback service is driven when a Service fails. ServiceB is annotated with maxRetries = 1 so serviceB is expected to execute 2 times but if MP_Fault_Tolerance_NonFallback_Enabled is set to false in the Container environment, then no retries should be attempted HOWEVER the Fallback should still be driven successfully, so the test checks that a Fallback was driven after serviceB fails.

### testCircuitClosedThenOpen

public void testCircuitClosedThenOpen()
A test to exercise Circuit Breaker thresholds, with a default SuccessThreshold If MP_Fault_Tolerance_NonFallback_Enabled is set to false in the Container environment, then the CircuitBreaker will not operate, no CircuitBreakerOpenExceptions will be thrown and execution will fail 7 times.

### testTimeout

public void testTimeout()
A test to exercise the default timeout. In normal operation, the default Fault Tolerance timeout is 1 second but serviceD will attempt to sleep for 3 seconds, so would be expected to throw a TimeoutException. However, if MP_Fault_Tolerance_NonFallback_Enabled is set to false in the Container environment, then no Timeout will occur and a RuntimeException will be thrown after 3 seconds.