From c1dbb716b3bd73ac1700bf5290ac6c1a864881f5 Mon Sep 17 00:00:00 2001 From: Benjamin Confino Date: Mon, 13 Nov 2023 13:23:42 +0000 Subject: [PATCH 1/3] This PR replaces all expected RuntimeExceptions with TestException. This is because I saw some genuine RuntimeExceptions causing failures in our build system and if runtime exceptions can appear where they are not expected the wrong runtime exception may appear where a runtime exception is expected --- .../fault/tolerance/tck/AsyncTimeoutTest.java | 4 +- .../tck/CircuitBreakerInitialSuccessTest.java | 16 +-- .../tck/CircuitBreakerLateSuccessTest.java | 8 +- .../tck/CircuitBreakerRetryTest.java | 21 ++-- .../tolerance/tck/CircuitBreakerTest.java | 113 +++++++++--------- .../fault/tolerance/tck/ConfigTest.java | 24 ++-- .../fault/tolerance/tck/FallbackTest.java | 55 ++++----- .../tolerance/tck/RetryConditionTest.java | 69 ++++++----- .../fault/tolerance/tck/RetryTest.java | 36 +++--- .../fault/tolerance/tck/RetryTimeoutTest.java | 9 +- .../tck/TimeoutGlobalConfigTest.java | 7 +- .../tck/TimeoutMethodConfigTest.java | 7 +- .../fault/tolerance/tck/TimeoutTest.java | 68 ++++++----- .../clientserver/AsyncRetryClient.java | 9 +- .../CircuitBreakerConfigGlobalTest.java | 10 +- .../CircuitBreakerConfigOnMethodTest.java | 10 +- ...rcuitBreakerClassLevelClientWithDelay.java | 3 +- ...rcuitBreakerClassLevelClientWithRetry.java | 3 +- ...tBreakerClientDefaultSuccessThreshold.java | 3 +- ...itBreakerClientHigherSuccessThreshold.java | 3 +- .../CircuitBreakerClientNoDelay.java | 3 +- .../CircuitBreakerClientRollingWindow.java | 5 +- .../CircuitBreakerClientWithDelay.java | 3 +- .../CircuitBreakerClientWithRetry.java | 10 +- .../CircuitBreakerClientWithRetryAsync.java | 4 +- .../clientserver/ConfigClassLevelClient.java | 3 +- .../ConfigClassLevelMaxDurationClient.java | 3 +- .../tck/config/clientserver/ConfigClient.java | 5 +- .../tck/disableEnv/DisableClient.java | 7 +- .../tolerance/tck/disableEnv/DisableTest.java | 13 +- .../FallbackClassLevelClient.java | 3 +- .../RetryClassLevelClientAbortOn.java | 5 +- .../RetryClassLevelClientForMaxRetries.java | 5 +- .../RetryClassLevelClientRetryOn.java | 9 +- .../clientserver/RetryClientAbortOn.java | 9 +- .../RetryClientForMaxRetries.java | 5 +- .../clientserver/RetryClientRetryOn.java | 7 +- .../clientserver/RetryClientWithDelay.java | 3 +- .../RetryClientWithNoDelayAndJitter.java | 3 +- .../clientserver/RetryTimeoutClient.java | 3 +- .../clientserver/DefaultTimeoutClient.java | 5 +- .../clientserver/ShorterTimeoutClient.java | 5 +- .../timeout/clientserver/TimeoutClient.java | 9 +- .../visibility/retry/RetryVisibilityTest.java | 9 +- 44 files changed, 338 insertions(+), 276 deletions(-) diff --git a/tck/src/main/java/org/eclipse/microprofile/fault/tolerance/tck/AsyncTimeoutTest.java b/tck/src/main/java/org/eclipse/microprofile/fault/tolerance/tck/AsyncTimeoutTest.java index 554d2df5..6e38d74a 100644 --- a/tck/src/main/java/org/eclipse/microprofile/fault/tolerance/tck/AsyncTimeoutTest.java +++ b/tck/src/main/java/org/eclipse/microprofile/fault/tolerance/tck/AsyncTimeoutTest.java @@ -34,6 +34,7 @@ import org.eclipse.microprofile.fault.tolerance.tck.asynctimeout.clientserver.AsyncTimeoutClient; import org.eclipse.microprofile.fault.tolerance.tck.config.ConfigAnnotationAsset; import org.eclipse.microprofile.fault.tolerance.tck.util.Connection; +import org.eclipse.microprofile.fault.tolerance.tck.util.TestException; import org.eclipse.microprofile.faulttolerance.Timeout; import org.jboss.arquillian.container.test.api.Deployment; import org.jboss.arquillian.testng.Arquillian; @@ -78,7 +79,8 @@ public static WebArchive deploy() { JavaArchive testJar = ShrinkWrap .create(JavaArchive.class, "ftAsyncTimeout.jar") - .addClasses(AsyncTimeoutClient.class, AsyncClassLevelTimeoutClient.class, Connection.class) + .addClasses(AsyncTimeoutClient.class, AsyncClassLevelTimeoutClient.class, Connection.class, + TestException.class) .addAsManifestResource(config, "microprofile-config.properties") .addAsManifestResource(EmptyAsset.INSTANCE, "beans.xml") .as(JavaArchive.class); diff --git a/tck/src/main/java/org/eclipse/microprofile/fault/tolerance/tck/CircuitBreakerInitialSuccessTest.java b/tck/src/main/java/org/eclipse/microprofile/fault/tolerance/tck/CircuitBreakerInitialSuccessTest.java index 5df17a4c..78196fe8 100644 --- a/tck/src/main/java/org/eclipse/microprofile/fault/tolerance/tck/CircuitBreakerInitialSuccessTest.java +++ b/tck/src/main/java/org/eclipse/microprofile/fault/tolerance/tck/CircuitBreakerInitialSuccessTest.java @@ -22,6 +22,7 @@ import static org.eclipse.microprofile.fault.tolerance.tck.Misc.Ints.contains; import org.eclipse.microprofile.fault.tolerance.tck.circuitbreaker.clientserver.CircuitBreakerClientDefaultSuccessThreshold; +import org.eclipse.microprofile.fault.tolerance.tck.util.TestException; import org.eclipse.microprofile.faulttolerance.exceptions.CircuitBreakerOpenException; import org.jboss.arquillian.container.test.api.Deployment; import org.jboss.arquillian.testng.Arquillian; @@ -49,7 +50,8 @@ public class CircuitBreakerInitialSuccessTest extends Arquillian { public static WebArchive deploy() { JavaArchive testJar = ShrinkWrap.create(JavaArchive.class, "ftCircuitBreakerInitialSuccess.jar") .addClasses(CircuitBreakerClientDefaultSuccessThreshold.class, - Misc.class) + Misc.class, + TestException.class) .addAsManifestResource(EmptyAsset.INSTANCE, "beans.xml") .as(JavaArchive.class); @@ -63,12 +65,12 @@ public static WebArchive deploy() { * * With requestVolumeThreshold = 4, failureRatio=0.75 and successThreshold = 1 the expected behaviour is, * - * Execution Behaviour ========= ========= 1 SUCCESS 2 RunTimeException 3 RunTimeException 4 RunTimeException 5 + * Execution Behaviour ========= ========= 1 SUCCESS 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 SUCCESS 8 RunTimeException - * 9 RunTimeException 10 RuntimeException 11 CircuitBreakerOpenException + * need to be made - of which at least 3 need to fail - for the Circuit to open again) 7 SUCCESS 8 TestException 9 + * TestException 10 TestException 11 CircuitBreakerOpenException * */ @Test @@ -97,15 +99,15 @@ public void testCircuitInitialSuccessDefaultSuccessThreshold() { e.printStackTrace(); } } - } catch (RuntimeException ex) { + } catch (TestException ex) { // Expected if (!contains(new int[]{2, 3, 4, 8, 9, 10}, i)) { - Assert.fail("serviceA should not throw a RuntimeException on iteration " + i); + Assert.fail("serviceA should not throw a TestException on iteration " + i); } } catch (Exception ex) { // Not Expected Assert.fail( - "serviceA should throw a RuntimeException or CircuitBreakerOpenException in testCircuitDefaultSuccessThreshold " + "serviceA should throw a TestException or CircuitBreakerOpenException in testCircuitDefaultSuccessThreshold " + "on iteration " + i); } } diff --git a/tck/src/main/java/org/eclipse/microprofile/fault/tolerance/tck/CircuitBreakerLateSuccessTest.java b/tck/src/main/java/org/eclipse/microprofile/fault/tolerance/tck/CircuitBreakerLateSuccessTest.java index 93492982..29b8d891 100644 --- a/tck/src/main/java/org/eclipse/microprofile/fault/tolerance/tck/CircuitBreakerLateSuccessTest.java +++ b/tck/src/main/java/org/eclipse/microprofile/fault/tolerance/tck/CircuitBreakerLateSuccessTest.java @@ -22,6 +22,7 @@ import static org.eclipse.microprofile.fault.tolerance.tck.Misc.Ints.contains; import org.eclipse.microprofile.fault.tolerance.tck.circuitbreaker.clientserver.CircuitBreakerClientDefaultSuccessThreshold; +import org.eclipse.microprofile.fault.tolerance.tck.util.TestException; import org.eclipse.microprofile.faulttolerance.exceptions.CircuitBreakerOpenException; import org.jboss.arquillian.container.test.api.Deployment; import org.jboss.arquillian.testng.Arquillian; @@ -49,7 +50,8 @@ public class CircuitBreakerLateSuccessTest extends Arquillian { public static WebArchive deploy() { JavaArchive testJar = ShrinkWrap.create(JavaArchive.class, "ftCircuitBreakerLateSuccess.jar") .addClasses(CircuitBreakerClientDefaultSuccessThreshold.class, - Misc.class) + Misc.class, + TestException.class) .addAsManifestResource(EmptyAsset.INSTANCE, "beans.xml") .as(JavaArchive.class); @@ -99,10 +101,10 @@ public void testCircuitLateSuccessDefaultSuccessThreshold() { e.printStackTrace(); } } - } catch (RuntimeException ex) { + } catch (TestException ex) { // Expected if (!contains(new int[]{1, 2, 3, 7, 8, 9}, i)) { - Assert.fail("serviceA should not throw a RuntimeException on iteration " + i); + Assert.fail("serviceA should not throw a RuntimeException on iteration " + i, ex); } } catch (Exception ex) { // Not Expected diff --git a/tck/src/main/java/org/eclipse/microprofile/fault/tolerance/tck/CircuitBreakerRetryTest.java b/tck/src/main/java/org/eclipse/microprofile/fault/tolerance/tck/CircuitBreakerRetryTest.java index 145bca79..b0237ac0 100644 --- a/tck/src/main/java/org/eclipse/microprofile/fault/tolerance/tck/CircuitBreakerRetryTest.java +++ b/tck/src/main/java/org/eclipse/microprofile/fault/tolerance/tck/CircuitBreakerRetryTest.java @@ -81,7 +81,8 @@ public static WebArchive deploy() { JavaArchive testJar = ShrinkWrap.create(JavaArchive.class, "ftCircuitBreakerRetry.jar") .addClasses(CircuitBreakerClientWithRetry.class, CircuitBreakerClassLevelClientWithRetry.class, - CircuitBreakerClientWithRetryAsync.class) + CircuitBreakerClientWithRetryAsync.class, + TestException.class) .addPackage(Packages.UTILS) .addAsManifestResource(EmptyAsset.INSTANCE, "beans.xml") .addAsManifestResource(config, "microprofile-config.properties") @@ -128,7 +129,7 @@ public void testCircuitOpenWithMoreRetries() { /** * A test to exercise Circuit Breaker thresholds with insufficient retries to open the Circuit so that the Circuit - * remains closed and a RuntimeException is caught. + * remains closed and a TestException is caught. */ @Test public void testCircuitOpenWithFewRetries() { @@ -145,10 +146,10 @@ public void testCircuitOpenWithFewRetries() { // Not Expected invokeCounter = clientForCBWithRetry.getCounterForInvokingServiceB(); Assert.fail( - "serviceB should retry or throw a RuntimeException (not a CBOE) in testCircuitOpenWithFewRetries on iteration " + "serviceB should retry or throw a TestException (not a CBOE) in testCircuitOpenWithFewRetries on iteration " + invokeCounter); - } catch (RuntimeException ex) { + } catch (TestException ex) { // Expected on iteration 3 invokeCounter = clientForCBWithRetry.getCounterForInvokingServiceB(); if (invokeCounter < 3) { @@ -159,7 +160,7 @@ public void testCircuitOpenWithFewRetries() { // Not Expected invokeCounter = clientForCBWithRetry.getCounterForInvokingServiceB(); Assert.fail( - "serviceB should retry or throw a RuntimeException in testCircuitOpenWithFewRetries on iteration " + "serviceB should retry or throw a TestException in testCircuitOpenWithFewRetries on iteration " + invokeCounter); } @@ -220,10 +221,10 @@ public void testClassLevelCircuitOpenWithFewRetries() { // Not Expected invokeCounter = clientForClassLevelCBWithRetry.getCounterForInvokingServiceB(); Assert.fail( - "serviceB should retry or throw a RuntimeException (not a CBOE) in testClassLevelCircuitOpenWithFewRetries on iteration " + "serviceB should retry or throw a TestException (not a CBOE) in testClassLevelCircuitOpenWithFewRetries on iteration " + invokeCounter); - } catch (RuntimeException ex) { + } catch (TestException ex) { // Expected on iteration 3 invokeCounter = clientForClassLevelCBWithRetry.getCounterForInvokingServiceB(); if (invokeCounter < 3) { @@ -234,7 +235,7 @@ public void testClassLevelCircuitOpenWithFewRetries() { // Not Expected invokeCounter = clientForClassLevelCBWithRetry.getCounterForInvokingServiceB(); Assert.fail( - "serviceB should retry or throw a RuntimeException in testClassLevelCircuitOpenWithFewRetries on iteration " + "serviceB should retry or throw a TestException in testClassLevelCircuitOpenWithFewRetries on iteration " + invokeCounter); } @@ -407,7 +408,7 @@ public void testCircuitOpenWithMoreRetriesAsync() { /** * A test to exercise Circuit Breaker thresholds with insufficient retries to open the Circuit so that the Circuit - * remains closed and a RuntimeException is caught when using an Asynchronous call. + * remains closed and a TestException is caught when using an Asynchronous call. */ @Test public void testCircuitOpenWithFewRetriesAsync() { @@ -437,7 +438,7 @@ public void testCircuitOpenWithFewRetriesAsync() { // Not Expected invokeCounter = clientForCBWithRetryAsync.getCounterForInvokingServiceB(); Assert.fail( - "serviceB should retry or throw a RuntimeException in testCircuitOpenWithFewRetries on iteration " + "serviceB should retry or throw a TestException in testCircuitOpenWithFewRetries on iteration " + invokeCounter); } diff --git a/tck/src/main/java/org/eclipse/microprofile/fault/tolerance/tck/CircuitBreakerTest.java b/tck/src/main/java/org/eclipse/microprofile/fault/tolerance/tck/CircuitBreakerTest.java index 9601f87f..b295f6b6 100644 --- a/tck/src/main/java/org/eclipse/microprofile/fault/tolerance/tck/CircuitBreakerTest.java +++ b/tck/src/main/java/org/eclipse/microprofile/fault/tolerance/tck/CircuitBreakerTest.java @@ -27,6 +27,7 @@ import org.eclipse.microprofile.fault.tolerance.tck.circuitbreaker.clientserver.CircuitBreakerClientNoDelay; import org.eclipse.microprofile.fault.tolerance.tck.circuitbreaker.clientserver.CircuitBreakerClientRollingWindow; import org.eclipse.microprofile.fault.tolerance.tck.circuitbreaker.clientserver.CircuitBreakerClientWithDelay; +import org.eclipse.microprofile.fault.tolerance.tck.util.TestException; import org.eclipse.microprofile.faulttolerance.exceptions.CircuitBreakerOpenException; import org.jboss.arquillian.container.test.api.Deployment; import org.jboss.arquillian.testng.Arquillian; @@ -64,7 +65,8 @@ public static WebArchive deploy() { CircuitBreakerClientDefaultSuccessThreshold.class, CircuitBreakerClientHigherSuccessThreshold.class, CircuitBreakerClientRollingWindow.class, - Misc.class) + Misc.class, + TestException.class) .addAsManifestResource(EmptyAsset.INSTANCE, "beans.xml") .as(JavaArchive.class); @@ -78,8 +80,8 @@ public static WebArchive deploy() { * With requestVolumeThreshold = 4, failureRatio=0.75, successThreshold = 2, delay = 50000 the expected behaviour * is, * - * Execution Behaviour ========= ========= 1 RunTimeException 2 RunTimeException 3 RunTimeException 4 - * RunTimeException 5 CircuitBreakerOpenException 6 CircuitBreakerOpenException 7 CircuitBreakerOpenException + * Execution Behaviour ========= ========= 1 TestException 2 TestException 3 TestException 4 TestException 5 + * CircuitBreakerOpenException 6 CircuitBreakerOpenException 7 CircuitBreakerOpenException */ @Test public void testCircuitClosedThenOpen() { @@ -95,17 +97,17 @@ public void testCircuitClosedThenOpen() { // Expected on iteration 5 if (i < 5) { Assert.fail( - "serviceA should throw a RuntimeException in testCircuitClosedThenOpen on iteration " + i); + "serviceA should throw a TestException in testCircuitClosedThenOpen on iteration " + i); } - } catch (RuntimeException ex) { + } catch (TestException ex) { // Expected if (!contains(new int[]{1, 2, 3, 4}, i)) { - Assert.fail("serviceA should not throw a RuntimeException on iteration " + i); + Assert.fail("serviceA should not throw a TestException on iteration " + i); } } catch (Exception ex) { // Not Expected Assert.fail( - "serviceA should throw a RuntimeException or CircuitBreakerOpenException in testCircuitClosedThenOpen on iteration " + "serviceA should throw a TestException or CircuitBreakerOpenException in testCircuitClosedThenOpen on iteration " + i); } } @@ -119,9 +121,9 @@ public void testCircuitClosedThenOpen() { * * With requestVolumeThreshold = 4, failureRatio=0.75 and successThreshold = 2 the expected behaviour is, * - * Execution Behaviour ========= ========= 1 RunTimeException 2 RunTimeException 3 RunTimeException 4 - * RunTimeException 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 + * 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 */ @Test public void testCircuitReClose() { @@ -144,16 +146,16 @@ public void testCircuitReClose() { // The CB delay has been set to 1 ms, so the CB should // transition to half-open on iteration 4 and we // should not see a CircuitBreakerOpenException - Assert.fail("serviceA should throw a RuntimeException in testCircuitReClose on iteration " + i); - } catch (RuntimeException ex) { + Assert.fail("serviceA should throw a TestException in testCircuitReClose on iteration " + i); + } catch (TestException ex) { // Expected if (!contains(new int[]{1, 2, 3, 4}, i)) { - Assert.fail("serviceA should not throw a RuntimeException on iteration " + i); + Assert.fail("serviceA should not throw a TestException on iteration " + i); } } catch (Exception ex) { // Not Expected Assert.fail( - "serviceA should succeed or throw a RuntimeException in testCircuitReClose on iteration " + i); + "serviceA should succeed or throw a TestException in testCircuitReClose on iteration " + i); } } int serviceAExecutions = clientForCBNoDelay.getCounterForInvokingServiceA(); @@ -166,12 +168,12 @@ public void testCircuitReClose() { * * With requestVolumeThreshold = 4, failureRatio=0.75 and successThreshold = 1 the expected behaviour is, * - * Execution Behaviour ========= ========= 1 RunTimeException 2 RunTimeException 3 RunTimeException 4 - * RunTimeException 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 - * RunTimeException 8 RunTimeException 9 RunTimeException 10 RuntimeException 11 CircuitBreakerOpenException + * 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 * */ @Test @@ -201,15 +203,15 @@ public void testCircuitDefaultSuccessThreshold() { e.printStackTrace(); } } - } catch (RuntimeException ex) { + } catch (TestException ex) { // Expected if (!contains(new int[]{1, 2, 3, 4, 7, 8, 9, 10}, i)) { - Assert.fail("serviceA should not throw a RuntimeException on iteration " + i); + Assert.fail("serviceA should not throw a TestException on iteration " + i); } } catch (Exception ex) { // Not Expected Assert.fail( - "serviceA should throw a RuntimeException or CircuitBreakerOpenException in testCircuitDefaultSuccessThreshold " + "serviceA should throw a TestException or CircuitBreakerOpenException in testCircuitDefaultSuccessThreshold " + "on iteration " + i); } } @@ -223,10 +225,9 @@ public void testCircuitDefaultSuccessThreshold() { * * With requestVolumeThreshold = 4, failureRatio=0.75 and successThreshold = 3 the expected behaviour is, * - * Execution Behaviour ========= ========= 1 RunTimeException 2 RunTimeException 3 RunTimeException 4 - * RunTimeException 5 CircuitBreakerOpenException Pause for longer than CircuitBreaker delay, so that it transitions - * to half-open 6 SUCCEED 7 SUCCEED 8 RunTimeException (CircuitBreaker will be re-opened) 9 - * CircuitBreakerOpenException + * 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 * */ @Test @@ -256,17 +257,17 @@ public void testCircuitHighSuccessThreshold() { "serviceA should not throw a CircuitBreakerOpenException in testCircuitHighSuccessThreshold on iteration " + i); } - } catch (RuntimeException ex) { + } catch (TestException ex) { // Check expected iterations if (!Misc.Ints.contains(new int[]{1, 2, 3, 4, 8}, i)) { Assert.fail( - "serviceA should not have thrown a RuntimeException in testCircuitHighSuccessThreshold on iteration " + "serviceA should not have thrown a TestException in testCircuitHighSuccessThreshold on iteration " + i); } } catch (Exception ex) { // Not Expected Assert.fail( - "serviceA should throw a RuntimeException or CircuitBreakerOpenException in testCircuitHighSuccessThreshold " + "serviceA should throw a TestException or CircuitBreakerOpenException in testCircuitHighSuccessThreshold " + "on iteration " + i); } } @@ -281,8 +282,8 @@ public void testCircuitHighSuccessThreshold() { * With requestVolumeThreshold = 4, failureRatio=0.75, successThreshold = 2 , delay = 50000 the expected behaviour * is, * - * Execution Behaviour ========= ========= 1 RunTimeException 2 RunTimeException 3 RunTimeException 4 - * RunTimeException 5 CircuitBreakerOpenException 6 CircuitBreakerOpenException 7 CircuitBreakerOpenException + * Execution Behaviour ========= ========= 1 TestException 2 TestException 3 TestException 4 TestException 5 + * CircuitBreakerOpenException 6 CircuitBreakerOpenException 7 CircuitBreakerOpenException */ @Test public void testClassLevelCircuitBase() { @@ -299,17 +300,17 @@ public void testClassLevelCircuitBase() { if (i < 5) { Assert.fail( - "serviceA should throw a RuntimeException in testClassLevelCircuitBase on iteration " + i); + "serviceA should throw a TestException in testClassLevelCircuitBase on iteration " + i); } - } catch (RuntimeException ex) { + } catch (TestException ex) { // Expected if (!contains(new int[]{1, 2, 3, 4}, i)) { - Assert.fail("serviceA should not throw a RuntimeException on iteration " + i); + Assert.fail("serviceA should not throw a TestException on iteration " + i); } } catch (Exception ex) { // Not Expected Assert.fail( - "serviceA should throw a RuntimeException or CircuitBreakerOpenException in testClassLevelCircuitBase on iteration " + "serviceA should throw a TestException or CircuitBreakerOpenException in testClassLevelCircuitBase on iteration " + i); } } @@ -325,7 +326,7 @@ public void testClassLevelCircuitBase() { * * With successThreshold = 2, requestVolumeThreshold = 2, failureRatio=1, delay = 50000 the expected behaviour is, * - * Execution Behaviour ========= ========= 1 RunTimeException 2 RunTimeException 3 CircuitBreakerOpenException 4 + * Execution Behaviour ========= ========= 1 TestException 2 TestException 3 CircuitBreakerOpenException 4 * CircuitBreakerOpenException 5 CircuitBreakerOpenException 6 CircuitBreakerOpenException 7 * CircuitBreakerOpenException */ @@ -343,18 +344,18 @@ public void testClassLevelCircuitOverride() { // Expected starting from iteration 3 if (i < 3) { Assert.fail( - "serviceC should throw a RuntimeException in testClassLevelCircuitOverride on iteration " + "serviceC should throw a TestException in testClassLevelCircuitOverride on iteration " + i); } - } catch (RuntimeException ex) { + } catch (TestException ex) { // Expected if (!contains(new int[]{1, 2}, i)) { - Assert.fail("serviceC should not throw a RuntimeException on iteration " + i); + Assert.fail("serviceC should not throw a TestException on iteration " + i); } } catch (Exception ex) { // Not Expected Assert.fail( - "serviceC should throw a RuntimeException or CircuitBreakerOpenException in testClassLevelCircuitOverride " + "serviceC should throw a TestException or CircuitBreakerOpenException in testClassLevelCircuitOverride " + "on iteration " + i); } } @@ -370,9 +371,9 @@ public void testClassLevelCircuitOverride() { * * With successThreshold = 2, requestVolumeThreshold = 4, failureRatio=0.75, delay = 1 the expected behaviour is, * - * Execution Behaviour ========= ========= 1 RunTimeException 2 RunTimeException 3 RunTimeException 4 - * RunTimeException 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 + * 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 */ @Test public void testClassLevelCircuitOverrideNoDelay() { @@ -399,17 +400,17 @@ public void testClassLevelCircuitOverrideNoDelay() { // transition to half-open on iteration 4 and we // should not see a CircuitBreakerOpenException Assert.fail( - "serviceD should throw a RuntimeException in testClassLevelCircuitOverrideNoDelay on iteration " + "serviceD should throw a TestException in testClassLevelCircuitOverrideNoDelay on iteration " + i); - } catch (RuntimeException ex) { + } catch (TestException ex) { // Expected if (!contains(new int[]{1, 2, 3, 4}, i)) { - Assert.fail("serviceD should not throw a RuntimeException on iteration " + i); + Assert.fail("serviceD should not throw a TestException on iteration " + i); } } catch (Exception ex) { // Not Expected Assert.fail( - "serviceD should succeed or throw a RuntimeException in testClassLevelCircuitOverrideNoDelay " + "serviceD should succeed or throw a TestException in testClassLevelCircuitOverrideNoDelay " + "on iteration " + i); } } @@ -423,7 +424,7 @@ public void testClassLevelCircuitOverrideNoDelay() { * * With requestVolumeThreshold = 4, failureRatio=0.5, expected behaviour is, * - * Execution Behaviour ========= ========= 1 Success 2 RunTimeException 3 RunTimeException 4 Success 5 + * Execution Behaviour ========= ========= 1 Success 2 TestException 3 TestException 4 Success 5 * CircuitBreakerOpenException */ @Test @@ -441,15 +442,15 @@ public void testRollingWindowCircuitOpen() { "serviceA should not throw a CircuitBreakerOpenException in testRollingWindowCircuitOpen on iteration " + i); } - } catch (RuntimeException ex) { + } catch (TestException ex) { // Expected if (!contains(new int[]{2, 3}, i)) { - Assert.fail("serviceA should not throw a RuntimeException on iteration " + i); + Assert.fail("serviceA should not throw a TestException on iteration " + i); } } catch (Exception ex) { // Not Expected Assert.fail( - "serviceA should throw a RuntimeException or CircuitBreakerOpenException in testRollingWindowCircuitOpen " + "serviceA should throw a TestException or CircuitBreakerOpenException in testRollingWindowCircuitOpen " + "on iteration " + i); } } @@ -465,7 +466,7 @@ public void testRollingWindowCircuitOpen() { * * With requestVolumeThreshold = 4, failureRatio=0.5, expected behaviour is, * - * Execution Behaviour ========= ========= 1 Success 2 RunTimeException 3 Success 4 Success 5 RuntimeException 6 + * Execution Behaviour ========= ========= 1 Success 2 TestException 3 Success 4 Success 5 TestException 6 * CircuitBreakerOpenException */ @Test @@ -483,15 +484,15 @@ public void testRollingWindowCircuitOpen2() { "serviceA should not throw a CircuitBreakerOpenException in testRollingWindowCircuitOpen2 " + "on iteration " + i); } - } catch (RuntimeException ex) { + } catch (TestException ex) { // Expected if (!contains(new int[]{2, 5}, i)) { - Assert.fail("serviceA should not throw a RuntimeException on iteration " + i); + Assert.fail("serviceA should not throw a TestException on iteration " + i); } } catch (Exception ex) { // Not Expected Assert.fail( - "serviceA should throw a RuntimeException or CircuitBreakerOpenException in testRollingWindowCircuitOpen2 " + "serviceA should throw a TestException or CircuitBreakerOpenException in testRollingWindowCircuitOpen2 " + "on iteration " + i); } } diff --git a/tck/src/main/java/org/eclipse/microprofile/fault/tolerance/tck/ConfigTest.java b/tck/src/main/java/org/eclipse/microprofile/fault/tolerance/tck/ConfigTest.java index 79af0f05..cc5b03f2 100644 --- a/tck/src/main/java/org/eclipse/microprofile/fault/tolerance/tck/ConfigTest.java +++ b/tck/src/main/java/org/eclipse/microprofile/fault/tolerance/tck/ConfigTest.java @@ -22,6 +22,7 @@ import org.eclipse.microprofile.fault.tolerance.tck.config.clientserver.ConfigClassLevelClient; import org.eclipse.microprofile.fault.tolerance.tck.config.clientserver.ConfigClassLevelMaxDurationClient; import org.eclipse.microprofile.fault.tolerance.tck.config.clientserver.ConfigClient; +import org.eclipse.microprofile.fault.tolerance.tck.util.TestException; import org.jboss.arquillian.container.test.api.Deployment; import org.jboss.arquillian.testng.Arquillian; import org.jboss.shrinkwrap.api.ShrinkWrap; @@ -53,7 +54,8 @@ public class ConfigTest extends Arquillian { public static WebArchive deploy() { JavaArchive testJar = ShrinkWrap .create(JavaArchive.class, "ftConfig.jar") - .addClasses(ConfigClient.class, ConfigClassLevelClient.class, ConfigClassLevelMaxDurationClient.class) + .addClasses(ConfigClient.class, ConfigClassLevelClient.class, ConfigClassLevelMaxDurationClient.class, + TestException.class) .addAsManifestResource(new StringAsset( "org.eclipse.microprofile.fault.tolerance.tck.config.clientserver.ConfigClient/serviceA/Retry/maxRetries=3" + @@ -86,8 +88,8 @@ public void testConfigMaxRetries() { try { clientForConfig.serviceA(); - Assert.fail("serviceA should throw a RuntimeException in testConfigMaxRetries"); - } catch (RuntimeException ex) { + Assert.fail("serviceA should throw a TestException in testConfigMaxRetries"); + } catch (TestException ex) { // Expected } int count = clientForConfig.getCounterForInvokingConnectionService(); @@ -108,8 +110,8 @@ public void testClassLevelConfigMaxRetries() { try { clientForClassLevelConfig.serviceA(); - Assert.fail("serviceA should throw a RuntimeException in testClassLevelConfigMaxRetries"); - } catch (RuntimeException ex) { + Assert.fail("serviceA should throw a TestException in testClassLevelConfigMaxRetries"); + } catch (TestException ex) { // Expected } int count = clientForClassLevelConfig.getCounterForInvokingConnectionService(); @@ -130,8 +132,8 @@ public void testClassLevelConfigMethodOverrideMaxRetries() { try { clientForClassLevelConfig.serviceB(); - Assert.fail("serviceB should throw a RuntimeException in testClassLevelConfigMethodOverrideMaxRetries"); - } catch (RuntimeException ex) { + Assert.fail("serviceB should throw a TestException in testClassLevelConfigMethodOverrideMaxRetries"); + } catch (TestException ex) { // Expected } int count = clientForClassLevelConfig.getCounterForInvokingConnectionService(); @@ -151,8 +153,8 @@ public void testClassLevelConfigMethodOverrideMaxRetries() { public void testConfigMaxDuration() { try { clientForConfig.serviceC(); - Assert.fail("serviceC should throw a RuntimeException in testConfigMaxDuration"); - } catch (RuntimeException ex) { + Assert.fail("serviceC should throw a TestException in testConfigMaxDuration"); + } catch (TestException ex) { // Expected } @@ -177,8 +179,8 @@ public void testConfigMaxDuration() { public void testClassLevelConfigMaxDuration() { try { clientForClassLevelMaxDurationConfig.serviceA(); - Assert.fail("serviceB should throw a RuntimeException in testClassLevelConfigMaxDuration"); - } catch (RuntimeException ex) { + Assert.fail("serviceB should throw a TestException in testClassLevelConfigMaxDuration"); + } catch (TestException ex) { // Expected } diff --git a/tck/src/main/java/org/eclipse/microprofile/fault/tolerance/tck/FallbackTest.java b/tck/src/main/java/org/eclipse/microprofile/fault/tolerance/tck/FallbackTest.java index b7c7697f..f40837d3 100644 --- a/tck/src/main/java/org/eclipse/microprofile/fault/tolerance/tck/FallbackTest.java +++ b/tck/src/main/java/org/eclipse/microprofile/fault/tolerance/tck/FallbackTest.java @@ -27,6 +27,7 @@ import org.eclipse.microprofile.fault.tolerance.tck.fallback.clientserver.SecondStringFallbackHandler; import org.eclipse.microprofile.fault.tolerance.tck.fallback.clientserver.StringFallbackHandler; import org.eclipse.microprofile.fault.tolerance.tck.fallback.clientserver.StringFallbackHandlerWithBean; +import org.eclipse.microprofile.fault.tolerance.tck.util.TestException; import org.eclipse.microprofile.faulttolerance.exceptions.TimeoutException; import org.jboss.arquillian.container.test.api.Deployment; import org.jboss.arquillian.testng.Arquillian; @@ -59,7 +60,7 @@ public static WebArchive deploy() { FallbackClassLevelClient.class, StringFallbackHandler.class, SecondStringFallbackHandler.class, StringFallbackHandlerWithBean.class, MyBean.class, - FallbackOnlyClient.class) + FallbackOnlyClient.class, TestException.class) .addAsManifestResource(EmptyAsset.INSTANCE, "beans.xml") .as(JavaArchive.class); @@ -81,8 +82,8 @@ public void testFallbackSuccess() { String result = fallbackClient.serviceA(); Assert.assertTrue(result.contains("serviceA"), "The message should be \"fallback for serviceA\""); - } catch (RuntimeException ex) { - Assert.fail("serviceA should not throw a RuntimeException in testFallbackSuccess"); + } catch (TestException ex) { + Assert.fail("serviceA should not throw a RuntimeException in testFallbackSuccess", ex); } Assert.assertEquals(fallbackClient.getCounterForInvokingServiceA(), 2, "The execution count should be 2 (1 retry + 1)"); @@ -90,8 +91,8 @@ public void testFallbackSuccess() { String result = fallbackClient.serviceB(); Assert.assertTrue(result.contains("serviceB"), "The message should be \"fallback for serviceB\""); - } catch (RuntimeException ex) { - Assert.fail("serviceB should not throw a RuntimeException in testFallbackSuccess"); + } catch (TestException ex) { + Assert.fail("serviceB should not throw a RuntimeException in testFallbackSuccess", ex); } Assert.assertEquals(fallbackClient.getCounterForInvokingServiceB(), 3, "The execution count should be 3 (2 retries + 1)"); @@ -113,8 +114,8 @@ public void testFallbackWithBeanSuccess() { // MyBean should be injected to the fallbackA Assert.assertTrue(result.contains("34"), "The message should be \"fallback for serviceA myBean.getCount()=34\""); - } catch (RuntimeException ex) { - Assert.fail("serviceA should not throw a RuntimeException in testFallbackWithBeanSuccess"); + } catch (TestException ex) { + Assert.fail("serviceA should not throw a RuntimeException in testFallbackWithBeanSuccess", ex); } Assert.assertEquals(fallbackWithBeanClient.getCounterForInvokingServiceA(), 2, "The execution count should be 2 (1 retry + 1)"); @@ -126,8 +127,8 @@ public void testFallbackWithBeanSuccess() { // so the same instance should be injected to the fallback handler Assert.assertTrue(result.contains("35"), "The message should be \"fallback for serviceB myBean.getCount()=35\""); - } catch (RuntimeException ex) { - Assert.fail("serviceB should not throw a RuntimeException in testFallbackWithBeanSuccess"); + } catch (TestException ex) { + Assert.fail("serviceB should not throw a RuntimeException in testFallbackWithBeanSuccess", ex); } Assert.assertEquals(fallbackWithBeanClient.getCounterForInvokingServiceB(), 3, "The execution count should be 3 (2 retries + 1)"); @@ -144,8 +145,8 @@ public void testClassLevelFallbackSuccess() { String result = fallbackClassLevelClient.serviceA(); Assert.assertTrue(result.contains("serviceA"), "The message should be \"fallback for serviceA\""); - } catch (RuntimeException ex) { - Assert.fail("serviceA should not throw a RuntimeException in testFallbackSuccess"); + } catch (TestException ex) { + Assert.fail("serviceA should not throw a RuntimeException in testFallbackSuccess", ex); } Assert.assertEquals(fallbackClassLevelClient.getCounterForInvokingServiceA(), 2, "The execution count should be 2 (1 retry + 1)"); @@ -153,11 +154,11 @@ public void testClassLevelFallbackSuccess() { String result = fallbackClassLevelClient.serviceB(); Assert.assertTrue(result.contains("second fallback for serviceB"), "The message should be \"second fallback for serviceB\""); - Assert.assertTrue(result.contains(RuntimeException.class.getName()), - "The message should be " + RuntimeException.class.getName()); + Assert.assertTrue(result.contains(TestException.class.getName()), + "The message should be " + TestException.class.getName()); - } catch (RuntimeException ex) { - Assert.fail("serviceB should not throw a RuntimeException in testFallbackSuccess"); + } catch (TestException ex) { + Assert.fail("serviceB should not throw a RuntimeException in testFallbackSuccess", ex); } Assert.assertEquals(fallbackClassLevelClient.getCounterForInvokingServiceB(), 3, "The execution count should be 3 (2 retries + 1)"); @@ -178,9 +179,9 @@ public void testFallbacktNoTimeout() { } catch (TimeoutException ex) { // Not Expected Assert.fail("serviceC should not throw a TimeoutException in testFallbacktNoTimeout"); - } catch (RuntimeException ex) { + } catch (TestException ex) { // Not expected - Assert.fail("serviceC should not throw a RuntimeException in testFallbacktNoTimeout"); + Assert.fail("serviceC should not throw a RuntimeException in testFallbacktNoTimeout", ex); } Assert.assertEquals(fallbackClient.getCounterForInvokingServiceC(), 2, @@ -202,9 +203,9 @@ public void testFallbackTimeout() { } catch (TimeoutException ex) { // Not Expected Assert.fail("serviceC should not throw a TimeoutException in testFallbackTimeout"); - } catch (RuntimeException ex) { + } catch (TestException ex) { // Not Expected - Assert.fail("serviceC should not throw a RuntimeException in testFallbackTimeout"); + Assert.fail("serviceC should not throw a RuntimeException in testFallbackTimeout", ex); } Assert.assertEquals(fallbackClient.getCounterForInvokingServiceC(), 2, @@ -224,8 +225,8 @@ public void testFallbackMethodSuccess() { String result = fallbackClient.serviceD(); Assert.assertTrue(result.contains("method for serviceD"), "The message should be \"fallback method for serviceD\""); - } catch (RuntimeException ex) { - Assert.fail("serviceD should not throw a RuntimeException in testFallbackMethodSuccess"); + } catch (TestException ex) { + Assert.fail("serviceD should not throw a RuntimeException in testFallbackMethodSuccess", ex); } Assert.assertEquals(fallbackClient.getCounterForInvokingServiceD(), 2, "The execution count should be 2 (1 retry + 1)"); @@ -245,8 +246,8 @@ public void testFallbackMethodWithArgsSuccess() { String result = fallbackClient.serviceE("serviceE", 42); Assert.assertTrue(result.contains("method for serviceE"), "The message should be \"fallback method for serviceE\""); - } catch (RuntimeException ex) { - Assert.fail("serviceE should not throw a RuntimeException in testFallbackMethodWithArgsSuccess"); + } catch (TestException ex) { + Assert.fail("serviceE should not throw a RuntimeException in testFallbackMethodWithArgsSuccess", ex); } Assert.assertEquals(fallbackClient.getCounterForInvokingServiceE(), 2, "The execution count should be 2 (1 retry + 1)"); @@ -264,8 +265,8 @@ public void testStandaloneHandlerFallback() { String result = fallbackOnlyClient.serviceA(); Assert.assertTrue(result.contains("serviceA"), "The message should be \"fallback for serviceA\""); - } catch (RuntimeException ex) { - Assert.fail("serviceA should not throw a RuntimeException in testStandaloneClassLevelFallback"); + } catch (TestException ex) { + Assert.fail("serviceA should not throw a RuntimeException in testStandaloneClassLevelFallback", ex); } Assert.assertEquals(fallbackOnlyClient.getCounterForInvokingServiceA(), 1, "The getCounterForInvokingServiceA should be 1"); @@ -282,8 +283,8 @@ public void testStandaloneMethodFallback() { String result = fallbackOnlyClient.serviceB(); Assert.assertTrue(result.contains("serviceB"), "The message should be \"fallback method for serviceB\""); - } catch (RuntimeException ex) { - Assert.fail("serviceB should not throw a RuntimeException in testStandaloneMethodFallback"); + } catch (TestException ex) { + Assert.fail("serviceB should not throw a RuntimeException in testStandaloneMethodFallback", ex); } Assert.assertEquals(fallbackOnlyClient.getCounterForInvokingServiceB(), 1, "The getCounterForInvokingServiceB should be 1"); diff --git a/tck/src/main/java/org/eclipse/microprofile/fault/tolerance/tck/RetryConditionTest.java b/tck/src/main/java/org/eclipse/microprofile/fault/tolerance/tck/RetryConditionTest.java index d4be35c7..b04b5315 100644 --- a/tck/src/main/java/org/eclipse/microprofile/fault/tolerance/tck/RetryConditionTest.java +++ b/tck/src/main/java/org/eclipse/microprofile/fault/tolerance/tck/RetryConditionTest.java @@ -42,6 +42,7 @@ import org.eclipse.microprofile.fault.tolerance.tck.util.AsyncCaller; import org.eclipse.microprofile.fault.tolerance.tck.util.AsyncCallerExecutor; import org.eclipse.microprofile.fault.tolerance.tck.util.TCKConfig; +import org.eclipse.microprofile.fault.tolerance.tck.util.TestException; import org.jboss.arquillian.container.test.api.Deployment; import org.jboss.arquillian.testng.Arquillian; import org.jboss.shrinkwrap.api.ShrinkWrap; @@ -62,6 +63,9 @@ */ public class RetryConditionTest extends Arquillian { + private final static String SIMULATED_EXCEPTION_MESSAGE = "Simulated error"; + private final static String SIMULATED_RUNTIME_EXCEPTION_MESSAGE = "Test Exception - Simulated error"; + private @Inject RetryClientRetryOn clientForRetryOn; private @Inject RetryClientAbortOn clientForAbortOn; private @Inject RetryClassLevelClientRetryOn clientForClassLevelRetryOn; @@ -79,7 +83,8 @@ public static WebArchive deploy() { AsyncRetryClient.class, CompletableFutureHelper.class, RetryChildException.class, - RetryParentException.class) + RetryParentException.class, + TestException.class) .addAsManifestResource(EmptyAsset.INSTANCE, "beans.xml") .as(JavaArchive.class); @@ -93,14 +98,14 @@ public static WebArchive deploy() { * Test that retries are executed where a failure declared as "retry on" in the {@code @Retry} annotation is * encountered. * - * serviceA is configured to retry on a RuntimeException. The service should be retried 3 times. + * serviceA is configured to retry on a TestException. The service should be retried 3 times. */ @Test public void testRetryOnTrue() { try { clientForRetryOn.serviceA(); - Assert.fail("serviceA should throw a RuntimeException in testRetryOnTrue"); - } catch (RuntimeException ex) { + Assert.fail("serviceA should throw a TestException in testRetryOnTrue"); + } catch (TestException ex) { // Expected } Assert.assertEquals(clientForRetryOn.getRetryCountForConnectionService(), 4, @@ -112,14 +117,14 @@ public void testRetryOnTrue() { * encountered. * * serviceB is configured to retry on an IOException. In practice the only exception that the service will throw is - * a RuntimeException, therefore no retries should be executed. + * a TestException, therefore no retries should be executed. */ @Test public void testRetryOnFalse() { try { clientForRetryOn.serviceB(); - Assert.fail("serviceB should throw a RuntimeException in testRetryOnFalse"); - } catch (RuntimeException ex) { + Assert.fail("serviceB should throw a TestException in testRetryOnFalse"); + } catch (TestException ex) { // Expected } Assert.assertEquals(clientForRetryOn.getRetryCountForWritingService(), 1, @@ -175,14 +180,14 @@ public void testRetryOnFalseAndAbortOnTrueThrowingAChildCustomException() { * annotation is NOT encountered. * * serviceA is configured to abort on an IOException. In practice the only exception that the service will throw is - * a RuntimeException, therefore the default number of 3 retries should be executed. + * a TestException, therefore the default number of 3 retries should be executed. */ @Test public void testRetryWithAbortOnFalse() { try { clientForAbortOn.serviceA(); - Assert.fail("serviceA should throw a RuntimeException in testRetryWithAbortOnFalse"); - } catch (RuntimeException ex) { + Assert.fail("serviceA should throw a TestException in testRetryWithAbortOnFalse"); + } catch (TestException ex) { // Expected } Assert.assertEquals(clientForAbortOn.getRetryCountForConnectionService(), 4, @@ -193,14 +198,14 @@ public void testRetryWithAbortOnFalse() { * Test that no retries are executed where a failure declared as "abort on" in the {@code @Retry} annotation is * encountered. * - * serviceB is configured to abort on a RuntimeException. The service should not be retried. + * serviceB is configured to abort on a TestException. The service should not be retried. */ @Test public void testRetryWithAbortOnTrue() { try { clientForAbortOn.serviceB(); - Assert.fail("serviceB should throw a RuntimeException in testRetryWithAbortOnTrue"); - } catch (RuntimeException ex) { + Assert.fail("serviceB should throw a TestException in testRetryWithAbortOnTrue"); + } catch (TestException ex) { // Expected } Assert.assertEquals(clientForAbortOn.getRetryCountForWritingService(), 1, @@ -210,14 +215,14 @@ public void testRetryWithAbortOnTrue() { /** * Analogous to testRetryOnTrue but using a Class level rather than method level annotation. * - * serviceA is configured to retry on a RuntimeException. The service should be retried 3 times. + * serviceA is configured to retry on a TestException. The service should be retried 3 times. */ @Test public void testClassLevelRetryOnTrue() { try { clientForClassLevelRetryOn.serviceA(); - Assert.fail("serviceA should throw a RuntimeException in testClassLevelRetryOnTrue"); - } catch (RuntimeException ex) { + Assert.fail("serviceA should throw a TestException in testClassLevelRetryOnTrue"); + } catch (TestException ex) { // Expected } Assert.assertEquals(clientForClassLevelRetryOn.getRetryCountForConnectionService(), 4, @@ -229,14 +234,14 @@ public void testClassLevelRetryOnTrue() { * Class level {@code @Retry} annotation. * * serviceB is configured to retry on an IOException. In practice the only exception that the service will throw is - * a RuntimeException, therefore no retries should be executed. + * a TestException, therefore no retries should be executed. */ @Test public void testClassLevelRetryOnFalse() { try { clientForClassLevelRetryOn.serviceB(); - Assert.fail("serviceB should throw a RuntimeException in testClassLevelRetryOnFalse"); - } catch (RuntimeException ex) { + Assert.fail("serviceB should throw a TestException in testClassLevelRetryOnFalse"); + } catch (TestException ex) { // Expected } Assert.assertEquals(clientForClassLevelRetryOn.getRetryCountForWritingService(), 1, @@ -249,14 +254,14 @@ public void testClassLevelRetryOnFalse() { * {@code @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 RuntimeException, therefore the default number of 3 retries should be executed. + * the service will throw is a TestException, therefore the default number of 3 retries should be executed. */ @Test public void testClassLevelRetryWithAbortOnFalse() { try { clientForClassLevelAbortOn.serviceA(); - Assert.fail("serviceA should throw a RuntimeException in testClassLevelRetryWithAbortOnFalse"); - } catch (RuntimeException ex) { + Assert.fail("serviceA should throw a TestException in testClassLevelRetryWithAbortOnFalse"); + } catch (TestException ex) { // Expected } Assert.assertEquals(clientForClassLevelAbortOn.getRetryCountForConnectionService(), 4, @@ -270,14 +275,14 @@ public void testClassLevelRetryWithAbortOnFalse() { * Test that no retries are executed where a failure declared as "abort on" in the {@code @Retry} annotation is * encountered. * - * serviceB is configured to abort on a RuntimeException. The service should not be retried. + * serviceB is configured to abort on a TestException. The service should not be retried. */ @Test public void testClassLevelRetryWithAbortOnTrue() { try { clientForClassLevelAbortOn.serviceB(); - Assert.fail("serviceB should throw a RuntimeException in testClassLevelRetryWithAbortOnTrue"); - } catch (RuntimeException ex) { + Assert.fail("serviceB should throw a TestException in testClassLevelRetryWithAbortOnTrue"); + } catch (TestException ex) { // Expected } Assert.assertEquals(clientForClassLevelAbortOn.getRetryCountForWritingService(), 1, @@ -292,7 +297,7 @@ public void testClassLevelRetryWithAbortOnTrue() { public void testAsyncRetryExceptionally() { final CompletionStage future = asyncRetryClient.serviceA(); - assertCompleteExceptionally(future, IOException.class, "Simulated error"); + assertCompleteExceptionally(future, IOException.class, SIMULATED_EXCEPTION_MESSAGE); assertEquals(asyncRetryClient.getCountInvocationsServA(), 3); } @@ -305,7 +310,7 @@ public void testNoAsynWilNotRetryExceptionally() { CompletableFuture future = new CompletableFuture<>(); assertCompleteExceptionally(asyncRetryClient.serviceBFailExceptionally(future), - IOException.class, "Simulated error"); + IOException.class, SIMULATED_EXCEPTION_MESSAGE); // no retries assertEquals(asyncRetryClient.getCountInvocationsServBFailExceptionally(), 1, "No retries are expected"); } @@ -321,8 +326,8 @@ public void testNoAsynRetryOnMethodException() { try { asyncRetryClient.serviceBFailException(future); fail("Was expecting an exception"); - } catch (RuntimeException e) { - assertEquals(e.getMessage(), "Simulated error"); + } catch (TestException e) { + assertEquals(e.getMessage(), SIMULATED_RUNTIME_EXCEPTION_MESSAGE); } // 2 retries assertEquals(asyncRetryClient.getCountInvocationsServBFailException(), 3); @@ -359,7 +364,8 @@ public void testRetryChainSuccess() { */ @Test public void testRetryChainExceptionally() { - assertCompleteExceptionally(asyncRetryClient.serviceE(), RuntimeException.class, "Simulated error"); + assertCompleteExceptionally(asyncRetryClient.serviceE(), TestException.class, + SIMULATED_RUNTIME_EXCEPTION_MESSAGE); assertEquals(asyncRetryClient.getCountInvocationsServE(), 3); } @@ -369,7 +375,8 @@ public void testRetryChainExceptionally() { */ @Test public void testRetryParallelExceptionally() { - assertCompleteExceptionally(asyncRetryClient.serviceG(), RuntimeException.class, "Simulated error"); + assertCompleteExceptionally(asyncRetryClient.serviceG(), TestException.class, + SIMULATED_RUNTIME_EXCEPTION_MESSAGE); assertEquals(asyncRetryClient.getCountInvocationsServG(), 3); } diff --git a/tck/src/main/java/org/eclipse/microprofile/fault/tolerance/tck/RetryTest.java b/tck/src/main/java/org/eclipse/microprofile/fault/tolerance/tck/RetryTest.java index d2e8e70b..38a14bbc 100644 --- a/tck/src/main/java/org/eclipse/microprofile/fault/tolerance/tck/RetryTest.java +++ b/tck/src/main/java/org/eclipse/microprofile/fault/tolerance/tck/RetryTest.java @@ -24,6 +24,7 @@ import org.eclipse.microprofile.fault.tolerance.tck.retry.clientserver.RetryClientForMaxRetries; import org.eclipse.microprofile.fault.tolerance.tck.retry.clientserver.RetryClientWithDelay; import org.eclipse.microprofile.fault.tolerance.tck.retry.clientserver.RetryClientWithNoDelayAndJitter; +import org.eclipse.microprofile.fault.tolerance.tck.util.TestException; import org.jboss.arquillian.container.test.api.Deployment; import org.jboss.arquillian.testng.Arquillian; import org.jboss.shrinkwrap.api.ShrinkWrap; @@ -60,7 +61,8 @@ public static WebArchive deploy() { .addClasses(RetryClientForMaxRetries.class, RetryClientWithDelay.class, RetryClassLevelClientForMaxRetries.class, - RetryClientWithNoDelayAndJitter.class) + RetryClientWithNoDelayAndJitter.class, + TestException.class) .addAsManifestResource(EmptyAsset.INSTANCE, "beans.xml") .addAsManifestResource(config, "microprofile-config.properties"); @@ -79,8 +81,8 @@ public static WebArchive deploy() { public void testRetryMaxRetries() { try { clientForMaxRetry.serviceA(); - Assert.fail("serviceA should throw a RuntimeException in testRetryMaxRetries"); - } catch (RuntimeException ex) { + Assert.fail("serviceA should throw a TestException in testRetryMaxRetries"); + } catch (TestException ex) { // Expected } Assert.assertEquals(clientForMaxRetry.getRetryCountForConnectionService(), 6, @@ -91,8 +93,8 @@ public void testRetryMaxRetries() { public void testRetryMaxDuration() { try { clientForMaxRetry.serviceB(); - Assert.fail("serviceB should throw a RuntimeException in testRetryMaxDuration"); - } catch (RuntimeException ex) { + Assert.fail("serviceB should throw a TestException in testRetryMaxDuration"); + } catch (TestException ex) { // Expected } @@ -106,8 +108,8 @@ public void testRetryMaxDuration() { public void testRetryMaxDurationSeconds() { try { clientForMaxRetry.serviceC(); - Assert.fail("serviceC should throw a RuntimeException in testRetryMaxDuration"); - } catch (RuntimeException ex) { + Assert.fail("serviceC should throw a TestException in testRetryMaxDuration"); + } catch (TestException ex) { // Expected } @@ -122,8 +124,8 @@ public void testRetryMaxDurationSeconds() { public void testRetryWithDelay() { try { clientForDelay.serviceA(); - Assert.fail("serviceA should throw a RuntimeException in testRetryWithDelay"); - } catch (RuntimeException ex) { + Assert.fail("serviceA should throw a TestException in testRetryWithDelay"); + } catch (TestException ex) { // Expected } @@ -144,8 +146,8 @@ public void testRetryWithDelay() { public void testRetryWithNoDelayAndJitter() { try { retryClientWithNoDelayAndJitter.serviceA(); - Assert.fail("serviceA should throw a RuntimeException in testRetryWithDelay"); - } catch (RuntimeException ex) { + Assert.fail("serviceA should throw a TestException in testRetryWithDelay"); + } catch (TestException ex) { // Expected } @@ -169,8 +171,8 @@ public void testRetryWithNoDelayAndJitter() { public void testClassLevelRetryMaxRetries() { try { clientForClassLevelMaxRetry.serviceA(); - Assert.fail("serviceA should throw a RuntimeException in testClassLevelRetryMaxRetries"); - } catch (RuntimeException ex) { + Assert.fail("serviceA should throw a TestException in testClassLevelRetryMaxRetries"); + } catch (TestException ex) { // Expected } @@ -189,8 +191,8 @@ public void testClassLevelRetryMaxRetries() { public void testClassLevelRetryMaxDuration() { try { clientForClassLevelMaxRetry.serviceB(); - Assert.fail("serviceB should throw a RuntimeException in testClassLevelRetryMaxDuration"); - } catch (RuntimeException ex) { + Assert.fail("serviceB should throw a TestException in testClassLevelRetryMaxDuration"); + } catch (TestException ex) { // Expected } @@ -216,8 +218,8 @@ public void testClassLevelRetryMaxDuration() { public void testClassLevelRetryMaxDurationSeconds() { try { clientForClassLevelMaxRetry.serviceC(); - Assert.fail("serviceC should throw a RuntimeException in testClassLevelRetryMaxDurationSeconds"); - } catch (RuntimeException ex) { + Assert.fail("serviceC should throw a TestException in testClassLevelRetryMaxDurationSeconds"); + } catch (TestException ex) { // Expected } diff --git a/tck/src/main/java/org/eclipse/microprofile/fault/tolerance/tck/RetryTimeoutTest.java b/tck/src/main/java/org/eclipse/microprofile/fault/tolerance/tck/RetryTimeoutTest.java index 02d191cf..e02ea7ea 100644 --- a/tck/src/main/java/org/eclipse/microprofile/fault/tolerance/tck/RetryTimeoutTest.java +++ b/tck/src/main/java/org/eclipse/microprofile/fault/tolerance/tck/RetryTimeoutTest.java @@ -26,6 +26,7 @@ import org.eclipse.microprofile.fault.tolerance.tck.config.ConfigAnnotationAsset; import org.eclipse.microprofile.fault.tolerance.tck.retrytimeout.clientserver.RetryTimeoutClient; import org.eclipse.microprofile.fault.tolerance.tck.util.TCKConfig; +import org.eclipse.microprofile.fault.tolerance.tck.util.TestException; import org.eclipse.microprofile.faulttolerance.Timeout; import org.eclipse.microprofile.faulttolerance.exceptions.TimeoutException; import org.jboss.arquillian.container.test.api.Deployment; @@ -64,7 +65,7 @@ public static WebArchive deploy() { JavaArchive testJar = ShrinkWrap .create(JavaArchive.class, "ftRetryTimeout.jar") - .addClasses(RetryTimeoutClient.class) + .addClasses(RetryTimeoutClient.class, TestException.class) .addAsManifestResource(config, "microprofile-config.properties") .addAsManifestResource(EmptyAsset.INSTANCE, "beans.xml") .as(JavaArchive.class); @@ -88,9 +89,9 @@ public void testRetryTimeout() { String result = clientForRetryTimeout.serviceA(config.getTimeoutInMillis(1000)); } catch (TimeoutException ex) { // Expected - } catch (RuntimeException ex) { + } catch (TestException ex) { // Not Expected - Assert.fail("serviceA should not throw a RuntimeException in testRetryTimeout"); + Assert.fail("serviceA should not throw a RuntimeException in testRetryTimeout", ex); } Assert.assertEquals(clientForRetryTimeout.getCounterForInvokingServiceA(), 2, @@ -112,7 +113,7 @@ public void testRetryNoTimeout() { } catch (TimeoutException ex) { // Not Expected Assert.fail("serviceA should not throw a TimeoutException in testRetrytNoTimeout"); - } catch (RuntimeException ex) { + } catch (TestException ex) { // Expected } diff --git a/tck/src/main/java/org/eclipse/microprofile/fault/tolerance/tck/TimeoutGlobalConfigTest.java b/tck/src/main/java/org/eclipse/microprofile/fault/tolerance/tck/TimeoutGlobalConfigTest.java index edb59e94..6ab1df4f 100644 --- a/tck/src/main/java/org/eclipse/microprofile/fault/tolerance/tck/TimeoutGlobalConfigTest.java +++ b/tck/src/main/java/org/eclipse/microprofile/fault/tolerance/tck/TimeoutGlobalConfigTest.java @@ -20,6 +20,7 @@ package org.eclipse.microprofile.fault.tolerance.tck; import org.eclipse.microprofile.fault.tolerance.tck.timeout.clientserver.TimeoutClient; +import org.eclipse.microprofile.fault.tolerance.tck.util.TestException; import org.eclipse.microprofile.faulttolerance.exceptions.TimeoutException; import org.jboss.arquillian.container.test.api.Deployment; import org.jboss.arquillian.testng.Arquillian; @@ -44,7 +45,7 @@ public class TimeoutGlobalConfigTest extends Arquillian { public static WebArchive deploy() { JavaArchive testJar = ShrinkWrap .create(JavaArchive.class, "ftTimeout.jar") - .addClasses(TimeoutClient.class) + .addClasses(TimeoutClient.class, TestException.class) .addAsManifestResource(new StringAsset( "Timeout/value=200"), "microprofile-config.properties") .addAsManifestResource(EmptyAsset.INSTANCE, "beans.xml").as(JavaArchive.class); @@ -64,9 +65,9 @@ public void testTimeout() { Assert.fail("serviceA should throw a TimeoutException in testTimeout"); } catch (TimeoutException ex) { // Expected - } catch (RuntimeException ex) { + } catch (TestException ex) { // Not Expected - Assert.fail("serviceA should throw a TimeoutException in testTimeout not a RuntimeException"); + Assert.fail("serviceA should throw a TimeoutException in testTimeout not a RuntimeException", ex); } } diff --git a/tck/src/main/java/org/eclipse/microprofile/fault/tolerance/tck/TimeoutMethodConfigTest.java b/tck/src/main/java/org/eclipse/microprofile/fault/tolerance/tck/TimeoutMethodConfigTest.java index dd6a1e20..4f2c1ab7 100644 --- a/tck/src/main/java/org/eclipse/microprofile/fault/tolerance/tck/TimeoutMethodConfigTest.java +++ b/tck/src/main/java/org/eclipse/microprofile/fault/tolerance/tck/TimeoutMethodConfigTest.java @@ -20,6 +20,7 @@ package org.eclipse.microprofile.fault.tolerance.tck; import org.eclipse.microprofile.fault.tolerance.tck.timeout.clientserver.TimeoutClient; +import org.eclipse.microprofile.fault.tolerance.tck.util.TestException; import org.eclipse.microprofile.faulttolerance.exceptions.TimeoutException; import org.jboss.arquillian.container.test.api.Deployment; import org.jboss.arquillian.testng.Arquillian; @@ -44,7 +45,7 @@ public class TimeoutMethodConfigTest extends Arquillian { public static WebArchive deploy() { JavaArchive testJar = ShrinkWrap .create(JavaArchive.class, "ftTimeout.jar") - .addClasses(TimeoutClient.class) + .addClasses(TimeoutClient.class, TestException.class) .addAsManifestResource(new StringAsset( "org.eclipse.microprofile.fault.tolerance.tck.timeout.clientserver.TimeoutClient/" + "serviceA/Timeout/value=200"), @@ -66,9 +67,9 @@ public void testTimeout() { Assert.fail("serviceA should throw a TimeoutException in testTimeout"); } catch (TimeoutException ex) { // Expected - } catch (RuntimeException ex) { + } catch (TestException ex) { // Not Expected - Assert.fail("serviceA should throw a TimeoutException in testTimeout not a RuntimeException"); + Assert.fail("serviceA should throw a TimeoutException in testTimeout not a RuntimeException", ex); } } diff --git a/tck/src/main/java/org/eclipse/microprofile/fault/tolerance/tck/TimeoutTest.java b/tck/src/main/java/org/eclipse/microprofile/fault/tolerance/tck/TimeoutTest.java index 7df671e5..9d7d817d 100644 --- a/tck/src/main/java/org/eclipse/microprofile/fault/tolerance/tck/TimeoutTest.java +++ b/tck/src/main/java/org/eclipse/microprofile/fault/tolerance/tck/TimeoutTest.java @@ -22,6 +22,7 @@ import org.eclipse.microprofile.fault.tolerance.tck.timeout.clientserver.DefaultTimeoutClient; import org.eclipse.microprofile.fault.tolerance.tck.timeout.clientserver.ShorterTimeoutClient; import org.eclipse.microprofile.fault.tolerance.tck.timeout.clientserver.TimeoutClient; +import org.eclipse.microprofile.fault.tolerance.tck.util.TestException; import org.eclipse.microprofile.faulttolerance.exceptions.TimeoutException; import org.jboss.arquillian.container.test.api.Deployment; import org.jboss.arquillian.testng.Arquillian; @@ -50,7 +51,8 @@ public class TimeoutTest extends Arquillian { public static WebArchive deploy() { JavaArchive testJar = ShrinkWrap .create(JavaArchive.class, "ftTimeout.jar") - .addClasses(TimeoutClient.class, DefaultTimeoutClient.class, ShorterTimeoutClient.class) + .addClasses(TimeoutClient.class, DefaultTimeoutClient.class, ShorterTimeoutClient.class, + TestException.class) .addAsManifestResource(EmptyAsset.INSTANCE, "beans.xml").as(JavaArchive.class); WebArchive war = ShrinkWrap.create(WebArchive.class, "ftTimeout.war").addAsLibrary(testJar); @@ -69,9 +71,9 @@ public void testTimeout() { Assert.fail("serviceA should throw a TimeoutException in testTimeout"); } catch (TimeoutException ex) { // Expected - } catch (RuntimeException ex) { + } catch (TestException ex) { // Not Expected - Assert.fail("serviceA should throw a TimeoutException in testTimeout not a RuntimeException"); + Assert.fail("serviceA should throw a TimeoutException in testTimeout not a RuntimeException", ex); } } @@ -88,7 +90,7 @@ public void testNoTimeout() { } catch (TimeoutException ex) { // Not Expected Assert.fail("serviceB should throw a RuntimeException in testNoTimeout not a TimeoutException"); - } catch (RuntimeException ex) { + } catch (TestException ex) { // Expected } } @@ -104,9 +106,9 @@ public void testGTDefaultTimeout() { Assert.fail("serviceB should throw a TimeoutException in testGTDefaultTimeout"); } catch (TimeoutException ex) { // Expected - } catch (RuntimeException ex) { + } catch (TestException ex) { // Not Expected - Assert.fail("serviceB should throw a TimeoutException in testGTDefaultTimeout not a RuntimeException"); + Assert.fail("serviceB should throw a TimeoutException in testGTDefaultTimeout not a RuntimeException", ex); } } @@ -123,8 +125,9 @@ public void testGTDefaultNoTimeout() { Assert.fail("serviceB should throw a RuntimeException in testGTDefaultNoTimeout"); } catch (TimeoutException ex) { // Not Expected - Assert.fail("serviceB should throw a RuntimeException in testGTDefaultNoTimeout not a TimeoutException"); - } catch (RuntimeException ex) { + Assert.fail("serviceB should throw a RuntimeException in testGTDefaultNoTimeout not a TimeoutException", + ex); + } catch (TestException ex) { // Expected } } @@ -140,9 +143,9 @@ public void testLTDefaultTimeout() { Assert.fail("serviceC should throw a TimeoutException in testLTDefaultTimeout"); } catch (TimeoutException ex) { // Expected - } catch (RuntimeException ex) { + } catch (TestException ex) { // Not Expected - Assert.fail("serviceC should throw a TimeoutException in testLTDefaultTimeout not a RuntimeException"); + Assert.fail("serviceC should throw a TimeoutException in testLTDefaultTimeout not a RuntimeException", ex); } } @@ -158,8 +161,9 @@ public void testLTDefaultNoTimeout() { Assert.fail("serviceC should throw a RuntimeException in testLTDefaultNoTimeout"); } catch (TimeoutException ex) { // Not Expected - Assert.fail("serviceC should throw a RuntimeException in testLTDefaultNoTimeout not a TimeoutException"); - } catch (RuntimeException ex) { + Assert.fail("serviceC should throw a RuntimeException in testLTDefaultNoTimeout not a TimeoutException", + ex); + } catch (TestException ex) { // Expected } } @@ -176,9 +180,9 @@ public void testSecondsTimeout() { Assert.fail("serviceD should throw a TimeoutException in testSecondsTimeout"); } catch (TimeoutException ex) { // Expected - } catch (RuntimeException ex) { + } catch (TestException ex) { // Not Expected - Assert.fail("serviceD should throw a TimeoutException in testSecondsTimeout not a RuntimeException"); + Assert.fail("serviceD should throw a TimeoutException in testSecondsTimeout not a RuntimeException", ex); } } @@ -195,8 +199,8 @@ public void testSecondsNoTimeout() { Assert.fail("serviceD should throw a RuntimeException in testSecondsNoTimeout"); } catch (TimeoutException ex) { // Not Expected - Assert.fail("serviceD should throw a RuntimeException in testSecondsNoTimeout not a TimeoutException"); - } catch (RuntimeException ex) { + Assert.fail("serviceD should throw a RuntimeException in testSecondsNoTimeout not a TimeoutException", ex); + } catch (TestException ex) { // Expected } } @@ -213,9 +217,9 @@ public void testTimeoutClassLevel() { Assert.fail("serviceA should throw a TimeoutException in testTimeout"); } catch (TimeoutException ex) { // Expected - } catch (RuntimeException ex) { + } catch (TestException ex) { // Not Expected - Assert.fail("serviceA should throw a TimeoutException in testTimeout not a RuntimeException"); + Assert.fail("serviceA should throw a TimeoutException in testTimeout not a RuntimeException", ex); } } @@ -233,7 +237,7 @@ public void testNoTimeoutClassLevel() { } catch (TimeoutException ex) { // Not Expected Assert.fail("serviceB should throw a RuntimeException in testNoTimeoutClassLevel not a TimeoutException"); - } catch (RuntimeException ex) { + } catch (TestException ex) { // Expected } } @@ -250,9 +254,9 @@ public void testGTDefaultTimeoutOverride() { Assert.fail("serviceB should throw a TimeoutException in testGTDefaultTimeout"); } catch (TimeoutException ex) { // Expected - } catch (RuntimeException ex) { + } catch (TestException ex) { // Not Expected - Assert.fail("serviceB should throw a TimeoutException in testGTDefaultTimeout not a RuntimeException"); + Assert.fail("serviceB should throw a TimeoutException in testGTDefaultTimeout not a RuntimeException", ex); } } @@ -270,7 +274,7 @@ public void testGTDefaultNoTimeoutOverride() { } catch (TimeoutException ex) { // Not Expected Assert.fail("serviceB should throw a RuntimeException in testGTDefaultNoTimeout not a TimeoutException"); - } catch (RuntimeException ex) { + } catch (TestException ex) { // Expected } } @@ -286,10 +290,11 @@ public void testLTDefaultTimeoutClassLevel() { Assert.fail("serviceA should throw a TimeoutException in testLTDefaultTimeoutClassLevel"); } catch (TimeoutException ex) { // Expected - } catch (RuntimeException ex) { + } catch (TestException ex) { // Not Expected Assert.fail( - "serviceA should throw a TimeoutException in testLTDefaultTimeoutClassLevel not a RuntimeException"); + "serviceA should throw a TimeoutException in testLTDefaultTimeoutClassLevel not a RuntimeException", + ex); } } @@ -306,8 +311,9 @@ public void testLTDefaultNoTimeoutClassLevel() { } catch (TimeoutException ex) { // Not Expected Assert.fail( - "serviceA should throw a RuntimeException in testLTDefaultNoTimeoutClassLevel not a TimeoutException"); - } catch (RuntimeException ex) { + "serviceA should throw a RuntimeException in testLTDefaultNoTimeoutClassLevel not a TimeoutException", + ex); + } catch (TestException ex) { // Expected } } @@ -324,10 +330,11 @@ public void testGTShorterTimeoutOverride() { Assert.fail("serviceB should throw a TimeoutException in testGTShorterTimeoutOverride"); } catch (TimeoutException ex) { // Expected - } catch (RuntimeException ex) { + } catch (TestException ex) { // Not Expected Assert.fail( - "serviceB should throw a TimeoutException in testGTShorterTimeoutOverride not a RuntimeException"); + "serviceB should throw a TimeoutException in testGTShorterTimeoutOverride not a RuntimeException", + ex); } } @@ -345,8 +352,9 @@ public void testGTShorterNoTimeoutOverride() { } catch (TimeoutException ex) { // Not Expected Assert.fail( - "serviceB should throw a RuntimeException in testGTShorterNoTimeoutOverride not a TimeoutException"); - } catch (RuntimeException ex) { + "serviceB should throw a RuntimeException in testGTShorterNoTimeoutOverride not a TimeoutException", + ex); + } catch (TestException ex) { // Expected } } diff --git a/tck/src/main/java/org/eclipse/microprofile/fault/tolerance/tck/asyncretry/clientserver/AsyncRetryClient.java b/tck/src/main/java/org/eclipse/microprofile/fault/tolerance/tck/asyncretry/clientserver/AsyncRetryClient.java index 85834b27..2c1d0c7e 100644 --- a/tck/src/main/java/org/eclipse/microprofile/fault/tolerance/tck/asyncretry/clientserver/AsyncRetryClient.java +++ b/tck/src/main/java/org/eclipse/microprofile/fault/tolerance/tck/asyncretry/clientserver/AsyncRetryClient.java @@ -29,6 +29,7 @@ *******************************************************************************/ import org.eclipse.microprofile.fault.tolerance.tck.util.AsyncCallerExecutor; import org.eclipse.microprofile.fault.tolerance.tck.util.TCKConfig; +import org.eclipse.microprofile.fault.tolerance.tck.util.TestException; import org.eclipse.microprofile.faulttolerance.Asynchronous; import org.eclipse.microprofile.faulttolerance.Retry; @@ -94,7 +95,7 @@ public CompletionStage serviceBFailExceptionally(final CompletionStage f public CompletionStage serviceBFailException(final CompletionStage future) { countInvocationsServBFailException++; // always fail - throw new RuntimeException("Simulated error"); + throw new TestException("Simulated error"); } /** @@ -207,7 +208,7 @@ public CompletionStage serviceH() { countInvocationsServH++; // fails twice if (countInvocationsServH < 3) { - throw new RuntimeException("Simulated error"); + throw new TestException("Simulated error"); } CompletableFuture future = new CompletableFuture<>(); @@ -257,10 +258,10 @@ private Supplier doTask(final String errorMessage) { // simulate some processing. TimeUnit.MILLISECONDS.sleep(config.getTimeoutInMillis(50)); } catch (InterruptedException e) { - throw new RuntimeException("Unplanned error: " + e); + throw new TestException("Unplanned error: " + e); } if (nonNull(errorMessage)) { - throw new RuntimeException(errorMessage); + throw new TestException(errorMessage); } else { return "Success"; } diff --git a/tck/src/main/java/org/eclipse/microprofile/fault/tolerance/tck/circuitbreaker/CircuitBreakerConfigGlobalTest.java b/tck/src/main/java/org/eclipse/microprofile/fault/tolerance/tck/circuitbreaker/CircuitBreakerConfigGlobalTest.java index 5eeefc67..06ad391c 100644 --- a/tck/src/main/java/org/eclipse/microprofile/fault/tolerance/tck/circuitbreaker/CircuitBreakerConfigGlobalTest.java +++ b/tck/src/main/java/org/eclipse/microprofile/fault/tolerance/tck/circuitbreaker/CircuitBreakerConfigGlobalTest.java @@ -23,6 +23,7 @@ import org.eclipse.microprofile.fault.tolerance.tck.Misc; import org.eclipse.microprofile.fault.tolerance.tck.circuitbreaker.clientserver.CircuitBreakerClientDefaultSuccessThreshold; +import org.eclipse.microprofile.fault.tolerance.tck.util.TestException; import org.eclipse.microprofile.faulttolerance.exceptions.CircuitBreakerOpenException; import org.jboss.arquillian.container.test.api.Deployment; import org.jboss.arquillian.testng.Arquillian; @@ -48,7 +49,8 @@ public class CircuitBreakerConfigGlobalTest extends Arquillian { public static WebArchive deploy() { JavaArchive testJar = ShrinkWrap.create(JavaArchive.class, "ftCircuitBreaker.jar") .addClasses(CircuitBreakerClientDefaultSuccessThreshold.class, - Misc.class) + Misc.class, + TestException.class) .addAsManifestResource(new StringAsset( "CircuitBreaker/delay=200"), "microprofile-config.properties") .addAsManifestResource(EmptyAsset.INSTANCE, "beans.xml") @@ -88,15 +90,15 @@ public void testCircuitDefaultSuccessThreshold() { e.printStackTrace(); } } - } catch (RuntimeException ex) { + } catch (TestException ex) { // Expected if (!contains(new int[]{1, 2, 3, 4, 7, 8, 9, 10}, i)) { - Assert.fail("serviceA should not throw a RuntimeException on iteration " + i); + Assert.fail("serviceA should not throw a TestException on iteration " + i); } } catch (Exception ex) { // Not Expected Assert.fail( - "serviceA should throw a RuntimeException or CircuitBreakerOpenException in testCircuitDefaultSuccessThreshold " + "serviceA should throw a TestException or CircuitBreakerOpenException in testCircuitDefaultSuccessThreshold " + "on iteration " + i); } } diff --git a/tck/src/main/java/org/eclipse/microprofile/fault/tolerance/tck/circuitbreaker/CircuitBreakerConfigOnMethodTest.java b/tck/src/main/java/org/eclipse/microprofile/fault/tolerance/tck/circuitbreaker/CircuitBreakerConfigOnMethodTest.java index 43b94787..92be2f95 100644 --- a/tck/src/main/java/org/eclipse/microprofile/fault/tolerance/tck/circuitbreaker/CircuitBreakerConfigOnMethodTest.java +++ b/tck/src/main/java/org/eclipse/microprofile/fault/tolerance/tck/circuitbreaker/CircuitBreakerConfigOnMethodTest.java @@ -23,6 +23,7 @@ import org.eclipse.microprofile.fault.tolerance.tck.Misc; import org.eclipse.microprofile.fault.tolerance.tck.circuitbreaker.clientserver.CircuitBreakerClientDefaultSuccessThreshold; +import org.eclipse.microprofile.fault.tolerance.tck.util.TestException; import org.eclipse.microprofile.faulttolerance.exceptions.CircuitBreakerOpenException; import org.jboss.arquillian.container.test.api.Deployment; import org.jboss.arquillian.testng.Arquillian; @@ -48,7 +49,8 @@ public class CircuitBreakerConfigOnMethodTest extends Arquillian { public static WebArchive deploy() { JavaArchive testJar = ShrinkWrap.create(JavaArchive.class, "ftCircuitBreaker.jar") .addClasses(CircuitBreakerClientDefaultSuccessThreshold.class, - Misc.class) + Misc.class, + TestException.class) .addAsManifestResource(new StringAsset( "org.eclipse.microprofile.fault.tolerance.tck.circuitbreaker" + ".clientserver.CircuitBreakerClientDefaultSuccessThreshold/serviceA/CircuitBreaker/delay=200"), @@ -89,15 +91,15 @@ public void testCircuitDefaultSuccessThreshold() { e.printStackTrace(); } } - } catch (RuntimeException ex) { + } catch (TestException ex) { // Expected if (!contains(new int[]{1, 2, 3, 4, 7, 8, 9, 10}, i)) { - Assert.fail("serviceA should not throw a RuntimeException on iteration " + i); + Assert.fail("serviceA should not throw a TestException on iteration " + i); } } catch (Exception ex) { // Not Expected Assert.fail( - "serviceA should throw a RuntimeException or CircuitBreakerOpenException in testCircuitDefaultSuccessThreshold " + "serviceA should throw a TestException or CircuitBreakerOpenException in testCircuitDefaultSuccessThreshold " + "on iteration " + i); } } diff --git a/tck/src/main/java/org/eclipse/microprofile/fault/tolerance/tck/circuitbreaker/clientserver/CircuitBreakerClassLevelClientWithDelay.java b/tck/src/main/java/org/eclipse/microprofile/fault/tolerance/tck/circuitbreaker/clientserver/CircuitBreakerClassLevelClientWithDelay.java index e9de5420..74a651d0 100644 --- a/tck/src/main/java/org/eclipse/microprofile/fault/tolerance/tck/circuitbreaker/clientserver/CircuitBreakerClassLevelClientWithDelay.java +++ b/tck/src/main/java/org/eclipse/microprofile/fault/tolerance/tck/circuitbreaker/clientserver/CircuitBreakerClassLevelClientWithDelay.java @@ -22,6 +22,7 @@ import java.io.Serializable; import java.sql.Connection; +import org.eclipse.microprofile.fault.tolerance.tck.util.TestException; import org.eclipse.microprofile.faulttolerance.CircuitBreaker; import jakarta.enterprise.context.RequestScoped; @@ -88,7 +89,7 @@ public Connection serviceD() { // simulate a backend service private Connection connectionService() { if (counterForInvokingService < 5) { - throw new RuntimeException("Connection failed"); + throw new TestException("Connection failed"); } return null; } diff --git a/tck/src/main/java/org/eclipse/microprofile/fault/tolerance/tck/circuitbreaker/clientserver/CircuitBreakerClassLevelClientWithRetry.java b/tck/src/main/java/org/eclipse/microprofile/fault/tolerance/tck/circuitbreaker/clientserver/CircuitBreakerClassLevelClientWithRetry.java index ece7e834..d7e3f9ce 100644 --- a/tck/src/main/java/org/eclipse/microprofile/fault/tolerance/tck/circuitbreaker/clientserver/CircuitBreakerClassLevelClientWithRetry.java +++ b/tck/src/main/java/org/eclipse/microprofile/fault/tolerance/tck/circuitbreaker/clientserver/CircuitBreakerClassLevelClientWithRetry.java @@ -22,6 +22,7 @@ import java.io.Serializable; import java.sql.Connection; +import org.eclipse.microprofile.fault.tolerance.tck.util.TestException; import org.eclipse.microprofile.faulttolerance.CircuitBreaker; import org.eclipse.microprofile.faulttolerance.Retry; @@ -67,6 +68,6 @@ public Connection serviceB() { // simulate a backend service private Connection connectionService() { - throw new RuntimeException("Connection failed"); + throw new TestException("Connection failed"); } } diff --git a/tck/src/main/java/org/eclipse/microprofile/fault/tolerance/tck/circuitbreaker/clientserver/CircuitBreakerClientDefaultSuccessThreshold.java b/tck/src/main/java/org/eclipse/microprofile/fault/tolerance/tck/circuitbreaker/clientserver/CircuitBreakerClientDefaultSuccessThreshold.java index 50bd55cb..7629647b 100644 --- a/tck/src/main/java/org/eclipse/microprofile/fault/tolerance/tck/circuitbreaker/clientserver/CircuitBreakerClientDefaultSuccessThreshold.java +++ b/tck/src/main/java/org/eclipse/microprofile/fault/tolerance/tck/circuitbreaker/clientserver/CircuitBreakerClientDefaultSuccessThreshold.java @@ -24,6 +24,7 @@ import java.io.Serializable; import java.sql.Connection; +import org.eclipse.microprofile.fault.tolerance.tck.util.TestException; import org.eclipse.microprofile.faulttolerance.CircuitBreaker; import jakarta.enterprise.context.RequestScoped; @@ -60,7 +61,7 @@ public Connection serviceA(int[] successSet) { private Connection connectionService(int[] successSet) { // Determine if execution succeeds if (!contains(successSet, counterForInvokingServiceA)) { - throw new RuntimeException("Connection failed"); + throw new TestException("Connection failed"); } return null; diff --git a/tck/src/main/java/org/eclipse/microprofile/fault/tolerance/tck/circuitbreaker/clientserver/CircuitBreakerClientHigherSuccessThreshold.java b/tck/src/main/java/org/eclipse/microprofile/fault/tolerance/tck/circuitbreaker/clientserver/CircuitBreakerClientHigherSuccessThreshold.java index 0dcc5753..0e4a9528 100644 --- a/tck/src/main/java/org/eclipse/microprofile/fault/tolerance/tck/circuitbreaker/clientserver/CircuitBreakerClientHigherSuccessThreshold.java +++ b/tck/src/main/java/org/eclipse/microprofile/fault/tolerance/tck/circuitbreaker/clientserver/CircuitBreakerClientHigherSuccessThreshold.java @@ -22,6 +22,7 @@ import java.io.Serializable; import java.sql.Connection; +import org.eclipse.microprofile.fault.tolerance.tck.util.TestException; import org.eclipse.microprofile.faulttolerance.CircuitBreaker; import jakarta.enterprise.context.RequestScoped; @@ -57,7 +58,7 @@ public Connection serviceA() { // simulate a backend service private Connection connectionService() { if (counterForInvokingServiceA < 5 || counterForInvokingServiceA > 6) { - throw new RuntimeException("Connection failed"); + throw new TestException("Connection failed"); } return null; diff --git a/tck/src/main/java/org/eclipse/microprofile/fault/tolerance/tck/circuitbreaker/clientserver/CircuitBreakerClientNoDelay.java b/tck/src/main/java/org/eclipse/microprofile/fault/tolerance/tck/circuitbreaker/clientserver/CircuitBreakerClientNoDelay.java index 3b5dbfc7..973711c6 100644 --- a/tck/src/main/java/org/eclipse/microprofile/fault/tolerance/tck/circuitbreaker/clientserver/CircuitBreakerClientNoDelay.java +++ b/tck/src/main/java/org/eclipse/microprofile/fault/tolerance/tck/circuitbreaker/clientserver/CircuitBreakerClientNoDelay.java @@ -22,6 +22,7 @@ import java.io.Serializable; import java.sql.Connection; +import org.eclipse.microprofile.fault.tolerance.tck.util.TestException; import org.eclipse.microprofile.faulttolerance.CircuitBreaker; import jakarta.enterprise.context.RequestScoped; @@ -56,7 +57,7 @@ public Connection serviceA() { // simulate a backend service private Connection connectionService() { if (counterForInvokingServiceA < 5) { - throw new RuntimeException("Connection failed"); + throw new TestException("Connection failed"); } return null; } diff --git a/tck/src/main/java/org/eclipse/microprofile/fault/tolerance/tck/circuitbreaker/clientserver/CircuitBreakerClientRollingWindow.java b/tck/src/main/java/org/eclipse/microprofile/fault/tolerance/tck/circuitbreaker/clientserver/CircuitBreakerClientRollingWindow.java index 8ca4671c..746716e4 100644 --- a/tck/src/main/java/org/eclipse/microprofile/fault/tolerance/tck/circuitbreaker/clientserver/CircuitBreakerClientRollingWindow.java +++ b/tck/src/main/java/org/eclipse/microprofile/fault/tolerance/tck/circuitbreaker/clientserver/CircuitBreakerClientRollingWindow.java @@ -22,6 +22,7 @@ import java.io.Serializable; import java.sql.Connection; +import org.eclipse.microprofile.fault.tolerance.tck.util.TestException; import org.eclipse.microprofile.faulttolerance.CircuitBreaker; import jakarta.enterprise.context.RequestScoped; @@ -60,7 +61,7 @@ public Connection service1RollingWindowOpenAfter4() { // Throw exception for the 2nd and 3rd request. private Connection connectionService1() { if ((counterForInvokingService1 == 2) || (counterForInvokingService1 == 3)) { - throw new RuntimeException("Connection failed"); + throw new TestException("Connection failed"); } return null; @@ -80,7 +81,7 @@ public Connection service2RollingWindowOpenAfter5() { // Throw exception for the 2nd and 5th request. private Connection connectionService2() { if ((counterForInvokingService2 == 2) || (counterForInvokingService2 == 5)) { - throw new RuntimeException("Connection failed"); + throw new TestException("Connection failed"); } return null; diff --git a/tck/src/main/java/org/eclipse/microprofile/fault/tolerance/tck/circuitbreaker/clientserver/CircuitBreakerClientWithDelay.java b/tck/src/main/java/org/eclipse/microprofile/fault/tolerance/tck/circuitbreaker/clientserver/CircuitBreakerClientWithDelay.java index a05caa01..a4e956b6 100644 --- a/tck/src/main/java/org/eclipse/microprofile/fault/tolerance/tck/circuitbreaker/clientserver/CircuitBreakerClientWithDelay.java +++ b/tck/src/main/java/org/eclipse/microprofile/fault/tolerance/tck/circuitbreaker/clientserver/CircuitBreakerClientWithDelay.java @@ -22,6 +22,7 @@ import java.io.Serializable; import java.sql.Connection; +import org.eclipse.microprofile.fault.tolerance.tck.util.TestException; import org.eclipse.microprofile.faulttolerance.CircuitBreaker; import jakarta.enterprise.context.RequestScoped; @@ -58,7 +59,7 @@ public Connection serviceA() { // simulate a backend service private Connection connectionService() { if (counterForInvokingServiceA < 5) { - throw new RuntimeException("Connection failed"); + throw new TestException("Connection failed"); } return null; } diff --git a/tck/src/main/java/org/eclipse/microprofile/fault/tolerance/tck/circuitbreaker/clientserver/CircuitBreakerClientWithRetry.java b/tck/src/main/java/org/eclipse/microprofile/fault/tolerance/tck/circuitbreaker/clientserver/CircuitBreakerClientWithRetry.java index bfdf119d..94259d47 100644 --- a/tck/src/main/java/org/eclipse/microprofile/fault/tolerance/tck/circuitbreaker/clientserver/CircuitBreakerClientWithRetry.java +++ b/tck/src/main/java/org/eclipse/microprofile/fault/tolerance/tck/circuitbreaker/clientserver/CircuitBreakerClientWithRetry.java @@ -57,7 +57,7 @@ public int getCounterForInvokingServiceC() { } @CircuitBreaker(successThreshold = 2, requestVolumeThreshold = 4, failureRatio = 0.75, delay = 50000) - @Retry(retryOn = {RuntimeException.class}, maxRetries = 7) + @Retry(retryOn = {TestException.class}, maxRetries = 7) public Connection serviceA() { Connection conn = null; counterForInvokingServiceA++; @@ -66,7 +66,7 @@ public Connection serviceA() { } @CircuitBreaker(successThreshold = 2, requestVolumeThreshold = 4, failureRatio = 0.75, delay = 50000) - @Retry(retryOn = {RuntimeException.class}, maxRetries = 2) + @Retry(retryOn = {TestException.class}, maxRetries = 2) public Connection serviceB() { Connection conn = null; counterForInvokingServiceB++; @@ -78,7 +78,7 @@ public Connection serviceB() { * Configured to always time out and Retry until CircuitBreaker is triggered on 4th call. */ @CircuitBreaker(successThreshold = 2, requestVolumeThreshold = 4, failureRatio = 0.75, delay = 50000) - @Retry(retryOn = {RuntimeException.class, TimeoutException.class}, maxRetries = 7, maxDuration = 20000) + @Retry(retryOn = {TestException.class, TimeoutException.class}, maxRetries = 7, maxDuration = 20000) @Timeout(100) // Scaled via config public Connection serviceC() { Connection conn = null; @@ -86,7 +86,7 @@ public Connection serviceC() { try { Thread.sleep(TCKConfig.getConfig().getTimeoutInMillis(5000)); - throw new RuntimeException("Timeout did not interrupt"); + throw new TestException("Timeout did not interrupt"); } catch (InterruptedException e) { // expected } @@ -151,6 +151,6 @@ public String serviceWithRetryFailOnCbOpen(boolean throwException) { // simulate a backend service private Connection connectionService() { - throw new RuntimeException("Connection failed"); + throw new TestException("Connection failed"); } } diff --git a/tck/src/main/java/org/eclipse/microprofile/fault/tolerance/tck/circuitbreaker/clientserver/CircuitBreakerClientWithRetryAsync.java b/tck/src/main/java/org/eclipse/microprofile/fault/tolerance/tck/circuitbreaker/clientserver/CircuitBreakerClientWithRetryAsync.java index 965779a4..d82b34d6 100644 --- a/tck/src/main/java/org/eclipse/microprofile/fault/tolerance/tck/circuitbreaker/clientserver/CircuitBreakerClientWithRetryAsync.java +++ b/tck/src/main/java/org/eclipse/microprofile/fault/tolerance/tck/circuitbreaker/clientserver/CircuitBreakerClientWithRetryAsync.java @@ -94,7 +94,7 @@ public Future serviceC() { try { Thread.sleep(TCKConfig.getConfig().getTimeoutInMillis(5000)); - throw new RuntimeException("Timeout did not interrupt"); + throw new TestException("Timeout did not interrupt"); } catch (InterruptedException e) { // expected } @@ -105,7 +105,7 @@ public Future serviceC() { * Has a CircuitBreaker and Retries on CircuitBreakerOpenException * * @param throwException - * whether this method should throw a runtime exception to simulate an application failure + * whether this method should throw a test exception to simulate an application failure * @return string "OK" */ @CircuitBreaker(requestVolumeThreshold = 4, failureRatio = 0.75, delay = 1000) diff --git a/tck/src/main/java/org/eclipse/microprofile/fault/tolerance/tck/config/clientserver/ConfigClassLevelClient.java b/tck/src/main/java/org/eclipse/microprofile/fault/tolerance/tck/config/clientserver/ConfigClassLevelClient.java index 6ce11cb3..0893d508 100644 --- a/tck/src/main/java/org/eclipse/microprofile/fault/tolerance/tck/config/clientserver/ConfigClassLevelClient.java +++ b/tck/src/main/java/org/eclipse/microprofile/fault/tolerance/tck/config/clientserver/ConfigClassLevelClient.java @@ -21,6 +21,7 @@ import java.sql.Connection; +import org.eclipse.microprofile.fault.tolerance.tck.util.TestException; import org.eclipse.microprofile.faulttolerance.Retry; import jakarta.enterprise.context.RequestScoped; @@ -60,7 +61,7 @@ public Connection serviceB() { private Connection connectionService() { counterForInvokingConnenectionService++; - throw new RuntimeException("Connection failed"); + throw new TestException("Connection failed"); } public int getCounterForInvokingConnectionService() { diff --git a/tck/src/main/java/org/eclipse/microprofile/fault/tolerance/tck/config/clientserver/ConfigClassLevelMaxDurationClient.java b/tck/src/main/java/org/eclipse/microprofile/fault/tolerance/tck/config/clientserver/ConfigClassLevelMaxDurationClient.java index d228c1c4..6aedbddd 100644 --- a/tck/src/main/java/org/eclipse/microprofile/fault/tolerance/tck/config/clientserver/ConfigClassLevelMaxDurationClient.java +++ b/tck/src/main/java/org/eclipse/microprofile/fault/tolerance/tck/config/clientserver/ConfigClassLevelMaxDurationClient.java @@ -19,6 +19,7 @@ *******************************************************************************/ package org.eclipse.microprofile.fault.tolerance.tck.config.clientserver; +import org.eclipse.microprofile.fault.tolerance.tck.util.TestException; import org.eclipse.microprofile.faulttolerance.Retry; import jakarta.enterprise.context.RequestScoped; @@ -48,7 +49,7 @@ private void writingService() { counterForInvokingWritingService++; try { Thread.sleep(100); - throw new RuntimeException("WritingService failed"); + throw new TestException("WritingService failed"); } catch (InterruptedException e) { e.printStackTrace(); } diff --git a/tck/src/main/java/org/eclipse/microprofile/fault/tolerance/tck/config/clientserver/ConfigClient.java b/tck/src/main/java/org/eclipse/microprofile/fault/tolerance/tck/config/clientserver/ConfigClient.java index 92082560..b5272285 100644 --- a/tck/src/main/java/org/eclipse/microprofile/fault/tolerance/tck/config/clientserver/ConfigClient.java +++ b/tck/src/main/java/org/eclipse/microprofile/fault/tolerance/tck/config/clientserver/ConfigClient.java @@ -21,6 +21,7 @@ import java.sql.Connection; +import org.eclipse.microprofile.fault.tolerance.tck.util.TestException; import org.eclipse.microprofile.faulttolerance.Retry; import jakarta.enterprise.context.RequestScoped; @@ -54,7 +55,7 @@ public void serviceC() { private Connection connectionService() { counterForInvokingConnenectionService++; - throw new RuntimeException("Connection failed"); + throw new TestException("Connection failed"); } public int getCounterForInvokingConnectionService() { @@ -65,7 +66,7 @@ private void writingService() { counterForInvokingWritingService++; try { Thread.sleep(100); - throw new RuntimeException("WritingService failed"); + throw new TestException("WritingService failed"); } catch (InterruptedException e) { e.printStackTrace(); } diff --git a/tck/src/main/java/org/eclipse/microprofile/fault/tolerance/tck/disableEnv/DisableClient.java b/tck/src/main/java/org/eclipse/microprofile/fault/tolerance/tck/disableEnv/DisableClient.java index 1606150e..d1b35322 100644 --- a/tck/src/main/java/org/eclipse/microprofile/fault/tolerance/tck/disableEnv/DisableClient.java +++ b/tck/src/main/java/org/eclipse/microprofile/fault/tolerance/tck/disableEnv/DisableClient.java @@ -22,6 +22,7 @@ import java.sql.Connection; import org.eclipse.microprofile.fault.tolerance.tck.fallback.clientserver.StringFallbackHandler; +import org.eclipse.microprofile.fault.tolerance.tck.util.TestException; import org.eclipse.microprofile.faulttolerance.CircuitBreaker; import org.eclipse.microprofile.faulttolerance.Fallback; import org.eclipse.microprofile.faulttolerance.Retry; @@ -93,7 +94,7 @@ public Connection serviceC() { public Connection serviceD(long timeToSleep) { try { Thread.sleep(timeToSleep); - throw new RuntimeException("Timeout did not interrupt"); + throw new TestException("Timeout did not interrupt"); } catch (InterruptedException e) { // expected } @@ -101,12 +102,12 @@ public Connection serviceD(long timeToSleep) { } private String nameService() { - throw new RuntimeException("Connection failed"); + throw new TestException("Connection failed"); } private Connection connectionService() { counterForInvokingConnenectionService++; - throw new RuntimeException("Connection failed"); + throw new TestException("Connection failed"); } public int getRetryCountForConnectionService() { diff --git a/tck/src/main/java/org/eclipse/microprofile/fault/tolerance/tck/disableEnv/DisableTest.java b/tck/src/main/java/org/eclipse/microprofile/fault/tolerance/tck/disableEnv/DisableTest.java index 43180755..c0a219e1 100644 --- a/tck/src/main/java/org/eclipse/microprofile/fault/tolerance/tck/disableEnv/DisableTest.java +++ b/tck/src/main/java/org/eclipse/microprofile/fault/tolerance/tck/disableEnv/DisableTest.java @@ -20,6 +20,7 @@ package org.eclipse.microprofile.fault.tolerance.tck.disableEnv; import org.eclipse.microprofile.fault.tolerance.tck.fallback.clientserver.StringFallbackHandler; +import org.eclipse.microprofile.fault.tolerance.tck.util.TestException; import org.eclipse.microprofile.faulttolerance.exceptions.TimeoutException; import org.jboss.arquillian.container.test.api.Deployment; import org.jboss.arquillian.testng.Arquillian; @@ -51,7 +52,7 @@ public class DisableTest extends Arquillian { public static WebArchive deploy() { JavaArchive testJar = ShrinkWrap .create(JavaArchive.class, "ftDisableAllButFallback.jar") - .addClasses(DisableClient.class, StringFallbackHandler.class) + .addClasses(DisableClient.class, StringFallbackHandler.class, TestException.class) .addAsManifestResource(new StringAsset("MP_Fault_Tolerance_NonFallback_Enabled=false"), "microprofile-config.properties") .addAsManifestResource(EmptyAsset.INSTANCE, "beans.xml") @@ -75,7 +76,7 @@ public void testRetryDisabled() { try { disableClient.serviceA(); Assert.fail("serviceA should throw a RuntimeException in testRetryDisabled"); - } catch (RuntimeException ex) { + } catch (TestException ex) { // Expected } Assert.assertEquals(disableClient.getRetryCountForConnectionService(), 1, @@ -98,8 +99,8 @@ public void testFallbackSuccess() { System.out.println("testFallbackSuccess got result - " + result); Assert.assertTrue(result.contains("serviceB"), "The message should be \"fallback for serviceB\""); - } catch (RuntimeException ex) { - Assert.fail("serviceB should not throw a RuntimeException in testFallbackSuccess"); + } catch (TestException ex) { + Assert.fail("serviceB should not throw a RuntimeException in testFallbackSuccess", ex); } Assert.assertEquals(disableClient.getCounterForInvokingServiceB(), 1, "The execution count should be 1 (0 retries + 1)"); @@ -118,7 +119,7 @@ public void testCircuitClosedThenOpen() { try { disableClient.serviceC(); - } catch (RuntimeException ex) { + } catch (TestException ex) { // Expected } catch (Exception ex) { // Not Expected @@ -148,7 +149,7 @@ public void testTimeout() { } catch (TimeoutException ex) { // Not Expected Assert.fail("serviceD should throw a RuntimeException in testTimeout not a TimeoutException"); - } catch (RuntimeException ex) { + } catch (TestException ex) { // Expected } } diff --git a/tck/src/main/java/org/eclipse/microprofile/fault/tolerance/tck/fallback/clientserver/FallbackClassLevelClient.java b/tck/src/main/java/org/eclipse/microprofile/fault/tolerance/tck/fallback/clientserver/FallbackClassLevelClient.java index e8173efe..01e0e835 100644 --- a/tck/src/main/java/org/eclipse/microprofile/fault/tolerance/tck/fallback/clientserver/FallbackClassLevelClient.java +++ b/tck/src/main/java/org/eclipse/microprofile/fault/tolerance/tck/fallback/clientserver/FallbackClassLevelClient.java @@ -19,6 +19,7 @@ *******************************************************************************/ package org.eclipse.microprofile.fault.tolerance.tck.fallback.clientserver; +import org.eclipse.microprofile.fault.tolerance.tck.util.TestException; import org.eclipse.microprofile.faulttolerance.Fallback; import org.eclipse.microprofile.faulttolerance.Retry; @@ -58,7 +59,7 @@ public String serviceB() { } private String nameService() { - throw new RuntimeException("Connection failed"); + throw new TestException("Connection failed"); } } diff --git a/tck/src/main/java/org/eclipse/microprofile/fault/tolerance/tck/retry/clientserver/RetryClassLevelClientAbortOn.java b/tck/src/main/java/org/eclipse/microprofile/fault/tolerance/tck/retry/clientserver/RetryClassLevelClientAbortOn.java index f6f2640d..7d702000 100644 --- a/tck/src/main/java/org/eclipse/microprofile/fault/tolerance/tck/retry/clientserver/RetryClassLevelClientAbortOn.java +++ b/tck/src/main/java/org/eclipse/microprofile/fault/tolerance/tck/retry/clientserver/RetryClassLevelClientAbortOn.java @@ -22,6 +22,7 @@ import java.io.IOException; import java.sql.Connection; +import org.eclipse.microprofile.fault.tolerance.tck.util.TestException; import org.eclipse.microprofile.faulttolerance.Retry; import jakarta.enterprise.context.RequestScoped; @@ -44,7 +45,7 @@ public Connection serviceA() { private Connection connectionService() { counterForInvokingConnenectionService++; - throw new RuntimeException("Connection failed"); + throw new TestException("Connection failed"); } public int getRetryCountForConnectionService() { @@ -63,7 +64,7 @@ private void writingService() { counterForInvokingWritingService++; try { Thread.sleep(100); - throw new RuntimeException("WritingService failed"); + throw new TestException("WritingService failed"); } catch (InterruptedException e) { e.printStackTrace(); } diff --git a/tck/src/main/java/org/eclipse/microprofile/fault/tolerance/tck/retry/clientserver/RetryClassLevelClientForMaxRetries.java b/tck/src/main/java/org/eclipse/microprofile/fault/tolerance/tck/retry/clientserver/RetryClassLevelClientForMaxRetries.java index 780df9e7..c24f4eae 100644 --- a/tck/src/main/java/org/eclipse/microprofile/fault/tolerance/tck/retry/clientserver/RetryClassLevelClientForMaxRetries.java +++ b/tck/src/main/java/org/eclipse/microprofile/fault/tolerance/tck/retry/clientserver/RetryClassLevelClientForMaxRetries.java @@ -22,6 +22,7 @@ import java.sql.Connection; import java.time.temporal.ChronoUnit; +import org.eclipse.microprofile.fault.tolerance.tck.util.TestException; import org.eclipse.microprofile.faulttolerance.Retry; import jakarta.enterprise.context.RequestScoped; @@ -48,7 +49,7 @@ public Connection serviceA() { private Connection connectionService() { counterForInvokingConnenectionService++; - throw new RuntimeException("Connection failed"); + throw new TestException("Connection failed"); } public int getRetryCountForConnectionService() { @@ -81,7 +82,7 @@ private void writingService() { counterForInvokingWritingService++; try { Thread.sleep(100); - throw new RuntimeException("WritingService failed"); + throw new TestException("WritingService failed"); } catch (InterruptedException e) { e.printStackTrace(); } diff --git a/tck/src/main/java/org/eclipse/microprofile/fault/tolerance/tck/retry/clientserver/RetryClassLevelClientRetryOn.java b/tck/src/main/java/org/eclipse/microprofile/fault/tolerance/tck/retry/clientserver/RetryClassLevelClientRetryOn.java index 41d2b2f4..960d5913 100644 --- a/tck/src/main/java/org/eclipse/microprofile/fault/tolerance/tck/retry/clientserver/RetryClassLevelClientRetryOn.java +++ b/tck/src/main/java/org/eclipse/microprofile/fault/tolerance/tck/retry/clientserver/RetryClassLevelClientRetryOn.java @@ -22,6 +22,7 @@ import java.io.IOException; import java.sql.Connection; +import org.eclipse.microprofile.fault.tolerance.tck.util.TestException; import org.eclipse.microprofile.faulttolerance.Retry; import jakarta.enterprise.context.RequestScoped; @@ -33,7 +34,7 @@ * */ @RequestScoped -@Retry(retryOn = {RuntimeException.class}, maxRetries = 3) +@Retry(retryOn = {TestException.class}, maxRetries = 3) public class RetryClassLevelClientRetryOn { private int counterForInvokingConnenectionService; private int counterForInvokingWritingService; @@ -44,7 +45,7 @@ public Connection serviceA() { private Connection connectionService() { counterForInvokingConnenectionService++; - throw new RuntimeException("Connection failed"); + throw new TestException("Connection failed"); } public int getRetryCountForConnectionService() { @@ -53,7 +54,7 @@ public int getRetryCountForConnectionService() { /** * serviceB is configured to retry on an IOException. In practice the only exception that will be thrown by the - * WritingService is a RuntimeException. + * WritingService is a TestException. */ @Retry(retryOn = {IOException.class}) public void serviceB() { @@ -64,7 +65,7 @@ private void writingService() { counterForInvokingWritingService++; try { Thread.sleep(100); - throw new RuntimeException("WritingService failed"); + throw new TestException("WritingService failed"); } catch (InterruptedException e) { e.printStackTrace(); } diff --git a/tck/src/main/java/org/eclipse/microprofile/fault/tolerance/tck/retry/clientserver/RetryClientAbortOn.java b/tck/src/main/java/org/eclipse/microprofile/fault/tolerance/tck/retry/clientserver/RetryClientAbortOn.java index 359f3e20..d761a61b 100644 --- a/tck/src/main/java/org/eclipse/microprofile/fault/tolerance/tck/retry/clientserver/RetryClientAbortOn.java +++ b/tck/src/main/java/org/eclipse/microprofile/fault/tolerance/tck/retry/clientserver/RetryClientAbortOn.java @@ -22,6 +22,7 @@ import java.io.IOException; import java.sql.Connection; +import org.eclipse.microprofile.fault.tolerance.tck.util.TestException; import org.eclipse.microprofile.faulttolerance.Retry; import jakarta.enterprise.context.RequestScoped; @@ -44,7 +45,7 @@ public Connection serviceA() { private Connection connectionService() { counterForInvokingConnenectionService++; - throw new RuntimeException("Connection failed"); + throw new TestException("Connection failed"); } public int getRetryCountForConnectionService() { @@ -52,9 +53,9 @@ public int getRetryCountForConnectionService() { } /** - * serviceB is configured to retry on a RuntimeException. The WritingService throws RuntimeExceptions. + * serviceB is configured to retry on a TestException. The WritingService throws TestException. */ - @Retry(abortOn = {RuntimeException.class}) + @Retry(abortOn = {TestException.class}) public void serviceB() { writingService(); } @@ -63,7 +64,7 @@ private void writingService() { counterForInvokingWritingService++; try { Thread.sleep(100); - throw new RuntimeException("WritingService failed"); + throw new TestException("WritingService failed"); } catch (InterruptedException e) { e.printStackTrace(); } diff --git a/tck/src/main/java/org/eclipse/microprofile/fault/tolerance/tck/retry/clientserver/RetryClientForMaxRetries.java b/tck/src/main/java/org/eclipse/microprofile/fault/tolerance/tck/retry/clientserver/RetryClientForMaxRetries.java index 87ad6e5b..b34f1e7e 100644 --- a/tck/src/main/java/org/eclipse/microprofile/fault/tolerance/tck/retry/clientserver/RetryClientForMaxRetries.java +++ b/tck/src/main/java/org/eclipse/microprofile/fault/tolerance/tck/retry/clientserver/RetryClientForMaxRetries.java @@ -22,6 +22,7 @@ import java.sql.Connection; import java.time.temporal.ChronoUnit; +import org.eclipse.microprofile.fault.tolerance.tck.util.TestException; import org.eclipse.microprofile.faulttolerance.Retry; import jakarta.enterprise.context.RequestScoped; @@ -48,7 +49,7 @@ public Connection serviceA() { private Connection connectionService() { counterForInvokingConnenectionService++; - throw new RuntimeException("Connection failed"); + throw new TestException("Connection failed"); } public int getRetryCountForConnectionService() { @@ -81,7 +82,7 @@ private void writingService() { counterForInvokingWritingService++; try { Thread.sleep(100); - throw new RuntimeException("WritingService failed"); + throw new TestException("WritingService failed"); } catch (InterruptedException e) { e.printStackTrace(); } diff --git a/tck/src/main/java/org/eclipse/microprofile/fault/tolerance/tck/retry/clientserver/RetryClientRetryOn.java b/tck/src/main/java/org/eclipse/microprofile/fault/tolerance/tck/retry/clientserver/RetryClientRetryOn.java index 7afc3335..b6cc6511 100644 --- a/tck/src/main/java/org/eclipse/microprofile/fault/tolerance/tck/retry/clientserver/RetryClientRetryOn.java +++ b/tck/src/main/java/org/eclipse/microprofile/fault/tolerance/tck/retry/clientserver/RetryClientRetryOn.java @@ -24,6 +24,7 @@ import org.eclipse.microprofile.fault.tolerance.tck.retry.clientserver.exceptions.RetryChildException; import org.eclipse.microprofile.fault.tolerance.tck.retry.clientserver.exceptions.RetryParentException; +import org.eclipse.microprofile.fault.tolerance.tck.util.TestException; import org.eclipse.microprofile.faulttolerance.Retry; import jakarta.enterprise.context.RequestScoped; @@ -38,14 +39,14 @@ public class RetryClientRetryOn { private int counterForInvokingConnenectionService; private int counterForInvokingWritingService; - @Retry(retryOn = {RuntimeException.class}) + @Retry(retryOn = {TestException.class}) public Connection serviceA() { return connectionService(); } private Connection connectionService() { counterForInvokingConnenectionService++; - throw new RuntimeException("Connection failed"); + throw new TestException("Connection failed"); } /** @@ -88,7 +89,7 @@ private void writingService() { counterForInvokingWritingService++; try { Thread.sleep(100); - throw new RuntimeException("WritingService failed"); + throw new TestException("WritingService failed"); } catch (InterruptedException e) { e.printStackTrace(); } diff --git a/tck/src/main/java/org/eclipse/microprofile/fault/tolerance/tck/retry/clientserver/RetryClientWithDelay.java b/tck/src/main/java/org/eclipse/microprofile/fault/tolerance/tck/retry/clientserver/RetryClientWithDelay.java index 884b3b4f..c0337cc0 100644 --- a/tck/src/main/java/org/eclipse/microprofile/fault/tolerance/tck/retry/clientserver/RetryClientWithDelay.java +++ b/tck/src/main/java/org/eclipse/microprofile/fault/tolerance/tck/retry/clientserver/RetryClientWithDelay.java @@ -29,6 +29,7 @@ import java.util.Set; import org.eclipse.microprofile.fault.tolerance.tck.util.TCKConfig; +import org.eclipse.microprofile.fault.tolerance.tck.util.TestException; import org.eclipse.microprofile.faulttolerance.Retry; import jakarta.enterprise.context.RequestScoped; @@ -65,7 +66,7 @@ private Connection connectionService() { timestampForConnectionService = currentTime; counterForInvokingConnenectionService++; - throw new RuntimeException("Connection failed"); + throw new TestException("Connection failed"); } public void assertDelayInRange() { diff --git a/tck/src/main/java/org/eclipse/microprofile/fault/tolerance/tck/retry/clientserver/RetryClientWithNoDelayAndJitter.java b/tck/src/main/java/org/eclipse/microprofile/fault/tolerance/tck/retry/clientserver/RetryClientWithNoDelayAndJitter.java index c791bba5..d58ef7b6 100644 --- a/tck/src/main/java/org/eclipse/microprofile/fault/tolerance/tck/retry/clientserver/RetryClientWithNoDelayAndJitter.java +++ b/tck/src/main/java/org/eclipse/microprofile/fault/tolerance/tck/retry/clientserver/RetryClientWithNoDelayAndJitter.java @@ -24,6 +24,7 @@ import java.util.ArrayList; import java.util.List; +import org.eclipse.microprofile.fault.tolerance.tck.util.TestException; import org.eclipse.microprofile.faulttolerance.Retry; import jakarta.enterprise.context.RequestScoped; @@ -58,7 +59,7 @@ private Connection connectionService() { timestampForConnectionService = currentTime; counterForInvokingConnectionService++; - throw new RuntimeException("Connection failed"); + throw new TestException("Connection failed"); } public int getRetryCountForConnectionService() { diff --git a/tck/src/main/java/org/eclipse/microprofile/fault/tolerance/tck/retrytimeout/clientserver/RetryTimeoutClient.java b/tck/src/main/java/org/eclipse/microprofile/fault/tolerance/tck/retrytimeout/clientserver/RetryTimeoutClient.java index 51e5a966..afecb72c 100644 --- a/tck/src/main/java/org/eclipse/microprofile/fault/tolerance/tck/retrytimeout/clientserver/RetryTimeoutClient.java +++ b/tck/src/main/java/org/eclipse/microprofile/fault/tolerance/tck/retrytimeout/clientserver/RetryTimeoutClient.java @@ -22,6 +22,7 @@ import static org.testng.Assert.fail; import org.eclipse.microprofile.fault.tolerance.tck.util.TCKConfig; +import org.eclipse.microprofile.fault.tolerance.tck.util.TestException; import org.eclipse.microprofile.faulttolerance.Retry; import org.eclipse.microprofile.faulttolerance.Timeout; import org.eclipse.microprofile.faulttolerance.exceptions.BulkheadException; @@ -68,7 +69,7 @@ public String serviceA(long timeToSleep) { try { counterForInvokingServiceA++; Thread.sleep(timeToSleep); - throw new RuntimeException("Timeout did not interrupt"); + throw new TestException("Timeout did not interrupt"); } catch (InterruptedException e) { // expected } diff --git a/tck/src/main/java/org/eclipse/microprofile/fault/tolerance/tck/timeout/clientserver/DefaultTimeoutClient.java b/tck/src/main/java/org/eclipse/microprofile/fault/tolerance/tck/timeout/clientserver/DefaultTimeoutClient.java index 1abeae8b..a6618d33 100644 --- a/tck/src/main/java/org/eclipse/microprofile/fault/tolerance/tck/timeout/clientserver/DefaultTimeoutClient.java +++ b/tck/src/main/java/org/eclipse/microprofile/fault/tolerance/tck/timeout/clientserver/DefaultTimeoutClient.java @@ -21,6 +21,7 @@ import java.sql.Connection; +import org.eclipse.microprofile.fault.tolerance.tck.util.TestException; import org.eclipse.microprofile.faulttolerance.Timeout; import jakarta.enterprise.context.RequestScoped; @@ -45,7 +46,7 @@ public class DefaultTimeoutClient { public Connection serviceA(long timeToSleep) { try { Thread.sleep(timeToSleep); - throw new RuntimeException("Timeout did not interrupt"); + throw new TestException("Timeout did not interrupt"); } catch (InterruptedException e) { // expected } @@ -63,7 +64,7 @@ public Connection serviceA(long timeToSleep) { public Connection serviceB(long timeToSleep) { try { Thread.sleep(timeToSleep); - throw new RuntimeException("Timeout did not interrupt"); + throw new TestException("Timeout did not interrupt"); } catch (InterruptedException e) { // expected } diff --git a/tck/src/main/java/org/eclipse/microprofile/fault/tolerance/tck/timeout/clientserver/ShorterTimeoutClient.java b/tck/src/main/java/org/eclipse/microprofile/fault/tolerance/tck/timeout/clientserver/ShorterTimeoutClient.java index d3eff0ac..e0097253 100644 --- a/tck/src/main/java/org/eclipse/microprofile/fault/tolerance/tck/timeout/clientserver/ShorterTimeoutClient.java +++ b/tck/src/main/java/org/eclipse/microprofile/fault/tolerance/tck/timeout/clientserver/ShorterTimeoutClient.java @@ -21,6 +21,7 @@ import java.sql.Connection; +import org.eclipse.microprofile.fault.tolerance.tck.util.TestException; import org.eclipse.microprofile.faulttolerance.Timeout; import jakarta.enterprise.context.RequestScoped; @@ -45,7 +46,7 @@ public class ShorterTimeoutClient { public Connection serviceA(long timeToSleep) { try { Thread.sleep(timeToSleep); - throw new RuntimeException("Timeout did not interrupt"); + throw new TestException("Timeout did not interrupt"); } catch (InterruptedException e) { // expected } @@ -63,7 +64,7 @@ public Connection serviceA(long timeToSleep) { public Connection serviceB(long timeToSleep) { try { Thread.sleep(timeToSleep); - throw new RuntimeException("Timeout did not interrupt"); + throw new TestException("Timeout did not interrupt"); } catch (InterruptedException e) { // expected } diff --git a/tck/src/main/java/org/eclipse/microprofile/fault/tolerance/tck/timeout/clientserver/TimeoutClient.java b/tck/src/main/java/org/eclipse/microprofile/fault/tolerance/tck/timeout/clientserver/TimeoutClient.java index f28f568d..e762b5c2 100644 --- a/tck/src/main/java/org/eclipse/microprofile/fault/tolerance/tck/timeout/clientserver/TimeoutClient.java +++ b/tck/src/main/java/org/eclipse/microprofile/fault/tolerance/tck/timeout/clientserver/TimeoutClient.java @@ -22,6 +22,7 @@ import java.sql.Connection; import java.time.temporal.ChronoUnit; +import org.eclipse.microprofile.fault.tolerance.tck.util.TestException; import org.eclipse.microprofile.faulttolerance.Timeout; import jakarta.enterprise.context.RequestScoped; @@ -46,7 +47,7 @@ public class TimeoutClient { public Connection serviceA(long timeToSleep) { try { Thread.sleep(timeToSleep); - throw new RuntimeException("Timeout did not interrupt"); + throw new TestException("Timeout did not interrupt"); } catch (InterruptedException e) { // expected } @@ -64,7 +65,7 @@ public Connection serviceA(long timeToSleep) { public Connection serviceB(long timeToSleep) { try { Thread.sleep(timeToSleep); - throw new RuntimeException("Timeout did not interrupt"); + throw new TestException("Timeout did not interrupt"); } catch (InterruptedException e) { // expected } @@ -82,7 +83,7 @@ public Connection serviceB(long timeToSleep) { public Connection serviceC(long timeToSleep) { try { Thread.sleep(timeToSleep); - throw new RuntimeException("Timeout did not interrupt"); + throw new TestException("Timeout did not interrupt"); } catch (InterruptedException e) { // expected } @@ -100,7 +101,7 @@ public Connection serviceC(long timeToSleep) { public Connection serviceD(long timeToSleepInMillis) { try { Thread.sleep(timeToSleepInMillis); - throw new RuntimeException("Timeout did not interrupt"); + throw new TestException("Timeout did not interrupt"); } catch (InterruptedException e) { // expected } diff --git a/tck/src/main/java/org/eclipse/microprofile/fault/tolerance/tck/visibility/retry/RetryVisibilityTest.java b/tck/src/main/java/org/eclipse/microprofile/fault/tolerance/tck/visibility/retry/RetryVisibilityTest.java index 5b8edbe5..703c4a0b 100644 --- a/tck/src/main/java/org/eclipse/microprofile/fault/tolerance/tck/visibility/retry/RetryVisibilityTest.java +++ b/tck/src/main/java/org/eclipse/microprofile/fault/tolerance/tck/visibility/retry/RetryVisibilityTest.java @@ -21,6 +21,7 @@ import java.io.IOException; +import org.eclipse.microprofile.fault.tolerance.tck.util.TestException; import org.jboss.arquillian.container.test.api.Deployment; import org.jboss.arquillian.testng.Arquillian; import org.jboss.shrinkwrap.api.ShrinkWrap; @@ -42,7 +43,7 @@ public class RetryVisibilityTest extends Arquillian { public static WebArchive deploy() { JavaArchive testJar = ShrinkWrap .create(JavaArchive.class, "ftRetryVisibility.jar") - // .addClasses( + .addClasses(TestException.class // RS.class, // RetryServiceType.class, // RetryService.class, @@ -50,7 +51,7 @@ public static WebArchive deploy() { // RetryOnClassServiceOverrideClassLevel.class, // RetryOnClassServiceOverrideMethodLevel.class, // RetryOnClassServiceNoAnnotationOnOveriddenMethod.class - // ) + ) .addPackage("org.eclipse.microprofile.fault.tolerance.tck.visibility.retry") .addAsManifestResource(EmptyAsset.INSTANCE, "beans.xml") .as(JavaArchive.class); @@ -272,11 +273,11 @@ private void checkServiceCall(int nbExpectedRetries, RetryService service, Strin RetryVisibilityTest.class.getSimpleName(), testName, expectedNbCalls)); - } catch (RuntimeException ex) { + } catch (TestException ex) { Assert.fail(String.format("no %s exception should have been thrown in %s#%s", ex.getClass().getName(), RetryVisibilityTest.class.getSimpleName(), - testName)); + testName), ex); } } } From f297f33ee67a6c583dbce257a54b67cd8cc22d02 Mon Sep 17 00:00:00 2001 From: Benjamin Confino Date: Tue, 20 Feb 2024 13:00:03 +0000 Subject: [PATCH 2/3] code review chnages --- .../fault/tolerance/tck/AsyncTimeoutTest.java | 4 +--- .../fault/tolerance/tck/FallbackTest.java | 16 +++++++-------- .../tolerance/tck/RetryConditionTest.java | 4 ++-- .../clientserver/AsyncRetryClient.java | 20 ++++++++++--------- .../CircuitBreakerClientWithRetryAsync.java | 3 ++- .../fallback/clientserver/FallbackClient.java | 3 ++- .../clientserver/FallbackOnlyClient.java | 3 ++- .../clientserver/FallbackWithBeanClient.java | 3 ++- .../RetryClassLevelClientAbortOn.java | 2 +- .../BaseRetryOnClassAndMethodService.java | 8 ++++---- .../retry/BaseRetryOnClassService.java | 8 ++++---- .../retry/BaseRetryOnMethodService.java | 8 ++++---- ...thodServiceNoAnnotationMethodOverride.java | 3 +-- ...rviceOverrideClassLevelMethodOverride.java | 3 +-- ...ssAndMethodServiceOverrideMethodLevel.java | 3 +-- ...sServiceNoAnnotationOnOveriddenMethod.java | 4 +++- ...rviceOverrideClassLevelMethodOverride.java | 3 ++- ...etryOnClassServiceOverrideMethodLevel.java | 3 ++- ...dServiceNoAnnotationOnOverridedMethod.java | 4 +--- ...viceOverridedClassLevelMethodOverride.java | 3 +-- ...ryOnMethodServiceOverridedMethodLevel.java | 3 +-- .../tck/visibility/retry/RetryService.java | 3 +-- .../visibility/retry/RetryVisibilityTest.java | 6 ++---- 23 files changed, 59 insertions(+), 61 deletions(-) diff --git a/tck/src/main/java/org/eclipse/microprofile/fault/tolerance/tck/AsyncTimeoutTest.java b/tck/src/main/java/org/eclipse/microprofile/fault/tolerance/tck/AsyncTimeoutTest.java index 6e38d74a..554d2df5 100644 --- a/tck/src/main/java/org/eclipse/microprofile/fault/tolerance/tck/AsyncTimeoutTest.java +++ b/tck/src/main/java/org/eclipse/microprofile/fault/tolerance/tck/AsyncTimeoutTest.java @@ -34,7 +34,6 @@ import org.eclipse.microprofile.fault.tolerance.tck.asynctimeout.clientserver.AsyncTimeoutClient; import org.eclipse.microprofile.fault.tolerance.tck.config.ConfigAnnotationAsset; import org.eclipse.microprofile.fault.tolerance.tck.util.Connection; -import org.eclipse.microprofile.fault.tolerance.tck.util.TestException; import org.eclipse.microprofile.faulttolerance.Timeout; import org.jboss.arquillian.container.test.api.Deployment; import org.jboss.arquillian.testng.Arquillian; @@ -79,8 +78,7 @@ public static WebArchive deploy() { JavaArchive testJar = ShrinkWrap .create(JavaArchive.class, "ftAsyncTimeout.jar") - .addClasses(AsyncTimeoutClient.class, AsyncClassLevelTimeoutClient.class, Connection.class, - TestException.class) + .addClasses(AsyncTimeoutClient.class, AsyncClassLevelTimeoutClient.class, Connection.class) .addAsManifestResource(config, "microprofile-config.properties") .addAsManifestResource(EmptyAsset.INSTANCE, "beans.xml") .as(JavaArchive.class); diff --git a/tck/src/main/java/org/eclipse/microprofile/fault/tolerance/tck/FallbackTest.java b/tck/src/main/java/org/eclipse/microprofile/fault/tolerance/tck/FallbackTest.java index f40837d3..b28f1211 100644 --- a/tck/src/main/java/org/eclipse/microprofile/fault/tolerance/tck/FallbackTest.java +++ b/tck/src/main/java/org/eclipse/microprofile/fault/tolerance/tck/FallbackTest.java @@ -83,7 +83,7 @@ public void testFallbackSuccess() { Assert.assertTrue(result.contains("serviceA"), "The message should be \"fallback for serviceA\""); } catch (TestException ex) { - Assert.fail("serviceA should not throw a RuntimeException in testFallbackSuccess", ex); + Assert.fail("serviceA should not throw a TestException in testFallbackSuccess", ex); } Assert.assertEquals(fallbackClient.getCounterForInvokingServiceA(), 2, "The execution count should be 2 (1 retry + 1)"); @@ -92,7 +92,7 @@ public void testFallbackSuccess() { Assert.assertTrue(result.contains("serviceB"), "The message should be \"fallback for serviceB\""); } catch (TestException ex) { - Assert.fail("serviceB should not throw a RuntimeException in testFallbackSuccess", ex); + Assert.fail("serviceB should not throw a TestException in testFallbackSuccess", ex); } Assert.assertEquals(fallbackClient.getCounterForInvokingServiceB(), 3, "The execution count should be 3 (2 retries + 1)"); @@ -115,7 +115,7 @@ public void testFallbackWithBeanSuccess() { Assert.assertTrue(result.contains("34"), "The message should be \"fallback for serviceA myBean.getCount()=34\""); } catch (TestException ex) { - Assert.fail("serviceA should not throw a RuntimeException in testFallbackWithBeanSuccess", ex); + Assert.fail("serviceA should not throw a TestException in testFallbackWithBeanSuccess", ex); } Assert.assertEquals(fallbackWithBeanClient.getCounterForInvokingServiceA(), 2, "The execution count should be 2 (1 retry + 1)"); @@ -128,7 +128,7 @@ public void testFallbackWithBeanSuccess() { Assert.assertTrue(result.contains("35"), "The message should be \"fallback for serviceB myBean.getCount()=35\""); } catch (TestException ex) { - Assert.fail("serviceB should not throw a RuntimeException in testFallbackWithBeanSuccess", ex); + Assert.fail("serviceB should not throw a TestException in testFallbackWithBeanSuccess", ex); } Assert.assertEquals(fallbackWithBeanClient.getCounterForInvokingServiceB(), 3, "The execution count should be 3 (2 retries + 1)"); @@ -146,7 +146,7 @@ public void testClassLevelFallbackSuccess() { Assert.assertTrue(result.contains("serviceA"), "The message should be \"fallback for serviceA\""); } catch (TestException ex) { - Assert.fail("serviceA should not throw a RuntimeException in testFallbackSuccess", ex); + Assert.fail("serviceA should not throw a TestException in testFallbackSuccess", ex); } Assert.assertEquals(fallbackClassLevelClient.getCounterForInvokingServiceA(), 2, "The execution count should be 2 (1 retry + 1)"); @@ -158,7 +158,7 @@ public void testClassLevelFallbackSuccess() { "The message should be " + TestException.class.getName()); } catch (TestException ex) { - Assert.fail("serviceB should not throw a RuntimeException in testFallbackSuccess", ex); + Assert.fail("serviceB should not throw a TestException in testFallbackSuccess", ex); } Assert.assertEquals(fallbackClassLevelClient.getCounterForInvokingServiceB(), 3, "The execution count should be 3 (2 retries + 1)"); @@ -181,7 +181,7 @@ public void testFallbacktNoTimeout() { Assert.fail("serviceC should not throw a TimeoutException in testFallbacktNoTimeout"); } catch (TestException ex) { // Not expected - Assert.fail("serviceC should not throw a RuntimeException in testFallbacktNoTimeout", ex); + Assert.fail("serviceC should not throw a TestException in testFallbacktNoTimeout", ex); } Assert.assertEquals(fallbackClient.getCounterForInvokingServiceC(), 2, @@ -205,7 +205,7 @@ public void testFallbackTimeout() { Assert.fail("serviceC should not throw a TimeoutException in testFallbackTimeout"); } catch (TestException ex) { // Not Expected - Assert.fail("serviceC should not throw a RuntimeException in testFallbackTimeout", ex); + Assert.fail("serviceC should not throw a TestException in testFallbackTimeout", ex); } Assert.assertEquals(fallbackClient.getCounterForInvokingServiceC(), 2, diff --git a/tck/src/main/java/org/eclipse/microprofile/fault/tolerance/tck/RetryConditionTest.java b/tck/src/main/java/org/eclipse/microprofile/fault/tolerance/tck/RetryConditionTest.java index b04b5315..eb1676f0 100644 --- a/tck/src/main/java/org/eclipse/microprofile/fault/tolerance/tck/RetryConditionTest.java +++ b/tck/src/main/java/org/eclipse/microprofile/fault/tolerance/tck/RetryConditionTest.java @@ -63,8 +63,8 @@ */ public class RetryConditionTest extends Arquillian { - private final static String SIMULATED_EXCEPTION_MESSAGE = "Simulated error"; - private final static String SIMULATED_RUNTIME_EXCEPTION_MESSAGE = "Test Exception - Simulated error"; + public final static String SIMULATED_EXCEPTION_MESSAGE = "Simulated error"; + public final static String SIMULATED_RUNTIME_EXCEPTION_MESSAGE = "Test Exception - Simulated error"; private @Inject RetryClientRetryOn clientForRetryOn; private @Inject RetryClientAbortOn clientForAbortOn; diff --git a/tck/src/main/java/org/eclipse/microprofile/fault/tolerance/tck/asyncretry/clientserver/AsyncRetryClient.java b/tck/src/main/java/org/eclipse/microprofile/fault/tolerance/tck/asyncretry/clientserver/AsyncRetryClient.java index 2c1d0c7e..63ce3d60 100644 --- a/tck/src/main/java/org/eclipse/microprofile/fault/tolerance/tck/asyncretry/clientserver/AsyncRetryClient.java +++ b/tck/src/main/java/org/eclipse/microprofile/fault/tolerance/tck/asyncretry/clientserver/AsyncRetryClient.java @@ -8,6 +8,8 @@ import java.util.concurrent.TimeUnit; import java.util.function.Supplier; +import org.eclipse.microprofile.fault.tolerance.tck.RetryConditionTest; + /* ******************************************************************************* * Copyright (c) 2018 Contributors to the Eclipse Foundation @@ -69,7 +71,7 @@ public CompletionStage serviceA() { countInvocationsServA++; // always fail CompletableFuture future = new CompletableFuture<>(); - future.completeExceptionally(new IOException("Simulated error")); + future.completeExceptionally(new IOException(RetryConditionTest.SIMULATED_EXCEPTION_MESSAGE)); return future; } @@ -82,7 +84,7 @@ public CompletionStage serviceA() { public CompletionStage serviceBFailExceptionally(final CompletionStage future) { countInvocationsServBFailExceptionally++; // always fail - future.toCompletableFuture().completeExceptionally(new IOException("Simulated error")); + future.toCompletableFuture().completeExceptionally(new IOException(RetryConditionTest.SIMULATED_EXCEPTION_MESSAGE)); return future; } @@ -95,7 +97,7 @@ public CompletionStage serviceBFailExceptionally(final CompletionStage f public CompletionStage serviceBFailException(final CompletionStage future) { countInvocationsServBFailException++; // always fail - throw new TestException("Simulated error"); + throw new TestException(RetryConditionTest.SIMULATED_EXCEPTION_MESSAGE); } /** @@ -112,7 +114,7 @@ public CompletionStage serviceC() { if (countInvocationsServC < 3) { // fail 2 first invocations - future.completeExceptionally(new IOException("Simulated error")); + future.completeExceptionally(new IOException(RetryConditionTest.SIMULATED_EXCEPTION_MESSAGE)); } else { future.complete("Success"); } @@ -133,7 +135,7 @@ public CompletionStage serviceD() { if (countInvocationsServD < 3) { // fail 2 first invocations return CompletableFuture.supplyAsync(doTask(null), executor) - .thenCompose(s -> CompletableFuture.supplyAsync(doTask("Simulated error"), executor)); + .thenCompose(s -> CompletableFuture.supplyAsync(doTask(RetryConditionTest.SIMULATED_EXCEPTION_MESSAGE), executor)); } else { return CompletableFuture.supplyAsync(doTask(null), executor) .thenCompose(s -> CompletableFuture.supplyAsync(doTask(null), executor)); @@ -153,7 +155,7 @@ public CompletionStage serviceE() { // always fail return CompletableFuture.supplyAsync(doTask(null), executor) - .thenCompose(s -> CompletableFuture.supplyAsync(doTask("Simulated error"), executor)); + .thenCompose(s -> CompletableFuture.supplyAsync(doTask(RetryConditionTest.SIMULATED_EXCEPTION_MESSAGE), executor)); } /** @@ -170,7 +172,7 @@ public CompletionStage serviceF() { if (countInvocationsServF < 3) { // fail 2 first invocations return CompletableFuture.supplyAsync(doTask(null), executor) - .thenCombine(CompletableFuture.supplyAsync(doTask("Simulated error"), executor), + .thenCombine(CompletableFuture.supplyAsync(doTask(RetryConditionTest.SIMULATED_EXCEPTION_MESSAGE), executor), (s, s2) -> s + " then " + s2); } else { return CompletableFuture.supplyAsync(doTask(null), executor) @@ -192,7 +194,7 @@ public CompletionStage serviceG() { countInvocationsServG++; // always fail return CompletableFuture.supplyAsync(doTask(null), executor) - .thenCombine(CompletableFuture.supplyAsync(doTask("Simulated error"), executor), + .thenCombine(CompletableFuture.supplyAsync(doTask(RetryConditionTest.SIMULATED_EXCEPTION_MESSAGE), executor), (s, s2) -> s + " then " + s2); } @@ -208,7 +210,7 @@ public CompletionStage serviceH() { countInvocationsServH++; // fails twice if (countInvocationsServH < 3) { - throw new TestException("Simulated error"); + throw new TestException(RetryConditionTest.SIMULATED_EXCEPTION_MESSAGE); } CompletableFuture future = new CompletableFuture<>(); diff --git a/tck/src/main/java/org/eclipse/microprofile/fault/tolerance/tck/circuitbreaker/clientserver/CircuitBreakerClientWithRetryAsync.java b/tck/src/main/java/org/eclipse/microprofile/fault/tolerance/tck/circuitbreaker/clientserver/CircuitBreakerClientWithRetryAsync.java index d82b34d6..154f4193 100644 --- a/tck/src/main/java/org/eclipse/microprofile/fault/tolerance/tck/circuitbreaker/clientserver/CircuitBreakerClientWithRetryAsync.java +++ b/tck/src/main/java/org/eclipse/microprofile/fault/tolerance/tck/circuitbreaker/clientserver/CircuitBreakerClientWithRetryAsync.java @@ -32,6 +32,7 @@ import org.eclipse.microprofile.faulttolerance.Timeout; import org.eclipse.microprofile.faulttolerance.exceptions.CircuitBreakerOpenException; import org.eclipse.microprofile.faulttolerance.exceptions.TimeoutException; +import org.testng.Assert; import jakarta.enterprise.context.RequestScoped; @@ -94,7 +95,7 @@ public Future serviceC() { try { Thread.sleep(TCKConfig.getConfig().getTimeoutInMillis(5000)); - throw new TestException("Timeout did not interrupt"); + Assert.fail("Timeout did not interrupt"); } catch (InterruptedException e) { // expected } diff --git a/tck/src/main/java/org/eclipse/microprofile/fault/tolerance/tck/fallback/clientserver/FallbackClient.java b/tck/src/main/java/org/eclipse/microprofile/fault/tolerance/tck/fallback/clientserver/FallbackClient.java index 52b9a2a3..c259ee70 100644 --- a/tck/src/main/java/org/eclipse/microprofile/fault/tolerance/tck/fallback/clientserver/FallbackClient.java +++ b/tck/src/main/java/org/eclipse/microprofile/fault/tolerance/tck/fallback/clientserver/FallbackClient.java @@ -22,6 +22,7 @@ import org.eclipse.microprofile.faulttolerance.Fallback; import org.eclipse.microprofile.faulttolerance.Retry; import org.eclipse.microprofile.faulttolerance.Timeout; +import org.eclipse.microprofile.fault.tolerance.tck.util.TestException; import jakarta.enterprise.context.RequestScoped; @@ -111,7 +112,7 @@ public String fallbackForServiceE(String name, Integer type) { } private String nameService() { - throw new RuntimeException("Connection failed"); + throw new TestException("Connection failed"); } } diff --git a/tck/src/main/java/org/eclipse/microprofile/fault/tolerance/tck/fallback/clientserver/FallbackOnlyClient.java b/tck/src/main/java/org/eclipse/microprofile/fault/tolerance/tck/fallback/clientserver/FallbackOnlyClient.java index 3e8cb114..31a89df0 100644 --- a/tck/src/main/java/org/eclipse/microprofile/fault/tolerance/tck/fallback/clientserver/FallbackOnlyClient.java +++ b/tck/src/main/java/org/eclipse/microprofile/fault/tolerance/tck/fallback/clientserver/FallbackOnlyClient.java @@ -20,6 +20,7 @@ package org.eclipse.microprofile.fault.tolerance.tck.fallback.clientserver; import org.eclipse.microprofile.faulttolerance.Fallback; +import org.eclipse.microprofile.fault.tolerance.tck.util.TestException; import jakarta.enterprise.context.RequestScoped; @@ -59,6 +60,6 @@ public String fallbackForServiceB() { } private String nameService() { - throw new RuntimeException("Connection failed"); + throw new TestException("Connection failed"); } } diff --git a/tck/src/main/java/org/eclipse/microprofile/fault/tolerance/tck/fallback/clientserver/FallbackWithBeanClient.java b/tck/src/main/java/org/eclipse/microprofile/fault/tolerance/tck/fallback/clientserver/FallbackWithBeanClient.java index b84d385a..840e32aa 100644 --- a/tck/src/main/java/org/eclipse/microprofile/fault/tolerance/tck/fallback/clientserver/FallbackWithBeanClient.java +++ b/tck/src/main/java/org/eclipse/microprofile/fault/tolerance/tck/fallback/clientserver/FallbackWithBeanClient.java @@ -21,6 +21,7 @@ import org.eclipse.microprofile.faulttolerance.Fallback; import org.eclipse.microprofile.faulttolerance.Retry; +import org.eclipse.microprofile.fault.tolerance.tck.util.TestException; import jakarta.enterprise.context.RequestScoped; @@ -59,7 +60,7 @@ public String serviceB() { } private String nameService() { - throw new RuntimeException("Connection failed"); + throw new TestException("Connection failed"); } } diff --git a/tck/src/main/java/org/eclipse/microprofile/fault/tolerance/tck/retry/clientserver/RetryClassLevelClientAbortOn.java b/tck/src/main/java/org/eclipse/microprofile/fault/tolerance/tck/retry/clientserver/RetryClassLevelClientAbortOn.java index 7d702000..c9449934 100644 --- a/tck/src/main/java/org/eclipse/microprofile/fault/tolerance/tck/retry/clientserver/RetryClassLevelClientAbortOn.java +++ b/tck/src/main/java/org/eclipse/microprofile/fault/tolerance/tck/retry/clientserver/RetryClassLevelClientAbortOn.java @@ -55,7 +55,7 @@ public int getRetryCountForConnectionService() { /** * serviceB is configured to retry on a RuntimeException. The WritingService throws RuntimeExceptions. */ - @Retry(abortOn = {RuntimeException.class}) + @Retry(abortOn = {TestException.class}) public void serviceB() { writingService(); } diff --git a/tck/src/main/java/org/eclipse/microprofile/fault/tolerance/tck/visibility/retry/BaseRetryOnClassAndMethodService.java b/tck/src/main/java/org/eclipse/microprofile/fault/tolerance/tck/visibility/retry/BaseRetryOnClassAndMethodService.java index bf2b02a9..15f4ddec 100644 --- a/tck/src/main/java/org/eclipse/microprofile/fault/tolerance/tck/visibility/retry/BaseRetryOnClassAndMethodService.java +++ b/tck/src/main/java/org/eclipse/microprofile/fault/tolerance/tck/visibility/retry/BaseRetryOnClassAndMethodService.java @@ -19,10 +19,10 @@ *******************************************************************************/ package org.eclipse.microprofile.fault.tolerance.tck.visibility.retry; -import java.io.IOException; import java.sql.Connection; import org.eclipse.microprofile.faulttolerance.Retry; +import org.eclipse.microprofile.fault.tolerance.tck.util.TestException; import jakarta.enterprise.context.RequestScoped; @@ -34,13 +34,13 @@ public class BaseRetryOnClassAndMethodService implements RetryService { @Override @Retry(maxRetries = 4) - public Connection service() throws IOException { + public Connection service() { nbCalls++; return delegate(); } - protected Connection delegate() throws IOException { - throw new IOException("cannot access delegate service"); + protected Connection delegate() { + throw new TestException("cannot access delegate service"); } @Override diff --git a/tck/src/main/java/org/eclipse/microprofile/fault/tolerance/tck/visibility/retry/BaseRetryOnClassService.java b/tck/src/main/java/org/eclipse/microprofile/fault/tolerance/tck/visibility/retry/BaseRetryOnClassService.java index b9c8b17a..6bcfd030 100644 --- a/tck/src/main/java/org/eclipse/microprofile/fault/tolerance/tck/visibility/retry/BaseRetryOnClassService.java +++ b/tck/src/main/java/org/eclipse/microprofile/fault/tolerance/tck/visibility/retry/BaseRetryOnClassService.java @@ -19,10 +19,10 @@ *******************************************************************************/ package org.eclipse.microprofile.fault.tolerance.tck.visibility.retry; -import java.io.IOException; import java.sql.Connection; import org.eclipse.microprofile.faulttolerance.Retry; +import org.eclipse.microprofile.fault.tolerance.tck.util.TestException; import jakarta.enterprise.context.RequestScoped; @@ -33,13 +33,13 @@ public class BaseRetryOnClassService implements RetryService { private int nbCalls = 0; @Override - public Connection service() throws IOException { + public Connection service() { nbCalls++; return delegate(); } - protected Connection delegate() throws IOException { - throw new IOException("cannot access delegate service"); + protected Connection delegate() { + throw new TestException("cannot access delegate service"); } @Override diff --git a/tck/src/main/java/org/eclipse/microprofile/fault/tolerance/tck/visibility/retry/BaseRetryOnMethodService.java b/tck/src/main/java/org/eclipse/microprofile/fault/tolerance/tck/visibility/retry/BaseRetryOnMethodService.java index 13748b36..38a57b59 100644 --- a/tck/src/main/java/org/eclipse/microprofile/fault/tolerance/tck/visibility/retry/BaseRetryOnMethodService.java +++ b/tck/src/main/java/org/eclipse/microprofile/fault/tolerance/tck/visibility/retry/BaseRetryOnMethodService.java @@ -19,10 +19,10 @@ *******************************************************************************/ package org.eclipse.microprofile.fault.tolerance.tck.visibility.retry; -import java.io.IOException; import java.sql.Connection; import org.eclipse.microprofile.faulttolerance.Retry; +import org.eclipse.microprofile.fault.tolerance.tck.util.TestException; import jakarta.enterprise.context.RequestScoped; @@ -33,13 +33,13 @@ public class BaseRetryOnMethodService implements RetryService { @Override @Retry - public Connection service() throws IOException { + public Connection service() { nbCalls++; return delegate(); } - protected Connection delegate() throws IOException { - throw new IOException("cannot access delegate service"); + protected Connection delegate() { + throw new TestException("cannot access delegate service"); } @Override diff --git a/tck/src/main/java/org/eclipse/microprofile/fault/tolerance/tck/visibility/retry/RetryOnClassAndMethodServiceNoAnnotationMethodOverride.java b/tck/src/main/java/org/eclipse/microprofile/fault/tolerance/tck/visibility/retry/RetryOnClassAndMethodServiceNoAnnotationMethodOverride.java index 484ee1f9..be935ead 100644 --- a/tck/src/main/java/org/eclipse/microprofile/fault/tolerance/tck/visibility/retry/RetryOnClassAndMethodServiceNoAnnotationMethodOverride.java +++ b/tck/src/main/java/org/eclipse/microprofile/fault/tolerance/tck/visibility/retry/RetryOnClassAndMethodServiceNoAnnotationMethodOverride.java @@ -19,7 +19,6 @@ *******************************************************************************/ package org.eclipse.microprofile.fault.tolerance.tck.visibility.retry; -import java.io.IOException; import java.sql.Connection; import jakarta.enterprise.context.RequestScoped; @@ -28,7 +27,7 @@ @RS(RetryServiceType.BASE_ROCM_RETRY_MISSING_ON_METHOD) public class RetryOnClassAndMethodServiceNoAnnotationMethodOverride extends BaseRetryOnClassAndMethodService { @Override - public Connection service() throws IOException { + public Connection service() { return super.service(); } } diff --git a/tck/src/main/java/org/eclipse/microprofile/fault/tolerance/tck/visibility/retry/RetryOnClassAndMethodServiceOverrideClassLevelMethodOverride.java b/tck/src/main/java/org/eclipse/microprofile/fault/tolerance/tck/visibility/retry/RetryOnClassAndMethodServiceOverrideClassLevelMethodOverride.java index 575c0773..35294798 100644 --- a/tck/src/main/java/org/eclipse/microprofile/fault/tolerance/tck/visibility/retry/RetryOnClassAndMethodServiceOverrideClassLevelMethodOverride.java +++ b/tck/src/main/java/org/eclipse/microprofile/fault/tolerance/tck/visibility/retry/RetryOnClassAndMethodServiceOverrideClassLevelMethodOverride.java @@ -19,7 +19,6 @@ *******************************************************************************/ package org.eclipse.microprofile.fault.tolerance.tck.visibility.retry; -import java.io.IOException; import java.sql.Connection; import org.eclipse.microprofile.faulttolerance.Retry; @@ -31,7 +30,7 @@ @Retry(maxRetries = 5) public class RetryOnClassAndMethodServiceOverrideClassLevelMethodOverride extends BaseRetryOnClassAndMethodService { @Override - public Connection service() throws IOException { + public Connection service() { return super.service(); } } diff --git a/tck/src/main/java/org/eclipse/microprofile/fault/tolerance/tck/visibility/retry/RetryOnClassAndMethodServiceOverrideMethodLevel.java b/tck/src/main/java/org/eclipse/microprofile/fault/tolerance/tck/visibility/retry/RetryOnClassAndMethodServiceOverrideMethodLevel.java index 7e543e08..ba3f4b9e 100644 --- a/tck/src/main/java/org/eclipse/microprofile/fault/tolerance/tck/visibility/retry/RetryOnClassAndMethodServiceOverrideMethodLevel.java +++ b/tck/src/main/java/org/eclipse/microprofile/fault/tolerance/tck/visibility/retry/RetryOnClassAndMethodServiceOverrideMethodLevel.java @@ -19,7 +19,6 @@ *******************************************************************************/ package org.eclipse.microprofile.fault.tolerance.tck.visibility.retry; -import java.io.IOException; import java.sql.Connection; import org.eclipse.microprofile.faulttolerance.Retry; @@ -31,7 +30,7 @@ public class RetryOnClassAndMethodServiceOverrideMethodLevel extends BaseRetryOnClassAndMethodService { @Override @Retry(maxRetries = 5) - public Connection service() throws IOException { + public Connection service() { return super.service(); } } diff --git a/tck/src/main/java/org/eclipse/microprofile/fault/tolerance/tck/visibility/retry/RetryOnClassServiceNoAnnotationOnOveriddenMethod.java b/tck/src/main/java/org/eclipse/microprofile/fault/tolerance/tck/visibility/retry/RetryOnClassServiceNoAnnotationOnOveriddenMethod.java index f9db4daa..69b5ddad 100644 --- a/tck/src/main/java/org/eclipse/microprofile/fault/tolerance/tck/visibility/retry/RetryOnClassServiceNoAnnotationOnOveriddenMethod.java +++ b/tck/src/main/java/org/eclipse/microprofile/fault/tolerance/tck/visibility/retry/RetryOnClassServiceNoAnnotationOnOveriddenMethod.java @@ -24,11 +24,13 @@ import jakarta.enterprise.context.RequestScoped; +import org.eclipse.microprofile.fault.tolerance.tck.util.TestException; + @RequestScoped @RS(RetryServiceType.BASE_ROC_RETRY_MISSING_ON_METHOD) public class RetryOnClassServiceNoAnnotationOnOveriddenMethod extends BaseRetryOnClassService { @Override - public Connection service() throws IOException { + public Connection service() { return super.service(); } } diff --git a/tck/src/main/java/org/eclipse/microprofile/fault/tolerance/tck/visibility/retry/RetryOnClassServiceOverrideClassLevelMethodOverride.java b/tck/src/main/java/org/eclipse/microprofile/fault/tolerance/tck/visibility/retry/RetryOnClassServiceOverrideClassLevelMethodOverride.java index 9b780b28..b952164a 100644 --- a/tck/src/main/java/org/eclipse/microprofile/fault/tolerance/tck/visibility/retry/RetryOnClassServiceOverrideClassLevelMethodOverride.java +++ b/tck/src/main/java/org/eclipse/microprofile/fault/tolerance/tck/visibility/retry/RetryOnClassServiceOverrideClassLevelMethodOverride.java @@ -23,6 +23,7 @@ import java.sql.Connection; import org.eclipse.microprofile.faulttolerance.Retry; +import org.eclipse.microprofile.fault.tolerance.tck.util.TestException; import jakarta.enterprise.context.RequestScoped; @@ -31,7 +32,7 @@ @Retry(maxRetries = 4) public class RetryOnClassServiceOverrideClassLevelMethodOverride extends BaseRetryOnClassService { @Override - public Connection service() throws IOException { + public Connection service() { return super.service(); } } diff --git a/tck/src/main/java/org/eclipse/microprofile/fault/tolerance/tck/visibility/retry/RetryOnClassServiceOverrideMethodLevel.java b/tck/src/main/java/org/eclipse/microprofile/fault/tolerance/tck/visibility/retry/RetryOnClassServiceOverrideMethodLevel.java index 8268302f..6894bef6 100644 --- a/tck/src/main/java/org/eclipse/microprofile/fault/tolerance/tck/visibility/retry/RetryOnClassServiceOverrideMethodLevel.java +++ b/tck/src/main/java/org/eclipse/microprofile/fault/tolerance/tck/visibility/retry/RetryOnClassServiceOverrideMethodLevel.java @@ -23,6 +23,7 @@ import java.sql.Connection; import org.eclipse.microprofile.faulttolerance.Retry; +import org.eclipse.microprofile.fault.tolerance.tck.util.TestException; import jakarta.enterprise.context.RequestScoped; @@ -37,7 +38,7 @@ public class RetryOnClassServiceOverrideMethodLevel extends BaseRetryOnClassService { @Override @Retry(maxRetries = 4) - public Connection service() throws IOException { + public Connection service() { return super.service(); } } diff --git a/tck/src/main/java/org/eclipse/microprofile/fault/tolerance/tck/visibility/retry/RetryOnMethodServiceNoAnnotationOnOverridedMethod.java b/tck/src/main/java/org/eclipse/microprofile/fault/tolerance/tck/visibility/retry/RetryOnMethodServiceNoAnnotationOnOverridedMethod.java index dba3bc80..e7eaaa8b 100644 --- a/tck/src/main/java/org/eclipse/microprofile/fault/tolerance/tck/visibility/retry/RetryOnMethodServiceNoAnnotationOnOverridedMethod.java +++ b/tck/src/main/java/org/eclipse/microprofile/fault/tolerance/tck/visibility/retry/RetryOnMethodServiceNoAnnotationOnOverridedMethod.java @@ -18,8 +18,6 @@ * limitations under the License. *******************************************************************************/ package org.eclipse.microprofile.fault.tolerance.tck.visibility.retry; - -import java.io.IOException; import java.sql.Connection; import jakarta.enterprise.context.RequestScoped; @@ -28,7 +26,7 @@ @RS(RetryServiceType.BASE_ROM_RETRY_MISSING_ON_METHOD) public class RetryOnMethodServiceNoAnnotationOnOverridedMethod extends BaseRetryOnMethodService { @Override - public Connection service() throws IOException { + public Connection service() { return super.service(); } } diff --git a/tck/src/main/java/org/eclipse/microprofile/fault/tolerance/tck/visibility/retry/RetryOnMethodServiceOverridedClassLevelMethodOverride.java b/tck/src/main/java/org/eclipse/microprofile/fault/tolerance/tck/visibility/retry/RetryOnMethodServiceOverridedClassLevelMethodOverride.java index 8bdd1ad9..0e97f6be 100644 --- a/tck/src/main/java/org/eclipse/microprofile/fault/tolerance/tck/visibility/retry/RetryOnMethodServiceOverridedClassLevelMethodOverride.java +++ b/tck/src/main/java/org/eclipse/microprofile/fault/tolerance/tck/visibility/retry/RetryOnMethodServiceOverridedClassLevelMethodOverride.java @@ -19,7 +19,6 @@ *******************************************************************************/ package org.eclipse.microprofile.fault.tolerance.tck.visibility.retry; -import java.io.IOException; import java.sql.Connection; import org.eclipse.microprofile.faulttolerance.Retry; @@ -31,7 +30,7 @@ @Retry(maxRetries = 4) public class RetryOnMethodServiceOverridedClassLevelMethodOverride extends BaseRetryOnMethodService { @Override - public Connection service() throws IOException { + public Connection service() { return super.service(); } } diff --git a/tck/src/main/java/org/eclipse/microprofile/fault/tolerance/tck/visibility/retry/RetryOnMethodServiceOverridedMethodLevel.java b/tck/src/main/java/org/eclipse/microprofile/fault/tolerance/tck/visibility/retry/RetryOnMethodServiceOverridedMethodLevel.java index 80c7b2c3..2020b0d6 100644 --- a/tck/src/main/java/org/eclipse/microprofile/fault/tolerance/tck/visibility/retry/RetryOnMethodServiceOverridedMethodLevel.java +++ b/tck/src/main/java/org/eclipse/microprofile/fault/tolerance/tck/visibility/retry/RetryOnMethodServiceOverridedMethodLevel.java @@ -19,7 +19,6 @@ *******************************************************************************/ package org.eclipse.microprofile.fault.tolerance.tck.visibility.retry; -import java.io.IOException; import java.sql.Connection; import org.eclipse.microprofile.faulttolerance.Retry; @@ -31,7 +30,7 @@ public class RetryOnMethodServiceOverridedMethodLevel extends BaseRetryOnMethodService { @Override @Retry(maxRetries = 4) - public Connection service() throws IOException { + public Connection service() { return super.service(); } } diff --git a/tck/src/main/java/org/eclipse/microprofile/fault/tolerance/tck/visibility/retry/RetryService.java b/tck/src/main/java/org/eclipse/microprofile/fault/tolerance/tck/visibility/retry/RetryService.java index 0d10c803..3a6c98a3 100644 --- a/tck/src/main/java/org/eclipse/microprofile/fault/tolerance/tck/visibility/retry/RetryService.java +++ b/tck/src/main/java/org/eclipse/microprofile/fault/tolerance/tck/visibility/retry/RetryService.java @@ -19,11 +19,10 @@ *******************************************************************************/ package org.eclipse.microprofile.fault.tolerance.tck.visibility.retry; -import java.io.IOException; import java.sql.Connection; public interface RetryService { - Connection service() throws IOException; + Connection service(); int getNumberOfServiceCalls(); } diff --git a/tck/src/main/java/org/eclipse/microprofile/fault/tolerance/tck/visibility/retry/RetryVisibilityTest.java b/tck/src/main/java/org/eclipse/microprofile/fault/tolerance/tck/visibility/retry/RetryVisibilityTest.java index 703c4a0b..d7a93dc8 100644 --- a/tck/src/main/java/org/eclipse/microprofile/fault/tolerance/tck/visibility/retry/RetryVisibilityTest.java +++ b/tck/src/main/java/org/eclipse/microprofile/fault/tolerance/tck/visibility/retry/RetryVisibilityTest.java @@ -19,8 +19,6 @@ *******************************************************************************/ package org.eclipse.microprofile.fault.tolerance.tck.visibility.retry; -import java.io.IOException; - import org.eclipse.microprofile.fault.tolerance.tck.util.TestException; import org.jboss.arquillian.container.test.api.Deployment; import org.jboss.arquillian.testng.Arquillian; @@ -265,7 +263,7 @@ private void checkServiceCall(int nbExpectedRetries, RetryService service, Strin service.service(); Assert.fail(String.format("in %s#%s service() should have failed", RetryVisibilityTest.class.getSimpleName(), testName)); - } catch (IOException re) { + } catch (TestException re) { Assert.assertEquals( service.getNumberOfServiceCalls(), expectedNbCalls, @@ -273,7 +271,7 @@ private void checkServiceCall(int nbExpectedRetries, RetryService service, Strin RetryVisibilityTest.class.getSimpleName(), testName, expectedNbCalls)); - } catch (TestException ex) { + } catch (Exception ex) { Assert.fail(String.format("no %s exception should have been thrown in %s#%s", ex.getClass().getName(), RetryVisibilityTest.class.getSimpleName(), From a6fffc74ff1e9d87c0c357d986464133d05b142c Mon Sep 17 00:00:00 2001 From: Andrew Rouse Date: Tue, 20 Feb 2024 17:29:51 +0000 Subject: [PATCH 3/3] Autoformat changes These are all changes that the autoformatter makes when running the build. --- .../clientserver/AsyncRetryClient.java | 17 +++++++++++------ .../fallback/clientserver/FallbackClient.java | 2 +- .../clientserver/FallbackOnlyClient.java | 2 +- .../clientserver/FallbackWithBeanClient.java | 2 +- .../retry/BaseRetryOnClassAndMethodService.java | 2 +- .../retry/BaseRetryOnClassService.java | 2 +- .../retry/BaseRetryOnMethodService.java | 2 +- ...assServiceNoAnnotationOnOveriddenMethod.java | 3 --- ...ServiceOverrideClassLevelMethodOverride.java | 2 -- .../RetryOnClassServiceOverrideMethodLevel.java | 2 -- ...hodServiceNoAnnotationOnOverridedMethod.java | 1 + 11 files changed, 18 insertions(+), 19 deletions(-) diff --git a/tck/src/main/java/org/eclipse/microprofile/fault/tolerance/tck/asyncretry/clientserver/AsyncRetryClient.java b/tck/src/main/java/org/eclipse/microprofile/fault/tolerance/tck/asyncretry/clientserver/AsyncRetryClient.java index 63ce3d60..9151d0c2 100644 --- a/tck/src/main/java/org/eclipse/microprofile/fault/tolerance/tck/asyncretry/clientserver/AsyncRetryClient.java +++ b/tck/src/main/java/org/eclipse/microprofile/fault/tolerance/tck/asyncretry/clientserver/AsyncRetryClient.java @@ -9,7 +9,6 @@ import java.util.function.Supplier; import org.eclipse.microprofile.fault.tolerance.tck.RetryConditionTest; - /* ******************************************************************************* * Copyright (c) 2018 Contributors to the Eclipse Foundation @@ -84,7 +83,8 @@ public CompletionStage serviceA() { public CompletionStage serviceBFailExceptionally(final CompletionStage future) { countInvocationsServBFailExceptionally++; // always fail - future.toCompletableFuture().completeExceptionally(new IOException(RetryConditionTest.SIMULATED_EXCEPTION_MESSAGE)); + future.toCompletableFuture() + .completeExceptionally(new IOException(RetryConditionTest.SIMULATED_EXCEPTION_MESSAGE)); return future; } @@ -135,7 +135,8 @@ public CompletionStage serviceD() { if (countInvocationsServD < 3) { // fail 2 first invocations return CompletableFuture.supplyAsync(doTask(null), executor) - .thenCompose(s -> CompletableFuture.supplyAsync(doTask(RetryConditionTest.SIMULATED_EXCEPTION_MESSAGE), executor)); + .thenCompose(s -> CompletableFuture + .supplyAsync(doTask(RetryConditionTest.SIMULATED_EXCEPTION_MESSAGE), executor)); } else { return CompletableFuture.supplyAsync(doTask(null), executor) .thenCompose(s -> CompletableFuture.supplyAsync(doTask(null), executor)); @@ -155,7 +156,8 @@ public CompletionStage serviceE() { // always fail return CompletableFuture.supplyAsync(doTask(null), executor) - .thenCompose(s -> CompletableFuture.supplyAsync(doTask(RetryConditionTest.SIMULATED_EXCEPTION_MESSAGE), executor)); + .thenCompose(s -> CompletableFuture.supplyAsync(doTask(RetryConditionTest.SIMULATED_EXCEPTION_MESSAGE), + executor)); } /** @@ -172,7 +174,9 @@ public CompletionStage serviceF() { if (countInvocationsServF < 3) { // fail 2 first invocations return CompletableFuture.supplyAsync(doTask(null), executor) - .thenCombine(CompletableFuture.supplyAsync(doTask(RetryConditionTest.SIMULATED_EXCEPTION_MESSAGE), executor), + .thenCombine( + CompletableFuture.supplyAsync(doTask(RetryConditionTest.SIMULATED_EXCEPTION_MESSAGE), + executor), (s, s2) -> s + " then " + s2); } else { return CompletableFuture.supplyAsync(doTask(null), executor) @@ -194,7 +198,8 @@ public CompletionStage serviceG() { countInvocationsServG++; // always fail return CompletableFuture.supplyAsync(doTask(null), executor) - .thenCombine(CompletableFuture.supplyAsync(doTask(RetryConditionTest.SIMULATED_EXCEPTION_MESSAGE), executor), + .thenCombine( + CompletableFuture.supplyAsync(doTask(RetryConditionTest.SIMULATED_EXCEPTION_MESSAGE), executor), (s, s2) -> s + " then " + s2); } diff --git a/tck/src/main/java/org/eclipse/microprofile/fault/tolerance/tck/fallback/clientserver/FallbackClient.java b/tck/src/main/java/org/eclipse/microprofile/fault/tolerance/tck/fallback/clientserver/FallbackClient.java index c259ee70..01b6c737 100644 --- a/tck/src/main/java/org/eclipse/microprofile/fault/tolerance/tck/fallback/clientserver/FallbackClient.java +++ b/tck/src/main/java/org/eclipse/microprofile/fault/tolerance/tck/fallback/clientserver/FallbackClient.java @@ -19,10 +19,10 @@ *******************************************************************************/ package org.eclipse.microprofile.fault.tolerance.tck.fallback.clientserver; +import org.eclipse.microprofile.fault.tolerance.tck.util.TestException; import org.eclipse.microprofile.faulttolerance.Fallback; import org.eclipse.microprofile.faulttolerance.Retry; import org.eclipse.microprofile.faulttolerance.Timeout; -import org.eclipse.microprofile.fault.tolerance.tck.util.TestException; import jakarta.enterprise.context.RequestScoped; diff --git a/tck/src/main/java/org/eclipse/microprofile/fault/tolerance/tck/fallback/clientserver/FallbackOnlyClient.java b/tck/src/main/java/org/eclipse/microprofile/fault/tolerance/tck/fallback/clientserver/FallbackOnlyClient.java index 31a89df0..d5794e1a 100644 --- a/tck/src/main/java/org/eclipse/microprofile/fault/tolerance/tck/fallback/clientserver/FallbackOnlyClient.java +++ b/tck/src/main/java/org/eclipse/microprofile/fault/tolerance/tck/fallback/clientserver/FallbackOnlyClient.java @@ -19,8 +19,8 @@ *******************************************************************************/ package org.eclipse.microprofile.fault.tolerance.tck.fallback.clientserver; -import org.eclipse.microprofile.faulttolerance.Fallback; import org.eclipse.microprofile.fault.tolerance.tck.util.TestException; +import org.eclipse.microprofile.faulttolerance.Fallback; import jakarta.enterprise.context.RequestScoped; diff --git a/tck/src/main/java/org/eclipse/microprofile/fault/tolerance/tck/fallback/clientserver/FallbackWithBeanClient.java b/tck/src/main/java/org/eclipse/microprofile/fault/tolerance/tck/fallback/clientserver/FallbackWithBeanClient.java index 840e32aa..ce03b681 100644 --- a/tck/src/main/java/org/eclipse/microprofile/fault/tolerance/tck/fallback/clientserver/FallbackWithBeanClient.java +++ b/tck/src/main/java/org/eclipse/microprofile/fault/tolerance/tck/fallback/clientserver/FallbackWithBeanClient.java @@ -19,9 +19,9 @@ *******************************************************************************/ package org.eclipse.microprofile.fault.tolerance.tck.fallback.clientserver; +import org.eclipse.microprofile.fault.tolerance.tck.util.TestException; import org.eclipse.microprofile.faulttolerance.Fallback; import org.eclipse.microprofile.faulttolerance.Retry; -import org.eclipse.microprofile.fault.tolerance.tck.util.TestException; import jakarta.enterprise.context.RequestScoped; diff --git a/tck/src/main/java/org/eclipse/microprofile/fault/tolerance/tck/visibility/retry/BaseRetryOnClassAndMethodService.java b/tck/src/main/java/org/eclipse/microprofile/fault/tolerance/tck/visibility/retry/BaseRetryOnClassAndMethodService.java index 15f4ddec..6e2cdad9 100644 --- a/tck/src/main/java/org/eclipse/microprofile/fault/tolerance/tck/visibility/retry/BaseRetryOnClassAndMethodService.java +++ b/tck/src/main/java/org/eclipse/microprofile/fault/tolerance/tck/visibility/retry/BaseRetryOnClassAndMethodService.java @@ -21,8 +21,8 @@ import java.sql.Connection; -import org.eclipse.microprofile.faulttolerance.Retry; import org.eclipse.microprofile.fault.tolerance.tck.util.TestException; +import org.eclipse.microprofile.faulttolerance.Retry; import jakarta.enterprise.context.RequestScoped; diff --git a/tck/src/main/java/org/eclipse/microprofile/fault/tolerance/tck/visibility/retry/BaseRetryOnClassService.java b/tck/src/main/java/org/eclipse/microprofile/fault/tolerance/tck/visibility/retry/BaseRetryOnClassService.java index 6bcfd030..d1d027f7 100644 --- a/tck/src/main/java/org/eclipse/microprofile/fault/tolerance/tck/visibility/retry/BaseRetryOnClassService.java +++ b/tck/src/main/java/org/eclipse/microprofile/fault/tolerance/tck/visibility/retry/BaseRetryOnClassService.java @@ -21,8 +21,8 @@ import java.sql.Connection; -import org.eclipse.microprofile.faulttolerance.Retry; import org.eclipse.microprofile.fault.tolerance.tck.util.TestException; +import org.eclipse.microprofile.faulttolerance.Retry; import jakarta.enterprise.context.RequestScoped; diff --git a/tck/src/main/java/org/eclipse/microprofile/fault/tolerance/tck/visibility/retry/BaseRetryOnMethodService.java b/tck/src/main/java/org/eclipse/microprofile/fault/tolerance/tck/visibility/retry/BaseRetryOnMethodService.java index 38a57b59..52f41ebd 100644 --- a/tck/src/main/java/org/eclipse/microprofile/fault/tolerance/tck/visibility/retry/BaseRetryOnMethodService.java +++ b/tck/src/main/java/org/eclipse/microprofile/fault/tolerance/tck/visibility/retry/BaseRetryOnMethodService.java @@ -21,8 +21,8 @@ import java.sql.Connection; -import org.eclipse.microprofile.faulttolerance.Retry; import org.eclipse.microprofile.fault.tolerance.tck.util.TestException; +import org.eclipse.microprofile.faulttolerance.Retry; import jakarta.enterprise.context.RequestScoped; diff --git a/tck/src/main/java/org/eclipse/microprofile/fault/tolerance/tck/visibility/retry/RetryOnClassServiceNoAnnotationOnOveriddenMethod.java b/tck/src/main/java/org/eclipse/microprofile/fault/tolerance/tck/visibility/retry/RetryOnClassServiceNoAnnotationOnOveriddenMethod.java index 69b5ddad..bd62b20e 100644 --- a/tck/src/main/java/org/eclipse/microprofile/fault/tolerance/tck/visibility/retry/RetryOnClassServiceNoAnnotationOnOveriddenMethod.java +++ b/tck/src/main/java/org/eclipse/microprofile/fault/tolerance/tck/visibility/retry/RetryOnClassServiceNoAnnotationOnOveriddenMethod.java @@ -19,13 +19,10 @@ *******************************************************************************/ package org.eclipse.microprofile.fault.tolerance.tck.visibility.retry; -import java.io.IOException; import java.sql.Connection; import jakarta.enterprise.context.RequestScoped; -import org.eclipse.microprofile.fault.tolerance.tck.util.TestException; - @RequestScoped @RS(RetryServiceType.BASE_ROC_RETRY_MISSING_ON_METHOD) public class RetryOnClassServiceNoAnnotationOnOveriddenMethod extends BaseRetryOnClassService { diff --git a/tck/src/main/java/org/eclipse/microprofile/fault/tolerance/tck/visibility/retry/RetryOnClassServiceOverrideClassLevelMethodOverride.java b/tck/src/main/java/org/eclipse/microprofile/fault/tolerance/tck/visibility/retry/RetryOnClassServiceOverrideClassLevelMethodOverride.java index b952164a..5c17b75e 100644 --- a/tck/src/main/java/org/eclipse/microprofile/fault/tolerance/tck/visibility/retry/RetryOnClassServiceOverrideClassLevelMethodOverride.java +++ b/tck/src/main/java/org/eclipse/microprofile/fault/tolerance/tck/visibility/retry/RetryOnClassServiceOverrideClassLevelMethodOverride.java @@ -19,11 +19,9 @@ *******************************************************************************/ package org.eclipse.microprofile.fault.tolerance.tck.visibility.retry; -import java.io.IOException; import java.sql.Connection; import org.eclipse.microprofile.faulttolerance.Retry; -import org.eclipse.microprofile.fault.tolerance.tck.util.TestException; import jakarta.enterprise.context.RequestScoped; diff --git a/tck/src/main/java/org/eclipse/microprofile/fault/tolerance/tck/visibility/retry/RetryOnClassServiceOverrideMethodLevel.java b/tck/src/main/java/org/eclipse/microprofile/fault/tolerance/tck/visibility/retry/RetryOnClassServiceOverrideMethodLevel.java index 6894bef6..521f0731 100644 --- a/tck/src/main/java/org/eclipse/microprofile/fault/tolerance/tck/visibility/retry/RetryOnClassServiceOverrideMethodLevel.java +++ b/tck/src/main/java/org/eclipse/microprofile/fault/tolerance/tck/visibility/retry/RetryOnClassServiceOverrideMethodLevel.java @@ -19,11 +19,9 @@ *******************************************************************************/ package org.eclipse.microprofile.fault.tolerance.tck.visibility.retry; -import java.io.IOException; import java.sql.Connection; import org.eclipse.microprofile.faulttolerance.Retry; -import org.eclipse.microprofile.fault.tolerance.tck.util.TestException; import jakarta.enterprise.context.RequestScoped; diff --git a/tck/src/main/java/org/eclipse/microprofile/fault/tolerance/tck/visibility/retry/RetryOnMethodServiceNoAnnotationOnOverridedMethod.java b/tck/src/main/java/org/eclipse/microprofile/fault/tolerance/tck/visibility/retry/RetryOnMethodServiceNoAnnotationOnOverridedMethod.java index e7eaaa8b..ab7f8d1b 100644 --- a/tck/src/main/java/org/eclipse/microprofile/fault/tolerance/tck/visibility/retry/RetryOnMethodServiceNoAnnotationOnOverridedMethod.java +++ b/tck/src/main/java/org/eclipse/microprofile/fault/tolerance/tck/visibility/retry/RetryOnMethodServiceNoAnnotationOnOverridedMethod.java @@ -18,6 +18,7 @@ * limitations under the License. *******************************************************************************/ package org.eclipse.microprofile.fault.tolerance.tck.visibility.retry; + import java.sql.Connection; import jakarta.enterprise.context.RequestScoped;