You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by da...@apache.org on 2020/04/08 19:49:50 UTC
[camel] 02/04: CAMEL-14860: Avoid using reflections for circuit
breakers. WIP
This is an automated email from the ASF dual-hosted git repository.
davsclaus pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/camel.git
commit fd04f6c16f3b07b1a408863e6ecb39927a4be0e7
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Wed Apr 8 17:07:56 2020 +0200
CAMEL-14860: Avoid using reflections for circuit breakers. WIP
---
.../faulttolerance/FaultToleranceReifier.java | 4 ----
.../faulttolerance/FaultToleranceRouteOkTest.java | 26 ++++++++++++++++++++++
2 files changed, 26 insertions(+), 4 deletions(-)
diff --git a/components/camel-microprofile-fault-tolerance/src/main/java/org/apache/camel/component/microprofile/faulttolerance/FaultToleranceReifier.java b/components/camel-microprofile-fault-tolerance/src/main/java/org/apache/camel/component/microprofile/faulttolerance/FaultToleranceReifier.java
index ec81375..8865e96 100644
--- a/components/camel-microprofile-fault-tolerance/src/main/java/org/apache/camel/component/microprofile/faulttolerance/FaultToleranceReifier.java
+++ b/components/camel-microprofile-fault-tolerance/src/main/java/org/apache/camel/component/microprofile/faulttolerance/FaultToleranceReifier.java
@@ -149,10 +149,6 @@ public class FaultToleranceReifier extends ProcessorReifier<CircuitBreakerDefini
// Extract properties from local configuration
loadProperties(properties, Optional.ofNullable(definition.getFaultToleranceConfiguration()));
- // Extract properties from definition
- BeanIntrospection beanIntrospection = camelContext.adapt(ExtendedCamelContext.class).getBeanIntrospection();
- beanIntrospection.getProperties(definition, properties, null, false);
-
FaultToleranceConfigurationDefinition config = new FaultToleranceConfigurationDefinition();
// Apply properties to a new configuration
diff --git a/components/camel-microprofile-fault-tolerance/src/test/java/org/apache/camel/component/microprofile/faulttolerance/FaultToleranceRouteOkTest.java b/components/camel-microprofile-fault-tolerance/src/test/java/org/apache/camel/component/microprofile/faulttolerance/FaultToleranceRouteOkTest.java
index 53b873e..2a8954f 100644
--- a/components/camel-microprofile-fault-tolerance/src/test/java/org/apache/camel/component/microprofile/faulttolerance/FaultToleranceRouteOkTest.java
+++ b/components/camel-microprofile-fault-tolerance/src/test/java/org/apache/camel/component/microprofile/faulttolerance/FaultToleranceRouteOkTest.java
@@ -16,15 +16,39 @@
*/
package org.apache.camel.component.microprofile.faulttolerance;
+import org.apache.camel.CamelContext;
+import org.apache.camel.ExtendedCamelContext;
+import org.apache.camel.LoggingLevel;
import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.spi.BeanIntrospection;
import org.apache.camel.spi.CircuitBreakerConstants;
import org.apache.camel.test.junit4.CamelTestSupport;
import org.junit.Test;
public class FaultToleranceRouteOkTest extends CamelTestSupport {
+ private BeanIntrospection bi;
+
+ @Override
+ protected boolean useJmx() {
+ return false;
+ }
+
+ @Override
+ protected CamelContext createCamelContext() throws Exception {
+ CamelContext context = super.createCamelContext();
+
+ bi = context.adapt(ExtendedCamelContext.class).getBeanIntrospection();
+ bi.setLoggingLevel(LoggingLevel.INFO);
+ bi.resetCounters();
+
+ return context;
+ }
+
@Test
public void testFaultTolerance() throws Exception {
+ assertEquals(0, bi.getInvokedCounter());
+
getMockEndpoint("mock:result").expectedBodiesReceived("Bye World");
getMockEndpoint("mock:result").expectedPropertyReceived(CircuitBreakerConstants.RESPONSE_SUCCESSFUL_EXECUTION, true);
getMockEndpoint("mock:result").expectedPropertyReceived(CircuitBreakerConstants.RESPONSE_FROM_FALLBACK, false);
@@ -32,6 +56,8 @@ public class FaultToleranceRouteOkTest extends CamelTestSupport {
template.sendBody("direct:start", "Hello World");
assertMockEndpointsSatisfied();
+
+ assertEquals(0, bi.getInvokedCounter());
}
@Override