本文整理了Java中org.camunda.bpm.engine.runtime.Job.getDuedate()
方法的一些代码示例,展示了Job.getDuedate()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Job.getDuedate()
方法的具体详情如下:
包路径:org.camunda.bpm.engine.runtime.Job
类名称:Job
方法名:getDuedate
[英]Returns the date on which this job is supposed to be processed.
[中]返回处理此作业的日期。
代码示例来源:origin: camunda/camunda-bpm-platform
public boolean areJobsAvailable() {
List<Job> list = managementService.createJobQuery().list();
for (Job job : list) {
if (!job.isSuspended() && job.getRetries() > 0 && (job.getDuedate() == null || ClockUtil.getCurrentTime().after(job.getDuedate()))) {
return true;
}
}
return false;
}
代码示例来源:origin: camunda/camunda-bpm-platform
public boolean areJobsAvailable() {
List<Job> list = managementService.createJobQuery().list();
for (Job job : list) {
if (!job.isSuspended() && job.getRetries() > 0 && (job.getDuedate() == null || ClockUtil.getCurrentTime().after(job.getDuedate()))) {
return true;
}
}
return false;
}
代码示例来源:origin: camunda/camunda-bpm-platform
public boolean isJobAvailable(Job job) {
return job.getRetries() > 0 && (job.getDuedate() == null || ClockUtil.getCurrentTime().after(job.getDuedate()));
}
代码示例来源:origin: camunda/camunda-bpm-platform
public void assertJobMigrated(Job jobBefore, String activityIdAfter) {
assertJobMigrated(jobBefore, activityIdAfter, jobBefore.getDuedate());
}
代码示例来源:origin: camunda/camunda-bpm-platform
protected boolean areJobsAvailable() {
List<Job> list = processEngine.getManagementService().createJobQuery().list();
for (Job job : list) {
if (!job.isSuspended() && job.getRetries() > 0 && (job.getDuedate() == null || ClockUtil.getCurrentTime().after(job.getDuedate()))) {
return true;
}
}
return false;
}
代码示例来源:origin: camunda/camunda-bpm-platform
@Test
public void testScheduleJobForBatchWindow() throws ParseException {
ClockUtil.setCurrentTime(currentDate);
processEngineConfiguration.setHistoryCleanupBatchWindowStartTime(startTime);
processEngineConfiguration.setHistoryCleanupBatchWindowEndTime(endTime);
processEngineConfiguration.initHistoryCleanup();
Job job = historyService.cleanUpHistoryAsync();
assertFalse(startDateForCheck.after(job.getDuedate())); // job due date is not before start date
assertTrue(endDateForCheck.after(job.getDuedate()));
}
}
代码示例来源:origin: camunda/camunda-bpm-platform
private Date testExpression(String timeExpression) {
// Set the clock fixed
HashMap<String, Object> variables1 = new HashMap<String, Object>();
variables1.put("dueDate", timeExpression);
// After process start, there should be timer created
ProcessInstance pi1 = runtimeService.startProcessInstanceByKey("intermediateTimerEventExample", variables1);
assertEquals(1, managementService.createJobQuery().processInstanceId(pi1.getId()).count());
List<Job> jobs = managementService.createJobQuery().executable().list();
assertEquals(1, jobs.size());
return jobs.get(0).getDuedate();
}
代码示例来源:origin: camunda/camunda-bpm-platform
@Test
@Deployment(resources = "org/camunda/bpm/engine/test/jobexecutor/simpleAsyncProcess.bpmn20.xml")
public void testMessageJobHasDueDateSet() {
runtimeService.startProcessInstanceByKey("simpleAsyncProcess");
Job job = managementService.createJobQuery().singleResult();
assertNotNull(job.getDuedate());
assertEquals(ClockUtil.getCurrentTime(), job.getDuedate());
}
代码示例来源:origin: camunda/camunda-bpm-platform
@Test
@Deployment(resources = "org/camunda/bpm/engine/test/jobexecutor/simpleAsyncProcess.bpmn20.xml")
public void testMessageJobHasDueDateSet() {
runtimeService.startProcessInstanceByKey("simpleAsyncProcess");
Job job = managementService.createJobQuery().singleResult();
assertNotNull(job.getDuedate());
assertEquals(ClockUtil.getCurrentTime(), job.getDuedate());
}
代码示例来源:origin: camunda/camunda-bpm-platform
private Date testExpression(String timeExpression) {
// Set the clock fixed
HashMap<String, Object> variables1 = new HashMap<String, Object>();
variables1.put("dueDate", timeExpression);
// After process start, there should be timer created
ProcessInstance pi1 = runtimeService.startProcessInstanceByKey("intermediateTimerEventExample", variables1);
Assert.assertEquals(1, managementService.createJobQuery().processInstanceId(pi1.getId()).count());
List<Job> jobs = managementService.createJobQuery().executable().list();
Assert.assertEquals(1, jobs.size());
runtimeService.deleteProcessInstance(pi1.getId(), "test");
return jobs.get(0).getDuedate();
}
代码示例来源:origin: camunda/camunda-bpm-platform
@Test
@OperateOnDeployment("app")
public void testInvokeProcessApplicationWithContextOnAsyncExecution() {
runtimeService.startProcessInstanceByKey("timerProcess");
ProcessApplicationWithInvocationContext.clearInvocationContext();
Job timer = managementService.createJobQuery().timers().singleResult();
assertThat(timer, is(notNullValue()));
long dueDate = timer.getDuedate().getTime();
Date afterDueDate = new Date(dueDate + 1000 * 60);
ClockUtil.setCurrentTime(afterDueDate);
waitForJobExecutorToProcessAllJobs();
InvocationContext invocationContext = ProcessApplicationWithInvocationContext.getInvocationContext();
assertThat(invocationContext, is(notNullValue()));
assertThat(invocationContext.getExecution(), is(notNullValue()));
assertThat(invocationContext.getExecution().getId(), is(timer.getExecutionId()));
}
代码示例来源:origin: camunda/camunda-bpm-platform
public void assertJobMigrated(String activityIdBefore, String activityIdAfter, String handlerType) {
JobDefinition jobDefinitionBefore = snapshotBeforeMigration.getJobDefinitionForActivityIdAndType(activityIdBefore, handlerType);
assertNotNull("Expected that a job definition for activity '" + activityIdBefore + "' exists before migration", jobDefinitionBefore);
Job jobBefore = snapshotBeforeMigration.getJobForDefinitionId(jobDefinitionBefore.getId());
assertNotNull("Expected that a timer job for activity '" + activityIdBefore + "' exists before migration", jobBefore);
assertJobMigrated(jobBefore, activityIdAfter, jobBefore.getDuedate());
}
代码示例来源:origin: camunda/camunda-bpm-platform
@Test
@Deployment(resources = "org/camunda/bpm/engine/test/jobexecutor/simpleAsyncProcess.bpmn20.xml")
public void testMessageJobHasNoDueDateSet() {
configuration.setEnsureJobDueDateNotNull(false);
runtimeService.startProcessInstanceByKey("simpleAsyncProcess");
Job job = managementService.createJobQuery().singleResult();
assertNull(job.getDuedate());
}
代码示例来源:origin: camunda/camunda-bpm-platform
public void testSetJobDueDateWithUpdatePermissionOnAnyProcessInstance() {
// given
String processInstanceId = startProcessInstanceByKey(TIMER_BOUNDARY_PROCESS_KEY).getId();
createGrantAuthorization(PROCESS_INSTANCE, ANY, userId, UPDATE);
String jobId = selectJobByProcessInstanceId(processInstanceId).getId();
// when
managementService.setJobDuedate(jobId, null);
// then
Job job = selectJobById(jobId);
assertNull(job.getDuedate());
}
代码示例来源:origin: camunda/camunda-bpm-platform
public void testSetJobDueDateWithUpdateInstancePermissionOnAnyProcessDefinition() {
// given
String processInstanceId = startProcessInstanceByKey(TIMER_BOUNDARY_PROCESS_KEY).getId();
createGrantAuthorization(PROCESS_DEFINITION, ANY, userId, UPDATE_INSTANCE);
String jobId = selectJobByProcessInstanceId(processInstanceId).getId();
// when
managementService.setJobDuedate(jobId, null);
// then
Job job = selectJobById(jobId);
assertNull(job.getDuedate());
}
代码示例来源:origin: camunda/camunda-bpm-platform
@Test
@Deployment(resources = "org/camunda/bpm/engine/test/jobexecutor/simpleAsyncProcess.bpmn20.xml")
public void testMessageJobHasDueDateSet() {
configuration.setEnsureJobDueDateNotNull(true);
runtimeService.startProcessInstanceByKey("simpleAsyncProcess");
Job job = managementService.createJobQuery().singleResult();
// time is fixed for the purposes of the test
assertEquals(ClockUtil.getCurrentTime(), job.getDuedate());
}
代码示例来源:origin: camunda/camunda-bpm-platform
public void testSetJobDueDateWithUpdatePermissionOnProcessInstance() {
// given
String processInstanceId = startProcessInstanceByKey(TIMER_BOUNDARY_PROCESS_KEY).getId();
createGrantAuthorization(PROCESS_INSTANCE, processInstanceId, userId, UPDATE);
String jobId = selectJobByProcessInstanceId(processInstanceId).getId();
// when
managementService.setJobDuedate(jobId, null);
// then
Job job = selectJobById(jobId);
assertNull(job.getDuedate());
}
代码示例来源:origin: camunda/camunda-bpm-platform
@Deployment(resources = "org/camunda/bpm/engine/test/bpmn/job/oneTaskProcess.bpmn20.xml")
public void testSetJobDuedateNonTimerJob(){
runtimeService.startProcessInstanceByKey("oneTaskProcess");
Job job = managementService.createJobQuery().processDefinitionKey("oneTaskProcess").singleResult();
assertNotNull(job);
managementService.setJobDuedate(job.getId(), new Date());
job = managementService.createJobQuery().processDefinitionKey("oneTaskProcess").singleResult();
assertNotNull(job.getDuedate());
}
代码示例来源:origin: camunda/camunda-bpm-platform
public void testSetJobDueDateWithUpdateInstancePermissionOnTimerBoundaryProcessDefinition() {
// given
String processInstanceId = startProcessInstanceByKey(TIMER_BOUNDARY_PROCESS_KEY).getId();
createGrantAuthorization(PROCESS_DEFINITION, TIMER_BOUNDARY_PROCESS_KEY, userId, UPDATE_INSTANCE);
String jobId = selectJobByProcessInstanceId(processInstanceId).getId();
// when
managementService.setJobDuedate(jobId, null);
// then
Job job = selectJobById(jobId);
assertNull(job.getDuedate());
}
代码示例来源:origin: camunda/camunda-bpm-platform
@Deployment(resources = {"org/camunda/bpm/engine/test/api/mgmt/ManagementServiceTest.testGetJobExceptionStacktrace.bpmn20.xml"})
public void testSetJobDuedateDateNull() {
ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("exceptionInJobExecution");
// The execution is waiting in the first usertask. This contains a boundary
// timer event.
Job timerJob = managementService.createJobQuery()
.processInstanceId(processInstance.getId())
.singleResult();
assertNotNull("No job found for process instance", timerJob);
assertNotNull(timerJob.getDuedate());
managementService.setJobDuedate(timerJob.getId(), null);
timerJob = managementService.createJobQuery()
.processInstanceId(processInstance.getId())
.singleResult();
assertNull(timerJob.getDuedate());
}
内容来源于网络,如有侵权,请联系作者删除!