Uploaded image for project: 'DeltaSpike'
  1. DeltaSpike
  2. DELTASPIKE-736

MockAwareInjectionTargetWrapper breaks interceptors in unit tests

VotersWatch issueWatchersLinkCloneUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments
    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 1.0.3
    • 1.1.0
    • TestControl
    • None
    • OpenWebBeans 1.2.6

    Description

      The automatic usage of MockAwareInjectionTargetWrapper breaks method-level interceptors under OWB:

      org.apache.webbeans.config.BeansDeployer#validate creates the interceptor stack of all beans while validating the deployment (Line 474). This code depends on owbBean.getProducer() returning an AbstractProducer (Line 462).

      TestControl replaces that AbstractProducer in some circumstances with an instance of MockAwareInjectionTargetWrapper, completely deactivating the if-branch which would active the interceptors.

      It seems that, depending where the interceptor binding is defined on the intercepted bean, interceptors work or don't work: using the annotation on the class level results in getProducer returning a AbstractProducer -> interceptors work. Defining interceptors only on methods shows the broken behaviour described here.

      Attachments

        1. ds-736-demo.tgz
          3 kB
          Ronald Steininger

        Activity

          This comment will be Viewable by All Users Viewable by All Users
          Cancel

          People

            gpetracek Gerhard Petracek
            rsteininger Ronald Steininger
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Slack

                Issue deployment