org.apache.directory.api.ldap.model.message.ModifyDnResponse Java Examples
The following examples show how to use
org.apache.directory.api.ldap.model.message.ModifyDnResponse.
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 |
@ChaiProvider.LdapOperation @ChaiProvider.ModifyOperation public void renameEntry( final String entryDN, final String newRDN, final String newParentDN ) throws ChaiOperationException, ChaiUnavailableException, IllegalStateException { try { final ModifyDnRequest modifyDnRequest = new ModifyDnRequestImpl(); modifyDnRequest.setName( new Dn( entryDN ) ); modifyDnRequest.setDeleteOldRdn( true ); modifyDnRequest.setNewRdn( new Rdn( newRDN ) ); modifyDnRequest.setNewSuperior( new Dn( newParentDN ) ); final ModifyDnResponse response = connection.modifyDn( modifyDnRequest ); processResponse( response ); } catch ( LdapException e ) { throw ChaiOperationException.forErrorMessage( e.getMessage() ); } }
Example #2
Source File: ModifyDNResponseTest.java From directory-ldap-api with Apache License 2.0 | 6 votes |
/** * Test parsing of a Response with the (optional) requestID attribute */ @Test public void testResponseWithRequestId() { Dsmlv2ResponseParser parser = null; try { parser = new Dsmlv2ResponseParser( getCodec() ); parser.setInput( ModifyDNResponseTest.class.getResource( "response_with_requestID_attribute.xml" ) .openStream(), "UTF-8" ); parser.parse(); } catch ( Exception e ) { fail( e.getMessage() ); } ModifyDnResponse modifyDNResponse = ( ModifyDnResponse ) parser.getBatchResponse().getCurrentResponse(); assertEquals( 456, modifyDNResponse.getMessageId() ); }
Example #3
Source File: ModifyDNResponseTest.java From directory-ldap-api with Apache License 2.0 | 6 votes |
/** * Test the decoding of a ModifyDNResponse with no LdapResult */ @Test public void testDecodeModifyDNResponseEmptyResult() throws DecoderException { ByteBuffer stream = ByteBuffer.allocate( 0x07 ); stream.put( new byte[] { 0x30, 0x05, // LDAPMessage ::=SEQUENCE { 0x02, 0x01, 0x01, // messageID MessageID 0x6D, 0x00, // CHOICE { ..., modifyDnResponse ModifyDNResponse, ... } ); stream.flip(); // Allocate a LdapMessage Container LdapMessageContainer<ModifyDnResponse> ldapMessageContainer = new LdapMessageContainer<>( codec ); // Decode a ModifyDNResponse message assertThrows( DecoderException.class, ( ) -> { Asn1Decoder.decode( stream, ldapMessageContainer ); } ); }
Example #4
Source File: LdapNetworkConnection.java From directory-ldap-api with Apache License 2.0 | 6 votes |
/** * Process the ModifyDnResponse received from the server * * @param modifyDnResponse The ModifyDnResponse to process * @param modifyDnFuture The ModifyDnFuture to feed * @param responseId The associated request message ID * @throws InterruptedException If the Future is interrupted */ private void modifyDnReceived( ModifyDnResponse modifyDnResponse, ModifyDnFuture modifyDnFuture, int responseId ) throws InterruptedException { if ( LOG.isDebugEnabled() ) { if ( modifyDnResponse.getLdapResult().getResultCode() == ResultCodeEnum.SUCCESS ) { // Everything is fine, return the response LOG.debug( I18n.msg( I18n.MSG_04125_MODIFYDN_SUCCESSFUL, modifyDnResponse ) ); } else { // We have had an error LOG.debug( I18n.msg( I18n.MSG_04124_MODIFYDN_FAILED, modifyDnResponse ) ); } } // Store the response into the future modifyDnFuture.set( modifyDnResponse ); // Remove the future from the map removeFromFutureMaps( responseId ); }
Example #5
Source File: ModifyDNResponseTest.java From directory-ldap-api with Apache License 2.0 | 6 votes |
/** * Test parsing of a response with Result Code */ @Test public void testResponseWithResultCode() { Dsmlv2ResponseParser parser = null; try { parser = new Dsmlv2ResponseParser( getCodec() ); parser.setInput( ModifyDNResponseTest.class.getResource( "response_with_result_code.xml" ).openStream(), "UTF-8" ); parser.parse(); } catch ( Exception e ) { fail( e.getMessage() ); } ModifyDnResponse modifyDNResponse = ( ModifyDnResponse ) parser.getBatchResponse().getCurrentResponse(); LdapResult ldapResult = modifyDNResponse.getLdapResult(); assertEquals( ResultCodeEnum.PROTOCOL_ERROR, ldapResult.getResultCode() ); }
Example #6
Source File: ModifyDNResponseTest.java From directory-ldap-api with Apache License 2.0 | 6 votes |
/** * Test parsing of a response with Error Message */ @Test public void testResponseWithErrorMessage() { Dsmlv2ResponseParser parser = null; try { parser = new Dsmlv2ResponseParser( getCodec() ); parser.setInput( ModifyDNResponseTest.class.getResource( "response_with_error_message.xml" ).openStream(), "UTF-8" ); parser.parse(); } catch ( Exception e ) { fail( e.getMessage() ); } ModifyDnResponse modifyDNResponse = ( ModifyDnResponse ) parser.getBatchResponse().getCurrentResponse(); LdapResult ldapResult = modifyDNResponse.getLdapResult(); assertEquals( "Unrecognized extended operation EXTENSION_OID: 1.2.6.1.4.1.18060.1.1.1.100.2", ldapResult .getDiagnosticMessage() ); }
Example #7
Source File: ModifyDNResponseTest.java From directory-ldap-api with Apache License 2.0 | 6 votes |
/** * Test parsing of a response with empty Error Message */ @Test public void testResponseWithEmptyErrorMessage() { Dsmlv2ResponseParser parser = null; try { parser = new Dsmlv2ResponseParser( getCodec() ); parser.setInput( ModifyDNResponseTest.class.getResource( "response_with_empty_error_message.xml" ) .openStream(), "UTF-8" ); parser.parse(); } catch ( Exception e ) { fail( e.getMessage() ); } ModifyDnResponse modifyDNResponse = ( ModifyDnResponse ) parser.getBatchResponse().getCurrentResponse(); LdapResult ldapResult = modifyDNResponse.getLdapResult(); assertNull( ldapResult.getDiagnosticMessage() ); }
Example #8
Source File: ModifyDNResponseTest.java From directory-ldap-api with Apache License 2.0 | 6 votes |
/** * Test parsing of a response with MatchedDN attribute */ @Test public void testResponseWithMatchedDNAttribute() { Dsmlv2ResponseParser parser = null; try { parser = new Dsmlv2ResponseParser( getCodec() ); parser.setInput( ModifyDNResponseTest.class.getResource( "response_with_matchedDN_attribute.xml" ) .openStream(), "UTF-8" ); parser.parse(); } catch ( Exception e ) { fail( e.getMessage() ); } ModifyDnResponse modifyDNResponse = ( ModifyDnResponse ) parser.getBatchResponse().getCurrentResponse(); LdapResult ldapResult = modifyDNResponse.getLdapResult(); assertTrue( ldapResult.getMatchedDn().equals( "cn=Bob Rush,ou=Dev,dc=Example,dc=COM" ) ); }
Example #9
Source File: BatchResponseTest.java From directory-ldap-api with Apache License 2.0 | 5 votes |
/** * Test parsing of a Response with the 1 ModDNResponse */ @Test public void testResponseWith1ModDNResponse() { Dsmlv2ResponseParser parser = null; try { parser = new Dsmlv2ResponseParser( getCodec() ); parser.setInput( BatchResponseTest.class.getResource( "response_with_1_ModDNResponse.xml" ).openStream(), "UTF-8" ); parser.parse(); } catch ( Exception e ) { fail( e.getMessage() ); } BatchResponseDsml batchResponse = parser.getBatchResponse(); assertEquals( 1, batchResponse.getResponses().size() ); DsmlDecorator<? extends Response> response = batchResponse.getCurrentResponse(); if ( response instanceof ModifyDnResponse ) { assertTrue( true ); } else { fail(); } }
Example #10
Source File: LdapServer.java From MyVirtualDirectory with Apache License 2.0 | 5 votes |
/** * Inject the MessageReceived and MessageSent handler into the IoHandler * * @param modifyDnRequestHandler The ModifyDnRequest message received handler * @param modifyDnResponseHandler The ModifyDnResponse message sent handler */ public void setModifyDnHandlers( LdapRequestHandler<ModifyDnRequest> modifyDnRequestHandler, LdapResponseHandler<ModifyDnResponse> modifyDnResponseHandler ) { handler.removeReceivedMessageHandler( ModifyDnRequest.class ); this.modifyDnRequestHandler = modifyDnRequestHandler; this.modifyDnRequestHandler.setLdapServer( this ); this.handler.addReceivedMessageHandler( ModifyDnRequest.class, this.modifyDnRequestHandler ); handler.removeSentMessageHandler( ModifyDnResponse.class ); this.modifyDnResponseHandler = modifyDnResponseHandler; this.modifyDnResponseHandler.setLdapServer( this ); this.handler.addSentMessageHandler( ModifyDnResponse.class, this.modifyDnResponseHandler ); }
Example #11
Source File: LdapServer.java From MyVirtualDirectory with Apache License 2.0 | 5 votes |
/** * Inject the MessageReceived and MessageSent handler into the IoHandler * * @param modifyDnRequestHandler The ModifyDnRequest message received handler * @param modifyDnResponseHandler The ModifyDnResponse message sent handler */ public void setModifyDnHandlers( LdapRequestHandler<ModifyDnRequest> modifyDnRequestHandler, LdapResponseHandler<ModifyDnResponse> modifyDnResponseHandler ) { handler.removeReceivedMessageHandler( ModifyDnRequest.class ); this.modifyDnRequestHandler = modifyDnRequestHandler; this.modifyDnRequestHandler.setLdapServer( this ); this.handler.addReceivedMessageHandler( ModifyDnRequest.class, this.modifyDnRequestHandler ); handler.removeSentMessageHandler( ModifyDnResponse.class ); this.modifyDnResponseHandler = modifyDnResponseHandler; this.modifyDnResponseHandler.setLdapServer( this ); this.handler.addSentMessageHandler( ModifyDnResponse.class, this.modifyDnResponseHandler ); }
Example #12
Source File: InitModifyDnResponse.java From directory-ldap-api with Apache License 2.0 | 5 votes |
/** * {@inheritDoc} */ public void action( LdapMessageContainer<ModifyDnResponse> container ) { // Now, we can allocate the ModifyDnResponse Object ModifyDnResponse modifyDnResponse = new ModifyDnResponseImpl( container.getMessageId() ); container.setMessage( modifyDnResponse ); if ( LOG.isDebugEnabled() ) { LOG.debug( I18n.msg( I18n.MSG_05177_MODIFY_DN_RESPONSE ) ); } }
Example #13
Source File: ModifyDNResponseTest.java From directory-ldap-api with Apache License 2.0 | 5 votes |
/** * Test parsing of a response with an empty Referral */ @Test public void testResponseWith1EmptyReferral() { Dsmlv2ResponseParser parser = null; try { parser = new Dsmlv2ResponseParser( getCodec() ); parser.setInput( ModifyDNResponseTest.class.getResource( "response_with_1_empty_referral.xml" ) .openStream(), "UTF-8" ); parser.parse(); } catch ( Exception e ) { fail( e.getMessage() ); } ModifyDnResponse modifyDNResponse = ( ModifyDnResponse ) parser.getBatchResponse().getCurrentResponse(); LdapResult ldapResult = modifyDNResponse.getLdapResult(); Collection<String> referrals = ldapResult.getReferral().getLdapUrls(); assertEquals( 0, referrals.size() ); }
Example #14
Source File: ModifyDNResponseTest.java From directory-ldap-api with Apache License 2.0 | 5 votes |
/** * Test parsing of a response with 3 (optional) Control elements without value */ @Test public void testResponseWith3ControlsWithoutValue() { Dsmlv2ResponseParser parser = null; try { parser = new Dsmlv2ResponseParser( getCodec() ); parser.setInput( ModifyDNResponseTest.class.getResource( "response_with_3_controls_without_value.xml" ) .openStream(), "UTF-8" ); parser.parse(); } catch ( Exception e ) { fail( e.getMessage() ); } ModifyDnResponse modifyDNResponse = ( ModifyDnResponse ) parser.getBatchResponse().getCurrentResponse(); Map<String, Control> controls = modifyDNResponse.getControls(); assertEquals( 3, modifyDNResponse.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 #15
Source File: ModifyDNResponseTest.java From directory-ldap-api with Apache License 2.0 | 5 votes |
/** * Test parsing of a response with 2 (optional) Control elements */ @Test public void testResponseWith2Controls() { Dsmlv2ResponseParser parser = null; try { parser = new Dsmlv2ResponseParser( getCodec() ); parser.setInput( ModifyDNResponseTest.class.getResource( "response_with_2_controls.xml" ).openStream(), "UTF-8" ); parser.parse(); } catch ( Exception e ) { fail( e.getMessage() ); } ModifyDnResponse modifyDNResponse = ( ModifyDnResponse ) parser.getBatchResponse().getCurrentResponse(); Map<String, Control> controls = modifyDNResponse.getControls(); assertEquals( 2, modifyDNResponse.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 #16
Source File: ModifyDNResponseTest.java From directory-ldap-api with Apache License 2.0 | 5 votes |
/** * Test parsing of a response with a (optional) Control element with empty value */ @Test public void testResponseWith1ControlEmptyValue() { Dsmlv2ResponseParser parser = null; try { parser = new Dsmlv2ResponseParser( getCodec() ); parser.setInput( ModifyDNResponseTest.class.getResource( "response_with_1_control_empty_value.xml" ) .openStream(), "UTF-8" ); parser.parse(); } catch ( Exception e ) { fail( e.getMessage() ); } ModifyDnResponse modifyDNResponse = ( ModifyDnResponse ) parser.getBatchResponse().getCurrentResponse(); Map<String, Control> controls = modifyDNResponse.getControls(); assertEquals( 1, modifyDNResponse.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 #17
Source File: ModifyDNResponseTest.java From directory-ldap-api with Apache License 2.0 | 5 votes |
/** * Test parsing of a response with a (optional) Control element */ @Test public void testResponseWith1Control() { Dsmlv2ResponseParser parser = null; try { parser = new Dsmlv2ResponseParser( getCodec() ); parser.setInput( ModifyDNResponseTest.class.getResource( "response_with_1_control.xml" ).openStream(), "UTF-8" ); parser.parse(); } catch ( Exception e ) { fail( e.getMessage() ); } ModifyDnResponse modifyDNResponse = ( ModifyDnResponse ) parser.getBatchResponse().getCurrentResponse(); Map<String, Control> controls = modifyDNResponse.getControls(); assertEquals( 1, modifyDNResponse.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 #18
Source File: BatchResponseTest.java From directory-ldap-api with Apache License 2.0 | 5 votes |
/** * Test parsing of a Response with the 2 ModDNResponse */ @Test public void testResponseWith2ModDNResponse() { Dsmlv2ResponseParser parser = null; try { parser = new Dsmlv2ResponseParser( getCodec() ); parser.setInput( BatchResponseTest.class.getResource( "response_with_2_ModDNResponse.xml" ).openStream(), "UTF-8" ); parser.parse(); } catch ( Exception e ) { fail( e.getMessage() ); } BatchResponseDsml batchResponse = parser.getBatchResponse(); assertEquals( 2, batchResponse.getResponses().size() ); DsmlDecorator<? extends Response> response = batchResponse.getCurrentResponse(); if ( response instanceof ModifyDnResponse ) { assertTrue( true ); } else { fail(); } }
Example #19
Source File: LdapConnectionWrapper.java From directory-ldap-api with Apache License 2.0 | 4 votes |
/** * {@inheritDoc} */ @Override public ModifyDnResponse modifyDn( ModifyDnRequest modDnRequest ) throws LdapException { return connection.modifyDn( modDnRequest ); }
Example #20
Source File: LdapNetworkConnection.java From directory-ldap-api with Apache License 2.0 | 4 votes |
/** * {@inheritDoc} */ @Override public void moveAndRename( Dn entryDn, Dn newDn, boolean deleteOldRdn ) throws LdapException { // Check the parameters first if ( entryDn == null ) { throw new IllegalArgumentException( I18n.err( I18n.ERR_04142_NULL_ENTRY_DN ) ); } if ( entryDn.isRootDse() ) { throw new IllegalArgumentException( I18n.err( I18n.ERR_04143_CANNOT_MOVE_ROOT_DSE ) ); } if ( newDn == null ) { throw new IllegalArgumentException( I18n.err( I18n.ERR_04144_NULL_NEW_DN ) ); } if ( newDn.isRootDse() ) { throw new IllegalArgumentException( I18n.err( I18n.ERR_04145_ROOT_DSE_CANNOT_BE_TARGET ) ); } // Create the request ModifyDnRequest modDnRequest = new ModifyDnRequestImpl(); modDnRequest.setName( entryDn ); modDnRequest.setNewRdn( newDn.getRdn() ); // Check if we really need to specify newSuperior. // newSuperior is optional [RFC4511, section 4.9] // Some servers (e.g. OpenDJ 2.6) require a special privilege if // newSuperior is specified even if it is the same as the old one. Therefore let's not // specify it if we do not need it. This is better interoperability. Dn newDnParent = newDn.getParent(); if ( newDnParent != null && !newDnParent.equals( entryDn.getParent() ) ) { modDnRequest.setNewSuperior( newDnParent ); } modDnRequest.setDeleteOldRdn( deleteOldRdn ); ModifyDnResponse modifyDnResponse = modifyDn( modDnRequest ); processResponse( modifyDnResponse ); }
Example #21
Source File: LdapNetworkConnection.java From directory-ldap-api with Apache License 2.0 | 4 votes |
/** * {@inheritDoc} */ @Override public ModifyDnResponse modifyDn( ModifyDnRequest modDnRequest ) throws LdapException { if ( modDnRequest == null ) { String msg = I18n.err( I18n.ERR_04145_ROOT_DSE_CANNOT_BE_TARGET ); if ( LOG.isDebugEnabled() ) { LOG.debug( msg ); } throw new IllegalArgumentException( msg ); } ModifyDnFuture modifyDnFuture = modifyDnAsync( modDnRequest ); // Get the result from the future try { // Read the response, waiting for it if not available immediately // Get the response, blocking ModifyDnResponse modifyDnResponse = modifyDnFuture.get( timeout, TimeUnit.MILLISECONDS ); if ( modifyDnResponse == null ) { // We didn't received anything : this is an error if ( LOG.isErrorEnabled() ) { LOG.error( I18n.err( I18n.ERR_04112_OP_FAILED_TIMEOUT, "ModifyDn" ) ); } throw new LdapException( TIME_OUT_ERROR ); } if ( modifyDnResponse.getLdapResult().getResultCode() == ResultCodeEnum.SUCCESS ) { // Everything is fine, return the response if ( LOG.isDebugEnabled() ) { LOG.debug( I18n.msg( I18n.MSG_04125_MODIFYDN_SUCCESSFUL, modifyDnResponse ) ); } } else { // We have had an error if ( LOG.isDebugEnabled() ) { LOG.debug( I18n.msg( I18n.MSG_04124_MODIFYDN_FAILED, modifyDnResponse ) ); } } return modifyDnResponse; } catch ( Exception ie ) { // Catch all other exceptions LOG.error( NO_RESPONSE_ERROR, ie ); // Send an abandon request if ( !modifyDnFuture.isCancelled() ) { abandon( modDnRequest.getMessageId() ); } throw new LdapException( NO_RESPONSE_ERROR, ie ); } }
Example #22
Source File: ModifyDNResponseTest.java From directory-ldap-api with Apache License 2.0 | 4 votes |
/** * Test the decoding of a ModifyDNResponse */ @Test public void testDecodeModifyResponseSuccess() throws DecoderException, EncoderException { ByteBuffer stream = ByteBuffer.allocate( 0x0E ); stream.put( new byte[] { 0x30, 0x0C, // LDAPMessage ::=SEQUENCE { 0x02, 0x01, 0x01, // messageID MessageID 0x6D, 0x07, // CHOICE { ..., modifyDnResponse ModifyDNResponse, ... // ModifyDNResponse ::= [APPLICATION 13] LDAPResult 0x0A, 0x01, 0x00, // LDAPResult ::= SEQUENCE { // resultCode ENUMERATED { // success (0), ... // }, 0x04, 0x00, // matchedDN LDAPDN, 0x04, 0x00 // errorMessage LDAPString, // referral [3] Referral OPTIONAL } // } } ); stream.flip(); // Allocate a LdapMessage Container LdapMessageContainer<ModifyDnResponse> ldapMessageContainer = new LdapMessageContainer<>( codec ); // Decode the ModifyDNResponse PDU Asn1Decoder.decode( stream, ldapMessageContainer ); // Check the decoded ModifyDNResponse PDU ModifyDnResponse modifyDnResponse = ldapMessageContainer.getMessage(); assertEquals( 1, modifyDnResponse.getMessageId() ); assertEquals( ResultCodeEnum.SUCCESS, modifyDnResponse.getLdapResult().getResultCode() ); assertEquals( "", modifyDnResponse.getLdapResult().getMatchedDn().getName() ); assertEquals( "", modifyDnResponse.getLdapResult().getDiagnosticMessage() ); // Check encode reverse Asn1Buffer buffer = new Asn1Buffer(); LdapEncoder.encodeMessage( buffer, codec, modifyDnResponse ); assertArrayEquals( stream.array(), buffer.getBytes().array() ); }
Example #23
Source File: ModifyDNResponseTest.java From directory-ldap-api with Apache License 2.0 | 4 votes |
/** * Test the decoding of a ModifyDNResponse with controls */ @Test public void testDecodeModifyResponseSuccessWithControls() throws DecoderException, EncoderException { ByteBuffer stream = ByteBuffer.allocate( 0x32 ); stream.put( new byte[] { 0x30, 0x30, // LDAPMessage ::=SEQUENCE { 0x02, 0x01, 0x01, // messageID MessageID 0x6D, 0x07, // CHOICE { ..., modifyDnResponse ModifyDNResponse, ... // ModifyDNResponse ::= [APPLICATION 13] LDAPResult 0x0A, 0x01, 0x00, // LDAPResult ::= SEQUENCE { // resultCode ENUMERATED { // success (0), ... // }, 0x04, 0x00, // matchedDN LDAPDN, 0x04, 0x00, // errorMessage LDAPString, // referral [3] Referral OPTIONAL } // } ( byte ) 0xA0, 0x22, // A control 0x30, 0x20, 0x04, 0x17, // EntryChange response control '2', '.', '1', '6', '.', '8', '4', '0', '.', '1', '.', '1', '1', '3', '7', '3', '0', '.', '3', '.', '4', '.', '7', 0x04, 0x05, // Control value 0x30, 0x03, // EntryChangeNotification ::= SEQUENCE { 0x0A, 0x01, 0x01 // changeType ENUMERATED { // add (1), } ); stream.flip(); // Allocate a LdapMessage Container LdapMessageContainer<ModifyDnResponse> ldapMessageContainer = new LdapMessageContainer<>( codec ); // Decode the ModifyDNResponse PDU Asn1Decoder.decode( stream, ldapMessageContainer ); // Check the decoded ModifyDNResponse PDU ModifyDnResponse modifyDnResponse = ldapMessageContainer.getMessage(); assertEquals( 1, modifyDnResponse.getMessageId() ); assertEquals( ResultCodeEnum.SUCCESS, modifyDnResponse.getLdapResult().getResultCode() ); assertEquals( "", modifyDnResponse.getLdapResult().getMatchedDn().getName() ); assertEquals( "", modifyDnResponse.getLdapResult().getDiagnosticMessage() ); // Check the Control Map<String, Control> controls = modifyDnResponse.getControls(); assertEquals( 1, controls.size() ); Control control =controls.get( "2.16.840.1.113730.3.4.7" ); assertEquals( "2.16.840.1.113730.3.4.7", control.getOid() ); assertTrue( control instanceof EntryChange ); // Check encode reverse Asn1Buffer buffer = new Asn1Buffer(); LdapEncoder.encodeMessage( buffer, codec, modifyDnResponse ); assertArrayEquals( stream.array(), buffer.getBytes().array() ); }
Example #24
Source File: LdapServer.java From MyVirtualDirectory with Apache License 2.0 | 4 votes |
/** * @return The MessageSent handler for the ModifyDnResponse */ public LdapResponseHandler<ModifyDnResponse> getModifyDnResponseHandler() { return modifyDnResponseHandler; }
Example #25
Source File: LdapServer.java From MyVirtualDirectory with Apache License 2.0 | 4 votes |
/** * @return The MessageSent handler for the ModifyDnResponse */ public LdapResponseHandler<ModifyDnResponse> getModifyDnResponseHandler() { return modifyDnResponseHandler; }
Example #26
Source File: LdapConnection.java From directory-ldap-api with Apache License 2.0 | 2 votes |
/** * Performs the modifyDn operation based on the given request object. * * @param modDnRequest the request object * @return modifyDn operation's response * @throws LdapException if some error occurred */ ModifyDnResponse modifyDn( ModifyDnRequest modDnRequest ) throws LdapException;
Example #27
Source File: ModDNResponseDsml.java From directory-ldap-api with Apache License 2.0 | 2 votes |
/** * Creates a new getDecoratedMessage() of ModDNResponseDsml. * * @param codec The LDAP Service to use * @param ldapMessage the message to decorate */ public ModDNResponseDsml( LdapApiService codec, ModifyDnResponse ldapMessage ) { super( codec, ldapMessage ); }