Dhairya-007 commented on PR #29417:
URL: https://github.com/apache/camel/pull/29417#issuecomment-6722924275

   Thanks for the approval @davsclaus — but CI caught that my new test was 
broken, so I have pushed a fix.
   
   `template.requestBody(uri)` with a single argument is the 
`requestBody(Object body)` overload: it sends the URI *as the body* to the 
template's default endpoint. So the test never reached the grpc producer and 
failed with `defaultEndpoint must be specified` instead of the message it 
asserts. The test now resolves the endpoint, creates the producer and starts 
it, which is where the validation actually runs. The URI also needed the 
`grpc://host:port/service` form — I had written `grpc:host:port/service`, which 
parses as an opaque URI.
   
   The production change is untouched.
   
   While fixing it I noticed the three pre-existing cases in the same class 
have the same problem — `emptyHostPort`, `emptyPort` and `invalidPort` all pass 
because `DefaultProducerTemplate` throws `defaultEndpoint must be specified`, 
never because of anything in camel-grpc. I have **not** changed them here, 
because making them real does not look like a clean one-liner:
   
   ```
   grpc:/org.apache.camel.component.grpc.PingPong             opaque=false 
host=null      port=-1  path=/org.apache.camel.component.grpc.PingPong
   grpc:localhost/org.apache.camel.component.grpc.PingPong    opaque=true  
host=null      port=-1  path=null
   grpc:localhost:0/org.apache.camel.component.grpc.PingPong  opaque=true  
host=null      port=-1  path=null
   ```
   
   `emptyHostPort` would genuinely reach `No connection properties (host or 
port) specified`, but the other two parse as opaque URIs with a null path, so 
`GrpcConfiguration.parseURI` would NPE on `uri.getPath().substring(1)` before 
any validation. That looks like a separate question — whether `parseURI` should 
reject an opaque URI with a clear message — so I would rather not fold it into 
this PR. Happy to open a follow-up if you think it is worth one.


-- 
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]

Reply via email to