Uploaded image for project: 'Location Based Access Control'
  1. Location Based Access Control
  2. LBAC-26

AOPContextSensitiveTest doesn't support Interceptors without 0-arg constructor

    XMLWordPrintable

Details

    • Bug
    • Status: Closed
    • Should
    • Resolution: Fixed
    • 0.1.0
    • 0.2.0
    • None

    Description

      As in the summary. I was trying to create the tests for LocationSearchAdviser but I was unable to set up the Context, because LocationServiceInterceptorAdvice must be constructed using ctr which requires a set of strings (restricted method names, usage case here). Typically, MethodInterceptors in this project have no constructor, so 0-arg ctr is inferred automatically. LocationServiceInterceptorAdvice features a ctr which requires an argument, so it doesn't have a 0-arg ctr (this interceptor would be useless anyway because the filter would be empty).

      Currently, AOPContextSensitiveTest instantiates the MethodInterceptors using getClassInstance method, so it's not possible to use an interceptor without 0-arg ctr.

      I have a proposal for this issue, included in this PR adding tests of LocationSearchAdviser (refer to AOPContextSensiviteTest, TestWithAOP and tests' @Before method}

      The other solution could be simply including statically the restricted method names into the LocationServiceInterceptorAdvice.

      I've tried to use my solution on other tests (replaced the setInterceptor call with one using an instantiated interceptor) and it seems to work fine.

      Gliffy Diagrams

        Attachments

          Activity

            People

              anuar2k Aleksander W
              anuar2k Aleksander W
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: