Package org.nasutekds.server.types

Examples of org.nasutekds.server.types.ByteStringBuilder$SubSequence


    assertTrue(reqOp.getType() == req.getType());
  }

  @Test (expectedExceptions = LDAPException.class)
  public void testAbandonRequestBadID() throws Exception {
    ByteStringBuilder builder = new ByteStringBuilder();
    ASN1Writer writer = ASN1.getWriter(builder);
    writer.writeOctetString(OP_TYPE_ABANDON_REQUEST, "invalid value");

    ASN1Reader reader = ASN1.getReader(builder.toByteString());
    LDAPReader.readProtocolOp(reader);
  }
View Full Code Here


   * @throws Exception If the test failed unexpectedly.
   */
  @Test(expectedExceptions = LDAPException.class)
  public void testDecodeEmptyElement() throws Exception
  {
    ByteStringBuilder builder = new ByteStringBuilder();
    ASN1Writer writer = ASN1.getWriter(builder);
    writer.writeStartSequence(OP_TYPE_COMPARE_REQUEST);
    writer.writeEndSequence();

    ASN1Reader reader = ASN1.getReader(builder.toByteString());
    LDAPReader.readProtocolOp(reader);
  }
View Full Code Here

   * @throws Exception If the test failed unexpectedly.
   */
  @Test(expectedExceptions = LDAPException.class)
  public void testDecodeInvalidElement() throws Exception
  {
    ByteStringBuilder builder = new ByteStringBuilder();
    ASN1Writer writer = ASN1.getWriter(builder);
    writer.writeStartSequence(OP_TYPE_COMPARE_REQUEST);
    writer.writeNull();
    writer.writeNull();
    writer.writeEndSequence();

    ASN1Reader reader = ASN1.getReader(builder.toByteString());
    LDAPReader.readProtocolOp(reader);
  }
View Full Code Here

   * @throws Exception If the test failed unexpectedly.
   */
  @Test(expectedExceptions = LDAPException.class)
  public void testDecodeWrongElementType() throws Exception
  {
    ByteStringBuilder builder = new ByteStringBuilder();
    ASN1Writer writer = ASN1.getWriter(builder);
    writer.writeStartSequence(OP_TYPE_COMPARE_REQUEST);
    writer.writeOctetString(dn);
    writer.writeNull();
    writer.writeEndSequence();

    ASN1Reader reader = ASN1.getReader(builder.toByteString());
    LDAPReader.readProtocolOp(reader);
  }
View Full Code Here

   * @throws Exception If the test failed unexpectedly.
   */
  @Test(expectedExceptions = Exception.class)
  public void testNullEncodeDecode() throws Exception
  {
    ByteStringBuilder builder = new ByteStringBuilder();
    ASN1Writer writer = ASN1.getWriter(builder);
    CompareRequestProtocolOp compareEncoded;
    CompareRequestProtocolOp compareDecoded;

    compareEncoded = new CompareRequestProtocolOp(null, null, null);
    compareEncoded.write(writer);
    ASN1Reader reader = ASN1.getReader(builder.toByteString());
    compareDecoded = (CompareRequestProtocolOp)LDAPReader.readProtocolOp(reader);
  }
View Full Code Here

   * @throws Exception If the test failed unexpectedly.
   */
  @Test
  public void testEncodeDecode() throws Exception
  {
    ByteStringBuilder builder = new ByteStringBuilder();
    ASN1Writer writer = ASN1.getWriter(builder);
    CompareRequestProtocolOp compareEncoded;
    CompareRequestProtocolOp compareDecoded;
    ArrayList<LDAPAttribute> attributes;


    //Test case for a full encode decode operation with normal params.
    compareEncoded = new CompareRequestProtocolOp(dn, attributeType,
                                                  assertionValue);
    compareEncoded.write(writer);
    ASN1Reader reader = ASN1.getReader(builder.toByteString());
    compareDecoded = (CompareRequestProtocolOp)LDAPReader.readProtocolOp(reader);

    assertEquals(compareEncoded.getType(), OP_TYPE_COMPARE_REQUEST);
    assertEquals(compareEncoded.getDN(), compareDecoded.getDN());
    assertEquals(compareEncoded.getAttributeType(),
View Full Code Here

   * @throws Exception If the test failed unexpectedly.
   */
  @Test
  public void testEncodeDecode() throws Exception
  {
    ByteStringBuilder builder = new ByteStringBuilder();
    ASN1Writer writer = ASN1.getWriter(builder);
    DeleteRequestProtocolOp deleteEncoded;
    DeleteRequestProtocolOp deleteDecoded;

    deleteEncoded = new DeleteRequestProtocolOp(dn);
    deleteEncoded.write(writer);
    ASN1Reader reader = ASN1.getReader(builder.toByteString());
    assertEquals(reader.peekType(), OP_TYPE_DELETE_REQUEST);

    deleteDecoded = (DeleteRequestProtocolOp)LDAPReader.readProtocolOp(reader);

    assertEquals(deleteDecoded.getDN(), deleteEncoded.getDN());
View Full Code Here

   * @throws Exception If the test failed unexpectedly.
   */
  @Test(expectedExceptions = Exception.class)
  public void testNullEncodeDecode() throws Exception
  {
    ByteStringBuilder builder = new ByteStringBuilder();
    ASN1Writer writer = ASN1.getWriter(builder);
    DeleteRequestProtocolOp deleteEncoded;
    DeleteRequestProtocolOp deleteDecoded;

    deleteEncoded = new DeleteRequestProtocolOp(null);
    deleteEncoded.write(writer);
    ASN1Reader reader = ASN1.getReader(builder.toByteString());
    deleteDecoded = (DeleteRequestProtocolOp)LDAPReader.readProtocolOp(reader);
  }
View Full Code Here

public class TestUnbindRequestProtocolOp  extends LdapTestCase {

  @Test()
  public void testUnbindEncodeDecodeRequest() throws Exception {
      ByteStringBuilder builder = new ByteStringBuilder();
      ASN1Writer writer = ASN1.getWriter(builder);
      UnbindRequestProtocolOp req = new UnbindRequestProtocolOp();
      req.write(writer);
      ASN1Reader reader = ASN1.getReader(builder.toByteString());
      ProtocolOp reqOp = LDAPReader.readProtocolOp(reader);
      assertTrue(reqOp.getProtocolOpName() == req.getProtocolOpName());
      assertTrue(reqOp.getType() == req.getType());
  }
View Full Code Here

   * @throws Exception If the test failed unexpectedly.
   */
  @Test(expectedExceptions = LDAPException.class)
  public void testDecodeEmptyElement() throws Exception
  {
    ByteStringBuilder builder = new ByteStringBuilder();
    ASN1Writer writer = ASN1.getWriter(builder);
    writer.writeStartSequence(OP_TYPE_MODIFY_DN_REQUEST);
    writer.writeEndSequence();

    ASN1Reader reader = ASN1.getReader(builder.toByteString());
    LDAPReader.readProtocolOp(reader);
  }
View Full Code Here

TOP

Related Classes of org.nasutekds.server.types.ByteStringBuilder$SubSequence

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.