Search in sources :

Example 16 with AuditLog

use of org.ovirt.engine.core.common.businessentities.AuditLog in project ovirt-engine by oVirt.

the class EventListModelTable method initTable.

@Override
public void initTable() {
    getTable().enableColumnResizing();
    AuditLogSeverityColumn severityColumn = new AuditLogSeverityColumn();
    severityColumn.setContextMenuTitle(constants.severityEvent());
    // $NON-NLS-1$
    getTable().addColumn(severityColumn, constants.empty(), "20px");
    AbstractTextColumn<AuditLog> logTimeColumn = new AbstractFullDateTimeColumn<AuditLog>() {

        @Override
        protected Date getRawValue(AuditLog object) {
            return object.getLogTime();
        }
    };
    logTimeColumn.makeSortable(AuditLogConditionFieldAutoCompleter.TIME);
    // $NON-NLS-1$
    getTable().addColumn(logTimeColumn, constants.timeEvent(), "170px");
    AbstractTextColumn<AuditLog> messageColumn = new AbstractTextColumn<AuditLog>() {

        @Override
        public String getValue(AuditLog object) {
            return object.getMessage();
        }
    };
    messageColumn.makeSortable(AuditLogConditionFieldAutoCompleter.MESSAGE);
    // $NON-NLS-1$
    getTable().addColumn(messageColumn, constants.messageEvent(), "600px");
    AbstractTextColumn<AuditLog> correlationIdColumn = new AbstractTextColumn<AuditLog>() {

        @Override
        public String getValue(AuditLog object) {
            return object.getCorrelationId();
        }
    };
    correlationIdColumn.makeSortable(AuditLogConditionFieldAutoCompleter.CORRELATION_ID);
    // $NON-NLS-1$
    getTable().addColumn(correlationIdColumn, constants.correltaionIdEvent(), "100px");
    AbstractTextColumn<AuditLog> originColumn = new AbstractTextColumn<AuditLog>() {

        @Override
        public String getValue(AuditLog object) {
            return object.getOrigin();
        }
    };
    originColumn.makeSortable(AuditLogConditionFieldAutoCompleter.ORIGIN);
    // $NON-NLS-1$
    getTable().addColumn(originColumn, constants.originEvent(), "100px");
    AbstractTextColumn<AuditLog> customEventIdColumn = new AbstractTextColumn<AuditLog>() {

        @Override
        public String getValue(AuditLog object) {
            int id = object.getCustomEventId();
            // $NON-NLS-1$
            return id >= 0 ? String.valueOf(id) : "";
        }
    };
    customEventIdColumn.makeSortable(AuditLogConditionFieldAutoCompleter.CUSTOM_EVENT_ID);
    // $NON-NLS-1$
    getTable().addColumn(customEventIdColumn, constants.customEventIdEvent(), "120px");
}
Also used : AbstractFullDateTimeColumn(org.ovirt.engine.ui.common.widget.table.column.AbstractFullDateTimeColumn) AbstractTextColumn(org.ovirt.engine.ui.common.widget.table.column.AbstractTextColumn) AuditLogSeverityColumn(org.ovirt.engine.ui.common.widget.table.column.AuditLogSeverityColumn) AuditLog(org.ovirt.engine.core.common.businessentities.AuditLog)

Example 17 with AuditLog

use of org.ovirt.engine.core.common.businessentities.AuditLog in project ovirt-engine by oVirt.

the class AuditLogDaoTest method testSaveExternalEvent.

@Test
public void testSaveExternalEvent() {
    AuditLog newExternalEvent = new AuditLog();
    newExternalEvent.setLogType(AuditLogType.EXTERNAL_EVENT_NORMAL);
    newExternalEvent.setExternal(true);
    newExternalEvent.setOrigin("XYZ");
    newExternalEvent.setCustomEventId(123123123);
    newExternalEvent.setCustomData("Some text here");
    newExternalEvent.setMessage("And here");
    newExternalEvent.setEventFloodInSec(100);
    dao.save(newExternalEvent);
    AuditLog result = dao.get(newExternalEvent.getAuditLogId());
    assertNotNull(result);
    assertTrue(result.getAuditLogId() > 0);
    assertEquals(newExternalEvent.getOrigin(), result.getOrigin());
    assertEquals(newExternalEvent.getCustomEventId(), result.getCustomEventId());
    assertEquals(newExternalEvent.getCustomData(), result.getCustomData());
    assertEquals(newExternalEvent.getMessage(), result.getMessage());
    assertEquals(newExternalEvent.getEventFloodInSec(), result.getEventFloodInSec());
}
Also used : AuditLog(org.ovirt.engine.core.common.businessentities.AuditLog) Test(org.junit.Test)

Example 18 with AuditLog

