com.evolveum.midpoint.task.api.TaskManager.getTaskWithResult()方法的使用及代码示例

x33g5p2x  于2022-01-30 转载在 其他  
字(8.6k)|赞(0)|评价(0)|浏览(132)

本文整理了Java中com.evolveum.midpoint.task.api.TaskManager.getTaskWithResult()方法的一些代码示例,展示了TaskManager.getTaskWithResult()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。TaskManager.getTaskWithResult()方法的具体详情如下:
包路径:com.evolveum.midpoint.task.api.TaskManager
类名称:TaskManager
方法名:getTaskWithResult

TaskManager.getTaskWithResult介绍

暂无

代码示例

代码示例来源:origin: Evolveum/midpoint

protected OperationResult waitForTaskNextRun(final String taskOid, final boolean checkSubresult, final int timeout, boolean kickTheTask) throws Exception {
  final OperationResult waitResult = new OperationResult(AbstractIntegrationTest.class+".waitForTaskNextRun");
  Task origTask = taskManager.getTaskWithResult(taskOid, waitResult);
  return waitForTaskNextRun(origTask, checkSubresult, timeout, waitResult, kickTheTask);
}

代码示例来源:origin: Evolveum/midpoint

protected OperationResult waitForTaskTreeNextFinishedRun(String rootTaskOid, int timeout) throws Exception {
  final OperationResult waitResult = new OperationResult(AbstractIntegrationTest.class+".waitForTaskTreeNextFinishedRun");
  Task origRootTask = taskManager.getTaskWithResult(rootTaskOid, waitResult);
  return waitForTaskTreeNextFinishedRun(origRootTask, timeout, waitResult);
}

代码示例来源:origin: Evolveum/midpoint

protected void suspendTask(String taskOid) throws CommonException {
  final OperationResult result = new OperationResult(AbstractIntegrationTest.class+".suspendTask");
  Task task = taskManager.getTaskWithResult(taskOid, result);
  LOGGER.info("Suspending task {}", taskOid);
  taskManager.suspendTaskQuietly(task, 3000, result);
}

代码示例来源:origin: Evolveum/midpoint

@Override
public boolean check() throws CommonException {
  Task freshTask = taskManager.getTaskWithResult(taskOid, waitResult);
  OperationResult result = freshTask.getResult();
  if (verbose) display("Check result", result);
  assert !isError(result, checkSubresult) : "Error in "+freshTask+": "+TestUtil.getErrorMessage(result);
  if (isUnknown(result, checkSubresult)) {
    return false;
  }
  return freshTask.getLastRunStartTimestamp() != null;
}
@Override

代码示例来源:origin: Evolveum/midpoint

@Override
  public void timeout() {
    try {
      Task freshTask = taskManager.getTaskWithResult(taskOid, waitResult);
      OperationResult result = freshTask.getResult();
      LOGGER.debug("Result of timed-out task:\n{}", result.debugDump());
      assert false : "Timeout ("+timeout+") while waiting for "+freshTask+" to start. Last result "+result;
    } catch (ObjectNotFoundException | SchemaException e) {
      LOGGER.error("Exception during task refresh: {}", e, e);
    }
  }
};

代码示例来源:origin: Evolveum/midpoint

@Override
public boolean check() throws CommonException {
  Task task = taskManager.getTaskWithResult(taskOid, waitResult);
  waitResult.summarize();
  display("Task execution status = " + task.getExecutionStatus());
  return task.getExecutionStatus() == TaskExecutionStatus.CLOSED
      || task.getExecutionStatus() == TaskExecutionStatus.SUSPENDED;
}
@Override

代码示例来源:origin: Evolveum/midpoint

@Override
  public void timeout() {
    Task task = null;
    try {
      task = taskManager.getTaskWithResult(taskOid, waitResult);
    } catch (ObjectNotFoundException|SchemaException e) {
      LOGGER.error("Exception during task refresh: {}", e,e);
    }
    OperationResult result = null;
    if (task != null) {
      result = task.getResult();
      LOGGER.debug("Result of timed-out task:\n{}", result.debugDump());
    }
    assert false : "Timeout ("+timeout+") while waiting for "+taskOid+" to close or suspend. Last result "+result;
  }
};

代码示例来源:origin: Evolveum/midpoint

@Override
    public boolean check() throws CommonException {
      freshTask = taskManager.getTaskWithResult(taskOid, waitResult);
      OperationResult result = freshTask.getResult();
      if (verbose) display("Check result", result);
      if (isError(result, checkSubresult)) {
        if (errorOk) {
          return true;
        } else {
          AssertJUnit.fail("Error in "+freshTask+": "+TestUtil.getErrorMessage(result));
        }
      }
      if (isUnknown(result, checkSubresult)) {
        return false;
      }
//            assert !isUnknown(result, checkSubresult) : "Unknown result in "+freshTask+": "+IntegrationTestTools.getErrorMessage(result);
      return !isInProgress(result, checkSubresult);
    }

代码示例来源:origin: Evolveum/midpoint

