Uploaded image for project: 'CDI TCK'
  1. CDI TCK
  2. CDITCK-221

Synchronization bug in test<X>ScopeActiveDuringCallToEjbTimeoutMethod tests

This issue belongs to an archived project. You can view it, but you can't modify it. Learn more

    XMLWordPrintable

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Done
    • 1.0.4.Final
    • 1.0.5.CR1, 1.1.0.Alpha1
    • Tests
    • None

    Description

      Waiting on either climbed or descended just tests that the timeout method was entered but does not guarantee the end of the method was reached and the proper state was set in the other variables. These tests will occasionally fail for this timing issue.

      Though not fancy, this kind of synchronization can work. We just need to move these variables to the end of the timeout method. That will guarantee that when either climbed or descended are set to true the other variables are also in a testable state.

      @Timeout
         public void timeout(Timer timer)
         {
            if (beanManager.getContext(ApplicationScoped.class).isActive())
            {
               applicationScopeActive = true;
               if (beanId > 0.0)
               {
                  if (beanId == simpleApplicationBeanInstance.get().getId())
                  {
                     sameBean = true;
                  }
               }
               else
               {
                  beanId = simpleApplicationBeanInstance.get().getId();
               }
            }
      
            // applicationScopeActive, beanId and sameBean have been set and are testable
            if (timer.getInfo().equals(CLIMB_COMMAND))
            {
               climbed = true;
            }
            if (timer.getInfo().equals(DESCEND_COMMAND))
            {
               descended = true;
            }
         }
      

      Attachments

        Issue Links

          Activity

            People

              mkouba@redhat.com Martin Kouba
              dblevins_jira David Blevins (Inactive)
              Archiver:
              rhn-support-abdwived Abhishek Dwivedi (Inactive)

              Dates

                Created:
                Updated:
                Resolved:
                Archived: