Search in sources :

Example 6 with BpmnModelInstance

use of org.camunda.bpm.model.bpmn.BpmnModelInstance in project camunda-bpm-platform by camunda.

the class SpringTransactionIntegrationDeploymentFailTest method testFailingAfterDeployment.

public void testFailingAfterDeployment() {
    // given
    final BpmnModelInstance model = Bpmn.createExecutableProcess().startEvent().userTask().endEvent().done();
    // 4. DeploymentFailListener is called
    try {
        processEngine.getRepositoryService().createDeployment().addModelInstance("model.bpmn", model).deploy();
    } catch (Exception ex) {
    // expected exception
    }
    // then
    // DeploymentFailListener succeeded to remove registered deployments
    assertEquals(0, processEngineConfiguration.getRegisteredDeployments().size());
}
Also used : BpmnModelInstance(org.camunda.bpm.model.bpmn.BpmnModelInstance)

Example 7 with BpmnModelInstance

use of org.camunda.bpm.model.bpmn.BpmnModelInstance in project camunda-bpm-platform by camunda.

the class ExternalTaskServiceTest method testCompleteWithNonLocalVariables.

public void testCompleteWithNonLocalVariables() {
    // given
    BpmnModelInstance instance = Bpmn.createExecutableProcess("Process").startEvent().serviceTask("externalTask").camundaType("external").camundaTopic("foo").camundaTaskPriority("100").camundaExecutionListenerClass(ExecutionListener.EVENTNAME_END, ReadLocalVariableListenerImpl.class).userTask("user").endEvent().done();
    deployment(instance);
    ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("Process");
    List<LockedExternalTask> lockedTasks = externalTaskService.fetchAndLock(1, WORKER_ID).topic("foo", 1L).execute();
    // when
    externalTaskService.complete(lockedTasks.get(0).getId(), WORKER_ID, Variables.createVariables().putValue("abc", "bar"), null);
    // then
    VariableInstance variableInstance = runtimeService.createVariableInstanceQuery().processInstanceIdIn(processInstance.getId()).singleResult();
    assertNotNull(variableInstance);
    assertEquals("bar", variableInstance.getValue());
    assertEquals("abc", variableInstance.getName());
}
Also used : LockedExternalTask(org.camunda.bpm.engine.externaltask.LockedExternalTask) ProcessInstance(org.camunda.bpm.engine.runtime.ProcessInstance) BpmnModelInstance(org.camunda.bpm.model.bpmn.BpmnModelInstance) VariableInstance(org.camunda.bpm.engine.runtime.VariableInstance) HistoricVariableInstance(org.camunda.bpm.engine.history.HistoricVariableInstance)

Example 8 with BpmnModelInstance

use of org.camunda.bpm.model.bpmn.BpmnModelInstance in project camunda-bpm-platform by camunda.

the class MultiTenancyEventSubscriptionQueryTest method setUp.

@Override
protected void setUp() {
    BpmnModelInstance process = Bpmn.createExecutableProcess("testProcess").startEvent().message("start").userTask().endEvent().done();
    deployment(process);
    deploymentForTenant(TENANT_ONE, process);
    deploymentForTenant(TENANT_TWO, process);
// the deployed process definition contains a message start event
// - so a message event subscription is created on deployment.
}
Also used : BpmnModelInstance(org.camunda.bpm.model.bpmn.BpmnModelInstance)

Example 9 with BpmnModelInstance

use of org.camunda.bpm.model.bpmn.BpmnModelInstance in project camunda-bpm-platform by camunda.

the class TenantIdProviderTest method setsTenantIdForHistoricDecisionInstance_BusinessRuleTask.

@Test
public void setsTenantIdForHistoricDecisionInstance_BusinessRuleTask() {
    String tenantId = TENANT_ID;
    SetValueOnHistoricDecisionInstanceTenantIdProvider tenantIdProvider = new SetValueOnHistoricDecisionInstanceTenantIdProvider(tenantId);
    TestTenantIdProvider.delegate = tenantIdProvider;
    BpmnModelInstance process = Bpmn.createExecutableProcess(PROCESS_DEFINITION_KEY).startEvent().businessRuleTask().camundaDecisionRef(DECISION_DEFINITION_KEY).camundaAsyncAfter().endEvent().done();
    testRule.deploy(process, DMN_FILE);
    // if a process instance is started
    engineRule.getRuntimeService().createProcessInstanceByKey(PROCESS_DEFINITION_KEY).setVariables(createVariables()).execute();
    // then the tenant id provider can set the tenant id to a value
    HistoricDecisionInstance historicDecisionInstance = engineRule.getHistoryService().createHistoricDecisionInstanceQuery().decisionDefinitionKey(DECISION_DEFINITION_KEY).singleResult();
    assertThat(historicDecisionInstance.getTenantId(), is(tenantId));
}
Also used : HistoricDecisionInstance(org.camunda.bpm.engine.history.HistoricDecisionInstance) BpmnModelInstance(org.camunda.bpm.model.bpmn.BpmnModelInstance) Test(org.junit.Test)

