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());
}
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());
}
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.
}
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));
}
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 });
}
Aggregations