Uploaded image for project: 'Isis'
  1. Isis
  2. ISIS-1229

Calling nextRequest() in an integration test should clear any @RequestScoped services.

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: core-1.8.0
    • Fix Version/s: 1.10.0
    • Component/s: Core
    • Labels:
      None

      Description

      Raised by Oscar:
      Related with this, I’m trying to test the following:

      @Test
      public void totalOrRatio() {

      // given
      kit.assignToPerson(account.getAccountOwner());

      this.nextRequest();

      kit.getRegisteredForPerson().setSex(Sex.Man);

      ….
      }

      Where the Kit.getRegisteredForPerson() is cached:

      // {{ RegisteredForPerson (property)
      @Property(editing = Editing.DISABLED, notPersisted = true)
      @MemberOrder(sequence = "1")
      public Person getRegisteredForPerson() {
      return this.queryResultsCache.execute(new Callable<Person>() {
      @Override
      public Person call() throws Exception

      { return Kit.this.findRegisteredToPerson(); }

      }, this.getClass(), "findRegisteredToPerson");
      }

      // }}

      Despite invoking “this.nextRequest()” on the integtest, seems that the cache is still alive (being it a @RequestScoped service).

      Would this also need to be improved for testing @RequestScoped services?

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              danhaywood Dan Haywood
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: