use of org.ovirt.engine.core.common.businessentities.AuditLog in project ovirt-engine by oVirt.
the class AuditLogDaoTest method testRemoveAllBeforeDate.
@Test
public void testRemoveAllBeforeDate() throws Exception {
Date cutoff = EXPECTED_DATE_FORMAT.parse("2010-12-20 13:11:00");
dao.removeAllBeforeDate(cutoff);
List<AuditLog> result = dao.getAll(PRIVILEGED_USER_ID, true);
assertEquals(1, result.size());
}
use of org.ovirt.engine.core.common.businessentities.AuditLog in project ovirt-engine by oVirt.
the class AuditLogDaoTest method testDeleteBackupRelatedAlerts.
@Test
public void testDeleteBackupRelatedAlerts() {
AuditLog entry = dao.getByOriginAndCustomEventId(AuditLog.OVIRT_ORIGIN, CUSTOM_BAKUP_EVENT_ID);
assertNotNull(entry);
assertFalse(entry.isDeleted());
dao.deleteBackupRelatedAlerts();
entry = dao.getByOriginAndCustomEventId(AuditLog.OVIRT_ORIGIN, CUSTOM_BAKUP_EVENT_ID);
assertNotNull(entry);
assertTrue(entry.isDeleted());
}
use of org.ovirt.engine.core.common.businessentities.AuditLog in project ovirt-engine by oVirt.
the class AuditLogDaoTest method testRemove.
/**
* Ensures that removing an AuditLog works as expected.
*/
@Test
public void testRemove() {
dao.remove(existingAuditLog.getAuditLogId());
AuditLog result = dao.get(existingAuditLog.getAuditLogId());
assertTrue(result.isDeleted());
}
use of org.ovirt.engine.core.common.businessentities.AuditLog in project ovirt-engine by oVirt.
the class AuditLogDaoTest method testGetWithInvalidId.
/**
* Ensures that if the id is invalid then no AuditLog is returned.
*/
@Test
public void testGetWithInvalidId() {
AuditLog result = dao.get(7);
assertNull(result);
}
use of org.ovirt.engine.core.common.businessentities.AuditLog in project ovirt-engine by oVirt.
the class GetAllAuditLogsByVMIdQueryTest method testExecuteQueryCommand.
@Test
public void testExecuteQueryCommand() {
// Mock the Query Parameters
Guid vmId = Guid.newGuid();
when(getQueryParameters().getId()).thenReturn(vmId);
// Set up the expected result
AuditLog expectedResult = new AuditLog();
expectedResult.setVmId(vmId);
// Mock the Daos
when(auditLogDaoMock.getAllByVMId(vmId, getUser().getId(), getQueryParameters().isFiltered())).thenReturn(Collections.singletonList(expectedResult));
getQuery().executeQueryCommand();
@SuppressWarnings("unchecked") List<AuditLog> result = getQuery().getQueryReturnValue().getReturnValue();
assertEquals("Wrong number of audit logs in result", 1, result.size());
assertEquals("Wrong audit log in result", expectedResult, result.get(0));
}
Aggregations