You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by el...@apache.org on 2010/05/27 10:08:45 UTC
svn commit: r948711 [4/7] - in /directory:
apacheds/trunk/core-api/src/test/java/org/apache/directory/server/core/entry/
apacheds/trunk/core-avl/src/main/java/org/apache/directory/server/core/avltree/
apacheds/trunk/core-integ/src/test/java/org/apache/...
Modified: directory/apacheds/trunk/core/src/test/java/org/apache/directory/server/core/schema/SchemaCheckerTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core/src/test/java/org/apache/directory/server/core/schema/SchemaCheckerTest.java?rev=948711&r1=948710&r2=948711&view=diff
==============================================================================
--- directory/apacheds/trunk/core/src/test/java/org/apache/directory/server/core/schema/SchemaCheckerTest.java (original)
+++ directory/apacheds/trunk/core/src/test/java/org/apache/directory/server/core/schema/SchemaCheckerTest.java Thu May 27 08:08:44 2010
@@ -31,9 +31,9 @@ import java.util.Map;
import org.apache.directory.shared.ldap.entry.DefaultEntry;
import org.apache.directory.shared.ldap.entry.DefaultEntryAttribute;
+import org.apache.directory.shared.ldap.entry.Entry;
import org.apache.directory.shared.ldap.entry.EntryAttribute;
import org.apache.directory.shared.ldap.entry.ModificationOperation;
-import org.apache.directory.shared.ldap.entry.Entry;
import org.apache.directory.shared.ldap.exception.LdapException;
import org.apache.directory.shared.ldap.exception.LdapSchemaViolationException;
import org.apache.directory.shared.ldap.message.ResultCodeEnum;
@@ -66,7 +66,7 @@ public class SchemaCheckerTest
@BeforeClass
public static void setUp() throws Exception
{
- String workingDirectory = System.getProperty( "workingDirectory" );
+ String workingDirectory = System.getProperty( "workingDirectory" );
if ( workingDirectory == null )
{
@@ -104,7 +104,8 @@ public class SchemaCheckerTest
modifyAttributes.put( new DefaultEntryAttribute( atCN ) );
// this should pass
- SchemaChecker.preventStructuralClassRemovalOnModifyReplace( schemaManager.getObjectClassRegistry(), name, mod, modifyAttributes );
+ SchemaChecker.preventStructuralClassRemovalOnModifyReplace( schemaManager.getObjectClassRegistry(), name, mod,
+ modifyAttributes );
// this should succeed since person is still in replaced set and is structural
modifyAttributes.removeAttributes( atCN );
@@ -113,7 +114,8 @@ public class SchemaCheckerTest
objectClassesReplaced.add( "top" );
objectClassesReplaced.add( "person" );
modifyAttributes.put( objectClassesReplaced );
- SchemaChecker.preventStructuralClassRemovalOnModifyReplace( schemaManager.getObjectClassRegistry(), name, mod, modifyAttributes );
+ SchemaChecker.preventStructuralClassRemovalOnModifyReplace( schemaManager.getObjectClassRegistry(), name, mod,
+ modifyAttributes );
// this should fail since only top is left
objectClassesReplaced = new DefaultEntryAttribute( atOC );
@@ -121,7 +123,8 @@ public class SchemaCheckerTest
modifyAttributes.put( objectClassesReplaced );
try
{
- SchemaChecker.preventStructuralClassRemovalOnModifyReplace( schemaManager.getObjectClassRegistry(), name, mod, modifyAttributes );
+ SchemaChecker.preventStructuralClassRemovalOnModifyReplace( schemaManager.getObjectClassRegistry(), name,
+ mod, modifyAttributes );
fail( "should never get here due to an LdapSchemaViolationException" );
}
catch ( LdapSchemaViolationException e )
@@ -136,7 +139,8 @@ public class SchemaCheckerTest
modifyAttributes.put( objectClassesReplaced );
try
{
- SchemaChecker.preventStructuralClassRemovalOnModifyReplace( schemaManager.getObjectClassRegistry(), name, mod, modifyAttributes );
+ SchemaChecker.preventStructuralClassRemovalOnModifyReplace( schemaManager.getObjectClassRegistry(), name,
+ mod, modifyAttributes );
fail( "should never get here due to an LdapSchemaViolationException" );
}
catch ( LdapSchemaViolationException e )
@@ -248,7 +252,7 @@ public class SchemaCheckerTest
// test for failure when modifying Rdn attribute in multi attribute Rdn
AttributeType CN_AT = schemaManager.lookupAttributeTypeRegistry( "cn" );
attributes.put( new DefaultEntryAttribute( "cn", CN_AT ) );
-
+
try
{
SchemaChecker.preventRdnChangeOnModifyRemove( name, mod, attributes, schemaManager );
@@ -296,8 +300,8 @@ public class SchemaCheckerTest
SchemaChecker.preventRdnChangeOnModifyReplace( name, mod, attributes, schemaManager );
// test should fail since we are removing the ou attribute
- attributes.put( "ou", (String)null );
-
+ attributes.put( "ou", ( String ) null );
+
try
{
SchemaChecker.preventRdnChangeOnModifyReplace( name, mod, attributes, schemaManager );
@@ -315,8 +319,8 @@ public class SchemaCheckerTest
SchemaChecker.preventRdnChangeOnModifyReplace( name, mod, attributes, schemaManager );
// test for failure when modifying Rdn attribute in multi attribute Rdn
- attributes.put("cn", (String)null );
-
+ attributes.put( "cn", ( String ) null );
+
try
{
SchemaChecker.preventRdnChangeOnModifyReplace( name, mod, attributes, schemaManager );
@@ -366,7 +370,7 @@ public class SchemaCheckerTest
// this should pass
DN name = new DN( "uid=akarasulu,ou=users,dc=example,dc=com" );
ModificationOperation mod = ModificationOperation.REPLACE_ATTRIBUTE;
- SchemaChecker.preventStructuralClassRemovalOnModifyReplace( schemaManager, name, mod,
+ SchemaChecker.preventStructuralClassRemovalOnModifyReplace( schemaManager, name, mod,
new DefaultEntryAttribute( "cn", CN_AT ) );
// this should succeed since person is still in replaced set and is structural
@@ -380,7 +384,8 @@ public class SchemaCheckerTest
objectClassesReplaced.add( "top" );
try
{
- SchemaChecker.preventStructuralClassRemovalOnModifyReplace( schemaManager, name, mod, objectClassesReplaced );
+ SchemaChecker
+ .preventStructuralClassRemovalOnModifyReplace( schemaManager, name, mod, objectClassesReplaced );
fail( "should never get here due to an LdapSchemaViolationException" );
}
catch ( LdapSchemaViolationException e )
@@ -393,7 +398,8 @@ public class SchemaCheckerTest
objectClassesReplaced = new DefaultEntryAttribute( "objectClass", OBJECT_CLASS );
try
{
- SchemaChecker.preventStructuralClassRemovalOnModifyReplace( schemaManager, name, mod, objectClassesReplaced );
+ SchemaChecker
+ .preventStructuralClassRemovalOnModifyReplace( schemaManager, name, mod, objectClassesReplaced );
fail( "should never get here due to an LdapSchemaViolationException" );
}
catch ( LdapSchemaViolationException e )
@@ -413,21 +419,16 @@ public class SchemaCheckerTest
DN name = new DN( "uid=akarasulu,ou=users,dc=example,dc=com" );
ModificationOperation mod = ModificationOperation.REMOVE_ATTRIBUTE;
AttributeType ocAt = schemaManager.lookupAttributeTypeRegistry( "objectClass" );
-
+
EntryAttribute entryObjectClasses = new DefaultEntryAttribute( "objectClass", ocAt );
entryObjectClasses.add( "top", "person", "organizationalPerson" );
// this should pass
- SchemaChecker.preventStructuralClassRemovalOnModifyRemove(
- schemaManager,
- name,
- mod,
- new DefaultEntryAttribute( "cn", schemaManager.lookupAttributeTypeRegistry( "cn" ) ),
- entryObjectClasses );
+ SchemaChecker.preventStructuralClassRemovalOnModifyRemove( schemaManager, name, mod, new DefaultEntryAttribute(
+ "cn", schemaManager.lookupAttributeTypeRegistry( "cn" ) ), entryObjectClasses );
// this should succeed since person is left and is structural
- EntryAttribute objectClassesRemoved = new DefaultEntryAttribute(
- "objectClass", ocAt );
+ EntryAttribute objectClassesRemoved = new DefaultEntryAttribute( "objectClass", ocAt );
objectClassesRemoved.add( "person" );
SchemaChecker.preventStructuralClassRemovalOnModifyRemove( schemaManager, name, mod, objectClassesRemoved,
entryObjectClasses );
@@ -435,7 +436,7 @@ public class SchemaCheckerTest
// this should fail since only top is left
objectClassesRemoved = new DefaultEntryAttribute( "objectClass", ocAt );
objectClassesRemoved.add( "person", "organizationalPerson" );
-
+
try
{
SchemaChecker.preventStructuralClassRemovalOnModifyRemove( schemaManager, name, mod, objectClassesRemoved,
@@ -479,14 +480,14 @@ public class SchemaCheckerTest
AttributeType snAt = schemaManager.lookupAttributeTypeRegistry( "sn" );
// postive test which should pass
- SchemaChecker.preventRdnChangeOnModifyRemove( name, mod,
- new DefaultEntryAttribute( "cn", cnAt, "does not matter" ), schemaManager );
+ SchemaChecker.preventRdnChangeOnModifyRemove( name, mod, new DefaultEntryAttribute( "cn", cnAt,
+ "does not matter" ), schemaManager );
// test should fail since we are removing the ou attribute
try
{
- SchemaChecker.preventRdnChangeOnModifyRemove( name, mod,
- new DefaultEntryAttribute( "ou", ouAt ), schemaManager );
+ SchemaChecker.preventRdnChangeOnModifyRemove( name, mod, new DefaultEntryAttribute( "ou", ouAt ),
+ schemaManager );
fail( "should never get here due to a LdapSchemaViolationException being thrown" );
}
catch ( LdapSchemaViolationException e )
@@ -497,14 +498,14 @@ public class SchemaCheckerTest
// test success using more than one attribute for the Rdn but not modifying rdn attribute
name = new DN( "ou=users+cn=system users,dc=example,dc=com" );
name.normalize( oidNormalizers );
- SchemaChecker.preventRdnChangeOnModifyRemove( name, mod,
- new DefaultEntryAttribute( "sn", snAt, "does not matter" ), schemaManager );
+ SchemaChecker.preventRdnChangeOnModifyRemove( name, mod, new DefaultEntryAttribute( "sn", snAt,
+ "does not matter" ), schemaManager );
// test for failure when modifying Rdn attribute in multi attribute Rdn
try
{
- SchemaChecker.preventRdnChangeOnModifyRemove( name, mod,
- new DefaultEntryAttribute( "cn", cnAt ), schemaManager );
+ SchemaChecker.preventRdnChangeOnModifyRemove( name, mod, new DefaultEntryAttribute( "cn", cnAt ),
+ schemaManager );
fail( "should never get here due to a LdapSchemaViolationException being thrown" );
}
catch ( LdapSchemaViolationException e )
@@ -514,14 +515,14 @@ public class SchemaCheckerTest
// should succeed since the value being deleted from the rdn attribute is
// is not used when composing the Rdn
- SchemaChecker.preventRdnChangeOnModifyRemove( name, mod,
- new DefaultEntryAttribute( "ou", ouAt, "container" ), schemaManager );
+ SchemaChecker.preventRdnChangeOnModifyRemove( name, mod, new DefaultEntryAttribute( "ou", ouAt, "container" ),
+ schemaManager );
// now let's make it fail again just by providing the right value for ou (users)
try
{
- SchemaChecker.preventRdnChangeOnModifyRemove( name, mod,
- new DefaultEntryAttribute( "ou", ouAt, "users" ), schemaManager );
+ SchemaChecker.preventRdnChangeOnModifyRemove( name, mod, new DefaultEntryAttribute( "ou", ouAt, "users" ),
+ schemaManager );
fail( "should never get here due to a LdapSchemaViolationException being thrown" );
}
catch ( LdapSchemaViolationException e )
@@ -530,66 +531,64 @@ public class SchemaCheckerTest
}
}
-
-// /**
-// * Test case to check the schema checker operates correctly when modify
-// * operations replace RDN attributes.
-// */
-// public void testPreventRdnChangeOnModifyReplaceAttribute() throws Exception
-// {
-// int mod = DirContext.REPLACE_ATTRIBUTE;
-// DN name = new DN( "ou=user,dc=example,dc=com" );
-//
-// // postive test which should pass
-// SchemaChecker.preventRdnChangeOnModifyReplace( name, mod, new AttributeImpl( "cn", "does not matter" ), registries.getOidRegistry() );
-//
-// // test should fail since we are removing the ou attribute
-// try
-// {
-// SchemaChecker.preventRdnChangeOnModifyReplace( name, mod, new AttributeImpl( "ou" ), registries.getOidRegistry() );
-// fail( "should never get here due to a LdapSchemaViolationException being thrown" );
-// }
-// catch ( LdapSchemaViolationException e )
-// {
-// assertEquals( ResultCodeEnum.NOT_ALLOWED_ON_RDN, e.getResultCode() );
-// }
-//
-// // test success using more than one attribute for the Rdn but not modifying rdn attribute
-// name = new DN( "ou=users+cn=system users,dc=example,dc=com" );
-// SchemaChecker.preventRdnChangeOnModifyReplace( name, mod, new AttributeImpl( "sn", "does not matter" ), registries.getOidRegistry() );
-//
-// // test for failure when modifying Rdn attribute in multi attribute Rdn
-// try
-// {
-// SchemaChecker.preventRdnChangeOnModifyReplace( name, mod, new AttributeImpl( "cn" ), registries.getOidRegistry() );
-// fail( "should never get here due to a LdapSchemaViolationException being thrown" );
-// }
-// catch ( LdapSchemaViolationException e )
-// {
-// assertEquals( ResultCodeEnum.NOT_ALLOWED_ON_RDN, e.getResultCode() );
-// }
-//
-// // should succeed since the values being replaced from the rdn attribute is
-// // is includes the old Rdn attribute value
-// Attribute attribute = new AttributeImpl( "ou" );
-// attribute.add( "container" );
-// attribute.add( "users" );
-// SchemaChecker.preventRdnChangeOnModifyReplace( name, mod, attribute, registries.getOidRegistry() );
-//
-// // now let's make it fail by not including the old value for ou (users)
-// attribute = new AttributeImpl( "ou" );
-// attribute.add( "container" );
-// try
-// {
-// SchemaChecker.preventRdnChangeOnModifyReplace( name, mod, attribute, registries.getOidRegistry() );
-// fail( "should never get here due to a LdapSchemaViolationException being thrown" );
-// }
-// catch ( LdapSchemaViolationException e )
-// {
-// assertEquals( ResultCodeEnum.NOT_ALLOWED_ON_RDN, e.getResultCode() );
-// }
-// }
-
+ // /**
+ // * Test case to check the schema checker operates correctly when modify
+ // * operations replace RDN attributes.
+ // */
+ // public void testPreventRdnChangeOnModifyReplaceAttribute() throws Exception
+ // {
+ // int mod = DirContext.REPLACE_ATTRIBUTE;
+ // DN name = new DN( "ou=user,dc=example,dc=com" );
+ //
+ // // postive test which should pass
+ // SchemaChecker.preventRdnChangeOnModifyReplace( name, mod, new AttributeImpl( "cn", "does not matter" ), registries.getOidRegistry() );
+ //
+ // // test should fail since we are removing the ou attribute
+ // try
+ // {
+ // SchemaChecker.preventRdnChangeOnModifyReplace( name, mod, new AttributeImpl( "ou" ), registries.getOidRegistry() );
+ // fail( "should never get here due to a LdapSchemaViolationException being thrown" );
+ // }
+ // catch ( LdapSchemaViolationException e )
+ // {
+ // assertEquals( ResultCodeEnum.NOT_ALLOWED_ON_RDN, e.getResultCode() );
+ // }
+ //
+ // // test success using more than one attribute for the Rdn but not modifying rdn attribute
+ // name = new DN( "ou=users+cn=system users,dc=example,dc=com" );
+ // SchemaChecker.preventRdnChangeOnModifyReplace( name, mod, new AttributeImpl( "sn", "does not matter" ), registries.getOidRegistry() );
+ //
+ // // test for failure when modifying Rdn attribute in multi attribute Rdn
+ // try
+ // {
+ // SchemaChecker.preventRdnChangeOnModifyReplace( name, mod, new AttributeImpl( "cn" ), registries.getOidRegistry() );
+ // fail( "should never get here due to a LdapSchemaViolationException being thrown" );
+ // }
+ // catch ( LdapSchemaViolationException e )
+ // {
+ // assertEquals( ResultCodeEnum.NOT_ALLOWED_ON_RDN, e.getResultCode() );
+ // }
+ //
+ // // should succeed since the values being replaced from the rdn attribute is
+ // // is includes the old Rdn attribute value
+ // Attribute attribute = new AttributeImpl( "ou" );
+ // attribute.add( "container" );
+ // attribute.add( "users" );
+ // SchemaChecker.preventRdnChangeOnModifyReplace( name, mod, attribute, registries.getOidRegistry() );
+ //
+ // // now let's make it fail by not including the old value for ou (users)
+ // attribute = new AttributeImpl( "ou" );
+ // attribute.add( "container" );
+ // try
+ // {
+ // SchemaChecker.preventRdnChangeOnModifyReplace( name, mod, attribute, registries.getOidRegistry() );
+ // fail( "should never get here due to a LdapSchemaViolationException being thrown" );
+ // }
+ // catch ( LdapSchemaViolationException e )
+ // {
+ // assertEquals( ResultCodeEnum.NOT_ALLOWED_ON_RDN, e.getResultCode() );
+ // }
+ // }
class MockOidRegistry extends OidRegistry
{
@@ -598,40 +597,48 @@ public class SchemaCheckerTest
return StringTools.deepTrimToLower( name );
}
+
public boolean hasOid( String id )
{
return true;
}
+
public String getPrimaryName( String oid ) throws LdapException
{
return oid;
}
+
public List<String> getNameSet( String oid ) throws LdapException
{
return Collections.singletonList( oid );
}
+
public Iterator<String> list()
{
return Collections.EMPTY_LIST.iterator();
}
+
public void register( String name, String oid )
{
}
+
public Map getOidByName()
{
return null;
}
+
public Map getNameByOid()
{
return null;
}
+
public void unregister( String numericOid ) throws LdapException
{
}
Modified: directory/apacheds/trunk/core/src/test/java/org/apache/directory/server/core/schema/SchemaServiceTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core/src/test/java/org/apache/directory/server/core/schema/SchemaServiceTest.java?rev=948711&r1=948710&r2=948711&view=diff
==============================================================================
--- directory/apacheds/trunk/core/src/test/java/org/apache/directory/server/core/schema/SchemaServiceTest.java (original)
+++ directory/apacheds/trunk/core/src/test/java/org/apache/directory/server/core/schema/SchemaServiceTest.java Thu May 27 08:08:44 2010
@@ -45,12 +45,12 @@ import org.junit.Test;
public class SchemaServiceTest
{
private static SchemaManager schemaManager;
-
-
+
+
@BeforeClass
public static void setUp() throws Exception
{
- String workingDirectory = System.getProperty( "workingDirectory" );
+ String workingDirectory = System.getProperty( "workingDirectory" );
if ( workingDirectory == null )
{
@@ -73,134 +73,113 @@ public class SchemaServiceTest
}
loaded = schemaManager.loadWithDeps( "nis" );
-
+
if ( !loaded )
{
fail( "Schema load failed : " + LdapExceptionUtils.printErrors( schemaManager.getErrors() ) );
}
}
-
+
@Test
public void testDescendants() throws Exception
{
Iterator<AttributeType> list = schemaManager.getAttributeTypeRegistry().descendants( "name" );
Set<String> nameAttrs = new HashSet<String>();
-
+
while ( list.hasNext() )
{
AttributeType type = list.next();
nameAttrs.add( type.getName() );
}
-
+
// We should only have 18 AT
String[] expectedNames = new String[]
- {
- "sn",
- "generationQualifier",
- "ou",
- "c",
- "o",
- "l",
- "c-st",
- "givenName",
- "title",
- "cn",
- "initials",
- "dmdName",
- "c-ou",
- "c-o",
- "apacheExistence",
- "st",
- "c-l",
- "ads-serverId",
- "ads-indexAttributeId",
- "ads-transportId",
- "ads-directoryServiceId",
- "ads-Id"
- };
-
+ { "sn", "generationQualifier", "ou", "c", "o", "l", "c-st", "givenName", "title", "cn", "initials",
+ "dmdName", "c-ou", "c-o", "apacheExistence", "st", "c-l", "ads-serverId", "ads-indexAttributeId",
+ "ads-transportId", "ads-directoryServiceId", "ads-Id" };
+
for ( String name : expectedNames )
{
- if ( nameAttrs.contains( name) )
+ if ( nameAttrs.contains( name ) )
{
nameAttrs.remove( name );
}
}
-
+
assertEquals( 0, nameAttrs.size() );
}
-/*
- public void testAlterObjectClassesBogusAttr() throws NamingException
- {
- Attribute attr = new AttributeImpl( "blah", "blah" );
-
- try
+ /*
+ public void testAlterObjectClassesBogusAttr() throws NamingException
{
- SchemaInterceptor.alterObjectClasses( attr, registries.getObjectClassRegistry() );
- fail( "should not get here" );
- }
- catch ( LdapNamingException e )
- {
- assertEquals( ResultCodeEnum.OPERATIONS_ERROR, e.getResultCode() );
- }
+ Attribute attr = new AttributeImpl( "blah", "blah" );
- attr = new AttributeImpl( "objectClass" );
- SchemaInterceptor.alterObjectClasses( attr );
- assertEquals( 0, attr.size() );
- }
+ try
+ {
+ SchemaInterceptor.alterObjectClasses( attr, registries.getObjectClassRegistry() );
+ fail( "should not get here" );
+ }
+ catch ( LdapNamingException e )
+ {
+ assertEquals( ResultCodeEnum.OPERATIONS_ERROR, e.getResultCode() );
+ }
+ attr = new AttributeImpl( "objectClass" );
+ SchemaInterceptor.alterObjectClasses( attr );
+ assertEquals( 0, attr.size() );
+ }
- public void testAlterObjectClassesNoAttrValue() throws NamingException
- {
- Attribute attr = new AttributeImpl( "objectClass" );
- SchemaInterceptor.alterObjectClasses( attr );
- assertEquals( 0, attr.size() );
- }
+ public void testAlterObjectClassesNoAttrValue() throws NamingException
+ {
+ Attribute attr = new AttributeImpl( "objectClass" );
+ SchemaInterceptor.alterObjectClasses( attr );
+ assertEquals( 0, attr.size() );
+ }
- public void testAlterObjectClassesTopAttrValue() throws NamingException
- {
- Attribute attr = new AttributeImpl( "objectClass", "top" );
- SchemaInterceptor.alterObjectClasses( attr, registries.getObjectClassRegistry() );
- assertEquals( 0, attr.size() );
- }
+ public void testAlterObjectClassesTopAttrValue() throws NamingException
+ {
+ Attribute attr = new AttributeImpl( "objectClass", "top" );
+ SchemaInterceptor.alterObjectClasses( attr, registries.getObjectClassRegistry() );
+ assertEquals( 0, attr.size() );
+ }
- public void testAlterObjectClassesInetOrgPersonAttrValue() throws NamingException
- {
- Attribute attr = new AttributeImpl( "objectClass", "organizationalPerson" );
- SchemaInterceptor.alterObjectClasses( attr, registries.getObjectClassRegistry() );
- assertEquals( 2, attr.size() );
- assertTrue( attr.contains( "person" ) );
- assertTrue( attr.contains( "organizationalPerson" ) );
- }
+ public void testAlterObjectClassesInetOrgPersonAttrValue() throws NamingException
+ {
+ Attribute attr = new AttributeImpl( "objectClass", "organizationalPerson" );
+ SchemaInterceptor.alterObjectClasses( attr, registries.getObjectClassRegistry() );
+ assertEquals( 2, attr.size() );
+ assertTrue( attr.contains( "person" ) );
+ assertTrue( attr.contains( "organizationalPerson" ) );
+ }
- public void testAlterObjectClassesOverlapping() throws NamingException
- {
- Attribute attr = new AttributeImpl( "objectClass", "organizationalPerson" );
- attr.add( "residentialPerson" );
- SchemaInterceptor.alterObjectClasses( attr, registries.getObjectClassRegistry() );
- assertEquals( 3, attr.size() );
- assertTrue( attr.contains( "person" ) );
- assertTrue( attr.contains( "organizationalPerson" ) );
- assertTrue( attr.contains( "residentialPerson" ) );
- }
+ public void testAlterObjectClassesOverlapping() throws NamingException
+ {
+ Attribute attr = new AttributeImpl( "objectClass", "organizationalPerson" );
+ attr.add( "residentialPerson" );
+ SchemaInterceptor.alterObjectClasses( attr, registries.getObjectClassRegistry() );
+ assertEquals( 3, attr.size() );
+ assertTrue( attr.contains( "person" ) );
+ assertTrue( attr.contains( "organizationalPerson" ) );
+ assertTrue( attr.contains( "residentialPerson" ) );
+ }
- public void testAlterObjectClassesOverlappingAndDsa() throws NamingException
- {
- Attribute attr = new AttributeImpl( "objectClass", "organizationalPerson" );
- attr.add( "residentialPerson" );
- attr.add( "dSA" );
- SchemaInterceptor.alterObjectClasses( attr, registries.getObjectClassRegistry() );
- assertEquals( 5, attr.size() );
- assertTrue( attr.contains( "person" ) );
- assertTrue( attr.contains( "organizationalPerson" ) );
- assertTrue( attr.contains( "residentialPerson" ) );
- assertTrue( attr.contains( "dSA" ) );
- assertTrue( attr.contains( "applicationEntity" ) );
- }
- */
+
+ public void testAlterObjectClassesOverlappingAndDsa() throws NamingException
+ {
+ Attribute attr = new AttributeImpl( "objectClass", "organizationalPerson" );
+ attr.add( "residentialPerson" );
+ attr.add( "dSA" );
+ SchemaInterceptor.alterObjectClasses( attr, registries.getObjectClassRegistry() );
+ assertEquals( 5, attr.size() );
+ assertTrue( attr.contains( "person" ) );
+ assertTrue( attr.contains( "organizationalPerson" ) );
+ assertTrue( attr.contains( "residentialPerson" ) );
+ assertTrue( attr.contains( "dSA" ) );
+ assertTrue( attr.contains( "applicationEntity" ) );
+ }
+ */
}
Modified: directory/apacheds/trunk/core/src/test/java/org/apache/directory/server/core/security/TlsKeyGeneratorTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core/src/test/java/org/apache/directory/server/core/security/TlsKeyGeneratorTest.java?rev=948711&r1=948710&r2=948711&view=diff
==============================================================================
--- directory/apacheds/trunk/core/src/test/java/org/apache/directory/server/core/security/TlsKeyGeneratorTest.java (original)
+++ directory/apacheds/trunk/core/src/test/java/org/apache/directory/server/core/security/TlsKeyGeneratorTest.java Thu May 27 08:08:44 2010
@@ -55,7 +55,7 @@ public class TlsKeyGeneratorTest
private static final Logger LOG = LoggerFactory.getLogger( TlsKeyGeneratorTest.class );
private static LdifSchemaLoader loader;
private static SchemaManager schemaManager;
-
+
/**
* Initialize the registries once for the whole test suite
@@ -63,7 +63,7 @@ public class TlsKeyGeneratorTest
@BeforeClass
public static void setup() throws Exception
{
- String workingDirectory = System.getProperty( "workingDirectory" );
+ String workingDirectory = System.getProperty( "workingDirectory" );
if ( workingDirectory == null )
{
@@ -85,8 +85,8 @@ public class TlsKeyGeneratorTest
fail( "Schema load failed : " + LdapExceptionUtils.printErrors( schemaManager.getErrors() ) );
}
}
-
-
+
+
/**
* Test method for all methods in one.
*/
@@ -97,10 +97,10 @@ public class TlsKeyGeneratorTest
TlsKeyGenerator.addKeyPair( entry );
LOG.debug( "Entry: {}", entry );
assertTrue( entry.contains( SchemaConstants.OBJECT_CLASS_AT, TlsKeyGenerator.TLS_KEY_INFO_OC ) );
-
+
KeyPair keyPair = TlsKeyGenerator.getKeyPair( entry );
assertNotNull( keyPair );
-
+
X509Certificate cert = TlsKeyGenerator.getCertificate( entry );
assertNotNull( cert );
}
Modified: directory/apacheds/trunk/core/src/test/java/org/apache/directory/server/core/subtree/SubtreeEvaluatorTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core/src/test/java/org/apache/directory/server/core/subtree/SubtreeEvaluatorTest.java?rev=948711&r1=948710&r2=948711&view=diff
==============================================================================
--- directory/apacheds/trunk/core/src/test/java/org/apache/directory/server/core/subtree/SubtreeEvaluatorTest.java (original)
+++ directory/apacheds/trunk/core/src/test/java/org/apache/directory/server/core/subtree/SubtreeEvaluatorTest.java Thu May 27 08:08:44 2010
@@ -50,7 +50,6 @@ import org.junit.BeforeClass;
import org.junit.Test;
-
/**
* Unit test cases for the SubtreeEvaluator.
*
@@ -64,10 +63,11 @@ public class SubtreeEvaluatorTest
FilterNormalizingVisitor visitor;
static ConcreteNameComponentNormalizer ncn;
+
@BeforeClass
public static void init() throws Exception
{
- String workingDirectory = System.getProperty( "workingDirectory" );
+ String workingDirectory = System.getProperty( "workingDirectory" );
if ( workingDirectory == null )
{
@@ -92,7 +92,7 @@ public class SubtreeEvaluatorTest
ncn = new ConcreteNameComponentNormalizer( schemaManager );
}
-
+
@Before
public void initTest()
{
@@ -108,7 +108,7 @@ public class SubtreeEvaluatorTest
evaluator = null;
}
-
+
@AfterClass
public static void tearDown() throws Exception
{
@@ -293,7 +293,6 @@ public class SubtreeEvaluatorTest
// now change the refinement so the entry is rejected
entry = new DefaultEntry( schemaManager, entryDn );
entry.put( "objectClass", "organizationalUnit" );
-
assertFalse( evaluator.evaluate( ss, apDn, entryDn, entry ) );
@@ -313,8 +312,8 @@ public class SubtreeEvaluatorTest
assertFalse( evaluator.evaluate( ss, apDn, entryDn, entry ) );
}
-
-
+
+
@Test
public void testWithFilter() throws Exception
{
Modified: directory/apacheds/trunk/jdbm-store/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmMasterTableTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/jdbm-store/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmMasterTableTest.java?rev=948711&r1=948710&r2=948711&view=diff
==============================================================================
--- directory/apacheds/trunk/jdbm-store/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmMasterTableTest.java (original)
+++ directory/apacheds/trunk/jdbm-store/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmMasterTableTest.java Thu May 27 08:08:44 2010
@@ -61,7 +61,7 @@ public class JdbmMasterTableTest
public JdbmMasterTableTest() throws Exception
{
- String workingDirectory = System.getProperty( "workingDirectory" );
+ String workingDirectory = System.getProperty( "workingDirectory" );
if ( workingDirectory == null )
{
Modified: directory/apacheds/trunk/jdbm-store/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/MockComparatorRegistry.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/jdbm-store/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/MockComparatorRegistry.java?rev=948711&r1=948710&r2=948711&view=diff
==============================================================================
--- directory/apacheds/trunk/jdbm-store/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/MockComparatorRegistry.java (original)
+++ directory/apacheds/trunk/jdbm-store/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/MockComparatorRegistry.java Thu May 27 08:08:44 2010
@@ -43,18 +43,18 @@ class MockComparatorRegistry extends Def
super();
}
-
private LdapComparator<Integer> comparator = new LdapComparator<Integer>( "1.1.1" )
{
- private static final long serialVersionUID = -4049615866911565018L;
+ private static final long serialVersionUID = -4049615866911565018L;
+
- public int compare( Integer i1, Integer i2 )
+ public int compare( Integer i1, Integer i2 )
{
return i1.compareTo( i2 );
}
};
-
+
public String getSchemaName( String oid ) throws LdapException
{
return null;
@@ -72,7 +72,7 @@ class MockComparatorRegistry extends Def
}
- public void register(LdapComparator<?> comparator ) throws LdapException
+ public void register( LdapComparator<?> comparator ) throws LdapException
{
}
@@ -88,13 +88,13 @@ class MockComparatorRegistry extends Def
return null;
}
-
+
public Iterator<String> oidsIterator()
{
return null;
}
-
+
public Iterator<LdapComparatorDescription> ldapComparatorDescriptionIterator()
{
return null;
@@ -103,7 +103,7 @@ class MockComparatorRegistry extends Def
public LdapComparator<Integer> unregister( String oid ) throws LdapException
{
- return this.comparator;
+ return this.comparator;
}
Modified: directory/apacheds/trunk/jdbm-store/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/ServerEntrySerializerTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/jdbm-store/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/ServerEntrySerializerTest.java?rev=948711&r1=948710&r2=948711&view=diff
==============================================================================
--- directory/apacheds/trunk/jdbm-store/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/ServerEntrySerializerTest.java (original)
+++ directory/apacheds/trunk/jdbm-store/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/ServerEntrySerializerTest.java Thu May 27 08:08:44 2010
@@ -28,12 +28,11 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
-import org.apache.directory.server.core.partition.impl.btree.jdbm.ServerEntrySerializer;
import org.apache.directory.shared.ldap.constants.SchemaConstants;
import org.apache.directory.shared.ldap.entry.DefaultEntry;
import org.apache.directory.shared.ldap.entry.DefaultEntryAttribute;
-import org.apache.directory.shared.ldap.entry.EntryAttribute;
import org.apache.directory.shared.ldap.entry.Entry;
+import org.apache.directory.shared.ldap.entry.EntryAttribute;
import org.apache.directory.shared.ldap.name.DN;
import org.apache.directory.shared.ldap.schema.SchemaManager;
import org.apache.directory.shared.ldap.schema.ldif.extractor.SchemaLdifExtractor;
@@ -61,54 +60,55 @@ public class ServerEntrySerializerTest
private static Map<String, OidNormalizer> oids;
private static Map<String, OidNormalizer> oidOids;
+
/**
* Initialize the registries once for the whole test suite
*/
@BeforeClass
public static void setup() throws Exception
{
- String workingDirectory = System.getProperty( "workingDirectory" );
-
- if ( workingDirectory == null )
+ String workingDirectory = System.getProperty( "workingDirectory" );
+
+ if ( workingDirectory == null )
{
String path = ServerEntrySerializerTest.class.getResource( "" ).getPath();
int targetPos = path.indexOf( "target" );
workingDirectory = path.substring( 0, targetPos + 6 );
}
-
- File schemaRepository = new File( workingDirectory, "schema" );
+
+ File schemaRepository = new File( workingDirectory, "schema" );
SchemaLdifExtractor extractor = new DefaultSchemaLdifExtractor( new File( workingDirectory ) );
extractor.extractOrCopy( true );
loader = new LdifSchemaLoader( schemaRepository );
-
+
schemaManager = new DefaultSchemaManager( loader );
schemaManager.loadAllEnabled();
-
+
List<Throwable> errors = schemaManager.getErrors();
-
+
if ( errors.size() != 0 )
{
fail( "Schema load failed : " + LdapExceptionUtils.printErrors( errors ) );
}
-
+
oids = new HashMap<String, OidNormalizer>();
// DC normalizer
- OidNormalizer dcOidNormalizer = new OidNormalizer( "dc",
- new DeepTrimToLowerNormalizer( SchemaConstants.DOMAIN_COMPONENT_AT_OID ) );
-
+ OidNormalizer dcOidNormalizer = new OidNormalizer( "dc", new DeepTrimToLowerNormalizer(
+ SchemaConstants.DOMAIN_COMPONENT_AT_OID ) );
+
oids.put( "dc", dcOidNormalizer );
oids.put( "domaincomponent", dcOidNormalizer );
oids.put( "0.9.2342.19200300.100.1.25", dcOidNormalizer );
// OU normalizer
- OidNormalizer ouOidNormalizer = new OidNormalizer( "ou",
- new DeepTrimToLowerNormalizer( SchemaConstants.OU_AT_OID ) );
-
+ OidNormalizer ouOidNormalizer = new OidNormalizer( "ou", new DeepTrimToLowerNormalizer(
+ SchemaConstants.OU_AT_OID ) );
+
oids.put( "ou", ouOidNormalizer );
- oids.put( "organizationalUnitName",ouOidNormalizer );
+ oids.put( "organizationalUnitName", ouOidNormalizer );
oids.put( "2.5.4.11", ouOidNormalizer );
-
+
// Another map where we store OIDs instead of names.
oidOids = new HashMap<String, OidNormalizer>();
@@ -117,183 +117,193 @@ public class ServerEntrySerializerTest
oidOids.put( "0.9.2342.19200300.100.1.25", dcOidNormalizer );
oidOids.put( "ou", ouOidNormalizer );
- oidOids.put( "organizationalUnitName",ouOidNormalizer );
+ oidOids.put( "organizationalUnitName", ouOidNormalizer );
oidOids.put( "2.5.4.11", ouOidNormalizer );
}
-
- @Test public void testSerializeEmtpyServerEntry() throws Exception
+
+ @Test
+ public void testSerializeEmtpyServerEntry() throws Exception
{
DN dn = DN.EMPTY_DN;
Entry entry = new DefaultEntry( schemaManager, dn );
ServerEntrySerializer ses = new ServerEntrySerializer( schemaManager );
-
+
byte[] data = ses.serialize( entry );
-
- Entry result = (Entry)ses.deserialize( data );
-
+
+ Entry result = ( Entry ) ses.deserialize( data );
+
assertEquals( entry, result );
}
- @Test public void testSerializeDNServerEntry() throws Exception
+ @Test
+ public void testSerializeDNServerEntry() throws Exception
{
DN dn = new DN( "cn=text, dc=example, dc=com" );
dn.normalize( oids );
-
+
Entry entry = new DefaultEntry( schemaManager, dn );
ServerEntrySerializer ses = new ServerEntrySerializer( schemaManager );
-
+
byte[] data = ses.serialize( entry );
-
- Entry result = (Entry)ses.deserialize( data );
-
+
+ Entry result = ( Entry ) ses.deserialize( data );
+
DN newDn = new DN();
newDn.add( dn.getRdn() );
entry.setDn( newDn );
-
+
assertEquals( entry, result );
}
- @Test public void testSerializeServerEntryOC() throws Exception
+ @Test
+ public void testSerializeServerEntryOC() throws Exception
{
DN dn = new DN( "cn=text, dc=example, dc=com" );
dn.normalize( oids );
-
+
Entry entry = new DefaultEntry( schemaManager, dn );
entry.add( "objectClass", "top", "person", "inetOrgPerson", "organizationalPerson" );
ServerEntrySerializer ses = new ServerEntrySerializer( schemaManager );
byte[] data = ses.serialize( entry );
-
- Entry result = (Entry)ses.deserialize( data );
-
+
+ Entry result = ( Entry ) ses.deserialize( data );
+
DN newDn = new DN();
newDn.add( dn.getRdn() );
entry.setDn( newDn );
-
+
assertEquals( entry, result );
}
- @Test public void testSerializeServerEntry() throws Exception
+ @Test
+ public void testSerializeServerEntry() throws Exception
{
DN dn = new DN( "cn=text, dc=example, dc=com" );
dn.normalize( oids );
-
+
Entry entry = new DefaultEntry( schemaManager, dn );
entry.add( "objectClass", "top", "person", "inetOrgPerson", "organizationalPerson" );
entry.add( "cn", "text", "test" );
- entry.add( "SN", (String)null );
+ entry.add( "SN", ( String ) null );
entry.add( "userPassword", StringTools.getBytesUtf8( "password" ) );
ServerEntrySerializer ses = new ServerEntrySerializer( schemaManager );
-
+
byte[] data = ses.serialize( entry );
-
- Entry result = (Entry)ses.deserialize( data );
-
+
+ Entry result = ( Entry ) ses.deserialize( data );
+
DN newDn = new DN();
newDn.add( dn.getRdn() );
entry.setDn( newDn );
-
+
assertEquals( entry, result );
}
- @Test public void testSerializeServerEntryWithEmptyDN() throws Exception
+ @Test
+ public void testSerializeServerEntryWithEmptyDN() throws Exception
{
DN dn = new DN( "" );
dn.normalize( oids );
-
+
Entry entry = new DefaultEntry( schemaManager, dn );
entry.add( "objectClass", "top", "person", "inetOrgPerson", "organizationalPerson" );
entry.add( "cn", "text", "test" );
- entry.add( "SN", (String)null );
+ entry.add( "SN", ( String ) null );
entry.add( "userPassword", StringTools.getBytesUtf8( "password" ) );
ServerEntrySerializer ses = new ServerEntrySerializer( schemaManager );
-
+
byte[] data = ses.serialize( entry );
-
- Entry result = (Entry)ses.deserialize( data );
-
+
+ Entry result = ( Entry ) ses.deserialize( data );
+
assertEquals( entry, result );
}
-
- @Test public void testSerializeServerEntryWithNoAttributes() throws Exception
+
+ @Test
+ public void testSerializeServerEntryWithNoAttributes() throws Exception
{
DN dn = new DN( "" );
dn.normalize( oids );
-
+
Entry entry = new DefaultEntry( schemaManager, dn );
ServerEntrySerializer ses = new ServerEntrySerializer( schemaManager );
-
+
byte[] data = ses.serialize( entry );
-
- Entry result = (Entry)ses.deserialize( data );
-
+
+ Entry result = ( Entry ) ses.deserialize( data );
+
assertEquals( entry, result );
}
-
-
- @Test public void testSerializeServerEntryWithAttributeNoValue() throws Exception
+
+
+ @Test
+ public void testSerializeServerEntryWithAttributeNoValue() throws Exception
{
DN dn = new DN( "" );
dn.normalize( oids );
-
+
Entry entry = new DefaultEntry( schemaManager, dn );
ServerEntrySerializer ses = new ServerEntrySerializer( schemaManager );
- EntryAttribute oc = new DefaultEntryAttribute( "ObjectClass", schemaManager.lookupAttributeTypeRegistry( "objectclass" ) );
+ EntryAttribute oc = new DefaultEntryAttribute( "ObjectClass", schemaManager
+ .lookupAttributeTypeRegistry( "objectclass" ) );
entry.add( oc );
-
+
byte[] data = ses.serialize( entry );
-
- Entry result = (Entry)ses.deserialize( data );
-
+
+ Entry result = ( Entry ) ses.deserialize( data );
+
assertEquals( entry, result );
}
- @Test public void testSerializeServerEntryWithAttributeStringValue() throws Exception
+ @Test
+ public void testSerializeServerEntryWithAttributeStringValue() throws Exception
{
DN dn = new DN( "" );
dn.normalize( oids );
-
+
Entry entry = new DefaultEntry( schemaManager, dn );
ServerEntrySerializer ses = new ServerEntrySerializer( schemaManager );
entry.add( "ObjectClass", "top", "person" );
-
+
byte[] data = ses.serialize( entry );
-
- Entry result = (Entry)ses.deserialize( data );
-
+
+ Entry result = ( Entry ) ses.deserialize( data );
+
assertEquals( entry, result );
}
- @Test public void testSerializeServerEntryWithAttributeBinaryValue() throws Exception
+ @Test
+ public void testSerializeServerEntryWithAttributeBinaryValue() throws Exception
{
DN dn = new DN( "" );
dn.normalize( oids );
-
+
Entry entry = new DefaultEntry( schemaManager, dn );
ServerEntrySerializer ses = new ServerEntrySerializer( schemaManager );
entry.add( "userPassword", StringTools.getBytesUtf8( "secret" ) );
-
+
byte[] data = ses.serialize( entry );
-
- Entry result = (Entry)ses.deserialize( data );
-
+
+ Entry result = ( Entry ) ses.deserialize( data );
+
assertEquals( entry, result );
}
}
Modified: directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/operations/modifydn/MoveIT.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/operations/modifydn/MoveIT.java?rev=948711&r1=948710&r2=948711&view=diff
==============================================================================
--- directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/operations/modifydn/MoveIT.java (original)
+++ directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/operations/modifydn/MoveIT.java Thu May 27 08:08:44 2010
@@ -50,111 +50,92 @@ import org.junit.runner.RunWith;
* @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
* @version $Rev: 679049 $
*/
-@RunWith ( FrameworkRunner.class )
-@CreateLdapServer (
- transports =
+@RunWith(FrameworkRunner.class)
+@CreateLdapServer(transports =
+ { @CreateTransport(protocol = "LDAP") })
+@ApplyLdifs(
{
- @CreateTransport( protocol = "LDAP" )
- })
-@ApplyLdifs( {
- // Entry # 1
- "dn: uid=akarasulu,ou=users,ou=system",
- "objectClass: uidObject",
- "objectClass: person",
- "objectClass: top",
- "uid: akarasulu",
- "cn: Alex Karasulu",
- "sn: karasulu",
- // Entry # 2
- "dn: ou=NewSuperior,ou=system",
- "objectClass: organizationalUnit",
- "objectClass: top",
- "ou: NewSuperior",
-
- "dn: ou=parent,ou=system",
- "changetype: add",
- "objectClass: organizationalUnit",
- "objectClass: top",
- "ou: parent",
-
- "dn: ou=child,ou=parent,ou=system",
- "changetype: add",
- "objectClass: organizationalUnit",
- "objectClass: top",
- "ou: child"
- }
-)
-public class MoveIT extends AbstractLdapTestUnit
+ // Entry # 1
+ "dn: uid=akarasulu,ou=users,ou=system", "objectClass: uidObject", "objectClass: person", "objectClass: top",
+ "uid: akarasulu", "cn: Alex Karasulu",
+ "sn: karasulu",
+ // Entry # 2
+ "dn: ou=NewSuperior,ou=system", "objectClass: organizationalUnit", "objectClass: top", "ou: NewSuperior",
+
+ "dn: ou=parent,ou=system", "changetype: add", "objectClass: organizationalUnit", "objectClass: top",
+ "ou: parent",
+
+ "dn: ou=child,ou=parent,ou=system", "changetype: add", "objectClass: organizationalUnit", "objectClass: top",
+ "ou: child" })
+public class MoveIT extends AbstractLdapTestUnit
{
private static final String DN = "uid=akarasulu,ou=users,ou=system";
private static final String NEW_DN = "uid=akarasulu,ou=NewSuperior,ou=system";
private static final String NEW_DN2 = "uid=elecharny,ou=NewSuperior,ou=system";
-
+
@Test
public void testMoveNoRdnChange() throws Exception
{
LdapContext ctx = getWiredContext( ldapServer );
ctx.rename( DN, NEW_DN );
-
+
SearchControls controls = new SearchControls();
controls.setSearchScope( SearchControls.OBJECT_SCOPE );
-
- NamingEnumeration<SearchResult> results =
- ctx.search( NEW_DN, "(objectClass=*)", controls );
+
+ NamingEnumeration<SearchResult> results = ctx.search( NEW_DN, "(objectClass=*)", controls );
assertNotNull( results );
assertTrue( "Could not find entry after move.", results.hasMore() );
SearchResult result = results.next();
assertNotNull( result );
assertEquals( NEW_DN, result.getNameInNamespace() );
-
+
results.close();
ctx.close();
}
-
+
@Test
public void testMoveAndRdnChange() throws Exception
{
LdapContext ctx = getWiredContext( ldapServer );
ctx.rename( DN, NEW_DN2 );
-
+
SearchControls controls = new SearchControls();
controls.setSearchScope( SearchControls.OBJECT_SCOPE );
-
- NamingEnumeration<SearchResult> results =
- ctx.search( NEW_DN2, "(objectClass=*)", controls );
+
+ NamingEnumeration<SearchResult> results = ctx.search( NEW_DN2, "(objectClass=*)", controls );
assertNotNull( results );
assertTrue( "Could not find entry after move.", results.hasMore() );
SearchResult result = results.next();
assertNotNull( result );
assertEquals( NEW_DN2, result.getNameInNamespace() );
-
+
results.close();
ctx.close();
}
-
-
+
+
@Test
public void testIllegalMove() throws Exception
{
- LdapConnection con = getClientApiConnection( ldapServer );
-
- //now do something bad: make the parent a child of its own child
- ModifyDnResponse resp = con.move( "ou=parent,ou=system", "ou=child,ou=parent,ou=system" );
- assertEquals( ResultCodeEnum.UNWILLING_TO_PERFORM, resp.getLdapResult().getResultCode() );
+ LdapConnection con = getClientApiConnection( ldapServer );
+
+ //now do something bad: make the parent a child of its own child
+ ModifyDnResponse resp = con.move( "ou=parent,ou=system", "ou=child,ou=parent,ou=system" );
+ assertEquals( ResultCodeEnum.UNWILLING_TO_PERFORM, resp.getLdapResult().getResultCode() );
}
-
-
+
+
@Test
public void testIllegalMoveToSameDN() throws Exception
{
- LdapConnection con = getClientApiConnection( ldapServer );
-
- //now do something bad: try to move the entry to the same DN
- ModifyDnResponse resp = con.move( "ou=parent,ou=system", "ou=parent,ou=system" );
+ LdapConnection con = getClientApiConnection( ldapServer );
+
+ //now do something bad: try to move the entry to the same DN
+ ModifyDnResponse resp = con.move( "ou=parent,ou=system", "ou=parent,ou=system" );
assertEquals( ResultCodeEnum.UNWILLING_TO_PERFORM, resp.getLdapResult().getResultCode() );
- }
+ }
}
Modified: directory/apacheds/trunk/server-tools/src/main/java/org/apache/directory/server/tools/DumpCommand.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/server-tools/src/main/java/org/apache/directory/server/tools/DumpCommand.java?rev=948711&r1=948710&r2=948711&view=diff
==============================================================================
--- directory/apacheds/trunk/server-tools/src/main/java/org/apache/directory/server/tools/DumpCommand.java (original)
+++ directory/apacheds/trunk/server-tools/src/main/java/org/apache/directory/server/tools/DumpCommand.java Thu May 27 08:08:44 2010
@@ -39,8 +39,6 @@ import jdbm.recman.CacheRecordManager;
import org.apache.commons.cli.CommandLine;
import org.apache.commons.cli.Option;
import org.apache.commons.cli.Options;
-import org.apache.directory.server.core.DefaultDirectoryService;
-import org.apache.directory.server.core.DirectoryService;
import org.apache.directory.server.core.partition.impl.btree.jdbm.JdbmIndex;
import org.apache.directory.server.core.partition.impl.btree.jdbm.JdbmMasterTable;
import org.apache.directory.server.i18n.I18n;
@@ -87,7 +85,7 @@ public class DumpCommand extends ToolCom
// --------------------------------------------------------------------
// setup temporary loader and temp registry
- String workingDirectory = System.getProperty( "workingDirectory" );
+ String workingDirectory = System.getProperty( "workingDirectory" );
if ( workingDirectory == null )
{
@@ -102,19 +100,18 @@ public class DumpCommand extends ToolCom
LdifSchemaLoader loader = new LdifSchemaLoader( schemaRepository );
schemaManager = new DefaultSchemaManager( loader );
schemaManager.loadAllEnabled();
-
+
List<Throwable> errors = schemaManager.getErrors();
-
+
if ( errors.size() != 0 )
{
throw new Exception( I18n.err( I18n.ERR_317, LdapExceptionUtils.printErrors( errors ) ) );
}
-
schemaManager.loadWithDeps( "collective" );
-
+
errors = schemaManager.getErrors();
-
+
if ( !errors.isEmpty() )
{
MultiException e = new MultiException();
@@ -122,7 +119,7 @@ public class DumpCommand extends ToolCom
{
e.addThrowable( t );
}
-
+
throw e;
}
@@ -153,10 +150,10 @@ public class DumpCommand extends ToolCom
PrintWriter out = null;
String[] excludedAttributes = cmdline.getOptionValues( 'e' );
-
+
if ( excludedAttributes != null )
{
- for ( String attributeType:excludedAttributes)
+ for ( String attributeType : excludedAttributes )
{
AttributeType type = schemaManager.lookupAttributeTypeRegistry( attributeType );
exclusions.add( type.getName() );
@@ -172,7 +169,7 @@ public class DumpCommand extends ToolCom
out = new PrintWriter( new FileWriter( outputFile ) );
}
- for ( String partition:partitions )
+ for ( String partition : partitions )
{
File partitionDirectory = new File( getInstanceLayout().getPartitionsDir(), partition );
out.println( "\n\n" );
@@ -209,12 +206,12 @@ public class DumpCommand extends ToolCom
idIndex.init( schemaManager, attributeType, partitionDirectory );
out.println( "#---------------------" );
- Cursor<Tuple<Long,Entry>> list = master.cursor();
+ Cursor<Tuple<Long, Entry>> list = master.cursor();
StringBuffer buf = new StringBuffer();
-
+
while ( list.next() )
{
- Tuple<Long,Entry> tuple = list.get();
+ Tuple<Long, Entry> tuple = list.get();
Long id = tuple.getKey();
String dn = ( String ) idIndex.reverseLookup( id );
Attributes entry = ( Attributes ) tuple.getValue();
@@ -222,7 +219,7 @@ public class DumpCommand extends ToolCom
filterAttributes( dn, entry );
buf.append( "# Entry: " ).append( id ).append( "\n#---------------------\n\n" );
-
+
if ( !LdifUtils.isLDIFSafe( dn ) )
{
// If the DN isn't LdifSafe, it needs to be Base64 encoded.
@@ -233,14 +230,14 @@ public class DumpCommand extends ToolCom
{
buf.append( "dn: " ).append( dn );
}
-
+
buf.append( "\n" ).append( LdifUtils.convertToLdif( entry ) );
if ( list.next() )
{
buf.append( "\n\n#---------------------\n" );
}
-
+
out.print( buf.toString() );
out.flush();
buf.setLength( 0 );
@@ -252,11 +249,11 @@ public class DumpCommand extends ToolCom
{
List<String> toRemove = new ArrayList<String>();
NamingEnumeration<? extends Attribute> attrs = entry.getAll();
-
+
while ( attrs.hasMore() )
{
Attribute attr = attrs.next();
-
+
if ( !schemaManager.getAttributeTypeRegistry().contains( attr.getID() ) )
{
if ( !isQuietEnabled() )
@@ -269,17 +266,17 @@ public class DumpCommand extends ToolCom
AttributeType type = schemaManager.lookupAttributeTypeRegistry( attr.getID() );
boolean isOperational = type.getUsage() != UsageEnum.USER_APPLICATIONS;
-
+
if ( exclusions.contains( attr.getID() ) || ( isOperational && ( !includeOperational ) ) )
{
toRemove.add( attr.getID() );
}
}
-
- for ( String id:toRemove )
+
+ for ( String id : toRemove )
{
entry.remove( id );
-
+
if ( isDebugEnabled() )
{
System.out.println( "# Excluding attribute " + id + " in " + dn );
Modified: directory/shared/trunk/asn1/src/main/java/org/apache/directory/shared/asn1/ber/grammar/AbstractGrammar.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/asn1/src/main/java/org/apache/directory/shared/asn1/ber/grammar/AbstractGrammar.java?rev=948711&r1=948710&r2=948711&view=diff
==============================================================================
--- directory/shared/trunk/asn1/src/main/java/org/apache/directory/shared/asn1/ber/grammar/AbstractGrammar.java (original)
+++ directory/shared/trunk/asn1/src/main/java/org/apache/directory/shared/asn1/ber/grammar/AbstractGrammar.java Thu May 27 08:08:44 2010
@@ -24,7 +24,6 @@ import org.apache.directory.shared.asn1.
import org.apache.directory.shared.asn1.codec.DecoderException;
import org.apache.directory.shared.asn1.util.Asn1StringUtils;
import org.apache.directory.shared.i18n.I18n;
-
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -63,6 +62,7 @@ public abstract class AbstractGrammar im
/** The grammar's states */
protected IStates statesEnum;
+
/** Default constructor */
public AbstractGrammar()
{
@@ -93,6 +93,7 @@ public abstract class AbstractGrammar im
this.name = name;
}
+
/**
* Get the transition associated with the state and tag
*
@@ -128,13 +129,14 @@ public abstract class AbstractGrammar im
byte tagByte = container.getCurrentTLV().getTag();
// We will loop until no more actions are to be executed
- GrammarTransition transition = ( ( AbstractGrammar ) container.getGrammar() ).getTransition( currentState, tagByte );
+ GrammarTransition transition = ( ( AbstractGrammar ) container.getGrammar() ).getTransition( currentState,
+ tagByte );
if ( transition == null )
{
- String errorMessage = I18n.err( I18n.ERR_00001, currentGrammar.getStatesEnum().getState( currentState ),
- Asn1StringUtils.dumpByte( tagByte ) );
+ String errorMessage = I18n.err( I18n.ERR_00001, currentGrammar.getStatesEnum().getState( currentState ),
+ Asn1StringUtils.dumpByte( tagByte ) );
log.error( errorMessage );
Modified: directory/shared/trunk/cursor/src/main/java/org/apache/directory/shared/ldap/cursor/ListCursor.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/cursor/src/main/java/org/apache/directory/shared/ldap/cursor/ListCursor.java?rev=948711&r1=948710&r2=948711&view=diff
==============================================================================
--- directory/shared/trunk/cursor/src/main/java/org/apache/directory/shared/ldap/cursor/ListCursor.java (original)
+++ directory/shared/trunk/cursor/src/main/java/org/apache/directory/shared/ldap/cursor/ListCursor.java Thu May 27 08:08:44 2010
@@ -21,8 +21,8 @@ package org.apache.directory.shared.ldap
import java.io.IOException;
import java.util.Collections;
-import java.util.List;
import java.util.Comparator;
+import java.util.List;
import org.apache.directory.shared.i18n.I18n;
@@ -38,16 +38,16 @@ public class ListCursor<E> extends Abstr
{
/** The inner List */
private final List<E> list;
-
+
/** The associated comparator */
private final Comparator<E> comparator;
-
+
/** The starting position for the cursor in the list. It can be > 0 */
private final int start;
-
+
/** The ending position for the cursor in the list. It can be < List.size() */
private final int end;
-
+
/** The current position in the list */
private int index = -1;
@@ -67,11 +67,11 @@ public class ListCursor<E> extends Abstr
*/
public ListCursor( Comparator<E> comparator, int start, List<E> list, int end )
{
- if ( list == null )
- {
- list = Collections.emptyList();
- }
- if ( ( start < 0 )|| ( start > list.size() ) )
+ if ( list == null )
+ {
+ list = Collections.emptyList();
+ }
+ if ( ( start < 0 ) || ( start > list.size() ) )
{
throw new IllegalArgumentException( I18n.err( I18n.ERR_02005, start ) );
}
@@ -346,7 +346,7 @@ public class ListCursor<E> extends Abstr
index = end - 1;
return true;
}
-
+
return false;
}
@@ -474,7 +474,7 @@ public class ListCursor<E> extends Abstr
public E get() throws Exception
{
checkNotClosed( "get()" );
-
+
if ( index < start || index >= end )
{
throw new IOException( I18n.err( I18n.ERR_02009 ) );
Modified: directory/shared/trunk/dsml-parser/src/main/java/org/apache/directory/shared/dsmlv2/engine/Dsmlv2Engine.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/dsml-parser/src/main/java/org/apache/directory/shared/dsmlv2/engine/Dsmlv2Engine.java?rev=948711&r1=948710&r2=948711&view=diff
==============================================================================
--- directory/shared/trunk/dsml-parser/src/main/java/org/apache/directory/shared/dsmlv2/engine/Dsmlv2Engine.java (original)
+++ directory/shared/trunk/dsml-parser/src/main/java/org/apache/directory/shared/dsmlv2/engine/Dsmlv2Engine.java Thu May 27 08:08:44 2010
@@ -213,7 +213,8 @@ public class Dsmlv2Engine
{
// Unable to connect to server
// We create a new ErrorResponse and return the XML response.
- ErrorResponse errorResponse = new ErrorResponse( 0, ErrorResponseType.COULD_NOT_CONNECT, e.getLocalizedMessage() );
+ ErrorResponse errorResponse = new ErrorResponse( 0, ErrorResponseType.COULD_NOT_CONNECT, e
+ .getLocalizedMessage() );
batchResponse.addResponse( errorResponse );
return batchResponse.toDsml();
}
@@ -228,8 +229,8 @@ public class Dsmlv2Engine
catch ( XmlPullParserException e )
{
// We create a new ErrorResponse and return the XML response.
- ErrorResponse errorResponse = new ErrorResponse( 0, ErrorResponseType.MALFORMED_REQUEST, I18n.err(I18n.ERR_03001, e.getLocalizedMessage(),
- e.getLineNumber(), e.getColumnNumber() ) );
+ ErrorResponse errorResponse = new ErrorResponse( 0, ErrorResponseType.MALFORMED_REQUEST, I18n.err(
+ I18n.ERR_03001, e.getLocalizedMessage(), e.getLineNumber(), e.getColumnNumber() ) );
batchResponse.addResponse( errorResponse );
return batchResponse.toDsml();
}
@@ -248,8 +249,8 @@ public class Dsmlv2Engine
catch ( XmlPullParserException e )
{
// We create a new ErrorResponse and return the XML response.
- ErrorResponse errorResponse = new ErrorResponse( 0, ErrorResponseType.MALFORMED_REQUEST, I18n.err(I18n.ERR_03001, e.getLocalizedMessage(),
- e.getLineNumber(), e.getColumnNumber() ) );
+ ErrorResponse errorResponse = new ErrorResponse( 0, ErrorResponseType.MALFORMED_REQUEST, I18n.err(
+ I18n.ERR_03001, e.getLocalizedMessage(), e.getLineNumber(), e.getColumnNumber() ) );
batchResponse.addResponse( errorResponse );
return batchResponse.toDsml();
}
@@ -262,7 +263,8 @@ public class Dsmlv2Engine
&& ( request.getMessageId() == 0 ) )
{
// Then we have to send an errorResponse
- ErrorResponse errorResponse = new ErrorResponse( 0, ErrorResponseType.MALFORMED_REQUEST, I18n.err( I18n.ERR_03002 ) );
+ ErrorResponse errorResponse = new ErrorResponse( 0, ErrorResponseType.MALFORMED_REQUEST, I18n
+ .err( I18n.ERR_03002 ) );
batchResponse.addResponse( errorResponse );
return batchResponse.toDsml();
}
@@ -274,8 +276,8 @@ public class Dsmlv2Engine
catch ( Exception e )
{
// We create a new ErrorResponse and return the XML response.
- ErrorResponse errorResponse = new ErrorResponse( 0, ErrorResponseType.GATEWAY_INTERNAL_ERROR,
- I18n.err( I18n.ERR_03003, e.getMessage() ) );
+ ErrorResponse errorResponse = new ErrorResponse( 0, ErrorResponseType.GATEWAY_INTERNAL_ERROR, I18n.err(
+ I18n.ERR_03003, e.getMessage() ) );
batchResponse.addResponse( errorResponse );
return batchResponse.toDsml();
}
@@ -294,8 +296,8 @@ public class Dsmlv2Engine
catch ( XmlPullParserException e )
{
// We create a new ErrorResponse and return the XML response.
- ErrorResponse errorResponse = new ErrorResponse( 0, ErrorResponseType.MALFORMED_REQUEST, I18n.err( I18n.ERR_03001,
- e.getLocalizedMessage(), e.getLineNumber(), e.getColumnNumber() ) );
+ ErrorResponse errorResponse = new ErrorResponse( 0, ErrorResponseType.MALFORMED_REQUEST, I18n.err(
+ I18n.ERR_03001, e.getLocalizedMessage(), e.getLineNumber(), e.getColumnNumber() ) );
batchResponse.addResponse( errorResponse );
return batchResponse.toDsml();
}
@@ -324,7 +326,7 @@ public class Dsmlv2Engine
bb.clear();
bb.position( bb.capacity() );
-
+
// Get the response
LdapMessageCodec response = null;
@@ -332,120 +334,118 @@ public class Dsmlv2Engine
switch ( response.getMessageType() )
{
- case ADD_RESPONSE :
- AddResponseCodec addResponse = (AddResponseCodec)response;
+ case ADD_RESPONSE:
+ AddResponseCodec addResponse = ( AddResponseCodec ) response;
copyMessageIdAndControls( response, addResponse );
-
+
AddResponseDsml addResponseDsml = new AddResponseDsml( addResponse );
batchResponse.addResponse( addResponseDsml );
break;
-
- case BIND_RESPONSE :
- BindResponseCodec bindResponse = (BindResponseCodec)response;
+
+ case BIND_RESPONSE:
+ BindResponseCodec bindResponse = ( BindResponseCodec ) response;
copyMessageIdAndControls( response, bindResponse );
-
+
AuthResponseDsml authResponseDsml = new AuthResponseDsml( bindResponse );
batchResponse.addResponse( authResponseDsml );
break;
-
- case COMPARE_RESPONSE :
- CompareResponseCodec compareResponse = (CompareResponseCodec)response;
+
+ case COMPARE_RESPONSE:
+ CompareResponseCodec compareResponse = ( CompareResponseCodec ) response;
copyMessageIdAndControls( response, compareResponse );
-
+
CompareResponseDsml compareResponseDsml = new CompareResponseDsml( compareResponse );
batchResponse.addResponse( compareResponseDsml );
break;
- case DEL_RESPONSE :
- DelResponseCodec delResponse = (DelResponseCodec)response;
+ case DEL_RESPONSE:
+ DelResponseCodec delResponse = ( DelResponseCodec ) response;
copyMessageIdAndControls( response, delResponse );
-
+
DelResponseDsml delResponseDsml = new DelResponseDsml( delResponse );
batchResponse.addResponse( delResponseDsml );
break;
-
- case MODIFY_RESPONSE :
- ModifyResponseCodec modifyResponse = (ModifyResponseCodec)response;
+
+ case MODIFY_RESPONSE:
+ ModifyResponseCodec modifyResponse = ( ModifyResponseCodec ) response;
copyMessageIdAndControls( response, modifyResponse );
-
+
ModifyResponseDsml modifyResponseDsml = new ModifyResponseDsml( modifyResponse );
batchResponse.addResponse( modifyResponseDsml );
break;
- case MODIFYDN_RESPONSE :
- ModifyDNResponseCodec modifyDNResponse = (ModifyDNResponseCodec)response;
+ case MODIFYDN_RESPONSE:
+ ModifyDNResponseCodec modifyDNResponse = ( ModifyDNResponseCodec ) response;
copyMessageIdAndControls( response, modifyDNResponse );
-
+
ModDNResponseDsml modDNResponseDsml = new ModDNResponseDsml( modifyDNResponse );
batchResponse.addResponse( modDNResponseDsml );
break;
- case EXTENDED_RESPONSE :
- ExtendedResponseCodec extendedResponse = (ExtendedResponseCodec)response;
+ case EXTENDED_RESPONSE:
+ ExtendedResponseCodec extendedResponse = ( ExtendedResponseCodec ) response;
copyMessageIdAndControls( response, extendedResponse );
-
+
ExtendedResponseDsml extendedResponseDsml = new ExtendedResponseDsml( extendedResponse );
batchResponse.addResponse( extendedResponseDsml );
break;
- case SEARCH_RESULT_ENTRY :
- case SEARCH_RESULT_REFERENCE :
- case SEARCH_RESULT_DONE :
+ case SEARCH_RESULT_ENTRY:
+ case SEARCH_RESULT_REFERENCE:
+ case SEARCH_RESULT_DONE:
// A SearchResponse can contains multiple responses of 3 types:
// - 0 to n SearchResultEntry
// - O to n SearchResultReference
// - 1 (only) SearchResultDone
// So we have to include those individual responses in a "General" SearchResponse
SearchResponseDsml searchResponseDsml = null;
-
+
// RequestID
int requestID = response.getMessageId();
-
+
while ( MessageTypeEnum.SEARCH_RESULT_DONE != response.getMessageType() )
{
if ( MessageTypeEnum.SEARCH_RESULT_ENTRY == response.getMessageType() )
{
- SearchResultEntryCodec sre = (SearchResultEntryCodec)response;
+ SearchResultEntryCodec sre = ( SearchResultEntryCodec ) response;
copyMessageIdAndControls( response, sre );
-
+
SearchResultEntryDsml searchResultEntryDsml = new SearchResultEntryDsml( sre );
- searchResponseDsml = new SearchResponseDsml( (LdapMessageCodec)sre );
-
+ searchResponseDsml = new SearchResponseDsml( ( LdapMessageCodec ) sre );
+
if ( requestID != 0 )
{
searchResponseDsml.setMessageId( requestID );
}
-
+
searchResponseDsml.addResponse( searchResultEntryDsml );
}
else if ( MessageTypeEnum.SEARCH_RESULT_REFERENCE == response.getMessageType() )
{
- SearchResultReferenceCodec srr = (SearchResultReferenceCodec)response;
+ SearchResultReferenceCodec srr = ( SearchResultReferenceCodec ) response;
copyMessageIdAndControls( response, srr );
-
+
SearchResultReferenceDsml searchResultReferenceDsml = new SearchResultReferenceDsml( srr );
searchResponseDsml.addResponse( searchResultReferenceDsml );
}
-
+
response = readResponse( bb );
}
-
- SearchResultDoneCodec srd = (SearchResultDoneCodec)response;
+
+ SearchResultDoneCodec srd = ( SearchResultDoneCodec ) response;
copyMessageIdAndControls( response, srd );
-
+
SearchResultDoneDsml searchResultDoneDsml = new SearchResultDoneDsml( srd );
searchResponseDsml.addResponse( searchResultDoneDsml );
break;
}
- LdapResponseCodec realResponse = (LdapResponseCodec)response;
+ LdapResponseCodec realResponse = ( LdapResponseCodec ) response;
ResultCodeEnum resultCode = realResponse.getLdapResult().getResultCode();
- if ( ( !continueOnError )
- && ( resultCode != ResultCodeEnum.SUCCESS )
- && ( resultCode != ResultCodeEnum.COMPARE_TRUE )
- && ( resultCode != ResultCodeEnum.COMPARE_FALSE )
- && ( resultCode != ResultCodeEnum.REFERRAL ) )
+ if ( ( !continueOnError ) && ( resultCode != ResultCodeEnum.SUCCESS )
+ && ( resultCode != ResultCodeEnum.COMPARE_TRUE ) && ( resultCode != ResultCodeEnum.COMPARE_FALSE )
+ && ( resultCode != ResultCodeEnum.REFERRAL ) )
{
// Turning on Exit flag
exit = true;
@@ -456,7 +456,7 @@ public class Dsmlv2Engine
private void copyMessageIdAndControls( LdapMessageCodec from, LdapMessageCodec to )
{
to.setMessageId( from.getMessageId() );
-
+
for ( Control control : from.getControls() )
{
to.addControl( control );
Modified: directory/shared/trunk/dsml-parser/src/main/java/org/apache/directory/shared/dsmlv2/reponse/Dsmlv2ResponseGrammar.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/dsml-parser/src/main/java/org/apache/directory/shared/dsmlv2/reponse/Dsmlv2ResponseGrammar.java?rev=948711&r1=948710&r2=948711&view=diff
==============================================================================
--- directory/shared/trunk/dsml-parser/src/main/java/org/apache/directory/shared/dsmlv2/reponse/Dsmlv2ResponseGrammar.java (original)
+++ directory/shared/trunk/dsml-parser/src/main/java/org/apache/directory/shared/dsmlv2/reponse/Dsmlv2ResponseGrammar.java Thu May 27 08:08:44 2010
@@ -326,8 +326,8 @@ public class Dsmlv2ResponseGrammar exten
// State: [EXTENDED_RESPONSE_ERROR_MESSAGE_END] - Tag: <response>
super.transitions[Dsmlv2StatesEnum.EXTENDED_RESPONSE_ERROR_MESSAGE_END].put( new Tag( "response", Tag.START ),
- new GrammarTransition( Dsmlv2StatesEnum.EXTENDED_RESPONSE_ERROR_MESSAGE_END,
- Dsmlv2StatesEnum.RESPONSE_END, extendedResponseAddResponse ) );
+ new GrammarTransition( Dsmlv2StatesEnum.EXTENDED_RESPONSE_ERROR_MESSAGE_END, Dsmlv2StatesEnum.RESPONSE_END,
+ extendedResponseAddResponse ) );
// State: [EXTENDED_RESPONSE_ERROR_MESSAGE_END] - Tag: </extendedResponse>
super.transitions[Dsmlv2StatesEnum.EXTENDED_RESPONSE_ERROR_MESSAGE_END].put( new Tag( "extendedResponse",
@@ -341,8 +341,8 @@ public class Dsmlv2ResponseGrammar exten
// State: [EXTENDED_RESPONSE_REFERRAL_END] - Tag: <responseName>
super.transitions[Dsmlv2StatesEnum.EXTENDED_RESPONSE_REFERRAL_END].put( new Tag( "responseName", Tag.START ),
- new GrammarTransition( Dsmlv2StatesEnum.EXTENDED_RESPONSE_REFERRAL_END,
- Dsmlv2StatesEnum.RESPONSE_NAME_END, extendedResponseAddResponseName ) );
+ new GrammarTransition( Dsmlv2StatesEnum.EXTENDED_RESPONSE_REFERRAL_END, Dsmlv2StatesEnum.RESPONSE_NAME_END,
+ extendedResponseAddResponseName ) );
// State: [EXTENDED_RESPONSE_REFERRAL_END] - Tag: <reponse>
super.transitions[Dsmlv2StatesEnum.EXTENDED_RESPONSE_REFERRAL_END].put( new Tag( "reponse", Tag.START ),
@@ -766,7 +766,7 @@ public class Dsmlv2ResponseGrammar exten
attributeValue = xpp.getAttributeValue( "", "requestID" );
if ( attributeValue != null )
{
- batchResponse.setRequestID( ParserUtils.parseAndVerifyRequestID( attributeValue, xpp ) );
+ batchResponse.setRequestID( ParserUtils.parseAndVerifyRequestID( attributeValue, xpp ) );
}
}
};
@@ -835,8 +835,8 @@ public class Dsmlv2ResponseGrammar exten
attributeValue = xpp.getAttributeValue( "", "requestID" );
if ( attributeValue != null )
{
- bindResponse.setMessageId( ParserUtils.parseAndVerifyRequestID( attributeValue, xpp ) );
-
+ bindResponse.setMessageId( ParserUtils.parseAndVerifyRequestID( attributeValue, xpp ) );
+
}
// MatchedDN
attributeValue = xpp.getAttributeValue( "", "matchedDN" );
@@ -877,7 +877,7 @@ public class Dsmlv2ResponseGrammar exten
attributeValue = xpp.getAttributeValue( "", "requestID" );
if ( attributeValue != null )
{
- compareResponse.setMessageId( ParserUtils.parseAndVerifyRequestID( attributeValue, xpp ) );
+ compareResponse.setMessageId( ParserUtils.parseAndVerifyRequestID( attributeValue, xpp ) );
}
// MatchedDN
attributeValue = xpp.getAttributeValue( "", "matchedDN" );
@@ -918,7 +918,7 @@ public class Dsmlv2ResponseGrammar exten
attributeValue = xpp.getAttributeValue( "", "requestID" );
if ( attributeValue != null )
{
- delResponse.setMessageId( ParserUtils.parseAndVerifyRequestID( attributeValue, xpp ) );
+ delResponse.setMessageId( ParserUtils.parseAndVerifyRequestID( attributeValue, xpp ) );
}
// MatchedDN
attributeValue = xpp.getAttributeValue( "", "matchedDN" );
@@ -959,7 +959,7 @@ public class Dsmlv2ResponseGrammar exten
attributeValue = xpp.getAttributeValue( "", "requestID" );
if ( attributeValue != null )
{
- modifyResponse.setMessageId( ParserUtils.parseAndVerifyRequestID( attributeValue, xpp ) );
+ modifyResponse.setMessageId( ParserUtils.parseAndVerifyRequestID( attributeValue, xpp ) );
}
// MatchedDN
attributeValue = xpp.getAttributeValue( "", "matchedDN" );
@@ -1000,7 +1000,7 @@ public class Dsmlv2ResponseGrammar exten
attributeValue = xpp.getAttributeValue( "", "requestID" );
if ( attributeValue != null )
{
- modifyDNResponse.setMessageId( ParserUtils.parseAndVerifyRequestID( attributeValue, xpp ) );
+ modifyDNResponse.setMessageId( ParserUtils.parseAndVerifyRequestID( attributeValue, xpp ) );
}
// MatchedDN
attributeValue = xpp.getAttributeValue( "", "matchedDN" );
@@ -1041,7 +1041,7 @@ public class Dsmlv2ResponseGrammar exten
attributeValue = xpp.getAttributeValue( "", "requestID" );
if ( attributeValue != null )
{
- extendedResponse.setMessageId( ParserUtils.parseAndVerifyRequestID( attributeValue, xpp ) );
+ extendedResponse.setMessageId( ParserUtils.parseAndVerifyRequestID( attributeValue, xpp ) );
}
// MatchedDN
attributeValue = xpp.getAttributeValue( "", "matchedDN" );
@@ -1078,7 +1078,7 @@ public class Dsmlv2ResponseGrammar exten
attributeValue = xpp.getAttributeValue( "", "requestID" );
if ( attributeValue != null )
{
- errorResponse.setMessageId( ParserUtils.parseAndVerifyRequestID( attributeValue, xpp ) );
+ errorResponse.setMessageId( ParserUtils.parseAndVerifyRequestID( attributeValue, xpp ) );
}
// type
attributeValue = xpp.getAttributeValue( "", "type" );
@@ -1137,7 +1137,7 @@ public class Dsmlv2ResponseGrammar exten
public void action( Dsmlv2Container container ) throws XmlPullParserException
{
ErrorResponse errorResponse = ( ErrorResponse ) container.getBatchResponse().getCurrentResponse();
-
+
XmlPullParser xpp = container.getParser();
try
{
@@ -1166,7 +1166,8 @@ public class Dsmlv2ResponseGrammar exten
* @param parent the parent
* @throws XmlPullParserException
*/
- private void createAndAddControl( Dsmlv2Container container, LdapMessageCodec parent ) throws XmlPullParserException
+ private void createAndAddControl( Dsmlv2Container container, LdapMessageCodec parent )
+ throws XmlPullParserException
{
Control control = null;
@@ -1176,14 +1177,14 @@ public class Dsmlv2ResponseGrammar exten
String attributeValue;
// TYPE
attributeValue = xpp.getAttributeValue( "", "type" );
-
+
if ( attributeValue != null )
{
if ( !OID.isOID( attributeValue ) )
{
throw new XmlPullParserException( I18n.err( I18n.ERR_03006 ), xpp, null );
}
-
+
control = new ControlImpl( attributeValue );
parent.addControl( control );
}
@@ -1193,7 +1194,7 @@ public class Dsmlv2ResponseGrammar exten
}
// CRITICALITY
attributeValue = xpp.getAttributeValue( "", "criticality" );
-
+
if ( attributeValue != null )
{
if ( attributeValue.equals( "true" ) )
@@ -1274,10 +1275,10 @@ public class Dsmlv2ResponseGrammar exten
{
// We have to catch the type Attribute Value before going to the next Text node
String typeValue = ParserUtils.getXsiTypeAttributeValue( xpp );
-
+
// Getting the value
String nextText = xpp.nextText();
-
+
if ( !nextText.equals( "" ) )
{
if ( ParserUtils.isBase64BinaryValue( xpp, typeValue ) )
@@ -1507,7 +1508,7 @@ public class Dsmlv2ResponseGrammar exten
attributeValue = xpp.getAttributeValue( "", "requestID" );
if ( attributeValue != null )
{
- searchResponse.setMessageId( ParserUtils.parseAndVerifyRequestID( attributeValue, xpp ) );
+ searchResponse.setMessageId( ParserUtils.parseAndVerifyRequestID( attributeValue, xpp ) );
}
}
};
@@ -1534,7 +1535,7 @@ public class Dsmlv2ResponseGrammar exten
attributeValue = xpp.getAttributeValue( "", "requestID" );
if ( attributeValue != null )
{
- searchResultEntry.setMessageId( ParserUtils.parseAndVerifyRequestID( attributeValue, xpp ) );
+ searchResultEntry.setMessageId( ParserUtils.parseAndVerifyRequestID( attributeValue, xpp ) );
}
// dn
attributeValue = xpp.getAttributeValue( "", "dn" );
@@ -1578,7 +1579,7 @@ public class Dsmlv2ResponseGrammar exten
attributeValue = xpp.getAttributeValue( "", "requestID" );
if ( attributeValue != null )
{
- searchResultReference.setMessageId( ParserUtils.parseAndVerifyRequestID( attributeValue, xpp ) );
+ searchResultReference.setMessageId( ParserUtils.parseAndVerifyRequestID( attributeValue, xpp ) );
}
}
};
@@ -1607,7 +1608,7 @@ public class Dsmlv2ResponseGrammar exten
attributeValue = xpp.getAttributeValue( "", "requestID" );
if ( attributeValue != null )
{
- searchResultDone.setMessageId( ParserUtils.parseAndVerifyRequestID( attributeValue, xpp ) );
+ searchResultDone.setMessageId( ParserUtils.parseAndVerifyRequestID( attributeValue, xpp ) );
}
// MatchedDN
attributeValue = xpp.getAttributeValue( "", "matchedDN" );
@@ -1669,7 +1670,7 @@ public class Dsmlv2ResponseGrammar exten
{
// We have to catch the type Attribute Value before going to the next Text node
String typeValue = ParserUtils.getXsiTypeAttributeValue( xpp );
-
+
// Getting the value
String nextText = xpp.nextText();
if ( ParserUtils.isBase64BinaryValue( xpp, typeValue ) )
@@ -1742,7 +1743,8 @@ public class Dsmlv2ResponseGrammar exten
{
public void action( Dsmlv2Container container ) throws XmlPullParserException
{
- ExtendedResponseCodec extendedResponse = ( ExtendedResponseCodec ) container.getBatchResponse().getCurrentResponse();
+ ExtendedResponseCodec extendedResponse = ( ExtendedResponseCodec ) container.getBatchResponse()
+ .getCurrentResponse();
XmlPullParser xpp = container.getParser();
try
@@ -1752,7 +1754,7 @@ public class Dsmlv2ResponseGrammar exten
{
extendedResponse.setResponseName( new OID( nextText.trim() ) );
}
-
+
}
catch ( IOException e )
{
@@ -1772,14 +1774,15 @@ public class Dsmlv2ResponseGrammar exten
{
public void action( Dsmlv2Container container ) throws XmlPullParserException
{
- ExtendedResponseCodec extendedResponse = ( ExtendedResponseCodec ) container.getBatchResponse().getCurrentResponse();
+ ExtendedResponseCodec extendedResponse = ( ExtendedResponseCodec ) container.getBatchResponse()
+ .getCurrentResponse();
XmlPullParser xpp = container.getParser();
try
{
// We have to catch the type Attribute Value before going to the next Text node
String typeValue = ParserUtils.getXsiTypeAttributeValue( xpp );
-
+
// Getting the value
String nextText = xpp.nextText();
if ( ParserUtils.isBase64BinaryValue( xpp, typeValue ) )