Search in sources :

Example 11 with LDIFDeleteChangeRecord

use of com.unboundid.ldif.LDIFDeleteChangeRecord in project ldapsdk by pingidentity.

the class DebugTestCase method testDebugLDIFWrite2EnabledWithoutLDIF.

/**
 * Tests the second {@code debugLDIFWrite} method with the debugger enabled
 * and a debug type set that does not include the LDIF type.
 *
 * @throws  Exception  If an unexpected problem occurs.
 */
@Test()
public void testDebugLDIFWrite2EnabledWithoutLDIF() throws Exception {
    Debug.setEnabled(true, EnumSet.of(DebugType.OTHER));
    testLogHandler.resetMessageCount();
    assertFalse(Debug.debugEnabled(DebugType.LDIF));
    Debug.debugLDIFWrite(new LDIFDeleteChangeRecord("dc=example,dc=com"));
    assertTrue(testLogHandler.getMessageCount() >= 0);
}
Also used : LDIFDeleteChangeRecord(com.unboundid.ldif.LDIFDeleteChangeRecord) Test(org.testng.annotations.Test)

Example 12 with LDIFDeleteChangeRecord

use of com.unboundid.ldif.LDIFDeleteChangeRecord in project ldapsdk by pingidentity.

the class DebugTestCase method testDebugLDIFWrite2DisabledAll.

/**
 * Tests the second {@code debugLDIFWrite} method with the debugger disabled
 * and a debug type set of all types.
 *
 * @throws  Exception  If an unexpected problem occurs.
 */
@Test()
public void testDebugLDIFWrite2DisabledAll() throws Exception {
    Debug.setEnabled(false);
    testLogHandler.resetMessageCount();
    assertFalse(Debug.debugEnabled(DebugType.LDIF));
    Debug.debugLDIFWrite(new LDIFDeleteChangeRecord("dc=example,dc=com"));
    assertTrue(testLogHandler.getMessageCount() >= 0);
}
Also used : LDIFDeleteChangeRecord(com.unboundid.ldif.LDIFDeleteChangeRecord) Test(org.testng.annotations.Test)

Example 13 with LDIFDeleteChangeRecord

use of com.unboundid.ldif.LDIFDeleteChangeRecord in project ldapsdk by pingidentity.

the class DebugTestCase method testDebugLDIFRead2EnabledWithoutLDIF.

/**
 * Tests the second {@code debugLDIFRead} method with the debugger enabled
 * and a debug type set that does not include the LDIF type.
 *
 * @throws  Exception  If an unexpected problem occurs.
 */
@Test()
public void testDebugLDIFRead2EnabledWithoutLDIF() throws Exception {
    Debug.setEnabled(true, EnumSet.of(DebugType.OTHER));
    testLogHandler.resetMessageCount();
    assertFalse(Debug.debugEnabled(DebugType.LDIF));
    Debug.debugLDIFRead(new LDIFDeleteChangeRecord("dc=example,dc=com"));
    assertTrue(testLogHandler.getMessageCount() >= 0);
}
Also used : LDIFDeleteChangeRecord(com.unboundid.ldif.LDIFDeleteChangeRecord) Test(org.testng.annotations.Test)

Example 14 with LDIFDeleteChangeRecord

use of com.unboundid.ldif.LDIFDeleteChangeRecord in project ldapsdk by pingidentity.

the class DebugTestCase method testDebugLDIFRead2DisabledAll.

/**
 * Tests the second {@code debugLDIFRead} method with the debugger disabled
 * and a debug type set of all types.
 *
 * @throws  Exception  If an unexpected problem occurs.
 */
@Test()
public void testDebugLDIFRead2DisabledAll() throws Exception {
    Debug.setEnabled(false);
    testLogHandler.resetMessageCount();
    assertFalse(Debug.debugEnabled(DebugType.LDIF));
    Debug.debugLDIFRead(new LDIFDeleteChangeRecord("dc=example,dc=com"));
    assertTrue(testLogHandler.getMessageCount() >= 0);
}
Also used : LDIFDeleteChangeRecord(com.unboundid.ldif.LDIFDeleteChangeRecord) Test(org.testng.annotations.Test)

