本文整理汇总了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() );
}
示例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() );
}
示例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() );
}
示例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() );
}
示例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() );
}
示例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() );
}