You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by ak...@apache.org on 2011/01/20 18:49:55 UTC
svn commit: r1061416 [6/6] - in /directory:
apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/interceptor/context/
apacheds/trunk/core-avl/src/main/java/org/apache/directory/server/core/avltree/
apacheds/trunk/core-integ/src/test/j...
Modified: directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/codec/search/SearchResultEntryTest.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/codec/search/SearchResultEntryTest.java?rev=1061416&r1=1061415&r2=1061416&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/codec/search/SearchResultEntryTest.java (original)
+++ directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/codec/search/SearchResultEntryTest.java Thu Jan 20 17:49:48 2011
@@ -41,7 +41,7 @@ import org.apache.directory.shared.ldap.
import org.apache.directory.shared.ldap.message.LdapEncoder;
import org.apache.directory.shared.ldap.message.SearchResultEntry;
import org.apache.directory.shared.ldap.message.control.Control;
-import org.apache.directory.shared.ldap.util.StringTools;
+import org.apache.directory.shared.util.Strings;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -96,7 +96,7 @@ public class SearchResultEntryTest
// AttributeValue ::= OCTET STRING
0x04, 0x12, 'o', 'r', 'g', 'a', 'n', 'i', 'z', 'a', 't', 'i', 'o', 'n', 'a', 'l', 'U', 'n', 'i', 't' } );
- String decodedPdu = StringTools.dumpBytes( stream.array() );
+ String decodedPdu = Strings.dumpBytes(stream.array());
stream.flip();
// Allocate a BindRequest Container
@@ -140,7 +140,7 @@ public class SearchResultEntryTest
// Check the length
assertEquals( 0x50, bb.limit() );
- String encodedPdu = StringTools.dumpBytes( bb.array() );
+ String encodedPdu = Strings.dumpBytes(bb.array());
assertEquals( encodedPdu, decodedPdu );
}
@@ -308,7 +308,7 @@ public class SearchResultEntryTest
0x02, 0x01, 0x02 // messageID MessageID ...
} );
- String decodedPdu = StringTools.dumpBytes( stream.array() );
+ String decodedPdu = Strings.dumpBytes(stream.array());
stream.flip();
// Allocate a BindRequest Container
@@ -361,7 +361,7 @@ public class SearchResultEntryTest
// Check the length
assertEquals( 0x61, bb.limit() );
- String encodedPdu = StringTools.dumpBytes( bb.array() );
+ String encodedPdu = Strings.dumpBytes(bb.array());
// We have to supress the last 5 chars from the decodedPDU, as they
// belongs to the next message.
@@ -527,7 +527,7 @@ public class SearchResultEntryTest
// PartialAttributeList ::= SEQUENCE OF SEQUENCE {
0x30, 0x00 } );
- String decodedPdu = StringTools.dumpBytes( stream.array() );
+ String decodedPdu = Strings.dumpBytes(stream.array());
stream.flip();
// Allocate a BindRequest Container
@@ -561,7 +561,7 @@ public class SearchResultEntryTest
// Check the length
assertEquals( 0x26, bb.limit() );
- String encodedPdu = StringTools.dumpBytes( bb.array() );
+ String encodedPdu = Strings.dumpBytes(bb.array());
assertEquals( encodedPdu, decodedPdu );
}
@@ -802,7 +802,7 @@ public class SearchResultEntryTest
// type AttributeDescription,
0x04, 0x0b, 'o', 'b', 'j', 'e', 'c', 't', 'c', 'l', 'a', 's', 's', 0x31, 0x00 } );
- String decodedPdu = StringTools.dumpBytes( stream.array() );
+ String decodedPdu = Strings.dumpBytes(stream.array());
stream.flip();
// Allocate a BindRequest Container
@@ -844,7 +844,7 @@ public class SearchResultEntryTest
// Check the length
assertEquals( 0x37, bb.limit() );
- String encodedPdu = StringTools.dumpBytes( bb.array() );
+ String encodedPdu = Strings.dumpBytes(bb.array());
assertEquals( encodedPdu, decodedPdu );
}
@@ -889,7 +889,7 @@ public class SearchResultEntryTest
// type AttributeDescription,
0x04, 0x0b, 'o', 'b', 'j', 'e', 'c', 't', 'c', 'l', 'a', 'z', 'z', 0x31, 0x00 } );
- String decodedPdu = StringTools.dumpBytes( stream.array() );
+ String decodedPdu = Strings.dumpBytes(stream.array());
stream.flip();
// Allocate a BindRequest Container
@@ -931,7 +931,7 @@ public class SearchResultEntryTest
// Check the length
assertEquals( 0x48, bb.limit() );
- String encodedPdu = StringTools.dumpBytes( bb.array() );
+ String encodedPdu = Strings.dumpBytes(bb.array());
assertEquals( encodedPdu.length(), decodedPdu.length() );
}
@@ -979,7 +979,7 @@ public class SearchResultEntryTest
0x30, 0x19, 0x04, 0x17, 0x32, 0x2E, 0x31, 0x36, 0x2E, 0x38, 0x34, 0x30, 0x2E, 0x31, 0x2E, 0x31, 0x31,
0x33, 0x37, 0x33, 0x30, 0x2E, 0x33, 0x2E, 0x34, 0x2E, 0x32 } );
- String decodedPdu = StringTools.dumpBytes( stream.array() );
+ String decodedPdu = Strings.dumpBytes(stream.array());
stream.flip();
// Allocate a BindRequest Container
@@ -1021,7 +1021,7 @@ public class SearchResultEntryTest
Control control = controls.get( "2.16.840.1.113730.3.4.2" );
assertEquals( "2.16.840.1.113730.3.4.2", control.getOid() );
- assertEquals( "", StringTools.dumpBytes( ( byte[] ) control.getValue() ) );
+ assertEquals( "", Strings.dumpBytes((byte[]) control.getValue()) );
// Check the encoding
try
@@ -1031,7 +1031,7 @@ public class SearchResultEntryTest
// Check the length
assertEquals( 0x54, bb.limit() );
- String encodedPdu = StringTools.dumpBytes( bb.array() );
+ String encodedPdu = Strings.dumpBytes(bb.array());
assertEquals( encodedPdu, decodedPdu );
}
@@ -1076,7 +1076,7 @@ public class SearchResultEntryTest
// AttributeValue ::= OCTET STRING
0x04, 0x00, } );
- String decodedPdu = StringTools.dumpBytes( stream.array() );
+ String decodedPdu = Strings.dumpBytes(stream.array());
stream.flip();
// Allocate a BindRequest Container
@@ -1119,7 +1119,7 @@ public class SearchResultEntryTest
// Check the length
assertEquals( 0x39, bb.limit() );
- String encodedPdu = StringTools.dumpBytes( bb.array() );
+ String encodedPdu = Strings.dumpBytes(bb.array());
assertEquals( encodedPdu, decodedPdu );
}
@@ -1170,7 +1170,7 @@ public class SearchResultEntryTest
0x30, 0x19, 0x04, 0x17, 0x32, 0x2E, 0x31, 0x36, 0x2E, 0x38, 0x34, 0x30, 0x2E, 0x31, 0x2E, 0x31, 0x31,
0x33, 0x37, 0x33, 0x30, 0x2E, 0x33, 0x2E, 0x34, 0x2E, 0x32 } );
- String decodedPdu = StringTools.dumpBytes( stream.array() );
+ String decodedPdu = Strings.dumpBytes(stream.array());
stream.flip();
// Allocate a BindRequest Container
@@ -1212,7 +1212,7 @@ public class SearchResultEntryTest
Control control = controls.get( "2.16.840.1.113730.3.4.2" );
assertEquals( "2.16.840.1.113730.3.4.2", control.getOid() );
- assertEquals( "", StringTools.dumpBytes( ( byte[] ) control.getValue() ) );
+ assertEquals( "", Strings.dumpBytes((byte[]) control.getValue()) );
// Check the encoding
try
@@ -1222,7 +1222,7 @@ public class SearchResultEntryTest
// Check the length
assertEquals( 0x56, bb.limit() );
- String encodedPdu = StringTools.dumpBytes( bb.array() );
+ String encodedPdu = Strings.dumpBytes(bb.array());
assertEquals( encodedPdu, decodedPdu );
}
Modified: directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/codec/search/SearchResultReferenceTest.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/codec/search/SearchResultReferenceTest.java?rev=1061416&r1=1061415&r2=1061416&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/codec/search/SearchResultReferenceTest.java (original)
+++ directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/codec/search/SearchResultReferenceTest.java Thu Jan 20 17:49:48 2011
@@ -42,6 +42,7 @@ import org.apache.directory.shared.ldap.
import org.apache.directory.shared.ldap.message.SearchResultReference;
import org.apache.directory.shared.ldap.message.control.Control;
import org.apache.directory.shared.ldap.util.StringTools;
+import org.apache.directory.shared.util.Strings;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -110,7 +111,7 @@ public class SearchResultReferenceTest
}
}
- String decodedPdu = StringTools.dumpBytes( stream.array() );
+ String decodedPdu = Strings.dumpBytes(stream.array());
stream.flip();
// Allocate a BindRequest Container
@@ -164,7 +165,7 @@ public class SearchResultReferenceTest
// Check the length
assertEquals( 0x3D8, bb.limit() );
- String encodedPdu = StringTools.dumpBytes( bb.array() );
+ String encodedPdu = Strings.dumpBytes(bb.array());
assertEquals( encodedPdu, decodedPdu );
}
@@ -238,7 +239,7 @@ public class SearchResultReferenceTest
stream.put( controlBytes[i] );
}
- String decodedPdu = StringTools.dumpBytes( stream.array() );
+ String decodedPdu = Strings.dumpBytes(stream.array());
stream.flip();
// Allocate a BindRequest Container
@@ -294,7 +295,7 @@ public class SearchResultReferenceTest
Control control = controls.get( "2.16.840.1.113730.3.4.2" );
assertEquals( "2.16.840.1.113730.3.4.2", control.getOid() );
- assertEquals( "", StringTools.dumpBytes( ( byte[] ) control.getValue() ) );
+ assertEquals( "", Strings.dumpBytes((byte[]) control.getValue()) );
// Check the encoding
try
@@ -304,7 +305,7 @@ public class SearchResultReferenceTest
// Check the length
assertEquals( 0x3F5, bb.limit() );
- String encodedPdu = StringTools.dumpBytes( bb.array() );
+ String encodedPdu = Strings.dumpBytes(bb.array());
assertEquals( encodedPdu, decodedPdu );
}
@@ -382,7 +383,7 @@ public class SearchResultReferenceTest
// LDAPURL
} );
- String decodedPdu = StringTools.dumpBytes( stream.array() );
+ String decodedPdu = Strings.dumpBytes(stream.array());
stream.flip();
// Allocate a BindRequest Container
@@ -420,7 +421,7 @@ public class SearchResultReferenceTest
// Check the length
assertEquals( 0x11, bb.limit() );
- String encodedPdu = StringTools.dumpBytes( bb.array() );
+ String encodedPdu = Strings.dumpBytes(bb.array());
assertEquals( encodedPdu, decodedPdu );
}
Modified: directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/codec/search/controls/EntryChangeControlTest.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/codec/search/controls/EntryChangeControlTest.java?rev=1061416&r1=1061415&r2=1061416&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/codec/search/controls/EntryChangeControlTest.java (original)
+++ directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/codec/search/controls/EntryChangeControlTest.java Thu Jan 20 17:49:48 2011
@@ -35,7 +35,7 @@ import org.apache.directory.shared.ldap.
import org.apache.directory.shared.ldap.codec.search.controls.entryChange.EntryChangeControlContainer;
import org.apache.directory.shared.ldap.codec.search.controls.entryChange.EntryChangeControlDecoder;
import org.apache.directory.shared.ldap.name.DN;
-import org.apache.directory.shared.ldap.util.StringTools;
+import org.apache.directory.shared.util.Strings;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -344,7 +344,7 @@ public class EntryChangeControlTest
0x02, 0x01, 0x10, // changeNumber INTEGER OPTIONAL -- if supported
} );
- String expected = StringTools.dumpBytes( bb.array() );
+ String expected = Strings.dumpBytes(bb.array());
bb.flip();
EntryChangeControl entry = new EntryChangeControl();
@@ -352,7 +352,7 @@ public class EntryChangeControlTest
entry.setChangeNumber( 16 );
entry.setPreviousDn( new DN( "a=b" ) );
bb = entry.encode( ByteBuffer.allocate( entry.computeLength() ) );
- String decoded = StringTools.dumpBytes( bb.array() );
+ String decoded = Strings.dumpBytes(bb.array());
assertEquals( expected, decoded );
}
@@ -381,7 +381,7 @@ public class EntryChangeControlTest
0x12, 0x34, 0x56, 0x78, (byte)0x9a, (byte)0xbc, (byte)0xde
} );
- String expected = StringTools.dumpBytes( bb.array() );
+ String expected = Strings.dumpBytes(bb.array());
bb.flip();
EntryChangeControl entry = new EntryChangeControl();
@@ -389,7 +389,7 @@ public class EntryChangeControlTest
entry.setChangeNumber( 5124095576030430L );
entry.setPreviousDn( new DN( "a=b" ) );
bb = entry.encode( ByteBuffer.allocate( entry.computeLength() ) );
- String decoded = StringTools.dumpBytes( bb.array() );
+ String decoded = Strings.dumpBytes(bb.array());
assertEquals( expected, decoded );
}
}
Modified: directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/codec/search/controls/PSearchControlTest.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/codec/search/controls/PSearchControlTest.java?rev=1061416&r1=1061415&r2=1061416&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/codec/search/controls/PSearchControlTest.java (original)
+++ directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/codec/search/controls/PSearchControlTest.java Thu Jan 20 17:49:48 2011
@@ -33,7 +33,7 @@ import org.apache.directory.shared.asn1.
import org.apache.directory.shared.ldap.codec.search.controls.persistentSearch.PersistentSearchControl;
import org.apache.directory.shared.ldap.codec.search.controls.persistentSearch.PersistentSearchControlContainer;
import org.apache.directory.shared.ldap.codec.search.controls.persistentSearch.PersistentSearchControlDecoder;
-import org.apache.directory.shared.ldap.util.StringTools;
+import org.apache.directory.shared.util.Strings;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -68,7 +68,7 @@ public class PSearchControlTest
0x01, 0x01, 0x00 // returnECs BOOLEAN
} );
- String expected = StringTools.dumpBytes( bb.array() );
+ String expected = Strings.dumpBytes(bb.array());
bb.flip();
PersistentSearchControl ctrl = new PersistentSearchControl();
@@ -76,7 +76,7 @@ public class PSearchControlTest
ctrl.setReturnECs( false );
ctrl.setChangeTypes( 1 );
bb = ctrl.encode(ByteBuffer.allocate( ctrl.computeLength() ) );
- String decoded = StringTools.dumpBytes( bb.array() );
+ String decoded = Strings.dumpBytes(bb.array());
assertEquals( expected, decoded );
}
Modified: directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/codec/search/controls/PagedSearchControlTest.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/codec/search/controls/PagedSearchControlTest.java?rev=1061416&r1=1061415&r2=1061416&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/codec/search/controls/PagedSearchControlTest.java (original)
+++ directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/codec/search/controls/PagedSearchControlTest.java Thu Jan 20 17:49:48 2011
@@ -36,6 +36,7 @@ import org.apache.directory.shared.ldap.
import org.apache.directory.shared.ldap.codec.search.controls.pagedSearch.PagedResultsControlContainer;
import org.apache.directory.shared.ldap.codec.search.controls.pagedSearch.PagedResultsControlDecoder;
import org.apache.directory.shared.ldap.util.StringTools;
+import org.apache.directory.shared.util.Strings;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -105,8 +106,8 @@ public class PagedSearchControlTest
ctrl.setCookie( StringTools.getBytesUtf8( "test" ) );
bb = ctrl.encode( ByteBuffer.allocate( ctrl.computeLength() ) );
- String decoded = StringTools.dumpBytes( bb.array() );
- String expected = StringTools.dumpBytes( buffer.array() );
+ String decoded = Strings.dumpBytes(bb.array());
+ String expected = Strings.dumpBytes(buffer.array());
assertEquals( expected, decoded );
}
@@ -257,8 +258,8 @@ public class PagedSearchControlTest
ctrl.setCookie( StringTools.getBytesUtf8( "test" ) );
bb = ctrl.encode( ByteBuffer.allocate( ctrl.computeLength() ) );
- String decoded = StringTools.dumpBytes( bb.array() );
- String expected = StringTools.dumpBytes( buffer.array() );
+ String decoded = Strings.dumpBytes(bb.array());
+ String expected = Strings.dumpBytes(buffer.array());
assertEquals( expected, decoded );
}
@@ -348,8 +349,8 @@ public class PagedSearchControlTest
ctrl.setCookie( null );
bb = ctrl.encode( ByteBuffer.allocate( ctrl.computeLength() ) );
- String decoded = StringTools.dumpBytes( bb.array() );
- String expected = StringTools.dumpBytes( buffer.array() );
+ String decoded = Strings.dumpBytes(bb.array());
+ String expected = Strings.dumpBytes(buffer.array());
assertEquals( expected, decoded );
}
Modified: directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/codec/search/controls/SubEntryControlTest.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/codec/search/controls/SubEntryControlTest.java?rev=1061416&r1=1061415&r2=1061416&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/codec/search/controls/SubEntryControlTest.java (original)
+++ directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/codec/search/controls/SubEntryControlTest.java Thu Jan 20 17:49:48 2011
@@ -35,7 +35,7 @@ import org.apache.directory.shared.asn1.
import org.apache.directory.shared.ldap.codec.search.controls.subentries.SubentriesControl;
import org.apache.directory.shared.ldap.codec.search.controls.subentries.SubentriesControlContainer;
import org.apache.directory.shared.ldap.codec.search.controls.subentries.SubentriesControlDecoder;
-import org.apache.directory.shared.ldap.util.StringTools;
+import org.apache.directory.shared.util.Strings;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -96,8 +96,8 @@ public class SubEntryControlTest
buffer.flip();
bb = control.encode( ByteBuffer.allocate( control.computeLength() ) );
- String expected = StringTools.dumpBytes( buffer.array() );
- String decoded = StringTools.dumpBytes( bb.array() );
+ String expected = Strings.dumpBytes(buffer.array());
+ String decoded = Strings.dumpBytes(bb.array());
assertEquals( expected, decoded );
}
catch( EncoderException e )
@@ -155,8 +155,8 @@ public class SubEntryControlTest
buffer.flip();
bb = control.encode( ByteBuffer.allocate( control.computeLength() ) );
- String expected = StringTools.dumpBytes( buffer.array() );
- String decoded = StringTools.dumpBytes( bb.array() );
+ String expected = Strings.dumpBytes(buffer.array());
+ String decoded = Strings.dumpBytes(bb.array());
assertEquals( expected, decoded );
}
catch( EncoderException e )
Modified: directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/codec/unbind/UnBindRequestTest.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/codec/unbind/UnBindRequestTest.java?rev=1061416&r1=1061415&r2=1061416&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/codec/unbind/UnBindRequestTest.java (original)
+++ directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/codec/unbind/UnBindRequestTest.java Thu Jan 20 17:49:48 2011
@@ -38,7 +38,7 @@ import org.apache.directory.shared.ldap.
import org.apache.directory.shared.ldap.message.UnbindRequest;
import org.apache.directory.shared.ldap.message.UnbindRequestImpl;
import org.apache.directory.shared.ldap.message.control.Control;
-import org.apache.directory.shared.ldap.util.StringTools;
+import org.apache.directory.shared.util.Strings;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -70,7 +70,7 @@ public class UnBindRequestTest
// UnbindRequest ::= [APPLICATION 2] NULL
} );
- String decodedPdu = StringTools.dumpBytes( stream.array() );
+ String decodedPdu = Strings.dumpBytes(stream.array());
stream.flip();
// Allocate a BindRequest Container
@@ -100,7 +100,7 @@ public class UnBindRequestTest
// Check the length
assertEquals( 0x07, bb.limit() );
- String encodedPdu = StringTools.dumpBytes( bb.array() );
+ String encodedPdu = Strings.dumpBytes(bb.array());
assertEquals( encodedPdu, decodedPdu );
}
@@ -134,7 +134,7 @@ public class UnBindRequestTest
0x30, 0x19, 0x04, 0x17, '2', '.', '1', '6', '.', '8', '4', '0', '.', '1', '.', '1', '1', '3', '7', '3',
'0', '.', '3', '.', '4', '.', '2' } );
- String decodedPdu = StringTools.dumpBytes( stream.array() );
+ String decodedPdu = Strings.dumpBytes(stream.array());
stream.flip();
// Allocate a BindRequest Container
@@ -161,7 +161,7 @@ public class UnBindRequestTest
Control control = controls.get( "2.16.840.1.113730.3.4.2" );
assertEquals( "2.16.840.1.113730.3.4.2", control.getOid() );
- assertEquals( "", StringTools.dumpBytes( ( byte[] ) control.getValue() ) );
+ assertEquals( "", Strings.dumpBytes((byte[]) control.getValue()) );
// Check the encoding
UnbindRequest internalUnbindRequest = new UnbindRequestImpl( unbindRequest.getMessageId() );
@@ -174,7 +174,7 @@ public class UnBindRequestTest
// Check the length
assertEquals( 0x24, bb.limit() );
- String encodedPdu = StringTools.dumpBytes( bb.array() );
+ String encodedPdu = Strings.dumpBytes(bb.array());
assertEquals( encodedPdu, decodedPdu );
}
Modified: directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/ldif/LdifAttributesReaderTest.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/ldif/LdifAttributesReaderTest.java?rev=1061416&r1=1061415&r2=1061416&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/ldif/LdifAttributesReaderTest.java (original)
+++ directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/ldif/LdifAttributesReaderTest.java Thu Jan 20 17:49:48 2011
@@ -43,7 +43,7 @@ import org.apache.directory.shared.ldap.
import org.apache.directory.shared.ldap.entry.Entry;
import org.apache.directory.shared.ldap.entry.EntryAttribute;
import org.apache.directory.shared.ldap.exception.LdapInvalidAttributeValueException;
-import org.apache.directory.shared.ldap.util.StringTools;
+import org.apache.directory.shared.util.Strings;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -551,7 +551,7 @@ public class LdifAttributesReaderTest
if ( "jpegphoto".equalsIgnoreCase( values[i][0] ) )
{
Attribute attr = attributes.get( values[i][0] );
- assertEquals( StringTools.dumpBytes( data ), StringTools.dumpBytes( ( byte[] ) attr.get() ) );
+ assertEquals( Strings.dumpBytes(data), Strings.dumpBytes((byte[]) attr.get()) );
}
else
{
Modified: directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/ldif/LdifReaderTest.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/ldif/LdifReaderTest.java?rev=1061416&r1=1061415&r2=1061416&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/ldif/LdifReaderTest.java (original)
+++ directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/ldif/LdifReaderTest.java Thu Jan 20 17:49:48 2011
@@ -43,6 +43,7 @@ import org.apache.directory.shared.ldap.
import org.apache.directory.shared.ldap.entry.ModificationOperation;
import org.apache.directory.shared.ldap.message.control.Control;
import org.apache.directory.shared.ldap.util.StringTools;
+import org.apache.directory.shared.util.Strings;
import org.junit.BeforeClass;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -1157,7 +1158,7 @@ public class LdifReaderTest
else if ( "jpegphoto".equalsIgnoreCase( values[i][0] ) )
{
EntryAttribute attr = entry.get( values[i][0] );
- assertEquals( StringTools.dumpBytes( data ), StringTools.dumpBytes( attr.getBytes() ) );
+ assertEquals( Strings.dumpBytes(data), Strings.dumpBytes(attr.getBytes()) );
}
else
{
@@ -1349,7 +1350,7 @@ public class LdifReaderTest
else if ( "jpegphoto".equalsIgnoreCase( values[0][i][0] ) )
{
EntryAttribute attr = entry.get( values[0][i][0] );
- assertEquals( StringTools.dumpBytes( data ), StringTools.dumpBytes( attr.getBytes() ) );
+ assertEquals( Strings.dumpBytes(data), Strings.dumpBytes(attr.getBytes()) );
}
else
{
Modified: directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/name/RdnTest.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/name/RdnTest.java?rev=1061416&r1=1061415&r2=1061416&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/name/RdnTest.java (original)
+++ directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/name/RdnTest.java Thu Jan 20 17:49:48 2011
@@ -37,6 +37,7 @@ import org.apache.directory.junit.tools.
import org.apache.directory.junit.tools.ConcurrentJunitRunner;
import org.apache.directory.shared.ldap.exception.LdapException;
import org.apache.directory.shared.ldap.util.StringTools;
+import org.apache.directory.shared.util.Strings;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -697,10 +698,10 @@ public class RdnTest
{
byte[] res = ( byte[] ) RDN.unescapeValue( "#fF" );
- assertEquals( "0xFF ", StringTools.dumpBytes( res ) );
+ assertEquals( "0xFF ", Strings.dumpBytes(res) );
res = ( byte[] ) RDN.unescapeValue( "#0123456789aBCDEF" );
- assertEquals( "0x01 0x23 0x45 0x67 0x89 0xAB 0xCD 0xEF ", StringTools.dumpBytes( res ) );
+ assertEquals( "0x01 0x23 0x45 0x67 0x89 0xAB 0xCD 0xEF ", Strings.dumpBytes(res) );
}
Modified: directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/util/StringToolsTest.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/util/StringToolsTest.java?rev=1061416&r1=1061415&r2=1061416&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/util/StringToolsTest.java (original)
+++ directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/util/StringToolsTest.java Thu Jan 20 17:49:48 2011
@@ -36,6 +36,7 @@ import javax.naming.NamingException;
import org.apache.directory.junit.tools.Concurrent;
import org.apache.directory.junit.tools.ConcurrentJunitRunner;
+import org.apache.directory.shared.util.Strings;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -148,29 +149,29 @@ public class StringToolsTest
@Test
public void testcharToBytesOne()
{
- assertEquals( "0x00 ", StringTools.dumpBytes( StringTools.charToBytes( ( char ) 0x0000 ) ) );
- assertEquals( "0x61 ", StringTools.dumpBytes( StringTools.charToBytes( 'a' ) ) );
- assertEquals( "0x7F ", StringTools.dumpBytes( StringTools.charToBytes( ( char ) 0x007F ) ) );
+ assertEquals( "0x00 ", Strings.dumpBytes(StringTools.charToBytes((char) 0x0000)) );
+ assertEquals( "0x61 ", Strings.dumpBytes(StringTools.charToBytes('a')) );
+ assertEquals( "0x7F ", Strings.dumpBytes(StringTools.charToBytes((char) 0x007F)) );
}
@Test
public void testcharToBytesTwo()
{
- assertEquals( "0xC2 0x80 ", StringTools.dumpBytes( StringTools.charToBytes( ( char ) 0x0080 ) ) );
- assertEquals( "0xC3 0xBF ", StringTools.dumpBytes( StringTools.charToBytes( ( char ) 0x00FF ) ) );
- assertEquals( "0xC4 0x80 ", StringTools.dumpBytes( StringTools.charToBytes( ( char ) 0x0100 ) ) );
- assertEquals( "0xDF 0xBF ", StringTools.dumpBytes( StringTools.charToBytes( ( char ) 0x07FF ) ) );
+ assertEquals( "0xC2 0x80 ", Strings.dumpBytes(StringTools.charToBytes((char) 0x0080)) );
+ assertEquals( "0xC3 0xBF ", Strings.dumpBytes(StringTools.charToBytes((char) 0x00FF)) );
+ assertEquals( "0xC4 0x80 ", Strings.dumpBytes(StringTools.charToBytes((char) 0x0100)) );
+ assertEquals( "0xDF 0xBF ", Strings.dumpBytes(StringTools.charToBytes((char) 0x07FF)) );
}
@Test
public void testcharToBytesThree()
{
- assertEquals( "0xE0 0xA0 0x80 ", StringTools.dumpBytes( StringTools.charToBytes( ( char ) 0x0800 ) ) );
- assertEquals( "0xE0 0xBF 0xBF ", StringTools.dumpBytes( StringTools.charToBytes( ( char ) 0x0FFF ) ) );
- assertEquals( "0xE1 0x80 0x80 ", StringTools.dumpBytes( StringTools.charToBytes( ( char ) 0x1000 ) ) );
- assertEquals( "0xEF 0xBF 0xBF ", StringTools.dumpBytes( StringTools.charToBytes( ( char ) 0xFFFF ) ) );
+ assertEquals( "0xE0 0xA0 0x80 ", Strings.dumpBytes(StringTools.charToBytes((char) 0x0800)) );
+ assertEquals( "0xE0 0xBF 0xBF ", Strings.dumpBytes(StringTools.charToBytes((char) 0x0FFF)) );
+ assertEquals( "0xE1 0x80 0x80 ", Strings.dumpBytes(StringTools.charToBytes((char) 0x1000)) );
+ assertEquals( "0xEF 0xBF 0xBF ", Strings.dumpBytes(StringTools.charToBytes((char) 0xFFFF)) );
}
Modified: directory/shared/trunk/util/src/main/java/org/apache/directory/shared/util/Strings.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/util/src/main/java/org/apache/directory/shared/util/Strings.java?rev=1061416&r1=1061415&r2=1061416&view=diff
==============================================================================
--- directory/shared/trunk/util/src/main/java/org/apache/directory/shared/util/Strings.java (original)
+++ directory/shared/trunk/util/src/main/java/org/apache/directory/shared/util/Strings.java Thu Jan 20 17:49:48 2011
@@ -49,4 +49,27 @@ public final class Strings
private static final byte[] HEX_CHAR = new byte[]
{ '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F' };
+ /**
+ * Helper function that dump an array of bytes in hex form
+ *
+ * @param buffer The bytes array to dump
+ * @return A string representation of the array of bytes
+ */
+ public static String dumpBytes( byte[] buffer )
+ {
+ if ( buffer == null )
+ {
+ return "";
+ }
+
+ StringBuffer sb = new StringBuffer();
+
+ for ( int i = 0; i < buffer.length; i++ )
+ {
+ sb.append( "0x" ).append( ( char ) ( HEX_CHAR[( buffer[i] & 0x00F0 ) >> 4] ) ).append(
+ ( char ) ( HEX_CHAR[buffer[i] & 0x000F] ) ).append( " " );
+ }
+
+ return sb.toString();
+ }
}