当前位置: 首页>>代码示例>>Java>>正文


Java BindResponse.getControls方法代码示例

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


在下文中一共展示了BindResponse.getControls方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: testResponseWith1Control

import org.apache.directory.api.ldap.model.message.BindResponse; //导入方法依赖的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( AuthResponseTest.class.getResource( "response_with_1_control.xml" ).openStream(), "UTF-8" );

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

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

    assertEquals( 1, bindResponse.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,代码来源:AuthResponseTest.java

示例2: testResponseWith1ControlEmptyValue

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

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

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

    assertEquals( 1, bindResponse.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,代码来源:AuthResponseTest.java

示例3: testResponseWith2Controls

import org.apache.directory.api.ldap.model.message.BindResponse; //导入方法依赖的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( AuthResponseTest.class.getResource( "response_with_2_controls.xml" ).openStream(), "UTF-8" );

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

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

    assertEquals( 2, bindResponse.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,代码行数:34,代码来源:AuthResponseTest.java

示例4: testResponseWith3ControlsWithoutValue

import org.apache.directory.api.ldap.model.message.BindResponse; //导入方法依赖的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( AuthResponseTest.class.getResource( "response_with_3_controls_without_value.xml" )
            .openStream(), "UTF-8" );

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

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

    assertEquals( 3, bindResponse.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,代码来源:AuthResponseTest.java


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