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

Create an extension that allows users to specify CDI context active for a test.

    Details

    • Type: Feature Request
    • Status: Open (View Workflow)
    • Priority: Major
    • Resolution: Unresolved
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: None
    • Labels:
      None

      Description

      I've seen the need for this to pop up in several places - at work, in SO questions, in email threads, and I think it would be ideal to handle as a new Arquillian Extension. Right now, Arquillian is dependent on the app server to manage context and typically the context activated is whatever the app server finds as appropriate. This works OK for servlet based containers since a RequestScope will be active, but for local, embedded (non servlet) or even JMX protocol based containers this doesn't work.

      Ideally, a developer would be able to annotate a test method:

      @ActiveContext(ValidScope.class)

      Where ValidScope.class is a CDI scope (RequestScoped, SessionScoped.. etc) that can be activated. The extension would then activate this scope for the duration of the test, allowing injection of appropriately scoped objects to be injected correctly.

      Perhaps this annotation can also be class level, applying to everything in that class.

        Gliffy Diagrams

          Attachments

            Issue Links

              Activity

                People

                • Assignee:
                  Unassigned
                  Reporter:
                  meetoblivion John Ament
                • Votes:
                  0 Vote for this issue
                  Watchers:
                  2 Start watching this issue

                  Dates

                  • Created:
                    Updated: