Search in sources :

Example 26 with Job

use of org.camunda.bpm.engine.runtime.Job in project camunda-bpm-platform by camunda.

the class BatchHistoricDecisionInstanceDeletionTest method createMonitorJobByQuery.

@Test
public void createMonitorJobByQuery() {
    // given
    HistoricDecisionInstanceQuery query = historyService.createHistoricDecisionInstanceQuery().decisionDefinitionKey(DECISION);
    Batch batch = historyService.deleteHistoricDecisionInstancesAsync(query, null);
    // when
    helper.executeSeedJob(batch);
    // then the seed job definition still exists but the seed job is removed
    JobDefinition seedJobDefinition = helper.getSeedJobDefinition(batch);
    assertNotNull(seedJobDefinition);
    Job seedJob = helper.getSeedJob(batch);
    assertNull(seedJob);
    // and a monitor job definition and job exists
    JobDefinition monitorJobDefinition = helper.getMonitorJobDefinition(batch);
    assertNotNull(monitorJobDefinition);
    Job monitorJob = helper.getMonitorJob(batch);
    assertNotNull(monitorJob);
}
Also used : Batch(org.camunda.bpm.engine.batch.Batch) HistoricDecisionInstanceQuery(org.camunda.bpm.engine.history.HistoricDecisionInstanceQuery) Job(org.camunda.bpm.engine.runtime.Job) JobDefinition(org.camunda.bpm.engine.management.JobDefinition) Test(org.junit.Test)

Example 27 with Job

use of org.camunda.bpm.engine.runtime.Job in project camunda-bpm-platform by camunda.

the class BatchHistoricDecisionInstanceDeletionTest method createSeedJobByIds.

@Test
public void createSeedJobByIds() {
    // when
    Batch batch = historyService.deleteHistoricDecisionInstancesAsync(decisionInstanceIds, null);
    // then there exists a seed job definition with the batch id as
    // configuration
    JobDefinition seedJobDefinition = helper.getSeedJobDefinition(batch);
    assertNotNull(seedJobDefinition);
    assertEquals(batch.getId(), seedJobDefinition.getJobConfiguration());
    assertEquals(BatchSeedJobHandler.TYPE, seedJobDefinition.getJobType());
    // and there exists a deletion job definition
    JobDefinition deletionJobDefinition = helper.getExecutionJobDefinition(batch);
    assertNotNull(deletionJobDefinition);
    assertEquals(Batch.TYPE_HISTORIC_DECISION_INSTANCE_DELETION, deletionJobDefinition.getJobType());
    // and a seed job with no relation to a process or execution etc.
    Job seedJob = helper.getSeedJob(batch);
    assertNotNull(seedJob);
    assertEquals(seedJobDefinition.getId(), seedJob.getJobDefinitionId());
    assertNull(seedJob.getDuedate());
    assertNull(seedJob.getDeploymentId());
    assertNull(seedJob.getProcessDefinitionId());
    assertNull(seedJob.getProcessDefinitionKey());
    assertNull(seedJob.getProcessInstanceId());
    assertNull(seedJob.getExecutionId());
    // but no deletion jobs where created
    List<Job> deletionJobs = helper.getExecutionJobs(batch);
    assertEquals(0, deletionJobs.size());
}
Also used : Batch(org.camunda.bpm.engine.batch.Batch) Job(org.camunda.bpm.engine.runtime.Job) JobDefinition(org.camunda.bpm.engine.management.JobDefinition) Test(org.junit.Test)

Example 28 with Job

use of org.camunda.bpm.engine.runtime.Job in project camunda-bpm-platform by camunda.

the class BatchHistoricDecisionInstanceDeletionTest method createSeedJobByQuery.

@Test
public void createSeedJobByQuery() {
    // given
    HistoricDecisionInstanceQuery query = historyService.createHistoricDecisionInstanceQuery().decisionDefinitionKey(DECISION);
    // when
    Batch batch = historyService.deleteHistoricDecisionInstancesAsync(decisionInstanceIds, query, null);
    // then there exists a seed job definition with the batch id as
    // configuration
    JobDefinition seedJobDefinition = helper.getSeedJobDefinition(batch);
    assertNotNull(seedJobDefinition);
    assertEquals(batch.getId(), seedJobDefinition.getJobConfiguration());
    assertEquals(BatchSeedJobHandler.TYPE, seedJobDefinition.getJobType());
    // and there exists a deletion job definition
    JobDefinition deletionJobDefinition = helper.getExecutionJobDefinition(batch);
    assertNotNull(deletionJobDefinition);
    assertEquals(Batch.TYPE_HISTORIC_DECISION_INSTANCE_DELETION, deletionJobDefinition.getJobType());
    // and a seed job with no relation to a process or execution etc.
    Job seedJob = helper.getSeedJob(batch);
    assertNotNull(seedJob);
    assertEquals(seedJobDefinition.getId(), seedJob.getJobDefinitionId());
    assertNull(seedJob.getDuedate());
    assertNull(seedJob.getDeploymentId());
    assertNull(seedJob.getProcessDefinitionId());
    assertNull(seedJob.getProcessDefinitionKey());
    assertNull(seedJob.getProcessInstanceId());
    assertNull(seedJob.getExecutionId());
    // but no deletion jobs where created
    List<Job> deletionJobs = helper.getExecutionJobs(batch);
    assertEquals(0, deletionJobs.size());
}
Also used : Batch(org.camunda.bpm.engine.batch.Batch) HistoricDecisionInstanceQuery(org.camunda.bpm.engine.history.HistoricDecisionInstanceQuery) Job(org.camunda.bpm.engine.runtime.Job) JobDefinition(org.camunda.bpm.engine.management.JobDefinition) Test(org.junit.Test)

