7 Replies Latest reply on Nov 24, 2010 3:46 PM by Aslak Knutsen

    Glassfish remote 3: failing test case

    Laird Nelson Apprentice

      Still enough of a rookie with Arquillian that I want to see if this is a Glassfish problem or an Arquillian problem.

       

      The following test case fails.  The deployment ear is deliberately stupid: there is one testCase.jar in its lib directory, containing only the test case class itself (and a META-INF/beans.xml):

       

      @RunWith(Arquillian.class)

      public class TestCase {

       

        @Deployment

        public static EnterpriseArchive createEar() {

          final EnterpriseArchive ear = ShrinkWrap.create(EnterpriseArchive.class, "test.ear");

          assertNotNull(ear);

       

          final JavaArchive testCaseJar = ShrinkWrap.create(JavaArchive.class, "testCase.jar");

          assertNotNull(testCaseJar);

          testCaseJar.addClass(new Object() {}.getClass().getEnclosingClass());

          testCaseJar.addManifestResource(EmptyAsset.INSTANCE, "beans.xml");

          System.out.println(testCaseJar.toString(true));

       

          ear.addLibrary(testCaseJar);

       

          System.out.println(ear.toString(true));

          return ear;

        }

       

        @Inject

        private Gorp bean;

       

        @Test

        public void hi() {

          assertNotNull(this.bean);

        }

       

        public static class SessionScopedBean implements Serializable {

       

          public String sayHi() {

            return "Hi!";

          }

       

        }

       

        @Stateless

        public static class Gorp {

       

          @Inject

          private SessionScopedBean bean;

       

          public String sayHi() {

            return this.bean.sayHi();

          }

       

        }

       

      }

       

      Glassfish 3.1 b30.  The error is a simple assertion failure; the injected Gorp reference is null.


      Best,

      Laird