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


Java LdifEntry.getModificationArray方法代码示例

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


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

示例1: test62ReverseRenameSimpleCompositeNotOverlappingKeepOldRdnDontExistInEntry

import org.apache.directory.api.ldap.model.ldif.LdifEntry; //导入方法依赖的package包/类
/**
 * Test a reversed rename ModifyDN, where the initial Rdn is simple,
 * the new Rdn is composite, they don't overlap, with deleteOldRdn = false, and
 * the new values exists in the entry.
 * 
 * Covers case 6.2 of http://cwiki.apache.org/confluence/display/DIRxSRVx11/Reverse+LDIF
 * 
 * Initial entry
 * dn: cn=test,ou=system
 * objectclass: top
 * objectclass: person
 * cn: test
 * sn: small
 * sn: This is a test
 * 
 * new Rdn : cn=joe+sn=small
 *
 * @throws LdapException on error
 */
@Test
public void test62ReverseRenameSimpleCompositeNotOverlappingKeepOldRdnDontExistInEntry() throws LdapException
{
    Dn dn = new Dn( "cn=test,ou=system" );
    Rdn oldRdn = new Rdn( "cn=test" );
    Rdn newRdn = new Rdn( "cn=joe+sn=small" );

    Entry entry = new DefaultEntry( dn,
        "objectClass: top",
        "objectClass: person",
        "cn: test",
        "sn: small",
        "sn: this is a test" );

    List<LdifEntry> reverseds = LdifRevertor.reverseRename( entry, newRdn, LdifRevertor.KEEP_OLD_RDN );

    assertNotNull( reverseds );
    assertEquals( 2, reverseds.size() );
    LdifEntry reversed = reverseds.get( 0 );

    assertEquals( "cn=joe+sn=small,ou=system", reversed.getDn().getName() );
    assertEquals( ChangeType.ModRdn, reversed.getChangeType() );
    assertFalse( reversed.isDeleteOldRdn() );
    assertEquals( oldRdn.getName(), reversed.getNewRdn() );
    assertNull( reversed.getNewSuperior() );

    reversed = reverseds.get( 1 );

    assertEquals( "cn=test,ou=system", reversed.getDn().getName() );
    assertEquals( ChangeType.Modify, reversed.getChangeType() );
    Modification[] mods = reversed.getModificationArray();

    assertNotNull( mods );
    assertEquals( 1, mods.length );
    assertEquals( ModificationOperation.REMOVE_ATTRIBUTE, mods[0].getOperation() );
    assertNotNull( mods[0].getAttribute() );
    assertEquals( "cn", mods[0].getAttribute().getId() );
    assertEquals( "joe", mods[0].getAttribute().getString() );
}
 
开发者ID:apache,项目名称:directory-ldap-api,代码行数:59,代码来源:LdifRevertorTest.java

示例2: test72ReverseRenameSimpleCompositeNotOverlappingDeleteOldRdnExistInEntry

import org.apache.directory.api.ldap.model.ldif.LdifEntry; //导入方法依赖的package包/类
/**
 * Test a reversed rename ModifyDN, where the initial Rdn is simple,
 * the new Rdn is composite, they don't overlap, with deleteOldRdn = true, and
 * some of new values exists in the entry.
 * 
 * Covers case 7.2 of http://cwiki.apache.org/confluence/display/DIRxSRVx11/Reverse+LDIF
 * 
 * Initial entry
 * dn: cn=test,ou=system
 * objectclass: top
 * objectclass: person
 * cn: test
 * sn: small
 * sn: This is a test
 * 
 * new Rdn : cn=joe+sn=small
 *
 * @throws LdapException on error
 */
