Package org.camunda.bpm.engine.management

Examples of org.camunda.bpm.engine.management.JobDefinitionQuery


    // suspend the job definition
    managementService.suspendJobDefinitionByProcessDefinitionKey(key, false);

    // then
    // all job definitions are suspended
    JobDefinitionQuery jobDefinitionQuery = managementService.createJobDefinitionQuery();
    assertEquals(3, jobDefinitionQuery.suspended().count());
    assertEquals(0, jobDefinitionQuery.active().count());

    // but the jobs are still active
    JobQuery jobQuery = managementService.createJobQuery();
    assertEquals(0, jobQuery.suspended().count());
    assertEquals(3, jobQuery.active().count());
View Full Code Here


    // suspend the job definition
    managementService.suspendJobDefinitionByProcessDefinitionKey(key, true);

    // then
    // all job definitions are suspended
    JobDefinitionQuery jobDefinitionQuery = managementService.createJobDefinitionQuery();
    assertEquals(3, jobDefinitionQuery.suspended().count());
    assertEquals(0, jobDefinitionQuery.active().count());

    // and the jobs too
    JobQuery jobQuery = managementService.createJobQuery();
    assertEquals(3, jobQuery.suspended().count());
    assertEquals(0, jobQuery.active().count());
View Full Code Here

    // there exists a job to activate process definition
    Job timerToActivateProcessDefinition = managementService.createJobQuery().timers().singleResult();
    assertNotNull(timerToActivateProcessDefinition);

    // the job definition should still suspended
    JobDefinitionQuery jobDefinitionQuery = managementService.createJobDefinitionQuery();

    assertEquals(0, jobDefinitionQuery.active().count());
    assertEquals(1, jobDefinitionQuery.suspended().count());

    JobDefinition suspendedJobDefinition = jobDefinitionQuery.suspended().singleResult();

    assertEquals(jobDefinition.getId(), suspendedJobDefinition.getId());
    assertTrue(suspendedJobDefinition.isSuspended());

    // the job is still suspended
    JobQuery jobQuery = managementService.createJobQuery();

    assertEquals(1, jobQuery.suspended().count());
    assertEquals(1, jobQuery.active().count()); // the timer job is active

    // when
    // execute job
    managementService.executeJob(timerToActivateProcessDefinition.getId());

    // then
    // the job definition should be activated
    assertEquals(0, jobDefinitionQuery.suspended().count());
    assertEquals(1, jobDefinitionQuery.active().count());

    JobDefinition activatedJobDefinition = jobDefinitionQuery.active().singleResult();

    assertEquals(jobDefinition.getId(), activatedJobDefinition.getId());
    assertFalse(activatedJobDefinition.isSuspended());

    // the job is activated too
View Full Code Here

    // suspend the job definition
    managementService.suspendJobDefinitionByProcessDefinitionKey(key, false, null);

    // then
    // all job definitions are suspended
    JobDefinitionQuery jobDefinitionQuery = managementService.createJobDefinitionQuery();
    assertEquals(3, jobDefinitionQuery.suspended().count());
    assertEquals(0, jobDefinitionQuery.active().count());

    // but the jobs are still active
    JobQuery jobQuery = managementService.createJobQuery();
    assertEquals(0, jobQuery.suspended().count());
    assertEquals(3, jobQuery.active().count());
View Full Code Here

    // suspend the job definition
    managementService.suspendJobDefinitionByProcessDefinitionKey(key, true, null);

    // then
    // all job definitions are suspended
    JobDefinitionQuery jobDefinitionQuery = managementService.createJobDefinitionQuery();
    assertEquals(3, jobDefinitionQuery.suspended().count());
    assertEquals(0, jobDefinitionQuery.active().count());

    // and the jobs too
    JobQuery jobQuery = managementService.createJobQuery();
    assertEquals(3, jobQuery.suspended().count());
    assertEquals(0, jobQuery.active().count());
