use of com.unboundid.ldif.LDIFDeleteChangeRecord 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.LDIFDeleteChangeRecord 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));
}
use of com.unboundid.ldif.LDIFDeleteChangeRecord in project ldapsdk by pingidentity.
the class ExcludeChangeTypeTransformationTestCase method testExcludeAddChangeType.
/**
* Tests the behavior when the set of change types to exclude contains only
* the add change type.
*
* @throws Exception If an unexpected problem occurs.
*/
@Test()
public void testExcludeAddChangeType() throws Exception {
final ExcludeChangeTypeTransformation t = new ExcludeChangeTypeTransformation(ChangeType.ADD);
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");
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.LDIFDeleteChangeRecord in project ldapsdk by pingidentity.
the class ExcludeChangeTypeTransformationTestCase method testExcludeModifyChangeType.
/**
* Tests the behavior when the set of change types to exclude contains only
* the modify change type.
*
* @throws Exception If an unexpected problem occurs.
*/
@Test()
public void testExcludeModifyChangeType() throws Exception {
final ExcludeChangeTypeTransformation t = new ExcludeChangeTypeTransformation(ChangeType.MODIFY);
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"));
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);
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.LDIFDeleteChangeRecord in project ldapsdk by pingidentity.
the class RedactAttributeTransformationTestCase method testTransformDeleteChangeRecordProcessDNsTruePreserveCountTrue.
/**
* Provides test coverage for the transformChangeRecord method for a delete
* record with both processDNs and preserveValueCount arguments set to true.
*
* @throws Exception If an unexpected problem occurs.
*/
@Test()
public void testTransformDeleteChangeRecordProcessDNsTruePreserveCountTrue() throws Exception {
final Schema schema = Schema.getDefaultStandardSchema();
final RedactAttributeTransformation t = new RedactAttributeTransformation(schema, true, true, "description", "displayName", "cn", "ou");
final LDIFChangeRecord r = t.transformChangeRecord(new LDIFDeleteChangeRecord("cn=Test,ou=People,dc=example,dc=com"));
assertNotNull(r);
assertEquals(r, new LDIFDeleteChangeRecord("cn=***REDACTED***,ou=***REDACTED***,dc=example,dc=com"));
}
Aggregations