Search in sources :

Example 6 with TableName

use of org.killbill.billing.util.dao.TableName in project killbill by killbill.

the class TestDefaultAuditLog method testEquals.

@Test(groups = "fast")
public void testEquals() throws Exception {
    final TableName tableName = TableName.ACCOUNT_EMAIL_HISTORY;
    final long recordId = Long.MAX_VALUE;
    final ChangeType changeType = ChangeType.DELETE;
    final EntityAudit entityAudit = new EntityAudit(tableName, recordId, changeType, null);
    final UUID tenantId = UUID.randomUUID();
    final String userName = UUID.randomUUID().toString();
    final CallOrigin callOrigin = CallOrigin.EXTERNAL;
    final UserType userType = UserType.CUSTOMER;
    final UUID userToken = UUID.randomUUID();
    final ClockMock clock = new ClockMock();
    final CallContext callContext = new DefaultCallContext(tenantId, userName, callOrigin, userType, userToken, clock);
    final AuditLogModelDao auditLog = new AuditLogModelDao(entityAudit, callContext);
    Assert.assertEquals(auditLog, auditLog);
    final AuditLogModelDao sameAuditLog = new AuditLogModelDao(entityAudit, callContext);
    Assert.assertEquals(sameAuditLog, auditLog);
    clock.addMonths(1);
    final CallContext otherCallContext = new DefaultCallContext(tenantId, userName, callOrigin, userType, userToken, clock);
    final AuditLogModelDao otherAuditLog = new AuditLogModelDao(entityAudit, otherCallContext);
    Assert.assertNotEquals(otherAuditLog, auditLog);
}
Also used : EntityAudit(org.killbill.billing.util.dao.EntityAudit) TableName(org.killbill.billing.util.dao.TableName) DefaultCallContext(org.killbill.billing.callcontext.DefaultCallContext) AuditLogModelDao(org.killbill.billing.util.audit.dao.AuditLogModelDao) CallOrigin(org.killbill.billing.util.callcontext.CallOrigin) ClockMock(org.killbill.clock.ClockMock) UUID(java.util.UUID) UserType(org.killbill.billing.util.callcontext.UserType) CallContext(org.killbill.billing.util.callcontext.CallContext) DefaultCallContext(org.killbill.billing.callcontext.DefaultCallContext) Test(org.testng.annotations.Test)

Example 7 with TableName

use of org.killbill.billing.util.dao.TableName in project killbill by killbill.

the class TestDefaultAuditUserApi method beforeClass.

@Override
@BeforeClass(groups = "fast")
public void beforeClass() throws Exception {
    super.beforeClass();
    auditLogs = ImmutableList.<AuditLog>of(createAuditLog(), createAuditLog(), createAuditLog(), createAuditLog());
    objectIds = ImmutableList.<UUID>of(UUID.randomUUID(), UUID.randomUUID(), UUID.randomUUID(), UUID.randomUUID());
    for (final TableName tableName : TableName.values()) {
        for (final UUID objectId : objectIds) {
            for (final AuditLog auditLog : auditLogs) {
                ((MockAuditDao) auditDao).addAuditLogForId(tableName, objectId, auditLog);
            }
        }
    }
}
Also used : TableName(org.killbill.billing.util.dao.TableName) MockAuditDao(org.killbill.billing.util.audit.dao.MockAuditDao) UUID(java.util.UUID) AuditLog(org.killbill.billing.util.audit.AuditLog) BeforeClass(org.testng.annotations.BeforeClass)

Aggregations

TableName (org.killbill.billing.util.dao.TableName)7 UUID (java.util.UUID)4 AuditLog (org.killbill.billing.util.audit.AuditLog)4 EntityAudit (org.killbill.billing.util.dao.EntityAudit)4 DefaultAuditLog (org.killbill.billing.util.audit.DefaultAuditLog)3 AuditLogModelDao (org.killbill.billing.util.audit.dao.AuditLogModelDao)3 Test (org.testng.annotations.Test)3 DefaultCallContext (org.killbill.billing.callcontext.DefaultCallContext)2 CallContext (org.killbill.billing.util.callcontext.CallContext)2 CallOrigin (org.killbill.billing.util.callcontext.CallOrigin)2 UserType (org.killbill.billing.util.callcontext.UserType)2 ClockMock (org.killbill.clock.ClockMock)2 ImmutableList (com.google.common.collect.ImmutableList)1 HashMap (java.util.HashMap)1 List (java.util.List)1 Map (java.util.Map)1 ObjectType (org.killbill.billing.ObjectType)1 InternalCallContext (org.killbill.billing.callcontext.InternalCallContext)1 ChangeType (org.killbill.billing.util.audit.ChangeType)1 DefaultAccountAuditLogsForObjectType (org.killbill.billing.util.audit.DefaultAccountAuditLogsForObjectType)1