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

# Class RetryConditionTest

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

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

public class RetryConditionTest extends org.jboss.arquillian.testng.Arquillian
Test the retryOn and abortOn conditions. If retryOn condition is not met, no retry will be performed. If abortOn condition is met, no retry will be performed.

Author:
  Emily Jiang

## Nested Class Summary

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

`org.jboss.arquillian.testng.Arquillian.UpdateResultListener`

## Field Summary

Fields
Modifier and Type
Field
Description
`static final String`
`SIMULATED_EXCEPTION_MESSAGE`
`static final String`
`SIMULATED_RUNTIME_EXCEPTION_MESSAGE`

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

`ARQUILLIAN_DATA_PROVIDER`

## Constructor Summary

Constructors
Constructor
Description
`RetryConditionTest()`

## Method Summary

Modifier and Type
Method
Description
`static org.jboss.shrinkwrap.api.spec.WebArchive`
`deploy()`
`void`
`testAsyncRetryExceptionally()`
Persistent Error condition.
`void`
`testClassLevelRetryOnFalse()`
Analogous to testRetryonFalse, testing whether the `@Retry` annotation on method serviceB overrides the Class level `@Retry` annotation.
`void`
`testClassLevelRetryOnTrue()`
Analogous to testRetryOnTrue but using a Class level rather than method level annotation.
`void`
`testClassLevelRetryWithAbortOnFalse()`
Analogous to testRetryWithAbortOnFalse but using a Class level rather than method level `@Retry` annotation.
`void`
`testClassLevelRetryWithAbortOnTrue()`
Analogous to testRetryWithAbortOnTrue, testing whether the `@Retry` annotation on method serviceB overrides the Class level `@Retry` annotation.
`void`
`testNoAsynRetryOnMethodException()`
Persistent Error condition outside the CompletableFuture.
`void`
`testNoAsynWilNotRetryExceptionally()`
Persistent Error condition inside a CompletableFuture.
`void`
`testRetryChainExceptionally()`
Persistent Error condition.
`void`
`testRetryChainSuccess()`
Temporary error.
`void`
`testRetryCompletionStageWithException()`
Temporary error.
`void`
`testRetryOnFalse()`
Test that no retries are executed where a failure declared as "retry on" in the `@Retry` annotation is NOT encountered.
`void`
`testRetryOnFalseAndAbortOnTrueThrowingAChildCustomException()`
Test that retries are executed where a failure declared as "retry on" in the `@Retry` annotation is encountered by inheritance.
`void`
`testRetryOnTrue()`
Test that retries are executed where a failure declared as "retry on" in the `@Retry` annotation is encountered.
`void`
`testRetryOnTrueThrowingAChildCustomException()`
Test that retries are executed where a failure declared as "retry on" in the `@Retry` annotation is encountered by inheritance.
`void`
`testRetryParallelExceptionally()`
Persistent Error condition.
`void`
`testRetryParallelSuccess()`
Temporary error.
`void`
`testRetrySuccess()`
Temporary error.
`void`
`testRetryWithAbortOnFalse()`
Test that the default number of retries are executed where a failure declared as "abort on" in the `@Retry` annotation is NOT encountered.
`void`
`testRetryWithAbortOnTrue()`
Test that no retries are executed where a failure declared as "abort on" in the `@Retry` annotation is encountered.

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

## Field Details

### SIMULATED_EXCEPTION_MESSAGE

public static final String SIMULATED_EXCEPTION_MESSAGE

See Also:
  - Constant Field Values

### SIMULATED_RUNTIME_EXCEPTION_MESSAGE

public static final String SIMULATED_RUNTIME_EXCEPTION_MESSAGE

See Also:
  - Constant Field Values

## Constructor Details

### RetryConditionTest

public RetryConditionTest()

## Method Details

### deploy

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

### testRetryOnTrue

public void testRetryOnTrue()
Test that retries are executed where a failure declared as "retry on" in the `@Retry` annotation is encountered. serviceA is configured to retry on a TestException. The service should be retried 3 times.

### testRetryOnFalse

public void testRetryOnFalse()
Test that no retries are executed where a failure declared as "retry on" in the `@Retry` annotation is NOT encountered. serviceB is configured to retry on an IOException. In practice the only exception that the service will throw is a TestException, therefore no retries should be executed.

### testRetryOnTrueThrowingAChildCustomException

public void testRetryOnTrueThrowingAChildCustomException()
Test that retries are executed where a failure declared as "retry on" in the `@Retry` annotation is encountered by inheritance. Service that throws a child custom exception but in the retry on list is configured child's parent custom exception

