You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by "JiriOndrusek (via GitHub)" <gi...@apache.org> on 2024/01/26 15:55:16 UTC

[PR] CXF-SOAP: Cover possible regression prior CXF fix causing indefinitive hang [camel-quarkus]

JiriOndrusek opened a new pull request, #5685:
URL: https://github.com/apache/camel-quarkus/pull/5685

   fixes https://github.com/apache/camel-quarkus/issues/5682
   
   <!-- Uncomment and fill this section if your PR is not trivial
   [ ] An issue should be filed for the change unless this is a trivial change (fixing a typo or similar). One issue should ideally be fixed by not more than one commit and the other way round, each commit should fix just one issue, without pulling in other changes.
   [ ] Each commit in the pull request should have a meaningful and properly spelled subject line and body. Copying the title of the associated issue is typically enough. Please include the issue number in the commit message prefixed by #.
   [ ] The pull request description should explain what the pull request does, how, and why. If the info is available in the associated issue or some other external document, a link is enough.
   [ ] Phrases like Fix #<issueNumber> or Fixes #<issueNumber> will auto-close the named issue upon merging the pull request. Using them is typically a good idea.
   [ ] Please run mvn process-resources -Pformat (and amend the changes if necessary) before sending the pull request.
   [ ] Contributor guide is your good friend: https://camel.apache.org/camel-quarkus/latest/contributor-guide.html
   -->


-- 
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: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] CXF-SOAP: Cover possible regression prior CXF fix causing indefinitive hang [camel-quarkus]

Posted by "jamesnetherton (via GitHub)" <gi...@apache.org>.
jamesnetherton commented on code in PR #5685:
URL: https://github.com/apache/camel-quarkus/pull/5685#discussion_r1474387842


##########
integration-test-groups/cxf-soap/cxf-soap-ws-security-client/src/test/java/org/apache/camel/quarkus/component/cxf/soap/wss/client/it/CxfSoapWssClientTest.java:
##########
@@ -86,6 +99,57 @@ void wsdlUpToDate() throws IOException {
             Assertions.fail("The static WSDL copy in " + staticCopyPath
                     + " went out of sync with the WSDL served by the container. The content was updated by the test, you just need to review and commit the changes.");
         }
+    }
+
+    /**
+     * In case of the wrong security configuration and before this
+     * <a href="https://github.com/jboss-fuse/cxf/pull/496">fix<a/>
+     * in CXF (can be simulated on camel-quarkus tag 3.0.0-RC2), the client would hang indefinitely.
+     * This tests covers such wrong configuration and verifies that no regression causing indefinite hang is present in
+     * the current code.
+     */
+    @Test
+    @DisabledOnIntegrationTest("Test doesn't have native part, no server for SayHello.wsdl exists")
+    public void testWrongClientNotHanging() {
 
+        Awaitility.await().atMost(30, TimeUnit.SECONDS).pollInterval(10, TimeUnit.SECONDS).until(() -> {
+            try {
+                //always fails because there is no server implementation
+                createSayHelloWrongClient().sayHelloWrong("Sheldon");
+            } catch (SOAPFaultException e) {
+                return "Connection refused".equals(e.getMessage());
+            }
+            //can not happen (client does not work)
+            return false;
+        });
     }
+
+    SayHelloWrongWS createSayHelloWrongClient() {
+
+        final URL serviceUrl = Thread.currentThread().getContextClassLoader().getResource("wsdl/HelloWorld.wsdl");
+        final Service service = Service.create(serviceUrl, SayHelloService.SERVICE);
+
+        SayHelloWrongWS port = service.getPort(SayHelloWrongWS.class);
+        BindingProvider bp = (BindingProvider) port;
+
+        Map<String, Object> requestContext = bp.getRequestContext();
+
+        //non-existing server url is used
+        requestContext.put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY,
+                String.format("http://localhost:%d/soapservice/sayHelloWrong", AvailablePortFinder.getNextAvailable()));

