• 如果您觉得本站非常有看点,那么赶紧使用Ctrl+D 收藏吧

Java LdapResult类的典型用法和代码示例

java 1次浏览

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

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

示例1: testResponseWithResultCode

点赞 3

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

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

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

    ModifyResponse modifyResponse = ( ModifyResponse ) parser.getBatchResponse().getCurrentResponse();

    LdapResult ldapResult = modifyResponse.getLdapResult();

    assertEquals( ResultCodeEnum.PROTOCOL_ERROR, ldapResult.getResultCode() );
}
 

开发者ID:apache,
项目名称:directory-ldap-api,
代码行数:28,
代码来源:ModifyResponseTest.java

示例2: testResponseWithErrorMessage

点赞 3

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

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

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

    ModifyResponse modifyResponse = ( ModifyResponse ) parser.getBatchResponse().getCurrentResponse();

    LdapResult ldapResult = modifyResponse.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,
代码来源:ModifyResponseTest.java

示例3: testResponseWithEmptyErrorMessage

点赞 3

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

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

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

    ModifyResponse modifyResponse = ( ModifyResponse ) parser.getBatchResponse().getCurrentResponse();

    LdapResult ldapResult = modifyResponse.getLdapResult();

    assertNull( ldapResult.getDiagnosticMessage() );
}
 

开发者ID:apache,
项目名称:directory-ldap-api,
代码行数:28,
代码来源:ModifyResponseTest.java

示例4: testResponseWithMatchedDNAttribute

点赞 3

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

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

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

    ModifyResponse modifyResponse = ( ModifyResponse ) parser.getBatchResponse().getCurrentResponse();

    LdapResult ldapResult = modifyResponse.getLdapResult();

    assertTrue( ldapResult.getMatchedDn().equals( "cn=Bob Rush,ou=Dev,dc=Example,dc=COM" ) );
}
 

开发者ID:apache,
项目名称:directory-ldap-api,
代码行数:28,
代码来源:ModifyResponseTest.java

示例5: testResponseWithResultCode

点赞 3

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

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

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

    BindResponse bindResponse = ( BindResponse ) parser.getBatchResponse().getCurrentResponse();

    LdapResult ldapResult = bindResponse.getLdapResult();

    assertEquals( ResultCodeEnum.PROTOCOL_ERROR, ldapResult.getResultCode() );
}
 

开发者ID:apache,
项目名称:directory-ldap-api,
代码行数:28,
代码来源:AuthResponseTest.java

示例6: testResponseWithErrorMessage

点赞 3

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

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

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

    BindResponse bindResponse = ( BindResponse ) parser.getBatchResponse().getCurrentResponse();

    LdapResult ldapResult = bindResponse.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,
代码来源:AuthResponseTest.java

示例7: testResponseWithEmptyErrorMessage

点赞 3

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

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

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

    BindResponse bindResponse = ( BindResponse ) parser.getBatchResponse().getCurrentResponse();

    LdapResult ldapResult = bindResponse.getLdapResult();

    assertNull( ldapResult.getDiagnosticMessage() );
}
 

开发者ID:apache,
项目名称:directory-ldap-api,
代码行数:28,
代码来源:AuthResponseTest.java

示例8: testResponseWithMatchedDNAttribute

点赞 3

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

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

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

    BindResponse bindResponse = ( BindResponse ) parser.getBatchResponse().getCurrentResponse();

    LdapResult ldapResult = bindResponse.getLdapResult();

    assertTrue( ldapResult.getMatchedDn().equals( "cn=Bob Rush,ou=Dev,dc=Example,dc=COM" ) );
}
 

开发者ID:apache,
项目名称:directory-ldap-api,
代码行数:28,
代码来源:AuthResponseTest.java

示例9: testResponseWithResultCode

点赞 3

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

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

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

    CompareResponse compareResponse = ( CompareResponse ) parser.getBatchResponse().getCurrentResponse();

    LdapResult ldapResult = compareResponse.getLdapResult();

    assertEquals( ResultCodeEnum.PROTOCOL_ERROR, ldapResult.getResultCode() );
}
 

开发者ID:apache,
项目名称:directory-ldap-api,
代码行数:28,
代码来源:CompareResponseTest.java

示例10: testResponseWithErrorMessage

点赞 3

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

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

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

    CompareResponse compareResponse = ( CompareResponse ) parser.getBatchResponse().getCurrentResponse();

    LdapResult ldapResult = compareResponse.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,
代码来源:CompareResponseTest.java

示例11: testResponseWithEmptyErrorMessage

点赞 3

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

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

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

    CompareResponse compareResponse = ( CompareResponse ) parser.getBatchResponse().getCurrentResponse();

    LdapResult ldapResult = compareResponse.getLdapResult();

    assertNull( ldapResult.getDiagnosticMessage() );
}
 

