This is an automated email from the ASF dual-hosted git repository.
zhfeng 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 a1c585eeaed CAMEL-19150: camel-olingo4 - Fix missing olingo4 endpoint
property names (#9570)
a1c585eeaed is described below
commit a1c585eeaedacc4b4e90200c904289ab650d61f0
Author: Zheng Feng <[email protected]>
AuthorDate: Sat Mar 18 21:11:48 2023 +0800
CAMEL-19150: camel-olingo4 - Fix missing olingo4 endpoint property names
(#9570)
---
.../camel/component/olingo4/Olingo4Endpoint.java | 3 ++-
.../camel/component/olingo4/Olingo4RouteTest.java | 20 +++++++++++++++++---
2 files changed, 19 insertions(+), 4 deletions(-)
diff --git
a/components/camel-olingo4/camel-olingo4-component/src/main/java/org/apache/camel/component/olingo4/Olingo4Endpoint.java
b/components/camel-olingo4/camel-olingo4-component/src/main/java/org/apache/camel/component/olingo4/Olingo4Endpoint.java
index 46d65c10112..7127f040197 100644
---
a/components/camel-olingo4/camel-olingo4-component/src/main/java/org/apache/camel/component/olingo4/Olingo4Endpoint.java
+++
b/components/camel-olingo4/camel-olingo4-component/src/main/java/org/apache/camel/component/olingo4/Olingo4Endpoint.java
@@ -166,7 +166,8 @@ public class Olingo4Endpoint extends
AbstractApiEndpoint<Olingo4ApiName, Olingo4
@Override
protected void afterConfigureProperties() {
- olingo4endpointPropertyNames = new
HashSet<>(getEndpointPropertyNames());
+ olingo4endpointPropertyNames
+ = new
HashSet<>(getPropertiesHelper().getValidEndpointProperties(getCamelContext(),
configuration));
olingo4endpointPropertyNames.add(EDM_PROPERTY);
olingo4endpointPropertyNames.add(ENDPOINT_HTTP_HEADERS_PROPERTY);
olingo4endpointPropertyNames.add(SERVICE_URI_PROPERTY);
diff --git
a/components/camel-olingo4/camel-olingo4-component/src/test/java/org/apache/camel/component/olingo4/Olingo4RouteTest.java
b/components/camel-olingo4/camel-olingo4-component/src/test/java/org/apache/camel/component/olingo4/Olingo4RouteTest.java
index af9fcd1feb1..2be975ff0bc 100644
---
a/components/camel-olingo4/camel-olingo4-component/src/test/java/org/apache/camel/component/olingo4/Olingo4RouteTest.java
+++
b/components/camel-olingo4/camel-olingo4-component/src/test/java/org/apache/camel/component/olingo4/Olingo4RouteTest.java
@@ -16,6 +16,9 @@
*/
package org.apache.camel.component.olingo4;
+import java.util.HashMap;
+import java.util.Map;
+
import org.apache.camel.CamelExecutionException;
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.test.junit5.CamelTestSupport;
@@ -29,18 +32,29 @@ public class Olingo4RouteTest extends CamelTestSupport {
protected static final String TEST_SERVICE_BASE_URL =
"http://services.odata.org/TripPinRESTierService";
@SuppressWarnings("unchecked")
- protected <T> T requestBody(String endpoint, Object body) throws
CamelExecutionException {
- return (T) template().requestBody(endpoint, body);
+ protected <T> T requestBody(String endpoint, Object body, Map<String,
Object> headers) throws CamelExecutionException {
+ return (T) template().requestBodyAndHeaders(endpoint, body, headers);
}
@Test
public void testRead() {
// Read entity set of the People object
- final ClientEntitySet entities = (ClientEntitySet)
requestBody("direct:readentities", null);
+ final ClientEntitySet entities = (ClientEntitySet)
requestBody("direct:readentities", null, null);
assertNotNull(entities);
assertEquals(20, entities.getEntities().size());
}
+ @Test
+ public void testReadWithQueryParams() {
+ final Map<String, Object> headers = new HashMap<>();
+ headers.put("CamelOlingo4.queryParams", Map.of("$top", "5"));
+
+ // Read entity set of the People object
+ final ClientEntitySet entities = (ClientEntitySet)
requestBody("direct:readentities", null, headers);
+ assertNotNull(entities);
+ assertEquals(5, entities.getEntities().size());
+ }
+
@Override
protected RouteBuilder createRouteBuilder() {
return new RouteBuilder() {