Uploaded image for project: 'Arquillian'
  1. Arquillian
  2. ARQ-340

mappedName and lookup attributes are ignored for @EJB in jections into test cases, forcing a naming convention on implementations

    Details

    • Type: Bug
    • Status: Closed (View Workflow)
    • Priority: Major
    • Resolution: Done
    • Affects Version/s: 1.0.0.Alpha4
    • Fix Version/s: 1.0.0.Alpha5
    • Component/s: Runtime Enricher SPI
    • Labels:
      None
    • Environment:
      JRE 1.6.0.21 windows xp jboss embedded 6
    • Steps to Reproduce:
      Hide

      download attached maven project. using maven 3, issue "mvn clean install" to run the build + tests. watch the fireworks

      Show
      download attached maven project. using maven 3, issue "mvn clean install" to run the build + tests. watch the fireworks
    • Workaround Description:
      Hide

      As a workaround, use:

      @Resource(mappedName="java://some/some/ejb") MyInterface ejb;

      or use manual lookup:

      new InitialContext().lookup("java://some/some/ejb")

      Show
      As a workaround, use: @Resource(mappedName="java://some/some/ejb") MyInterface ejb; or use manual lookup: new InitialContext().lookup("java://some/some/ejb")

      Description

      suppose i have an interface called BeanInterface, which is a local interface implemented a class called BeanImplementation.
      then, in my test case, i have the following in ijected field:

      @EJB(mappedName = "java:global/test/BeanImplementation/local")
      private BeanInterface bean;

      this will fail because the enricher does not bother looking at the annotation attributes. specifically, as can be seen in EJBInjectionEnricher.java line 102, the code does not pass the Field itself to the lookup method, only its name. the lookup method then proceeds to try several JNDI naming alternatives (line 137).

      this means that production classes are forced to adhere to the naming conventions used by arquillian code or tests fail.

      the code in question could take into account the mappedName and/or lookup attributes of @EJB to allow developers to specify the JNDI name for the lookup.

        Gliffy Diagrams

          Issue Links

            Activity

            Hide
            hatchetman82 Radai Rosenblatt added a comment -

            maven project failing tests because @EJB attributes are ignored

            Show
            hatchetman82 Radai Rosenblatt added a comment - maven project failing tests because @EJB attributes are ignored
            Hide
            shpandrak Amit Lieberman added a comment -

            This is very important as it makes Arquillian irrelevant for testing our project

            Show
            shpandrak Amit Lieberman added a comment - This is very important as it makes Arquillian irrelevant for testing our project
            Hide
            vbndeveloper vbndeveloper added a comment -

            This is critical for our testing as well. Arquillian is useless to us without being able to reuse our JNDI deployment mappings.

            Show
            vbndeveloper vbndeveloper added a comment - This is critical for our testing as well. Arquillian is useless to us without being able to reuse our JNDI deployment mappings.
            Hide
            aslak Aslak Knutsen added a comment -

            pushed upstream master

            Show
            aslak Aslak Knutsen added a comment - pushed upstream master

              People

              • Assignee:
                dallen6 David Allen
                Reporter:
                hatchetman82 Radai Rosenblatt
              • Votes:
                4 Vote for this issue
                Watchers:
                3 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:

                  Development