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

davsclaus pushed a commit to branch camel-3.14.x
in repository https://gitbox.apache.org/repos/asf/camel.git


The following commit(s) were added to refs/heads/camel-3.14.x by this push:
     new d0efa899815 CAMEL-17911: fix creation of duplicate apiProxy (#7845)
d0efa899815 is described below

commit d0efa89981546979ed5f6c5b9029a9f6b5cf1c7b
Author: klease <38634989+kle...@users.noreply.github.com>
AuthorDate: Tue Jun 21 18:23:23 2022 +0200

    CAMEL-17911: fix creation of duplicate apiProxy (#7845)
    
    * CAMEL-17911: fix creation of duplicate apiProxy
    The check for equality always failed because the configuration is only set
    on the superclass but was read from Olingo2Component.
    Modify AbstractOlingo2TestSupport to fix flaky test due to reused Camel 
context.
    
    * CAMEL-17911: Fix handling of configuration in olingo4 in same way as for 
olingo2.
---
 .../java/org/apache/camel/component/olingo2/Olingo2Component.java     | 4 ++--
 .../apache/camel/component/olingo2/AbstractOlingo2TestSupport.java    | 2 --
 .../java/org/apache/camel/component/olingo4/Olingo4Component.java     | 4 ++--
 3 files changed, 4 insertions(+), 6 deletions(-)

diff --git 
a/components/camel-olingo2/camel-olingo2-component/src/main/java/org/apache/camel/component/olingo2/Olingo2Component.java
 
b/components/camel-olingo2/camel-olingo2-component/src/main/java/org/apache/camel/component/olingo2/Olingo2Component.java
index 6a57a6ebf1c..de5bca0f747 100644
--- 
a/components/camel-olingo2/camel-olingo2-component/src/main/java/org/apache/camel/component/olingo2/Olingo2Component.java
+++ 
b/components/camel-olingo2/camel-olingo2-component/src/main/java/org/apache/camel/component/olingo2/Olingo2Component.java
@@ -118,10 +118,10 @@ public class Olingo2Component extends 
AbstractApiComponent<Olingo2ApiName, Oling
 
     public Olingo2AppWrapper createApiProxy(Olingo2Configuration 
endpointConfiguration) {
         final Olingo2AppWrapper result;
-        if (endpointConfiguration.equals(this.configuration)) {
+        if (endpointConfiguration.equals(getConfiguration())) {
             synchronized (this) {
                 if (apiProxy == null) {
-                    apiProxy = createOlingo2App(this.configuration);
+                    apiProxy = createOlingo2App(getConfiguration());
                 }
             }
             result = apiProxy;
diff --git 
a/components/camel-olingo2/camel-olingo2-component/src/test/java/org/apache/camel/component/olingo2/AbstractOlingo2TestSupport.java
 
b/components/camel-olingo2/camel-olingo2-component/src/test/java/org/apache/camel/component/olingo2/AbstractOlingo2TestSupport.java
index 7d446c69b45..a915dfd7865 100644
--- 
a/components/camel-olingo2/camel-olingo2-component/src/test/java/org/apache/camel/component/olingo2/AbstractOlingo2TestSupport.java
+++ 
b/components/camel-olingo2/camel-olingo2-component/src/test/java/org/apache/camel/component/olingo2/AbstractOlingo2TestSupport.java
@@ -23,12 +23,10 @@ import java.util.Properties;
 import org.apache.camel.CamelContext;
 import org.apache.camel.CamelExecutionException;
 import org.apache.camel.test.junit5.CamelTestSupport;
-import org.junit.jupiter.api.TestInstance;
 
 /**
  * Abstract base class for Olingo Integration tests generated by Camel API 
component maven plugin.
  */
-@TestInstance(TestInstance.Lifecycle.PER_CLASS)
 public class AbstractOlingo2TestSupport extends CamelTestSupport {
 
     private static final String TEST_OPTIONS_PROPERTIES = 
"/test-options.properties";
diff --git 
a/components/camel-olingo4/camel-olingo4-component/src/main/java/org/apache/camel/component/olingo4/Olingo4Component.java
 
b/components/camel-olingo4/camel-olingo4-component/src/main/java/org/apache/camel/component/olingo4/Olingo4Component.java
index 4edd53a9222..24e1e822553 100644
--- 
a/components/camel-olingo4/camel-olingo4-component/src/main/java/org/apache/camel/component/olingo4/Olingo4Component.java
+++ 
b/components/camel-olingo4/camel-olingo4-component/src/main/java/org/apache/camel/component/olingo4/Olingo4Component.java
@@ -118,10 +118,10 @@ public class Olingo4Component extends 
AbstractApiComponent<Olingo4ApiName, Oling
 
     public Olingo4AppWrapper createApiProxy(Olingo4Configuration 
endpointConfiguration) {
         final Olingo4AppWrapper result;
-        if (endpointConfiguration.equals(this.configuration)) {
+        if (endpointConfiguration.equals(getConfiguration())) {
             synchronized (this) {
                 if (apiProxy == null) {
-                    apiProxy = createOlingo4App(this.configuration);
+                    apiProxy = createOlingo4App(getConfiguration());
                 }
             }
             result = apiProxy;

Reply via email to