Example 15 with LDIFDeleteChangeRecord

use of com.unboundid.ldif.LDIFDeleteChangeRecord in project ldapsdk by pingidentity.

the class TransformLDIFTestCase method testExcludeRecordsWithoutChangeType.

/**
 * Tests the ability to exclude LDIF records without change types.
 *
 * @throws  Exception  If an unexpected problem occurs.
 */
@Test()
public void testExcludeRecordsWithoutChangeType() throws Exception {
    // Create the LDIF file to process.
    final File sourceLDIFFile = createTempFile("dn: dc=example,dc=com", "objectClass: top", "objectClass: domain", "dc: example", "", "dn: ou=People,dc=example,dc=com", "changetype: add", "objectClass: top", "objectClass: organizationalUnit", "ou: People", "", "dn: ou=People,dc=example,dc=com", "changetype: modify", "add: description", "description: foo", "", "dn: ou=People,dc=example,dc=com", "changetype: moddn", "newrdn: ou=Users", "deleteoldrdn: 1", "", "dn: ou=Users,dc=example,dc=com", "changetype: delete");
    final File outputFile = runTool("--sourceLDIF", sourceLDIFFile.getAbsolutePath(), "--excludeRecordsWithoutChangeType");
    final LDIFReader reader = new LDIFReader(outputFile);
    LDIFRecord r = reader.readLDIFRecord();
    assertNotNull(r);
    assertTrue(r instanceof LDIFAddChangeRecord);
    r = reader.readLDIFRecord();
    assertNotNull(r);
    assertTrue(r instanceof LDIFModifyChangeRecord);
    r = reader.readLDIFRecord();
    assertNotNull(r);
    assertTrue(r instanceof LDIFModifyDNChangeRecord);
    r = reader.readLDIFRecord();
    assertNotNull(r);
    assertTrue(r instanceof LDIFDeleteChangeRecord);
    assertNull(reader.readEntry());
    reader.close();
}
Also used : LDIFRecord(com.unboundid.ldif.LDIFRecord) LDIFAddChangeRecord(com.unboundid.ldif.LDIFAddChangeRecord) LDIFReader(com.unboundid.ldif.LDIFReader) LDIFModifyChangeRecord(com.unboundid.ldif.LDIFModifyChangeRecord) LDIFDeleteChangeRecord(com.unboundid.ldif.LDIFDeleteChangeRecord) File(java.io.File) LDIFModifyDNChangeRecord(com.unboundid.ldif.LDIFModifyDNChangeRecord) Test(org.testng.annotations.Test)

Aggregations

LDIFDeleteChangeRecord (com.unboundid.ldif.LDIFDeleteChangeRecord)67 Test (org.testng.annotations.Test)58 LDIFAddChangeRecord (com.unboundid.ldif.LDIFAddChangeRecord)29 LDIFChangeRecord (com.unboundid.ldif.LDIFChangeRecord)20 LDIFModifyChangeRecord (com.unboundid.ldif.LDIFModifyChangeRecord)18 LDIFModifyDNChangeRecord (com.unboundid.ldif.LDIFModifyDNChangeRecord)17 Calendar (java.util.Calendar)17 GregorianCalendar (java.util.GregorianCalendar)17 Entry (com.unboundid.ldap.sdk.Entry)10 Attribute (com.unboundid.ldap.sdk.Attribute)9 ModifyRequest (com.unboundid.ldap.sdk.ModifyRequest)9 ReadOnlyEntry (com.unboundid.ldap.sdk.ReadOnlyEntry)9 DN (com.unboundid.ldap.sdk.DN)7 LDAPException (com.unboundid.ldap.sdk.LDAPException)6 File (java.io.File)5 Schema (com.unboundid.ldap.sdk.schema.Schema)4 Nullable (com.unboundid.util.Nullable)4 ASN1OctetString (com.unboundid.asn1.ASN1OctetString)3 ChangeLogEntry (com.unboundid.ldap.sdk.ChangeLogEntry)3 Modification (com.unboundid.ldap.sdk.Modification)3