org.apache.directory.api.ldap.model.message.DeleteRequest Java Examples

The following examples show how to use org.apache.directory.api.ldap.model.message.DeleteRequest. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ApacheLdapProviderImpl.java    From ldapchai with GNU Lesser General Public License v2.1 6 votes vote down vote up
public void deleteEntry( final String entryDN )
        throws ChaiOperationException, ChaiUnavailableException, IllegalStateException
{
    activityPreCheck();
    getInputValidator().deleteEntry( entryDN );

    try
    {
        final DeleteRequest deleteRequest = new DeleteRequestImpl();
        deleteRequest.setName( new Dn( entryDN ) );
        final DeleteResponse response = connection.delete( deleteRequest );
        processResponse( response );
    }
    catch ( LdapException e )
    {
        throw ChaiOperationException.forErrorMessage( e.getMessage() );
    }
}
 
Example #2
Source File: DefaultCoreSession.java    From MyVirtualDirectory with Apache License 2.0 6 votes vote down vote up
/**
 * {@inheritDoc}
 */
public void delete( DeleteRequest deleteRequest, LogChange log ) throws LdapException
{
    DeleteOperationContext deleteContext = new DeleteOperationContext( this, deleteRequest );

    deleteContext.setLogChange( log );

    OperationManager operationManager = directoryService.getOperationManager();

    try
    {
        operationManager.delete( deleteContext );
    }
    catch ( LdapException e )
    {
        deleteRequest.getResultResponse().addAllControls( deleteContext.getResponseControls() );
        throw e;
    }

    deleteRequest.getResultResponse().addAllControls( deleteContext.getResponseControls() );
}
 
Example #3
Source File: DefaultCoreSession.java    From MyVirtualDirectory with Apache License 2.0 6 votes vote down vote up
/**
 * {@inheritDoc}
 */
public void delete( DeleteRequest deleteRequest, LogChange log ) throws LdapException
{
    DeleteOperationContext deleteContext = new DeleteOperationContext( this, deleteRequest );

    deleteContext.setLogChange( log );

    OperationManager operationManager = directoryService.getOperationManager();

    try
    {
        operationManager.delete( deleteContext );
    }
    catch ( LdapException e )
    {
        deleteRequest.getResultResponse().addAllControls( deleteContext.getResponseControls() );
        throw e;
    }

    deleteRequest.getResultResponse().addAllControls( deleteContext.getResponseControls() );
}
 
Example #4
Source File: DelRequestTest.java    From directory-ldap-api with Apache License 2.0 6 votes vote down vote up
/**
 * Test parsing of a request with the dn attribute
 */
@Test
public void testRequestWithDn()
{
    Dsmlv2Parser parser = null;
    try
    {
        parser = newParser();

        parser.setInput( DelRequestTest.class.getResource( "request_with_dn_attribute.xml" ).openStream(), "UTF-8" );

        parser.parse();
    }
    catch ( Exception e )
    {
        fail( e.getMessage() );
    }

    DeleteRequest delRequest = ( DeleteRequest ) parser.getBatchRequest().getCurrentRequest();

    assertTrue( delRequest.getName().equals( "cn=Bob Rush,ou=Dev,dc=Example,dc=COM" ) );
}
 
Example #5
Source File: DelRequestTest.java    From directory-ldap-api with Apache License 2.0 6 votes vote down vote up
/**
 * Test parsing of a request with the (optional) requestID attribute
 */
@Test
public void testRequestWithRequestId()
{
    Dsmlv2Parser parser = null;
    try
    {
        parser = newParser();

        parser.setInput( DelRequestTest.class.getResource( "request_with_requestID_attribute.xml" ).openStream(),
            "UTF-8" );

        parser.parse();
    }
    catch ( Exception e )
    {
        fail( e.getMessage() );
    }

    DeleteRequest delRequest = ( DeleteRequest ) parser.getBatchRequest().getCurrentRequest();

    assertEquals( 456, delRequest.getMessageId() );
}
 
Example #6
Source File: DelRequestTest.java    From directory-ldap-api with Apache License 2.0 6 votes vote down vote up
/**
 * Test the decoding of an empty DelRequest
 */
