コード例 #1
0
  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()));
  }
コード例 #2
0
 private void compareActionRecords(ActionLogRecord expected, ActionLogRecord received) {
   assertEquals(expected.getId(), received.getId());
   assertEquals(expected.getUsername(), received.getUsername());
   assertEquals(expected.getActionName(), received.getActionName());
   assertEquals(expected.getNamespace(), received.getNamespace());
   assertEquals(expected.getParameters(), received.getParameters());
   assertEquals(
       DateConverter.getFormattedDate(expected.getActionDate(), "ddMMyyyyHHmm"),
       DateConverter.getFormattedDate(received.getActionDate(), "ddMMyyyyHHmm"));
 }