1 Reply Latest reply: May 23, 2012 1:47 AM by Charlee Chitsuk RSS

    The glassfish-ejb-jar for Arquillian / Glassfish Embedded does not apply.

    Charlee Chitsuk Newbie

      Dear All,

       

      I've tried to learn the Arquillian version 1.0.0.Final by using the Glassfish embedded version 3.1.2. I've create a simple hello world EJB application as the following: -

       

      The Interface

      @Remote
      @WebService
      public interface DummyServiceable {
          @WebMethod
          String greet(@WebParam(name = "name") 
                       final String name);
      }
      

       

       

      The Service

      @Stateless
      @WebService(
              endpointInterface = "com.poc.DummyServiceable",
              serviceName       = "engine/DummyService",
              portName          = "DummyPort"
              )
      public class DummyService implements DummyServiceable {
          @Override
          public String greet(final String name) {
              String result = "Hello " + name; 
              return result;
          }
      

       

       

      The glassfish-ejb-jar.xml (Configured as CONFIDENTIAL)

      <?xml version="1.0" encoding="UTF-8"?>
      <!DOCTYPE glassfish-ejb-jar PUBLIC "-//GlassFish.org//DTD GlassFish Application Server 3.1 EJB 3.1//EN" 
                         "http://glassfish.org/dtds/glassfish-ejb-jar_3_1-1.dtd">
      <glassfish-ejb-jar>
        <enterprise-beans>
          <ejb>
            <ejb-name>DummyService</ejb-name>
            <webservice-endpoint>
              <port-component-name>DummyService</port-component-name>
              <endpoint-address-uri>engine/DummyService/DummyService</endpoint-address-uri>
              <transport-guarantee>CONFIDENTIAL</transport-guarantee>
            </webservice-endpoint>
          </ejb>
        </enterprise-beans>
      </glassfish-ejb-jar>
      

       

       

      The unit test

      @RunWith(Arquillian.class)public class DummyServiceTester {
          @Deployment    public static JavaArchive createDeployment() {
              File file = new File("src/main/resources/META-INF/glassfish-ejb-jar.xml");
              Assert.assertNotNull("The glassfish specific file is not found.", file);
              
              return ShrinkWrap.create(JavaArchive.class, "myapp.jar")
                  .addClass(DummyService.class)
                  .addClass(DummyServiceable.class)
                  .addAsManifestResource(EmptyAsset.INSTANCE, "beans.xml")
                  .addAsManifestResource(file);
          }
          
              
          @EJB
          private DummyServiceable service;
          
          @Test
          public void whenGreet(){
              Assert.assertNotNull("The service is null", this.service);
              String name = "Charlee";
              String expected = "Hello " + name;
              
              String actual = this.service.greet(name);
              
              Assert.assertEquals("The result is unexpected.", expected, actual);
          }
      }
      

       

      By overall, the Arquillian works very well together with Glassfish embedded 3.1.2. Anyhow, the glassfish-ejb-jar.xml does not apply as it is printed at the console as the following: -

       

      INFO: WS00019: EJB Endpoint deployed

      test  listening at address at http://CharleeCh:14080/engine/DummyService/DummyService

       

      I've tried to deploy the ear file to the remote Glassfish 3.1.2 with purpose to ensure that my glassfish-ejb-jar.xml is configured properly. The console shows me as the following: -

       

      [#|2012-04-17T14:07:11.465+0700|INFO|glassfish3.1.2|javax.enterprise.webservices.org.glassfish.webservices|_ThreadID=18;_ThreadName=Thread-2;|

      WS00019: EJB Endpoint deployed

      arquillian-ear-0.0.1-SNAPSHOT  listening at address at https://CharleeCh:4081/engine/DummyService/DummyService|#]

       

      I'm not sure if I'm doing something wrong or not. Could you please help to advise further? Thank you very much for your help in advance. I'm looking forward to hearing from you soon.

       

      Regards,

       

      Charlee Ch.