@Test
public void testDecodeDelRequestEmpty() throws DecoderException
{
    ByteBuffer stream = ByteBuffer.allocate( 0x07 );

    stream.put( new byte[]
        {
          0x30, 0x05,               // LDAPMessage ::= SEQUENCE {
            0x02, 0x01, 0x01,       // messageID MessageID
                                    // CHOICE { ..., delRequest DelRequest, ...
                                    // DelRequest ::= [APPLICATION 10] LDAPDN;
            0x4A, 0x00              // Empty Dn
    } );

    stream.flip();

    // Allocate a LdapMessage Container
    LdapMessageContainer<DeleteRequest> container = new LdapMessageContainer<>( codec );

    // Decode a DelRequest PDU
    assertThrows( DecoderException.class, ( ) ->
    {
        Asn1Decoder.decode( stream, container );
    } );
}
 
Example #7
Source File: LdapConnectionTemplate.java    From directory-ldap-api with Apache License 2.0 6 votes vote down vote up
/**
 * {@inheritDoc}
 */
@Override
public DeleteResponse delete( DeleteRequest deleteRequest )
{
    LdapConnection connection = null;
    try
    {
        connection = connectionPool.getConnection();
        return connection.delete( deleteRequest );
    }
    catch ( LdapException e )
    {
        throw new LdapRuntimeException( e );
    }
    finally
    {
        returnLdapConnection( connection );
    }
}
 
Example #8
Source File: LdapConnectionTemplate.java    From directory-ldap-api with Apache License 2.0 6 votes vote down vote up
/**
 * {@inheritDoc}
 */
@Override
public DeleteResponse delete( Dn dn, RequestBuilder<DeleteRequest> requestBuilder )
{
    DeleteRequest deleteRequest = newDeleteRequest( dn );
    if ( requestBuilder != null )
    {
        try
        {
            requestBuilder.buildRequest( deleteRequest );
        }
        catch ( LdapException e )
        {
            throw new LdapRuntimeException( e );
        }
    }
    return delete( deleteRequest );
}
 
Example #9
Source File: LdapNetworkConnection.java    From directory-ldap-api with Apache License 2.0 6 votes vote down vote up
/**
 * deletes the entry with the given Dn, and all its children
 *
 * @param dn the target entry's Dn
 * @throws LdapException If the Dn is not valid or if the deletion failed
 */
public void deleteTree( Dn dn ) throws LdapException
{
    if ( isControlSupported( TreeDelete.OID ) )
    {
        DeleteRequest deleteRequest = new DeleteRequestImpl();
        deleteRequest.setName( dn );
        deleteRequest.addControl( new TreeDeleteImpl() );
        DeleteResponse deleteResponse = delete( deleteRequest );

        processResponse( deleteResponse );
    }
    else
    {
        String msg = I18n.err( I18n.ERR_04148_SUBTREE_CONTROL_NOT_SUPPORTED );
        LOG.error( msg );
        throw new LdapException( msg );
    }
}
 
Example #10
Source File: DelRequestDsml.java    From directory-ldap-api with Apache License 2.0 5 votes vote down vote up
/**
 * {@inheritDoc}
 */
@Override
public DeleteRequest setName( Dn name )
{
    getDecorated().setName( name );

    return this;
}
 
Example #11
Source File: LdapServer.java    From MyVirtualDirectory with Apache License 2.0 5 votes vote down vote up
/**
 * Inject the MessageReceived and MessageSent handler into the IoHandler
 * 
 * @param deleteRequestHandler The DeleteRequest message received handler
 * @param deleteResponseHandler The DeleteResponse message sent handler
 */
public void setDeleteHandlers( LdapRequestHandler<DeleteRequest> deleteRequestHandler,
    LdapResponseHandler<DeleteResponse> deleteResponseHandler )
{
    handler.removeReceivedMessageHandler( DeleteRequest.class );
    this.deleteRequestHandler = deleteRequestHandler;
    this.deleteRequestHandler.setLdapServer( this );
    this.handler.addReceivedMessageHandler( DeleteRequest.class, this.deleteRequestHandler );

    handler.removeSentMessageHandler( DeleteResponse.class );
    this.deleteResponseHandler = deleteResponseHandler;
    this.deleteResponseHandler.setLdapServer( this );
    this.handler.addSentMessageHandler( DeleteResponse.class, this.deleteResponseHandler );
}
 
Example #12
Source File: LdapServer.java    From MyVirtualDirectory with Apache License 2.0 5 votes vote down vote up
/**
 * Inject the MessageReceived and MessageSent handler into the IoHandler
 * 
 * @param deleteRequestHandler The DeleteRequest message received handler
 * @param deleteResponseHandler The DeleteResponse message sent handler
 */