View Full Code Here

    // the process definition will be activated
    repositoryService.activateProcessDefinitionByKey(key);

    // then
    // the job definitions should be activated...
    JobDefinitionQuery jobDefinitionQuery = managementService.createJobDefinitionQuery();

    assertEquals(0, jobDefinitionQuery.suspended().count());
    assertEquals(5, jobDefinitionQuery.active().count());

    // ...and the corresponding jobs should be still suspended
    JobQuery jobQuery = managementService.createJobQuery();

    assertEquals(0, jobQuery.active().count());
View Full Code Here

    // suspend the job definition
    managementService.suspendJobDefinitionByProcessDefinitionKey(key, false, new Date(oneWeekFromStartTime));

    // then
    // the job definition is still active
    JobDefinitionQuery jobDefinitionQuery = managementService.createJobDefinitionQuery();
    assertEquals(3, jobDefinitionQuery.active().count());
    assertEquals(0, jobDefinitionQuery.suspended().count());

    // there exists a job for the delayed suspension execution
    JobQuery jobQuery = managementService.createJobQuery();

    Job delayedSuspensionJob = jobQuery.timers().active().singleResult();
    assertNotNull(delayedSuspensionJob);

    // execute job
    managementService.executeJob(delayedSuspensionJob.getId());

    assertEquals(0, jobDefinitionQuery.active().count());
    assertEquals(3, jobDefinitionQuery.suspended().count());

    // but the jobs are still active
    jobQuery = managementService.createJobQuery();
    assertEquals(0, jobQuery.suspended().count());
    assertEquals(3, jobQuery.active().count());
View Full Code Here

    // the process definition will be activated
    repositoryService.activateProcessDefinitionByKey(key, false, null);

    // then
    // the job definitions should be activated...
    JobDefinitionQuery jobDefinitionQuery = managementService.createJobDefinitionQuery();

    assertEquals(5, jobDefinitionQuery.active().count());
    assertEquals(0, jobDefinitionQuery.suspended().count());

    // ...and the corresponding jobs should still suspended
    JobQuery jobQuery = managementService.createJobQuery();

    assertEquals(0, jobQuery.active().count());
View Full Code Here

    // the process definition will be activated
    repositoryService.activateProcessDefinitionByKey(key, true, null);

    // then
    // the job definitions should be activated...
    JobDefinitionQuery jobDefinitionQuery = managementService.createJobDefinitionQuery();

    assertEquals(5, jobDefinitionQuery.active().count());
    assertEquals(0, jobDefinitionQuery.suspended().count());

    // ...and the corresponding jobs should be activated too
    JobQuery jobQuery = managementService.createJobQuery();

    assertEquals(5, jobQuery.active().count());
View Full Code Here

    // suspend the job definition
    managementService.suspendJobDefinitionByProcessDefinitionKey(key, true, new Date(oneWeekFromStartTime));

    // then
    // the job definitions are still active
    JobDefinitionQuery jobDefinitionQuery = managementService.createJobDefinitionQuery();
    assertEquals(3, jobDefinitionQuery.active().count());
    assertEquals(0, jobDefinitionQuery.suspended().count());

    // there exists a job for the delayed suspension execution
    JobQuery jobQuery = managementService.createJobQuery();

    Job delayedSuspensionJob = jobQuery.timers().active().singleResult();
    assertNotNull(delayedSuspensionJob);

    // execute job
    managementService.executeJob(delayedSuspensionJob.getId());

    // the job definition should be suspended
    assertEquals(0, jobDefinitionQuery.active().count());
    assertEquals(3, jobDefinitionQuery.suspended().count());

    // the corresponding jobs are suspended
    jobQuery = managementService.createJobQuery();

    assertEquals(0, jobQuery.active().count());
View Full Code Here

TOP

Related Classes of org.camunda.bpm.engine.management.JobDefinitionQuery

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.