use of org.activiti.api.process.runtime.conf.ProcessRuntimeConfiguration in project Activiti by Activiti.
the class ProcessExtensionsIT method processInstanceFailsIfVariableTypeIncorrect.
@Test
public void processInstanceFailsIfVariableTypeIncorrect() {
ProcessRuntimeConfiguration configuration = processRuntime.configuration();
assertThat(configuration).isNotNull();
assertThatExceptionOfType(IllegalStateException.class).isThrownBy(() -> {
processRuntime.start(ProcessPayloadBuilder.start().withProcessDefinitionKey(INITIAL_VARS_PROCESS).withVariable("age", true).withVariable("name", 7).withVariable("subscribe", "ok").withVariable("birth", "2007-10-01").build());
}).withMessage("Variables fail type validation: subscribe, name, age");
}
use of org.activiti.api.process.runtime.conf.ProcessRuntimeConfiguration in project Activiti by Activiti.
the class ConformanceBasicProcessRuntimeTest method shouldGetConfiguration.
@Test
public void shouldGetConfiguration() {
securityUtil.logInAs("user1");
// when
ProcessRuntimeConfiguration configuration = processRuntime.configuration();
// then
assertThat(configuration).isNotNull();
// when
List<ProcessRuntimeEventListener<?>> processRuntimeEventListeners = configuration.processEventListeners();
List<VariableEventListener<?>> variableEventListeners = configuration.variableEventListeners();
// then
assertThat(processRuntimeEventListeners).isNotEmpty();
assertThat(variableEventListeners).isNotEmpty();
}
use of org.activiti.api.process.runtime.conf.ProcessRuntimeConfiguration in project Activiti by Activiti.
the class ConformanceBasicProcessRuntimeTest method shouldGetConfiguration.
@Test
public void shouldGetConfiguration() {
securityUtil.logInAs("user1");
// when
ProcessRuntimeConfiguration configuration = processRuntime.configuration();
// then
assertThat(configuration).isNotNull();
// when
List<ProcessRuntimeEventListener<?>> processRuntimeEventListeners = configuration.processEventListeners();
List<VariableEventListener<?>> variableEventListeners = configuration.variableEventListeners();
// then
assertThat(processRuntimeEventListeners).hasSize(11);
assertThat(variableEventListeners).hasSize(3);
}
use of org.activiti.api.process.runtime.conf.ProcessRuntimeConfiguration in project Activiti by Activiti.
the class ProcessRuntimeIT method updateProcessInstance.
@Test
public void updateProcessInstance() {
ProcessRuntimeConfiguration configuration = processRuntime.configuration();
assertThat(configuration).isNotNull();
Page<ProcessDefinition> processDefinitionPage = processRuntime.processDefinitions(PAGEABLE);
assertThat(processDefinitionPage.getContent()).isNotNull();
assertThat(processDefinitionPage.getContent()).extracting(ProcessDefinition::getKey).contains(CATEGORIZE_HUMAN_PROCESS);
// start a process with a business key to check filters
ProcessInstance categorizeProcess = processRuntime.start(ProcessPayloadBuilder.start().withProcessDefinitionKey(CATEGORIZE_HUMAN_PROCESS).withVariable("expectedKey", true).withBusinessKey("my business key").withName("my process name").build());
assertThat(categorizeProcess).isNotNull();
assertThat(categorizeProcess.getStatus()).isEqualTo(ProcessInstance.ProcessInstanceStatus.RUNNING);
assertThat(categorizeProcess.getName()).isEqualTo("my process name");
// assertThat(categorizeProcess.getDescription()).isNull();
//
// To do: currently Description is not possible to update
//
// update a process
Page<ProcessInstance> processInstancePage = processRuntime.processInstances(PAGEABLE);
ProcessInstance processInstance = processInstancePage.getContent().get(0);
UpdateProcessPayload updateProcessPayload = ProcessPayloadBuilder.update().withProcessInstanceId(processInstance.getId()).withBusinessKey(processInstance.getBusinessKey() + " UPDATED").withName(processInstance.getName() + " UPDATED").build();
ProcessInstance updatedProcessInstance = processRuntime.update(updateProcessPayload);
assertThat(updatedProcessInstance).isNotNull();
processInstancePage = processRuntime.processInstances(PAGEABLE);
assertThat(processInstancePage).isNotNull();
assertThat(processInstancePage.getContent()).hasSize(1);
processInstance = processInstancePage.getContent().get(0);
assertThat(processInstance.getName()).isEqualTo("my process name UPDATED");
assertThat(processInstance.getBusinessKey()).isEqualTo("my business key UPDATED");
// delete a process to avoid possible problems with other tests
ProcessInstance deletedProcessInstance = processRuntime.delete(ProcessPayloadBuilder.delete(categorizeProcess));
assertThat(deletedProcessInstance).isNotNull();
assertThat(deletedProcessInstance.getStatus()).isEqualTo(ProcessInstance.ProcessInstanceStatus.CANCELLED);
}
use of org.activiti.api.process.runtime.conf.ProcessRuntimeConfiguration in project Activiti by Activiti.
the class ProcessRuntimeIT method shouldGetConfiguration.
@Test
public void shouldGetConfiguration() {
// when
ProcessRuntimeConfiguration configuration = processRuntime.configuration();
// then
assertThat(configuration).isNotNull();
}
Aggregations