This is an automated email from the ASF dual-hosted git repository. ffang pushed a commit to branch camel-3.18.x in repository https://gitbox.apache.org/repos/asf/camel.git
The following commit(s) were added to refs/heads/camel-3.18.x by this push: new 44995b07f46 [CAMEL-18960]fix up CxfRsEndpointWithPropertiesTest 44995b07f46 is described below commit 44995b07f46334d3dd27c6754cc028123d378ffd Author: Freeman Fang <freeman.f...@gmail.com> AuthorDate: Fri Jan 20 12:22:02 2023 -0500 [CAMEL-18960]fix up CxfRsEndpointWithPropertiesTest (cherry picked from commit 84702a1da3984840a41f205a30c434a27e855a53) (cherry picked from commit a346af2c3e2fb36bb1942f5b7fe0310aa481b284) --- .../apache/camel/component/cxf/jaxrs/CxfRsEndpoint.java | 4 +++- components/camel-cxf/camel-cxf-spring-rest/pom.xml | 16 ++++++++++++++++ .../component/cxf/spring/jaxrs/CxfRsSpringEndpoint.java | 2 ++ .../cxf/jaxrs/CxfRsEndpointWithPropertiesTest.java | 4 +--- 4 files changed, 22 insertions(+), 4 deletions(-) diff --git a/components/camel-cxf/camel-cxf-rest/src/main/java/org/apache/camel/component/cxf/jaxrs/CxfRsEndpoint.java b/components/camel-cxf/camel-cxf-rest/src/main/java/org/apache/camel/component/cxf/jaxrs/CxfRsEndpoint.java index 09711197e16..778f20e2b2a 100644 --- a/components/camel-cxf/camel-cxf-rest/src/main/java/org/apache/camel/component/cxf/jaxrs/CxfRsEndpoint.java +++ b/components/camel-cxf/camel-cxf-rest/src/main/java/org/apache/camel/component/cxf/jaxrs/CxfRsEndpoint.java @@ -154,6 +154,8 @@ public class CxfRsEndpoint extends DefaultEndpoint implements HeaderFilterStrate public CxfRsEndpoint(Component component, String uri, AbstractJAXRSFactoryBean bean) { super(uri, component); setAddress(bean.getAddress()); + setFeatures(bean.getFeatures()); + setProperties(bean.getProperties()); // Update the sfb address by resolving the properties bean.setAddress(getAddress()); @@ -695,7 +697,7 @@ public class CxfRsEndpoint extends DefaultEndpoint implements HeaderFilterStrate * Set the feature list to the CxfRs endpoint. */ public void setFeatures(List<Feature> features) { - this.features = features; + this.features = new ArrayList<Feature>(features); } public Map<String, Object> getProperties() { diff --git a/components/camel-cxf/camel-cxf-spring-rest/pom.xml b/components/camel-cxf/camel-cxf-spring-rest/pom.xml index 8a27a8831ee..13ccd3a30d8 100644 --- a/components/camel-cxf/camel-cxf-spring-rest/pom.xml +++ b/components/camel-cxf/camel-cxf-spring-rest/pom.xml @@ -298,6 +298,22 @@ </resource> </resources> <plugins> + <!-- generate the attached tests jar --> + <plugin> + <artifactId>maven-jar-plugin</artifactId> + <executions> + <execution> + <goals> + <goal>test-jar</goal> + </goals> + </execution> + </executions> + <configuration> + <excludes> + <exclude>log4j2.properties</exclude> + </excludes> + </configuration> + </plugin> <plugin> <artifactId>maven-surefire-plugin</artifactId> <configuration> diff --git a/components/camel-cxf/camel-cxf-spring-rest/src/main/java/org/apache/camel/component/cxf/spring/jaxrs/CxfRsSpringEndpoint.java b/components/camel-cxf/camel-cxf-spring-rest/src/main/java/org/apache/camel/component/cxf/spring/jaxrs/CxfRsSpringEndpoint.java index 9d6d5515bd7..3697f7816e0 100644 --- a/components/camel-cxf/camel-cxf-spring-rest/src/main/java/org/apache/camel/component/cxf/spring/jaxrs/CxfRsSpringEndpoint.java +++ b/components/camel-cxf/camel-cxf-spring-rest/src/main/java/org/apache/camel/component/cxf/spring/jaxrs/CxfRsSpringEndpoint.java @@ -35,6 +35,8 @@ public class CxfRsSpringEndpoint extends CxfRsEndpoint implements BeanIdAware { public CxfRsSpringEndpoint(Component component, String uri, AbstractJAXRSFactoryBean bean) { super(uri, component); setAddress(bean.getAddress()); + setFeatures(bean.getFeatures()); + setProperties(bean.getProperties()); // Update the sfb address by resolving the properties bean.setAddress(getAddress()); init(bean); diff --git a/components/camel-cxf/camel-cxf-spring-rest/src/test/java/org/apache/camel/component/cxf/jaxrs/CxfRsEndpointWithPropertiesTest.java b/components/camel-cxf/camel-cxf-spring-rest/src/test/java/org/apache/camel/component/cxf/jaxrs/CxfRsEndpointWithPropertiesTest.java index 0d86e25fce9..5f425439f16 100644 --- a/components/camel-cxf/camel-cxf-spring-rest/src/test/java/org/apache/camel/component/cxf/jaxrs/CxfRsEndpointWithPropertiesTest.java +++ b/components/camel-cxf/camel-cxf-spring-rest/src/test/java/org/apache/camel/component/cxf/jaxrs/CxfRsEndpointWithPropertiesTest.java @@ -26,7 +26,6 @@ import org.apache.http.HttpResponse; import org.apache.http.client.methods.HttpGet; import org.apache.http.impl.client.CloseableHttpClient; import org.apache.http.impl.client.HttpClientBuilder; -import org.junit.jupiter.api.Disabled; import org.junit.jupiter.api.Test; import static org.junit.jupiter.api.Assertions.assertEquals; @@ -39,7 +38,6 @@ public class CxfRsEndpointWithPropertiesTest extends AbstractSpringBeanTestSuppo } @Test - @Disabled("Camel 3.0: investigate why this fail") public void testCxfRsBeanWithCamelPropertiesHolder() throws Exception { // get the camelContext from application context CamelContext camelContext = ctx.getBean("camel", CamelContext.class); @@ -50,7 +48,7 @@ public class CxfRsEndpointWithPropertiesTest extends AbstractSpringBeanTestSuppo assertEquals(1, features.size(), "Single feature is expected"); Map<String, Object> endpointProps = testEndpoint.getProperties(); - assertEquals(1, endpointProps.size(), "Single endpoint property is expected"); + assertEquals(2, endpointProps.size(), "two endpoint properties is expected, aKey and beanId"); assertEquals("aValue", endpointProps.get("aKey"), "Wrong property value"); HttpGet get = new HttpGet(testEndpoint.getAddress());