gnodet-bot commented on code in PR #31084:
URL: https://github.com/apache/camel/pull/31084#discussion_r4728802707
##########
components/camel-cxf/camel-cxf-rest/src/test/java/org/apache/camel/component/cxf/jaxrs/CxfRsEndpointTest.java:
##########
@@ -120,6 +123,44 @@ public void testCxfRsEndpointSetProvider() throws
Exception {
}
}
+ @Test
+ public void testCxfRsEndpointProvidersBeanIds() throws Exception {
+ JSONProvider<?> jsonProvider = new JSONProvider<>();
+ JAXBElementProvider<?> xmlProvider = new JAXBElementProvider<>();
+ context.getRegistry().bind("jsonProvider", jsonProvider);
+ context.getRegistry().bind("xmlProvider", xmlProvider);
+
+ String endpointUri = "cxfrs://http://localhost:" + CTX + ""
+ +
"?resourceClass=org.apache.camel.component.cxf.jaxrs.testbean.CustomerService"
+ + "&providers=#jsonProvider,#xmlProvider";
Review Comment:
💡 **Nit:** `+ ""` is a no-op — the empty string concatenation is likely a
copy-paste artifact from an existing test.
```suggestion
String endpointUri = "cxfrs://http://localhost:" + CTX
+
"?resourceClass=org.apache.camel.component.cxf.jaxrs.testbean.CustomerService"
+ "&providers=#jsonProvider,#xmlProvider";
```
##########
components/camel-cxf/camel-cxf-rest/src/test/java/org/apache/camel/component/cxf/jaxrs/CxfRsEndpointTest.java:
##########
@@ -120,6 +123,44 @@ public void testCxfRsEndpointSetProvider() throws
Exception {
}
}
+ @Test
+ public void testCxfRsEndpointProvidersBeanIds() throws Exception {
+ JSONProvider<?> jsonProvider = new JSONProvider<>();
+ JAXBElementProvider<?> xmlProvider = new JAXBElementProvider<>();
+ context.getRegistry().bind("jsonProvider", jsonProvider);
+ context.getRegistry().bind("xmlProvider", xmlProvider);
+
+ String endpointUri = "cxfrs://http://localhost:" + CTX + ""
+ +
"?resourceClass=org.apache.camel.component.cxf.jaxrs.testbean.CustomerService"
+ + "&providers=#jsonProvider,#xmlProvider";
+
+ // as in a route, the context creates the endpoint with the generated
configurer and starts it
+ CxfRsEndpoint endpoint = context.getEndpoint(endpointUri,
CxfRsEndpoint.class);
+ JAXRSServerFactoryBean sfb = endpoint.createJAXRSServerFactoryBean();
+ assertEquals(List.of(jsonProvider, xmlProvider), sfb.getProviders(),
"Get wrong providers");
+ JAXRSClientFactoryBean cfb = endpoint.createJAXRSClientFactoryBean();
+ assertEquals(List.of(jsonProvider, xmlProvider), cfb.getProviders(),
"Get wrong providers");
+ }
+
+ @Test
+ public void testCxfRsEndpointProvidersListBean() throws Exception {
+ JSONProvider<?> jsonProvider = new JSONProvider<>();
+ JAXBElementProvider<?> xmlProvider = new JAXBElementProvider<>();
+ context.getRegistry().bind("myProviders", List.of(jsonProvider,
xmlProvider));
+
+ String endpointUri = "cxfrs://http://localhost:" + CTX + ""
+ +
"?resourceClass=org.apache.camel.component.cxf.jaxrs.testbean.CustomerService"
+ + "&providers=#myProviders";
Review Comment:
💡 **Nit:** Same `+ ""` no-op as above.
```suggestion
String endpointUri = "cxfrs://http://localhost:" + CTX
+
"?resourceClass=org.apache.camel.component.cxf.jaxrs.testbean.CustomerService"
+ "&providers=#myProviders";
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]