@Test
public void test72ReverseRenameSimpleCompositeNotOverlappingDeleteOldRdnExistInEntry() throws LdapException
{
    Dn dn = new Dn( "cn=test,ou=system" );
    Rdn oldRdn = new Rdn( "cn=test" );
    Rdn newRdn = new Rdn( "cn=joe+sn=small" );

    Entry entry = new DefaultEntry( dn,
        "objectClass: top",
        "objectClass: person",
        "cn: test",
        "sn: small",
        "sn: this is a test" );

    List<LdifEntry> reverseds = LdifRevertor.reverseRename( entry, newRdn, LdifRevertor.DELETE_OLD_RDN );

    assertNotNull( reverseds );
    assertEquals( 2, reverseds.size() );
    LdifEntry reversed = reverseds.get( 0 );

    assertEquals( "cn=joe+sn=small,ou=system", reversed.getDn().getName() );
    assertEquals( ChangeType.ModRdn, reversed.getChangeType() );
    assertFalse( reversed.isDeleteOldRdn() );
    assertEquals( oldRdn.getName(), reversed.getNewRdn() );
    assertNull( reversed.getNewSuperior() );

    reversed = reverseds.get( 1 );

    assertEquals( "cn=test,ou=system", reversed.getDn().getName() );
    assertEquals( ChangeType.Modify, reversed.getChangeType() );
    Modification[] mods = reversed.getModificationArray();

    assertNotNull( mods );
    assertEquals( 1, mods.length );
    assertEquals( ModificationOperation.REMOVE_ATTRIBUTE, mods[0].getOperation() );
    assertNotNull( mods[0].getAttribute() );
    assertEquals( "cn", mods[0].getAttribute().getId() );
    assertEquals( "joe", mods[0].getAttribute().getString() );
}
 
开发者ID:apache,项目名称:directory-ldap-api,代码行数:59,代码来源:LdifRevertorTest.java

示例3: test82ReverseRenameSimpleCompositeOverlappingKeepOldRdnExistInEntry

import org.apache.directory.api.ldap.model.ldif.LdifEntry; //导入方法依赖的package包/类
/**
 * Test a reversed rename ModifyDN, where the initial Rdn is simple,
 * the new Rdn is composite, they overlap, with deleteOldRdn = false, and
 * some of the new values exist in the entry.
 * 
 * Covers case 8.2 of http://cwiki.apache.org/confluence/display/DIRxSRVx11/Reverse+LDIF
 * 
 * Initial entry
 * dn: cn=test,ou=system
 * objectclass: top
 * objectclass: person
 * cn: test
 * sn: This is a test
 * seeAlso: big
 * 
 * new Rdn : sn=small+cn=test+seeAlso=big
 *
 * @throws LdapException on error
 */
@Test
public void test82ReverseRenameSimpleCompositeOverlappingKeepOldRdnExistInEntry() throws LdapException
{
    Dn dn = new Dn( "cn=test,ou=system" );
    Rdn oldRdn = new Rdn( "cn=test" );
    Rdn newRdn = new Rdn( "sn=small+cn=test+seeAlso=big" );

    Entry entry = new DefaultEntry( dn,
        "objectClass: top",
        "objectClass: person",
        "cn: test",
        "seeAlso: big",
        "sn: this is a test" );

    List<LdifEntry> reverseds = LdifRevertor.reverseRename( entry, newRdn, LdifRevertor.KEEP_OLD_RDN );

    assertNotNull( reverseds );
    assertEquals( 2, reverseds.size() );
    LdifEntry reversed = reverseds.get( 0 );

    assertEquals( "sn=small+cn=test+seeAlso=big,ou=system", reversed.getDn().getName() );
    assertEquals( ChangeType.ModRdn, reversed.getChangeType() );
    assertFalse( reversed.isDeleteOldRdn() );
    assertEquals( oldRdn.getName(), reversed.getNewRdn() );
    assertNull( reversed.getNewSuperior() );

    reversed = reverseds.get( 1 );

    assertEquals( "cn=test,ou=system", reversed.getDn().getName() );
    assertEquals( ChangeType.Modify, reversed.getChangeType() );
    Modification[] mods = reversed.getModificationArray();

    assertNotNull( mods );
    assertEquals( 1, mods.length );
    assertEquals( ModificationOperation.REMOVE_ATTRIBUTE, mods[0].getOperation() );
    assertNotNull( mods[0].getAttribute() );
    assertEquals( "sn", mods[0].getAttribute().getId() );
    assertEquals( "small", mods[0].getAttribute().getString() );
}
 
开发者ID:apache,项目名称:directory-ldap-api,代码行数:59,代码来源:LdifRevertorTest.java

示例4: test92ReverseRenameSimpleCompositeOverlappingDeleteOldRdnDontExistInEntry