开发者ID:apache,
项目名称:directory-ldap-api,
代码行数:28,
代码来源:CompareResponseTest.java

示例12: testResponseWithMatchedDNAttribute

点赞 3

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

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

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

    CompareResponse compareResponse = ( CompareResponse ) parser.getBatchResponse().getCurrentResponse();

    LdapResult ldapResult = compareResponse.getLdapResult();

    assertTrue( ldapResult.getMatchedDn().equals( "cn=Bob Rush,ou=Dev,dc=Example,dc=COM" ) );
}
 

开发者ID:apache,
项目名称:directory-ldap-api,
代码行数:28,
代码来源:CompareResponseTest.java

示例13: testResponseWithResultCode

点赞 3

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

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

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

    DeleteResponse delResponse = ( DeleteResponse ) parser.getBatchResponse().getCurrentResponse();

    LdapResult ldapResult = delResponse.getLdapResult();

    assertEquals( ResultCodeEnum.PROTOCOL_ERROR, ldapResult.getResultCode() );
}
 

开发者ID:apache,
项目名称:directory-ldap-api,
代码行数:28,
代码来源:DelResponseTest.java

示例14: testResponseWithErrorMessage

点赞 3

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

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

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

    DeleteResponse delResponse = ( DeleteResponse ) parser.getBatchResponse().getCurrentResponse();

    LdapResult ldapResult = delResponse.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,
代码来源:DelResponseTest.java

示例15: testResponseWithEmptyErrorMessage

点赞 3

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

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

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

    DeleteResponse delResponse = ( DeleteResponse ) parser.getBatchResponse().getCurrentResponse();

    LdapResult ldapResult = delResponse.getLdapResult();

    assertNull( ldapResult.getDiagnosticMessage() );
}
 

开发者ID:apache,
项目名称:directory-ldap-api,
代码行数:28,
代码来源:DelResponseTest.java

示例16: testResponseWithMatchedDNAttribute

点赞 3

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

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

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

    DeleteResponse delResponse = ( DeleteResponse ) parser.getBatchResponse().getCurrentResponse();

    LdapResult ldapResult = delResponse.getLdapResult();

    assertTrue( ldapResult.getMatchedDn().equals( "cn=Bob Rush,ou=Dev,dc=Example,dc=COM" ) );
}
 

开发者ID:apache,
项目名称:directory-ldap-api,
代码行数:28,
代码来源:DelResponseTest.java

示例17: testResponseWithResultCode

点赞 3

import org.apache.directory.api.ldap.model.message.LdapResult; //导入依赖的package包/类
/**
 * 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() );
}
 

开发者ID:apache,
项目名称:directory-ldap-api,
代码行数:28,
代码来源:ModifyDNResponseTest.java

示例18: testResponseWithErrorMessage

点赞 3

import org.apache.directory.api.ldap.model.message.LdapResult; //导入依赖的package包/类
/**
 * 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() );
}
 

开发者ID:apache,
项目名称:directory-ldap-api,
代码行数:29,
代码来源:ModifyDNResponseTest.java

示例19: testResponseWithEmptyErrorMessage

点赞 3

import org.apache.directory.api.ldap.model.message.LdapResult; //导入依赖的package包/类
/**
 * 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() );
}
 

开发者ID:apache,
项目名称:directory-ldap-api,
代码行数:28,
代码来源:ModifyDNResponseTest.java

示例20: testResponseWithMatchedDNAttribute

点赞 3

import org.apache.directory.api.ldap.model.message.LdapResult; //导入依赖的package包/类
/**
 * 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" ) );
}
 

开发者ID:apache,
项目名称:directory-ldap-api,
代码行数:28,
代码来源:ModifyDNResponseTest.java

示例21: testResponseWithResultCode

点赞 3

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

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

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

    ExtendedResponse extendedResponse = ( ExtendedResponse ) parser.getBatchResponse().getCurrentResponse();

    LdapResult ldapResult = extendedResponse.getLdapResult();

    assertEquals( ResultCodeEnum.PROTOCOL_ERROR, ldapResult.getResultCode() );
}
 

开发者ID:apache,
项目名称:directory-ldap-api,
代码行数:28,
代码来源:ExtendedResponseTest.java

示例22: testResponseWithErrorMessage

点赞 3

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

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

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

    ExtendedResponse extendedResponse = ( ExtendedResponse ) parser.getBatchResponse().getCurrentResponse();

    LdapResult ldapResult = extendedResponse.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,
代码来源:ExtendedResponseTest.java

示例23: testResponseWithEmptyErrorMessage

点赞 3

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

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

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

    ExtendedResponse extendedResponse = ( ExtendedResponse ) parser.getBatchResponse().getCurrentResponse();

    LdapResult ldapResult = extendedResponse.getLdapResult();

    assertNull( ldapResult.getDiagnosticMessage() );
}
 

开发者ID:apache,
项目名称:directory-ldap-api,
代码行数:28,
代码来源:ExtendedResponseTest.java

示例24: testResponseWithMatchedDNAttribute

点赞 3

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

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

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

    ExtendedResponse extendedResponse = ( ExtendedResponse ) parser.getBatchResponse().getCurrentResponse();

    LdapResult ldapResult = extendedResponse.getLdapResult();

    assertTrue( ldapResult.getMatchedDn().equals( "cn=Bob Rush,ou=Dev,dc=Example,dc=COM" ) );
}
 

开发者ID:apache,
项目名称:directory-ldap-api,
代码行数:28,
代码来源:ExtendedResponseTest.java

示例25: testResponseWithResultCode

点赞 3

import org.apache.directory.api.ldap.model.message.LdapResult; //导入依赖的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

示例26: testResponseWithErrorMessage

点赞 3

import org.apache.directory.api.ldap.model.message.LdapResult; //导入依赖的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

示例27: testResponseWithEmptyErrorMessage

点赞 3

import org.apache.directory.api.ldap.model.message.LdapResult; //导入依赖的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

示例28: testResponseWithMatchedDNAttribute

点赞 3

import org.apache.directory.api.ldap.model.message.LdapResult; //导入依赖的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

示例29: action

点赞 3

import org.apache.directory.api.ldap.model.message.LdapResult; //导入依赖的package包/类
/**
 * {@inheritDoc}
 */
