Search in sources :

Example 66 with Batch

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

the class BatchSuspensionTest method shouldActivateSeedJobAndDefinition.

@Test
public void shouldActivateSeedJobAndDefinition() {
    // given
    Batch batch = helper.migrateProcessInstancesAsync(1);
    managementService.suspendBatchById(batch.getId());
    // when
    managementService.activateBatchById(batch.getId());
    // then
    JobDefinition seedJobDefinition = helper.getSeedJobDefinition(batch);
    assertFalse(seedJobDefinition.isSuspended());
    Job seedJob = helper.getSeedJob(batch);
    assertFalse(seedJob.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 67 with Batch

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

the class BatchSuspensionTest method testUserOperationLogQueryByBatchEntityType.

@Test
@RequiredHistoryLevel(ProcessEngineConfiguration.HISTORY_FULL)
public void testUserOperationLogQueryByBatchEntityType() {
    // given
    Batch batch1 = helper.migrateProcessInstancesAsync(1);
    Batch batch2 = helper.migrateProcessInstancesAsync(1);
    // when
    identityService.setAuthenticatedUserId(USER_ID);
    managementService.suspendBatchById(batch1.getId());
    managementService.suspendBatchById(batch2.getId());
    managementService.activateBatchById(batch1.getId());
    identityService.clearAuthentication();
    // then
    UserOperationLogQuery query = historyService.createUserOperationLogQuery().entityType(BATCH);
    assertEquals(3, query.count());
    assertEquals(3, query.list().size());
}
Also used : Batch(org.camunda.bpm.engine.batch.Batch) UserOperationLogQuery(org.camunda.bpm.engine.history.UserOperationLogQuery) Test(org.junit.Test) RequiredHistoryLevel(org.camunda.bpm.engine.test.RequiredHistoryLevel)

Example 68 with Batch

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

the class BatchSuspensionTest method shouldCreateActivatedSeedJob.

@Test
public void shouldCreateActivatedSeedJob() {
    // given
    Batch batch = helper.migrateProcessInstancesAsync(2);
    // when
    helper.executeSeedJob(batch);
    // then
    Job seedJob = helper.getSeedJob(batch);
    assertFalse(seedJob.isSuspended());
}
Also used : Batch(org.camunda.bpm.engine.batch.Batch) Job(org.camunda.bpm.engine.runtime.Job) Test(org.junit.Test)

Example 69 with Batch

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

the class BatchSuspensionTest method shouldCreateSuspendedSeedJob.

@Test
public void shouldCreateSuspendedSeedJob() {
    // given
    Batch batch = helper.migrateProcessInstancesAsync(2);
    managementService.suspendBatchById(batch.getId());
    // when
    helper.executeSeedJob(batch);
    // then
    Job seedJob = helper.getSeedJob(batch);
    assertTrue(seedJob.isSuspended());
}
Also used : Batch(org.camunda.bpm.engine.batch.Batch) Job(org.camunda.bpm.engine.runtime.Job) Test(org.junit.Test)

Example 70 with Batch

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

the class BatchSuspensionTest method shouldSuspendExecutionJobsAndDefinition.

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

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