public void setDeleteHandlers( LdapRequestHandler<DeleteRequest> deleteRequestHandler,
    LdapResponseHandler<DeleteResponse> deleteResponseHandler )
{
    handler.removeReceivedMessageHandler( DeleteRequest.class );
    this.deleteRequestHandler = deleteRequestHandler;
    this.deleteRequestHandler.setLdapServer( this );
    this.handler.addReceivedMessageHandler( DeleteRequest.class, this.deleteRequestHandler );

    handler.removeSentMessageHandler( DeleteResponse.class );
    this.deleteResponseHandler = deleteResponseHandler;
    this.deleteResponseHandler.setLdapServer( this );
    this.handler.addSentMessageHandler( DeleteResponse.class, this.deleteResponseHandler );
}
 
Example #13
Source File: DelRequestTest.java    From directory-ldap-api with Apache License 2.0 5 votes vote down vote up
/**
 * Test the decoding of a full DelRequest
 */
@Test
public void testDecodeDelRequestSuccess() throws DecoderException, EncoderException
{
    ByteBuffer stream = ByteBuffer.allocate( 0x27 );

    stream.put( new byte[]
        {
          0x30, 0x25,               // LDAPMessage ::= SEQUENCE {
            0x02, 0x01, 0x01,       // messageID MessageID
                                    // CHOICE { ..., delRequest DelRequest, ...
                                    // DelRequest ::= [APPLICATION 10] LDAPDN;
            0x4A, 0x20,
              'c', 'n', '=', 't', 'e', 's', 't', 'M', 'o', 'd', 'i', 'f', 'y', ',',
              'o', 'u', '=', 'u', 's', 'e', 'r', 's', ',', 'o', 'u', '=', 's', 'y', 's', 't', 'e', 'm'
        } );

    stream.flip();

    // Allocate a LdapMessage Container
    LdapMessageContainer<DeleteRequest> container = new LdapMessageContainer<>( codec );

    // Decode a DelRequest PDU
    Asn1Decoder.decode( stream, container );

    // Check the decoded DelRequest PDU
    DeleteRequest delRequest = container.getMessage();

    assertEquals( 1, delRequest.getMessageId() );
    assertEquals( "cn=testModify,ou=users,ou=system", delRequest.getName().toString() );

    // Check encode reverse
    Asn1Buffer buffer = new Asn1Buffer();

    LdapEncoder.encodeMessage( buffer, codec, delRequest );

    assertArrayEquals( stream.array(), buffer.getBytes().array() );
}
 
Example #14
Source File: ModelFactoryImpl.java    From directory-ldap-api with Apache License 2.0 5 votes vote down vote up
/**
 * {@inheritDoc}
 */
@Override
public DeleteRequest newDeleteRequest( Dn dn )
{
    return new DeleteRequestImpl()
        .setName( dn );
}
 
Example #15
Source File: LdapNetworkConnection.java    From directory-ldap-api with Apache License 2.0 5 votes vote down vote up
/**
 * deletes the entry with the given Dn, and all its children
 *
 * @param dn the target entry's Dn as a String
 * @throws LdapException If the Dn is not valid or if the deletion failed
 */
public void deleteTree( String dn ) throws LdapException
{
    try
    {
        String treeDeleteOid = "1.2.840.113556.1.4.805";
        Dn newDn = new Dn( dn );

        if ( isControlSupported( treeDeleteOid ) )
        {
            DeleteRequest deleteRequest = new DeleteRequestImpl();
            deleteRequest.setName( newDn );
            deleteRequest.addControl( new OpaqueControl( treeDeleteOid ) );
            DeleteResponse deleteResponse = delete( deleteRequest );

            processResponse( deleteResponse );
        }
        else
        {
            String msg = I18n.err( I18n.ERR_04148_SUBTREE_CONTROL_NOT_SUPPORTED );
            LOG.error( msg );
            throw new LdapException( msg );
        }
    }
    catch ( LdapInvalidDnException e )
    {
        LOG.error( e.getMessage(), e );
        throw new LdapException( e.getMessage(), e );
    }
}
 
Example #16
Source File: LdapNetworkConnection.java    From directory-ldap-api with Apache License 2.0 5 votes vote down vote up
/**
 * {@inheritDoc}
 */
@Override
public void delete( Dn dn ) throws LdapException
{
    DeleteRequest deleteRequest = new DeleteRequestImpl();
    deleteRequest.setName( dn );

    DeleteResponse deleteResponse = delete( deleteRequest );

    processResponse( deleteResponse );
}
 
