当前位置: 首页>>代码示例>>Java>>正文


Java JobQuery类代码示例

本文整理汇总了Java中org.activiti.engine.runtime.JobQuery的典型用法代码示例。如果您正苦于以下问题:Java JobQuery类的具体用法?Java JobQuery怎么用?Java JobQuery使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


JobQuery类属于org.activiti.engine.runtime包,在下文中一共展示了JobQuery类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: testGetJobsWithExceptionByProcessInstanceId

import org.activiti.engine.runtime.JobQuery; //导入依赖的package包/类
@Test
public void testGetJobsWithExceptionByProcessInstanceId()
{
    String processInstanceId = "processInstanceId";
    JobQuery jobQuery = mock(JobQuery.class);
    when(activitiManagementService.createJobQuery()).thenReturn(jobQuery);
    when(jobQuery.withException()).thenReturn(jobQuery);
    when(jobQuery.processInstanceId(processInstanceId)).thenReturn(jobQuery);
    List<Job> expectedJobs = new ArrayList<>();
    when(jobQuery.list()).thenReturn(expectedJobs);
    List<Job> actualJobs = activitiService.getJobsWithExceptionByProcessInstanceId(processInstanceId);
    assertSame(expectedJobs, actualJobs);
    InOrder inOrder = inOrder(jobQuery);
    inOrder.verify(jobQuery).withException();
    inOrder.verify(jobQuery).processInstanceId(processInstanceId);
    inOrder.verify(jobQuery).list();
    inOrder.verifyNoMoreInteractions();
}
 
开发者ID:FINRAOS,项目名称:herd,代码行数:19,代码来源:ActivitiServiceTest.java

示例2: testGetJobsWithExceptionCountByProcessInstanceId

import org.activiti.engine.runtime.JobQuery; //导入依赖的package包/类
@Test
public void testGetJobsWithExceptionCountByProcessInstanceId()
{
    String processInstanceId = "processInstanceId";
    JobQuery jobQuery = mock(JobQuery.class);
    when(activitiManagementService.createJobQuery()).thenReturn(jobQuery);
    when(jobQuery.withException()).thenReturn(jobQuery);
    when(jobQuery.processInstanceId(processInstanceId)).thenReturn(jobQuery);
    long expectedResult = 1234l;
    when(jobQuery.count()).thenReturn(expectedResult);
    long actualResult = activitiService.getJobsWithExceptionCountByProcessInstanceId(processInstanceId);
    assertEquals(expectedResult, actualResult);
    InOrder inOrder = inOrder(jobQuery);
    inOrder.verify(jobQuery).withException();
    inOrder.verify(jobQuery).processInstanceId(processInstanceId);
    inOrder.verify(jobQuery).count();
    inOrder.verifyNoMoreInteractions();
}
 
开发者ID:FINRAOS,项目名称:herd,代码行数:19,代码来源:ActivitiServiceTest.java

示例3: testQueryByDuedateHigherThenOrEqual

import org.activiti.engine.runtime.JobQuery; //导入依赖的package包/类
public void testQueryByDuedateHigherThenOrEqual() {
  JobQuery query = managementService.createJobQuery().duedateHigherThenOrEquals(testStartTime);
  verifyQueryResults(query, 3);
  
  query = managementService.createJobQuery().duedateHigherThenOrEquals(timerOneFireTime);
  verifyQueryResults(query, 3);
  
  query = managementService.createJobQuery().duedateHigherThenOrEquals(new Date(timerOneFireTime.getTime() + ONE_SECOND));
  verifyQueryResults(query, 2);
  
  query = managementService.createJobQuery().duedateHigherThenOrEquals(timerThreeFireTime);
  verifyQueryResults(query, 1);
  
  query = managementService.createJobQuery().duedateHigherThenOrEquals(new Date(timerThreeFireTime.getTime() + ONE_SECOND));
  verifyQueryResults(query, 0);
}
 
开发者ID:logicalhacking,项目名称:SecureBPMN,代码行数:17,代码来源:JobQueryTest.java

示例4: testCatchingTimerEvent

import org.activiti.engine.runtime.JobQuery; //导入依赖的package包/类
@Deployment
public void testCatchingTimerEvent() throws Exception {

  // Set the clock fixed
  Date startTime = new Date();

  // After process start, there should be timer created
  ProcessInstance pi = runtimeService.startProcessInstanceByKey("intermediateTimerEventExample");
  JobQuery jobQuery = managementService.createJobQuery().processInstanceId(pi.getId());
  assertEquals(1, jobQuery.count());

  // After setting the clock to time '50minutes and 5 seconds', the second timer should fire
  ClockUtil.setCurrentTime(new Date(startTime.getTime() + ((50 * 60 * 1000) + 5000)));
  waitForJobExecutorToProcessAllJobs(5000L, 25L);

  assertEquals(0, jobQuery.count());
  assertProcessEnded(pi.getProcessInstanceId());


}
 
开发者ID:logicalhacking,项目名称:SecureBPMN,代码行数:21,代码来源:IntermediateTimerEventTest.java

示例5: testCycleDateStartTimerEvent