Example 10 with BpmnModelInstance

use of org.camunda.bpm.model.bpmn.BpmnModelInstance in project camunda-bpm-platform by camunda.

the class MultiTenancyHistoricProcessInstanceStateTest method testSuspensionWithTenancy.

@Test
public void testSuspensionWithTenancy() throws Exception {
    BpmnModelInstance instance = Bpmn.createExecutableProcess(PROCESS_ID).startEvent().userTask().endEvent().done();
    ProcessDefinition processDefinition = processEngineTestRule.deployAndGetDefinition(instance);
    ProcessDefinition processDefinition1 = processEngineTestRule.deployForTenantAndGetDefinition(TENANT_ONE, instance);
    ProcessDefinition processDefinition2 = processEngineTestRule.deployForTenantAndGetDefinition(TENANT_TWO, instance);
    ProcessInstance processInstance = processEngineRule.getRuntimeService().startProcessInstanceById(processDefinition.getId());
    ProcessInstance processInstance1 = processEngineRule.getRuntimeService().startProcessInstanceById(processDefinition1.getId());
    ProcessInstance processInstance2 = processEngineRule.getRuntimeService().startProcessInstanceById(processDefinition2.getId());
    // suspend Tenant one
    processEngineRule.getRuntimeService().updateProcessInstanceSuspensionState().byProcessDefinitionKey(processDefinition1.getKey()).processDefinitionTenantId(processDefinition1.getTenantId()).suspend();
    String[] processInstances = { processInstance1.getId(), processInstance2.getId(), processInstance.getId() };
    verifyStates(processInstances, new String[] { HistoricProcessInstance.STATE_SUSPENDED, HistoricProcessInstance.STATE_ACTIVE, HistoricProcessInstance.STATE_ACTIVE });
    // suspend without tenant
    processEngineRule.getRuntimeService().updateProcessInstanceSuspensionState().byProcessDefinitionKey(processDefinition.getKey()).processDefinitionWithoutTenantId().suspend();
    verifyStates(processInstances, new String[] { HistoricProcessInstance.STATE_SUSPENDED, HistoricProcessInstance.STATE_ACTIVE, HistoricProcessInstance.STATE_SUSPENDED });
    // reactivate without tenant
    processEngineRule.getRuntimeService().updateProcessInstanceSuspensionState().byProcessDefinitionKey(processDefinition.getKey()).processDefinitionWithoutTenantId().activate();
    verifyStates(processInstances, new String[] { HistoricProcessInstance.STATE_SUSPENDED, HistoricProcessInstance.STATE_ACTIVE, HistoricProcessInstance.STATE_ACTIVE });
}
Also used : ProcessDefinition(org.camunda.bpm.engine.repository.ProcessDefinition) HistoricProcessInstance(org.camunda.bpm.engine.history.HistoricProcessInstance) ProcessInstance(org.camunda.bpm.engine.runtime.ProcessInstance) BpmnModelInstance(org.camunda.bpm.model.bpmn.BpmnModelInstance) Test(org.junit.Test)

Aggregations

BpmnModelInstance (org.camunda.bpm.model.bpmn.BpmnModelInstance)587 Test (org.junit.Test)408 ProcessInstance (org.camunda.bpm.engine.runtime.ProcessInstance)258 Task (org.camunda.bpm.engine.task.Task)139 TaskQuery (org.camunda.bpm.engine.task.TaskQuery)124 ProcessDefinition (org.camunda.bpm.engine.repository.ProcessDefinition)119 MigrationPlan (org.camunda.bpm.engine.migration.MigrationPlan)67 ProcessApplicationDeployment (org.camunda.bpm.engine.repository.ProcessApplicationDeployment)47 Deployment (org.camunda.bpm.engine.repository.Deployment)39 ProcessDefinitionQuery (org.camunda.bpm.engine.repository.ProcessDefinitionQuery)27 Job (org.camunda.bpm.engine.runtime.Job)24 HistoricProcessInstance (org.camunda.bpm.engine.history.HistoricProcessInstance)22 VariableInstance (org.camunda.bpm.engine.runtime.VariableInstance)21 ProcessEngineException (org.camunda.bpm.engine.ProcessEngineException)16 Date (java.util.Date)15 HashMap (java.util.HashMap)15 HistoricVariableInstance (org.camunda.bpm.engine.history.HistoricVariableInstance)14 Execution (org.camunda.bpm.engine.runtime.Execution)14 MigratingBpmnEventTrigger (org.camunda.bpm.engine.test.api.runtime.migration.util.MigratingBpmnEventTrigger)14 SequenceFlow (org.camunda.bpm.model.bpmn.instance.SequenceFlow)14