This is an automated email from the ASF dual-hosted git repository.
davsclaus pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel.git
The following commit(s) were added to refs/heads/main by this push:
new 885bd0bc4e1 CAMEL-17911: fix creation of duplicate apiProxy (#7845)
885bd0bc4e1 is described below
commit 885bd0bc4e14199273d4f8c45f98d69050215f90
Author: klease <[email protected]>
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.
---
.../org/apache/camel/component/olingo2/Olingo2EndpointConfigurer.java | 2 +-
.../resources/org/apache/camel/component/olingo2/olingo2.json | 4 ++--
.../java/org/apache/camel/component/olingo2/Olingo2Component.java | 4 ++--
.../apache/camel/component/olingo2/AbstractOlingo2TestSupport.java | 2 --
.../org/apache/camel/component/olingo4/Olingo4EndpointConfigurer.java | 2 +-
.../resources/org/apache/camel/component/olingo4/olingo4.json | 4 ++--
.../java/org/apache/camel/component/olingo4/Olingo4Component.java | 4 ++--
7 files changed, 10 insertions(+), 12 deletions(-)
diff --git
a/components/camel-olingo2/camel-olingo2-component/src/generated/java/org/apache/camel/component/olingo2/Olingo2EndpointConfigurer.java
b/components/camel-olingo2/camel-olingo2-component/src/generated/java/org/apache/camel/component/olingo2/Olingo2EndpointConfigurer.java
index e6319c5448a..47cd8edf343 100644
---
a/components/camel-olingo2/camel-olingo2-component/src/generated/java/org/apache/camel/component/olingo2/Olingo2EndpointConfigurer.java
+++
b/components/camel-olingo2/camel-olingo2-component/src/generated/java/org/apache/camel/component/olingo2/Olingo2EndpointConfigurer.java
@@ -32,9 +32,9 @@ public class Olingo2EndpointConfigurer extends
PropertyConfigurerSupport impleme
map.put("proxy", org.apache.http.HttpHost.class);
map.put("serviceUri", java.lang.String.class);
map.put("socketTimeout", int.class);
+ map.put("bridgeErrorHandler", boolean.class);
map.put("sendEmptyMessageWhenIdle", boolean.class);
map.put("splitResult", boolean.class);
- map.put("bridgeErrorHandler", boolean.class);
map.put("exceptionHandler",
org.apache.camel.spi.ExceptionHandler.class);
map.put("exchangePattern", org.apache.camel.ExchangePattern.class);
map.put("pollStrategy",
org.apache.camel.spi.PollingConsumerPollStrategy.class);
diff --git
a/components/camel-olingo2/camel-olingo2-component/src/generated/resources/org/apache/camel/component/olingo2/olingo2.json
b/components/camel-olingo2/camel-olingo2-component/src/generated/resources/org/apache/camel/component/olingo2/olingo2.json
index 183adb272dc..da6de63d054 100644
---
a/components/camel-olingo2/camel-olingo2-component/src/generated/resources/org/apache/camel/component/olingo2/olingo2.json
+++
b/components/camel-olingo2/camel-olingo2-component/src/generated/resources/org/apache/camel/component/olingo2/olingo2.json
@@ -58,13 +58,13 @@
"proxy": { "kind": "parameter", "displayName": "Proxy", "group": "common",
"label": "", "required": false, "type": "object", "javaType":
"org.apache.http.HttpHost", "deprecated": false, "autowired": false, "secret":
false, "configurationClass":
"org.apache.camel.component.olingo2.Olingo2Configuration",
"configurationField": "configuration", "description": "HTTP proxy server
configuration" },
"serviceUri": { "kind": "parameter", "displayName": "Service Uri",
"group": "common", "label": "", "required": false, "type": "string",
"javaType": "java.lang.String", "deprecated": false, "autowired": false,
"secret": false, "configurationClass":
"org.apache.camel.component.olingo2.Olingo2Configuration",
"configurationField": "configuration", "description": "Target OData service
base URI, e.g. http:\/\/services.odata.org\/OData\/OData.svc" },
"socketTimeout": { "kind": "parameter", "displayName": "Socket Timeout",
"group": "common", "label": "", "required": false, "type": "integer",
"javaType": "int", "deprecated": false, "autowired": false, "secret": false,
"defaultValue": 30000, "configurationClass":
"org.apache.camel.component.olingo2.Olingo2Configuration",
"configurationField": "configuration", "description": "HTTP request timeout in
milliseconds, defaults to 30,000 (30 seconds)" },
+ "bridgeErrorHandler": { "kind": "parameter", "displayName": "Bridge Error
Handler", "group": "consumer", "label": "consumer", "required": false, "type":
"boolean", "javaType": "boolean", "deprecated": false, "autowired": false,
"secret": false, "defaultValue": false, "description": "Allows for bridging the
consumer to the Camel routing Error Handler, which mean any exceptions occurred
while the consumer is trying to pickup incoming messages, or the likes, will
now be processed as a m [...]
"sendEmptyMessageWhenIdle": { "kind": "parameter", "displayName": "Send
Empty Message When Idle", "group": "consumer", "label": "consumer", "required":
false, "type": "boolean", "javaType": "boolean", "deprecated": false,
"autowired": false, "secret": false, "defaultValue": false, "description": "If
the polling consumer did not poll any files, you can enable this option to send
an empty message (no body) instead." },
"splitResult": { "kind": "parameter", "displayName": "Split Result",
"group": "consumer", "label": "consumer", "required": false, "type": "boolean",
"javaType": "boolean", "deprecated": false, "autowired": false, "secret":
false, "defaultValue": true, "configurationClass":
"org.apache.camel.component.olingo2.Olingo2Configuration",
"configurationField": "configuration", "description": "For endpoints that
return an array or collection, a consumer endpoint will map every element to
dist [...]
- "bridgeErrorHandler": { "kind": "parameter", "displayName": "Bridge Error
Handler", "group": "consumer (advanced)", "label": "consumer,advanced",
"required": false, "type": "boolean", "javaType": "boolean", "deprecated":
false, "autowired": false, "secret": false, "defaultValue": false,
"description": "Allows for bridging the consumer to the Camel routing Error
Handler, which mean any exceptions occurred while the consumer is trying to
pickup incoming messages, or the likes, will now [...]
"exceptionHandler": { "kind": "parameter", "displayName": "Exception
Handler", "group": "consumer (advanced)", "label": "consumer,advanced",
"required": false, "type": "object", "javaType":
"org.apache.camel.spi.ExceptionHandler", "optionalPrefix": "consumer.",
"deprecated": false, "autowired": false, "secret": false, "description": "To
let the consumer use a custom ExceptionHandler. Notice if the option
bridgeErrorHandler is enabled then this option is not in use. By default the
con [...]
"exchangePattern": { "kind": "parameter", "displayName": "Exchange
Pattern", "group": "consumer (advanced)", "label": "consumer,advanced",
"required": false, "type": "object", "javaType":
"org.apache.camel.ExchangePattern", "enum": [ "InOnly", "InOut",
"InOptionalOut" ], "deprecated": false, "autowired": false, "secret": false,
"description": "Sets the exchange pattern when the consumer creates an
exchange." },
"pollStrategy": { "kind": "parameter", "displayName": "Poll Strategy",
"group": "consumer (advanced)", "label": "consumer,advanced", "required":
false, "type": "object", "javaType":
"org.apache.camel.spi.PollingConsumerPollStrategy", "deprecated": false,
"autowired": false, "secret": false, "description": "A pluggable
org.apache.camel.PollingConsumerPollingStrategy allowing you to provide your
custom implementation to control error handling usually occurred during the
poll operation [...]
- "lazyStartProducer": { "kind": "parameter", "displayName": "Lazy Start
Producer", "group": "producer (advanced)", "label": "producer,advanced",
"required": false, "type": "boolean", "javaType": "boolean", "deprecated":
false, "autowired": false, "secret": false, "defaultValue": false,
"description": "Whether the producer should be started lazy (on the first
message). By starting lazy you can use this to allow CamelContext and routes to
startup in situations where a producer may other [...]
+ "lazyStartProducer": { "kind": "parameter", "displayName": "Lazy Start
Producer", "group": "producer", "label": "producer", "required": false, "type":
"boolean", "javaType": "boolean", "deprecated": false, "autowired": false,
"secret": false, "defaultValue": false, "description": "Whether the producer
should be started lazy (on the first message). By starting lazy you can use
this to allow CamelContext and routes to startup in situations where a producer
may otherwise fail during sta [...]
"httpAsyncClientBuilder": { "kind": "parameter", "displayName": "Http
Async Client Builder", "group": "advanced", "label": "advanced", "required":
false, "type": "object", "javaType":
"org.apache.http.impl.nio.client.HttpAsyncClientBuilder", "deprecated": false,
"autowired": false, "secret": false, "configurationClass":
"org.apache.camel.component.olingo2.Olingo2Configuration",
"configurationField": "configuration", "description": "Custom HTTP async client
builder for more complex HT [...]
"httpClientBuilder": { "kind": "parameter", "displayName": "Http Client
Builder", "group": "advanced", "label": "advanced", "required": false, "type":
"object", "javaType": "org.apache.http.impl.client.HttpClientBuilder",
"deprecated": false, "autowired": false, "secret": false, "configurationClass":
"org.apache.camel.component.olingo2.Olingo2Configuration",
"configurationField": "configuration", "description": "Custom HTTP client
builder for more complex HTTP client configuration, o [...]
"backoffErrorThreshold": { "kind": "parameter", "displayName": "Backoff
Error Threshold", "group": "scheduler", "label": "consumer,scheduler",
"required": false, "type": "integer", "javaType": "int", "deprecated": false,
"autowired": false, "secret": false, "description": "The number of subsequent
error polls (failed due some error) that should happen before the
backoffMultipler should kick-in." },
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/generated/java/org/apache/camel/component/olingo4/Olingo4EndpointConfigurer.java
b/components/camel-olingo4/camel-olingo4-component/src/generated/java/org/apache/camel/component/olingo4/Olingo4EndpointConfigurer.java
index 4314cd35994..3f7b2e75fc1 100644
---
a/components/camel-olingo4/camel-olingo4-component/src/generated/java/org/apache/camel/component/olingo4/Olingo4EndpointConfigurer.java
+++
b/components/camel-olingo4/camel-olingo4-component/src/generated/java/org/apache/camel/component/olingo4/Olingo4EndpointConfigurer.java
@@ -30,9 +30,9 @@ public class Olingo4EndpointConfigurer extends
PropertyConfigurerSupport impleme
map.put("proxy", org.apache.http.HttpHost.class);
map.put("serviceUri", java.lang.String.class);
map.put("socketTimeout", int.class);
+ map.put("bridgeErrorHandler", boolean.class);
map.put("sendEmptyMessageWhenIdle", boolean.class);
map.put("splitResult", boolean.class);
- map.put("bridgeErrorHandler", boolean.class);
map.put("exceptionHandler",
org.apache.camel.spi.ExceptionHandler.class);
map.put("exchangePattern", org.apache.camel.ExchangePattern.class);
map.put("pollStrategy",
org.apache.camel.spi.PollingConsumerPollStrategy.class);
diff --git
a/components/camel-olingo4/camel-olingo4-component/src/generated/resources/org/apache/camel/component/olingo4/olingo4.json
b/components/camel-olingo4/camel-olingo4-component/src/generated/resources/org/apache/camel/component/olingo4/olingo4.json
index efa0b61051b..a398590c5dd 100644
---
a/components/camel-olingo4/camel-olingo4-component/src/generated/resources/org/apache/camel/component/olingo4/olingo4.json
+++
b/components/camel-olingo4/camel-olingo4-component/src/generated/resources/org/apache/camel/component/olingo4/olingo4.json
@@ -54,13 +54,13 @@
"proxy": { "kind": "parameter", "displayName": "Proxy", "group": "common",
"label": "", "required": false, "type": "object", "javaType":
"org.apache.http.HttpHost", "deprecated": false, "autowired": false, "secret":
false, "configurationClass":
"org.apache.camel.component.olingo4.Olingo4Configuration",
"configurationField": "configuration", "description": "HTTP proxy server
configuration" },
"serviceUri": { "kind": "parameter", "displayName": "Service Uri",
"group": "common", "label": "", "required": false, "type": "string",
"javaType": "java.lang.String", "deprecated": false, "autowired": false,
"secret": false, "configurationClass":
"org.apache.camel.component.olingo4.Olingo4Configuration",
"configurationField": "configuration", "description": "Target OData service
base URI, e.g. http:\/\/services.odata.org\/OData\/OData.svc" },
"socketTimeout": { "kind": "parameter", "displayName": "Socket Timeout",
"group": "common", "label": "", "required": false, "type": "integer",
"javaType": "int", "deprecated": false, "autowired": false, "secret": false,
"defaultValue": 30000, "configurationClass":
"org.apache.camel.component.olingo4.Olingo4Configuration",
"configurationField": "configuration", "description": "HTTP request timeout in
milliseconds, defaults to 30,000 (30 seconds)" },
+ "bridgeErrorHandler": { "kind": "parameter", "displayName": "Bridge Error
Handler", "group": "consumer", "label": "consumer", "required": false, "type":
"boolean", "javaType": "boolean", "deprecated": false, "autowired": false,
"secret": false, "defaultValue": false, "description": "Allows for bridging the
consumer to the Camel routing Error Handler, which mean any exceptions occurred
while the consumer is trying to pickup incoming messages, or the likes, will
now be processed as a m [...]
"sendEmptyMessageWhenIdle": { "kind": "parameter", "displayName": "Send
Empty Message When Idle", "group": "consumer", "label": "consumer", "required":
false, "type": "boolean", "javaType": "boolean", "deprecated": false,
"autowired": false, "secret": false, "defaultValue": false, "description": "If
the polling consumer did not poll any files, you can enable this option to send
an empty message (no body) instead." },
"splitResult": { "kind": "parameter", "displayName": "Split Result",
"group": "consumer", "label": "consumer", "required": false, "type": "boolean",
"javaType": "boolean", "deprecated": false, "autowired": false, "secret":
false, "defaultValue": true, "configurationClass":
"org.apache.camel.component.olingo4.Olingo4Configuration",
"configurationField": "configuration", "description": "For endpoints that
return an array or collection, a consumer endpoint will map every element to
dist [...]
- "bridgeErrorHandler": { "kind": "parameter", "displayName": "Bridge Error
Handler", "group": "consumer (advanced)", "label": "consumer,advanced",
"required": false, "type": "boolean", "javaType": "boolean", "deprecated":
false, "autowired": false, "secret": false, "defaultValue": false,
"description": "Allows for bridging the consumer to the Camel routing Error
Handler, which mean any exceptions occurred while the consumer is trying to
pickup incoming messages, or the likes, will now [...]
"exceptionHandler": { "kind": "parameter", "displayName": "Exception
Handler", "group": "consumer (advanced)", "label": "consumer,advanced",
"required": false, "type": "object", "javaType":
"org.apache.camel.spi.ExceptionHandler", "optionalPrefix": "consumer.",
"deprecated": false, "autowired": false, "secret": false, "description": "To
let the consumer use a custom ExceptionHandler. Notice if the option
bridgeErrorHandler is enabled then this option is not in use. By default the
con [...]
"exchangePattern": { "kind": "parameter", "displayName": "Exchange
Pattern", "group": "consumer (advanced)", "label": "consumer,advanced",
"required": false, "type": "object", "javaType":
"org.apache.camel.ExchangePattern", "enum": [ "InOnly", "InOut",
"InOptionalOut" ], "deprecated": false, "autowired": false, "secret": false,
"description": "Sets the exchange pattern when the consumer creates an
exchange." },
"pollStrategy": { "kind": "parameter", "displayName": "Poll Strategy",
"group": "consumer (advanced)", "label": "consumer,advanced", "required":
false, "type": "object", "javaType":
"org.apache.camel.spi.PollingConsumerPollStrategy", "deprecated": false,
"autowired": false, "secret": false, "description": "A pluggable
org.apache.camel.PollingConsumerPollingStrategy allowing you to provide your
custom implementation to control error handling usually occurred during the
poll operation [...]
- "lazyStartProducer": { "kind": "parameter", "displayName": "Lazy Start
Producer", "group": "producer (advanced)", "label": "producer,advanced",
"required": false, "type": "boolean", "javaType": "boolean", "deprecated":
false, "autowired": false, "secret": false, "defaultValue": false,
"description": "Whether the producer should be started lazy (on the first
message). By starting lazy you can use this to allow CamelContext and routes to
startup in situations where a producer may other [...]
+ "lazyStartProducer": { "kind": "parameter", "displayName": "Lazy Start
Producer", "group": "producer", "label": "producer", "required": false, "type":
"boolean", "javaType": "boolean", "deprecated": false, "autowired": false,
"secret": false, "defaultValue": false, "description": "Whether the producer
should be started lazy (on the first message). By starting lazy you can use
this to allow CamelContext and routes to startup in situations where a producer
may otherwise fail during sta [...]
"httpAsyncClientBuilder": { "kind": "parameter", "displayName": "Http
Async Client Builder", "group": "advanced", "label": "advanced", "required":
false, "type": "object", "javaType":
"org.apache.http.impl.nio.client.HttpAsyncClientBuilder", "deprecated": false,
"autowired": false, "secret": false, "configurationClass":
"org.apache.camel.component.olingo4.Olingo4Configuration",
"configurationField": "configuration", "description": "Custom HTTP async client
builder for more complex HT [...]
"httpClientBuilder": { "kind": "parameter", "displayName": "Http Client
Builder", "group": "advanced", "label": "advanced", "required": false, "type":
"object", "javaType": "org.apache.http.impl.client.HttpClientBuilder",
"deprecated": false, "autowired": false, "secret": false, "configurationClass":
"org.apache.camel.component.olingo4.Olingo4Configuration",
"configurationField": "configuration", "description": "Custom HTTP client
builder for more complex HTTP client configuration, o [...]
"backoffErrorThreshold": { "kind": "parameter", "displayName": "Backoff
Error Threshold", "group": "scheduler", "label": "consumer,scheduler",
"required": false, "type": "integer", "javaType": "int", "deprecated": false,
"autowired": false, "secret": false, "description": "The number of subsequent
error polls (failed due some error) that should happen before the
backoffMultipler should kick-in." },
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;