import org.activiti.engine.runtime.JobQuery; //导入依赖的package包/类
@Deployment
public void testCycleDateStartTimerEvent() throws Exception {
  ClockUtil.setCurrentTime(new Date());

  // After process start, there should be timer created
  JobQuery jobQuery = managementService.createJobQuery();
  assertEquals(1, jobQuery.count());

  moveByMinutes(5);
  ProcessInstanceQuery piq = runtimeService.createProcessInstanceQuery().processDefinitionKey("startTimerEventExample");
  assertEquals(1, piq.count());
  assertEquals(1, jobQuery.count());

  moveByMinutes(5);
  assertEquals(2, piq.count());
  assertEquals(1, jobQuery.count());
  //have to manually delete pending timer
  cleanDB();

}
 
开发者ID:logicalhacking,项目名称:SecureBPMN,代码行数:21,代码来源:StartTimerEventTest.java

示例6: testCycleWithLimitStartTimerEvent

import org.activiti.engine.runtime.JobQuery; //导入依赖的package包/类
@Deployment
public void testCycleWithLimitStartTimerEvent() throws Exception {
  ClockUtil.setCurrentTime(new Date());

  // After process start, there should be timer created
  JobQuery jobQuery = managementService.createJobQuery();
  assertEquals(1, jobQuery.count());

  moveByMinutes(5);
  ProcessInstanceQuery piq = runtimeService.createProcessInstanceQuery().processDefinitionKey("startTimerEventExampleCycle");
  assertEquals(1, piq.count());
  assertEquals(1, jobQuery.count());

  moveByMinutes(5);
  assertEquals(2, piq.count());
  assertEquals(0, jobQuery.count());

}
 
开发者ID:logicalhacking,项目名称:SecureBPMN,代码行数:19,代码来源:StartTimerEventTest.java

示例7: testVersionUpgradeShouldCancelJobs

import org.activiti.engine.runtime.JobQuery; //导入依赖的package包/类
@Deployment
public void testVersionUpgradeShouldCancelJobs() throws Exception {
  ClockUtil.setCurrentTime(new Date());

  // After process start, there should be timer created
  JobQuery jobQuery = managementService.createJobQuery();
  assertEquals(1, jobQuery.count());

  //we deploy new process version, with some small change
  String process = new String(IoUtil.readInputStream(getClass().getResourceAsStream("StartTimerEventTest.testVersionUpgradeShouldCancelJobs.bpmn20.xml"), "")).replaceAll("beforeChange","changed");
  String id = repositoryService.createDeployment().addInputStream("StartTimerEventTest.testVersionUpgradeShouldCancelJobs.bpmn20.xml",
      new ByteArrayInputStream(process.getBytes())).deploy().getId();

  assertEquals(1, jobQuery.count());

  moveByMinutes(5);

  //we check that correct version was started
  String pi = runtimeService.createProcessInstanceQuery().processDefinitionKey("startTimerEventExample").singleResult().getProcessInstanceId();
  assertEquals("changed", runtimeService.getActiveActivityIds(pi).get(0));
  assertEquals(1, jobQuery.count());

  cleanDB();
  repositoryService.deleteDeployment(id, true);
}
 
开发者ID:logicalhacking,项目名称:SecureBPMN,代码行数:26,代码来源:StartTimerEventTest.java

示例8: testMultipleTimersOnUserTask

import org.activiti.engine.runtime.JobQuery; //导入依赖的package包/类
@Deployment
public void testMultipleTimersOnUserTask() {

  // Set the clock fixed
  Date startTime = new Date();

  // After process start, there should be 3 timers created
  ProcessInstance pi = runtimeService.startProcessInstanceByKey("multipleTimersOnUserTask");
  JobQuery jobQuery = managementService.createJobQuery().processInstanceId(pi.getId());
  List<Job> jobs = jobQuery.list();
  assertEquals(3, jobs.size());

  // After setting the clock to time '1 hour and 5 seconds', the second timer should fire
  ClockUtil.setCurrentTime(new Date(startTime.getTime() + ((60 * 60 * 1000) + 5000)));
  waitForJobExecutorToProcessAllJobs(5000L, 25L);
  assertEquals(0L, jobQuery.count());

  // which means that the third task is reached
  Task task = taskService.createTaskQuery().singleResult();
  assertEquals("Third Task", task.getName());
}
 
开发者ID:logicalhacking,项目名称:SecureBPMN,代码行数:22,代码来源:BoundaryTimerEventTest.java

示例9: testExpressionOnTimer

import org.activiti.engine.runtime.JobQuery; //导入依赖的package包/类
@Deployment
public void testExpressionOnTimer(){
  // Set the clock fixed
  Date startTime = new Date();
  
  HashMap<String, Object> variables = new HashMap<String, Object>();
  variables.put("duration", "PT1H");
  
  // After process start, there should be a timer created
  ProcessInstance pi = runtimeService.startProcessInstanceByKey("testExpressionOnTimer", variables);

  JobQuery jobQuery = managementService.createJobQuery().processInstanceId(pi.getId());
  List<Job> jobs = jobQuery.list();
  assertEquals(1, jobs.size());

  // After setting the clock to time '1 hour and 5 seconds', the second timer should fire
  ClockUtil.setCurrentTime(new Date(startTime.getTime() + ((60 * 60 * 1000) + 5000)));
  waitForJobExecutorToProcessAllJobs(5000L, 25L);
  assertEquals(0L, jobQuery.count());

  // which means the process has ended
  assertProcessEnded(pi.getId());
}
 
