use of com.unboundid.ldif.LDIFModifyDNChangeRecord in project ldapsdk by pingidentity.
the class ExcludeChangeTypeTransformationTestCase method testExcludeNullSet.
/**
* Tests the behavior when the set of change types to exclude is
* {@code null}}.
*
* @throws Exception If an unexpected problem occurs.
*/
@Test()
public void testExcludeNullSet() throws Exception {
final ExcludeChangeTypeTransformation t = new ExcludeChangeTypeTransformation((ChangeType[]) null);
final LDIFAddChangeRecord addChangeRecord = new LDIFAddChangeRecord(new Entry("dn: dc=example,dc=com", "objectClass: top", "objectClass: domain", "dc: example"));
assertNotNull(t.transformChangeRecord(addChangeRecord));
assertEquals(t.transformChangeRecord(addChangeRecord), addChangeRecord);
assertNotNull(t.translate(addChangeRecord, 0));
assertEquals(t.translate(addChangeRecord, 0), addChangeRecord);
assertNotNull(t.translateChangeRecordToWrite(addChangeRecord));
assertEquals(t.translateChangeRecordToWrite(addChangeRecord), addChangeRecord);
final LDIFDeleteChangeRecord deleteChangeRecord = new LDIFDeleteChangeRecord("dc=example,dc=com");
assertNotNull(t.transformChangeRecord(deleteChangeRecord));
assertEquals(t.transformChangeRecord(deleteChangeRecord), deleteChangeRecord);
assertNotNull(t.translate(deleteChangeRecord, 0));
assertEquals(t.translate(deleteChangeRecord, 0), deleteChangeRecord);
assertNotNull(t.translateChangeRecordToWrite(deleteChangeRecord));
assertEquals(t.translateChangeRecordToWrite(deleteChangeRecord), deleteChangeRecord);
final LDIFModifyChangeRecord modifyChangeRecord = new LDIFModifyChangeRecord(new ModifyRequest("dn: dc=example,dc=com", "changetype: modify", "replace: description", "description: foo"));
assertNotNull(t.transformChangeRecord(modifyChangeRecord));
assertEquals(t.transformChangeRecord(modifyChangeRecord), modifyChangeRecord);
assertNotNull(t.translate(modifyChangeRecord, 0));
assertEquals(t.translate(modifyChangeRecord, 0), modifyChangeRecord);
assertNotNull(t.translateChangeRecordToWrite(modifyChangeRecord));
assertEquals(t.translateChangeRecordToWrite(modifyChangeRecord), modifyChangeRecord);
final LDIFModifyDNChangeRecord modifyDNChangeRecord = new LDIFModifyDNChangeRecord("ou=People,dc=example,dc=com", "ou=Users", true, null);
assertNotNull(t.transformChangeRecord(modifyDNChangeRecord));
assertEquals(t.transformChangeRecord(modifyDNChangeRecord), modifyDNChangeRecord);
assertNotNull(t.translate(modifyDNChangeRecord, 0));
assertEquals(t.translate(modifyDNChangeRecord, 0), modifyDNChangeRecord);
assertNotNull(t.translateChangeRecordToWrite(modifyDNChangeRecord));
assertEquals(t.translateChangeRecordToWrite(modifyDNChangeRecord), modifyDNChangeRecord);
}
use of com.unboundid.ldif.LDIFModifyDNChangeRecord in project ldapsdk by pingidentity.
the class MoveSubtreeTransformationTestCase method testTransformModifyDNChangeRecord.
/**
* Provides general test coverage for the transformChangeRecord method for
* modify DN change records.
*
* @throws Exception If an unexpected problem occurs.
*/
@Test()
public void testTransformModifyDNChangeRecord() throws Exception {
final MoveSubtreeTransformation t = new MoveSubtreeTransformation(new DN("o=example.com"), new DN("dc=example,dc=com"));
final LDIFChangeRecord r = t.transformChangeRecord(new LDIFModifyDNChangeRecord("uid=test.user,ou=Users,o=example.com", "cn=Test User", false, "ou=People,o=example.com"));
assertNotNull(r);
assertEquals(r, new LDIFModifyDNChangeRecord("uid=test.user,ou=Users,dc=example,dc=com", "cn=Test User", false, "ou=People,dc=example,dc=com"));
}
use of com.unboundid.ldif.LDIFModifyDNChangeRecord in project ldapsdk by pingidentity.
the class ExcludeAttributeTransformationTestCase method testExcludeForModifyDNChangeRecord.
/**
* Tests the behavior for LDIF modify DN change records.
*
* @throws Exception If an unexpected problem occurs.
*/
@Test()
public void testExcludeForModifyDNChangeRecord() throws Exception {
final ExcludeAttributeTransformation t = new ExcludeAttributeTransformation(Schema.getDefaultStandardSchema(), "description", "displayName");
final LDIFChangeRecord r = t.transformChangeRecord(new LDIFModifyDNChangeRecord("ou=People,dc=example,dc=com", "ou=users", true, "o=example.com"));
assertNotNull(r);
assertEquals(r, new LDIFModifyDNChangeRecord("ou=People,dc=example,dc=com", "ou=users", true, "o=example.com"));
}
use of com.unboundid.ldif.LDIFModifyDNChangeRecord in project ldapsdk by pingidentity.
the class ExcludeChangeTypeTransformationTestCase method testExcludeEmptySet.
/**
* Tests the behavior when the set of change types to exclude is empty.
*
* @throws Exception If an unexpected problem occurs.
*/
@Test()
public void testExcludeEmptySet() throws Exception {
final ExcludeChangeTypeTransformation t = new ExcludeChangeTypeTransformation();
final LDIFAddChangeRecord addChangeRecord = new LDIFAddChangeRecord(new Entry("dn: dc=example,dc=com", "objectClass: top", "objectClass: domain", "dc: example"));
assertNotNull(t.transformChangeRecord(addChangeRecord));
assertEquals(t.transformChangeRecord(addChangeRecord), addChangeRecord);
assertNotNull(t.translate(addChangeRecord, 0));
assertEquals(t.translate(addChangeRecord, 0), addChangeRecord);
assertNotNull(t.translateChangeRecordToWrite(addChangeRecord));
assertEquals(t.translateChangeRecordToWrite(addChangeRecord), addChangeRecord);
final LDIFDeleteChangeRecord deleteChangeRecord = new LDIFDeleteChangeRecord("dc=example,dc=com");
assertNotNull(t.transformChangeRecord(deleteChangeRecord));
assertEquals(t.transformChangeRecord(deleteChangeRecord), deleteChangeRecord);
assertNotNull(t.translate(deleteChangeRecord, 0));
assertEquals(t.translate(deleteChangeRecord, 0), deleteChangeRecord);
assertNotNull(t.translateChangeRecordToWrite(deleteChangeRecord));
assertEquals(t.translateChangeRecordToWrite(deleteChangeRecord), deleteChangeRecord);
final LDIFModifyChangeRecord modifyChangeRecord = new LDIFModifyChangeRecord(new ModifyRequest("dn: dc=example,dc=com", "changetype: modify", "replace: description", "description: foo"));
assertNotNull(t.transformChangeRecord(modifyChangeRecord));
assertEquals(t.transformChangeRecord(modifyChangeRecord), modifyChangeRecord);
assertNotNull(t.translate(modifyChangeRecord, 0));
assertEquals(t.translate(modifyChangeRecord, 0), modifyChangeRecord);
assertNotNull(t.translateChangeRecordToWrite(modifyChangeRecord));
assertEquals(t.translateChangeRecordToWrite(modifyChangeRecord), modifyChangeRecord);
final LDIFModifyDNChangeRecord modifyDNChangeRecord = new LDIFModifyDNChangeRecord("ou=People,dc=example,dc=com", "ou=Users", true, null);
assertNotNull(t.transformChangeRecord(modifyDNChangeRecord));
assertEquals(t.transformChangeRecord(modifyDNChangeRecord), modifyDNChangeRecord);
assertNotNull(t.translate(modifyDNChangeRecord, 0));
assertEquals(t.translate(modifyDNChangeRecord, 0), modifyDNChangeRecord);
assertNotNull(t.translateChangeRecordToWrite(modifyDNChangeRecord));
assertEquals(t.translateChangeRecordToWrite(modifyDNChangeRecord), modifyDNChangeRecord);
}
use of com.unboundid.ldif.LDIFModifyDNChangeRecord in project ldapsdk by pingidentity.
the class ExcludeChangeTypeTransformationTestCase method testExcludeAllChangeTypes.
/**
* Tests the behavior when the set of change types to exclude contains all of
* the change types.
*
* @throws Exception If an unexpected problem occurs.
*/
@Test()
public void testExcludeAllChangeTypes() throws Exception {
final ExcludeChangeTypeTransformation t = new ExcludeChangeTypeTransformation(ChangeType.ADD, ChangeType.DELETE, ChangeType.MODIFY, ChangeType.MODIFY_DN);
final LDIFAddChangeRecord addChangeRecord = new LDIFAddChangeRecord(new Entry("dn: dc=example,dc=com", "objectClass: top", "objectClass: domain", "dc: example"));
assertNull(t.transformChangeRecord(addChangeRecord));
assertNull(t.translate(addChangeRecord, 0));
assertNull(t.translateChangeRecordToWrite(addChangeRecord));
final LDIFDeleteChangeRecord deleteChangeRecord = new LDIFDeleteChangeRecord("dc=example,dc=com");
assertNull(t.transformChangeRecord(deleteChangeRecord));
assertNull(t.translate(deleteChangeRecord, 0));
assertNull(t.translateChangeRecordToWrite(deleteChangeRecord));
final LDIFModifyChangeRecord modifyChangeRecord = new LDIFModifyChangeRecord(new ModifyRequest("dn: dc=example,dc=com", "changetype: modify", "replace: description", "description: foo"));
assertNull(t.transformChangeRecord(modifyChangeRecord));
assertNull(t.translate(modifyChangeRecord, 0));
assertNull(t.translateChangeRecordToWrite(modifyChangeRecord));
final LDIFModifyDNChangeRecord modifyDNChangeRecord = new LDIFModifyDNChangeRecord("ou=People,dc=example,dc=com", "ou=Users", true, null);
assertNull(t.transformChangeRecord(modifyDNChangeRecord));
assertNull(t.translate(modifyDNChangeRecord, 0));
assertNull(t.translateChangeRecordToWrite(modifyDNChangeRecord));
}
Aggregations