Uploaded image for project: 'EJB 3.0'
  1. EJB 3.0
  2. EJBTHREE-1795

Fix the ChangeXMLUnitTestCase to be more robust

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Major Major
    • 1.1.4
    • 1.1.3
    • testsuite
    • None

      During the current EJB3 1.1.3 release, it was observed that org.jboss.ejb3.test.changexml.ChangeXMLUnitTestCase fails when run with other tests (particularly involving a security/security domain test). Running only this specific testcase gets it passing. The testcase is not very robust, the way it currently is:

      ...
      SecurityClient client = SecurityClientFactory.getSecurityClient();
      client.setSimple("somebody", "password");
      client.login();

      ....

      // bean = jboss metadata
      bean.setSecurityDomain("other");

      // Now this shouldn't work
      try

      { local.doSomething("bad"); }

      catch (EJBAccessException expected)

      { return; }

      throw new RuntimeException("Should not be here!");

      From the comments of this testcase, it appears to be testing that changing to session bean metadata to add a security domain dynamically, works as expected.

      The issue with this is that when this test is run along with other tests, the "other" security domain and the corresponding user/roles properties, which are already loaded as part of some other testcase get picked up. Incidentally, those properties files have the login credentials for "somebody". Effectively, the security authentication succeeds and the method on the bean is successfully invoked. Thus the test failure. Note that when run as a single test, the users/roles properties (for the "other" domain) are not found and hence the EJBAccessException is caught as expected and the test case passes.

      To make this test more robust, here's what has to be done:

      1) Configure a custom unique security domain for this testcase (ex: changexml-security-domain).
      2) Use custom unique users/roles properties file to ensure that these will be picked and not some random/stray property files.

      Both these steps are easy to accomplish in the testcase.

              jaikiran Jaikiran Pai (Inactive)
              jaikiran Jaikiran Pai (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

                Created:
                Updated:
                Resolved: