0 Replies Latest reply on Jul 25, 2014 11:41 AM by Raj Haque

    Arquillian tests are not working after first time following a modifications on the tests.  getting TestResult.setEnd(J)V

    Raj Haque Newbie

      Hi All,  I am using arquillian 1.1.5.Final with suit extension. 

       

      Every time I save the file and run the test, it works. But next time it does not.

      The test fails with :

          Tests in error:

              testDI(test.com.animation2000.integration.filter.SimpleTest): org.jboss.arquillian.test.spi.TestResult.setEnd(J)V

       

      My dependencies are:

       

      <!-- Needed for running tests (you may also use TestNG) -->

        <dependency>

        <groupId>junit</groupId>

        <artifactId>junit</artifactId>

        <version>4.10</version>

        <scope>test</scope>

        </dependency>

       

        <!-- Optional, but highly recommended -->

        <!-- Arquillian allows you to test enterprise code such as EJBs and Transactional(JTA)

        JPA from JUnit/TestNG -->

       

        <dependency>

        <groupId>org.jboss.arquillian.junit</groupId>

        <artifactId>arquillian-junit-container</artifactId>

        <!-- <version>1.0.0.CR7</version> -->

        <version>1.1.5.Final</version>

        <scope>test</scope>

        </dependency>

        <!-- add new for suit -->

        <dependency>

        <groupId>org.jboss.arquillian.protocol</groupId>

        <artifactId>arquillian-protocol-servlet</artifactId>

        <version>1.1.5.Final</version>

        <scope>test</scope>

        </dependency>

        <!-- add new for suit -->

        <dependency>

        <groupId>org.jboss.shrinkwrap.descriptors</groupId>

        <artifactId>shrinkwrap-descriptors-spi</artifactId>

        <!-- <version>1.1.0-alpha-4</version> -->

        <version>2.0.0-alpha-6</version>

        <scope>test</scope>

        </dependency>

        <!-- add new for libs -->

        <dependency>

        <groupId>org.jboss.shrinkwrap.resolver</groupId>

        <artifactId>shrinkwrap-resolver-api</artifactId>

        <version>2.0.0-alpha-6</version>

        <scope>test</scope>

        </dependency>

        <!-- add new for libs -->

        <dependency>

        <groupId>org.jboss.shrinkwrap.resolver</groupId>

        <artifactId>shrinkwrap-resolver-impl-maven</artifactId>

        <version>2.0.0-alpha-6</version>

        <scope>test</scope>

        </dependency>

        <!-- add new for libs -->

        <dependency>

        <groupId>org.jboss.shrinkwrap.resolver</groupId>

        <artifactId>shrinkwrap-resolver-api-maven</artifactId>

        <version>2.0.0-alpha-6</version>

        <scope>test</scope>

        </dependency>

        <!-- add new for suit -->

        <dependency>

        <groupId>org.jboss.arquillian.core</groupId>

        <artifactId>arquillian-core-api</artifactId>

        <version>1.1.5.Final</version>

        <scope>test</scope>

        </dependency>

       

       

      Suit is

       

      package com.animation2000.coreservices.test.suit;

       

       

      import java.io.File;

      import java.util.HashMap;

      import java.util.Map;

       

       

      import org.eu.ingwar.tools.arquillian.extension.suite.annotations.ArquillianSuiteDeployment;

      import org.jboss.arquillian.container.test.api.Deployment;

      import org.jboss.shrinkwrap.api.Archive;

      import org.jboss.shrinkwrap.api.ShrinkWrap;

      import org.jboss.shrinkwrap.api.asset.EmptyAsset;

      import org.jboss.shrinkwrap.api.spec.JavaArchive;

      import org.jboss.shrinkwrap.api.spec.WebArchive;

      import org.jboss.shrinkwrap.resolver.api.maven.Maven;

       

       

      import test.com.animation2000.coreservices.payroll.crud.service.PayrollCRUDServiceTest;

       

       

      import com.animation2000.coreservices.audit.service.GenericAuditService;

      import com.animation2000.coreservices.payroll.crud.service.PayrollCRUDService;

      import com.animation2000.coreservices.util.MiscUtilsSD;

      import com.animation2000.coreservices.util.Resources;

      import com.animation2000.smart.dao.SmartDAO;

       

       

      @ArquillianSuiteDeployment

      public class ArquillianSuitCommon{

       

       

       

       

        @Deployment(name = "Common_Extra", order = 2)

        public static Archive<?> generateDefaultDeployment() {

        return ShrinkWrap.create(JavaArchive.class, "Common_Extra.jar")

        .addClasses(MiscUtilsSD.class,GenericAuditService.class,PayrollCRUDService.class, SmartDAO.class,Resources.class,PayrollCRUDServiceTest.class)

        .addPackages(true,"com.animation2000.coreservices.domain")

        .addPackages(true,"com.animation2000.coreservices.audit")

       

       

        //.addPackage("com.animation2000.coreservices.domain.customized")

        .addPackage("com.animation2000.smart.dao")

        .addPackage("com.animation2000.coreservices.payroll.crud.service")

        .addPackage("com.animation2000.coreservices.payroll.crud.service.test")

        /*.addPackages(true,"com.animation2000")

        .addPackages(true,"uk.gov.govtalk")

        .addPackages(true,"org.w3._2000._09.xmldsig")*/

        .addAsResource("META-INF/persistence.xml", "META-INF/persistence.xml")

       

       

        .addAsManifestResource(EmptyAsset.INSTANCE, "beans.xml");

        // addAsLibraries( 

        //                DependencyResolvers.use(MavenDependencyResolver.class) 

        //            .artifact("org.mockito:mockito-all:1.8.3") 

        //            .resolveAs(GenericArchive.class))  ;

        }

       

       

       

       

        @Deployment(name = "Extra_Extra", order = 1)

        public static Archive<?> generateExtra_ExtraDefaultDeployment() {

        File[] libs = Maven.resolver().loadPomFromFile("pom.xml").importRuntimeAndTestDependencies().asFile();

        Map<File,File>  m= new HashMap<File,File>();

        for(File file : libs){

        m.put(file,file);

        }

       

        WebArchive res = ShrinkWrap.create(WebArchive.class, "Common_Extra_Extra.war");

       

        for(File file : m.keySet()){

        try{

        res.addAsLibrary(file);

        }catch(Exception io){

        io.printStackTrace();

        }

        }      

        res.addClasses(PayrollCRUDServiceTest.class);

        res.addPackages(true,"com.animation2000.coreservices")

        .addPackages(true,"com.animation2000.smart.dao")

        .addPackages(true,"com.animation2000.birt.reports.")

        .addPackages(true,"uk.gov.govtalk")

        .addPackages(true,"org.w3._2000._09.xmldsig")

        .addAsResource("META-INF/persistence.xml", "META-INF/persistence.xml")

        .addAsManifestResource(EmptyAsset.INSTANCE, "beans.xml");

      return res;       

        }

       

      Arquillian

       

      <?xml version="1.0" encoding="UTF-8"?>

      <arquillian xmlns="http://jboss.org/schema/arquillian"

         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

         xsi:schemaLocation="http://jboss.org/schema/arquillian

              http://jboss.org/schema/arquillian/arquillian_1_0.xsd">

       

         <defaultProtocol type="Servlet 3.0" />

         <!-- Uncomment to have test archives exported to the file system for inspection -->

          <engine>

            <property name="maxTestClassesBeforeRestart">200</property>

            <property name="deploymentExportPath">/SDDevelopmentMVN/TEST_temp</property>

          </engine>

       

         <!-- Example configuration for a remote JBoss AS 7 instance -->

         <container qualifier="jboss" default="true">

            <protocol type="jmx-as7">

               <property name="executionType">REMOTE</property>

            </protocol>

            <configuration>

               <property name="jbossHome">/SDDevelopmentMVN/jboss/jbossExternalMVN</property>

            </configuration>

         </container>

       

      </arquillian>

       

       

      The test is:

      <code>

      @RunWith(Arquillian.class)

      public class SimpleTest{

       

      @Inject

        PayrollCRUDService payrollCRUDService;

       

      @BeforeClass

        public static  void setUpClass() throws Exception {

       

        }

       

      @Test

      @OperateOnDeployment("External_Extra_Extra")

        public void testDI() {

        Assert.assertNotNull(" DI not working", payrollCRUDService);

        }

       

      @Test

      @OperateOnDeployment("External_Extra_Extra")

        public void test(){

        PayrollWrapper wrapper = payrollCRUDService.getPayroll("10010");

         Assert.assertTrue("hello","VISTA1".equalsIgnoreCase(wrapper.getPayroll().getAccSoftwareType()));

       

        }

       

      }

      </code>

       

       

      Could some one help me, please. I am completely stuck..

       

       

      Thanks in advance

       

      Message was edited by: Raj Haque This only happening when I am using a deployment with all maven dependencies as it is now in the post.