0 Replies Latest reply on Sep 20, 2013 7:46 AM by alfonso.mateos

    How to set arquillian.xml with Persistence Extension when deploying an EAR artifact and testing with @RunAsClient

    alfonso.mateos

      Hello everybody,

      I want to run a functional test on my REST API, so I depoy the EAR that contains it this way:

        @Deployment(testable = false)

        public static Archive<?> createDeployment() {

          return ShrinkWrap

              .create(ZipImporter.class, "api-functional-test.ear")

              .importFrom(new File("/Users/alfonso/Desarrollo/eplus/eplus/trunk/epsilon/core/ear/target/epsilon-core.ear")).as(EnterpriseArchive.class);

       

      Then I test it this way:

        @Test

        @RunAsClient

        @UsingDataSet("datasets/person.yml")

        public void testGetEmployeeById() throws Exception {

           ....

      }

      The "api-functional-test.ear" artifact is deployed on JBoss AS 7.2.0.Final, but the testGetEmployeeById method is executed on the client side, i.e. out of my JBoss. So I cannot use @Datasource(<my-jndi-datasource>) nor <property name="defaultDataSource">java:jboss/datasources/EpsilonXADS</property> inside Arquillian because both of them are referring to a JNDI resource that is living inside JBoss, because my tests are running outside of my container. Same thing when I try to use a persistence.xml, this seems expected to be added into the @Deployment method explicitly. Also, if I remove the testable=false key so that it's testable, then it starts compaining about which war inside my EAR should be enriched.

      As a result, tests are ignoring those annotations, as if they didn't exist at all.

      Is there any way to get my client tests using Arquillian Persistence Extension in this situation? Any hint would be useful... I cannot benefit from @CreateSchema neither, for the same reason.

      Thanks in advance ;-)