use of org.mifos.framework.components.audit.util.helpers.AuditLogView in project head by mifos.
the class AuditBusinessServiceIntegrationTest method testGetAuditLogRecordsPasswordChange.
@Test
public void testGetAuditLogRecordsPasswordChange() throws Exception {
AuditLog auditLog = new AuditLog(1, (short) 2, "Mifos", new Date(System.currentTimeMillis()), (short) 3);
Set<AuditLogRecord> auditLogRecords = new HashSet<AuditLogRecord>();
AuditLogRecord auditLogRecord = new AuditLogRecord("Password", "test_1", "new_test_1", auditLog);
auditLogRecords.add(auditLogRecord);
auditLog.addAuditLogRecords(auditLogRecords);
legacyAuditDao.save(auditLog);
AuditBusinessService auditBusinessService = new AuditBusinessService();
List<AuditLogView> auditLogViewList = auditBusinessService.getAuditLogRecords((short) 2, 1);
Assert.assertEquals(1, auditLogViewList.size());
AuditLogView auditLogView = auditLogViewList.get(0);
Assert.assertEquals(AuditConstants.HIDDEN_PASSWORD, auditLogView.getOldValue());
Assert.assertEquals(AuditConstants.HIDDEN_PASSWORD, auditLogView.getNewValue());
auditLog = getAuditLog(1, (short) 2);
}
use of org.mifos.framework.components.audit.util.helpers.AuditLogView in project head by mifos.
the class AuditInterceptorIntegrationTest method testAuditLogView.
@Test
public void testAuditLogView() {
AuditLogView auditLogView = new AuditLogView();
long currentTime = System.currentTimeMillis();
Date date = new Date(currentTime);
auditLogView.setDate(date.toString());
auditLogView.setField("field");
// auditLogView.setMfiLocale(new Locale("1"));
auditLogView.setNewValue("new value");
auditLogView.setOldValue("old value");
auditLogView.setUser("user");
Assert.assertEquals("value of date", new Date(currentTime).toString(), auditLogView.getDate());
Assert.assertEquals("value of field", "field", auditLogView.getField());
//Assert.assertEquals("value of Locale", new Locale("1"), auditLogView
// .getMfiLocale());
Assert.assertEquals("value of new value", "new value", auditLogView.getNewValue());
Assert.assertEquals("value of old value", "old value", auditLogView.getOldValue());
Assert.assertEquals("value of user", "user", auditLogView.getUser());
}
use of org.mifos.framework.components.audit.util.helpers.AuditLogView in project head by mifos.
the class SavingsServiceFacadeWebTier method retrieveSavingsAccountAuditLogs.
@Override
public List<AuditLogDto> retrieveSavingsAccountAuditLogs(Long savingsId) {
List<AuditLogDto> auditLogDtos = new ArrayList<AuditLogDto>();
AuditBusinessService auditBusinessService = new AuditBusinessService();
try {
List<AuditLogView> auditLogs = auditBusinessService.getAuditLogRecords(EntityType.SAVINGS.getValue(), savingsId.intValue());
for (AuditLogView auditLogView : auditLogs) {
auditLogDtos.add(auditLogView.toDto());
}
return auditLogDtos;
} catch (ServiceException e) {
throw new MifosRuntimeException(e);
}
}
Aggregations