public void action( LdapMessageContainer<MessageDecorator<? extends Message>> container ) throws DecoderException
{
    TLV tlv = container.getCurrentTLV();

    // If we hae a Referrals sequence, then it should not be empty
    if ( tlv.getLength() == 0 )
    {
        String msg = I18n.err( I18n.ERR_04011 );
        LOG.error( msg );

        // This will generate a PROTOCOL_ERROR
        throw new DecoderException( msg );
    }

    ResultResponse response = ( ResultResponse ) container.getMessage();
    LdapResult ldapResult = response.getLdapResult();

    Referral referral = new ReferralImpl();
    ldapResult.setReferral( referral );

    if ( IS_DEBUG )
    {
        LOG.debug( "Initialising a referrals list" );
    }
}
 

开发者ID:apache,
项目名称:directory-ldap-api,
代码行数:29,
代码来源:InitReferrals.java

示例30: sendAuthMethNotSupported

点赞 3

import org.apache.directory.api.ldap.model.message.LdapResult; //导入依赖的package包/类
/**
 * Send back an AUTH-METH-NOT-SUPPORTED error message to the client
 */
private void sendAuthMethNotSupported( LdapSession ldapSession, BindRequest bindRequest )
{
    // First, r-einit the state to Anonymous, and clear the
    // saslProperty map
    ldapSession.clearSaslProperties();
    ldapSession.setAnonymous();

    // And send the response to the client
    LdapResult bindResult = bindRequest.getResultResponse().getLdapResult();
    bindResult.setResultCode( ResultCodeEnum.AUTH_METHOD_NOT_SUPPORTED );
    bindResult.setDiagnosticMessage( ResultCodeEnum.AUTH_METHOD_NOT_SUPPORTED.toString() + ": "
        + bindRequest.getSaslMechanism() + " is not a supported mechanism." );

    // Write back the error
    ldapSession.getIoSession().write( bindRequest.getResultResponse() );
}
 

开发者ID:TremoloSecurity,
项目名称:MyVirtualDirectory,
代码行数:20,
代码来源:BindRequestHandler.java

示例31: handle

点赞 3

import org.apache.directory.api.ldap.model.message.LdapResult; //导入依赖的package包/类
/**
 * Deal with a received BindRequest
 * 
 * @param ldapSession The current session
 * @param bindRequest The received BindRequest
 * @throws Exception If the authentication cannot be handled
 */
public void handle( LdapSession ldapSession, BindRequest bindRequest ) throws Exception
{
    LOG.debug( "Received: {}", bindRequest );

    // Guard clause:  LDAP version 3
    if ( !bindRequest.getVersion3() )
    {
        LOG.error( I18n.err( I18n.ERR_162 ) );
        LdapResult bindResult = bindRequest.getResultResponse().getLdapResult();
        bindResult.setResultCode( ResultCodeEnum.PROTOCOL_ERROR );
        bindResult.setDiagnosticMessage( I18n.err( I18n.ERR_163 ) );
        ldapSession.getIoSession().write( bindRequest.getResultResponse() );
        return;
    }

    // Deal with the two kinds of authentication : Simple and SASL
    if ( bindRequest.isSimple() )
    {
        handleSimpleAuth( ldapSession, bindRequest );
    }
    else
    {
        handleSaslAuth( ldapSession, bindRequest );
    }
}
 

