Hi

I'm building a Test Case that needs to test the case were a new LDAP entry doesn't respect the schema:
  • Don't put a required attribute
  • Include an invalid attribute that is not defined in any of the objectclasses


The problem is that in the first case I'm getting no errors or warnings and in the the second case I'm getting an WARNING in the log saying that the unknown attribute will be ignored. In both cases I was expecting an LDAP error 65 (schema violation) and receive the corresponding NamingException.

Not sure if I'm missing any dependency in my pom.xml file or I'm doing something wrong in the code.

This is the code of my Test Case:

Code:
...
import org.apache.directory.server.core.schema.SchemaInterceptor;
import org.springframework.security.ldap.server.ApacheDSContainer;
...
    @Override
    protected void doSetUp() throws Exception {
        try
        {
            FileUtils.deleteDirectory(WORKING_DIRECTORY);
            
            ldapServer = new ApacheDSContainer("dc=company,dc=org", "classpath:test-server.ldif");
            ldapServer.setWorkingDirectory(WORKING_DIRECTORY);
            ldapServer.setPort(LDAP_PORT);
            ldapServer.getService().setAllowAnonymousAccess(true);
            ldapServer.getService().setAccessControlEnabled(true);
            ldapServer.getService().setShutdownHookEnabled(true);
            
            ldapServer.getService().getInterceptors().add(new SchemaInterceptor());
            ldapServer.afterPropertiesSet(); // This method calls start
        }
        finally
        {
            super.doSetUp();
        }
        
    }

    @Override
    protected void doTearDown() throws Exception {
        try
        {
            if (ldapServer != null) {
                ldapServer.stop();
            }
        }
        finally
        {
            super.doTearDown();
        }
    }

My pom.xml file is:
Code:
		<dependency>
			<groupId>org.apache.directory.server</groupId>
			<artifactId>apacheds-core</artifactId>
			<version>1.5.5</version>
			<scope>test</scope>
		</dependency>
		<dependency>
			<groupId>org.apache.directory.server</groupId>
			<artifactId>apacheds-server-jndi</artifactId>
			<version>1.5.5</version>
			<scope>test</scope>
		</dependency>
		<dependency>
			<groupId>org.springframework.security</groupId>
			<artifactId>spring-security-ldap</artifactId>
			<version>3.1.1.RELEASE</version>
			<scope>test</scope>
		</dependency>
Thank you very much!