Search in sources :

Example 71 with Batch

use of org.camunda.bpm.engine.batch.Batch in project camunda-bpm-platform by camunda.

the class BatchSuspensionTest method shouldActivateExecutionJobsAndDefinition.

@Test
public void shouldActivateExecutionJobsAndDefinition() {
    // given
    Batch batch = helper.migrateProcessInstancesAsync(1);
    managementService.suspendBatchById(batch.getId());
    helper.executeSeedJob(batch);
    // when
    managementService.activateBatchById(batch.getId());
    // then
    JobDefinition migrationJobDefinition = helper.getExecutionJobDefinition(batch);
    assertFalse(migrationJobDefinition.isSuspended());
    Job migrationJob = helper.getExecutionJobs(batch).get(0);
    assertFalse(migrationJob.isSuspended());
}
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 72 with Batch

use of org.camunda.bpm.engine.batch.Batch in project camunda-bpm-platform by camunda.

the class BatchSuspensionTest method shouldCreateUserOperationLogForBatchSuspension.

@Test
@RequiredHistoryLevel(ProcessEngineConfiguration.HISTORY_FULL)
public void shouldCreateUserOperationLogForBatchSuspension() {
    // given
    Batch batch = helper.migrateProcessInstancesAsync(1);
    // when
    identityService.setAuthenticatedUserId(USER_ID);
    managementService.suspendBatchById(batch.getId());
    identityService.clearAuthentication();
    // then
    UserOperationLogEntry entry = historyService.createUserOperationLogQuery().singleResult();
    assertNotNull(entry);
    assertEquals(batch.getId(), entry.getBatchId());
    assertEquals(AbstractSetBatchStateCmd.SUSPENSION_STATE_PROPERTY, entry.getProperty());
    assertNull(entry.getOrgValue());
    assertEquals(SuspensionState.SUSPENDED.getName(), entry.getNewValue());
}
Also used : Batch(org.camunda.bpm.engine.batch.Batch) UserOperationLogEntry(org.camunda.bpm.engine.history.UserOperationLogEntry) Test(org.junit.Test) RequiredHistoryLevel(org.camunda.bpm.engine.test.RequiredHistoryLevel)

Example 73 with Batch

use of org.camunda.bpm.engine.batch.Batch in project camunda-bpm-platform by camunda.

the class BatchSuspensionTest method shouldActivateMonitorJobAndDefinition.

@Test
public void shouldActivateMonitorJobAndDefinition() {
    // given
    Batch batch = helper.migrateProcessInstancesAsync(1);
    managementService.suspendBatchById(batch.getId());
    helper.executeSeedJob(batch);
    // when
    managementService.activateBatchById(batch.getId());
    // then
    JobDefinition monitorJobDefinition = helper.getMonitorJobDefinition(batch);
    assertFalse(monitorJobDefinition.isSuspended());
    Job monitorJob = helper.getMonitorJob(batch);
    assertFalse(monitorJob.isSuspended());
}
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 74 with Batch

use of org.camunda.bpm.engine.batch.Batch in project camunda-bpm-platform by camunda.

the class BatchPriorityTest method seedJobShouldGetPriorityFromOverridingJobDefinitionPriority.

@Test
public void seedJobShouldGetPriorityFromOverridingJobDefinitionPriority() {
    // given
    Batch batch = helper.migrateProcessInstancesAsync(2);
    JobDefinition seedJobDefinition = helper.getSeedJobDefinition(batch);
    managementService.setOverridingJobPriorityForJobDefinition(seedJobDefinition.getId(), CUSTOM_PRIORITY);
    // when
    helper.executeSeedJob(batch);
    // then
    Job seedJob = helper.getSeedJob(batch);
    assertEquals(CUSTOM_PRIORITY, seedJob.getPriority());
}
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 75 with Batch

use of org.camunda.bpm.engine.batch.Batch in project camunda-bpm-platform by camunda.

the class BatchPriorityTest method monitorJobShouldGetPriorityOverridingJobDefinitionPriority.

@Test
public void monitorJobShouldGetPriorityOverridingJobDefinitionPriority() {
    // given
    Batch batch = helper.migrateProcessInstancesAsync(1);
    JobDefinition monitorJobDefinition = helper.getMonitorJobDefinition(batch);
    managementService.setOverridingJobPriorityForJobDefinition(monitorJobDefinition.getId(), CUSTOM_PRIORITY);
    // when
    helper.executeSeedJob(batch);
    // then
    Job monitorJob = helper.getMonitorJob(batch);
    assertEquals(CUSTOM_PRIORITY, monitorJob.getPriority());
}
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)

Aggregations

Batch (org.camunda.bpm.engine.batch.Batch)324 Test (org.junit.Test)286 HistoricBatch (org.camunda.bpm.engine.batch.history.HistoricBatch)125 ProcessDefinition (org.camunda.bpm.engine.repository.ProcessDefinition)95 Job (org.camunda.bpm.engine.runtime.Job)78 ProcessInstance (org.camunda.bpm.engine.runtime.ProcessInstance)64 CoreMatchers.containsString (org.hamcrest.CoreMatchers.containsString)32 Date (java.util.Date)28 JobDefinition (org.camunda.bpm.engine.management.JobDefinition)28 AbstractAsyncOperationsTest (org.camunda.bpm.engine.test.api.AbstractAsyncOperationsTest)26 HistoricProcessInstanceQuery (org.camunda.bpm.engine.history.HistoricProcessInstanceQuery)24 ArrayList (java.util.ArrayList)23 ProcessInstanceQuery (org.camunda.bpm.engine.runtime.ProcessInstanceQuery)19 ProcessEngineException (org.camunda.bpm.engine.ProcessEngineException)18 HistoricDecisionInstanceQuery (org.camunda.bpm.engine.history.HistoricDecisionInstanceQuery)17 ExternalTask (org.camunda.bpm.engine.externaltask.ExternalTask)16 ActivityInstance (org.camunda.bpm.engine.runtime.ActivityInstance)15 Deployment (org.camunda.bpm.engine.test.Deployment)15 ExpectedException (org.junit.rules.ExpectedException)14 Matchers.anyString (org.mockito.Matchers.anyString)14