Uploaded image for project: 'Application Server 3  4  5 and 6'
  1. Application Server 3 4 5 and 6
  2. JBAS-4404

Tests testJdbc and testControlFlags in org.jboss.test.security.test.LoginModulesUnitTestCase may fail incorrectly

    XMLWordPrintable

    Details

      Description

      Suites: org.jboss.test.security.test.LoginModulesUnitTestCase, org.jboss.test.security.test.XMLLoginModulesUnitTestCase
      Tests: testJdbc, testControlFlags

      When running these tests with JBoss AS 4.0.5 on the Unisys MCP system, these tests fail as follows:

      junit.framework.AssertionFailedError: Java is a role
      at org.jboss.test.security.test.LoginModulesUnitTestCase.testJdbc(LoginModulesUnitTestCase.java:879)
      and
      junit.framework.AssertionFailedError: Role1 is a role
      at org.jboss.test.security.test.LoginModulesUnitTestCase.testControlFlags(LoginModulesUnitTestCase.java:919)

      There appears to be a bug in the test code. The tests testJdbc and testControlFlags use the org.jboss.security.auth.spi.DatabaseServerLoginModule to query for the roles allowed. However, the call to subject.getPrincipals(Group.class) returns a Set with two groups: "Roles" and "CallerPrincipal". Because a Set is unordered, the iterator for the set may return either "Roles" or "CallerPrincipal" first. However, the test code always just looks at the first group in the Set and assumes it is the "Roles" group. On the MCP, this first group seems to be the "CallerPrincipal" group, so the test assertions fail.

      I updated the test code to find the "Roles" group first before performing the assertions. With this change, the tests pass on both the Unisys MCP and Windows systems.

        Gliffy Diagrams

          Attachments

            Activity

              People

              • Assignee:
                anil.saldhana Anil Saldanha
                Reporter:
                burdeasa Stephen Burdeau
              • Votes:
                0 Vote for this issue
                Watchers:
                0 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: