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");
}
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());
}
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);
}
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)));
}
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);
}
Aggregations