Example #17
Source File: BatchRequestTest.java    From directory-ldap-api with Apache License 2.0 5 votes vote down vote up
/**
 * Test parsing of a Request with 2 DelRequest
 */
@Test
public void testResponseWith2DelRequest()
{
    Dsmlv2Parser parser = null;
    try
    {
        parser = newParser();

        parser.setInput( BatchRequestTest.class.getResource( "request_with_2_DelRequest.xml" ).openStream(),
            "UTF-8" );

        parser.parse();
    }
    catch ( Exception e )
    {
        fail( e.getMessage() );
    }

    BatchRequestDsml batchRequest = parser.getBatchRequest();

    assertEquals( 2, batchRequest.getRequests().size() );

    if ( batchRequest.getCurrentRequest() instanceof DeleteRequest )
    {
        assertTrue( true );
    }
    else
    {
        fail();
    }
}
 
Example #18
Source File: BatchRequestTest.java    From directory-ldap-api with Apache License 2.0 5 votes vote down vote up
/**
 * Test parsing of a Request with 1 DelRequest
 */
@Test
public void testResponseWith1DelRequest()
{
    Dsmlv2Parser parser = null;
    try
    {
        parser = newParser();

        parser.setInput( BatchRequestTest.class.getResource( "request_with_1_DelRequest.xml" ).openStream(),
            "UTF-8" );

        parser.parse();
    }
    catch ( Exception e )
    {
        fail( e.getMessage() );
    }

    BatchRequestDsml batchRequest = parser.getBatchRequest();

    assertEquals( 1, batchRequest.getRequests().size() );

    if ( batchRequest.getCurrentRequest() instanceof DeleteRequest )
    {
        assertTrue( true );
    }
    else
    {
        fail();
    }
}
 
Example #19
Source File: DelRequestTest.java    From directory-ldap-api with Apache License 2.0 5 votes vote down vote up
/**
 * Test parsing of a request with a (optional) Control element
 */
@Test
public void testRequestWith1Control()
{
    Dsmlv2Parser parser = null;
    try
    {
        parser = newParser();

        parser.setInput( DelRequestTest.class.getResource( "request_with_1_control.xml" ).openStream(), "UTF-8" );

        parser.parse();
    }
    catch ( Exception e )
    {
        fail( e.getMessage() );
    }

    DeleteRequest delRequest = ( DeleteRequest ) parser.getBatchRequest().getCurrentRequest();
    Map<String, Control> controls = delRequest.getControls();

    assertEquals( 1, delRequest.getControls().size() );

    Control control = controls.get( "1.2.840.113556.1.4.643" );

    assertNotNull( control );
    assertTrue( control.isCritical() );
    assertEquals( "1.2.840.113556.1.4.643", control.getOid() );
    assertEquals( "Some text", Strings.utf8ToString( ( ( DsmlControl<?> ) control ).getValue() ) );
}
 
Example #20
Source File: DelRequestDsml.java    From directory-ldap-api with Apache License 2.0 5 votes vote down vote up
/**
 * {@inheritDoc}
 */
@Override
public DeleteRequest setMessageId( int messageId )
{
    super.setMessageId( messageId );

    return this;
}
 
Example #21
Source File: DelRequestTest.java    From directory-ldap-api with Apache License 2.0 5 votes vote down vote up
/**
 * Test parsing of a request with 3 (optional) Control elements without value
 */
@Test
public void testRequestWith3ControlsWithoutValue()
{
    Dsmlv2Parser parser = null;
    try
    {
        parser = newParser();

        parser.setInput( DelRequestTest.class.getResource( "request_with_3_controls_without_value.xml" )
            .openStream(), "UTF-8" );

        parser.parse();
    }
    catch ( Exception e )
    {
        fail( e.getMessage() );
    }

    DeleteRequest delRequest = ( DeleteRequest ) parser.getBatchRequest().getCurrentRequest();
    Map<String, Control> controls = delRequest.getControls();

    assertEquals( 3, delRequest.getControls().size() );

    Control control = controls.get( "1.2.840.113556.1.4.456" );

    assertNotNull( control );
    assertTrue( control.isCritical() );
    assertEquals( "1.2.840.113556.1.4.456", control.getOid() );
    assertFalse( ( ( DsmlControl<?> ) control ).hasValue() );
}
 