@Override
public void timeout() {
  try {
    Task freshTask = taskManager.getTaskWithResult(taskOid, waitResult);
    OperationResult result = freshTask.getResult();
    LOGGER.debug("Result of timed-out task:\n{}", result.debugDump());
    assert false : "Timeout ("+timeout+") while waiting for "+freshTask+" to finish. Last result "+result;
  } catch (ObjectNotFoundException e) {
    LOGGER.error("Exception during task refresh: {}", e,e);
  } catch (SchemaException e) {
    LOGGER.error("Exception during task refresh: {}", e,e);
  }
}

代码示例来源:origin: Evolveum/midpoint

private void notifyMidpointAboutProcessEvent(ProcessEvent event) {
  OperationResult result = new OperationResult(DOT_CLASS + "notifyMidpointAboutProcessEvent");
  String taskOid = ActivitiUtil.getTaskOid(event.getVariables());
  Task task;
  try {
    task = taskManager.getTaskWithResult(taskOid, result);
  } catch (ObjectNotFoundException|SchemaException|RuntimeException e) {
    throw new SystemException("Couldn't get task " + taskOid + " from repository: " + e.getMessage(), e);
  }
  if (task.getExecutionStatus() != TaskExecutionStatus.WAITING) {
    LOGGER.trace("Asynchronous message received in a state different from WAITING (actual state: {}), ignoring it. Task = {}", task.getExecutionStatus(), task);
    return;
  }
  try {
    wfTaskController.onProcessEvent(event, false, task, result);
  } catch (SchemaException|ObjectNotFoundException|ObjectAlreadyExistsException|RuntimeException e) {
    throw new SystemException("Couldn't process a process-related event: " + e.getMessage(), e);
  }
}

代码示例来源:origin: Evolveum/midpoint

Task task = taskManager.getTaskWithResult(taskOid, result);
LOGGER.info("Restarting task {}", taskOid);
if (task.getExecutionStatus() == TaskExecutionStatus.SUSPENDED) {

代码示例来源:origin: Evolveum/midpoint

@Override
      public boolean check() throws CommonException {
        Task freshTask = taskManager.getTaskWithResult(origTask.getOid(), waitResult);
        OperationResult taskResult = freshTask.getResult();
//                display("Times", longTimeToString(origLastRunStartTimestamp) + "-" + longTimeToString(origLastRunStartTimestamp)
//                        + " : " + longTimeToString(freshTask.getLastRunStartTimestamp()) + "-" + longTimeToString(freshTask.getLastRunFinishTimestamp()));
        if (verbose) display("Check result", taskResult);
        taskResultHolder.setValue(taskResult);
        if (isError(taskResult, checkSubresult)) {
          return true;
        }
        if (isUnknown(taskResult, checkSubresult)) {
          return false;
        }
        if (freshTask.getLastRunFinishTimestamp() == null) {
          return false;
        }
        if (freshTask.getLastRunStartTimestamp() == null) {
          return false;
        }
        return !freshTask.getLastRunStartTimestamp().equals(origLastRunStartTimestamp)
            && !freshTask.getLastRunFinishTimestamp().equals(origLastRunFinishTimestamp)
            && freshTask.getLastRunStartTimestamp() < freshTask.getLastRunFinishTimestamp();
      }
      @Override

代码示例来源:origin: Evolveum/midpoint

@Override
  public void timeout() {
    try {
      Task freshTask = taskManager.getTaskWithResult(origTask.getOid(), waitResult);
      OperationResult result = freshTask.getResult();
      LOGGER.debug("Timed-out task:\n{}", freshTask.debugDump());
      display("Times", "origLastRunStartTimestamp="+longTimeToString(origLastRunStartTimestamp)
      + ", origLastRunFinishTimestamp=" + longTimeToString(origLastRunFinishTimestamp)
      + ", freshTask.getLastRunStartTimestamp()=" + longTimeToString(freshTask.getLastRunStartTimestamp())
      + ", freshTask.getLastRunFinishTimestamp()=" + longTimeToString(freshTask.getLastRunFinishTimestamp()));
      assert false : "Timeout ("+timeout+") while waiting for "+freshTask+" next run. Last result "+result;
    } catch (ObjectNotFoundException | SchemaException e) {
      LOGGER.error("Exception during task refresh: {}", e, e);
    }
  }
};

代码示例来源:origin: Evolveum/midpoint

OperationResult aggregateResult = new OperationResult("aggregate");
Checker checker = () -> {
  Task freshRootTask = taskManager.getTaskWithResult(origRootTask.getOid(), waitResult);
IntegrationTestTools.waitFor("Waiting for task tree " + origRootTask + " next finished run", checker, timeout, DEFAULT_TASK_SLEEP_TIME);
Task freshTask = taskManager.getTaskWithResult(origRootTask.getOid(), waitResult);
LOGGER.debug("Final root task:\n{}", freshTask.debugDump());
aggregateResult.computeStatusIfUnknown();

代码示例来源:origin: Evolveum/midpoint

IntegrationTestTools.waitFor("Waiting for task " + origTask + " next run", checker, timeout, DEFAULT_TASK_SLEEP_TIME);
Task freshTask = taskManager.getTaskWithResult(origTask.getOid(), waitResult);
LOGGER.debug("Final task:\n{}", freshTask.debugDump());
display("Times", "origLastRunStartTimestamp="+longTimeToString(origLastRunStartTimestamp)

相关文章