Example 29 with Job

use of org.camunda.bpm.engine.runtime.Job in project camunda-bpm-platform by camunda.

the class BatchHistoricDecisionInstanceDeletionTest method createMonitorJobByIdsAndQuery.

@Test
public void createMonitorJobByIdsAndQuery() {
    // given
    HistoricDecisionInstanceQuery query = historyService.createHistoricDecisionInstanceQuery().decisionDefinitionKey(DECISION);
    Batch batch = historyService.deleteHistoricDecisionInstancesAsync(decisionInstanceIds, query, null);
    // when
    helper.executeSeedJob(batch);
    // then the seed job definition still exists but the seed job is removed
    JobDefinition seedJobDefinition = helper.getSeedJobDefinition(batch);
    assertNotNull(seedJobDefinition);
    Job seedJob = helper.getSeedJob(batch);
    assertNull(seedJob);
    // and a monitor job definition and job exists
    JobDefinition monitorJobDefinition = helper.getMonitorJobDefinition(batch);
    assertNotNull(monitorJobDefinition);
    Job monitorJob = helper.getMonitorJob(batch);
    assertNotNull(monitorJob);
}
Also used : Batch(org.camunda.bpm.engine.batch.Batch) HistoricDecisionInstanceQuery(org.camunda.bpm.engine.history.HistoricDecisionInstanceQuery) Job(org.camunda.bpm.engine.runtime.Job) JobDefinition(org.camunda.bpm.engine.management.JobDefinition) Test(org.junit.Test)

Example 30 with Job

use of org.camunda.bpm.engine.runtime.Job in project camunda-bpm-platform by camunda.

the class BatchHistoricDecisionInstanceDeletionTest method deleteInstancesByIds.

@Test
public void deleteInstancesByIds() {
    // given
    Batch batch = historyService.deleteHistoricDecisionInstancesAsync(decisionInstanceIds, null);
    helper.executeSeedJob(batch);
    List<Job> deletionJobs = helper.getExecutionJobs(batch);
    // when
    for (Job deletionJob : deletionJobs) {
        helper.executeJob(deletionJob);
    }
    // then
    assertEquals(0, historyService.createHistoricDecisionInstanceQuery().count());
    assertEquals(0, historyService.createHistoricDecisionInstanceQuery().count());
}
Also used : Batch(org.camunda.bpm.engine.batch.Batch) Job(org.camunda.bpm.engine.runtime.Job) Test(org.junit.Test)

Aggregations

Job (org.camunda.bpm.engine.runtime.Job)696 Deployment (org.camunda.bpm.engine.test.Deployment)310 Test (org.junit.Test)232 ProcessInstance (org.camunda.bpm.engine.runtime.ProcessInstance)189 ProcessDefinition (org.camunda.bpm.engine.repository.ProcessDefinition)148 JobDefinition (org.camunda.bpm.engine.management.JobDefinition)135 JobQuery (org.camunda.bpm.engine.runtime.JobQuery)116 HashMap (java.util.HashMap)98 Batch (org.camunda.bpm.engine.batch.Batch)78 JobDefinitionQuery (org.camunda.bpm.engine.management.JobDefinitionQuery)78 Task (org.camunda.bpm.engine.task.Task)71 Date (java.util.Date)67 MigrationPlan (org.camunda.bpm.engine.migration.MigrationPlan)48 BpmnModelInstance (org.camunda.bpm.model.bpmn.BpmnModelInstance)24 AbstractFoxPlatformIntegrationTest (org.camunda.bpm.integrationtest.util.AbstractFoxPlatformIntegrationTest)23 ActivityInstance (org.camunda.bpm.engine.runtime.ActivityInstance)21 TaskQuery (org.camunda.bpm.engine.task.TaskQuery)20 Incident (org.camunda.bpm.engine.runtime.Incident)17 HistoricJobLog (org.camunda.bpm.engine.history.HistoricJobLog)15 HistoricProcessInstance (org.camunda.bpm.engine.history.HistoricProcessInstance)15