Example #22
Source File: DelRequestTest.java    From directory-ldap-api with Apache License 2.0 5 votes vote down vote up
/**
 * Test parsing of a request with 2 (optional) Control elements
 */
@Test
public void testRequestWith2Controls()
{
    Dsmlv2Parser parser = null;
    try
    {
        parser = newParser();

        parser.setInput( DelRequestTest.class.getResource( "request_with_2_controls.xml" ).openStream(), "UTF-8" );

        parser.parse();
    }
    catch ( Exception e )
    {
        e.printStackTrace();
        fail( e.getMessage() );
    }

    DeleteRequest delRequest = ( DeleteRequest ) parser.getBatchRequest().getCurrentRequest();
    Map<String, Control> controls = delRequest.getControls();

    assertEquals( 2, delRequest.getControls().size() );

    Control control = controls.get( "1.2.840.113556.1.4.789" );

    assertNotNull( control );
    assertFalse( control.isCritical() );
    assertEquals( "1.2.840.113556.1.4.789", control.getOid() );
    assertEquals( "Some other text", Strings.utf8ToString( ( ( DsmlControl<?> ) control ).getValue() ) );
}
 
Example #23
Source File: DelRequestTest.java    From directory-ldap-api with Apache License 2.0 5 votes vote down vote up
/**
 * Test parsing of a request with a (optional) Control element with empty value
 */
@Test
public void testRequestWith1ControlEmptyValue()
{
    Dsmlv2Parser parser = null;
    try
    {
        parser = newParser();

        parser.setInput( DelRequestTest.class.getResource( "request_with_1_control_empty_value.xml" ).openStream(),
            "UTF-8" );

        parser.parse();
    }
    catch ( Exception e )
    {
        fail( e.getMessage() );
    }

    DeleteRequest delRequest = ( DeleteRequest ) parser.getBatchRequest().getCurrentRequest();
    Map<String, Control> controls = delRequest.getControls();

    assertEquals( 1, delRequest.getControls().size() );

    Control control = controls.get( "1.2.840.113556.1.4.643" );

    assertNotNull( control );
    assertTrue( control.isCritical() );
    assertEquals( "1.2.840.113556.1.4.643", control.getOid() );
    assertFalse( ( ( DsmlControl<?> ) control ).hasValue() );
}
 
Example #24
Source File: DelRequestTest.java    From directory-ldap-api with Apache License 2.0 5 votes vote down vote up
/**
 * Test parsing of a request with a (optional) Control element
 */
@Test
public void testRequestWith1ControlBase64Value()
{
    Dsmlv2Parser parser = null;
    try
    {
        parser = newParser();

        parser.setInput(
            DelRequestTest.class.getResource( "request_with_1_control_base64_value.xml" ).openStream(), "UTF-8" );

        parser.parse();
    }
    catch ( Exception e )
    {
        fail( e.getMessage() );
    }

    DeleteRequest delRequest = ( DeleteRequest ) parser.getBatchRequest().getCurrentRequest();
    Map<String, Control> controls = delRequest.getControls();

    assertEquals( 1, delRequest.getControls().size() );

    Control control = controls.get( "1.2.840.113556.1.4.643" );

    assertNotNull( control );
    assertTrue( control.isCritical() );
    assertEquals( "1.2.840.113556.1.4.643", control.getOid() );
    assertEquals( "DSMLv2.0 rocks!!", Strings.utf8ToString( ( ( DsmlControl<?> ) control ).getValue() ) );
}
 
Example #25
Source File: LdapConnectionTemplate.java    From directory-ldap-api with Apache License 2.0 4 votes vote down vote up
/**
 * {@inheritDoc}
 */
@Override
public DeleteRequest newDeleteRequest( Dn dn )
{
    return modelFactory.newDeleteRequest( dn );
}
 
Example #26
Source File: DefaultCoreSession.java    From MyVirtualDirectory with Apache License 2.0 4 votes vote down vote up
/**
 * {@inheritDoc}
 */
public void delete( DeleteRequest deleteRequest ) throws LdapException
{
    delete( deleteRequest, LogChange.TRUE );
}
 
Example #27
Source File: DelRequestDsml.java    From directory-ldap-api with Apache License 2.0 4 votes vote down vote up
/**
 * {@inheritDoc}
 */
@Override
public DeleteRequest removeControl( Control control )
{
    return ( DeleteRequest ) super.removeControl( control );
}
 