import org.apache.directory.api.ldap.model.ldif.LdifEntry; //导入方法依赖的package包/类
/**
 * Test a reversed rename ModifyDN, where the initial Rdn is simple,
 * the new Rdn is composite, they overlap, with deleteOldRdn = true, and
 * some of the new values exists in the entry.
 * 
 * Covers case 9.2 of http://cwiki.apache.org/confluence/display/DIRxSRVx11/Reverse+LDIF
 * 
 * Initial entry
 * dn: cn=test,ou=system
 * objectclass: top
 * objectclass: person
 * cn: test
 * seeAlso: big
 * sn: This is a test
 * 
 * new Rdn : cn=small+cn=test+cn=big
 *
 * @throws LdapException on error
 */
@Test
public void test92ReverseRenameSimpleCompositeOverlappingDeleteOldRdnDontExistInEntry() throws LdapException
{
    Dn dn = new Dn( "cn=test,ou=system" );
    Rdn oldRdn = new Rdn( "cn=test" );
    Rdn newRdn = new Rdn( "sn=small+cn=test+seeAlso=big" );

    Entry entry = new DefaultEntry( dn,
        "objectClass: top",
        "objectClass: person",
        "cn: test",
        "seeAlso: big",
        "sn: this is a test" );

    List<LdifEntry> reverseds = LdifRevertor.reverseRename( entry, newRdn, LdifRevertor.DELETE_OLD_RDN );

    assertNotNull( reverseds );
    assertEquals( 2, reverseds.size() );
    LdifEntry reversed = reverseds.get( 0 );

    assertEquals( "sn=small+cn=test+seeAlso=big,ou=system", reversed.getDn().getName() );
    assertEquals( ChangeType.ModRdn, reversed.getChangeType() );
    assertFalse( reversed.isDeleteOldRdn() );
    assertEquals( oldRdn.getName(), reversed.getNewRdn() );
    assertNull( reversed.getNewSuperior() );

    reversed = reverseds.get( 1 );

    assertEquals( "cn=test,ou=system", reversed.getDn().getName() );
    assertEquals( ChangeType.Modify, reversed.getChangeType() );
    Modification[] mods = reversed.getModificationArray();

    assertNotNull( mods );
    assertEquals( 1, mods.length );
    assertEquals( ModificationOperation.REMOVE_ATTRIBUTE, mods[0].getOperation() );
    assertNotNull( mods[0].getAttribute() );
    assertEquals( "sn", mods[0].getAttribute().getId() );
    assertEquals( "small", mods[0].getAttribute().getString() );
}
 
开发者ID:apache,项目名称:directory-ldap-api,代码行数:59,代码来源:LdifRevertorTest.java

示例5: test102ReverseRenameCompositeCompositeNotOverlappingKeepOldRdnExistInEntry

import org.apache.directory.api.ldap.model.ldif.LdifEntry; //导入方法依赖的package包/类
/**
 * Test a reversed rename ModifyDN, where the initial Rdn is composite,
 * the new Rdn is composite, they don't overlap, with deleteOldRdn = false, and
 * some of the new values exists in the entry.
 * 
 * Covers case 10.2 of http://cwiki.apache.org/confluence/display/DIRxSRVx11/Reverse+LDIF
 * 
 * Initial entry
 * dn: sn=small+cn=test,ou=system
 * objectclass: top
 * objectclass: person
 * cn: test
 * cn: big
 * sn: small
 * sn: This is a test
 * 
 * new Rdn : sn=joe+cn=big
 *
 * @throws LdapException on error
 */
