This is an automated email from the ASF dual-hosted git repository. zhfeng pushed a commit to branch camel-3.x in repository https://gitbox.apache.org/repos/asf/camel.git
The following commit(s) were added to refs/heads/camel-3.x by this push: new 2aa5d752005 CAMEL-19150: camel-olingo4 - Fix missing olingo4 endpoint property names (#9570) 2aa5d752005 is described below commit 2aa5d7520052e624498728cfff1117624a20436f Author: Zheng Feng <zh.f...@gmail.com> 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 3036f16aecf..4b81ed40167 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 @@ -167,7 +167,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() {