Review Comment:
   Nitpick - if we don't actually care about the server URL, can we just hard code the port to any value? If so we can remove the dependency on `camel-test-junit5`.
   
   



-- 
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: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] CXF-SOAP: Cover possible regression prior CXF fix causing indefinitive hang [camel-quarkus]

Posted by "jamesnetherton (via GitHub)" <gi...@apache.org>.
jamesnetherton commented on PR #5685:
URL: https://github.com/apache/camel-quarkus/pull/5685#issuecomment-1921224172

   @JiriOndrusek do you mind rebasing on latest `main` just to check it with the latest upgrades.
   
   I left an optional nitpick comment too.


-- 
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: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] CXF-SOAP: Cover possible regression prior CXF fix causing indefinitive hang [camel-quarkus]

Posted by "JiriOndrusek (via GitHub)" <gi...@apache.org>.
JiriOndrusek commented on code in PR #5685:
URL: https://github.com/apache/camel-quarkus/pull/5685#discussion_r1474549753


##########
integration-test-groups/cxf-soap/cxf-soap-ws-security-client/src/test/java/org/apache/camel/quarkus/component/cxf/soap/wss/client/it/CxfSoapWssClientTest.java:
##########
@@ -86,6 +99,57 @@ void wsdlUpToDate() throws IOException {
             Assertions.fail("The static WSDL copy in " + staticCopyPath
                     + " went out of sync with the WSDL served by the container. The content was updated by the test, you just need to review and commit the changes.");
         }
+    }
+
+    /**
+     * In case of the wrong security configuration and before this
+     * <a href="https://github.com/jboss-fuse/cxf/pull/496">fix<a/>
+     * in CXF (can be simulated on camel-quarkus tag 3.0.0-RC2), the client would hang indefinitely.
+     * This tests covers such wrong configuration and verifies that no regression causing indefinite hang is present in
+     * the current code.
+     */
+    @Test
+    @DisabledOnIntegrationTest("Test doesn't have native part, no server for SayHello.wsdl exists")
+    public void testWrongClientNotHanging() {
 
+        Awaitility.await().atMost(30, TimeUnit.SECONDS).pollInterval(10, TimeUnit.SECONDS).until(() -> {
+            try {
+                //always fails because there is no server implementation
+                createSayHelloWrongClient().sayHelloWrong("Sheldon");
+            } catch (SOAPFaultException e) {
+                return "Connection refused".equals(e.getMessage());
+            }
+            //can not happen (client does not work)
+            return false;
+        });
     }
+
+    SayHelloWrongWS createSayHelloWrongClient() {
+
+        final URL serviceUrl = Thread.currentThread().getContextClassLoader().getResource("wsdl/HelloWorld.wsdl");
+        final Service service = Service.create(serviceUrl, SayHelloService.SERVICE);
+
+        SayHelloWrongWS port = service.getPort(SayHelloWrongWS.class);
+        BindingProvider bp = (BindingProvider) port;
+
+        Map<String, Object> requestContext = bp.getRequestContext();
+
+        //non-existing server url is used
+        requestContext.put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY,
+                String.format("http://localhost:%d/soapservice/sayHelloWrong", AvailablePortFinder.getNextAvailable()));

Review Comment:
   I understand your point. I used the next available port just to be sure that the port is really not used. Maybe it is not necessary. I'll remove the dependency and hardcode a fixed value



-- 
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: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] CXF-SOAP: Cover possible regression prior CXF fix causing indefinitive hang [camel-quarkus]

Posted by "JiriOndrusek (via GitHub)" <gi...@apache.org>.
JiriOndrusek commented on PR #5685:
URL: https://github.com/apache/camel-quarkus/pull/5685#issuecomment-1921589075

   PR is rebased the dependency `camel-test-junit5` removed


-- 
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: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] CXF-SOAP: Cover possible regression prior CXF fix causing indefinitive hang [camel-quarkus]

Posted by "zhfeng (via GitHub)" <gi...@apache.org>.
zhfeng merged PR #5685:
URL: https://github.com/apache/camel-quarkus/pull/5685


-- 
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: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org