Search in sources :

Example 21 with AuditLog

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());
}
Also used : Date(java.util.Date) AuditLog(org.ovirt.engine.core.common.businessentities.AuditLog) Test(org.junit.Test)

Example 22 with AuditLog

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());
}
Also used : AuditLog(org.ovirt.engine.core.common.businessentities.AuditLog) Test(org.junit.Test)

Example 23 with AuditLog

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());
}
Also used : AuditLog(org.ovirt.engine.core.common.businessentities.AuditLog) Test(org.junit.Test)

Example 24 with AuditLog

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);
}
Also used : AuditLog(org.ovirt.engine.core.common.businessentities.AuditLog) Test(org.junit.Test)

Example 25 with AuditLog

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));
}
Also used : Guid(org.ovirt.engine.core.compat.Guid) AuditLog(org.ovirt.engine.core.common.businessentities.AuditLog) Test(org.junit.Test)

Aggregations

AuditLog (org.ovirt.engine.core.common.businessentities.AuditLog)31 Test (org.junit.Test)13 Date (java.util.Date)6 Guid (org.ovirt.engine.core.compat.Guid)4 AuditLogSeverity (org.ovirt.engine.core.common.AuditLogSeverity)2 AbstractFullDateTimeColumn (org.ovirt.engine.ui.common.widget.table.column.AbstractFullDateTimeColumn)2 AuditLogSeverityColumn (org.ovirt.engine.ui.common.widget.table.column.AuditLogSeverityColumn)2 HasClickHandlers (com.google.gwt.event.dom.client.HasClickHandlers)1 EventBus (com.google.gwt.event.shared.EventBus)1 SafeHtmlUtils (com.google.gwt.safehtml.shared.SafeHtmlUtils)1 FlowPanel (com.google.gwt.user.client.ui.FlowPanel)1 HasData (com.google.gwt.view.client.HasData)1 Inject (com.google.inject.Inject)1 Provider (com.google.inject.Provider)1 Named (com.google.inject.name.Named)1 PresenterWidget (com.gwtplatform.mvp.client.PresenterWidget)1 View (com.gwtplatform.mvp.client.View)1 RevealRootPopupContentEvent (com.gwtplatform.mvp.client.proxy.RevealRootPopupContentEvent)1 Date (java.sql.Date)1 Collection (java.util.Collection)1