• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java AddResponse类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.apache.directory.api.ldap.model.message.AddResponse的典型用法代码示例。如果您正苦于以下问题:Java AddResponse类的具体用法?Java AddResponse怎么用?Java AddResponse使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



AddResponse类属于org.apache.directory.api.ldap.model.message包,在下文中一共展示了AddResponse类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: testResponseWithRequestId

import org.apache.directory.api.ldap.model.message.AddResponse; //导入依赖的package包/类
/**
 * Test parsing of a Response with the (optional) requestID attribute
 */
@Test
public void testResponseWithRequestId()
{
    Dsmlv2ResponseParser parser = null;
    try
    {
        parser = new Dsmlv2ResponseParser( getCodec() );

        parser.setInput( AddResponseTest.class.getResource( "response_with_requestID_attribute.xml" ).openStream(),
            "UTF-8" );

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

    AddResponse addResponse = ( AddResponse ) parser.getBatchResponse().getCurrentResponse();

    assertEquals( 456, addResponse.getMessageId() );
}
 
开发者ID:apache,项目名称:directory-ldap-api,代码行数:26,代码来源:AddResponseTest.java


示例2: testResponseWithResultCode

import org.apache.directory.api.ldap.model.message.AddResponse; //导入依赖的package包/类
/**
 * Test parsing of a response with Result Code
 */
@Test
public void testResponseWithResultCode()
{
    Dsmlv2ResponseParser parser = null;
    try
    {
        parser = new Dsmlv2ResponseParser( getCodec() );

        parser
            .setInput( AddResponseTest.class.getResource( "response_with_result_code.xml" ).openStream(), "UTF-8" );

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

    AddResponse addResponse = ( AddResponse ) parser.getBatchResponse().getCurrentResponse();

    LdapResult ldapResult = addResponse.getLdapResult();

    assertEquals( ResultCodeEnum.PROTOCOL_ERROR, ldapResult.getResultCode() );
}
 
开发者ID:apache,项目名称:directory-ldap-api,代码行数:28,代码来源:AddResponseTest.java


示例3: testResponseWithErrorMessage

import org.apache.directory.api.ldap.model.message.AddResponse; //导入依赖的package包/类
/**
 * Test parsing of a response with Error Message
 */
@Test
public void testResponseWithErrorMessage()
{
    Dsmlv2ResponseParser parser = null;
    try
    {
        parser = new Dsmlv2ResponseParser( getCodec() );

        parser.setInput( AddResponseTest.class.getResource( "response_with_error_message.xml" ).openStream(),
            "UTF-8" );

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

    AddResponse addResponse = ( AddResponse ) parser.getBatchResponse().getCurrentResponse();

    LdapResult ldapResult = addResponse.getLdapResult();

    assertEquals( "Unrecognized extended operation EXTENSION_OID: 1.2.6.1.4.1.18060.1.1.1.100.2", ldapResult
        .getDiagnosticMessage() );
}
 
开发者ID:apache,项目名称:directory-ldap-api,代码行数:29,代码来源:AddResponseTest.java


示例4: testResponseWithEmptyErrorMessage

import org.apache.directory.api.ldap.model.message.AddResponse; //导入依赖的package包/类
/**
 * Test parsing of a response with empty Error Message
 */
@Test
public void testResponseWithEmptyErrorMessage()
{
    Dsmlv2ResponseParser parser = null;
    try
    {
        parser = new Dsmlv2ResponseParser( getCodec() );

        parser.setInput( AddResponseTest.class.getResource( "response_with_empty_error_message.xml" ).openStream(),
            "UTF-8" );

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

    AddResponse addResponse = ( AddResponse ) parser.getBatchResponse().getCurrentResponse();

    LdapResult ldapResult = addResponse.getLdapResult();

    assertNull( ldapResult.getDiagnosticMessage() );
}
 
开发者ID:apache,项目名称:directory-ldap-api,代码行数:28,代码来源:AddResponseTest.java


示例5: testResponseWithMatchedDNAttribute

import org.apache.directory.api.ldap.model.message.AddResponse; //导入依赖的package包/类
/**
 * Test parsing of a response with MatchedDN attribute
 */
@Test
public void testResponseWithMatchedDNAttribute()
{
    Dsmlv2ResponseParser parser = null;
    try
    {
        parser = new Dsmlv2ResponseParser( getCodec() );

        parser.setInput( AddResponseTest.class.getResource( "response_with_matchedDN_attribute.xml" ).openStream(),
            "UTF-8" );

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

    AddResponse addResponse = ( AddResponse ) parser.getBatchResponse().getCurrentResponse();

    LdapResult ldapResult = addResponse.getLdapResult();

    assertTrue( ldapResult.getMatchedDn().equals( "cn=Bob Rush,ou=Dev,dc=Example,dc=COM" ) );
}
 
开发者ID:apache,项目名称:directory-ldap-api,代码行数:28,代码来源:AddResponseTest.java


示例6: add

import org.apache.directory.api.ldap.model.message.AddResponse; //导入依赖的package包/类
/**
 * {@inheritDoc}
 */
@Override
public void add( Entry entry ) throws LdapException
{
    if ( entry == null )
    {
        String msg = "Cannot add an empty entry";
        LOG.debug( msg );
        throw new IllegalArgumentException( msg );
    }

    AddRequest addRequest = new AddRequestImpl();
    addRequest.setEntry( entry );

    AddResponse addResponse = add( addRequest );

    processResponse( addResponse );
}
 
开发者ID:apache,项目名称:directory-ldap-api,代码行数:21,代码来源:LdapNetworkConnection.java


示例7: add

import org.apache.directory.api.ldap.model.message.AddResponse; //导入依赖的package包/类
/**
 * {@inheritDoc}
 */
@Override
public AddResponse add( AddRequest addRequest )
{
    LdapConnection connection = null;
    try
    {
        connection = connectionPool.getConnection();
        return connection.add( addRequest );
    }
    catch ( LdapException e )
    {
        throw new LdapRuntimeException( e );
    }
    finally
    {
        returnLdapConnection( connection );
    }
}
 
开发者ID:apache,项目名称:directory-ldap-api,代码行数:22,代码来源:LdapConnectionTemplate.java


示例8: addEntry

import org.apache.directory.api.ldap.model.message.AddResponse; //导入依赖的package包/类
/**
 * 添加条目
 * 
 * Apache LDAP 主要提供三种添加条目的方法。当前用:同步的、服务器有返回响应的。
 * 
 * @author      ZhengWei(HY)
 * @createDate  2017-02-14
 * @version     v1.0
 * 
 * @param i_Entry
 * @return            添加成功返回true。
 */
public boolean addEntry(Entry i_Entry)
{
    LdapConnection v_Conn       = null;
    AddRequest     v_AddRequest = new AddRequestImpl();
    AddResponse    v_Response   = null;
    
    try
    {
        v_AddRequest.setEntry(  i_Entry);
        v_AddRequest.addControl(new ManageDsaITImpl());
        
        v_Conn = this.getConnection();
        v_Response = v_Conn.add(v_AddRequest);
    }
    catch (Exception exce)
    {
        exce.printStackTrace();
    }
    finally
    {
        this.closeConnection(v_Conn);
    }
    
    return LDAP.isSuccess(v_Response);
}
 
开发者ID:HY-ZhengWei,项目名称:hy.common.ldap,代码行数:38,代码来源:LDAP.java


示例9: testResponseWith1AddResponse

import org.apache.directory.api.ldap.model.message.AddResponse; //导入依赖的package包/类
/**
 * Test parsing of a Response with the 1 AddResponse
 */
@Test
public void testResponseWith1AddResponse()
{
    Dsmlv2ResponseParser parser = null;
    try
    {
        parser = new Dsmlv2ResponseParser( getCodec() );

        parser.setInput( BatchResponseTest.class.getResource( "response_with_1_AddResponse.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 AddResponse )
    {
        assertTrue( true );
    }
    else
    {
        fail();
    }
}
 
开发者ID:apache,项目名称:directory-ldap-api,代码行数:37,代码来源:BatchResponseTest.java


示例10: testResponseWith2AddResponse

import org.apache.directory.api.ldap.model.message.AddResponse; //导入依赖的package包/类
/**
 * Test parsing of a Response with the 2 AddResponse
 */
@Test
public void testResponseWith2AddResponse()
{
    Dsmlv2ResponseParser parser = null;
    try
    {
        parser = new Dsmlv2ResponseParser( getCodec() );

        parser.setInput( BatchResponseTest.class.getResource( "response_with_2_AddResponse.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 AddResponse )
    {
        assertTrue( true );
    }
    else
    {
        fail();
    }
}
 
开发者ID:apache,项目名称:directory-ldap-api,代码行数:37,代码来源:BatchResponseTest.java


示例11: testResponseWith1Control

import org.apache.directory.api.ldap.model.message.AddResponse; //导入依赖的package包/类
/**
 * Test parsing of a response with a (optional) Control element
 */
@Test
public void testResponseWith1Control()
{
    Dsmlv2ResponseParser parser = null;
    try
    {
        parser = new Dsmlv2ResponseParser( getCodec() );

        parser.setInput( AddResponseTest.class.getResource( "response_with_1_control.xml" ).openStream(), "UTF-8" );

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

    AddResponse addResponse = ( AddResponse ) parser.getBatchResponse().getCurrentResponse();
    Map<String, Control> controls = addResponse.getControls();

    assertEquals( 1, addResponse.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() ) );
}
 
开发者ID:apache,项目名称:directory-ldap-api,代码行数:33,代码来源:AddResponseTest.java


示例12: testResponseWith1ControlEmptyValue

import org.apache.directory.api.ldap.model.message.AddResponse; //导入依赖的package包/类
/**
 * Test parsing of a response with a (optional) Control element with emptyValue
 */
@Test
public void testResponseWith1ControlEmptyValue()
{
    Dsmlv2ResponseParser parser = null;
    try
    {
        parser = new Dsmlv2ResponseParser( getCodec() );

        parser.setInput( AddResponseTest.class.getResource( "response_with_1_control_empty_value.xml" )
            .openStream(), "UTF-8" );

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

    AddResponse addResponse = ( AddResponse ) parser.getBatchResponse().getCurrentResponse();
    Map<String, Control> controls = addResponse.getControls();

    assertEquals( 1, addResponse.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() );
}
 
开发者ID:apache,项目名称:directory-ldap-api,代码行数:34,代码来源:AddResponseTest.java


示例13: testResponseWith2Controls

import org.apache.directory.api.ldap.model.message.AddResponse; //导入依赖的package包/类
/**
 * Test parsing of a response with 2 (optional) Control elements
 */
@Test
public void testResponseWith2Controls()
{
    Dsmlv2ResponseParser parser = null;
    try
    {
        parser = new Dsmlv2ResponseParser( getCodec() );

        parser.setInput( AddResponseTest.class.getResource( "response_with_2_controls.xml" ).openStream(), "UTF-8" );

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

    AddResponse addResponse = ( AddResponse ) parser.getBatchResponse().getCurrentResponse();
    Map<String, Control> controls = addResponse.getControls();

    assertEquals( 2, addResponse.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() ) );
}
 
开发者ID:apache,项目名称:directory-ldap-api,代码行数:33,代码来源:AddResponseTest.java


示例14: testResponseWith3ControlsWithoutValue

import org.apache.directory.api.ldap.model.message.AddResponse; //导入依赖的package包/类
/**
 * 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( AddResponseTest.class.getResource( "response_with_3_controls_without_value.xml" )
            .openStream(), "UTF-8" );

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

    AddResponse addResponse = ( AddResponse ) parser.getBatchResponse().getCurrentResponse();
    Map<String, Control> controls = addResponse.getControls();

    assertEquals( 3, addResponse.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() );
}
 
开发者ID:apache,项目名称:directory-ldap-api,代码行数:34,代码来源:AddResponseTest.java


示例15: testResponseWith1Referral

import org.apache.directory.api.ldap.model.message.AddResponse; //导入依赖的package包/类
/**
 * Test parsing of a response with a Referral
 */
@Test
public void testResponseWith1Referral()
{
    Dsmlv2ResponseParser parser = null;

    try
    {
        parser = new Dsmlv2ResponseParser( getCodec() );

        parser.setInput( AddResponseTest.class.getResource( "response_with_1_referral.xml" ).openStream(), "UTF-8" );

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

    AddResponse addResponse = ( AddResponse ) parser.getBatchResponse().getCurrentResponse();

    LdapResult ldapResult = addResponse.getLdapResult();

    Collection<String> referrals = ldapResult.getReferral().getLdapUrls();

    assertEquals( 1, referrals.size() );

    assertTrue( referrals.contains( "ldap://www.apache.org/" ) );
}
 
开发者ID:apache,项目名称:directory-ldap-api,代码行数:32,代码来源:AddResponseTest.java


示例16: testResponseWith1EmptyReferral

import org.apache.directory.api.ldap.model.message.AddResponse; //导入依赖的package包/类
/**
 * Test parsing of a response with an empty Referral
 */
@Test
public void testResponseWith1EmptyReferral()
{
    Dsmlv2ResponseParser parser = null;
    try
    {
        parser = new Dsmlv2ResponseParser( getCodec() );

        parser.setInput( AddResponseTest.class.getResource( "response_with_1_empty_referral.xml" ).openStream(),
            "UTF-8" );

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

    AddResponse addResponse = ( AddResponse ) parser.getBatchResponse().getCurrentResponse();

    LdapResult ldapResult = addResponse.getLdapResult();

    Collection<String> referrals = ldapResult.getReferral().getLdapUrls();

    assertEquals( 0, referrals.size() );
}
 
开发者ID:apache,项目名称:directory-ldap-api,代码行数:30,代码来源:AddResponseTest.java


示例17: testResponseWith2Referrals

import org.apache.directory.api.ldap.model.message.AddResponse; //导入依赖的package包/类
/**
 * Test parsing of a response with 2 Referral elements
 */
@Test
public void testResponseWith2Referrals()
{
    Dsmlv2ResponseParser parser = null;
    try
    {
        parser = new Dsmlv2ResponseParser( getCodec() );

        parser
            .setInput( AddResponseTest.class.getResource( "response_with_2_referrals.xml" ).openStream(), "UTF-8" );

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

    AddResponse addResponse = ( AddResponse ) parser.getBatchResponse().getCurrentResponse();

    LdapResult ldapResult = addResponse.getLdapResult();

    Collection<String> referrals = ldapResult.getReferral().getLdapUrls();

    assertEquals( 2, referrals.size() );

    assertTrue( referrals.contains( "ldap://www.apache.org/" ) );
    assertTrue( referrals.contains( "ldap://www.apple.com/" ) );
}
 
开发者ID:apache,项目名称:directory-ldap-api,代码行数:33,代码来源:AddResponseTest.java


示例18: setAddHandlers

import org.apache.directory.api.ldap.model.message.AddResponse; //导入依赖的package包/类
/**
 * Inject the MessageReceived and MessageSent handler into the IoHandler
 * 
 * @param addRequestHandler The AddRequest message received handler
 * @param addResponseHandler The AddResponse message sent handler
 */
public void setAddHandlers( LdapRequestHandler<AddRequest> addRequestHandler,
    LdapResponseHandler<AddResponse> addResponseHandler )
{
    this.handler.removeReceivedMessageHandler( AddRequest.class );
    this.addRequestHandler = addRequestHandler;
    this.addRequestHandler.setLdapServer( this );
    this.handler.addReceivedMessageHandler( AddRequest.class, this.addRequestHandler );

    this.handler.removeSentMessageHandler( AddResponse.class );
    this.addResponseHandler = addResponseHandler;
    this.addResponseHandler.setLdapServer( this );
    this.handler.addSentMessageHandler( AddResponse.class, this.addResponseHandler );
}
 
开发者ID:TremoloSecurity,项目名称:MyVirtualDirectory,代码行数:20,代码来源:LdapServer.java


示例19: createEntry

import org.apache.directory.api.ldap.model.message.AddResponse; //导入依赖的package包/类
public void createEntry( final String entryDN, final Set<String> baseObjectClasses, final Map<String, String> stringAttributes )
        throws ChaiOperationException, ChaiUnavailableException, IllegalStateException
{
    activityPreCheck();
    getInputValidator().createEntry( entryDN, baseObjectClasses, stringAttributes );

    try
    {
        final AddRequest addRequest = new AddRequestImpl();
        final Entry entry = new DefaultEntry();
        entry.setDn( entryDN );
        for ( final String baseObjectClass : baseObjectClasses )
        {
            entry.add( ChaiConstant.ATTR_LDAP_OBJECTCLASS, baseObjectClass );
        }

        for ( final Map.Entry<String, String> entryIter : stringAttributes.entrySet() )
        {
            final String name = entryIter.getKey();
            final String value = entryIter.getValue();
            entry.add( name, value );
        }

        final AddResponse response = connection.add( addRequest );
        processResponse( response );
    }
    catch ( LdapException e )
    {
        throw ChaiOperationException.forErrorMessage( e.getMessage() );
    }
}
 
开发者ID:ldapchai,项目名称:ldapchai,代码行数:32,代码来源:ApacheLdapProviderImpl.java


示例20: processCreateResult

import org.apache.directory.api.ldap.model.message.AddResponse; //导入依赖的package包/类
@Override
protected RuntimeException processCreateResult(String dn, AddResponse addResponse) {
	if (addResponse.getLdapResult().getResultCode() == ResultCodeEnum.CONSTRAINT_VIOLATION &&
			addResponse.getLdapResult().getDiagnosticMessage().contains("password")) {
		return new InvalidAttributeValueException("Error adding LDAP entry " + dn + ": " + addResponse.getLdapResult().getDiagnosticMessage());
	}
	return super.processCreateResult(dn, addResponse);
}
 
开发者ID:Evolveum,项目名称:connector-ldap,代码行数:9,代码来源:EDirectoryLdapConnector.java



注:本文中的org.apache.directory.api.ldap.model.message.AddResponse类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java ISO9075类代码示例发布时间:2022-05-22
下一篇:
Java GuildCreateEvent类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap