You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@directory.apache.org by "Anthony Dahanne (JIRA)" <ji...@apache.org> on 2012/12/18 15:28:12 UTC
[jira] [Created] (DIRSERVER-1784) Annotations to enable/disable
schemas
Anthony Dahanne created DIRSERVER-1784:
------------------------------------------
Summary: Annotations to enable/disable schemas
Key: DIRSERVER-1784
URL: https://issues.apache.org/jira/browse/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 :
{code}
@EnableSchema( <list of schema to enable> ) and
@DisableSchema( <List of schema to disable> )
{code}
As a workaround, we can use :
{code}
@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" ) );
}
}
{code}
or, even :
{code}
@Before
// simplest way to enable a schema in embedded mode
public void enableNis() throws Exception {
if(!service.getSchemaManager().isEnabled( "nis" ))
{
service.getSchemaManager().enable( "nis" );
}
}
{code}
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 :
http://mail-archives.apache.org/mod_mbox/directory-users/201212.mbox/%3CCAJHJdS9JqW5yNSwgiFohWUxJzEgqf9c-0XP2jr8P14PdTz7X%2BA%40mail.gmail.com%3E
--
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: http://www.atlassian.com/software/jira