### testRetryOnFalseAndAbortOnTrueThrowingAChildCustomException

public void testRetryOnFalseAndAbortOnTrueThrowingAChildCustomException()
Test that retries are executed where a failure declared as "retry on" in the `@Retry` annotation is encountered by inheritance. Service that throws a child custom exception but in the retry on list is configured child's parent custom exception and in the abort on list is configured the child custom exception. For this case the retry on will be false and the abort on will be true due the class configured in the abort on list is equals to the exception that is throwing by the serviceD not like in the retry on list where is configured the parent exception class of the throwing by the serviceD. So the highest priority will be when the exception type is equals

### testRetryWithAbortOnFalse

public void testRetryWithAbortOnFalse()
Test that the default number of retries are executed where a failure declared as "abort on" in the `@Retry` annotation is NOT encountered. serviceA is configured to abort on an IOException. In practice the only exception that the service will throw is a TestException, therefore the default number of 3 retries should be executed.

### testRetryWithAbortOnTrue

public void testRetryWithAbortOnTrue()
Test that no retries are executed where a failure declared as "abort on" in the `@Retry` annotation is encountered. serviceB is configured to abort on a TestException. The service should not be retried.

### testClassLevelRetryOnTrue

public void testClassLevelRetryOnTrue()
Analogous to testRetryOnTrue but using a Class level rather than method level annotation. serviceA is configured to retry on a TestException. The service should be retried 3 times.

### testClassLevelRetryOnFalse

public void testClassLevelRetryOnFalse()
Analogous to testRetryonFalse, testing whether the `@Retry` annotation on method serviceB overrides the Class level `@Retry` annotation. serviceB is configured to retry on an IOException. In practice the only exception that the service will throw is a TestException, therefore no retries should be executed.

### testClassLevelRetryWithAbortOnFalse

public void testClassLevelRetryWithAbortOnFalse()
Analogous to testRetryWithAbortOnFalse but using a Class level rather than method level `@Retry` annotation. Test that the default number of retries are executed where a failure declared as "abort on" in the `@Retry` annotation is NOT encountered. The Class, and therefore serviceA, is configured to abort on an IOException. In practice the only exception that the service will throw is a TestException, therefore the default number of 3 retries should be executed.

### testClassLevelRetryWithAbortOnTrue

public void testClassLevelRetryWithAbortOnTrue()
Analogous to testRetryWithAbortOnTrue, testing whether the `@Retry` annotation on method serviceB overrides the Class level `@Retry` annotation. Test that no retries are executed where a failure declared as "abort on" in the `@Retry` annotation is encountered. serviceB is configured to abort on a TestException. The service should not be retried.

### testAsyncRetryExceptionally

public void testAsyncRetryExceptionally()
Persistent Error condition. Will retry 2 times and still throw exception. ServiceA uses `Asynchronous` and will always return IOException.

### testNoAsynWilNotRetryExceptionally

public void testNoAsynWilNotRetryExceptionally()
Persistent Error condition inside a CompletableFuture. Will not retry because method is not marked with @Asynchronous ServiceB will always complete exceptionally with IOException.

### testNoAsynRetryOnMethodException

public void testNoAsynRetryOnMethodException()
Persistent Error condition outside the CompletableFuture. Will retry because ServiceB will always throw IOException.

### testRetrySuccess

public void testRetrySuccess()
Temporary error. Will retry 2 times, the first 2 executions will fail. ServiceC uses `Asynchronous`.

### testRetryChainSuccess

public void testRetryChainSuccess()
Temporary error. Will retry 2 times, the first 2 executions will fail deep in a CompletableFuture chained execution. ServiceD uses `Asynchronous` and chains 2 CompletableFutures.

### testRetryChainExceptionally

public void testRetryChainExceptionally()
Persistent Error condition. Will retry 3 times and still throw exception. ServiceE will always return IOException.

### testRetryParallelExceptionally

public void testRetryParallelExceptionally()
Persistent Error condition. Will retry 3 times and still throw exception. ServiceF will always return IOException.

### testRetryParallelSuccess

public void testRetryParallelSuccess()
Temporary error. Will retry 2 times, the first 2 executions fail in a CompletableFuture parallel execution. ServiceG uses `Asynchronous` and 2 CompletableFutures.

### testRetryCompletionStageWithException

public void testRetryCompletionStageWithException()
Temporary error. Will retry 2 times, the first 2 executions fail and the method will throw an exception.