This is an automated email from the ASF dual-hosted git repository. github-bot pushed a commit to branch quarkus-main in repository https://gitbox.apache.org/repos/asf/camel-quarkus.git
commit 77d1fed967ef03ad026d5ac5b1c0c05e3ef1aebe Author: James Netherton <jamesnether...@gmail.com> AuthorDate: Mon Oct 31 08:56:00 2022 +0000 Disable microprofile-fault-tolerance testing due to #4225 --- .../it/CoreFaultToleranceProducers.java | 35 ++++++++++++++++++++-- integration-tests/foundation-grouped/pom.xml | 6 +++- integration-tests/microprofile/pom.xml | 2 ++ .../MicroProfileFaultToleranceRoutes.java | 20 ++++++------- .../MicroprofileFaultToleranceIT.java | 2 ++ .../MicroprofileFaultToleranceTest.java | 2 ++ tooling/scripts/group-tests.groovy | 6 +++- 7 files changed, 58 insertions(+), 15 deletions(-) diff --git a/integration-test-groups/foundation/core-fault-tolerance/src/main/java/org/apache/camel/quarkus/core/faulttolerance/it/CoreFaultToleranceProducers.java b/integration-test-groups/foundation/core-fault-tolerance/src/main/java/org/apache/camel/quarkus/core/faulttolerance/it/CoreFaultToleranceProducers.java index aa9394108c..67f580041d 100644 --- a/integration-test-groups/foundation/core-fault-tolerance/src/main/java/org/apache/camel/quarkus/core/faulttolerance/it/CoreFaultToleranceProducers.java +++ b/integration-test-groups/foundation/core-fault-tolerance/src/main/java/org/apache/camel/quarkus/core/faulttolerance/it/CoreFaultToleranceProducers.java @@ -18,29 +18,32 @@ package org.apache.camel.quarkus.core.faulttolerance.it; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; +import java.util.concurrent.TimeUnit; import javax.enterprise.context.ApplicationScoped; +import javax.enterprise.inject.Disposes; import javax.inject.Named; import io.smallrye.faulttolerance.core.FaultToleranceStrategy; import io.smallrye.faulttolerance.core.InvocationContext; import io.smallrye.faulttolerance.core.circuit.breaker.CircuitBreaker; import io.smallrye.faulttolerance.core.stopwatch.SystemStopwatch; +import io.smallrye.faulttolerance.core.timer.ThreadTimer; import io.smallrye.faulttolerance.core.util.ExceptionDecision; public class CoreFaultToleranceProducers { @ApplicationScoped @Named("customCircuitBreaker") - CircuitBreaker<Integer> produceCustomCircuitBreaker() { + CircuitBreaker<Integer> produceCustomCircuitBreaker(ThreadTimer threadTimer) { FaultToleranceStrategy<Integer> delegate = new FaultToleranceStrategy<Integer>() { @Override public Integer apply(InvocationContext<Integer> ctx) { return null; } }; - return new CircuitBreaker<Integer>(delegate, "description", ExceptionDecision.ALWAYS_FAILURE, 10, 40, 0.1, - 2, new SystemStopwatch()) { + return new CircuitBreaker<>(delegate, "description", ExceptionDecision.ALWAYS_FAILURE, 10, 40, 0.1, + 2, SystemStopwatch.INSTANCE, threadTimer) { @Override public String toString() { return "customCircuitBreaker"; @@ -54,4 +57,30 @@ public class CoreFaultToleranceProducers { return Executors.newFixedThreadPool(2); } + @ApplicationScoped + @Named("threadTimer") + ThreadTimer threadTimer(@Named("threadTimerExecutor") ExecutorService executorService) { + return new ThreadTimer(executorService); + } + + @ApplicationScoped + @Named("threadTimerExecutor") + ExecutorService threadTimerExecutor() { + return Executors.newSingleThreadExecutor(); + } + + void disposeThreadTimerExecutor(@Disposes @Named("threadTimerExecutor") ExecutorService threadTimerExecutor, + ThreadTimer timer) { + try { + timer.shutdown(); + } catch (InterruptedException e) { + Thread.currentThread().interrupt(); + } + + try { + threadTimerExecutor.awaitTermination(10, TimeUnit.SECONDS); + } catch (InterruptedException e) { + Thread.currentThread().interrupt(); + } + } } diff --git a/integration-tests/foundation-grouped/pom.xml b/integration-tests/foundation-grouped/pom.xml index 70cf7efb29..741e00836a 100644 --- a/integration-tests/foundation-grouped/pom.xml +++ b/integration-tests/foundation-grouped/pom.xml @@ -96,10 +96,12 @@ <groupId>org.apache.camel.quarkus</groupId> <artifactId>camel-quarkus-log</artifactId> </dependency> + <!-- https://github.com/apache/camel-quarkus/issues/4225 <dependency> <groupId>org.apache.camel.quarkus</groupId> <artifactId>camel-quarkus-microprofile-fault-tolerance</artifactId> </dependency> + --> <dependency> <groupId>org.apache.camel.quarkus</groupId> <artifactId>camel-quarkus-mock</artifactId> @@ -210,7 +212,9 @@ <properties> <group-tests.source.dir>${maven.multiModuleProjectDirectory}/integration-test-groups/foundation</group-tests.source.dir> <group-tests.dest.module.dir>${project.basedir}</group-tests.dest.module.dir> - <group-tests.concat.rel.paths>src/main/resources/application.properties</group-tests.concat.rel.paths> + <group-tests.concat.rel.paths>src/main/resources/application.properties</group-tests.concat.rel.paths> + <!-- TODO: https://github.com/apache/camel-quarkus/issues/4225 --> + <group-tests.files.excludes>core-fault-tolerance</group-tests.files.excludes> </properties> </configuration> </execution> diff --git a/integration-tests/microprofile/pom.xml b/integration-tests/microprofile/pom.xml index 42789db903..1f606d005e 100644 --- a/integration-tests/microprofile/pom.xml +++ b/integration-tests/microprofile/pom.xml @@ -84,6 +84,7 @@ <profiles> + <!-- TODO: https://github.com/apache/camel-quarkus/issues/4225 <profile> <id>native</id> <activation> @@ -111,6 +112,7 @@ </plugins> </build> </profile> + --> <profile> <id>virtualDependencies</id> <activation> diff --git a/integration-tests/microprofile/src/main/java/org/apache/camel/quarkus/component/microprofile/it/faulttolerance/MicroProfileFaultToleranceRoutes.java b/integration-tests/microprofile/src/main/java/org/apache/camel/quarkus/component/microprofile/it/faulttolerance/MicroProfileFaultToleranceRoutes.java index 2ac31d6d3e..f6a07977d4 100644 --- a/integration-tests/microprofile/src/main/java/org/apache/camel/quarkus/component/microprofile/it/faulttolerance/MicroProfileFaultToleranceRoutes.java +++ b/integration-tests/microprofile/src/main/java/org/apache/camel/quarkus/component/microprofile/it/faulttolerance/MicroProfileFaultToleranceRoutes.java @@ -17,14 +17,12 @@ package org.apache.camel.quarkus.component.microprofile.it.faulttolerance; import java.util.concurrent.ScheduledExecutorService; -import java.util.concurrent.atomic.AtomicInteger; import javax.enterprise.context.ApplicationScoped; import javax.inject.Inject; import javax.inject.Named; import org.apache.camel.builder.RouteBuilder; -import org.eclipse.microprofile.faulttolerance.exceptions.TimeoutException; @ApplicationScoped public class MicroProfileFaultToleranceRoutes extends RouteBuilder { @@ -38,6 +36,7 @@ public class MicroProfileFaultToleranceRoutes extends RouteBuilder { @Override public void configure() throws Exception { + /* TODO: https://github.com/apache/camel-quarkus/issues/4225 from("direct:faultToleranceWithBulkhead") .circuitBreaker() .faultToleranceConfiguration().bulkheadEnabled(true).end() @@ -51,7 +50,7 @@ public class MicroProfileFaultToleranceRoutes extends RouteBuilder { .onFallback() .setBody().constant(FALLBACK_RESULT) .end(); - + from("direct:faultToleranceWithFallback") .circuitBreaker() .process(exchange -> { @@ -64,7 +63,7 @@ public class MicroProfileFaultToleranceRoutes extends RouteBuilder { .onFallback() .setBody().constant(FALLBACK_RESULT) .end(); - + from("direct:faultToleranceWithThreshold") .circuitBreaker() .faultToleranceConfiguration().failureRatio(100).successThreshold(1).requestVolumeThreshold(1).delay(0).end() @@ -77,7 +76,7 @@ public class MicroProfileFaultToleranceRoutes extends RouteBuilder { }) .end() .setBody().simple(RESULT); - + from("direct:faultToleranceWithTimeout") .circuitBreaker() .faultToleranceConfiguration().timeoutEnabled(true).timeoutDuration(500).end() @@ -91,7 +90,7 @@ public class MicroProfileFaultToleranceRoutes extends RouteBuilder { .onFallback() .setBody().simple(FALLBACK_RESULT) .end(); - + from("direct:faultToleranceWithTimeoutCustomExecutor") .circuitBreaker() .faultToleranceConfiguration().timeoutEnabled(true).timeoutScheduledExecutorService("myThreadPool") @@ -106,26 +105,27 @@ public class MicroProfileFaultToleranceRoutes extends RouteBuilder { .onFallback() .setBody().simple(FALLBACK_RESULT) .end(); - + from("direct:inheritErrorHandler") .errorHandler(deadLetterChannel("mock:dead").maximumRedeliveries(3).redeliveryDelay(0)) .circuitBreaker().inheritErrorHandler(true) .to("mock:start") .throwException(new IllegalArgumentException(EXCEPTION_MESSAGE)).end() .to("mock:end"); - + from("direct:circuitBreakerBean") .bean(greetingBean, "greetWithCircuitBreaker"); - + from("direct:fallbackBean") .bean(greetingBean, "greetWithFallback"); - + from("direct:timeoutBean") .doTry() .bean(greetingBean, "greetWithDelay") .doCatch(TimeoutException.class) .setBody().constant(FALLBACK_RESULT) .end(); + */ } @Named("myThreadPool") diff --git a/integration-tests/microprofile/src/test/java/org/apache/camel/quarkus/component/microprofile/it/faulttolerance/MicroprofileFaultToleranceIT.java b/integration-tests/microprofile/src/test/java/org/apache/camel/quarkus/component/microprofile/it/faulttolerance/MicroprofileFaultToleranceIT.java index 1362ada770..dad557b45b 100644 --- a/integration-tests/microprofile/src/test/java/org/apache/camel/quarkus/component/microprofile/it/faulttolerance/MicroprofileFaultToleranceIT.java +++ b/integration-tests/microprofile/src/test/java/org/apache/camel/quarkus/component/microprofile/it/faulttolerance/MicroprofileFaultToleranceIT.java @@ -17,7 +17,9 @@ package org.apache.camel.quarkus.component.microprofile.it.faulttolerance; import io.quarkus.test.junit.QuarkusIntegrationTest; +import org.junit.jupiter.api.Disabled; +@Disabled("https://github.com/apache/camel-quarkus/issues/4225") @QuarkusIntegrationTest class MicroprofileFaultToleranceIT extends MicroprofileFaultToleranceTest { diff --git a/integration-tests/microprofile/src/test/java/org/apache/camel/quarkus/component/microprofile/it/faulttolerance/MicroprofileFaultToleranceTest.java b/integration-tests/microprofile/src/test/java/org/apache/camel/quarkus/component/microprofile/it/faulttolerance/MicroprofileFaultToleranceTest.java index 4d5378c12a..27de01642e 100644 --- a/integration-tests/microprofile/src/test/java/org/apache/camel/quarkus/component/microprofile/it/faulttolerance/MicroprofileFaultToleranceTest.java +++ b/integration-tests/microprofile/src/test/java/org/apache/camel/quarkus/component/microprofile/it/faulttolerance/MicroprofileFaultToleranceTest.java @@ -18,6 +18,7 @@ package org.apache.camel.quarkus.component.microprofile.it.faulttolerance; import io.quarkus.test.junit.QuarkusTest; import io.restassured.RestAssured; +import org.junit.jupiter.api.Disabled; import org.junit.jupiter.api.Test; import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.MethodSource; @@ -26,6 +27,7 @@ import org.junit.jupiter.params.provider.ValueSource; import static org.apache.camel.quarkus.component.microprofile.it.faulttolerance.MicroProfileFaultToleranceRoutes.EXCEPTION_MESSAGE; import static org.hamcrest.Matchers.is; +@Disabled("https://github.com/apache/camel-quarkus/issues/4225") @QuarkusTest class MicroprofileFaultToleranceTest { diff --git a/tooling/scripts/group-tests.groovy b/tooling/scripts/group-tests.groovy index 02eba771f7..fd5e047a22 100644 --- a/tooling/scripts/group-tests.groovy +++ b/tooling/scripts/group-tests.groovy @@ -34,13 +34,17 @@ import groovy.ant.AntBuilder final Path sourceDir = Paths.get(properties['group-tests.source.dir']) final String[] concatRelPaths = properties['group-tests.concat.rel.paths'].split('[\\s,]+') final Path destinationModuleDir = Paths.get(properties['group-tests.dest.module.dir']) +final String excludes = properties['group-tests.files.excludes'] ?: "" +final List<String> fileExcludes = excludes.split('[\\s,]+') as List /* Property names whose values originating from distinct application.properties files can be concatenated using comma as a separator */ -final Set<String> commaConcatenatePropertyNames = ["quarkus.native.resources.includes", "quarkus.native.resources.excludes"] as Set; +final Set<String> commaConcatenatePropertyNames = ["quarkus.native.resources.includes", "quarkus.native.resources.excludes"] as Set final Map<String, ResourceConcatenator> mergedFiles = new HashMap<>() concatRelPaths.each {relPath -> mergedFiles.put(relPath, new ResourceConcatenator(commaConcatenatePropertyNames)) } Files.list(sourceDir) + .filter(p -> !fileExcludes.contains(p.getFileName().toString())) + .peek(p -> System.out.println(p.getFileName().toString())) .filter { p -> Files.exists(p.resolve('pom.xml')) } .sorted() .forEach { p ->