8 Replies Latest reply on Apr 6, 2015 10:07 AM by Keith Babo

    Test support on SwitchYard

    Tomohisa igarashi Master

      I just revisted SwitchYardTestKit and Arquillian to know what we have today there, what is the problem and a few ideas for improvement. I'd like to start a discussion from here about how we can improve those test environment for SwitchYard 2.x. Any comment would be appreciated!

       

      • Unit tests (SwitchYardTestKit and embedded SwitchYard runtime)
        • What we have today
          • SwitchYardTestKit supports to run a unit test against embedded SwitchYard runtime
          • Limited container resources are provided by mixins like NamingMixIn and TransactionMixIn
          • Currently it's used in each component test and the quickstart test except JCA gateway
          • It also can be used for application unit test
        • Problems
          • It cannot test the application which needs AS7 container resources like JCA or EJB
        • Ideas for improvement
          • Create a JavaEEMixIn with using embedded AS7 to just provide JavaEE resources to the unit test

            • just boot up the embedded AS7 separately and then SwitchYardTestKit starts the embedded SwitchYard like it does today. No SwitchYard subsystem.

            • Testing with the exact version of AS7/EAP still should be placed in release repo

               

      • Integration tests (Arquillian and real AS7 container)
        • What we have today
          • Full JavaEE container resources are provided by AS7 through Arquillian

          • It needs AS7/EAP installation with SwitchYard subsystem eneabled

          • It was only used to test the quickstarts deployment against real AS7 container before, but now it also includes functional tests for the JCA gateway

        • Problems
          • Since a AS7/EAP installation with SwitchYard subsystem enabled is required, quickstart repo also needs to depend on release repo if we would use arquillian for the quickstart test

          • Arquillian start/stop the AS7/EAP container every time for each test, which makes test phase slower

          • Almost no support tool for the application integration tests. User would need to create SwitchYard archive from scratch and use arquillian-jbossas-remote if the application needs AS7 container resources

          • Arquillian CDI injection doesn't work if the SwitchYard application has Bean Service

            • System wide resource like ServiceContainer injected by MSCEnricher or JNDI resource can be injected once testable archive is deployed, but no way to have CDI beans injected into test class since it's application scoped. (This test fails at L87: https://github.com/igarashitm/release/commit/992343d9e2057719da8e819a0e8eaade37775bf0)

              Apparently this is MSCEnricher specific problem - MSCEnricher is using @Inject for the ServiceContainer while it's not a CDI bean

          • No mock up capability like SwitchYardTestKit has

          • ShrinkwrapUtil is digging into maven local repository to find an artifact

        • Ideas for improvement
          • Use jboss-as:start/jboss-as:shutdown goal to keep AS7 instance running during all test executions, and then use AS7 remote adapter instad of managed. It elliminates start/stop for each test

          • Provide a support tool for the application developer who would like to test their SwitchYard application against existing AS7/EAP container through arquillian

            • utility of creating SY jar/war/ear (maybe with using ShrinkWrap maven resolver)

          • Provide a component/gateway mock up tool which supports hot swapping of ExchangeHandler like SwitchYardTestKit does, but works in the real container

          • ShrinkWrap maven resolver may improve the way to resolve an artiafct by ShrinkWrapUtil