5 Replies Latest reply on Oct 14, 2010 3:43 AM by Aslak Knutsen

    JUnit example TemperatureConverterTestCase fails with GlassFish remote

    Sivakumar Thyagarajan Newbie

      diff --git a/examples/junit/pom.xml b/examples/junit/pom.xml
      index ca0d70e..bc4a302 100644
      --- a/examples/junit/pom.xml
      +++ b/examples/junit/pom.xml
      @@ -619,6 +619,54 @@
                              </dependencies>
                      </profile>
      -->
      +
      +      <profile>
      +         <id>glassfish-remote</id>
      +         <activation>
      +            <activeByDefault>false</activeByDefault>
      +            <property>
      +               <name>glassfish-remote</name>
      +            </property>
      +         </activation>
      +         <properties>
      +            <glassfish.version>3.1-b09</glassfish.version>
      +         </properties>
      +         <dependencies>
      +            <dependency>
      +               <groupId>org.jboss.arquillian.container</groupId>
      +               <artifactId>arquillian-glassfish-remote-3</artifactId>
      +               <version>${project.version}</version>
      +               <scope>test</scope>
      +            </dependency>
      +            <dependency>
      +               <groupId>org.glassfish.deployment</groupId>
      +               <artifactId>deployment-client</artifactId>
      +               <version>${glassfish.version}</version>
      +               <scope>test</scope>
      +            </dependency>
      +         </dependencies>
      +         <build>
      +            <plugins>
      +               <plugin>
      +                  <groupId>org.apache.maven.plugins</groupId>
      +                  <artifactId>maven-surefire-plugin</artifactId>
      +                  <configuration>
      +                     <test>${test}</test>
      +                     <parallel>none</parallel>
      +                                                       <includes>
      +                                                               <include>com/acme/ejb/*</include>
      +                                                               <include>com/acme/ejb31/*</include>
      +                                                               <include>com/acme/cdi/*</include>
      +                                                               <include>com/acme/cdi/payment/*</include>
      +                                                               <include>com/acme/cdi/random/*</include>
      +                                                               <!-- <include>com/acme/web/*</include>  -->
      +                                                       </includes>
      +                  </configuration>
      +               </plugin>
      +            </plugins>
      +         </build>
      +      </profile>
      +
              </profiles>
          <!-- Dependencies -->
      diff --git a/examples/junit/src/test/resources/arquillian.xml b/examples/junit/src/test/resources/arquillian.xml
      index 3dc40c6..aaaf86d 100644
      --- a/examples/junit/src/test/resources/arquillian.xml
      +++ b/examples/junit/src/test/resources/arquillian.xml
      @@ -2,7 +2,8 @@
      <arquillian xmlns="http://jboss.com/arquillian"
                      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      -               xmlns:weldee="urn:arq:org.jboss.arquillian.container.weld.ee.embedded_1_1">
      +               xmlns:weldee="urn:arq:org.jboss.arquillian.container.weld.ee.embedded_1_1"
      +               xmlns:glassfish="urn:arq:org.jboss.arquillian.container.glassfish.remote_3">
              <weldee:container>
      <!-- Revert until 1.1 Weld is released.. https://jira.jboss.org/browse/ARQ-185
      @@ -10,4 +11,14 @@
      -->           
              </weldee:container>    
      -</arquillian>
      \ No newline at end of file
      +       <glassfish:container>
      +               <glassfish:deploymentUri>deployer:Sun:AppServer::localhost:4848</glassfish:deploymentUri>
      +               <glassfish:deploymentFactoryClass>org.glassfish.deployapi.SunDeploymentFactory</glassfish:deploymentFa
      +               <glassfish:remoteServerAddress>localhost</glassfish:remoteServerAddress>
      +               <glassfish:remoteServerHttpPort>8080</glassfish:remoteServerHttpPort>
      +               <!-- Set if admin password is set 
      +               <glassfish:deploymentUsername>admin</glassfish:deploymentUsername>
      +               <glassfish:deploymentPassword>adminadmin</glassfish:deploymentPassword>
      +               -->
      +       </glassfish:container>
      +</arquillian>
      Hi

       

      The pom.xml in arquillian/examples/junit does not include a profile for arquillian-glassfish-remote-3 by default. I made the attached changes to enable it. However when I run the tests against GlassFish v3 (either b09 or the latest), I see the following failures in TemperatureConverterTestCase.

      $ mvn test -Dtest=com.acme.ejb.TemperatureConverterTestCase -Pglassfish-remote

      ...

      Running com.acme.ejb.TemperatureConverterTestCase

      Tests run: 3, Failures: 0, Errors: 3, Skipped: 0, Time elapsed: 0.029 sec <<< FAILURE!

      ...

      Results :

      Tests in error:

        testConvertToCelsius(com.acme.ejb.TemperatureConverterTestCase)

        testConvertToFarenheit(com.acme.ejb.TemperatureConverterTestCase)

        testIsTransactional(com.acme.ejb.TemperatureConverterTestCase)

       

      The test log indicates that the EJB couldn't be obtained by Arquillian for injection. A lookup is attempted with the application name of test.ear "java:global/test.ear/test/TemperatureConverterBean", but the archive is deployed as "jsr88-7312430501899307848"

      --- snippet from com.acme.ejb.TemperatureConverterTestCase-output.txt --

      12/10/2010 7:53:16 PM org.jboss.arquillian.impl.XmlConfigurationBuilder loadArquillianConfiguration

      INFO: building configuration from XML file: arquillian.xml

      12/10/2010 7:53:16 PM org.jboss.arquillian.impl.XmlConfigurationBuilder matchContainerConfiguration

      WARNING: No container configuration found for URI: java:urn:org.jboss.arquillian.container.weld.ee.embedded_1_1

      12/10/2010 7:53:22 PM org.jboss.arquillian.container.jsr88.remote_1_2.JSR88DeploymentListener handleProgressEvent

      INFO: Deployment of application jsr88-7312430501899307848

      12/10/2010 7:53:23 PM org.jboss.arquillian.container.jsr88.remote_1_2.JSR88DeploymentListener$1 handleProgressEvent

      INFO: Application jsr88-7312430501899307848 enabled successfully

      12/10/2010 7:53:23 PM org.jboss.arquillian.container.jsr88.remote_1_2.JSR88DeploymentListener$1 handleProgressEvent

      INFO: All operations completed successfully

      12/10/2010 7:53:25 PM org.jboss.arquillian.container.jsr88.remote_1_2.JSR88DeploymentListener handleProgressEvent

      INFO: Undeployment of application jsr88-7312430501899307848

      12/10/2010 7:53:25 PM org.jboss.arquillian.container.jsr88.remote_1_2.JSR88DeploymentListener handleProgressEvent

      INFO: All operations completed successfully

      -- snippet from com.acme.ejb.TemperatureConverterTestCase.txt ---

      INFO: Deployment of application jsr88-7312430501899307848

      org.jboss.arquillian.impl.event.FiredEventException: java.lang.RuntimeException: Could not inject members

      at org.jboss.arquillian.impl.event.MapEventManager.fire(MapEventManager.java:68)

      at org.jboss.arquillian.impl.context.AbstractEventContext.fire(AbstractEventContext.java:115)

      at org.jboss.arquillian.impl.EventTestRunnerAdaptor.before(EventTestRunnerAdaptor.java:127)

      at org.jboss.arquillian.junit.Arquillian$4.evaluate(Arquillian.java:206)

      at org.jboss.arquillian.junit.Arquillian$5$1.evaluate(Arquillian.java:225)

      at org.jboss.arquillian.junit.Arquillian$MultiStatementExecutor.execute(Arquillian.java:297)

      at org.jboss.arquillian.junit.Arquillian$5.evaluate(Arquillian.java:221) ...

      at com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:94)

      at com.sun.enterprise.web.PESessionLockingStandardPipeline.invoke(PESessionLockingStandardPipeline.java:87)

      at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:158)

      at org.apache.catalina.connector.CoyoteAdapter.doService(CoyoteAdapter.java:319)

      at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:220)

      at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:166)

      at com.sun.grizzly.http.ProcessorTask.invokeAdapter(ProcessorTask.java:803)

      at com.sun.grizzly.http.ProcessorTask.doProcess(ProcessorTask.java:706)

      at com.sun.grizzly.http.ProcessorTask.process(ProcessorTask.java:987)

      at com.sun.grizzly.http.DefaultProtocolFilter.execute(DefaultProtocolFilter.java:217)

      at com.sun.grizzly.DefaultProtocolChain.executeProtocolFilter(DefaultProtocolChain.java:135)

      at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:102)

      at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:88)

      at com.sun.grizzly.http.HttpProtocolChain.execute(HttpProtocolChain.java:76)

      at com.sun.grizzly.ProtocolChainContextTask.doCall(ProtocolChainContextTask.java:53)

      at com.sun.grizzly.SelectionKeyContextTask.call(SelectionKeyContextTask.java:57)

      at com.sun.grizzly.ContextTask.run(ContextTask.java:69)

      at com.sun.grizzly.util.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:526)

      at com.sun.grizzly.util.AbstractThreadPool$Worker.run(AbstractThreadPool.java:507)

      at java.lang.Thread.run(Thread.java:636)

      Caused by: java.lang.RuntimeException: Could not inject members

      at org.jboss.arquillian.testenricher.ejb.EJBInjectionEnricher.injectClass(EJBInjectionEnricher.java:128)

      at org.jboss.arquillian.testenricher.ejb.EJBInjectionEnricher.enrich(EJBInjectionEnricher.java:50)

      at org.jboss.arquillian.impl.handler.TestCaseEnricher.callback(TestCaseEnricher.java:42)

      at org.jboss.arquillian.impl.handler.TestCaseEnricher.callback(TestCaseEnricher.java:32)

      at org.jboss.arquillian.impl.event.MapEventManager.fire(MapEventManager.java:63)

      ... 50 more

      Caused by: javax.naming.NamingException: No EJB found in JNDI, tried the following names: java:global/test.ear/test/TemperatureConverterBean, java:global/test.ear/test/TemperatureConverter, java:global/test/TemperatureConverter, java:global/test/TemperatureConverterBean, java:global/test/TemperatureConverter/no-interface, test/TemperatureConverterBean/local, test/TemperatureConverterBean/remote, test/TemperatureConverter/no-interface, TemperatureConverterBean/local, TemperatureConverterBean/remote, TemperatureConverter/no-interface,

      at org.jboss.arquillian.testenricher.ejb.EJBInjectionEnricher.lookupEJB(EJBInjectionEnricher.java:162)

      at org.jboss.arquillian.testenricher.ejb.EJBInjectionEnricher.injectClass(EJBInjectionEnricher.java:102)

      ... 54 more

      Could you please help? Is there anyway that I can configure the EJB lookup to use the JSR-88 name?
      Thanks
      --Siva.