use of org.ovirt.engine.core.common.businessentities.AuditLog in project ovirt-engine by oVirt.

the class AuditLogDaoTest method setUp.

@Override
@Before
public void setUp() throws Exception {
    super.setUp();
    dao = dbFacade.getAuditLogDao();
    // create some test data
    newAuditLog = new AuditLog();
    newAuditLog.setAuditLogId(44000);
    newAuditLog.setUserId(new Guid("9bf7c640-b620-456f-a550-0348f366544b"));
    newAuditLog.setUserName("userportal3");
    newAuditLog.setVmId(VM_ID);
    newAuditLog.setVmName(VM_NAME);
    newAuditLog.setVmTemplateId(VM_TEMPLATE_ID);
    newAuditLog.setVmTemplateName(VM_TEMPLATE_NAME);
    newAuditLog.setVdsId(FixturesTool.VDS_RHEL6_NFS_SPM);
    newAuditLog.setVdsName(FixturesTool.GLUSTER_SERVER_NAME3);
    newAuditLog.setLogTime(EXPECTED_DATE_FORMAT.parse("2010-12-22 14:00:00"));
    newAuditLog.setLogType(AuditLogType.IRS_DISK_SPACE_LOW_ERROR);
    newAuditLog.setSeverity(AuditLogSeverity.ERROR);
    newAuditLog.setMessage("Critical, Low disk space.  domain has 1 GB of free space");
    newAuditLog.setStoragePoolId(FixturesTool.DATA_CENTER);
    newAuditLog.setStoragePoolName("rhel6.iscsi");
    newAuditLog.setStorageDomainId(FixturesTool.STORAGE_DOMAIN_SCALE_SD5);
    newAuditLog.setStorageDomainName("fDMzhE-wx3s-zo3q-Qcxd-T0li-yoYU-QvVePk");
    newAuditLog.setQuotaId(FixturesTool.DEFAULT_QUOTA_GENERAL);
    newAuditLog.setQuotaName("General Quota");
    newAuditLog.setGlusterVolumeId(new Guid("0e0abdbc-2a0f-4df0-8b99-cc577a7a9bb5"));
    newAuditLog.setGlusterVolumeName("gluster_volume_name-1");
    existingAuditLog = dao.get(EXISTING_ENTRY_ID);
    externalAuditLog = dao.get(EXTERNAL_ENTRY_ID);
}
Also used : Guid(org.ovirt.engine.core.compat.Guid) AuditLog(org.ovirt.engine.core.common.businessentities.AuditLog) Before(org.junit.Before)

Example 19 with AuditLog

use of org.ovirt.engine.core.common.businessentities.AuditLog in project ovirt-engine by oVirt.

the class AuditLogDaoTest method testMultipleAlertsWithSameTypeAndHostAreSavedIfRepeatableTrue.

/**
 * Checks if multiple alerts of the same type for the same host are saved if repeatable is set to {@code true}
 */
@Test
public void testMultipleAlertsWithSameTypeAndHostAreSavedIfRepeatableTrue() {
    AuditLog entry = new AuditLog(AuditLogType.VDS_ALERT_FENCE_DISABLED_BY_CLUSTER_POLICY, AuditLogSeverity.ALERT);
    entry.setVdsId(FixturesTool.VDS_RHEL6_NFS_SPM);
    entry.setVdsName(FixturesTool.GLUSTER_SERVER_NAME3);
    entry.setMessage("Testing alert");
    entry.setRepeatable(true);
    // test if no alert of the same type for the same host exists
    assertEquals(0L, getAlertCount(entry, dao.getAll(null, false)));
    dao.save(entry);
    AuditLog savedAlert = dao.get(entry.getAuditLogId());
    assertNotNull(savedAlert);
    // test if 1st alert was stored in db
    assertEquals(1L, getAlertCount(entry, dao.getAll(null, false)));
    // try to save 2nd alert
    entry.setLogTime(new Date());
    dao.save(entry);
    savedAlert = dao.get(entry.getAuditLogId());
    assertNotNull(savedAlert);
    // test if 2nd alert was also stored in db
    assertEquals(2L, getAlertCount(entry, dao.getAll(null, false)));
}
Also used : AuditLog(org.ovirt.engine.core.common.businessentities.AuditLog) Date(java.util.Date) Test(org.junit.Test)

Example 20 with AuditLog

use of org.ovirt.engine.core.common.businessentities.AuditLog in project ovirt-engine by oVirt.

the class AuditLogDaoTest method testGet.

/**
 * Ensures that, if the id is valid, then retrieving a AuditLog works as expected.
 */
@Test
public void testGet() {
    AuditLog result = dao.get(44291);
    assertNotNull(result);
    assertEquals(existingAuditLog, result);
}
Also used : 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