Example #28
Source File: LdapServer.java    From MyVirtualDirectory with Apache License 2.0 4 votes vote down vote up
/**
 * @return The MessageReceived handler for the DeleteRequest
 */
public LdapRequestHandler<DeleteRequest> getDeleteRequestHandler()
{
    return deleteRequestHandler;
}
 
Example #29
Source File: DelRequestTest.java    From directory-ldap-api with Apache License 2.0 4 votes vote down vote up
/**
 * Test the decoding of a full DelRequest with controls
 */
@Test
public void testDecodeDelRequestSuccessWithControls() throws DecoderException, EncoderException
{
    ByteBuffer stream = ByteBuffer.allocate( 0x44 );

    stream.put( new byte[]
        {
          0x30, 0x42,               // LDAPMessage ::= SEQUENCE {
            0x02, 0x01, 0x01,       // messageID MessageID
                                    // CHOICE { ..., delRequest DelRequest, ...
                                    // DelRequest ::= [APPLICATION 10] LDAPDN;
            0x4A, 0x20,
              'c', 'n', '=', 't', 'e', 's', 't', 'M', 'o', 'd', 'i', 'f', 'y', ',',
              'o', 'u', '=', 'u', 's', 'e', 'r', 's', ',', 'o', 'u', '=', 's', 'y', 's', 't', 'e', 'm',
            ( byte ) 0xA0, 0x1B,    // A control
              0x30, 0x19,
                0x04, 0x17,
                  '2', '.', '1', '6', '.', '8', '4', '0', '.', '1', '.', '1', '1', '3',
                  '7', '3', '0', '.', '3', '.', '4', '.', '2'
        } );

    stream.flip();

    // Allocate a LdapMessage Container
    LdapMessageContainer<DeleteRequest> container = new LdapMessageContainer<>( codec );

    // Decode a DelRequest PDU
    Asn1Decoder.decode( stream, container );

    // Check the decoded DelRequest PDU
    DeleteRequest delRequest = container.getMessage();

    assertEquals( 1, delRequest.getMessageId() );
    assertEquals( "cn=testModify,ou=users,ou=system", delRequest.getName().toString() );

    // Check the Control
    Map<String, Control> controls = delRequest.getControls();

    assertEquals( 1, controls.size() );

    Control control = controls.get( "2.16.840.1.113730.3.4.2" );
    assertTrue( control instanceof ManageDsaIT );
    assertEquals( "2.16.840.1.113730.3.4.2", control.getOid() );

    // Check encode reverse
    Asn1Buffer buffer = new Asn1Buffer();

    LdapEncoder.encodeMessage( buffer, codec, delRequest );

    assertArrayEquals( stream.array(), buffer.getBytes().array() );
}
 
Example #30
Source File: DelRequestTest.java    From directory-ldap-api with Apache License 2.0 4 votes vote down vote up
/**
 * Test the decoding of a full DelRequest
 */
@Test
public void testDecodeDelRequestBadDN() throws DecoderException
{
    ByteBuffer stream = ByteBuffer.allocate( 0x27 );

    stream.put( new byte[]
        {
          0x30, 0x25,               // LDAPMessage ::= SEQUENCE {
            0x02, 0x01, 0x01,       // messageID MessageID
                                    // CHOICE { ..., delRequest DelRequest, ...
                                    // DelRequest ::= [APPLICATION 10] LDAPDN;
            0x4A, 0x20,
              'c', 'n', ':', 't', 'e', 's', 't', 'M', 'o', 'd', 'i', 'f', 'y', ',',
              'o', 'u', '=', 'u', 's', 'e', 'r', 's', ',', 'o', 'u', '=', 's', 'y', 's', 't', 'e', 'm'
        } );

    stream.flip();

    // Allocate a LdapMessage Container
    LdapMessageContainer<DeleteRequest> container = new LdapMessageContainer<>( codec );

    // Decode a DelRequest PDU
    assertThrows( DecoderException.class, ( ) ->
    {
        try
        {
            Asn1Decoder.decode( stream, container );
        }
        catch ( DecoderException de )
        {
            assertTrue( de instanceof ResponseCarryingException );
            Message response = ( ( ResponseCarryingException ) de ).getResponse();
            assertTrue( response instanceof DeleteResponseImpl );
            assertEquals( ResultCodeEnum.INVALID_DN_SYNTAX, ( ( DeleteResponseImpl ) response ).getLdapResult()
                .getResultCode() );

            throw de;
        }
    } );
}