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-unsubscr...@camel.apache.org

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

Reply via email to