Search in sources :

Example 76 with Batch

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

the class BatchPriorityTest method executionJobShouldGetPriorityFromProcessEngineConfiguration.

@Test
public void executionJobShouldGetPriorityFromProcessEngineConfiguration() {
    // given
    setBatchJobPriority(CUSTOM_PRIORITY);
    Batch batch = helper.migrateProcessInstancesAsync(1);
    // when
    helper.executeSeedJob(batch);
    // then
    Job executionJob = helper.getExecutionJobs(batch).get(0);
    assertEquals(CUSTOM_PRIORITY, executionJob.getPriority());
}
Also used : Batch(org.camunda.bpm.engine.batch.Batch) Job(org.camunda.bpm.engine.runtime.Job) Test(org.junit.Test)

Example 77 with Batch

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

the class BatchPriorityTest method monitorJobShouldGetPriorityFromProcessEngineConfiguration.

@Test
public void monitorJobShouldGetPriorityFromProcessEngineConfiguration() {
    // given
    setBatchJobPriority(CUSTOM_PRIORITY);
    Batch batch = helper.migrateProcessInstancesAsync(1);
    // 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) Test(org.junit.Test)

Example 78 with Batch

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

the class HistoryCleanupHistoricBatchTest method createModificationBatch.

private Batch createModificationBatch() {
    BpmnModelInstance instance = createModelInstance();
    ProcessDefinition processDefinition = testRule.deployAndGetDefinition(instance);
    Batch modificationBatch = modificationHelper.startAfterAsync("process", 1, "userTask1", processDefinition.getId());
    return modificationBatch;
}
Also used : HistoricBatch(org.camunda.bpm.engine.batch.history.HistoricBatch) Batch(org.camunda.bpm.engine.batch.Batch) ProcessDefinition(org.camunda.bpm.engine.repository.ProcessDefinition) BpmnModelInstance(org.camunda.bpm.model.bpmn.BpmnModelInstance)

Example 79 with Batch

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

the class MultiTenancyBatchTest method testActivateBatchFailsWithWrongTenant.

@Test
public void testActivateBatchFailsWithWrongTenant() {
    // given
    Batch batch = batchHelper.migrateProcessInstanceAsync(tenant2Definition, tenant2Definition);
    managementService.suspendBatchById(batch.getId());
    // when
    identityService.setAuthentication("user", null, singletonList(TENANT_ONE));
    try {
        managementService.activateBatchById(batch.getId());
        Assert.fail("exception expected");
    } catch (ProcessEngineException e) {
        // then
        Assert.assertThat(e.getMessage(), CoreMatchers.containsString("Cannot activate batch '" + batch.getId() + "' because it belongs to no authenticated tenant"));
    } finally {
        identityService.clearAuthentication();
    }
}
Also used : HistoricBatch(org.camunda.bpm.engine.batch.history.HistoricBatch) Batch(org.camunda.bpm.engine.batch.Batch) ProcessEngineException(org.camunda.bpm.engine.ProcessEngineException) Test(org.junit.Test)

Example 80 with Batch

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

the class MultiTenancyBatchTest method testDeleteBatchFailsWithWrongTenant.

@Test
public void testDeleteBatchFailsWithWrongTenant() {
    // given
    Batch batch = batchHelper.migrateProcessInstanceAsync(tenant2Definition, tenant2Definition);
    // when
    identityService.setAuthentication("user", null, singletonList(TENANT_ONE));
    try {
        managementService.deleteBatch(batch.getId(), true);
        Assert.fail("exception expected");
    } catch (ProcessEngineException e) {
        // then
        Assert.assertThat(e.getMessage(), CoreMatchers.containsString("Cannot delete batch '" + batch.getId() + "' because it belongs to no authenticated tenant"));
    } finally {
        identityService.clearAuthentication();
    }
}
Also used : HistoricBatch(org.camunda.bpm.engine.batch.history.HistoricBatch) Batch(org.camunda.bpm.engine.batch.Batch) ProcessEngineException(org.camunda.bpm.engine.ProcessEngineException) 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