directory-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Anthony Dahanne (JIRA)" <>
Subject [jira] [Created] (DIRSERVER-1784) Annotations to enable/disable schemas
Date Tue, 18 Dec 2012 14:28:12 GMT
Anthony Dahanne created DIRSERVER-1784:

             Summary: Annotations to enable/disable schemas
                 Key: DIRSERVER-1784
             Project: Directory ApacheDS
          Issue Type: Bug
    Affects Versions: 2.0.0-M8
            Reporter: Anthony Dahanne
            Priority: Minor

There is no annotations to enable/disable schemas in integration tests; it would be convenient
to have :
@EnableSchema( <list of schema to enable> ) and
@DisableSchema( <List of schema to disable> )
As a workaround, we can use :
        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" ) );

or, even :

 // simplest way to enable a schema in embedded mode
  public void enableNis() throws Exception  {
      if(!service.getSchemaManager().isEnabled( "nis" ))
          service.getSchemaManager().enable( "nis" );

The problem with this workaround is that if we try to apply an ldif relying on the new schema
in the @ApplyLdif annotation of a test, ApacheDS will fail.
Another workaround is to apply this ldif in the test itself.
More info / code examples in the original mail thread :

This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see:

View raw message