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


Java Entry.iterator方法代码示例

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


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

示例1: modify

import org.apache.directory.api.ldap.model.entry.Entry; //导入方法依赖的package包/类
/**
 * {@inheritDoc}
 */
@Override
public void modify( Entry entry, ModificationOperation modOp ) throws LdapException
{
    if ( entry == null )
    {
        LOG.debug( "received a null entry for modification" );
        throw new IllegalArgumentException( "Entry to be modified cannot be null" );
    }

    ModifyRequest modReq = new ModifyRequestImpl();
    modReq.setName( entry.getDn() );

    Iterator<Attribute> itr = entry.iterator();

    while ( itr.hasNext() )
    {
        modReq.addModification( itr.next(), modOp );
    }

    ModifyResponse modifyResponse = modify( modReq );

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

示例2: testIterator

import org.apache.directory.api.ldap.model.entry.Entry; //导入方法依赖的package包/类
/**
 * Test method for Iterator()
 */
@Test
public void testIterator() throws LdapException
{
    Entry entry = createEntry();

    Iterator<Attribute> iterator = entry.iterator();

    assertTrue( iterator.hasNext() );

    Set<String> expectedIds = new HashSet<String>();
    expectedIds.add( "objectclass" );
    expectedIds.add( "cn" );
    expectedIds.add( "sn" );
    expectedIds.add( "userpassword" );

    while ( iterator.hasNext() )
    {
        Attribute attribute = iterator.next();

        String id = attribute.getId();
        assertTrue( expectedIds.contains( id ) );
        expectedIds.remove( id );
    }

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

示例3: testRequestWith1AttrWithoutValue

import org.apache.directory.api.ldap.model.entry.Entry; //导入方法依赖的package包/类
/**
 * Test parsing of a request with an Attr elements with value
 */
@Test
public void testRequestWith1AttrWithoutValue()
{
    Dsmlv2Parser parser = null;
    try
    {
        parser = newParser();

        parser.setInput( AddRequestTest.class.getResource( "request_with_1_attr_without_value.xml" ).openStream(),
            "UTF-8" );

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

    AddRequest addRequest = ( AddRequest ) parser.getBatchRequest().getCurrentRequest();

    Entry entry = addRequest.getEntry();
    assertEquals( 1, entry.size() );

    // Getting the Attribute
    Iterator<Attribute> attributeIterator = entry.iterator();
    Attribute attribute = attributeIterator.next();
    assertEquals( "objectclass", attribute.getUpId() );

    // Getting the Value
    Iterator<Value> valueIterator = attribute.iterator();
    assertFalse( valueIterator.hasNext() );
}
 
开发者ID:apache,项目名称:directory-ldap-api,代码行数:36,代码来源:AddRequestTest.java

示例4: testRequestWith1AttrEmptyValue

import org.apache.directory.api.ldap.model.entry.Entry; //导入方法依赖的package包/类
/**
 * Test parsing of a request with an Attr elements with empty value
 */
@Test
public void testRequestWith1AttrEmptyValue()
{
    Dsmlv2Parser parser = null;
    try
    {
        parser = newParser();

        parser.setInput( AddRequestTest.class.getResource( "request_with_1_attr_empty_value.xml" ).openStream(),
            "UTF-8" );

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

    AddRequest addRequest = ( AddRequest ) parser.getBatchRequest().getCurrentRequest();

    Entry entry = addRequest.getEntry();
    assertEquals( 1, entry.size() );

    // Getting the Attribute
    Iterator<Attribute> attributeIterator = entry.iterator();
    Attribute attribute = attributeIterator.next();
    assertEquals( "objectclass", attribute.getUpId() );

    // Getting the Value
    Iterator<Value> valueIterator = attribute.iterator();
    assertFalse( valueIterator.hasNext() );
}
 
开发者ID:apache,项目名称:directory-ldap-api,代码行数:36,代码来源:AddRequestTest.java

示例5: testRequestWith1AttrWithValue

import org.apache.directory.api.ldap.model.entry.Entry; //导入方法依赖的package包/类
/**
 * Test parsing of a request with an Attr elements with value
 */
@Test
public void testRequestWith1AttrWithValue()
{
    Dsmlv2Parser parser = null;
    try
    {
        parser = newParser();

        parser.setInput( AddRequestTest.class.getResource( "request_with_1_attr_with_value.xml" ).openStream(),
            "UTF-8" );

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

    AddRequest addRequest = ( AddRequest ) parser.getBatchRequest().getCurrentRequest();

    Entry entry = addRequest.getEntry();
    assertEquals( 1, entry.size() );

    // Getting the Attribute
    Iterator<Attribute> attributeIterator = entry.iterator();
    Attribute attribute = attributeIterator.next();
    assertEquals( "objectclass", attribute.getUpId() );

    // Getting the Value
    Iterator<Value> valueIterator = attribute.iterator();
    assertTrue( valueIterator.hasNext() );
    Value value = valueIterator.next();
    assertEquals( "top", value.getValue() );
}
 
开发者ID:apache,项目名称:directory-ldap-api,代码行数:38,代码来源:AddRequestTest.java

示例6: testRequestWith1AttrWithBase64Value

import org.apache.directory.api.ldap.model.entry.Entry; //导入方法依赖的package包/类
/**
 * Test parsing of a request with an Attr elements with value
 */
@Test
public void testRequestWith1AttrWithBase64Value()
{
    Dsmlv2Parser parser = null;
    try
    {
        parser = newParser();

        parser.setInput( AddRequestTest.class.getResource( "request_with_1_attr_with_base64_value.xml" )
            .openStream(), "UTF-8" );

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

    AddRequest addRequest = ( AddRequest ) parser.getBatchRequest().getCurrentRequest();

    Entry entry = addRequest.getEntry();
    assertEquals( 1, entry.size() );

    // Getting the Attribute
    Iterator<Attribute> attributeIterator = entry.iterator();
    Attribute attribute = attributeIterator.next();
    assertEquals( "objectclass", attribute.getUpId() );

    // Getting the Value
    Iterator<Value> valueIterator = attribute.iterator();
    assertTrue( valueIterator.hasNext() );
    Value value = valueIterator.next();
    assertFalse( value.isHumanReadable() );
    assertEquals( "DSMLv2.0 rocks!!", value.getValue() );
}
 
开发者ID:apache,项目名称:directory-ldap-api,代码行数:39,代码来源:AddRequestTest.java

示例7: testRequestWith2AttrWithValue

import org.apache.directory.api.ldap.model.entry.Entry; //导入方法依赖的package包/类
/**
 * Test parsing of a request with 2 Attr elements with value
 */
@Test
public void testRequestWith2AttrWithValue()
{
    Dsmlv2Parser parser = null;
    try
    {
        parser = newParser();

        parser.setInput( AddRequestTest.class.getResource( "request_with_2_attr_with_value.xml" ).openStream(),
            "UTF-8" );

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

    AddRequest addRequest = ( AddRequest ) parser.getBatchRequest().getCurrentRequest();

    Entry entry = addRequest.getEntry();
    assertEquals( 1, entry.size() );

    // Getting the Attribute
    Iterator<Attribute> attributeIterator = entry.iterator();
    Attribute attribute = attributeIterator.next();
    assertEquals( "objectclass", attribute.getUpId() );

    // Getting the Value
    Iterator<Value> valueIterator = attribute.iterator();
    assertTrue( valueIterator.hasNext() );
    Value value = valueIterator.next();
    assertEquals( "top", value.getValue() );
    assertTrue( valueIterator.hasNext() );
    value = valueIterator.next();
    assertEquals( "person", value.getValue() );
    assertFalse( valueIterator.hasNext() );
}
 
开发者ID:apache,项目名称:directory-ldap-api,代码行数:42,代码来源:AddRequestTest.java

示例8: testRequestWith1AttrWith2Values

import org.apache.directory.api.ldap.model.entry.Entry; //导入方法依赖的package包/类
/**
 * Test parsing of a request with 1 Attr element with 2 Values
 */
@Test
public void testRequestWith1AttrWith2Values()
{
    Dsmlv2Parser parser = null;
    try
    {
        parser = newParser();

        parser.setInput( AddRequestTest.class.getResource( "request_with_1_attr_with_2_values.xml" ).openStream(),
            "UTF-8" );

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

    AddRequest addRequest = ( AddRequest ) parser.getBatchRequest().getCurrentRequest();

    Entry entry = addRequest.getEntry();
    assertEquals( 1, entry.size() );

    // Getting the Attribute
    Iterator<Attribute> attributeIterator = entry.iterator();
    Attribute attribute = attributeIterator.next();
    assertEquals( "objectclass", attribute.getUpId() );

    // Getting the Value
    Iterator<Value> valueIterator = attribute.iterator();
    assertTrue( valueIterator.hasNext() );
    Value value = valueIterator.next();
    assertEquals( "top", value.getValue() );
    assertTrue( valueIterator.hasNext() );
    value = valueIterator.next();
    assertEquals( "person", value.getValue() );
    assertFalse( valueIterator.hasNext() );
}
 
开发者ID:apache,项目名称:directory-ldap-api,代码行数:42,代码来源:AddRequestTest.java

示例9: testResponseWith1Attr0Value

import org.apache.directory.api.ldap.model.entry.Entry; //导入方法依赖的package包/类
/**
 * Test parsing of a response with 1 Attr 0 Value
 */
@Test
public void testResponseWith1Attr0Value()
{
    Dsmlv2ResponseParser parser = null;
    try
    {
        parser = new Dsmlv2ResponseParser( getCodec() );

        parser.setInput(
            SearchResultEntryTest.class.getResource( "response_with_1_attr_0_value.xml" ).openStream(), "UTF-8" );

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

    SearchResultEntry searchResultEntry = ( ( SearchResponse ) parser.getBatchResponse().getCurrentResponse()
        .getDecorated() )
        .getCurrentSearchResultEntry();

    Entry entry = searchResultEntry.getEntry();
    assertEquals( 1, entry.size() );

    Iterator<Attribute> attributeIterator = entry.iterator();
    Attribute attribute = attributeIterator.next();
    assertEquals( "dc", attribute.getUpId() );
}
 
开发者ID:apache,项目名称:directory-ldap-api,代码行数:33,代码来源:SearchResultEntryTest.java

示例10: testResponseWith1Attr1Value

import org.apache.directory.api.ldap.model.entry.Entry; //导入方法依赖的package包/类
/**
 * Test parsing of a response with 1 Attr 1 Value
 */
@Test
public void testResponseWith1Attr1Value()
{
    Dsmlv2ResponseParser parser = null;
    try
    {
        parser = new Dsmlv2ResponseParser( getCodec() );

        parser.setInput(
            SearchResultEntryTest.class.getResource( "response_with_1_attr_1_value.xml" ).openStream(), "UTF-8" );

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

    SearchResultEntry searchResultEntry = ( ( SearchResponse ) parser.getBatchResponse().getCurrentResponse()
        .getDecorated() )
        .getCurrentSearchResultEntry();

    Entry entry = searchResultEntry.getEntry();
    assertEquals( 1, entry.size() );

    Iterator<Attribute> attributeIterator = entry.iterator();
    Attribute attribute = attributeIterator.next();
    assertEquals( "dc", attribute.getUpId() );

    Iterator<Value> valueIterator = attribute.iterator();
    assertTrue( valueIterator.hasNext() );
    Value value = valueIterator.next();
    assertEquals( "example", value.getValue() );
}
 
开发者ID:apache,项目名称:directory-ldap-api,代码行数:38,代码来源:SearchResultEntryTest.java

示例11: testResponseWith1Attr1Base64Value

import org.apache.directory.api.ldap.model.entry.Entry; //导入方法依赖的package包/类
/**
 * Test parsing of a response with 1 Attr 1 Base64 Value
 */
@Test
public void testResponseWith1Attr1Base64Value()
{
    Dsmlv2ResponseParser parser = null;
    try
    {
        parser = new Dsmlv2ResponseParser( getCodec() );

        parser.setInput( SearchResultEntryTest.class.getResource( "response_with_1_attr_1_base64_value.xml" )
            .openStream(), "UTF-8" );

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

    SearchResultEntry searchResultEntry = ( ( SearchResponse ) parser.getBatchResponse().getCurrentResponse()
        .getDecorated() )
        .getCurrentSearchResultEntry();

    Entry entry = searchResultEntry.getEntry();
    assertEquals( 1, entry.size() );

    Iterator<Attribute> attributeIterator = entry.iterator();
    Attribute attribute = attributeIterator.next();
    assertEquals( "cn", attribute.getUpId() );
    assertEquals( 1, attribute.size() );

    Iterator<Value> valueIterator = attribute.iterator();
    assertTrue( valueIterator.hasNext() );
    Value value = valueIterator.next();

    String expected = new String( new byte[]
        { 'E', 'm', 'm', 'a', 'n', 'u', 'e', 'l', ' ', 'L', ( byte ) 0xc3, ( byte ) 0xa9, 'c', 'h', 'a', 'r', 'n',
            'y' }, StandardCharsets.UTF_8 );
    assertEquals( expected, value.getValue() );
}
 
开发者ID:apache,项目名称:directory-ldap-api,代码行数:43,代码来源:SearchResultEntryTest.java

示例12: testResponseWith1Attr1EmptyValue

import org.apache.directory.api.ldap.model.entry.Entry; //导入方法依赖的package包/类
/**
 * Test parsing of a response with 1 Attr 1 empty Value
 */
@Test
public void testResponseWith1Attr1EmptyValue()
{
    Dsmlv2ResponseParser parser = null;
    try
    {
        parser = new Dsmlv2ResponseParser( getCodec() );

        parser.setInput( SearchResultEntryTest.class.getResource( "response_with_1_attr_1_empty_value.xml" )
            .openStream(), "UTF-8" );

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

    SearchResultEntry searchResultEntry = ( ( SearchResponse ) parser.getBatchResponse().getCurrentResponse()
        .getDecorated() )
        .getCurrentSearchResultEntry();

    Entry entry = searchResultEntry.getEntry();
    assertEquals( 1, entry.size() );

    Iterator<Attribute> attributeIterator = entry.iterator();
    Attribute attribute = attributeIterator.next();
    assertEquals( "dc", attribute.getUpId() );
    assertEquals( 1, attribute.size() );

    Iterator<Value> valueIterator = attribute.iterator();
    assertTrue( valueIterator.hasNext() );
    Value value = valueIterator.next();
    assertEquals( "", value.getValue() );
}
 
开发者ID:apache,项目名称:directory-ldap-api,代码行数:39,代码来源:SearchResultEntryTest.java

示例13: testResponseWith1Attr2Value

import org.apache.directory.api.ldap.model.entry.Entry; //导入方法依赖的package包/类
/**
 * Test parsing of a response with 1 Attr 2 Value
 */
@Test
public void testResponseWith1Attr2Value()
{
    Dsmlv2ResponseParser parser = null;
    try
    {
        parser = new Dsmlv2ResponseParser( getCodec() );

        parser.setInput(
            SearchResultEntryTest.class.getResource( "response_with_1_attr_2_value.xml" ).openStream(), "UTF-8" );

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

    SearchResultEntry searchResultEntry = ( ( SearchResponse ) parser.getBatchResponse().getCurrentResponse()
        .getDecorated() )
        .getCurrentSearchResultEntry();

    Entry entry = searchResultEntry.getEntry();
    assertEquals( 1, entry.size() );

    Iterator<Attribute> attributeIterator = entry.iterator();
    Attribute attribute = attributeIterator.next();
    assertEquals( "objectclass", attribute.getUpId() );
    assertEquals( 2, attribute.size() );

    Iterator<Value> valueIterator = attribute.iterator();
    assertTrue( valueIterator.hasNext() );
    Value value = valueIterator.next();
    assertEquals( "top", value.getValue() );
    assertTrue( valueIterator.hasNext() );
    value = valueIterator.next();
    assertEquals( "domain", value.getValue() );
    assertFalse( valueIterator.hasNext() );
}
 
开发者ID:apache,项目名称:directory-ldap-api,代码行数:43,代码来源:SearchResultEntryTest.java


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