You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by ja...@apache.org on 2022/10/31 08:56:21 UTC

[camel-quarkus] 02/02: Disable core-fault-tolerance testing due to #4225

This is an automated email from the ASF dual-hosted git repository.

jamesnetherton pushed a commit to branch quarkus-main
in repository https://gitbox.apache.org/repos/asf/camel-quarkus.git

commit 196f97dae66739b5699b48ef2bd1270c76e4eaa4
Author: James Netherton <ja...@gmail.com>
AuthorDate: Mon Oct 31 08:56:00 2022 +0000

    Disable core-fault-tolerance testing due to #4225
---
 .../it/CoreFaultToleranceProducers.java            | 35 ++++++++++++++++++++--
 integration-tests/foundation-grouped/pom.xml       |  6 +++-
 tooling/scripts/group-tests.groovy                 |  6 +++-
 3 files changed, 42 insertions(+), 5 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 51f2d09ee1..b11a115073 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/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 ->