Search in sources :

Example 1 with CaseInstanceBuilder

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

the class CaseDefinitionRestServiceInteractionTest method setUpRuntime.

@Before
public void setUpRuntime() {
    CaseDefinition mockCaseDefinition = MockProvider.createMockCaseDefinition();
    setUpRuntimeData(mockCaseDefinition);
    caseServiceMock = mock(CaseService.class);
    when(processEngine.getCaseService()).thenReturn(caseServiceMock);
    caseInstanceBuilder = mock(CaseInstanceBuilder.class);
    CaseInstance mockCaseInstance = MockProvider.createMockCaseInstance();
    when(caseServiceMock.withCaseDefinition(MockProvider.EXAMPLE_CASE_DEFINITION_ID)).thenReturn(caseInstanceBuilder);
    when(caseInstanceBuilder.businessKey(anyString())).thenReturn(caseInstanceBuilder);
    when(caseInstanceBuilder.setVariables(Matchers.<Map<String, Object>>any())).thenReturn(caseInstanceBuilder);
    when(caseInstanceBuilder.create()).thenReturn(mockCaseInstance);
}
Also used : CaseInstance(org.camunda.bpm.engine.runtime.CaseInstance) CaseInstanceBuilder(org.camunda.bpm.engine.runtime.CaseInstanceBuilder) CaseDefinition(org.camunda.bpm.engine.repository.CaseDefinition) CaseService(org.camunda.bpm.engine.CaseService) Matchers.anyString(org.mockito.Matchers.anyString) Matchers.containsString(org.hamcrest.Matchers.containsString) Before(org.junit.Before)

Example 2 with CaseInstanceBuilder

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

the class MultiTenancyHistoricCaseActivityInstanceQueryTest method createCaseInstance.

protected void createCaseInstance(String tenantId) {
    CaseInstanceBuilder builder = caseService.withCaseDefinitionByKey("oneTaskCase");
    builder.caseDefinitionTenantId(tenantId).create();
}
Also used : CaseInstanceBuilder(org.camunda.bpm.engine.runtime.CaseInstanceBuilder)

Example 3 with CaseInstanceBuilder

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

the class MultiTenancyCaseInstanceCmdsTenantCheckTest method createCaseInstance.

protected String createCaseInstance(String tenantId) {
    VariableMap variables = Variables.putValue(VARIABLE_NAME, VARIABLE_VALUE);
    CaseInstanceBuilder builder = caseService.withCaseDefinitionByKey("twoTaskCase").setVariables(variables);
    if (tenantId == null) {
        return builder.create().getId();
    } else {
        return builder.caseDefinitionTenantId(tenantId).create().getId();
    }
}
Also used : CaseInstanceBuilder(org.camunda.bpm.engine.runtime.CaseInstanceBuilder) VariableMap(org.camunda.bpm.engine.variable.VariableMap)

Example 4 with CaseInstanceBuilder

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

the class MultiTenancyHistoricDataCmdsTenantCheckTest method createAndCloseCaseInstance.

protected String createAndCloseCaseInstance(String tenantId) {
    String caseInstanceId;
    CaseInstanceBuilder builder = caseService.withCaseDefinitionByKey("oneTaskCase");
    if (tenantId == null) {
        caseInstanceId = builder.create().getId();
    } else {
        caseInstanceId = builder.caseDefinitionTenantId(tenantId).create().getId();
    }
    caseService.completeCaseExecution(caseInstanceId);
    caseService.closeCaseInstance(caseInstanceId);
    return caseInstanceId;
}
Also used : CaseInstanceBuilder(org.camunda.bpm.engine.runtime.CaseInstanceBuilder)

Example 5 with CaseInstanceBuilder

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

the class MultiTenancyHistoricCaseInstanceQueryTest method createCaseInstance.

protected void createCaseInstance(String tenantId) {
    CaseInstanceBuilder builder = caseService.withCaseDefinitionByKey("oneTaskCase");
    builder.caseDefinitionTenantId(tenantId).create();
}
Also used : CaseInstanceBuilder(org.camunda.bpm.engine.runtime.CaseInstanceBuilder)

Aggregations

CaseInstanceBuilder (org.camunda.bpm.engine.runtime.CaseInstanceBuilder)5 CaseService (org.camunda.bpm.engine.CaseService)1 CaseDefinition (org.camunda.bpm.engine.repository.CaseDefinition)1 CaseInstance (org.camunda.bpm.engine.runtime.CaseInstance)1 VariableMap (org.camunda.bpm.engine.variable.VariableMap)1 Matchers.containsString (org.hamcrest.Matchers.containsString)1 Before (org.junit.Before)1 Matchers.anyString (org.mockito.Matchers.anyString)1