1 Reply Latest reply on Dec 2, 2013 2:05 PM by kcbabo

    Arquillian testing of a single Service in a war

    burmanm

      Hi,

       

      How does one test one service in Arquillian with war deployment? The provided examples of Arquillian deployments are copying the whole package to the container, which is something I don't want, as I want to test with different settings (such as different persistence.xml to enable query logging and different DataSource file for H2).

       

      I have following structure for this example service:

       

      RESTEasyGateway + CustomComposer -> Service, which calls with @Inject a @Stateless bean which has @PersistenceContext. Testing the EJB & Persistence works fine with Arquillian, however trying to test the whole call from the start to the end (sort of like integration testing) proves problematic.

       

      Trying to deploy AS war with the following properties:

       

      
      
      
          
      return ShrinkWrap.create(WebArchive.class, "routingServiceTest.war")
      
      
                  
      .addClasses(RoutingModifier.class, RoutingDao.class, Operator.class, RoutingModifier_.class, Operator_.class, 
      
      
                 
      
      
       RoutingService.class, SearchCriteria.class, RoutingComposer.class, RoutingServiceBean.class)
      
      
                  
      .addAsResource("META-INF/dev-persistence.xml", "META-INF/persistence.xml")
      
      
                  
      .addAsWebInfResource("META-INF/switchyard-routingservice.xml")
      
      
                  
      .addAsWebInfResource(EmptyAsset.INSTANCE, "beans.xml")
      
      
                  
      .addAsWebInfResource("test-ds.xml");
      
      
      
      
      
      

       

      Goes quite far, but in the end I get the following error:

       

      Caused by: java.lang.ClassNotFoundException: org.switchyard.component.resteasy.composer.RESTEasyMessageComposer

       

      Target is EAP 6.1.0 + SwitchYard 1.1 (the app works fine when deployed normally). Maybe this is more related to the WAR deployment style, but the deployment page had nothing special.

        • 1. Re: Arquillian testing of a single Service in a war
          kcbabo

          This isn't something we've tried before. As you mentioned, the current examples demonstrating Arquillian with SY use remote deployment and include a complete deployment as part of the test.  We are going to look at deeper integration with Arquillian as part of SwitchYard 2.x, so if you have requests or feedback beyond what you mentioned here, please let us know.