Search in sources :

Example 26 with LDIFDeleteChangeRecord

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

the class DeleteAuditLogMessageTestCase method testHardDeleteOfSoftDeletedEntry.

/**
 * Tests the behavior for a hard delete of a soft-deleted entry.
 *
 * @throws  Exception  If an unexpected problem occurs.
 */
@Test()
public void testHardDeleteOfSoftDeletedEntry() throws Exception {
    final DeleteAuditLogMessage m = new DeleteAuditLogMessage("# 27/Aug/2018:15:09:11.624 -0500; conn=58; op=1; " + "productName=\"Directory Server\"; " + "instanceName=\"ReplicaOne\"; startupID=W4RZ/w==; " + "threadID=14; clientIP=127.0.0.1; " + "requesterDN=\"cn=Proxy User,cn=Root DNs,cn=config\"; " + "replicationChangeID=\"000001657D0124C47A0D0000000F\"; " + "authzDN=\"cn=Directory Manager,cn=Root DNs,cn=config\"; " + "isSoftDeletedEntry=true; " + "requestControlOIDs=\"1.3.6.1.4.1.30221.2.5.2\"; " + "intermediateClientRequestControl={ " + "\"clientIdentity\":\"dn:cn=Directory Manager,cn=Root " + "DNs,cn=config\", \"downstreamClientAddress\":\"127.0.0.1\", " + "\"downstreamClientSecure\":false, " + "\"clientName\":\"PingDirectory\", " + "\"clientSessionID\":\"conn=9\", \"clientRequestID\":\"op=5\", " + "\"downstreamRequest\":{ " + "\"clientName\":\"Unidentified Directory Application\" } }", "# Deleted entry real attributes", "# objectClass: top", "# objectClass: organizationalUnit", "# objectClass: ds-soft-delete-entry", "# ou: People", "# createTimestamp: 20180827200911.586Z", "# creatorsName: cn=Directory Manager,cn=Root DNs,cn=config", "# modifyTimestamp: 20180827200911.586Z", "# modifiersName: cn=Directory Manager,cn=Root DNs,cn=config", "# entryUUID: f7e0fa1e-03e5-4a81-9b2f-f909b6531a80", "# ds-soft-delete-from-dn: ou=People,dc=example,dc=com", "# ds-soft-delete-timestamp: 20180827200911.614Z", "# Deleted entry virtual attributes", "# ds-entry-checksum: 419234829", "# subschemaSubentry: cn=schema", "dn: entryUUID=f7e0fa1e-03e5-4a81-9b2f-f909b6531a80+ou=People," + "dc=example,dc=com", "changetype: delete");
    assertNotNull(m.getLogMessageLines());
    assertFalse(m.getLogMessageLines().isEmpty());
    assertNotNull(m.getCommentedHeaderLine());
    assertTrue(m.getCommentedHeaderLine().startsWith("# 27/Aug/2018:15:09:11.624 -0500; conn=58; op=1; "));
    assertNotNull(m.getUncommentedHeaderLine());
    assertTrue(m.getUncommentedHeaderLine().startsWith("27/Aug/2018:15:09:11.624 -0500; conn=58; op=1; "));
    assertNotNull(m.getTimestamp());
    final Calendar calendar = new GregorianCalendar();
    calendar.setTime(m.getTimestamp());
    assertEquals(calendar.get(Calendar.YEAR), 2018);
    assertEquals(calendar.get(Calendar.MONTH), Calendar.AUGUST);
    assertNotNull(m.getHeaderNamedValues());
    assertFalse(m.getHeaderNamedValues().isEmpty());
    assertTrue(m.getHeaderNamedValues().containsKey("conn"));
    assertNotNull(m.getProductName());
    assertEquals(m.getProductName(), "Directory Server");
    assertNotNull(m.getInstanceName());
    assertEquals(m.getInstanceName(), "ReplicaOne");
    assertNotNull(m.getStartupID());
    assertEquals(m.getStartupID(), "W4RZ/w==");
    assertNotNull(m.getThreadID());
    assertEquals(m.getThreadID().longValue(), 14L);
    assertNotNull(m.getRequesterDN());
    assertDNsEqual(m.getRequesterDN(), "cn=Proxy User,cn=Root DNs,cn=config");
    assertNotNull(m.getRequesterIPAddress());
    assertEquals(m.getRequesterIPAddress(), "127.0.0.1");
    assertNotNull(m.getConnectionID());
    assertEquals(m.getConnectionID().longValue(), 58L);
    assertNotNull(m.getOperationID());
    assertEquals(m.getOperationID().longValue(), 1L);
    assertNull(m.getTriggeredByConnectionID());
    assertNull(m.getTriggeredByOperationID());
    assertNotNull(m.getReplicationChangeID());
    assertEquals(m.getReplicationChangeID(), "000001657D0124C47A0D0000000F");
    assertNotNull(m.getAlternateAuthorizationDN());
    assertDNsEqual(m.getAlternateAuthorizationDN(), "cn=Directory Manager,cn=Root DNs,cn=config");
    assertNull(m.getTransactionID());
    assertNull(m.getOrigin());
    assertNull(m.getUsingAdminSessionWorkerThread());
    assertNotNull(m.getRequestControlOIDs());
    assertEquals(m.getRequestControlOIDs(), Collections.singletonList("1.3.6.1.4.1.30221.2.5.2"));
    assertNull(m.getOperationPurposeRequestControl());
    assertNotNull(m.getIntermediateClientRequestControl());
    assertNotNull(m.getDN());
    assertDNsEqual(m.getDN(), "entryUUID=f7e0fa1e-03e5-4a81-9b2f-f909b6531a80+ou=People," + "dc=example,dc=com");
    assertNull(m.getIsSubtreeDelete());
    assertNull(m.getDeletedAsPartOfSubtreeDelete());
    assertNull(m.getIsSoftDelete());
    assertNull(m.getSoftDeletedEntryDN());
    assertNotNull(m.getIsSoftDeletedEntry());
    assertTrue(m.getIsSoftDeletedEntry());
    assertNotNull(m.getDeletedEntry());
    assertEquals(m.getDeletedEntry(), new ReadOnlyEntry("dn: entryUUID=f7e0fa1e-03e5-4a81-9b2f-f909b6531a80+ou=People," + "dc=example,dc=com", "objectClass: top", "objectClass: organizationalUnit", "objectClass: ds-soft-delete-entry", "ou: People", "createTimestamp: 20180827200911.586Z", "creatorsName: cn=Directory Manager,cn=Root DNs,cn=config", "modifyTimestamp: 20180827200911.586Z", "modifiersName: cn=Directory Manager,cn=Root DNs,cn=config", "entryUUID: f7e0fa1e-03e5-4a81-9b2f-f909b6531a80", "ds-soft-delete-from-dn: ou=People,dc=example,dc=com", "ds-soft-delete-timestamp: 20180827200911.614Z"));
    assertNotNull(m.getDeletedEntryVirtualAttributes());
    assertFalse(m.getDeletedEntryVirtualAttributes().isEmpty());
    assertEquals(m.getDeletedEntryVirtualAttributes(), Arrays.asList(new Attribute("ds-entry-checksum", "419234829"), new Attribute("subschemaSubentry", "cn=schema")));
    assertNotNull(m.getChangeType());
    assertEquals(m.getChangeType(), ChangeType.DELETE);
    assertNotNull(m.getChangeRecord());
    assertTrue(m.getChangeRecord() instanceof LDIFDeleteChangeRecord);
    assertTrue(m.isRevertible());
    final List<LDIFChangeRecord> revertChangeRecords = m.getRevertChangeRecords();
    assertNotNull(revertChangeRecords);
    assertFalse(revertChangeRecords.isEmpty());
    assertEquals(revertChangeRecords.size(), 1);
    assertTrue(revertChangeRecords.get(0) instanceof LDIFAddChangeRecord);
    final LDIFAddChangeRecord revertChangeRecord = (LDIFAddChangeRecord) revertChangeRecords.get(0);
    assertEquals(revertChangeRecord.getEntryToAdd(), m.getDeletedEntry());
    assertNotNull(m.toString());
    assertNotNull(m.toMultiLineString());
}
Also used : ReadOnlyEntry(com.unboundid.ldap.sdk.ReadOnlyEntry) LDIFChangeRecord(com.unboundid.ldif.LDIFChangeRecord) Attribute(com.unboundid.ldap.sdk.Attribute) LDIFAddChangeRecord(com.unboundid.ldif.LDIFAddChangeRecord) GregorianCalendar(java.util.GregorianCalendar) Calendar(java.util.Calendar) GregorianCalendar(java.util.GregorianCalendar) LDIFDeleteChangeRecord(com.unboundid.ldif.LDIFDeleteChangeRecord) Test(org.testng.annotations.Test)

Example 27 with LDIFDeleteChangeRecord

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

the class DeleteAuditLogMessageTestCase method testBasicNonReversibleDeleteLogMessageFromArray.

/**
 * Tests the behavior for a basic, non-reversible delete audit log message
 * read from an array of strings.
 *
 * @throws  Exception  If an unexpected problem occurs.
 */
@Test()
public void testBasicNonReversibleDeleteLogMessageFromArray() throws Exception {
    final DeleteAuditLogMessage m = new DeleteAuditLogMessage("# 24/Aug/2018:12:11:50 -0500; conn=33; op=1; " + "authzDN=\"cn=Directory Manager,cn=Root DNs,cn=config\"", "dn: ou=People,dc=example,dc=com", "changetype: delete");
    assertNotNull(m.getLogMessageLines());
    assertFalse(m.getLogMessageLines().isEmpty());
    assertNotNull(m.getCommentedHeaderLine());
    assertEquals(m.getCommentedHeaderLine(), "# 24/Aug/2018:12:11:50 -0500; conn=33; op=1; " + "authzDN=\"cn=Directory Manager,cn=Root DNs,cn=config\"");
    assertNotNull(m.getUncommentedHeaderLine());
    assertEquals(m.getUncommentedHeaderLine(), "24/Aug/2018:12:11:50 -0500; conn=33; op=1; " + "authzDN=\"cn=Directory Manager,cn=Root DNs,cn=config\"");
    assertNotNull(m.getTimestamp());
    final Calendar calendar = new GregorianCalendar();
    calendar.setTime(m.getTimestamp());
    assertEquals(calendar.get(Calendar.YEAR), 2018);
    assertEquals(calendar.get(Calendar.MONTH), Calendar.AUGUST);
    assertNotNull(m.getHeaderNamedValues());
    assertFalse(m.getHeaderNamedValues().isEmpty());
    assertTrue(m.getHeaderNamedValues().containsKey("conn"));
    assertNull(m.getProductName());
    assertNull(m.getInstanceName());
    assertNull(m.getStartupID());
    assertNull(m.getThreadID());
    assertNull(m.getRequesterDN());
    assertNull(m.getRequesterIPAddress());
    assertNotNull(m.getConnectionID());
    assertEquals(m.getConnectionID().longValue(), 33L);
    assertNotNull(m.getOperationID());
    assertEquals(m.getOperationID().longValue(), 1L);
    assertNull(m.getTriggeredByConnectionID());
    assertNull(m.getTriggeredByOperationID());
    assertNull(m.getReplicationChangeID());
    assertNotNull(m.getAlternateAuthorizationDN());
    assertDNsEqual(m.getAlternateAuthorizationDN(), "cn=Directory Manager,cn=Root DNs,cn=config");
    assertNull(m.getTransactionID());
    assertNull(m.getOrigin());
    assertNull(m.getUsingAdminSessionWorkerThread());
    assertNull(m.getRequestControlOIDs());
    assertNull(m.getOperationPurposeRequestControl());
    assertNull(m.getIntermediateClientRequestControl());
    assertNotNull(m.getDN());
    assertDNsEqual(m.getDN(), "ou=People,dc=example,dc=com");
    assertNull(m.getIsSubtreeDelete());
    assertNull(m.getDeletedAsPartOfSubtreeDelete());
    assertNull(m.getIsSoftDelete());
    assertNull(m.getSoftDeletedEntryDN());
    assertNull(m.getIsSoftDeletedEntry());
    assertNull(m.getDeletedEntry());
    assertNull(m.getDeletedEntryVirtualAttributes());
    assertNotNull(m.getChangeType());
    assertEquals(m.getChangeType(), ChangeType.DELETE);
    assertNotNull(m.getChangeRecord());
    assertTrue(m.getChangeRecord() instanceof LDIFDeleteChangeRecord);
    assertFalse(m.isRevertible());
    try {
        m.getRevertChangeRecords();
        fail("Expected an exception when trying to revert a non-revertible " + "delete audit log message");
    } catch (final AuditLogException e) {
    // This was expected.
    }
    assertNotNull(m.toString());
    assertNotNull(m.toMultiLineString());
}
Also used : GregorianCalendar(java.util.GregorianCalendar) Calendar(java.util.Calendar) GregorianCalendar(java.util.GregorianCalendar) LDIFDeleteChangeRecord(com.unboundid.ldif.LDIFDeleteChangeRecord) Test(org.testng.annotations.Test)

Example 28 with LDIFDeleteChangeRecord

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

the class AuditLogMessageTestCase method testMinimalLogMessage.

/**
 * Tests the behavior for a minimal audit log message.
 *
 * @throws  Exception  If an unexpected problem occurs.
 */
@Test()
public void testMinimalLogMessage() throws Exception {
    final AddAuditLogMessage m = new AddAuditLogMessage("# 23/Aug/2018:14:02:40 -0500", "dn: ou=People,dc=example,dc=com", "changetype: add", "objectClass: top", "objectClass: organizationalUnit", "ou: People", "createTimestamp: 20180823190240.967Z", "creatorsName: cn=Directory Manager,cn=Root DNs,cn=config", "modifyTimestamp: 20180823190240.967Z", "modifiersName: cn=Directory Manager,cn=Root DNs,cn=config", "entryUUID: b58849bd-2032-4077-ba10-2cd9be8166e0");
    assertNotNull(m.getLogMessageLines());
    assertFalse(m.getLogMessageLines().isEmpty());
    assertNotNull(m.getCommentedHeaderLine());
    assertTrue(m.getCommentedHeaderLine().equals("# 23/Aug/2018:14:02:40 -0500"));
    assertNotNull(m.getUncommentedHeaderLine());
    assertEquals(m.getUncommentedHeaderLine(), "23/Aug/2018:14:02:40 -0500");
    assertNotNull(m.getTimestamp());
    final Calendar calendar = new GregorianCalendar();
    calendar.setTime(m.getTimestamp());
    assertEquals(calendar.get(Calendar.YEAR), 2018);
    assertEquals(calendar.get(Calendar.MONTH), Calendar.AUGUST);
    assertNotNull(m.getHeaderNamedValues());
    assertTrue(m.getHeaderNamedValues().isEmpty());
    assertNull(m.getProductName());
    assertNull(m.getInstanceName());
    assertNull(m.getStartupID());
    assertNull(m.getThreadID());
    assertNull(m.getRequesterDN());
    assertNull(m.getRequesterIPAddress());
    assertNull(m.getConnectionID());
    assertNull(m.getOperationID());
    assertNull(m.getTriggeredByConnectionID());
    assertNull(m.getTriggeredByOperationID());
    assertNull(m.getReplicationChangeID());
    assertNull(m.getAlternateAuthorizationDN());
    assertNull(m.getTransactionID());
    assertNull(m.getOrigin());
    assertNull(m.getUsingAdminSessionWorkerThread());
    assertNull(m.getRequestControlOIDs());
    assertNull(m.getOperationPurposeRequestControl());
    assertNull(m.getIntermediateClientRequestControl());
    assertNotNull(m.getChangeType());
    assertEquals(m.getChangeType(), ChangeType.ADD);
    assertNotNull(m.getChangeRecord());
    assertTrue(m.getChangeRecord() instanceof LDIFAddChangeRecord);
    assertTrue(m.isRevertible());
    assertNotNull(m.getRevertChangeRecords());
    assertFalse(m.getRevertChangeRecords().isEmpty());
    assertEquals(m.getRevertChangeRecords().size(), 1);
    assertTrue(m.getRevertChangeRecords().get(0) instanceof LDIFDeleteChangeRecord);
    assertNotNull(m.toString());
    assertNotNull(m.toMultiLineString());
}
Also used : LDIFAddChangeRecord(com.unboundid.ldif.LDIFAddChangeRecord) Calendar(java.util.Calendar) GregorianCalendar(java.util.GregorianCalendar) GregorianCalendar(java.util.GregorianCalendar) LDIFDeleteChangeRecord(com.unboundid.ldif.LDIFDeleteChangeRecord) Test(org.testng.annotations.Test)

