[ 
https://issues.apache.org/jira/browse/CXF-8769?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17612136#comment-17612136
 ] 

Andriy Redko edited comment on CXF-8769 at 10/2/22 4:42 PM:
------------------------------------------------------------

So I see two issues here: a) "of" method is not supported by design b) 
`AbstractHelmId` is not used anywhere so its "fromString" method is not 
considered as a candidate for parameter converter.


was (Author: reta):
So I see one issue here: a) "of" method is not supported by design b) 
`AbstractHelmId` is not used anywhere so its "fromString" method is not 
considered as a candidate for parameter converter.

> inherited static method 'fromString(String)' not considered on localTransport
> -----------------------------------------------------------------------------
>
>                 Key: CXF-8769
>                 URL: https://issues.apache.org/jira/browse/CXF-8769
>             Project: CXF
>          Issue Type: Bug
>          Components: JAX-RS, JAX-WS Runtime
>    Affects Versions: 3.5.3
>         Environment: Junit 5
> cxf local transport
>            Reporter: Benjamin Marwell
>            Priority: Major
>
> Hi CXF team!
>  
> h3. Description of the error and code
> I tried to use a local transport for testing my services. However, I have a 
> path and/or query parameter set to something like this:
> {code:java}
> @Path("api")
> public class HelmResource {
>   // body left out for brevity
>   @PUT
>   @Path("helm/{id}/files")
>   public Response putFile(@PathParam("id") HelmId helmId, String entity);
> }
> // important parts of the parameter class
> abstract class AbstractHelmId {
>   // watch the return type!
>   public static HelmId fromString(String id) {
>     return HelmId.of(new UUID(id));
>   }
> }
> @Generated // by immutables.org
> public class HelmId {
>   private final UUID id;
>   // should inherit the fromString(String id) method.
>   public static HelmId of(UUID uuid) {
>     return new HelmId(uuid);
>   }
> }
> {code}
> This works perfectly fine on Open Liberty (which uses CXF), but it does not 
> when using CXF in local test mode. I wrote a Junit5 extension based on your 
> wiki: 
> [https://cwiki.apache.org/confluence/display/CXF20DOC/JAXRS+Testing#JAXRSTesting-LocalTransport]
>  
> h3. Expected behaviour
> HelmId is being read from the path
>  
> h3. Actual behaviour
> {code:java}
> HelmId has no constructor with single String parameter, static 
> valueOf(String) or fromString(String) methods{code}
>  
> h3. Workaround
> Create a ParamConverterProvider and a ParamConverter for all the classes. 
> This eliminates the idea of the integration test though, as the test uses a 
> provider, the production code does not.
>  
> h3. Expected solution
> The error is being thrown here: [cxf/InjectionUtils.java at 
> b6e3ab83a37cfb777d6eebf9711e552027bde37a · apache/cxf 
> (github.com)|https://github.com/apache/cxf/blob/b6e3ab83a37cfb777d6eebf9711e552027bde37a/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/InjectionUtils.java#L526-L535]
> I assume this method must be changed or is not properly called for local 
> transports.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to