开发者ID:TremoloSecurity,
项目名称:MyVirtualDirectory,
代码行数:33,
代码来源:BindRequestHandler.java

示例32: handleReplication

点赞 3

import org.apache.directory.api.ldap.model.message.LdapResult; //导入依赖的package包/类
/**
 * Handle the replication request.
 */
private void handleReplication( LdapSession session, SearchRequest searchRequest ) throws LdapException
{
    if ( replicationReqHandler != null )
    {
        replicationReqHandler.handleSyncRequest( session, searchRequest );
    }
    else
    {
        // Replication is not allowed on this server. generate a error message
        LOG.warn( "This server does not allow replication" );
        LdapResult result = searchRequest.getResultResponse().getLdapResult();

        result.setDiagnosticMessage( "Replication is not allowed on this server" );
        result.setResultCode( ResultCodeEnum.OTHER );
        session.getIoSession().write( searchRequest.getResultResponse() );

        return;
    }
}
 

开发者ID:TremoloSecurity,
项目名称:MyVirtualDirectory,
代码行数:23,
代码来源:SearchRequestHandler.java

示例33: processLdapResult

点赞 3

import org.apache.directory.api.ldap.model.message.LdapResult; //导入依赖的package包/类
protected RuntimeException processLdapResult(String message, LdapResult ldapResult) {
	if (ldapResult.getResultCode() == ResultCodeEnum.UNWILLING_TO_PERFORM) {
		WillNotPerform willNotPerform = WillNotPerform.parseDiagnosticMessage(ldapResult.getDiagnosticMessage());
		if (willNotPerform == null) {
			return LdapUtil.processLdapResult(message, ldapResult);
		}
		try {
			Class<? extends RuntimeException> exceptionClass = willNotPerform.getExceptionClass();
			Constructor<? extends RuntimeException> exceptionConstructor;
			exceptionConstructor = exceptionClass.getConstructor(String.class);
			String exceptionMessage = LdapUtil.sanitizeString(ldapResult.getDiagnosticMessage()) + ": " + willNotPerform.name() + ": " + willNotPerform.getMessage();
			RuntimeException exception = exceptionConstructor.newInstance(exceptionMessage);
			LdapUtil.logOperationError(message, ldapResult, exceptionMessage);
			throw exception;
		} catch (NoSuchMethodException | SecurityException | InstantiationException | IllegalAccessException | IllegalArgumentException | InvocationTargetException e) {
			LOG.error("Error during LDAP error handling: {0}: {1}", e.getClass(), e.getMessage(), e);
			// fallback
			return LdapUtil.processLdapResult(message, ldapResult);
		}

	} else {
		return LdapUtil.processLdapResult(message, ldapResult);
	}
}
 

开发者ID:Evolveum,
项目名称:connector-ldap,
代码行数:25,
代码来源:AdLdapConnector.java

示例34: action

点赞 2

import org.apache.directory.api.ldap.model.message.LdapResult; //导入依赖的package包/类
/**
 * {@inheritDoc}
 */
@Override
public void action( Dsmlv2Container container ) throws XmlPullParserException
{
    AddResponseDsml addResponse = new AddResponseDsml(
        container.getLdapCodecService(), new AddResponseImpl() );
    container.getBatchResponse().addResponse( addResponse );

    LdapResult ldapResult = addResponse.getLdapResult();

    XmlPullParser xpp = container.getParser();

    // Checking and adding the batchRequest's attributes
    String attributeValue;
    // requestID
    attributeValue = xpp.getAttributeValue( "", "requestID" );

    if ( attributeValue != null )
    {
        addResponse.setMessageId( ParserUtils.parseAndVerifyRequestID( attributeValue, xpp ) );
    }

    // MatchedDN
    attributeValue = xpp.getAttributeValue( "", "matchedDN" );

    if ( attributeValue != null )
    {
        try
        {
            ldapResult.setMatchedDn( new Dn( attributeValue ) );
        }
        catch ( LdapInvalidDnException lide )
        {
            throw new XmlPullParserException( lide.getMessage(), xpp, lide );
        }
    }
}
 

开发者ID:apache,
项目名称:directory-ldap-api,
代码行数:40,
代码来源:Dsmlv2ResponseGrammar.java


版权声明:本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系管理员进行删除。
喜欢 (0)