Search in sources :

Example 81 with Batch

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

the class MultiTenancyBatchTest method testSuspendBatch.

@Test
public void testSuspendBatch() {
    // given
    Batch batch = batchHelper.migrateProcessInstanceAsync(tenant1Definition, tenant1Definition);
    // when
    identityService.setAuthentication("user", null, singletonList(TENANT_ONE));
    managementService.suspendBatchById(batch.getId());
    identityService.clearAuthentication();
    // then
    batch = managementService.createBatchQuery().batchId(batch.getId()).singleResult();
    Assert.assertTrue(batch.isSuspended());
}
Also used : HistoricBatch(org.camunda.bpm.engine.batch.history.HistoricBatch) Batch(org.camunda.bpm.engine.batch.Batch) Test(org.junit.Test)

Example 82 with Batch

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

the class MultiTenancyBatchTest method testActivateBatch.

@Test
public void testActivateBatch() {
    // given
    Batch batch = batchHelper.migrateProcessInstanceAsync(tenant1Definition, tenant1Definition);
    managementService.suspendBatchById(batch.getId());
    // when
    identityService.setAuthentication("user", null, singletonList(TENANT_ONE));
    managementService.activateBatchById(batch.getId());
    identityService.clearAuthentication();
    // then
    batch = managementService.createBatchQuery().batchId(batch.getId()).singleResult();
    Assert.assertFalse(batch.isSuspended());
}
Also used : HistoricBatch(org.camunda.bpm.engine.batch.history.HistoricBatch) Batch(org.camunda.bpm.engine.batch.Batch) Test(org.junit.Test)

Example 83 with Batch

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

the class BatchQueryTest method testBatchQueryById.

@Test
public void testBatchQueryById() {
    // given
    Batch batch1 = helper.migrateProcessInstancesAsync(1);
    helper.migrateProcessInstancesAsync(1);
    // when
    Batch resultBatch = managementService.createBatchQuery().batchId(batch1.getId()).singleResult();
    // then
    Assert.assertNotNull(resultBatch);
    Assert.assertEquals(batch1.getId(), resultBatch.getId());
}
Also used : Batch(org.camunda.bpm.engine.batch.Batch) Test(org.junit.Test)

Example 84 with Batch

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

the class BatchQueryTest method testBatchQueryBySuspendedBatches.

@Test
public void testBatchQueryBySuspendedBatches() {
    // given
    Batch batch1 = helper.migrateProcessInstancesAsync(1);
    Batch batch2 = helper.migrateProcessInstancesAsync(1);
    helper.migrateProcessInstancesAsync(1);
    // when
    managementService.suspendBatchById(batch1.getId());
    managementService.suspendBatchById(batch2.getId());
    managementService.activateBatchById(batch1.getId());
    // then
    BatchQuery query = managementService.createBatchQuery().suspended();
    Assert.assertEquals(1, query.count());
    Assert.assertEquals(1, query.list().size());
    Assert.assertEquals(batch2.getId(), query.singleResult().getId());
}
Also used : Batch(org.camunda.bpm.engine.batch.Batch) BatchQuery(org.camunda.bpm.engine.batch.BatchQuery) Test(org.junit.Test)

Example 85 with Batch

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

the class BatchSuspensionTest method shouldCreateSuspendedMonitorJob.

@Test
public void shouldCreateSuspendedMonitorJob() {
    // given
    Batch batch = helper.migrateProcessInstancesAsync(1);
    managementService.suspendBatchById(batch.getId());
    // when
    helper.executeSeedJob(batch);
    // then
    Job monitorJob = helper.getMonitorJob(batch);
    assertTrue(monitorJob.isSuspended());
}
Also used : Batch(org.camunda.bpm.engine.batch.Batch) Job(org.camunda.bpm.engine.runtime.Job) 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