Package org.activiti.engine.runtime

Examples of org.activiti.engine.runtime.JobQuery


    verifyQueryResults(query, 3);
  }
 
  public void testQueryByExecutable() {
    ClockUtil.setCurrentTime(new Date(timerThreeFireTime.getTime() + ONE_SECOND)); // all jobs should be executable at t3 + 1hour.1second
    JobQuery query = managementService.createJobQuery().executable();
    verifyQueryResults(query, 4);
   
    // Setting retries of one job to 0, makes it non-executable
    setRetries(processInstanceIdOne, 0);
    verifyQueryResults(query, 3);
View Full Code Here


    ClockUtil.setCurrentTime(testStartTime);
    verifyQueryResults(query, 1); // 1, since a message is always executable when retries > 0
  }
 
  public void testQueryByOnlyTimers() {
    JobQuery query = managementService.createJobQuery().timers();
    verifyQueryResults(query, 3);
  }
View Full Code Here

    JobQuery query = managementService.createJobQuery().timers();
    verifyQueryResults(query, 3);
  }
 
  public void testQueryByOnlyMessages() {
    JobQuery query = managementService.createJobQuery().messages();
    verifyQueryResults(query, 1);
  }
View Full Code Here

      assertTextPresent("Cannot combine onlyTimers() with onlyMessages() in the same query", e.getMessage());
    }
  }
 
  public void testQueryByDuedateLowerThen() {
    JobQuery query = managementService.createJobQuery().duedateLowerThen(testStartTime);
    verifyQueryResults(query, 0);
   
    query = managementService.createJobQuery().duedateLowerThen(new Date(timerOneFireTime.getTime() + ONE_SECOND));
    verifyQueryResults(query, 1);
   
View Full Code Here

    query = managementService.createJobQuery().duedateLowerThen(new Date(timerThreeFireTime.getTime() + ONE_SECOND));
    verifyQueryResults(query, 3);
  }
 
  public void testQueryByDuedateHigherThen() {
    JobQuery query = managementService.createJobQuery().duedateHigherThen(testStartTime);
    verifyQueryResults(query, 3);
   
    query = managementService.createJobQuery().duedateHigherThen(timerOneFireTime);
    verifyQueryResults(query, 2);
   
View Full Code Here

    verifyQueryResults(query, 0);
  }
 
  @Deployment(resources = {"org/activiti/engine/test/api/mgmt/ManagementServiceTest.testGetJobExceptionStacktrace.bpmn20.xml"})
  public void testQueryByException() {
    JobQuery query = managementService.createJobQuery().withException();
    verifyQueryResults(query, 0);
   
    ProcessInstance processInstance = startProcessInstanceWithFailingJob();
   
    query = managementService.createJobQuery().withException();
View Full Code Here

    verifyFailedJob(query, processInstance);
  }
 
  @Deployment(resources = {"org/activiti/engine/test/api/mgmt/ManagementServiceTest.testGetJobExceptionStacktrace.bpmn20.xml"})
  public void testQueryByExceptionMessage() {
    JobQuery query = managementService.createJobQuery().exceptionMessage(EXCEPTION_MESSAGE);
    verifyQueryResults(query, 0);
   
    ProcessInstance processInstance = startProcessInstanceWithFailingJob();
   
    query = managementService.createJobQuery().exceptionMessage(EXCEPTION_MESSAGE);
View Full Code Here

    verifyFailedJob(query, processInstance);
  }

  @Deployment(resources = {"org/activiti/engine/test/api/mgmt/ManagementServiceTest.testGetJobExceptionStacktrace.bpmn20.xml"})
  public void testQueryByExceptionMessageEmpty() {
    JobQuery query = managementService.createJobQuery().exceptionMessage("");
    verifyQueryResults(query, 0);
   
    startProcessInstanceWithFailingJob();
   
    query = managementService.createJobQuery().exceptionMessage("");
View Full Code Here

   
    // sorting on multiple fields
    setRetries(processInstanceIdTwo, 2);
    ClockUtil.setCurrentTime(new Date(timerThreeFireTime.getTime() + ONE_SECOND)); // make sure all timers can fire
   
    JobQuery query = managementService.createJobQuery()
      .timers()
      .executable()
      .orderByJobRetries()
      .asc()
      .orderByJobDuedate()
      .desc();
    
    List<Job> jobs = query.list();
    assertEquals(3, jobs.size());
   
    assertEquals(2, jobs.get(0).getRetries());
    assertEquals(3, jobs.get(1).getRetries());
    assertEquals(3, jobs.get(2).getRetries());
View Full Code Here

    Date dueDateLowerThen = RequestUtil.getDate(getQuery(), "duedate-lt");
    Date dueDateLowerThenOrEquals = RequestUtil.getDate(getQuery(), "duedate-ltoe");
    Date dueDateHigherThen = RequestUtil.getDate(getQuery(), "duedate-ht");
    Date dueDateHigherThenOrEquals = RequestUtil.getDate(getQuery(), "duedate-htoe");

    JobQuery jobQuery = ActivitiUtil.getManagementService().createJobQuery();
    if (processInstanceId != null) {
      jobQuery.processInstanceId(processInstanceId);
    }
    if (withRetriesLeft) {
      jobQuery.withRetriesLeft();
    }
    if (executable) {
      jobQuery.executable();
    }
    if (onlyTimers) {
      jobQuery.timers();
    }
    if (onlyMessages) {
      jobQuery.messages();
    }
    if (dueDateLowerThen != null) {
      jobQuery.duedateLowerThen(dueDateLowerThen);
    }
    if (dueDateLowerThenOrEquals != null) {
      jobQuery.duedateLowerThenOrEquals(dueDateLowerThenOrEquals);
    }
    if (dueDateHigherThen != null) {
      jobQuery.duedateHigherThen(dueDateHigherThen);
    }
    if (dueDateHigherThenOrEquals != null) {
      jobQuery.duedateLowerThenOrEquals(dueDateLowerThenOrEquals);
    }
   
    DataResponse response = new JobsPaginateList().paginateList(getQuery(), jobQuery, "id", properties);
    return response;
  }
View Full Code Here

TOP

Related Classes of org.activiti.engine.runtime.JobQuery

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.