@Test
public void test102ReverseRenameCompositeCompositeNotOverlappingKeepOldRdnExistInEntry() throws LdapException
{
    Dn dn = new Dn( "sn=small+cn=test,ou=system" );
    Rdn oldRdn = new Rdn( "sn=small+cn=test" );
    Rdn newRdn = new Rdn( "sn=joe+cn=big" );

    Entry entry = new DefaultEntry( dn,
        "objectClass: top",
        "objectClass: person",
        "cn: test",
        "cn: big",
        "sn: small",
        "sn: this is a test" );

    List<LdifEntry> reverseds = LdifRevertor.reverseRename( entry, newRdn, LdifRevertor.KEEP_OLD_RDN );

    assertNotNull( reverseds );
    assertEquals( 2, reverseds.size() );
    LdifEntry reversed = reverseds.get( 0 );

    assertEquals( "sn=joe+cn=big,ou=system", reversed.getDn().getName() );
    assertEquals( ChangeType.ModRdn, reversed.getChangeType() );
    assertFalse( reversed.isDeleteOldRdn() );
    assertEquals( oldRdn.getName(), reversed.getNewRdn() );
    assertNull( reversed.getNewSuperior() );

    reversed = reverseds.get( 1 );

    assertEquals( "sn=small+cn=test,ou=system", reversed.getDn().getName() );
    assertEquals( ChangeType.Modify, reversed.getChangeType() );
    Modification[] mods = reversed.getModificationArray();

    assertNotNull( mods );
    assertEquals( 1, mods.length );
    assertEquals( ModificationOperation.REMOVE_ATTRIBUTE, mods[0].getOperation() );
    assertNotNull( mods[0].getAttribute() );
    assertEquals( "sn", mods[0].getAttribute().getId() );
    assertEquals( "joe", mods[0].getAttribute().getString() );
}
 
开发者ID:apache,项目名称:directory-ldap-api,代码行数:61,代码来源:LdifRevertorTest.java

示例6: test112ReverseRenameCompositeCompositeNotOverlappingDeleteOldRdnExistInEntry

import org.apache.directory.api.ldap.model.ldif.LdifEntry; //导入方法依赖的package包/类
/**
 * Test a reversed rename ModifyDN, where the initial Rdn is composite,
 * the new Rdn is composite, they don't overlap, with deleteOldRdn = true, and
 * some of the new values exists in the entry.
 * 
 * Covers case 11.2 of http://cwiki.apache.org/confluence/display/DIRxSRVx11/Reverse+LDIF
 * 
 * Initial entry
 * dn: sn=small+cn=test,ou=system
 * objectclass: top
 * objectclass: person
 * cn: test
 * sn: big
 * sn: small
 * sn: This is a test
 * 
 * new Rdn : cn=joe+sn=big
 *
 * @throws LdapException on error
 */
@Test
public void test112ReverseRenameCompositeCompositeNotOverlappingDeleteOldRdnExistInEntry() throws LdapException
{
    Dn dn = new Dn( "sn=small+cn=test,ou=system" );
    Rdn oldRdn = new Rdn( "sn=small+cn=test" );
    Rdn newRdn = new Rdn( "cn=joe+sn=big" );

    Entry entry = new DefaultEntry( dn,
        "objectClass: top",
        "objectClass: person",
        "cn: test",
        "sn: big",
        "sn: small",
        "sn: this is a test" );

    List<LdifEntry> reverseds = LdifRevertor.reverseRename( entry, newRdn, LdifRevertor.DELETE_OLD_RDN );

    assertNotNull( reverseds );
    assertEquals( 2, reverseds.size() );
    LdifEntry reversed = reverseds.get( 0 );

    assertEquals( "cn=joe+sn=big,ou=system", reversed.getDn().getName() );
    assertEquals( ChangeType.ModRdn, reversed.getChangeType() );
    assertFalse( reversed.isDeleteOldRdn() );
    assertEquals( oldRdn.getName(), reversed.getNewRdn() );
    assertNull( reversed.getNewSuperior() );

    reversed = reverseds.get( 1 );

    assertEquals( "sn=small+cn=test,ou=system", reversed.getDn().getName() );
    assertEquals( ChangeType.Modify, reversed.getChangeType() );
    Modification[] mods = reversed.getModificationArray();

    assertNotNull( mods );
    assertEquals( 1, mods.length );
    assertEquals( ModificationOperation.REMOVE_ATTRIBUTE, mods[0].getOperation() );
    assertNotNull( mods[0].getAttribute() );
    assertEquals( "cn", mods[0].getAttribute().getId() );
    assertEquals( "joe", mods[0].getAttribute().getString() );
}
 
开发者ID:apache,项目名称:directory-ldap-api,代码行数:61,代码来源:LdifRevertorTest.java


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