org.sonatype.security.ldap.dao.NoLdapUserRolesFoundException: No roles found for user: cstamas

Sonatype JIRA | Peter Lynch | 5 years ago
  1. 0

    I tried adding a unit test to org.sonatype.security.ldap.dao.LdapGroupDAOTest in ldap-common module. Since all the unit test methods are using Junit 4x annotations I assumed these were being used to run the tests. It turns out that this is not forced ( it used to be afaik ) and instead Junit delegates to org.junit.internal.runners.JUnit38ClassRunner instead since in above case depends on AbstractLdapTestEnvironment from https://github.com/sonatype/sisu-ldap-testsuite/tree/plexus-ldap-testsuite-1.4 which extends PlexusTestCase which finally extends Junit 3x TestCase. Surefire decides that Junit 3 runer must be used then. This leads to confusion in writing additional tests and who knows if some test methods are not being run because they are not named properly. {quote} ------------------------------------------------------------------------------- Test set: org.sonatype.security.ldap.dao.LdapGroupDAOTest ------------------------------------------------------------------------------- Tests run: 3, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 2.803 sec <<< FAILURE! testUsingInvalidGroupMemberFormat(org.sonatype.security.ldap.dao.LdapGroupDAOTest) Time elapsed: 0.768 sec <<< ERROR! org.sonatype.security.ldap.dao.NoLdapUserRolesFoundException: No roles found for user: cstamas at org.sonatype.security.ldap.dao.DefaultLdapGroupDAO.getGroupMembership(DefaultLdapGroupDAO.java:86) at org.sonatype.security.ldap.dao.LdapGroupDAOTest.doTestWithGroupMemberFormat(LdapGroupDAOTest.java:79) at org.sonatype.security.ldap.dao.LdapGroupDAOTest.testUsingInvalidGroupMemberFormat(LdapGroupDAOTest.java:48) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at junit.framework.TestCase.runTest(TestCase.java:168) at junit.framework.TestCase.runBare(TestCase.java:134) at junit.framework.TestResult$1.protect(TestResult.java:110) at junit.framework.TestResult.runProtected(TestResult.java:128) at junit.framework.TestResult.run(TestResult.java:113) at junit.framework.TestCase.run(TestCase.java:124) at junit.framework.TestSuite.runTest(TestSuite.java:243) at junit.framework.TestSuite.run(TestSuite.java:238) *at org.junit.internal.runners.JUnit38ClassRunner.run(JUnit38ClassRunner.java:83)* at org.apache.maven.surefire.junit4.JUnit4TestSet.execute(JUnit4TestSet.java:53) at org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:123) at org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:104) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at org.apache.maven.surefire.util.ReflectionUtils.invokeMethodWithArray(ReflectionUtils.java:164) at org.apache.maven.surefire.booter.ProviderFactory$ProviderProxy.invoke(ProviderFactory.java:110) {quote}

    Sonatype JIRA | 5 years ago | Peter Lynch
    org.sonatype.security.ldap.dao.NoLdapUserRolesFoundException: No roles found for user: cstamas

    Root Cause Analysis

    1. org.sonatype.security.ldap.dao.NoLdapUserRolesFoundException

      No roles found for user: cstamas

      at org.sonatype.security.ldap.dao.DefaultLdapGroupDAO.getGroupMembership()
    2. org.sonatype.security
      LdapGroupDAOTest.testUsingInvalidGroupMemberFormat
      1. org.sonatype.security.ldap.dao.DefaultLdapGroupDAO.getGroupMembership(DefaultLdapGroupDAO.java:86)
      2. org.sonatype.security.ldap.dao.LdapGroupDAOTest.doTestWithGroupMemberFormat(LdapGroupDAOTest.java:79)
      3. org.sonatype.security.ldap.dao.LdapGroupDAOTest.testUsingInvalidGroupMemberFormat(LdapGroupDAOTest.java:48)
      3 frames
    3. Java RT
      Method.invoke
      1. sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      2. sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      3. sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      4. java.lang.reflect.Method.invoke(Method.java:597)
      4 frames
    4. JUnit
      TestSuite.run
      1. junit.framework.TestCase.runTest(TestCase.java:168)
      2. junit.framework.TestCase.runBare(TestCase.java:134)
      3. junit.framework.TestResult$1.protect(TestResult.java:110)
      4. junit.framework.TestResult.runProtected(TestResult.java:128)
      5. junit.framework.TestResult.run(TestResult.java:113)
      6. junit.framework.TestCase.run(TestCase.java:124)
      7. junit.framework.TestSuite.runTest(TestSuite.java:243)
      8. junit.framework.TestSuite.run(TestSuite.java:238)
      8 frames