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

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

    XMLWordPrintable

Details

    • Feature Request
    • Resolution: Unresolved
    • Major
    • None
    • None
    • None
    • 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.

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              meetoblivion_jira John Ament (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated: