use of org.killbill.billing.client.model.AuditLogs in project killbill by killbill.
the class TestAccount method testGetAccountAuditLogs.
@Test(groups = "slow", description = "retrieve account logs")
public void testGetAccountAuditLogs() throws Exception {
final Account accountJson = createAccount();
assertNotNull(accountJson);
// generate more log data
final CustomFields customFields = new CustomFields();
customFields.add(new CustomField(null, accountJson.getAccountId(), ObjectType.ACCOUNT, "1", "value1", null));
customFields.add(new CustomField(null, accountJson.getAccountId(), ObjectType.ACCOUNT, "2", "value2", null));
customFields.add(new CustomField(null, accountJson.getAccountId(), ObjectType.ACCOUNT, "3", "value3", null));
accountApi.createAccountCustomFields(accountJson.getAccountId(), customFields, requestOptions);
final CustomFields accountCustomFields = accountApi.getAccountCustomFields(accountJson.getAccountId(), requestOptions);
assertEquals(accountCustomFields.size(), 3);
final AuditLogs auditLogsJson = accountApi.getAccountAuditLogs(accountJson.getAccountId(), requestOptions);
assertEquals(auditLogsJson.size(), 4);
assertEquals(auditLogsJson.get(0).getChangeType(), ChangeType.INSERT.toString());
assertEquals(auditLogsJson.get(0).getObjectType(), ObjectType.ACCOUNT);
assertEquals(auditLogsJson.get(0).getObjectId(), accountJson.getAccountId());
assertEquals(auditLogsJson.get(1).getChangeType(), ChangeType.INSERT.toString());
assertEquals(auditLogsJson.get(1).getObjectType(), ObjectType.CUSTOM_FIELD);
assertEquals(auditLogsJson.get(1).getObjectId(), accountCustomFields.get(0).getCustomFieldId());
assertEquals(auditLogsJson.get(2).getChangeType(), ChangeType.INSERT.toString());
assertEquals(auditLogsJson.get(2).getObjectType(), ObjectType.CUSTOM_FIELD);
assertEquals(auditLogsJson.get(2).getObjectId(), accountCustomFields.get(1).getCustomFieldId());
assertEquals(auditLogsJson.get(3).getChangeType(), ChangeType.INSERT.toString());
assertEquals(auditLogsJson.get(3).getObjectType(), ObjectType.CUSTOM_FIELD);
assertEquals(auditLogsJson.get(3).getObjectId(), accountCustomFields.get(2).getCustomFieldId());
}
Aggregations