Example 29 with LDIFDeleteChangeRecord

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

the class AuditLogMessageTestCase method testCompleteLogMessage.

/**
 * Tests the behavior for a complete audit log message.
 *
 * @throws  Exception  If an unexpected problem occurs.
 */
@Test()
public void testCompleteLogMessage() throws Exception {
    final AddAuditLogMessage m = new AddAuditLogMessage("# 23/Aug/2018:15:05:51.615 -0500; conn=25; op=1; " + "origin=\"replication\"; productName=\"Directory Server\"; " + "instanceName=\"ReplicaOne\"; startupID=W38TQw==; threadID=8; " + "clientIP=127.0.0.1; " + "requesterDN=\"cn=Proxy User,cn=Root DNs,cn=config\"; " + "replicationChangeID=\"000001656864A77520DB00000001\"; " + "authzDN=\"cn=Directory Manager,cn=Root DNs,cn=config\"; " + "txnID=1234; usingAdminSessionWorkerThread=true; " + "isUndelete=false; " + "requestControlOIDs=\"2.16.840.1.113730.3.4.2," + "1.3.6.1.1.12,1.3.6.1.4.1.30221.2.5.19," + "1.3.6.1.4.1.30221.2.5.2\"; operationPurpose={ " + "\"applicationName\":\"Test Application\", " + "\"applicationVersion\":\"1.2.3\", " + "\"codeLocation\":\"Somewhere in the code\", " + "\"requestPurpose\":\"Just testing\" }; " + "intermediateClientRequestControl={ " + "\"clientIdentity\":\"dn:cn=Directory " + "Manager,cn=Root DNs,cn=config\", " + "\"downstreamClientAddress\":\"127.0.0.1\", " + "\"downstreamClientSecure\":false, " + "\"clientName\":\"PingDirectory\", " + "\"clientSessionID\":\"conn=8\", " + "\"clientRequestID\":\"op=1\", " + "\"downstreamRequest\":{ " + "\"clientName\":\"Unidentified Directory Application\" } }; " + "propertyNameAndValueSeparatedBySpaces = value ; " + "propertyWithValueContainingEscapedCharacters=a#22b\\;c; " + "propertyWithUnquotedValueContainingQuote=a\"b; " + "propertyWithQuotedValueContainingSpacesAndSemicolon=\" ; \" ; " + "propertyWithEmptyValue=; anotherPropertyWithEmptyValue=", "dn: ou=People,dc=example,dc=com", "changetype: add", "objectClass: top", "objectClass: organizationalUnit", "ou: People", "createTimestamp: 20180823190240.967Z", "creatorsName: cn=Directory Manager,cn=Root DNs,cn=config", "modifyTimestamp: 20180823190240.967Z", "modifiersName: cn=Directory Manager,cn=Root DNs,cn=config", "entryUUID: b58849bd-2032-4077-ba10-2cd9be8166e0");
    assertNotNull(m.getLogMessageLines());
    assertFalse(m.getLogMessageLines().isEmpty());
    assertNotNull(m.getCommentedHeaderLine());
    assertTrue(m.getCommentedHeaderLine().startsWith("# "));
    assertNotNull(m.getUncommentedHeaderLine());
    assertFalse(m.getUncommentedHeaderLine().isEmpty());
    assertFalse(m.getUncommentedHeaderLine().startsWith("# "));
    assertEquals(m.getUncommentedHeaderLine(), m.getCommentedHeaderLine().substring(2));
    assertNotNull(m.getTimestamp());
    final Calendar calendar = new GregorianCalendar();
    calendar.setTime(m.getTimestamp());
    assertEquals(calendar.get(Calendar.YEAR), 2018);
    assertEquals(calendar.get(Calendar.MONTH), Calendar.AUGUST);
    assertNotNull(m.getHeaderNamedValues());
    assertFalse(m.getHeaderNamedValues().isEmpty());
    assertTrue(m.getHeaderNamedValues().containsKey("conn"));
    assertTrue(m.getHeaderNamedValues().containsKey("propertyNameAndValueSeparatedBySpaces"));
    assertEquals(m.getHeaderNamedValues().get("propertyNameAndValueSeparatedBySpaces"), "value");
    assertTrue(m.getHeaderNamedValues().containsKey("propertyWithValueContainingEscapedCharacters"));
    assertEquals(m.getHeaderNamedValues().get("propertyWithValueContainingEscapedCharacters"), "a\"b;c");
    assertTrue(m.getHeaderNamedValues().containsKey("propertyWithUnquotedValueContainingQuote"));
    assertEquals(m.getHeaderNamedValues().get("propertyWithUnquotedValueContainingQuote"), "a\"b");
    assertTrue(m.getHeaderNamedValues().containsKey("propertyWithQuotedValueContainingSpacesAndSemicolon"));
    assertEquals(m.getHeaderNamedValues().get("propertyWithQuotedValueContainingSpacesAndSemicolon"), " ; ");
    assertTrue(m.getHeaderNamedValues().containsKey("propertyWithEmptyValue"));
    assertEquals(m.getHeaderNamedValues().get("propertyWithEmptyValue"), "");
    assertTrue(m.getHeaderNamedValues().containsKey("anotherPropertyWithEmptyValue"));
    assertEquals(m.getHeaderNamedValues().get("anotherPropertyWithEmptyValue"), "");
    assertNotNull(m.getProductName());
    assertEquals(m.getProductName(), "Directory Server");
    assertNotNull(m.getInstanceName());
    assertEquals(m.getInstanceName(), "ReplicaOne");
    assertNotNull(m.getStartupID());
    assertEquals(m.getStartupID(), "W38TQw==");
    assertNotNull(m.getThreadID());
    assertEquals(m.getThreadID().longValue(), 8);
    assertNotNull(m.getRequesterDN());
    assertDNsEqual(m.getRequesterDN(), "cn=Proxy User,cn=Root DNs,cn=config");
    assertNotNull(m.getRequesterIPAddress());
    assertEquals(m.getRequesterIPAddress(), "127.0.0.1");
    assertNotNull(m.getConnectionID());
    assertEquals(m.getConnectionID().longValue(), 25L);
    assertNotNull(m.getOperationID());
    assertEquals(m.getOperationID().longValue(), 1L);
    assertNull(m.getTriggeredByConnectionID());
    assertNull(m.getTriggeredByOperationID());
    assertNotNull(m.getReplicationChangeID());
    assertEquals(m.getReplicationChangeID(), "000001656864A77520DB00000001");
    assertNotNull(m.getAlternateAuthorizationDN());
    assertDNsEqual(m.getAlternateAuthorizationDN(), "cn=Directory Manager,cn=Root DNs,cn=config");
    assertNotNull(m.getTransactionID());
    assertEquals(m.getTransactionID(), "1234");
    assertNotNull(m.getOrigin());
    assertEquals(m.getOrigin(), "replication");
    assertNotNull(m.getUsingAdminSessionWorkerThread());
    assertEquals(m.getUsingAdminSessionWorkerThread().booleanValue(), true);
    assertNotNull(m.getRequestControlOIDs());
    assertFalse(m.getRequestControlOIDs().isEmpty());
    assertEquals(m.getRequestControlOIDs(), Arrays.asList("2.16.840.1.113730.3.4.2", "1.3.6.1.1.12", "1.3.6.1.4.1.30221.2.5.19", "1.3.6.1.4.1.30221.2.5.2"));
    assertNotNull(m.getOperationPurposeRequestControl());
    assertEquals(m.getOperationPurposeRequestControl().getApplicationName(), "Test Application");
    assertEquals(m.getOperationPurposeRequestControl().getApplicationVersion(), "1.2.3");
    assertEquals(m.getOperationPurposeRequestControl().getCodeLocation(), "Somewhere in the code");
    assertEquals(m.getOperationPurposeRequestControl().getRequestPurpose(), "Just testing");
    assertNotNull(m.getIntermediateClientRequestControl());
    assertEquals(m.getIntermediateClientRequestControl().getClientIdentity(), "dn:cn=Directory Manager,cn=Root DNs,cn=config");
    assertEquals(m.getIntermediateClientRequestControl().getDownstreamClientAddress(), "127.0.0.1");
    assertEquals(m.getIntermediateClientRequestControl().downstreamClientSecure(), Boolean.FALSE);
    assertEquals(m.getIntermediateClientRequestControl().getClientName(), "PingDirectory");
    assertEquals(m.getIntermediateClientRequestControl().getClientSessionID(), "conn=8");
    assertEquals(m.getIntermediateClientRequestControl().getClientRequestID(), "op=1");
    assertNotNull(m.getIntermediateClientRequestControl().getDownstreamRequest());
    assertEquals(m.getIntermediateClientRequestControl().getDownstreamRequest().getClientName(), "Unidentified Directory Application");
    assertNotNull(m.getDN());
    assertDNsEqual(m.getDN(), "ou=People,dc=example,dc=com");
    assertNotNull(m.getEntry());
    assertNotNull(m.getIsUndelete());
    assertEquals(m.getIsUndelete(), Boolean.FALSE);
    assertNotNull(m.getChangeType());
    assertEquals(m.getChangeType(), ChangeType.ADD);
    assertNotNull(m.getChangeRecord());
    assertTrue(m.getChangeRecord() instanceof LDIFAddChangeRecord);
    assertTrue(m.isRevertible());
    assertNotNull(m.getRevertChangeRecords());
    assertFalse(m.getRevertChangeRecords().isEmpty());
    assertEquals(m.getRevertChangeRecords().size(), 1);
    assertTrue(m.getRevertChangeRecords().get(0) instanceof LDIFDeleteChangeRecord);
    assertNotNull(m.toString());
    assertNotNull(m.toMultiLineString());
}
Also used : LDIFAddChangeRecord(com.unboundid.ldif.LDIFAddChangeRecord) Calendar(java.util.Calendar) GregorianCalendar(java.util.GregorianCalendar) GregorianCalendar(java.util.GregorianCalendar) LDIFDeleteChangeRecord(com.unboundid.ldif.LDIFDeleteChangeRecord) Test(org.testng.annotations.Test)

Example 30 with LDIFDeleteChangeRecord

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

the class ChangeLogEntryTestCase method testConstructDeleteChangeLogEntry.

/**
 * Tests the ability to construct a changelog entry for a delete operation.
 *
 * @throws  Exception  If an unexpected problem occurs.
 */
@Test()
public void testConstructDeleteChangeLogEntry() throws Exception {
    final ChangeLogEntry e = ChangeLogEntry.constructChangeLogEntry(2L, new LDIFDeleteChangeRecord("dc=example,dc=com"));
    assertNotNull(e);
    assertEquals(e.getChangeNumber(), 2L);
    assertEquals(new DN(e.getTargetDN()), new DN("dc=example,dc=com"));
    assertEquals(e.getChangeType(), ChangeType.DELETE);
    assertNull(e.getAddAttributes());
    assertNull(e.getDeletedEntryAttributes());
    assertNull(e.getModifications());
    assertNull(e.getNewRDN());
    assertNull(e.getNewSuperior());
    assertTrue(e.toLDIFChangeRecord() instanceof LDIFDeleteChangeRecord);
}
Also used : LDIFDeleteChangeRecord(com.unboundid.ldif.LDIFDeleteChangeRecord) 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