use of org.entando.entando.aps.system.services.actionlog.model.ActionLogRecord in project entando-core by entando.
the class TestActionLogDAO method testGetActionRecords.
public void testGetActionRecords() {
IActionLogRecordSearchBean bean = null;
List<Integer> ids = this._actionLoggerDAO.getActionRecords(bean);
// this.compareIds(new Integer[]{}, ids);
ActionLogRecord record1 = this._helper.createActionRecord(1, "username1", "actionName1", "namespace1", DateConverter.parseDate("01/01/2009 00:00", "dd/MM/yyyy HH:mm"), "params1");
ActionLogRecord record2 = this._helper.createActionRecord(2, "username2", "actionName2", "namespace2", DateConverter.parseDate("01/01/2009 10:00", "dd/MM/yyyy HH:mm"), "params2");
ActionLogRecord record3 = this._helper.createActionRecord(3, "username123", "actionName123", "namespace123", DateConverter.parseDate("02/01/2009 12:00", "dd/MM/yyyy HH:mm"), "params123");
this._helper.addActionRecord(record1);
this._helper.addActionRecord(record2);
this._helper.addActionRecord(record3);
//
// ids = this._actionLoggerDAO.getActionRecords(bean);
// this.compareIds(new Integer[]{1, 2, 3}, ids);
ActionLogRecordSearchBean searchBean = this._helper.createSearchBean("name", "Name", "space", "arams", null, null);
ids = this._actionLoggerDAO.getActionRecords(searchBean);
this.compareIds(new Integer[] { 1, 2, 3 }, ids);
searchBean = this._helper.createSearchBean("name", "Name", "space", "arams", DateConverter.parseDate("01/01/2009 10:01", "dd/MM/yyyy HH:mm"), null);
ids = this._actionLoggerDAO.getActionRecords(searchBean);
this.compareIds(new Integer[] { 3 }, ids);
searchBean = this._helper.createSearchBean(null, null, null, null, null, DateConverter.parseDate("01/01/2009 10:01", "dd/MM/yyyy HH:mm"));
ids = this._actionLoggerDAO.getActionRecords(searchBean);
this.compareIds(new Integer[] { 1, 2 }, ids);
searchBean = this._helper.createSearchBean(null, "Name", null, null, DateConverter.parseDate("01/01/2009 09:01", "dd/MM/yyyy HH:mm"), DateConverter.parseDate("01/01/2009 10:01", "dd/MM/yyyy HH:mm"));
ids = this._actionLoggerDAO.getActionRecords(searchBean);
this.compareIds(new Integer[] { 2 }, ids);
}
use of org.entando.entando.aps.system.services.actionlog.model.ActionLogRecord in project entando-core by entando.
the class TestActionLogDAO method testAddGetDeleteActionRecord.
public void testAddGetDeleteActionRecord() {
ActionLogRecord record1 = this._helper.createActionRecord(1, "username1", "actionName1", "namespace1", DateConverter.parseDate("01/01/2009 00:00", "dd/MM/yyyy HH:mm"), "params1");
ActionLogRecord record2 = this._helper.createActionRecord(2, "username2", "actionName2", "namespace2", DateConverter.parseDate("01/02/2009 00:00", "dd/MM/yyyy HH:mm"), "params2");
this._actionLoggerDAO.addActionRecord(record1);
this._actionLoggerDAO.addActionRecord(record2);
ActionLogRecord addedRecord1 = this._actionLoggerDAO.getActionRecord(record1.getId());
this.compareActionRecords(record1, addedRecord1);
ActionLogRecord addedRecord2 = this._actionLoggerDAO.getActionRecord(record2.getId());
this.compareActionRecords(record2, addedRecord2);
this._actionLoggerDAO.deleteActionRecord(record1.getId());
assertNull(this._actionLoggerDAO.getActionRecord(record1.getId()));
this._actionLoggerDAO.deleteActionRecord(record2.getId());
assertNull(this._actionLoggerDAO.getActionRecord(record2.getId()));
}
use of org.entando.entando.aps.system.services.actionlog.model.ActionLogRecord in project entando-core by entando.
the class TestActionLogManager method testGetActionRecords.
public void testGetActionRecords() throws Throwable {
List<Integer> ids = this._actionLoggerManager.getActionRecords(null);
this.compareIds(new Integer[] {}, ids);
ActionLogRecord record1 = this._helper.createActionRecord(1, "username1", "actionName1", "namespace1", DateConverter.parseDate("01/01/2009 00:00", "dd/MM/yyyy HH:mm"), "params1");
ActionLogRecord record2 = this._helper.createActionRecord(2, "username2", "actionName2", "namespace2", DateConverter.parseDate("01/01/2009 10:00", "dd/MM/yyyy HH:mm"), "params2");
ActionLogRecord record3 = this._helper.createActionRecord(3, "username123", "actionName123", "namespace123", DateConverter.parseDate("02/01/2009 12:00", "dd/MM/yyyy HH:mm"), "params123");
this._helper.addActionRecord(record1);
this._helper.addActionRecord(record2);
this._helper.addActionRecord(record3);
ids = this._actionLoggerManager.getActionRecords(null);
this.compareIds(new Integer[] { 1, 2, 3 }, ids);
ActionLogRecordSearchBean searchBean = this._helper.createSearchBean("name", "Name", "space", "arams", null, null);
ids = this._actionLoggerManager.getActionRecords(searchBean);
this.compareIds(new Integer[] { 1, 2, 3 }, ids);
searchBean = this._helper.createSearchBean("name", "Name", "space", "arams", DateConverter.parseDate("01/01/2009 10:01", "dd/MM/yyyy HH:mm"), null);
ids = this._actionLoggerManager.getActionRecords(searchBean);
this.compareIds(new Integer[] { 3 }, ids);
searchBean = this._helper.createSearchBean(null, null, null, null, null, DateConverter.parseDate("01/01/2009 10:01", "dd/MM/yyyy HH:mm"));
ids = this._actionLoggerManager.getActionRecords(searchBean);
this.compareIds(new Integer[] { 1, 2 }, ids);
searchBean = this._helper.createSearchBean(null, "Name", null, null, DateConverter.parseDate("01/01/2009 09:01", "dd/MM/yyyy HH:mm"), DateConverter.parseDate("01/01/2009 10:01", "dd/MM/yyyy HH:mm"));
ids = this._actionLoggerManager.getActionRecords(searchBean);
this.compareIds(new Integer[] { 2 }, ids);
}
use of org.entando.entando.aps.system.services.actionlog.model.ActionLogRecord in project entando-core by entando.
the class TestActionLogManager method testAddGetDeleteActionRecord.
public void testAddGetDeleteActionRecord() throws Throwable {
ActionLogRecord record1 = this._helper.createActionRecord(0, "username1", "actionName1", "namespace1", null, "params1");
ActionLogRecord record2 = this._helper.createActionRecord(0, "username2", "actionName2", "namespace2", null, "params2");
this._actionLoggerManager.addActionRecord(record1);
this._actionLoggerManager.addActionRecord(record2);
super.waitThreads(IActionLogManager.LOG_APPENDER_THREAD_NAME_PREFIX);
ActionLogRecord addedRecord1 = this._actionLoggerManager.getActionRecord(record1.getId());
this.compareActionRecords(record1, addedRecord1);
ActionLogRecord addedRecord2 = this._actionLoggerManager.getActionRecord(record2.getId());
this.compareActionRecords(record2, addedRecord2);
this._actionLoggerManager.deleteActionRecord(record1.getId());
assertNull(this._actionLoggerManager.getActionRecord(record1.getId()));
this._actionLoggerManager.deleteActionRecord(record2.getId());
assertNull(this._actionLoggerManager.getActionRecord(record2.getId()));
}
use of org.entando.entando.aps.system.services.actionlog.model.ActionLogRecord in project entando-core by entando.
the class ActionLoggerInterceptor method intercept.
@Override
public String intercept(ActionInvocation invocation) throws Exception {
ActionLogRecord actionRecord = null;
String result = null;
try {
actionRecord = this.buildActionRecord(invocation);
result = invocation.invoke();
List<ActivityStreamInfo> asiList = null;
Object actionObject = invocation.getAction();
if (actionObject instanceof BaseAction) {
BaseAction action = (BaseAction) actionObject;
asiList = action.getActivityStreamInfos();
}
if (null == asiList || asiList.isEmpty()) {
this.getActionLoggerManager().addActionRecord(actionRecord);
} else {
for (int i = 0; i < asiList.size(); i++) {
ActivityStreamInfo asi = asiList.get(i);
ActionLogRecord clone = this.createClone(actionRecord);
clone.setActivityStreamInfo(asi);
this.getActionLoggerManager().addActionRecord(clone);
}
}
} catch (Throwable t) {
_logger.error("error in intercept", t);
// ApsSystemUtils.logThrowable(t, this, "intercept");
}
return result;
}
Aggregations