[maven-release-plugin] copy for tag 1.0.0-M33
git-svn-id: https://svn.apache.org/repos/asf/directory/shared/tags/1.0.0-M33@1720705 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/dsml/parser/src/main/java/org/apache/directory/api/dsmlv2/AbstractGrammar.java b/dsml/parser/src/main/java/org/apache/directory/api/dsmlv2/AbstractGrammar.java
index a58c949..45ddf0a 100644
--- a/dsml/parser/src/main/java/org/apache/directory/api/dsmlv2/AbstractGrammar.java
+++ b/dsml/parser/src/main/java/org/apache/directory/api/dsmlv2/AbstractGrammar.java
@@ -144,7 +144,7 @@
{
XmlPullParser xpp = container.getParser();
- String tagName = Strings.toLowerCase( xpp.getName() );
+ String tagName = Strings.toLowerCaseAscii( xpp.getName() );
GrammarTransition transition = getTransition( container.getState(), new Tag( tagName, tagType ) );
diff --git a/dsml/parser/src/main/java/org/apache/directory/api/dsmlv2/Tag.java b/dsml/parser/src/main/java/org/apache/directory/api/dsmlv2/Tag.java
index cb2ea40..03af796 100644
--- a/dsml/parser/src/main/java/org/apache/directory/api/dsmlv2/Tag.java
+++ b/dsml/parser/src/main/java/org/apache/directory/api/dsmlv2/Tag.java
@@ -80,7 +80,7 @@
*/
public void setName( String name )
{
- this.name = Strings.toLowerCase( name );
+ this.name = Strings.toLowerCaseAscii( name );
}
diff --git a/integ/src/test/java/org/apache/directory/api/ldap/entry/TestEntryUtils.java b/integ/src/test/java/org/apache/directory/api/ldap/entry/TestEntryUtils.java
index 6eb312d..fbbcd8d 100644
--- a/integ/src/test/java/org/apache/directory/api/ldap/entry/TestEntryUtils.java
+++ b/integ/src/test/java/org/apache/directory/api/ldap/entry/TestEntryUtils.java
@@ -163,7 +163,7 @@
{
if ( value.isHumanReadable() )
{
- return new StringValue( Strings.toLowerCase( value.getString() ) );
+ return new StringValue( Strings.toLowerCaseAscii( value.getString() ) );
}
throw new IllegalStateException();
@@ -172,7 +172,7 @@
public String normalize( String value ) throws LdapException
{
- return Strings.toLowerCase( value );
+ return Strings.toLowerCaseAscii( value );
}
};
diff --git a/ldap/client/api/src/main/java/org/apache/directory/ldap/client/api/LdifAnonymizer.java b/ldap/client/api/src/main/java/org/apache/directory/ldap/client/api/LdifAnonymizer.java
index f739b99..9c39911 100644
--- a/ldap/client/api/src/main/java/org/apache/directory/ldap/client/api/LdifAnonymizer.java
+++ b/ldap/client/api/src/main/java/org/apache/directory/ldap/client/api/LdifAnonymizer.java
@@ -40,11 +40,15 @@
import org.apache.directory.api.ldap.model.entry.Attribute;
import org.apache.directory.api.ldap.model.entry.DefaultAttribute;
import org.apache.directory.api.ldap.model.entry.DefaultEntry;
+import org.apache.directory.api.ldap.model.entry.DefaultModification;
import org.apache.directory.api.ldap.model.entry.Entry;
+import org.apache.directory.api.ldap.model.entry.Modification;
+import org.apache.directory.api.ldap.model.entry.StringValue;
import org.apache.directory.api.ldap.model.entry.Value;
import org.apache.directory.api.ldap.model.exception.LdapException;
import org.apache.directory.api.ldap.model.exception.LdapInvalidAttributeValueException;
import org.apache.directory.api.ldap.model.exception.LdapInvalidDnException;
+import org.apache.directory.api.ldap.model.ldif.ChangeType;
import org.apache.directory.api.ldap.model.ldif.LdifEntry;
import org.apache.directory.api.ldap.model.ldif.LdifReader;
import org.apache.directory.api.ldap.model.ldif.LdifUtils;
@@ -490,6 +494,7 @@
LdifReader ldifReader = new LdifReader( inputFile, schemaManager );
int count = 0;
List<LdifEntry> errors = new ArrayList<LdifEntry>();
+ List<String> errorTexts = new ArrayList<String>();
try
{
@@ -566,6 +571,7 @@
}
errors.add( ldifEntry );
+ errorTexts.add( e.getMessage() );
}
}
@@ -574,11 +580,14 @@
if ( errors.size() != 0 )
{
println( "There are " + errors.size() + " bad entries" );
+ int i = 0;
for ( LdifEntry ldifEntry : errors )
{
println( "---------------------------------------------------" );
+ println( "error : " + errorTexts.get( i ) );
println( ldifEntry.getDn().toString() );
+ i++;
}
}
}
@@ -595,6 +604,258 @@
ldifReader.close();
}
}
+
+
+ /**
+ * Anonymize a Modify change
+ */
+ private LdifEntry anonymizeChangeModify( LdifEntry ldifEntry ) throws LdapException
+ {
+ Dn entryDn = ldifEntry.getDn();
+ LdifEntry newLdifEntry = new LdifEntry( schemaManager );
+ newLdifEntry.setChangeType( ChangeType.Modify );
+
+ // Process the DN first
+ Dn anonymizedDn = anonymizeDn( entryDn );
+
+ if ( anonymizedDn == null )
+ {
+ return null;
+ }
+
+ newLdifEntry.setDn( anonymizedDn );
+
+ // Now, process the entry's attributes
+ for ( Modification modification : ldifEntry.getModifications() )
+ {
+ Attribute attribute = modification.getAttribute();
+ AttributeType attributeType = schemaManager.getAttributeType( attribute.getId() );
+ attribute.apply( attributeType );
+
+ // Deal with the special case of a DN syntax
+
+ if ( attributeType.getSyntax().getSyntaxChecker() instanceof DnSyntaxChecker )
+ {
+ Value<?>[] anonymizedValues = new Value<?>[ attribute.size()];
+ int pos = 0;
+
+ for ( Value<?> dnValue : modification.getAttribute() )
+ {
+ Dn dn = new Dn( schemaManager, dnValue.getString() );
+ Dn newdDn = anonymizeDn( dn );
+ anonymizedValues[pos++] = new StringValue( newdDn.toString() );
+ }
+
+ Modification anonymizedModification = new DefaultModification( modification.getOperation(), attributeType, anonymizedValues );
+ newLdifEntry.addModification( anonymizedModification );
+ }
+ else
+ {
+ Anonymizer anonymizer = attributeAnonymizers.get( attributeType.getOid() );
+
+ if ( anonymizer == null )
+ {
+ newLdifEntry.addModification( modification );
+ }
+ else
+ {
+ Attribute anonymizedAttribute = anonymizer.anonymize( valueMap, attribute );
+
+ Modification anonymizedModification = new DefaultModification( modification.getOperation(), anonymizedAttribute );
+ newLdifEntry.addModification( anonymizedModification );
+ }
+ }
+ }
+
+ return newLdifEntry;
+ }
+
+
+ /**
+ * Anonymize a Add change
+ */
+ private LdifEntry anonymizeChangeAdd( LdifEntry ldifEntry ) throws LdapException
+ {
+ Dn entryDn = ldifEntry.getDn();
+ LdifEntry newLdifEntry = new LdifEntry( schemaManager );
+ newLdifEntry.setChangeType( ChangeType.Add );
+
+ // Process the DN first
+ Dn anonymizedDn = anonymizeDn( entryDn );
+
+ if ( anonymizedDn == null )
+ {
+ return null;
+ }
+
+ newLdifEntry.setDn( anonymizedDn );
+
+ // Now, process the entry's attributes
+ for ( Attribute attribute : ldifEntry )
+ {
+ AttributeType attributeType = attribute.getAttributeType();
+ Attribute anonymizedAttribute = new DefaultAttribute( attributeType );
+
+ // Deal with the special case of a DN syntax
+
+ if ( attributeType.getSyntax().getSyntaxChecker() instanceof DnSyntaxChecker )
+ {
+ for ( Value<?> dnValue : attribute )
+ {
+ Dn dn = new Dn( schemaManager, dnValue.getString() );
+ Dn newdDn = anonymizeDn( dn );
+ anonymizedAttribute.add( newdDn.toString() );
+ }
+
+ newLdifEntry.addAttribute( attribute );
+ }
+ else
+ {
+ Anonymizer anonymizer = attributeAnonymizers.get( attribute.getAttributeType().getOid() );
+
+ if ( anonymizer == null )
+ {
+ newLdifEntry.addAttribute( attribute );
+ }
+ else
+ {
+ anonymizedAttribute = anonymizer.anonymize( valueMap, attribute );
+
+ if ( anonymizedAttribute != null )
+ {
+ newLdifEntry.addAttribute( anonymizedAttribute );
+ }
+ }
+ }
+ }
+
+ return newLdifEntry;
+ }
+
+
+ /**
+ * Anonymize a Delete change
+ */
+ private LdifEntry anonymizeChangeDelete( LdifEntry ldifEntry ) throws LdapException
+ {
+ Dn entryDn = ldifEntry.getDn();
+
+ // Process the DN, there is nothing more in the entry
+ Dn anonymizedDn = anonymizeDn( entryDn );
+
+ if ( anonymizedDn == null )
+ {
+ return null;
+ }
+
+ ldifEntry.setDn( anonymizedDn );
+
+ return ldifEntry;
+ }
+
+
+ /**
+ * Anonymize a Delete change
+ */
+ private LdifEntry anonymizeChangeModDn( LdifEntry ldifEntry ) throws LdapException
+ {
+ Dn entryDn = ldifEntry.getDn();
+
+ // Process the DN
+ Dn anonymizedDn = anonymizeDn( entryDn );
+
+ if ( anonymizedDn == null )
+ {
+ return null;
+ }
+
+ ldifEntry.setDn( anonymizedDn );
+
+ // Anonymize the newRdn if any
+ Dn newRdn = new Dn( schemaManager, ldifEntry.getNewRdn() );
+ Dn anonymizedRdn = anonymizeDn( newRdn );
+
+ if ( anonymizedRdn == null )
+ {
+ return null;
+ }
+
+ ldifEntry.setNewRdn( anonymizedRdn.toString() );
+
+ // Anonymize the neSuperior if any
+ Dn newSuperior = new Dn( schemaManager, ldifEntry.getNewSuperior() );
+
+ Dn anonymizedSuperior = anonymizeDn( newSuperior );
+
+ if ( anonymizedSuperior == null )
+ {
+ return null;
+ }
+
+ ldifEntry.setNewSuperior( anonymizedSuperior.toString() );
+
+ return ldifEntry;
+ }
+
+
+ /**
+ * Anonymize the full entry
+ */
+ private Entry anonymizeEntry( LdifEntry ldifEntry ) throws LdapException
+ {
+ Entry entry = ldifEntry.getEntry();
+ Entry newEntry = new DefaultEntry( schemaManager );
+
+ // Process the DN first
+ Dn entryDn = entry.getDn();
+
+ Dn anonymizedDn = anonymizeDn( entryDn );
+
+ if ( anonymizedDn == null )
+ {
+ return null;
+ }
+
+ // Now, process the entry's attributes
+ for ( Attribute attribute : entry )
+ {
+ AttributeType attributeType = attribute.getAttributeType();
+
+ // Deal with the special case of
+
+ if ( attributeType.getSyntax().getSyntaxChecker() instanceof DnSyntaxChecker )
+ {
+ for ( Value<?> dnValue : attribute )
+ {
+ Dn dn = new Dn( schemaManager, dnValue.getString() );
+ Dn newdDn = anonymizeDn( dn );
+ newEntry.add( attributeType, newdDn.toString() );
+ }
+ }
+ else
+ {
+ Anonymizer anonymizer = attributeAnonymizers.get( attribute.getAttributeType().getOid() );
+
+ if ( anonymizer == null )
+ {
+ newEntry.add( attribute );
+ }
+ else
+ {
+ Attribute anonymizedAttribute = anonymizer.anonymize( valueMap, attribute );
+
+ if ( anonymizedAttribute != null )
+ {
+ newEntry.add( anonymizedAttribute );
+ }
+ }
+ }
+ }
+
+ newEntry.setDn( anonymizedDn );
+
+ return newEntry;
+ }
/**
@@ -616,58 +877,61 @@
for ( LdifEntry ldifEntry : entries )
{
- Entry entry = ldifEntry.getEntry();
- Entry newEntry = new DefaultEntry( schemaManager );
-
- // Process the DN first
- Dn entryDn = entry.getDn();
-
- Dn anonymizedDn = anonymizeDn( entryDn );
-
- if ( anonymizedDn == null )
+ if ( ldifEntry.isEntry() && !ldifEntry.isChangeAdd() )
{
- continue;
- }
-
- // Now, process the entry
- for ( Attribute attribute : entry )
- {
- AttributeType attributeType = attribute.getAttributeType();
+ // process a full entry. Add changes aren't preocessed ghere.
+ Entry newEntry = anonymizeEntry( ldifEntry );
- // Deal with the special case of
-
- if ( attributeType.getSyntax().getSyntaxChecker() instanceof DnSyntaxChecker )
+ if ( newEntry != null )
{
- for ( Value<?> dnValue : attribute )
- {
- Dn dn = new Dn( schemaManager, dnValue.getString() );
- Dn newdDn = anonymizeDn( dn );
- newEntry.add( attributeType, newdDn.toString() );
- }
- }
- else
- {
- Anonymizer anonymizer = attributeAnonymizers.get( attribute.getAttributeType().getOid() );
-
- if ( anonymizer == null )
- {
- newEntry.add( attribute );
- }
- else
- {
- Attribute anonymizedAttribute = anonymizer.anonymize( valueMap, attribute );
-
- if ( anonymizedAttribute != null )
- {
- newEntry.add( anonymizedAttribute );
- }
- }
+ result.append( LdifUtils.convertToLdif( newEntry ) );
+ result.append( "\n" );
}
}
+ else if ( ldifEntry.isChangeDelete() )
+ {
+ // A Delete operation
+ LdifEntry newLdifEntry = anonymizeChangeDelete( ldifEntry );
- newEntry.setDn( anonymizedDn );
- result.append( LdifUtils.convertToLdif( newEntry ) );
- result.append( "\n" );
+ if ( ldifEntry != null )
+ {
+ result.append( newLdifEntry );
+ result.append( "\n" );
+ }
+ }
+ else if ( ldifEntry.isChangeAdd() )
+ {
+ // A Add operation
+ LdifEntry newLdifEntry = anonymizeChangeAdd( ldifEntry );
+
+ if ( ldifEntry != null )
+ {
+ result.append( newLdifEntry );
+ result.append( "\n" );
+ }
+ }
+ else if ( ldifEntry.isChangeModify() )
+ {
+ // A Modify operation
+ LdifEntry newLdifEntry = anonymizeChangeModify( ldifEntry );
+
+ if ( ldifEntry != null )
+ {
+ result.append( newLdifEntry );
+ result.append( "\n" );
+ }
+ }
+ else if ( ldifEntry.isChangeModDn() || ldifEntry.isChangeModRdn() )
+ {
+ // A MODDN operation
+ LdifEntry newLdifEntry = anonymizeChangeModDn( ldifEntry );
+
+ if ( ldifEntry != null )
+ {
+ result.append( newLdifEntry );
+ result.append( "\n" );
+ }
+ }
}
return result.toString();
diff --git a/ldap/client/api/src/test/java/org/apache/directory/ldap/client/api/LdifAnonymizerTest.java b/ldap/client/api/src/test/java/org/apache/directory/ldap/client/api/LdifAnonymizerTest.java
index f400f75..454a027 100644
--- a/ldap/client/api/src/test/java/org/apache/directory/ldap/client/api/LdifAnonymizerTest.java
+++ b/ldap/client/api/src/test/java/org/apache/directory/ldap/client/api/LdifAnonymizerTest.java
@@ -136,4 +136,70 @@
anonymizer.addNamingContext( "dc=example,dc=com" );
anonymizer.anonymize( ldif );
}
+
+
+ @Test
+ public void testLdifAnonymizer4() throws Exception, Exception
+ {
+ String ldif =
+ "dn: ou=PD Accountants, ou=Product Development, ou=usa, dc=airius, dc=com\n" +
+ "changetype: modrdn\n" +
+ "newrdn: ou=Product Development Accountants\n" +
+ "deleteoldrdn: 0\n" +
+ "newsuperior: ou=Accounting, ou=usa, dc=airius, dc=com\n" +
+ "\n" +
+ "dn: cn=Paula Jensen, ou=Product Development, dc=airius, dc=com\n" +
+ "changetype: modify\n" +
+ "add: postaladdress\n" +
+ "postaladdress: 123 Anystreet $ Sunnyvale, CA $ 94086\n" +
+ "-\n" +
+ "delete: description\n" +
+ "-\n" +
+ "replace: telephonenumber\n" +
+ "telephonenumber: +1 408 555 1234\n" +
+ "telephonenumber: +1 408 555 5678\n" +
+ "-\n" +
+ "delete: facsimiletelephonenumber\n" +
+ "facsimiletelephonenumber: +1 408 555 9876\n" +
+ "-\n" +
+ "\n" +
+ "dn: cn=cn2,ou=People,o=hp.com\n" +
+ "changetype: add\n" +
+ "ObjectClass: top\n" +
+ "objectClass: person\n" +
+ "cn: cn1\n" +
+ "cn: cn2\n" +
+ "cn: cn3\n" +
+ "userPassword: test\n" +
+ "sn: elecharny\n" +
+ "givenname: test\n" +
+ "\n" +
+ "dn: uid=thayapari.a.wijesundara@hp.com,ou=People,o=hp.com\n" +
+ "changetype: delete\n" +
+ "\n" +
+ "dn: uid=thayapari.a.wijesundara@hp.com,ou=People,o=hp.com\n" +
+ "changetype: modify\n" +
+ "replace: telephoneNumber\n" +
+ "telephoneNumber::KzYxIDIgODI3ODQ2NDQ=\n" +
+ "-\n" +
+ "\n" +
+ "dn: uid=thayapari.a.wijesundara@hp.com,ou=People,o=hp.com\n" +
+ "changetype: modify\n" +
+ "replace: telephoneNumber\n" +
+ "telephoneNumber::KzYxIDIgODI3ODQ2NDQ=\n" +
+ "-\n" +
+ "\n" +
+ "dn: cn=vsmuser_g1u2283c,ou=Groups,o=hp.com\n" +
+ "changetype: modify\n" +
+ "replace: member\n" +
+ "member::Y249dnNtLmhvdXN0b24uaHAuY29tLG91PVNlcnZlcnMsbz1ocC5jb20=\n" +
+ "member::dWlkPXRpbS50dXNzaW5nQGhwLmNvbSxvdT1QZW9wbGUsbz1ocC5jb20=\n" +
+ "member::dWlkPXRpbS50dXNzaW5nQGhwZS5jb20sb3U9UGVvcGxlLG89aHAuY29t\n" +
+ "member::dWlkPW1hcnRoYWxhLm5pci5yZWRkeUBocGUuY29tLG91PVBlb3BsZSxvPWhwLmNvbQ==\n" +
+ "-";
+
+ LdifAnonymizer anonymizer = new LdifAnonymizer( schemaManager );
+ anonymizer.addNamingContext( "dc=example,dc=com" );
+ anonymizer.anonymize( ldif );
+ }
}
diff --git a/ldap/codec/core/src/main/java/org/apache/directory/api/ldap/codec/api/DefaultConfigurableBinaryAttributeDetector.java b/ldap/codec/core/src/main/java/org/apache/directory/api/ldap/codec/api/DefaultConfigurableBinaryAttributeDetector.java
index 3f080fe..3033bf4 100644
--- a/ldap/codec/core/src/main/java/org/apache/directory/api/ldap/codec/api/DefaultConfigurableBinaryAttributeDetector.java
+++ b/ldap/codec/core/src/main/java/org/apache/directory/api/ldap/codec/api/DefaultConfigurableBinaryAttributeDetector.java
@@ -146,7 +146,7 @@
return true;
}
- String attrId = Strings.toLowerCase( attributeId );
+ String attrId = Strings.toLowerCaseAscii( attributeId );
return binaryAttributes.contains( attrId );
}
@@ -161,7 +161,7 @@
{
for ( String binaryAttribute : binaryAttributes )
{
- String attrId = Strings.toLowerCase( binaryAttribute );
+ String attrId = Strings.toLowerCaseAscii( binaryAttribute );
this.binaryAttributes.add( attrId );
}
}
@@ -177,7 +177,7 @@
{
for ( String binaryAttribute : binaryAttributes )
{
- String attrId = Strings.toLowerCase( binaryAttribute );
+ String attrId = Strings.toLowerCaseAscii( binaryAttribute );
this.binaryAttributes.remove( attrId );
}
}
diff --git a/ldap/codec/core/src/main/java/org/apache/directory/api/ldap/codec/api/SchemaBinaryAttributeDetector.java b/ldap/codec/core/src/main/java/org/apache/directory/api/ldap/codec/api/SchemaBinaryAttributeDetector.java
index 3a30cec..f47cd47 100644
--- a/ldap/codec/core/src/main/java/org/apache/directory/api/ldap/codec/api/SchemaBinaryAttributeDetector.java
+++ b/ldap/codec/core/src/main/java/org/apache/directory/api/ldap/codec/api/SchemaBinaryAttributeDetector.java
@@ -60,7 +60,7 @@
*/
public boolean isBinary( String attributeId )
{
- String attrId = Strings.toLowerCase( attributeId );
+ String attrId = Strings.toLowerCaseAscii( attributeId );
if ( attrId.endsWith( ";binary" ) )
{
diff --git a/ldap/codec/core/src/test/java/org/apache/directory/api/ldap/codec/add/AddRequestTest.java b/ldap/codec/core/src/test/java/org/apache/directory/api/ldap/codec/add/AddRequestTest.java
index b02f70e..77a40f1 100644
--- a/ldap/codec/core/src/test/java/org/apache/directory/api/ldap/codec/add/AddRequestTest.java
+++ b/ldap/codec/core/src/test/java/org/apache/directory/api/ldap/codec/add/AddRequestTest.java
@@ -224,9 +224,9 @@
Attribute attribute = entry.get( "l" );
- assertTrue( expectedTypes.contains( Strings.toLowerCase( attribute.getId() ) ) );
+ assertTrue( expectedTypes.contains( Strings.toLowerCaseAscii( attribute.getId() ) ) );
- Set<String> vals = ( Set<String> ) typesVals.get( Strings.toLowerCase( attribute.getId() ) );
+ Set<String> vals = ( Set<String> ) typesVals.get( Strings.toLowerCaseAscii( attribute.getId() ) );
for ( Value<?> value : attribute )
{
@@ -237,9 +237,9 @@
attribute = entry.get( "attrs" );
- assertTrue( expectedTypes.contains( Strings.toLowerCase( attribute.getId() ) ) );
+ assertTrue( expectedTypes.contains( Strings.toLowerCaseAscii( attribute.getId() ) ) );
- vals = ( Set<String> ) typesVals.get( Strings.toLowerCase( attribute.getId() ) );
+ vals = ( Set<String> ) typesVals.get( Strings.toLowerCaseAscii( attribute.getId() ) );
for ( Value<?> value : attribute )
{
@@ -1065,7 +1065,7 @@
Attribute attribute = entry.get( "l" );
- assertEquals( "l", Strings.toLowerCase( attribute.getId() ) );
+ assertEquals( "l", Strings.toLowerCaseAscii( attribute.getId() ) );
for ( Value<?> value : attribute )
{
@@ -1219,7 +1219,7 @@
Attribute attribute = entry.get( "l" );
- assertEquals( "l", Strings.toLowerCase( attribute.getId() ) );
+ assertEquals( "l", Strings.toLowerCaseAscii( attribute.getId() ) );
for ( Value<?> value : attribute )
{
diff --git a/ldap/codec/core/src/test/java/org/apache/directory/api/ldap/codec/modify/ModifyRequestTest.java b/ldap/codec/core/src/test/java/org/apache/directory/api/ldap/codec/modify/ModifyRequestTest.java
index 74d1d50..9a26729 100644
--- a/ldap/codec/core/src/test/java/org/apache/directory/api/ldap/codec/modify/ModifyRequestTest.java
+++ b/ldap/codec/core/src/test/java/org/apache/directory/api/ldap/codec/modify/ModifyRequestTest.java
@@ -544,7 +544,7 @@
Modification modification = ( Modification ) modifications[0];
Attribute attributeValue = modification.getAttribute();
- assertEquals( "telephonenumber", Strings.toLowerCase( attributeValue.getId() ) );
+ assertEquals( "telephonenumber", Strings.toLowerCaseAscii( attributeValue.getId() ) );
String attrValue = attributeValue.getString();
assertEquals( "1234567890", attrValue );
@@ -552,7 +552,7 @@
modification = ( Modification ) modifications[1];
attributeValue = modification.getAttribute();
- assertEquals( "cn", Strings.toLowerCase( attributeValue.getUpId() ) );
+ assertEquals( "cn", Strings.toLowerCaseAscii( attributeValue.getUpId() ) );
attrValue = attributeValue.getString();
assertEquals( "XXX", attrValue );
@@ -820,7 +820,7 @@
Modification modification = ( Modification ) modifications[0];
Attribute attributeValue = modification.getAttribute();
- assertEquals( "description", Strings.toLowerCase( attributeValue.getUpId() ) );
+ assertEquals( "description", Strings.toLowerCaseAscii( attributeValue.getUpId() ) );
assertEquals( 0, attributeValue.size() );
modification = ( Modification ) modifications[1];
@@ -828,7 +828,7 @@
String attrValue = attributeValue.getString();
- assertEquals( "telephonenumber", Strings.toLowerCase( attributeValue.getUpId() ) );
+ assertEquals( "telephonenumber", Strings.toLowerCaseAscii( attributeValue.getUpId() ) );
assertEquals( "01234567890", attrValue );
@@ -837,7 +837,7 @@
attrValue = attributeValue.getString();
- assertEquals( "telephonenumber", Strings.toLowerCase( attributeValue.getUpId() ) );
+ assertEquals( "telephonenumber", Strings.toLowerCaseAscii( attributeValue.getUpId() ) );
attrValue = attributeValue.getString();
assertEquals( "01234567890", attrValue );
@@ -1023,7 +1023,7 @@
Modification modification = ( Modification ) modifications[0];
Attribute attributeValue = modification.getAttribute();
- assertEquals( "l", Strings.toLowerCase( attributeValue.getUpId() ) );
+ assertEquals( "l", Strings.toLowerCaseAscii( attributeValue.getUpId() ) );
assertTrue( attributeValue.contains( "Paris" ) );
assertTrue( attributeValue.contains( "London" ) );
@@ -1031,7 +1031,7 @@
modification = ( Modification ) modifications[1];
attributeValue = modification.getAttribute();
- assertEquals( "attrs", Strings.toLowerCase( attributeValue.getUpId() ) );
+ assertEquals( "attrs", Strings.toLowerCaseAscii( attributeValue.getUpId() ) );
String attrValue = attributeValue.getString();
assertEquals( "test", attrValue );
@@ -1956,7 +1956,7 @@
Modification modification = ( Modification ) modifications[0];
Attribute attributeValue = modification.getAttribute();
- assertEquals( "l", Strings.toLowerCase( attributeValue.getUpId() ) );
+ assertEquals( "l", Strings.toLowerCaseAscii( attributeValue.getUpId() ) );
assertEquals( 0, attributeValue.size() );
// Check the encoding
@@ -2108,7 +2108,7 @@
Modification modification = ( Modification ) modifications[0];
Attribute attributeValue = modification.getAttribute();
- assertEquals( "l", Strings.toLowerCase( attributeValue.getUpId() ) );
+ assertEquals( "l", Strings.toLowerCaseAscii( attributeValue.getUpId() ) );
assertEquals( 0, attributeValue.size() );
// Check the Control
@@ -2248,7 +2248,7 @@
Modification modification = ( Modification ) modifications[0];
Attribute attributeValue = modification.getAttribute();
- assertEquals( "l", Strings.toLowerCase( attributeValue.getUpId() ) );
+ assertEquals( "l", Strings.toLowerCaseAscii( attributeValue.getUpId() ) );
assertEquals( 2, attributeValue.size() );
assertTrue( attributeValue.contains( "a" ) );
diff --git a/ldap/codec/core/src/test/java/org/apache/directory/api/ldap/codec/search/SearchResultEntryTest.java b/ldap/codec/core/src/test/java/org/apache/directory/api/ldap/codec/search/SearchResultEntryTest.java
index b6d35be..962f360 100644
--- a/ldap/codec/core/src/test/java/org/apache/directory/api/ldap/codec/search/SearchResultEntryTest.java
+++ b/ldap/codec/core/src/test/java/org/apache/directory/api/ldap/codec/search/SearchResultEntryTest.java
@@ -190,7 +190,7 @@
{
Attribute attribute = entry.get( "objectclass" );
- assertEquals( Strings.toLowerCase( "objectClass" ), Strings.toLowerCase( attribute.getUpId() ) );
+ assertEquals( Strings.toLowerCaseAscii( "objectClass" ), Strings.toLowerCaseAscii( attribute.getUpId() ) );
assertTrue( attribute.contains( "top" ) );
assertTrue( attribute.contains( "organizationalUnit" ) );
@@ -398,8 +398,8 @@
Attribute attribute = entry.get( expectedAttributes[i] );
assertEquals(
- Strings.toLowerCase( expectedAttributes[i] ),
- Strings.toLowerCase( attribute.getUpId() ) );
+ Strings.toLowerCaseAscii( expectedAttributes[i] ),
+ Strings.toLowerCaseAscii( attribute.getUpId() ) );
assertTrue( attribute.contains( "top" ) );
assertTrue( attribute.contains( "organizationalUnit" ) );
@@ -585,7 +585,7 @@
{
Attribute attribute = entry.get( "objectclass" );
- assertEquals( Strings.toLowerCase( "objectClass" ), Strings.toLowerCase( attribute.getUpId() ) );
+ assertEquals( Strings.toLowerCaseAscii( "objectClass" ), Strings.toLowerCaseAscii( attribute.getUpId() ) );
assertTrue( attribute.contains( "top" ) );
assertTrue( attribute.contains( "person" ) );
@@ -1350,7 +1350,7 @@
{
Attribute attribute = entry.get( "objectclass" );
- assertEquals( Strings.toLowerCase( "objectClass" ), Strings.toLowerCase( attribute.getUpId() ) );
+ assertEquals( Strings.toLowerCaseAscii( "objectClass" ), Strings.toLowerCaseAscii( attribute.getUpId() ) );
assertEquals( 0, attribute.size() );
}
@@ -1494,11 +1494,11 @@
assertEquals( 2, entry.size() );
Attribute attribute = entry.get( "objectclass" );
- assertEquals( Strings.toLowerCase( "objectClass" ), Strings.toLowerCase( attribute.getUpId() ) );
+ assertEquals( Strings.toLowerCaseAscii( "objectClass" ), Strings.toLowerCaseAscii( attribute.getUpId() ) );
assertEquals( 0, attribute.size() );
attribute = entry.get( "objectclazz" );
- assertEquals( Strings.toLowerCase( "objectClazz" ), Strings.toLowerCase( attribute.getUpId() ) );
+ assertEquals( Strings.toLowerCaseAscii( "objectClazz" ), Strings.toLowerCaseAscii( attribute.getUpId() ) );
assertEquals( 0, attribute.size() );
// Check the encoding
@@ -1656,7 +1656,7 @@
{
Attribute attribute = entry.get( "objectclass" );
- assertEquals( Strings.toLowerCase( "objectClass" ), Strings.toLowerCase( attribute.getUpId() ) );
+ assertEquals( Strings.toLowerCaseAscii( "objectClass" ), Strings.toLowerCaseAscii( attribute.getUpId() ) );
assertEquals( 0, attribute.size() );
}
@@ -1799,7 +1799,7 @@
{
Attribute attribute = entry.get( "objectclass" );
- assertEquals( Strings.toLowerCase( "objectClass" ), Strings.toLowerCase( attribute.getUpId() ) );
+ assertEquals( Strings.toLowerCaseAscii( "objectClass" ), Strings.toLowerCaseAscii( attribute.getUpId() ) );
assertTrue( attribute.contains( "" ) );
}
@@ -1962,7 +1962,7 @@
{
Attribute attribute = entry.get( "objectclass" );
- assertEquals( Strings.toLowerCase( "objectClass" ), Strings.toLowerCase( attribute.getUpId() ) );
+ assertEquals( Strings.toLowerCaseAscii( "objectClass" ), Strings.toLowerCaseAscii( attribute.getUpId() ) );
assertTrue( attribute.contains( "" ) );
}
diff --git a/ldap/model/src/main/java/org/apache/directory/api/ldap/model/entry/DefaultAttribute.java b/ldap/model/src/main/java/org/apache/directory/api/ldap/model/entry/DefaultAttribute.java
index 2515cc7..40d239f 100644
--- a/ldap/model/src/main/java/org/apache/directory/api/ldap/model/entry/DefaultAttribute.java
+++ b/ldap/model/src/main/java/org/apache/directory/api/ldap/model/entry/DefaultAttribute.java
@@ -616,7 +616,7 @@
throw new IllegalArgumentException( "Cannot set a null ID with a null AttributeType" );
}
- String newId = Strings.toLowerCase( trimmed );
+ String newId = Strings.toLowerCaseAscii( trimmed );
setUpIdInternal( upId, newId, attributeType );
}
diff --git a/ldap/model/src/main/java/org/apache/directory/api/ldap/model/entry/DefaultEntry.java b/ldap/model/src/main/java/org/apache/directory/api/ldap/model/entry/DefaultEntry.java
index b272f08..6f9f0f6 100644
--- a/ldap/model/src/main/java/org/apache/directory/api/ldap/model/entry/DefaultEntry.java
+++ b/ldap/model/src/main/java/org/apache/directory/api/ldap/model/entry/DefaultEntry.java
@@ -418,7 +418,7 @@
*/
private String getId( String upId )
{
- String id = Strings.trim( Strings.toLowerCase( upId ) );
+ String id = Strings.trim( Strings.toLowerCaseAscii( upId ) );
// If empty, throw an error
if ( Strings.isEmpty( id ) )
diff --git a/ldap/model/src/main/java/org/apache/directory/api/ldap/model/ldif/LdifAttributesReader.java b/ldap/model/src/main/java/org/apache/directory/api/ldap/model/ldif/LdifAttributesReader.java
index 7c79134..36e343f 100644
--- a/ldap/model/src/main/java/org/apache/directory/api/ldap/model/ldif/LdifAttributesReader.java
+++ b/ldap/model/src/main/java/org/apache/directory/api/ldap/model/ldif/LdifAttributesReader.java
@@ -332,7 +332,7 @@
{
// Each line could start either with an OID, an attribute type, with
// "control:" or with "changetype:"
- String lowerLine = Strings.toLowerCase( line );
+ String lowerLine = Strings.toLowerCaseAscii( line );
// We have three cases :
// 1) The first line after the Dn is a "control:" -> this is an error
@@ -394,7 +394,7 @@
{
// Each line could start either with an OID, an attribute type, with
// "control:" or with "changetype:"
- String lowerLine = Strings.toLowerCase( line );
+ String lowerLine = Strings.toLowerCaseAscii( line );
// We have three cases :
// 1) The first line after the Dn is a "control:" -> this is an error
diff --git a/ldap/model/src/main/java/org/apache/directory/api/ldap/model/ldif/LdifEntry.java b/ldap/model/src/main/java/org/apache/directory/api/ldap/model/ldif/LdifEntry.java
index bb67721..4f15e43 100644
--- a/ldap/model/src/main/java/org/apache/directory/api/ldap/model/ldif/LdifEntry.java
+++ b/ldap/model/src/main/java/org/apache/directory/api/ldap/model/ldif/LdifEntry.java
@@ -25,6 +25,7 @@
import java.io.ObjectInput;
import java.io.ObjectOutput;
import java.util.HashMap;
+import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
@@ -66,7 +67,7 @@
*
* @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
*/
-public class LdifEntry implements Cloneable, Externalizable
+public class LdifEntry implements Cloneable, Externalizable, Iterable<Attribute>
{
/** Used in toArray() */
public static final Modification[] EMPTY_MODS = new Modification[0];
@@ -973,6 +974,19 @@
/**
+ * Returns an enumeration containing the zero or more attributes in the
+ * collection. The behavior of the enumeration is not specified if the
+ * attribute collection is changed.
+ *
+ * @return an enumeration of all contained attributes
+ */
+ public Iterator<Attribute> iterator()
+ {
+ return entry.iterator();
+ }
+
+
+ /**
* @return a String representing the Entry, as a LDIF
*/
public String toString()
diff --git a/ldap/model/src/main/java/org/apache/directory/api/ldap/model/ldif/LdifUtils.java b/ldap/model/src/main/java/org/apache/directory/api/ldap/model/ldif/LdifUtils.java
index 71217fc..c73dd01 100644
--- a/ldap/model/src/main/java/org/apache/directory/api/ldap/model/ldif/LdifUtils.java
+++ b/ldap/model/src/main/java/org/apache/directory/api/ldap/model/ldif/LdifUtils.java
@@ -390,7 +390,7 @@
sb.append( '\n' );
// Dump the ChangeType
- String changeType = Strings.toLowerCase( entry.getChangeType().toString() );
+ String changeType = Strings.toLowerCaseAscii( entry.getChangeType().toString() );
if ( entry.getChangeType() != ChangeType.None )
{
diff --git a/ldap/model/src/main/java/org/apache/directory/api/ldap/model/schema/registries/DefaultSchemaObjectRegistry.java b/ldap/model/src/main/java/org/apache/directory/api/ldap/model/schema/registries/DefaultSchemaObjectRegistry.java
index 1af49fa..503f9ea 100644
--- a/ldap/model/src/main/java/org/apache/directory/api/ldap/model/schema/registries/DefaultSchemaObjectRegistry.java
+++ b/ldap/model/src/main/java/org/apache/directory/api/ldap/model/schema/registries/DefaultSchemaObjectRegistry.java
@@ -214,7 +214,7 @@
if ( schemaObject == null )
{
// let's try with trimming and lowercasing now
- schemaObject = byName.get( Strings.trim( Strings.toLowerCase( oid ) ) );
+ schemaObject = byName.get( Strings.trim( Strings.toLowerCaseAscii( oid ) ) );
}
if ( schemaObject == null )
diff --git a/ldap/schema/data/src/test/java/org/apache/directory/api/ldap/schema/loader/SchemaManagerEnableDisableLoadTest.java b/ldap/schema/data/src/test/java/org/apache/directory/api/ldap/schema/loader/SchemaManagerEnableDisableLoadTest.java
index abe0ea4..1f45cb6 100644
--- a/ldap/schema/data/src/test/java/org/apache/directory/api/ldap/schema/loader/SchemaManagerEnableDisableLoadTest.java
+++ b/ldap/schema/data/src/test/java/org/apache/directory/api/ldap/schema/loader/SchemaManagerEnableDisableLoadTest.java
@@ -147,7 +147,7 @@
for ( Schema schema : enabled )
{
- assertTrue( enabledSchemas.contains( Strings.toLowerCase( schema.getSchemaName() ) ) );
+ assertTrue( enabledSchemas.contains( Strings.toLowerCaseAscii( schema.getSchemaName() ) ) );
}
// The disabled schemas
diff --git a/pom.xml b/pom.xml
index 0632ea7..5bea2e1 100644
--- a/pom.xml
+++ b/pom.xml
@@ -51,20 +51,20 @@
<commons.lang.version>2.6</commons.lang.version>
<commons.pool.version>1.6</commons.pool.version>
<dom4j.version>1.6.1</dom4j.version>
+ <findbugs.annotations.version>1.0.0</findbugs.annotations.version>
<junit.version>4.12</junit.version>
<log4j.version>1.2.17</log4j.version>
- <mina.core.version>2.0.9</mina.core.version>
+ <logback.version>1.1.3</logback.version>
+ <mina.core.version>2.0.10</mina.core.version>
<org.osgi.core.version>6.0.0</org.osgi.core.version>
- <org.apache.felix.version>4.4.1</org.apache.felix.version>
- <slf4j.api.version>1.7.10</slf4j.api.version>
+ <org.apache.felix.version>5.4.0</org.apache.felix.version>
+ <pax-exam.version>4.7.0</pax-exam.version>
+ <pax-url.version>2.4.4</pax-url.version>
+ <slf4j.api.version>1.7.13</slf4j.api.version>
<slf4j.api.bundleversion>"$«range;[==,=+)»"</slf4j.api.bundleversion>
- <slf4j.log4j12.version>1.7.10</slf4j.log4j12.version>
+ <slf4j.log4j12.version>1.7.13</slf4j.log4j12.version>
<xml.apis.version>2.0.2</xml.apis.version>
<xpp3.version>1.1.4c</xpp3.version>
- <pax-exam.version>4.4.0</pax-exam.version>
- <pax-url.version>2.3.0</pax-url.version>
- <logback.version>1.1.2</logback.version>
- <findbugs.annotations.version>1.0.0</findbugs.annotations.version>
</properties>
<distributionManagement>