Testing with RESTEasy binding in SwitchYard works only sometimes

Solution Verified - Updated -

Environment

  • Red Hat JBoss Fuse Service Works (FSW)
    • 6.0
  • Red Hat JBoss Fuse (Fuse)
    • 6.2

Issue

  • I have constructed a JUnit test with the SwitchYardRunner to test my application.
  • The application consists of a bean and two services: One WSDL service with SOAP binding and one Java service with RESTEasy binding. Both services are working by being tested with SOAP-UI.
  • Now I have created a test case to verify both service gateways. When running the JUnit test it fails most of the time by running into a timeout:

    2015-08-13 14:05:26,897 WARN  [Thread-10] [org.apache.camel.component.direct.DirectProducer] - No consumers available on endpoint: Endpoint[direct://%7Burn:com.example.integration:my-service:1.0%7DMyServiceResource] to process: Exchange[Message:com.example.integration.services.ValidateTokenRequest@5c57cb28]
    2015-08-13 14:10:26,885 WARN  [Thread-10] [org.jboss.resteasy.plugins.server.sun.http.ResteasyHttpHandler] - WTF!
    org.jboss.resteasy.spi.UnhandledException: org.switchyard.component.common.DeliveryException: SWITCHYARD034508: Timed out waiting on OUT Exchange message.
    
  • That means if I run one and the same test case serveral times, it is not predictable how often it will work ("JUnit Green") or runs into the timeout, but it fails more than success.

Resolution

This is a bug in SwitchYard RESTEasy binding and Test Kit: ENTESB-3916 and BZ-1258693

One possible workaround is to have only one test method per a test case/RESTEasy endpoint, combining all test assertions from multiple methods into a single method. This should at least keep the coverage of the assertions in the tests as well as not block the automated build pipeline.

This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.