Search in sources :

Example 1 with ProcessInstance

use of org.activiti.api.process.model.ProcessInstance in project Activiti by Activiti.

the class APIProcessInstanceConverterTest method should_convertFromInternalProcessInstance_when_appVersionIsNotSet.

@Test
public void should_convertFromInternalProcessInstance_when_appVersionIsNotSet() {
    ExecutionEntity internalProcessInstance = anInternalProcessInstance(null);
    ProcessInstance result = subject.from(internalProcessInstance);
    assertValidProcessInstanceResult(result, null);
}
Also used : ExecutionEntity(org.activiti.engine.impl.persistence.entity.ExecutionEntity) ProcessInstance(org.activiti.api.process.model.ProcessInstance) Test(org.junit.jupiter.api.Test)

Example 2 with ProcessInstance

use of org.activiti.api.process.model.ProcessInstance in project Activiti by Activiti.

the class APIProcessInstanceConverterTest method should_convertFromInternalProcessInstance_when_withCompletedStatus.

@Test
public void should_convertFromInternalProcessInstance_when_withCompletedStatus() {
    ExecutionEntity internalProcessInstance = anInternalProcessInstance(APP_VERSION);
    internalProcessInstance.setEnded(true);
    ProcessInstance result = subject.from(internalProcessInstance);
    assertValidProcessInstanceResult(result);
    assertThat(result.getStatus()).isEqualTo(ProcessInstanceStatus.COMPLETED);
}
Also used : ExecutionEntity(org.activiti.engine.impl.persistence.entity.ExecutionEntity) ProcessInstance(org.activiti.api.process.model.ProcessInstance) Test(org.junit.jupiter.api.Test)

Example 3 with ProcessInstance

use of org.activiti.api.process.model.ProcessInstance in project Activiti by Activiti.

the class APIProcessInstanceConverterTest method should_convertFromInternalProcessInstance_when_withSuspendedStatus.

@Test
public void should_convertFromInternalProcessInstance_when_withSuspendedStatus() {
    ExecutionEntity internalProcessInstance = anInternalProcessInstance(APP_VERSION);
    internalProcessInstance.setSuspensionState(SuspensionState.SUSPENDED.getStateCode());
    ProcessInstance result = subject.from(internalProcessInstance);
    assertValidProcessInstanceResult(result);
    assertThat(result.getStatus()).isEqualTo(ProcessInstanceStatus.SUSPENDED);
}
Also used : ExecutionEntity(org.activiti.engine.impl.persistence.entity.ExecutionEntity) ProcessInstance(org.activiti.api.process.model.ProcessInstance) Test(org.junit.jupiter.api.Test)

Example 4 with ProcessInstance

use of org.activiti.api.process.model.ProcessInstance in project Activiti by Activiti.

the class ProcessRuntimeImpl method suspend.

@Override
public ProcessInstance suspend(SuspendProcessPayload suspendProcessPayload) {
    ProcessInstance processInstance = processInstance(suspendProcessPayload.getProcessInstanceId());
    checkUserCanWrite(processInstance.getProcessDefinitionKey());
    runtimeService.suspendProcessInstanceById(suspendProcessPayload.getProcessInstanceId());
    return processInstanceConverter.from(runtimeService.createProcessInstanceQuery().processInstanceId(suspendProcessPayload.getProcessInstanceId()).singleResult());
}
Also used : ProcessInstance(org.activiti.api.process.model.ProcessInstance)

Example 5 with ProcessInstance

use of org.activiti.api.process.model.ProcessInstance in project Activiti by Activiti.

the class TaskRuntimeMultiInstanceIT method sequentialMultiInstance_should_collectOutputValues.

@Test
public void sequentialMultiInstance_should_collectOutputValues() {
    ProcessInstance processInstance = processBaseRuntime.startProcessWithProcessDefinitionKey("miSequentialUserTasksOutputCollection");
    List<Task> tasks = taskBaseRuntime.getTasks(processInstance);
    assertThat(tasks).hasSize(1);
    taskBaseRuntime.completeTask(tasks.get(0), singletonMap("meal", "pizza"));
    tasks = taskBaseRuntime.getTasks(processInstance);
    assertThat(tasks).hasSize(1);
    taskBaseRuntime.completeTask(tasks.get(0), singletonMap("meal", "pasta"));
    List<VariableInstance> variables = processBaseRuntime.getVariables(processInstance);
    assertThat(variables).extracting(VariableInstance::getName, VariableInstance::getValue).contains(tuple("meals", asList("pizza", "pasta")));
}
Also used : Task(org.activiti.api.task.model.Task) ProcessInstance(org.activiti.api.process.model.ProcessInstance) VariableInstance(org.activiti.api.model.shared.model.VariableInstance) Test(org.junit.jupiter.api.Test) SpringBootTest(org.springframework.boot.test.context.SpringBootTest)

Aggregations

ProcessInstance (org.activiti.api.process.model.ProcessInstance)154 Test (org.junit.jupiter.api.Test)123 SpringBootTest (org.springframework.boot.test.context.SpringBootTest)116 Task (org.activiti.api.task.model.Task)73 AfterEach (org.junit.jupiter.api.AfterEach)57 VariableInstance (org.activiti.api.model.shared.model.VariableInstance)54 Assertions.assertThat (org.assertj.core.api.Assertions.assertThat)39 Autowired (org.springframework.beans.factory.annotation.Autowired)39 BeforeEach (org.junit.jupiter.api.BeforeEach)38 Page (org.activiti.api.runtime.shared.query.Page)37 SecurityUtil (org.activiti.spring.boot.security.util.SecurityUtil)37 ProcessCleanUpUtil (org.activiti.spring.boot.test.util.ProcessCleanUpUtil)37 Import (org.springframework.context.annotation.Import)35 List (java.util.List)33 Assertions.tuple (org.assertj.core.api.Assertions.tuple)33 Assertions.catchThrowable (org.assertj.core.api.Assertions.catchThrowable)31 LocalEventSource (org.activiti.test.LocalEventSource)30 RuntimeEvent (org.activiti.api.model.shared.event.RuntimeEvent)29 ProcessRuntimeEvent (org.activiti.api.process.model.events.ProcessRuntimeEvent)29 TaskRuntimeEvent (org.activiti.api.task.model.events.TaskRuntimeEvent)29