From d6decca5e1bcbeea0b79a12bf1d180adfbb65c54 Mon Sep 17 00:00:00 2001 From: Miroslav Novak Date: Fri, 29 Nov 2024 11:22:44 +0100 Subject: [PATCH] [EAPQE-2697] Add test for MicroProfile LRA with Fault Tolerance --- .../fault/tolerance/CpuLoadTest.java | 2 +- .../fault/tolerance/DatabaseCrashTest.java | 2 +- .../MultipleFaultToleranceModuleEarTest.java | 2 +- .../tolerance/MultipleJarDeploymentTest.java | 2 +- .../fault/tolerance/UndeployDeployTest.java | 4 +- .../v10/MicroProfileFaultTolerance10Test.java | 2 +- .../v20/FaultTolerance20AsyncPartialTest.java | 2 +- .../v20/FaultTolerance20AsyncTest.java | 2 +- .../tolerance/v20/PriorityOrderTest.java | 2 +- microprofile-lra/pom.xml | 5 + .../qe/microprofile/lra/LRAParticipant.java | 5 + .../LRAParticipantWithFaultTolerance1.java | 199 +++++++++++++ .../LRAParticipantWithFaultTolerance2.java | 39 +++ .../microprofile/lra/EnableLRASetupTask.java | 52 +++- .../lra/FaultToleranceWithLRATest.java | 281 ++++++++++++++++++ .../FaultToleranceServerSetup.java | 4 +- ...fileFaultToleranceServerConfiguration.java | 2 +- .../MicroProfileTelemetryServerSetup.java | 2 +- 18 files changed, 579 insertions(+), 30 deletions(-) create mode 100644 microprofile-lra/src/main/java/org/jboss/eap/qe/microprofile/lra/LRAParticipantWithFaultTolerance1.java create mode 100644 microprofile-lra/src/main/java/org/jboss/eap/qe/microprofile/lra/LRAParticipantWithFaultTolerance2.java create mode 100644 microprofile-lra/src/test/java/org/jboss/eap/qe/microprofile/lra/FaultToleranceWithLRATest.java rename {microprofile-fault-tolerance/src/test/java/org/jboss/eap/qe/microprofile/fault/tolerance/util => tooling-server-configuration/src/main/java/org/jboss/eap/qe/microprofile/common/setuptasks}/FaultToleranceServerSetup.java (78%) rename {microprofile-fault-tolerance/src/test/java/org/jboss/eap/qe/microprofile/fault/tolerance/util => tooling-server-configuration/src/main/java/org/jboss/eap/qe/microprofile/common/setuptasks}/MicroProfileFaultToleranceServerConfiguration.java (98%) rename {microprofile-fault-tolerance/src/test/java/org/jboss/eap/qe/microprofile/fault/tolerance/util => tooling-server-configuration/src/main/java/org/jboss/eap/qe/microprofile/common/setuptasks}/MicroProfileTelemetryServerSetup.java (99%) diff --git a/microprofile-fault-tolerance/src/test/java/org/jboss/eap/qe/microprofile/fault/tolerance/CpuLoadTest.java b/microprofile-fault-tolerance/src/test/java/org/jboss/eap/qe/microprofile/fault/tolerance/CpuLoadTest.java index 18528eca..3ebe3ce5 100644 --- a/microprofile-fault-tolerance/src/test/java/org/jboss/eap/qe/microprofile/fault/tolerance/CpuLoadTest.java +++ b/microprofile-fault-tolerance/src/test/java/org/jboss/eap/qe/microprofile/fault/tolerance/CpuLoadTest.java @@ -14,8 +14,8 @@ import org.jboss.arquillian.container.test.api.RunAsClient; import org.jboss.arquillian.junit.Arquillian; import org.jboss.arquillian.test.api.ArquillianResource; +import org.jboss.eap.qe.microprofile.common.setuptasks.MicroProfileFaultToleranceServerConfiguration; import org.jboss.eap.qe.microprofile.fault.tolerance.deployments.load.LoadService; -import org.jboss.eap.qe.microprofile.fault.tolerance.util.MicroProfileFaultToleranceServerConfiguration; import org.jboss.eap.qe.microprofile.tooling.cpu.load.HighCPUUtils; import org.jboss.eap.qe.microprofile.tooling.cpu.load.utils.ProcessUtils; import org.jboss.eap.qe.microprofile.tooling.cpu.load.utils.ProcessUtilsProvider; diff --git a/microprofile-fault-tolerance/src/test/java/org/jboss/eap/qe/microprofile/fault/tolerance/DatabaseCrashTest.java b/microprofile-fault-tolerance/src/test/java/org/jboss/eap/qe/microprofile/fault/tolerance/DatabaseCrashTest.java index 2d8ab3be..58d761de 100644 --- a/microprofile-fault-tolerance/src/test/java/org/jboss/eap/qe/microprofile/fault/tolerance/DatabaseCrashTest.java +++ b/microprofile-fault-tolerance/src/test/java/org/jboss/eap/qe/microprofile/fault/tolerance/DatabaseCrashTest.java @@ -20,9 +20,9 @@ import org.jboss.arquillian.container.test.api.RunAsClient; import org.jboss.arquillian.junit.Arquillian; import org.jboss.arquillian.test.api.ArquillianResource; +import org.jboss.eap.qe.microprofile.common.setuptasks.MicroProfileFaultToleranceServerConfiguration; import org.jboss.eap.qe.microprofile.fault.tolerance.deployments.database.DatabaseService; import org.jboss.eap.qe.microprofile.fault.tolerance.deployments.database.DatabaseServlet; -import org.jboss.eap.qe.microprofile.fault.tolerance.util.MicroProfileFaultToleranceServerConfiguration; import org.jboss.eap.qe.microprofile.tooling.server.configuration.deployment.ConfigurationUtil; import org.jboss.eap.qe.ts.common.docker.Docker; import org.jboss.eap.qe.ts.common.docker.junit.DockerRequiredTests; diff --git a/microprofile-fault-tolerance/src/test/java/org/jboss/eap/qe/microprofile/fault/tolerance/MultipleFaultToleranceModuleEarTest.java b/microprofile-fault-tolerance/src/test/java/org/jboss/eap/qe/microprofile/fault/tolerance/MultipleFaultToleranceModuleEarTest.java index fb78182c..45a2e970 100644 --- a/microprofile-fault-tolerance/src/test/java/org/jboss/eap/qe/microprofile/fault/tolerance/MultipleFaultToleranceModuleEarTest.java +++ b/microprofile-fault-tolerance/src/test/java/org/jboss/eap/qe/microprofile/fault/tolerance/MultipleFaultToleranceModuleEarTest.java @@ -10,11 +10,11 @@ import org.jboss.arquillian.container.test.api.RunAsClient; import org.jboss.arquillian.junit.Arquillian; import org.jboss.arquillian.test.api.ArquillianResource; +import org.jboss.eap.qe.microprofile.common.setuptasks.MicroProfileFaultToleranceServerConfiguration; import org.jboss.eap.qe.microprofile.fault.tolerance.deployments.v10.HelloFallback; import org.jboss.eap.qe.microprofile.fault.tolerance.deployments.v10.HelloService; import org.jboss.eap.qe.microprofile.fault.tolerance.deployments.v10.HelloServlet; import org.jboss.eap.qe.microprofile.fault.tolerance.deployments.v10.MyContext; -import org.jboss.eap.qe.microprofile.fault.tolerance.util.MicroProfileFaultToleranceServerConfiguration; import org.jboss.eap.qe.microprofile.tooling.server.configuration.ConfigurationException; import org.jboss.eap.qe.microprofile.tooling.server.configuration.arquillian.ArquillianContainerProperties; import org.jboss.eap.qe.microprofile.tooling.server.configuration.arquillian.ArquillianDescriptorWrapper; diff --git a/microprofile-fault-tolerance/src/test/java/org/jboss/eap/qe/microprofile/fault/tolerance/MultipleJarDeploymentTest.java b/microprofile-fault-tolerance/src/test/java/org/jboss/eap/qe/microprofile/fault/tolerance/MultipleJarDeploymentTest.java index 8782bb28..07083c35 100644 --- a/microprofile-fault-tolerance/src/test/java/org/jboss/eap/qe/microprofile/fault/tolerance/MultipleJarDeploymentTest.java +++ b/microprofile-fault-tolerance/src/test/java/org/jboss/eap/qe/microprofile/fault/tolerance/MultipleJarDeploymentTest.java @@ -10,10 +10,10 @@ import org.jboss.arquillian.container.test.api.OperateOnDeployment; import org.jboss.arquillian.junit.Arquillian; import org.jboss.as.arquillian.api.ServerSetup; +import org.jboss.eap.qe.microprofile.common.setuptasks.FaultToleranceServerSetup; import org.jboss.eap.qe.microprofile.fault.tolerance.deployments.v10.HelloFallback; import org.jboss.eap.qe.microprofile.fault.tolerance.deployments.v10.HelloService; import org.jboss.eap.qe.microprofile.fault.tolerance.deployments.v10.MyContext; -import org.jboss.eap.qe.microprofile.fault.tolerance.util.FaultToleranceServerSetup; import org.jboss.eap.qe.microprofile.tooling.server.configuration.deployment.ConfigurationUtil; import org.jboss.eap.qe.microprofile.tooling.server.log.LogChecker; import org.jboss.shrinkwrap.api.Archive; diff --git a/microprofile-fault-tolerance/src/test/java/org/jboss/eap/qe/microprofile/fault/tolerance/UndeployDeployTest.java b/microprofile-fault-tolerance/src/test/java/org/jboss/eap/qe/microprofile/fault/tolerance/UndeployDeployTest.java index 121b983a..80ed0992 100644 --- a/microprofile-fault-tolerance/src/test/java/org/jboss/eap/qe/microprofile/fault/tolerance/UndeployDeployTest.java +++ b/microprofile-fault-tolerance/src/test/java/org/jboss/eap/qe/microprofile/fault/tolerance/UndeployDeployTest.java @@ -14,9 +14,9 @@ import org.jboss.arquillian.junit.Arquillian; import org.jboss.arquillian.junit.InSequence; import org.jboss.arquillian.test.api.ArquillianResource; +import org.jboss.eap.qe.microprofile.common.setuptasks.MicroProfileFaultToleranceServerConfiguration; +import org.jboss.eap.qe.microprofile.common.setuptasks.MicroProfileTelemetryServerSetup; import org.jboss.eap.qe.microprofile.fault.tolerance.deployments.v10.HelloService; -import org.jboss.eap.qe.microprofile.fault.tolerance.util.MicroProfileFaultToleranceServerConfiguration; -import org.jboss.eap.qe.microprofile.fault.tolerance.util.MicroProfileTelemetryServerSetup; import org.jboss.eap.qe.microprofile.tooling.server.configuration.creaper.ManagementClientProvider; import org.jboss.eap.qe.microprofile.tooling.server.configuration.deployment.ConfigurationUtil; import org.jboss.eap.qe.microprofile.tooling.server.log.LogChecker; diff --git a/microprofile-fault-tolerance/src/test/java/org/jboss/eap/qe/microprofile/fault/tolerance/v10/MicroProfileFaultTolerance10Test.java b/microprofile-fault-tolerance/src/test/java/org/jboss/eap/qe/microprofile/fault/tolerance/v10/MicroProfileFaultTolerance10Test.java index ea7fe84a..cf71b412 100644 --- a/microprofile-fault-tolerance/src/test/java/org/jboss/eap/qe/microprofile/fault/tolerance/v10/MicroProfileFaultTolerance10Test.java +++ b/microprofile-fault-tolerance/src/test/java/org/jboss/eap/qe/microprofile/fault/tolerance/v10/MicroProfileFaultTolerance10Test.java @@ -27,8 +27,8 @@ import org.jboss.arquillian.container.test.api.RunAsClient; import org.jboss.arquillian.junit.Arquillian; import org.jboss.arquillian.test.api.ArquillianResource; +import org.jboss.eap.qe.microprofile.common.setuptasks.MicroProfileFaultToleranceServerConfiguration; import org.jboss.eap.qe.microprofile.fault.tolerance.deployments.v10.HelloService; -import org.jboss.eap.qe.microprofile.fault.tolerance.util.MicroProfileFaultToleranceServerConfiguration; import org.jboss.eap.qe.microprofile.tooling.server.configuration.creaper.ManagementClientProvider; import org.jboss.eap.qe.microprofile.tooling.server.configuration.deployment.ConfigurationUtil; import org.jboss.shrinkwrap.api.Archive; diff --git a/microprofile-fault-tolerance/src/test/java/org/jboss/eap/qe/microprofile/fault/tolerance/v20/FaultTolerance20AsyncPartialTest.java b/microprofile-fault-tolerance/src/test/java/org/jboss/eap/qe/microprofile/fault/tolerance/v20/FaultTolerance20AsyncPartialTest.java index a41f691f..745ed2c9 100644 --- a/microprofile-fault-tolerance/src/test/java/org/jboss/eap/qe/microprofile/fault/tolerance/v20/FaultTolerance20AsyncPartialTest.java +++ b/microprofile-fault-tolerance/src/test/java/org/jboss/eap/qe/microprofile/fault/tolerance/v20/FaultTolerance20AsyncPartialTest.java @@ -24,8 +24,8 @@ import org.jboss.arquillian.container.test.api.RunAsClient; import org.jboss.arquillian.junit.Arquillian; import org.jboss.arquillian.test.api.ArquillianResource; +import org.jboss.eap.qe.microprofile.common.setuptasks.MicroProfileFaultToleranceServerConfiguration; import org.jboss.eap.qe.microprofile.fault.tolerance.deployments.v20.AsyncHelloService; -import org.jboss.eap.qe.microprofile.fault.tolerance.util.MicroProfileFaultToleranceServerConfiguration; import org.jboss.eap.qe.microprofile.tooling.server.configuration.deployment.ConfigurationUtil; import org.jboss.shrinkwrap.api.Archive; import org.jboss.shrinkwrap.api.ShrinkWrap; diff --git a/microprofile-fault-tolerance/src/test/java/org/jboss/eap/qe/microprofile/fault/tolerance/v20/FaultTolerance20AsyncTest.java b/microprofile-fault-tolerance/src/test/java/org/jboss/eap/qe/microprofile/fault/tolerance/v20/FaultTolerance20AsyncTest.java index 9b99b512..df3ff899 100644 --- a/microprofile-fault-tolerance/src/test/java/org/jboss/eap/qe/microprofile/fault/tolerance/v20/FaultTolerance20AsyncTest.java +++ b/microprofile-fault-tolerance/src/test/java/org/jboss/eap/qe/microprofile/fault/tolerance/v20/FaultTolerance20AsyncTest.java @@ -26,8 +26,8 @@ import org.jboss.arquillian.container.test.api.RunAsClient; import org.jboss.arquillian.junit.Arquillian; import org.jboss.arquillian.test.api.ArquillianResource; +import org.jboss.eap.qe.microprofile.common.setuptasks.MicroProfileFaultToleranceServerConfiguration; import org.jboss.eap.qe.microprofile.fault.tolerance.deployments.v20.AsyncHelloService; -import org.jboss.eap.qe.microprofile.fault.tolerance.util.MicroProfileFaultToleranceServerConfiguration; import org.jboss.eap.qe.microprofile.tooling.server.configuration.deployment.ConfigurationUtil; import org.jboss.shrinkwrap.api.Archive; import org.jboss.shrinkwrap.api.ShrinkWrap; diff --git a/microprofile-fault-tolerance/src/test/java/org/jboss/eap/qe/microprofile/fault/tolerance/v20/PriorityOrderTest.java b/microprofile-fault-tolerance/src/test/java/org/jboss/eap/qe/microprofile/fault/tolerance/v20/PriorityOrderTest.java index 7f7aba55..8b638499 100644 --- a/microprofile-fault-tolerance/src/test/java/org/jboss/eap/qe/microprofile/fault/tolerance/v20/PriorityOrderTest.java +++ b/microprofile-fault-tolerance/src/test/java/org/jboss/eap/qe/microprofile/fault/tolerance/v20/PriorityOrderTest.java @@ -14,12 +14,12 @@ import org.jboss.arquillian.container.test.api.RunAsClient; import org.jboss.arquillian.junit.Arquillian; import org.jboss.arquillian.test.api.ArquillianResource; +import org.jboss.eap.qe.microprofile.common.setuptasks.MicroProfileFaultToleranceServerConfiguration; import org.jboss.eap.qe.microprofile.fault.tolerance.deployments.v20.AsyncHelloService; import org.jboss.eap.qe.microprofile.fault.tolerance.deployments.v20.PriorityServlet; import org.jboss.eap.qe.microprofile.fault.tolerance.deployments.v20.priority.AfterInterceptor; import org.jboss.eap.qe.microprofile.fault.tolerance.deployments.v20.priority.BeforeInterceptor; import org.jboss.eap.qe.microprofile.fault.tolerance.deployments.v20.priority.InterceptorsContext; -import org.jboss.eap.qe.microprofile.fault.tolerance.util.MicroProfileFaultToleranceServerConfiguration; import org.jboss.eap.qe.microprofile.tooling.server.configuration.deployment.ConfigurationUtil; import org.jboss.shrinkwrap.api.Archive; import org.jboss.shrinkwrap.api.ShrinkWrap; diff --git a/microprofile-lra/pom.xml b/microprofile-lra/pom.xml index 2285c367..5face1b5 100644 --- a/microprofile-lra/pom.xml +++ b/microprofile-lra/pom.xml @@ -71,6 +71,10 @@ org.wildfly.core wildfly-controller + + org.eclipse.microprofile.fault-tolerance + microprofile-fault-tolerance-api + @@ -141,6 +145,7 @@ cloud-server microprofile-lra-coordinator microprofile-lra-participant + microprofile-fault-tolerance diff --git a/microprofile-lra/src/main/java/org/jboss/eap/qe/microprofile/lra/LRAParticipant.java b/microprofile-lra/src/main/java/org/jboss/eap/qe/microprofile/lra/LRAParticipant.java index a8b52a0d..e8ffbd11 100644 --- a/microprofile-lra/src/main/java/org/jboss/eap/qe/microprofile/lra/LRAParticipant.java +++ b/microprofile-lra/src/main/java/org/jboss/eap/qe/microprofile/lra/LRAParticipant.java @@ -13,9 +13,12 @@ import org.eclipse.microprofile.lra.annotation.Complete; import org.eclipse.microprofile.lra.annotation.ws.rs.LRA; import org.jboss.eap.qe.microprofile.lra.model.LRAResult; +import org.jboss.logging.Logger; public class LRAParticipant { + private static final Logger LOGGER = Logger.getLogger(LRAParticipant.class); + public static final String RESULT_PATH = "/result"; public static final String RESET_PATH = "/reset"; @@ -26,6 +29,7 @@ public class LRAParticipant { @Path("/compensate") public Response compensate(@HeaderParam(LRA.LRA_HTTP_CONTEXT_HEADER) URI lraId, @HeaderParam(LRA.LRA_HTTP_RECOVERY_HEADER) URI recoveryId) { + LOGGER.infof("Compensating action for participant (%s) in LRA %s.", recoveryId, lraId); lraResult.setCompleted(false); lraResult.setFinishLraId(lraId); lraResult.setFinishRecoveryId(recoveryId); @@ -37,6 +41,7 @@ public Response compensate(@HeaderParam(LRA.LRA_HTTP_CONTEXT_HEADER) URI lraId, @Path("/complete") public Response complete(@HeaderParam(LRA.LRA_HTTP_CONTEXT_HEADER) URI lraId, @HeaderParam(LRA.LRA_HTTP_RECOVERY_HEADER) URI recoveryId) { + LOGGER.infof("Complete action for participant (%s) in LRA %s.", recoveryId, lraId); lraResult.setCompleted(true); lraResult.setFinishLraId(lraId); lraResult.setFinishRecoveryId(recoveryId); diff --git a/microprofile-lra/src/main/java/org/jboss/eap/qe/microprofile/lra/LRAParticipantWithFaultTolerance1.java b/microprofile-lra/src/main/java/org/jboss/eap/qe/microprofile/lra/LRAParticipantWithFaultTolerance1.java new file mode 100644 index 00000000..b9c33075 --- /dev/null +++ b/microprofile-lra/src/main/java/org/jboss/eap/qe/microprofile/lra/LRAParticipantWithFaultTolerance1.java @@ -0,0 +1,199 @@ +package org.jboss.eap.qe.microprofile.lra; + +import static org.jboss.eap.qe.microprofile.lra.LRAParticipantWithFaultTolerance1.PATH; + +import jakarta.enterprise.context.ApplicationScoped; +import jakarta.ws.rs.GET; +import jakarta.ws.rs.HeaderParam; +import jakarta.ws.rs.Path; +import jakarta.ws.rs.Produces; +import jakarta.ws.rs.QueryParam; +import jakarta.ws.rs.client.Client; +import jakarta.ws.rs.client.ClientBuilder; +import jakarta.ws.rs.core.Context; +import jakarta.ws.rs.core.MediaType; +import jakarta.ws.rs.core.Response; +import jakarta.ws.rs.core.UriInfo; + +import java.net.URI; +import java.time.Duration; +import java.util.concurrent.atomic.AtomicInteger; + +import org.eclipse.microprofile.faulttolerance.CircuitBreaker; +import org.eclipse.microprofile.faulttolerance.Fallback; +import org.eclipse.microprofile.faulttolerance.Retry; +import org.eclipse.microprofile.faulttolerance.Timeout; +import org.eclipse.microprofile.lra.annotation.ws.rs.LRA; +import org.jboss.logging.Logger; + +@Path(PATH) +@ApplicationScoped +@Produces(MediaType.APPLICATION_JSON) +public class LRAParticipantWithFaultTolerance1 extends LRAParticipant { + + private static final Logger LOGGER = Logger.getLogger(LRAParticipantWithFaultTolerance1.class); + + public static final String PATH = "lra-participant-with-fault-tolerance-1"; + public static final String RETRY_PATH = "work-with-retry"; + public static final String TIMEOUT_PATH = "work-with-timeout"; + public static final String RETRY_COUNT_PATH = "retry-count"; + public static final String FAIL_LRA = "fail-lra"; + public static final String RESET_COUNTER_PATH = "reset-counter"; + public static final String CIRCUIT_BREAKER_PATH = "work-with-circuit-breaker"; + public static final String FALLBACK_PATH = "work-with-fallback"; + + private final AtomicInteger retryCount = new AtomicInteger(0); + + @Context + UriInfo uriInfo; + + @LRA(value = LRA.Type.REQUIRED) + @GET + @Path(RETRY_PATH) + @Retry(maxRetries = 3, delay = 100) + public Response workWithRetry(@HeaderParam(LRA.LRA_HTTP_CONTEXT_HEADER) URI lraId, + @HeaderParam(LRA.LRA_HTTP_RECOVERY_HEADER) URI recoveryId, + @QueryParam(LRAParticipantWithFaultTolerance1.FAIL_LRA) boolean failLRA) throws Exception { + + LOGGER.infof("Executing action of LRAParticipantWithFaultTolerance1 enlisted in LRA %s " + + "that was assigned %s participant Id. Retried: %s", lraId, recoveryId, retryCount.incrementAndGet()); + + // check lraId and recoveryId is consistent across retries otherwise return response to fail the test + if (retryCount.get() > 1 && !lraId.equals(lraResult.getLraId())) { + return Response.status(Response.Status.INTERNAL_SERVER_ERROR) + .entity("Wrong lraId across retries. Expected " + lraResult.getLraId() + " but got " + lraId).build(); + } + + if (retryCount.get() > 1 && !recoveryId.equals(lraResult.getRecoveryId())) { + return Response.status(Response.Status.INTERNAL_SERVER_ERROR) + .entity("Wrong recoveryId across retries. Expected " + lraResult.getRecoveryId() + " but got " + recoveryId) + .build(); + } + + lraResult.setLraId(lraId); + lraResult.setRecoveryId(recoveryId); + + // call Participant 2 to propagate the LRA + try (Client client = ClientBuilder.newClient()) { + client.target(uriInfo.getBaseUri() + "/" + LRAParticipantWithFaultTolerance2.PATH) + .request().get(); + } + + if (failLRA) { + throw new Exception("Throwing exception to fail participant until maxRetry is reached."); + } + + return Response.ok("Method with @Retry ended successfully.").build(); + } + + @LRA(value = LRA.Type.REQUIRED) + @GET + @Path(TIMEOUT_PATH) + @Timeout(1000) + public Response workWithRetry(@HeaderParam(LRA.LRA_HTTP_CONTEXT_HEADER) URI lraId, + @HeaderParam(LRA.LRA_HTTP_RECOVERY_HEADER) URI recoveryId) throws Exception { + + LOGGER.infof("Executing action of LRAParticipantWithFaultTolerance1 enlisted in LRA %s " + + "that was assigned %s participant Id. Retried: %s", lraId, recoveryId, retryCount.incrementAndGet()); + + lraResult.setLraId(lraId); + lraResult.setRecoveryId(recoveryId); + + // call Participant 2 to propagate the LRA + try (Client client = ClientBuilder.newClient()) { + client.target(uriInfo.getBaseUri() + "/" + LRAParticipantWithFaultTolerance2.PATH) + .request().get(); + } + + // Cause timeout of this method so exception is thrown and LRA is compensated + Thread.sleep(Duration.ofSeconds(10).toMillis()); + + return Response.ok("Method with @Timeout ended successfully.").build(); + } + + /** + * If 2 or more calls from last 10 calls fail then circuit is open. + * If circuit is open and 1 call is successful (after 1000 ms) delay then circuit is closed again. + */ + @LRA(value = LRA.Type.REQUIRED) + @GET + @Path(CIRCUIT_BREAKER_PATH) + @CircuitBreaker(requestVolumeThreshold = 10, failureRatio = 0.2, delay = 1000, successThreshold = 10) + public Response workWithCircuitBreaker(@HeaderParam(LRA.LRA_HTTP_CONTEXT_HEADER) URI lraId, + @HeaderParam(LRA.LRA_HTTP_RECOVERY_HEADER) URI recoveryId, + @QueryParam(LRAParticipantWithFaultTolerance1.FAIL_LRA) boolean failLRA) throws Exception { + LOGGER.infof("Executing action of LRAParticipantWithFaultTolerance1 enlisted in LRA %s " + + "that was assigned %s participant Id. Retried: %s", lraId, recoveryId, retryCount.incrementAndGet()); + + lraResult.setLraId(lraId); + lraResult.setRecoveryId(recoveryId); + + // call Participant 2 to propagate the LRA + try (Client client = ClientBuilder.newClient()) { + client.target(uriInfo.getBaseUri() + "/" + LRAParticipantWithFaultTolerance2.PATH) + .request().get(); + } + + if (failLRA) { + throw new Exception("Throwing exception to fail participant until circuit is open."); + } + + return Response.ok("Method with @CircuitBreaker ended successfully.").build(); + } + + @LRA(value = LRA.Type.REQUIRED) + @GET + @Path(FALLBACK_PATH) + @Fallback(fallbackMethod = "fallback") + public Response workWithFallback(@HeaderParam(LRA.LRA_HTTP_CONTEXT_HEADER) URI lraId, + @HeaderParam(LRA.LRA_HTTP_RECOVERY_HEADER) URI recoveryId, + @QueryParam(LRAParticipantWithFaultTolerance1.FAIL_LRA) boolean failLRA) throws Exception { + + LOGGER.infof("Executing action of LRAParticipantWithFaultTolerance1 enlisted in LRA %s " + + "that was assigned %s participant Id. Retried: %s", lraId, recoveryId, retryCount.incrementAndGet()); + + lraResult.setLraId(lraId); + lraResult.setRecoveryId(recoveryId); + + // call Participant 2 to propagate the LRA + try (Client client = ClientBuilder.newClient()) { + client.target(uriInfo.getBaseUri() + "/" + LRAParticipantWithFaultTolerance2.PATH) + .request().get(); + } + if (failLRA) { + throw new Exception("Throwing exception to fail participant so fallback method is called."); + } + return Response.ok("Method ended successfully without calling method in @Fallback.").build(); + } + + public Response fallback(@HeaderParam(LRA.LRA_HTTP_CONTEXT_HEADER) URI lraId, + @HeaderParam(LRA.LRA_HTTP_RECOVERY_HEADER) URI recoveryId, + @QueryParam(LRAParticipantWithFaultTolerance1.FAIL_LRA) boolean failLRA) { + // check lraId and recoveryId is the same + if (!lraId.equals(lraResult.getLraId())) { + return Response.status(Response.Status.INTERNAL_SERVER_ERROR) + .entity("Wrong lraId across retries. Expected " + lraResult.getLraId() + " but got " + lraId).build(); + } + + if (!recoveryId.equals(lraResult.getRecoveryId())) { + return Response.status(Response.Status.INTERNAL_SERVER_ERROR) + .entity("Wrong recoveryId across retries. Expected " + lraResult.getRecoveryId() + " but got " + recoveryId) + .build(); + } + lraResult.setLraId(lraId); + lraResult.setRecoveryId(recoveryId); + return Response.ok("Method defined in @Fallback ended successfully.").build(); + } + + @GET + @Path(RETRY_COUNT_PATH) + public int getRetryCount() { + return retryCount.get(); + } + + @GET + @Path(RESET_COUNTER_PATH) + public void resetCounter() { + retryCount.set(0); + } +} diff --git a/microprofile-lra/src/main/java/org/jboss/eap/qe/microprofile/lra/LRAParticipantWithFaultTolerance2.java b/microprofile-lra/src/main/java/org/jboss/eap/qe/microprofile/lra/LRAParticipantWithFaultTolerance2.java new file mode 100644 index 00000000..e9d3a959 --- /dev/null +++ b/microprofile-lra/src/main/java/org/jboss/eap/qe/microprofile/lra/LRAParticipantWithFaultTolerance2.java @@ -0,0 +1,39 @@ +package org.jboss.eap.qe.microprofile.lra; + +import static org.jboss.eap.qe.microprofile.lra.LRAParticipantWithFaultTolerance2.PATH; + +import jakarta.enterprise.context.ApplicationScoped; +import jakarta.ws.rs.GET; +import jakarta.ws.rs.HeaderParam; +import jakarta.ws.rs.Path; +import jakarta.ws.rs.Produces; +import jakarta.ws.rs.core.MediaType; +import jakarta.ws.rs.core.Response; + +import java.net.URI; + +import org.eclipse.microprofile.lra.annotation.ws.rs.LRA; +import org.jboss.logging.Logger; + +@Path(PATH) +@ApplicationScoped +@Produces(MediaType.APPLICATION_JSON) +public class LRAParticipantWithFaultTolerance2 extends LRAParticipant { + + private static final Logger LOGGER = Logger.getLogger(LRAParticipantWithFaultTolerance2.class); + + public static final String PATH = "lra-participant-with-fault-tolerance-2"; + + @LRA(value = LRA.Type.MANDATORY, end = false) + @GET + public Response doLRA(@HeaderParam(LRA.LRA_HTTP_CONTEXT_HEADER) URI lraId, + @HeaderParam(LRA.LRA_HTTP_RECOVERY_HEADER) URI recoveryId) { + LOGGER.infof("Executing action of Participant 2 enlisted in LRA %s " + + "that was assigned %s participant Id.", lraId, recoveryId); + + lraResult.setLraId(lraId); + lraResult.setRecoveryId(recoveryId); + + return Response.ok().build(); + } +} diff --git a/microprofile-lra/src/test/java/org/jboss/eap/qe/microprofile/lra/EnableLRASetupTask.java b/microprofile-lra/src/test/java/org/jboss/eap/qe/microprofile/lra/EnableLRASetupTask.java index 26c5b287..c3838b84 100644 --- a/microprofile-lra/src/test/java/org/jboss/eap/qe/microprofile/lra/EnableLRASetupTask.java +++ b/microprofile-lra/src/test/java/org/jboss/eap/qe/microprofile/lra/EnableLRASetupTask.java @@ -3,6 +3,8 @@ import org.jboss.eap.qe.microprofile.tooling.server.configuration.arquillian.MicroProfileServerSetupTask; import org.jboss.eap.qe.microprofile.tooling.server.configuration.creaper.ManagementClientProvider; import org.wildfly.extras.creaper.core.online.OnlineManagementClient; +import org.wildfly.extras.creaper.core.online.operations.Address; +import org.wildfly.extras.creaper.core.online.operations.Operations; import org.wildfly.extras.creaper.core.online.operations.admin.Administration; /** @@ -18,14 +20,23 @@ public class EnableLRASetupTask implements MicroProfileServerSetupTask { @Override public void setup() throws Exception { try (OnlineManagementClient client = ManagementClientProvider.onlineStandalone()) { - client.execute(String.format("/extension=%s:add", EXTENSION_LRA_COORDINATOR)) - .assertSuccess(); - client.execute(String.format("/subsystem=%s:add", SUBSYSTEM_LRA_COORDINATOR)) - .assertSuccess(); - client.execute(String.format("/extension=%s:add", EXTENSION_LRA_PARTICIPANT)) - .assertSuccess(); - client.execute(String.format("/subsystem=%s:add", SUBSYSTEM_LRA_PARTICIPANT)) - .assertSuccess(); + final Operations ops = new Operations(client); + if (!ops.exists(Address.extension(EXTENSION_LRA_COORDINATOR))) { + client.execute(String.format("/extension=%s:add", EXTENSION_LRA_COORDINATOR)) + .assertSuccess(); + } + if (!ops.exists(Address.subsystem(SUBSYSTEM_LRA_COORDINATOR))) { + client.execute(String.format("/subsystem=%s:add", SUBSYSTEM_LRA_COORDINATOR)) + .assertSuccess(); + } + if (!ops.exists(Address.extension(EXTENSION_LRA_PARTICIPANT))) { + client.execute(String.format("/extension=%s:add", EXTENSION_LRA_PARTICIPANT)) + .assertSuccess(); + } + if (!ops.exists(Address.subsystem(SUBSYSTEM_LRA_PARTICIPANT))) { + client.execute(String.format("/subsystem=%s:add", SUBSYSTEM_LRA_PARTICIPANT)) + .assertSuccess(); + } new Administration(client).reload(); } } @@ -33,14 +44,23 @@ public void setup() throws Exception { @Override public void tearDown() throws Exception { try (OnlineManagementClient client = ManagementClientProvider.onlineStandalone()) { - client.execute(String.format("/subsystem=%s:remove", SUBSYSTEM_LRA_PARTICIPANT)) - .assertSuccess(); - client.execute(String.format("/extension=%s:remove", EXTENSION_LRA_PARTICIPANT)) - .assertSuccess(); - client.execute(String.format("/subsystem=%s:remove", SUBSYSTEM_LRA_COORDINATOR)) - .assertSuccess(); - client.execute(String.format("/extension=%s:remove", EXTENSION_LRA_COORDINATOR)) - .assertSuccess(); + final Operations ops = new Operations(client); + if (ops.exists(Address.subsystem(SUBSYSTEM_LRA_PARTICIPANT))) { + client.execute(String.format("/subsystem=%s:remove", SUBSYSTEM_LRA_PARTICIPANT)) + .assertSuccess(); + } + if (ops.exists(Address.extension(EXTENSION_LRA_PARTICIPANT))) { + client.execute(String.format("/extension=%s:remove", EXTENSION_LRA_PARTICIPANT)) + .assertSuccess(); + } + if (ops.exists(Address.subsystem(SUBSYSTEM_LRA_COORDINATOR))) { + client.execute(String.format("/subsystem=%s:remove", SUBSYSTEM_LRA_COORDINATOR)) + .assertSuccess(); + } + if (ops.exists(Address.extension(EXTENSION_LRA_COORDINATOR))) { + client.execute(String.format("/extension=%s:remove", EXTENSION_LRA_COORDINATOR)) + .assertSuccess(); + } new Administration(client).reload(); } } diff --git a/microprofile-lra/src/test/java/org/jboss/eap/qe/microprofile/lra/FaultToleranceWithLRATest.java b/microprofile-lra/src/test/java/org/jboss/eap/qe/microprofile/lra/FaultToleranceWithLRATest.java new file mode 100644 index 00000000..3ee34ea0 --- /dev/null +++ b/microprofile-lra/src/test/java/org/jboss/eap/qe/microprofile/lra/FaultToleranceWithLRATest.java @@ -0,0 +1,281 @@ +package org.jboss.eap.qe.microprofile.lra; + +import static io.restassured.RestAssured.get; +import static io.restassured.RestAssured.given; +import static org.hamcrest.Matchers.containsString; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; + +import jakarta.ws.rs.core.Response; + +import java.net.URL; +import java.time.Duration; +import java.util.Arrays; + +import org.jboss.arquillian.container.test.api.Deployment; +import org.jboss.arquillian.junit.Arquillian; +import org.jboss.arquillian.test.api.ArquillianResource; +import org.jboss.as.arquillian.api.ServerSetup; +import org.jboss.as.arquillian.api.ServerSetupTask; +import org.jboss.eap.qe.microprofile.common.setuptasks.FaultToleranceServerSetup; +import org.jboss.eap.qe.microprofile.lra.model.LRAResult; +import org.jboss.eap.qe.microprofile.tooling.server.configuration.arquillian.MicroProfileServerSetupTask; +import org.jboss.eap.qe.microprofile.tooling.server.configuration.deployment.ConfigurationUtil; +import org.jboss.shrinkwrap.api.Archive; +import org.jboss.shrinkwrap.api.ShrinkWrap; +import org.jboss.shrinkwrap.api.spec.WebArchive; +import org.junit.Assert; +import org.junit.Before; +import org.junit.Test; +import org.junit.runner.RunWith; + +/** + * Tests fault tolerance behavior with Long Running Actions (LRA). + */ +@RunWith(Arquillian.class) +@ServerSetup({ EnableLRASetupTask.class, FaultToleranceServerSetup.class }) +public class FaultToleranceWithLRATest { + + public static final String DEPLOYMENT_NAME = "microprofile-lra"; + + @ArquillianResource() + private URL baseApplicationUrl; + + @Deployment(testable = false) + public static Archive deployment() { + return ShrinkWrap.create(WebArchive.class, DEPLOYMENT_NAME + ".war") + .addPackages(true, LRAParticipantWithFaultTolerance1.class.getPackage()) + .addClasses(EnableLRASetupTask.class, MicroProfileServerSetupTask.class, ServerSetupTask.class) + .addAsWebInfResource(ConfigurationUtil.BEANS_XML_FILE_LOCATION, "beans.xml"); + } + + @Before + public void before() { + resetCounter(); + resetParticipantResult(LRAParticipantWithFaultTolerance1.PATH); + resetParticipantResult(LRAParticipantWithFaultTolerance2.PATH); + } + + /** + * Scenario: Tests the LRA with a retry mechanism in case of transient failures. Apply @Retry on a method that starts an LRA + * transaction. + * Simulate a failure in the method and verify that the method is retried within the context of the same LRA until the retry + * limit is reached. + * Test Steps: + * Start an LRA and invoke a participant method annotated with @Retry. + * Force the method to fail a configurable number of times (through exception). + * Ensure the method is retried up to the maximum number of attempts. + * Verify that the LRA context is maintained across retries. + * Verify the final state of the LRA: should fail after all retries fail. + */ + @Test + public void testMaxRetryFailWithLRA() { + // call participant with retry logic, it will retry until it fails (max retry reached) + given() + .queryParam(LRAParticipantWithFaultTolerance1.FAIL_LRA, true) + .when() + .get(getURL(LRAParticipantWithFaultTolerance1.PATH, LRAParticipantWithFaultTolerance1.RETRY_PATH)) + .then() + .statusCode(Response.Status.INTERNAL_SERVER_ERROR.getStatusCode()) + .body(containsString("Throwing exception to fail participant until maxRetry is reached")); + + // check that retry is higher than 1 + int numberOfRetries = Integer + .parseInt( + get(getURL(LRAParticipantWithFaultTolerance1.PATH, LRAParticipantWithFaultTolerance1.RETRY_COUNT_PATH)) + .body().print()); + Assert.assertTrue("Number of retries must be higher than 1 but it's " + numberOfRetries, numberOfRetries > 1); + + // check tx was compensated + verifyResult(getParticipantResult(LRAParticipantWithFaultTolerance1.PATH), false); + verifyResult(getParticipantResult(LRAParticipantWithFaultTolerance2.PATH), false); + } + + /** + * Scenario: Tests the LRA with a retry mechanism in case of transient failures. Apply @Retry on a method that starts an LRA + * transaction. + * Do NOT simulate a failure in the method and verify that the method finished successfully. + * Test Steps: + * Start an LRA and invoke a participant method annotated with @Retry without causing any failure. + * Verify the final state of the LRA: it should be completed successfully. + */ + @Test + public void testRetryWithLRA() { + // call participant with retry logic, however it will not fail on max retry + given() + .queryParam(LRAParticipantWithFaultTolerance1.FAIL_LRA, false) + .when() + .get(getURL(LRAParticipantWithFaultTolerance1.PATH, LRAParticipantWithFaultTolerance1.RETRY_PATH)) + .then() + .statusCode(Response.Status.OK.getStatusCode()) + .body(containsString("Method with @Retry ended successfully")); + + // check that there was no retry (i.e. retry is equal to 1) + int numberOfRetries = Integer + .parseInt( + get(getURL(LRAParticipantWithFaultTolerance1.PATH, LRAParticipantWithFaultTolerance1.RETRY_COUNT_PATH)) + .body().print()); + Assert.assertEquals("Number of retries must be one.", 1, numberOfRetries); + + // check tx was completed + verifyResult(getParticipantResult(LRAParticipantWithFaultTolerance1.PATH), true); + verifyResult(getParticipantResult(LRAParticipantWithFaultTolerance2.PATH), true); + } + + /** + * Scenario: Test LRA behavior when an operation on method annotated by @Timeout exceeds a set timeout. + * Test Steps: + * Start an LRA and invoke a participant method annotated with @Timeout. + * Introduce an artificial delay in the method (using Thread.sleep()). + * Set the @Timeout limit to a value shorter than the introduced delay to trigger a timeout causing LRA transaction to fail. + * Verify that the LRA has transitioned to a compensating state, ensuring any partial work is compensated. + */ + @Test + public void testTimeoutWithLRA() { + // call participant with @timeout logic and wait for it to fail on timeout + given() + .queryParam(LRAParticipantWithFaultTolerance1.FAIL_LRA, false) + .when() + .get(getURL(LRAParticipantWithFaultTolerance1.PATH, LRAParticipantWithFaultTolerance1.TIMEOUT_PATH)) + .then() + .statusCode(Response.Status.INTERNAL_SERVER_ERROR.getStatusCode()) + .body(containsString("timed out")); + + // check tx was compensated + verifyResult(getParticipantResult(LRAParticipantWithFaultTolerance1.PATH), false); + verifyResult(getParticipantResult(LRAParticipantWithFaultTolerance2.PATH), false); + } + + /** + * Scenario: Test LRA participation with a circuit breaker pattern to prevent overload. Use @CircuitBreaker to temporarily + * prevent + * a method from being executed if it consistently fails within an LRA context. + * Test Steps: + * Start an LRA and invoke a participant method annotated with @CircuitBreaker. + * Simulate repeated failures to trigger the circuit breaker’s open state. + * Verify that subsequent LRA requests to this method are blocked by the open circuit breaker and LRA transactions are + * compensated. + * Test the half-open state by allowing one method invocation and ensuring it closes the circuit. + * Verify that the LRA completes when the circuit breaker is closed again. + */ + @Test + public void testCircuitBreakerWithLRA() throws Exception { + // call participant with circuit breaker logic, first try it works + given() + .queryParam(LRAParticipantWithFaultTolerance1.FAIL_LRA, false) + .when() + .get(getURL(LRAParticipantWithFaultTolerance1.PATH, LRAParticipantWithFaultTolerance1.CIRCUIT_BREAKER_PATH)) + .then() + .statusCode(Response.Status.OK.getStatusCode()) + .body(containsString("Method with @CircuitBreaker ended successfully")); + + // now call it until the circuit is open + int counter = 0; + while (!given() + .queryParam(LRAParticipantWithFaultTolerance1.FAIL_LRA, true) + .when() + .get(getURL(LRAParticipantWithFaultTolerance1.PATH, LRAParticipantWithFaultTolerance1.CIRCUIT_BREAKER_PATH)) + .body().print().contains("circuit breaker is open")) { + if (counter++ > 10) { + Assert.fail("Circuit breaker must be open now."); + } + } + + // check last tx was compensated + verifyResult(getParticipantResult(LRAParticipantWithFaultTolerance1.PATH), false); + verifyResult(getParticipantResult(LRAParticipantWithFaultTolerance2.PATH), false); + + // After 1 sec circuit gets to half open state and then any new successful call will close it again. Call it until any of the calls succeeds. + long timeout = Duration.ofSeconds(10).toMillis(); + long startTime = System.currentTimeMillis(); + while (given() + .queryParam(LRAParticipantWithFaultTolerance1.FAIL_LRA, false) + .when() + .get(getURL(LRAParticipantWithFaultTolerance1.PATH, LRAParticipantWithFaultTolerance1.CIRCUIT_BREAKER_PATH)) + .statusCode() != 200) { + if (System.currentTimeMillis() - startTime > timeout) { + Assert.fail("Circuit breaker did not close in " + timeout + "ms timeout even though it should."); + } + Thread.sleep(200); + } + + // call once more to check circuit is closed and tx finishes as completed + given() + .queryParam(LRAParticipantWithFaultTolerance1.FAIL_LRA, false) + .when() + .get(getURL(LRAParticipantWithFaultTolerance1.PATH, LRAParticipantWithFaultTolerance1.CIRCUIT_BREAKER_PATH)) + .then() + .statusCode(Response.Status.OK.getStatusCode()) + .body(containsString("Method with @CircuitBreaker ended successfully")); + + // check last tx was completed + verifyResult(getParticipantResult(LRAParticipantWithFaultTolerance1.PATH), true); + verifyResult(getParticipantResult(LRAParticipantWithFaultTolerance2.PATH), true); + } + + /** + * Scenario: Test LRA functionality with fallback actions when primary LRA participant methods fail. + * Use @Fallback to specify an alternative method in case a participant method fails within the context of an LRA. + * Test Steps: + * Start an LRA and invoke a method with @Fallback. + * Force the method to throw an exception, triggering the fallback method. + * Verify that the fallback method is called within the same LRA context. + * Verify that the LRA final state completed. + */ + @Test + public void testFallbackWithLRA() { + // call rest endpoint with having fallback method and check that fallback method was called + // inside this call there will be checked that method and its fallback method are called with the same tx context + given() + .queryParam(LRAParticipantWithFaultTolerance1.FAIL_LRA, true) + .when() + .get(getURL(LRAParticipantWithFaultTolerance1.PATH, LRAParticipantWithFaultTolerance1.FALLBACK_PATH)) + .then() + .statusCode(Response.Status.OK.getStatusCode()) + .body(containsString("Method defined in @Fallback ended successfully")); + + // verify tx is completed + verifyResult(getParticipantResult(LRAParticipantWithFaultTolerance1.PATH), true); + verifyResult(getParticipantResult(LRAParticipantWithFaultTolerance2.PATH), true); + } + + private String getURL(String... paths) { + String baseUrlString = baseApplicationUrl.toString(); + StringBuilder sb = new StringBuilder(baseUrlString.substring(0, baseUrlString.length() - 1)); + Arrays.stream(paths).forEach(path -> sb.append(path.startsWith("/") ? path : "/" + path)); + return sb.toString(); + } + + private LRAResult getParticipantResult(String participantPath) { + return given() + .when().get(getURL(participantPath, LRAParticipant.RESULT_PATH)) + .then() + .statusCode(Response.Status.OK.getStatusCode()) + .extract().as(LRAResult.class); + } + + private void resetParticipantResult(String participantPath) { + given() + .when().put(getURL(participantPath, LRAParticipant.RESET_PATH)) + .then() + .statusCode(Response.Status.NO_CONTENT.getStatusCode()); + } + + private void resetCounter() { + given() + .when() + .get(getURL(LRAParticipantWithFaultTolerance1.PATH, LRAParticipantWithFaultTolerance1.RESET_COUNTER_PATH)) + .then() + .statusCode(Response.Status.NO_CONTENT.getStatusCode()); + } + + private void verifyResult(LRAResult lraResult, boolean shouldBeCompleted) { + if (shouldBeCompleted) { + assertTrue("LRA must be completed but instead it was compensated (rolled back).", + lraResult.isCompleted()); + } else { + assertFalse("LRA was completed but instead it should be compensated (rolled back).", + lraResult.isCompleted()); + } + } +} diff --git a/microprofile-fault-tolerance/src/test/java/org/jboss/eap/qe/microprofile/fault/tolerance/util/FaultToleranceServerSetup.java b/tooling-server-configuration/src/main/java/org/jboss/eap/qe/microprofile/common/setuptasks/FaultToleranceServerSetup.java similarity index 78% rename from microprofile-fault-tolerance/src/test/java/org/jboss/eap/qe/microprofile/fault/tolerance/util/FaultToleranceServerSetup.java rename to tooling-server-configuration/src/main/java/org/jboss/eap/qe/microprofile/common/setuptasks/FaultToleranceServerSetup.java index a98da05b..73081707 100644 --- a/microprofile-fault-tolerance/src/test/java/org/jboss/eap/qe/microprofile/fault/tolerance/util/FaultToleranceServerSetup.java +++ b/tooling-server-configuration/src/main/java/org/jboss/eap/qe/microprofile/common/setuptasks/FaultToleranceServerSetup.java @@ -1,4 +1,4 @@ -package org.jboss.eap.qe.microprofile.fault.tolerance.util; +package org.jboss.eap.qe.microprofile.common.setuptasks; import org.jboss.eap.qe.microprofile.tooling.server.configuration.arquillian.MicroProfileServerSetupTask; @@ -13,6 +13,6 @@ public void setup() throws Exception { @Override public void tearDown() throws Exception { - MicroProfileFaultToleranceServerConfiguration.enableFaultTolerance(); + MicroProfileFaultToleranceServerConfiguration.disableFaultTolerance(); } } diff --git a/microprofile-fault-tolerance/src/test/java/org/jboss/eap/qe/microprofile/fault/tolerance/util/MicroProfileFaultToleranceServerConfiguration.java b/tooling-server-configuration/src/main/java/org/jboss/eap/qe/microprofile/common/setuptasks/MicroProfileFaultToleranceServerConfiguration.java similarity index 98% rename from microprofile-fault-tolerance/src/test/java/org/jboss/eap/qe/microprofile/fault/tolerance/util/MicroProfileFaultToleranceServerConfiguration.java rename to tooling-server-configuration/src/main/java/org/jboss/eap/qe/microprofile/common/setuptasks/MicroProfileFaultToleranceServerConfiguration.java index a736322f..75fb17db 100644 --- a/microprofile-fault-tolerance/src/test/java/org/jboss/eap/qe/microprofile/fault/tolerance/util/MicroProfileFaultToleranceServerConfiguration.java +++ b/tooling-server-configuration/src/main/java/org/jboss/eap/qe/microprofile/common/setuptasks/MicroProfileFaultToleranceServerConfiguration.java @@ -1,4 +1,4 @@ -package org.jboss.eap.qe.microprofile.fault.tolerance.util; +package org.jboss.eap.qe.microprofile.common.setuptasks; import org.jboss.eap.qe.microprofile.tooling.server.configuration.creaper.ManagementClientProvider; import org.wildfly.extras.creaper.core.online.OnlineManagementClient; diff --git a/microprofile-fault-tolerance/src/test/java/org/jboss/eap/qe/microprofile/fault/tolerance/util/MicroProfileTelemetryServerSetup.java b/tooling-server-configuration/src/main/java/org/jboss/eap/qe/microprofile/common/setuptasks/MicroProfileTelemetryServerSetup.java similarity index 99% rename from microprofile-fault-tolerance/src/test/java/org/jboss/eap/qe/microprofile/fault/tolerance/util/MicroProfileTelemetryServerSetup.java rename to tooling-server-configuration/src/main/java/org/jboss/eap/qe/microprofile/common/setuptasks/MicroProfileTelemetryServerSetup.java index fcee3693..15e67df1 100644 --- a/microprofile-fault-tolerance/src/test/java/org/jboss/eap/qe/microprofile/fault/tolerance/util/MicroProfileTelemetryServerSetup.java +++ b/tooling-server-configuration/src/main/java/org/jboss/eap/qe/microprofile/common/setuptasks/MicroProfileTelemetryServerSetup.java @@ -1,4 +1,4 @@ -package org.jboss.eap.qe.microprofile.fault.tolerance.util; +package org.jboss.eap.qe.microprofile.common.setuptasks; import org.jboss.eap.qe.microprofile.tooling.server.configuration.creaper.ManagementClientProvider; import org.wildfly.extras.creaper.core.online.OnlineManagementClient;