开发者ID:logicalhacking,项目名称:SecureBPMN,代码行数:24,代码来源:BoundaryTimerEventTest.java

示例10: testCatchingTimerEvent

import org.activiti.engine.runtime.JobQuery; //导入依赖的package包/类
@Deployment
public void testCatchingTimerEvent() throws Exception {

  // Set the clock fixed
  Date startTime = new Date();

  // After process start, there should be 3 timers created
  ProcessInstance pi = runtimeService.startProcessInstanceByKey("exclusiveTimers");
  JobQuery jobQuery = managementService.createJobQuery().processInstanceId(pi.getId());
  assertEquals(3, jobQuery.count());

  // After setting the clock to time '50minutes and 5 seconds', the timers should fire
  ClockUtil.setCurrentTime(new Date(startTime.getTime() + ((50 * 60 * 1000) + 5000)));
  waitForJobExecutorToProcessAllJobs(5000L, 25L);

  assertEquals(0, jobQuery.count());
  assertProcessEnded(pi.getProcessInstanceId());


}
 
开发者ID:iotsap,项目名称:FiWare-Template-Handler,代码行数:21,代码来源:ExclusiveTimerEventTest.java

示例11: testCatchingTimerEvent

import org.activiti.engine.runtime.JobQuery; //导入依赖的package包/类
@Deployment
public void testCatchingTimerEvent() throws Exception {

  // Set the clock fixed
  Date startTime = new Date();

  // After process start, there should be 3 timers created
  ProcessInstance pi = runtimeService.startProcessInstanceByKey("exclusiveTimers");
  JobQuery jobQuery = managementService.createJobQuery().processInstanceId(pi.getId());
  assertEquals(3, jobQuery.count());

  // After setting the clock to time '50minutes and 5 seconds', the timers should fire
  ClockUtil.setCurrentTime(new Date(startTime.getTime() + ((50 * 60 * 1000) + 5000)));
  waitForJobExecutorToProcessAllJobs(5000L, 100L);

  assertEquals(0, jobQuery.count());
  assertProcessEnded(pi.getProcessInstanceId());


}
 
开发者ID:springvelocity,项目名称:xbpm5,代码行数:21,代码来源:ExclusiveTimerEventTest.java

示例12: testTimerShouldNotBeRecreatedOnDeploymentCacheReboot

import org.activiti.engine.runtime.JobQuery; //导入依赖的package包/类
@Deployment
public void testTimerShouldNotBeRecreatedOnDeploymentCacheReboot() {
  
  // Just to be sure, I added this test. Sounds like something that could easily happen
  // when the order of deploy/parsing is altered.
  
  // After process start, there should be timer created
  JobQuery jobQuery = managementService.createJobQuery();
  assertEquals(1, jobQuery.count());
  
  // Reset deployment cache
  ((ProcessEngineConfigurationImpl) processEngineConfiguration).getProcessDefinitionCache().clear();
  
  // Start one instance of the process definition, this will trigger a cache reload
  runtimeService.startProcessInstanceByKey("startTimer");
  
  // No new jobs should have been created
  assertEquals(1, jobQuery.count());
}
 
开发者ID:springvelocity,项目名称:xbpm5,代码行数:20,代码来源:StartTimerEventTest.java

示例13: getJob

import org.activiti.engine.runtime.JobQuery; //导入依赖的package包/类
Job getJob(DelegateExecution context) {
    JobQuery jobQuery = context.getEngineServices().getManagementService().createJobQuery();
    if (jobQuery == null) {
        return null;
    }
    return jobQuery.processInstanceId(context.getProcessInstanceId()).singleResult();
}
 
开发者ID:SAP,项目名称:cf-mta-deploy-service,代码行数:8,代码来源:ProcessStepHelper.java

示例14: timers

import org.activiti.engine.runtime.JobQuery; //导入依赖的package包/类
@Override
public JobQuery timers() {
    if (onlyMessages) {
        throw new ActivitiIllegalArgumentException("Cannot combine onlyTimers() with onlyMessages() in the same query");
    }
    this.onlyTimers = true;
    return this;
}
 
开发者ID:flowable,项目名称:flowable-engine,代码行数:9,代码来源:JobQueryImpl.java

示例15: messages

import org.activiti.engine.runtime.JobQuery; //导入依赖的package包/类
@Override
public JobQuery messages() {
    if (onlyTimers) {
        throw new ActivitiIllegalArgumentException("Cannot combine onlyTimers() with onlyMessages() in the same query");
    }
    this.onlyMessages = true;
    return this;
}
 
开发者ID:flowable,项目名称:flowable-engine,代码行数:9,代码来源:JobQueryImpl.java


注:本文中的org.activiti.engine.runtime.JobQuery类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。