Author: elecharny
Date: Sat Jul 2 10:33:17 2005
New Revision: 208849
URL: http://svn.apache.org/viewcvs?rev=208849&view=rev
Log:
A wrong copy/paste left some SearchResultEntry test in the ModifyRequest unit test.
Fixed.
Modified:
directory/sandbox/trunk/asn1-new-codec/src/test/org/apache/asn1/ldap/codec/ModifyRequestTest.java
Modified: directory/sandbox/trunk/asn1-new-codec/src/test/org/apache/asn1/ldap/codec/ModifyRequestTest.java
URL: http://svn.apache.org/viewcvs/directory/sandbox/trunk/asn1-new-codec/src/test/org/apache/asn1/ldap/codec/ModifyRequestTest.java?rev=208849&r1=208848&r2=208849&view=diff
==============================================================================
--- directory/sandbox/trunk/asn1-new-codec/src/test/org/apache/asn1/ldap/codec/ModifyRequestTest.java
(original)
+++ directory/sandbox/trunk/asn1-new-codec/src/test/org/apache/asn1/ldap/codec/ModifyRequestTest.java
Sat Jul 2 10:33:17 2005
@@ -30,7 +30,6 @@
import org.apache.asn1.ber.containers.IAsn1Container;
import org.apache.asn1.ldap.pojo.LdapMessage;
import org.apache.asn1.ldap.pojo.ModifyRequest;
-import org.apache.asn1.ldap.pojo.SearchResultEntry;
import org.apache.asn1.primitives.OctetString;
import org.apache.log4j.Logger;
import org.apache.log4j.PropertyConfigurator;
@@ -53,99 +52,6 @@
}
/**
- * Test the decoding of a ModifyRequest
- */
- public void testDecodeModifyRequestSuccess() throws NamingException
- {
- Asn1Decoder ldapDecoder = new LdapDecoder();
-
- ByteBuffer stream = ByteBuffer.allocate( 0x7c );
-
- stream.put(
- new byte[]
- {
-
-
- 0x30, 0x7a, // LDAPMessage ::=SEQUENCE {
- 0x02, 0x01, 0x01, // messageID MessageID
- 0x64, 0x74, // CHOICE { ..., searchResEntry SearchResultEntry, ...
- // SearchResultEntry ::= [APPLICATION 4] SEQUENCE {
- // objectName LDAPDN,
- 0x04, 0x1b, 'o', 'u', '=', 'c', 'o', 'n', 't', 'a', 'c', 't', 's', ',', 'd', 'c', '=',
'i', 'k', 't', 'e', 'k', ',', 'd', 'c', '=', 'c', 'o', 'm',
- // attributes PartialAttributeList }
- // PartialAttributeList ::= SEQUENCE OF SEQUENCE {
- 0x30, 0x55,
- 0x30, 0x28,
- // type AttributeDescription,
- 0x04, 0x0b, 'o', 'b', 'j', 'e', 'c', 't', 'C', 'l', 'a', 's', 's',
- // vals SET OF AttributeValue }
- 0x31, 0x19,
- // AttributeValue ::= OCTET STRING
- 0x04, 0x03, 't', 'o', 'p',
- // AttributeValue ::= OCTET STRING
- 0x04, 0x12, 'o', 'r', 'g', 'a', 'n', 'i', 'z', 'a', 't', 'i', 'o', 'n', 'a',
'l', 'U', 'n', 'i', 't',
- 0x30, 0x29,
- // type AttributeDescription,
- 0x04, 0x0c, 'o', 'b', 'j', 'e', 'c', 't', 'C', 'l', 'a', 's', 's', '2',
- // vals SET OF AttributeValue }
- 0x31, 0x19,
- // AttributeValue ::= OCTET STRING
- 0x04, 0x03, 't', 'o', 'p',
- // AttributeValue ::= OCTET STRING
- 0x04, 0x12, 'o', 'r', 'g', 'a', 'n', 'i', 'z', 'a', 't', 'i', 'o', 'n', 'a', 'l', 'U',
'n', 'i', 't'
- } );
-
- stream.flip();
-
- // Allocate a BindRequest Container
- IAsn1Container ldapMessageContainer = new LdapMessageContainer();
-
- try
- {
- ldapDecoder.decode( stream, ldapMessageContainer );
- }
- catch ( DecoderException de )
- {
- de.printStackTrace();
- Assert.fail( de.getMessage() );
- }
-
- LdapMessage message = ( ( LdapMessageContainer ) ldapMessageContainer ).getLdapMessage();
- SearchResultEntry searchResultEntry = message.getSearchResultEntry();
-
- Assert.assertEquals( 1, message.getMessageId() );
- Assert.assertEquals( "ou=contacts,dc=iktek,dc=com", searchResultEntry.getObjectName()
);
-
- ArrayList partialAttributesList = searchResultEntry.getPartialAttributeList();
-
- Assert.assertEquals( 2, partialAttributesList.size() );
-
- String[] expectedAttributes = new String[]{"objectClass", "objectClass2"};
-
- for ( int i = 0; i < partialAttributesList.size(); i++ )
- {
- BasicAttribute attributeValue = (BasicAttribute)partialAttributesList.get( i
);
-
- Assert.assertEquals( expectedAttributes[i], attributeValue.getID() );
-
- NamingEnumeration values = attributeValue.getAll();
-
- HashSet expectedValues = new HashSet();
-
- expectedValues.add( "[74][6F][70]" );
- expectedValues.add( "[6F][72][67][61][6E][69][7A][61][74][69][6F][6E][61][6C][55][6E][69][74]"
);
-
- while ( values.hasMore() )
- {
- OctetString value = (OctetString)values.next();
-
- Assert.assertTrue( expectedValues.contains( value.toString() ) );
-
- expectedValues.remove( value.toString() );
- }
- }
- }
- /**
* Test the decoding of a ModifyRequest
*/
public void testDecodeModifyRequest2AttrsSuccess() throws NamingException
@@ -246,5 +152,4 @@
}
}
-
}
|