Hello Emmanuel,
Thanks a lot for your answer !
Unfortunately, I now encounter new issues...
I had to switch to Apache DS 2.0.0-M8 to compile AND I had to add
apacheds-jdbm 2.0.0-M3 for runtime
<dependency>
<groupId>org.apache.directory.server</groupId>
<artifactId>apacheds-server-integ</artifactId>
<version>${apacheds-server.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.directory.server</groupId>
<artifactId>apacheds-core-integ</artifactId>
<version>${apacheds-server.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.directory.server</groupId>
<artifactId>apacheds-jdbm</artifactId>
<version>2.0.0-M3</version>
<scope>test</scope>
</dependency>
to compile the snippet you gave me :
// The shared LDAP connection
private static LdapConnection connection;
@Before
public void enableNis() throws Exception
{
connection = IntegrationUtils.getAdminConnection(
getService());
Entry nisEntry = connection.lookup( "cn=nis,ou=schema" );
boolean isNisDisabled = nisEntry.contains( "m-disabled", "TRUE" );
// if nis is disabled then enable it
if ( isNisDisabled )
{
connection.modify( "cn=nis,ou=schema", new
DefaultModification( ModificationOperation.REMOVE_ATTRIBUTE,
"m-disabled", "TRUE" ) );
}
}
and I had to change the @BeforeClass into a @Before (non static method),
otherwise the getService() would always return null.
Then, I could verify in the log the NIS schema was enabled :
@Test
public void authenticateAndAuthorizeFromDynamicGroup() throws Exception {
Entry nisEntry = connection.lookup( "cn=nis,ou=schema" );
boolean isNisDisabled = nisEntry.contains( "m-disabled", "TRUE" );
System.out.println("Nis is disabled : "+isNisDisabled);
etc...
would print false (and true if I remove the snippet)
but...
I now have this error
Caused by: org.apache.directory.shared.ldap.model.exception.LdapException:
ERR_04269 ATTRIBUTE_TYPE for OID gidnumber does not exist!
, whenever I add this ldif (in the applyldif annotation) :
"dn: cn=operators,ou=groups,dc=mycompany,dc=com",
"objectClass: posixGroup",
"cn: operators",
"gidNumber: 5000",
"description: Operators Group",
I have copied my test in a pastebin :
http://pastebin.com/BXNP8muU
I have tried several combinations, but whenever I try to load an ldif with
gidNumber, it fails...
Thanks again for your help,
Regards,
Anthony
On Mon, Dec 17, 2012 at 5:49 PM, Emmanuel Lécharny <elecharny@gmail.com>wrote:
> @ApplyLdifs( {
> // the users organizationalUnit
> "dn: ou=users,dc=mycompany,dc=com",
> "objectClass: organizationalUnit",
> "objectClass: top",
> "ou: users",
> "description: Users",
>
> // the groups organizationalUnit
> "dn: ou=groups,dc=mycompany,dc=com",
> "objectClass: organizationalUnit",
> "objectClass: top",
> "ou: groups",
> "description: Groups" })
|