Search in sources :

Example 1 with CloudProcessInstance

use of org.activiti.cloud.api.process.model.CloudProcessInstance in project activiti-cloud-application by Activiti.

the class Tasks method checkIfFormKeyAndProcessInstanceFieldsArePresent.

@Then("the task has the formKey field and correct processInstance fields")
public void checkIfFormKeyAndProcessInstanceFieldsArePresent() {
    newTask = obtainFirstTaskFromProcess();
    assertThat(newTask).isNotNull().extracting(CloudTask::getFormKey).isEqualTo("taskForm");
    CloudProcessInstance processFromQuery = processQuerySteps.getProcessInstance(Serenity.sessionVariableCalled("processInstanceId").toString());
    assertThat(processFromQuery).isNotNull();
    CloudTask taskFromRB = taskRuntimeBundleSteps.getTaskById(newTask.getId());
    assertThat(taskFromRB).isNotNull();
    assertThat(taskFromRB.getFormKey()).isEqualTo("taskForm");
    assertThat(taskFromRB.getProcessDefinitionId()).isEqualTo(processFromQuery.getProcessDefinitionId());
    CloudTask taskFromQuery = taskQuerySteps.getTaskById(newTask.getId());
    assertThat(taskFromQuery).isNotNull();
    assertThat(taskFromQuery.getFormKey()).isEqualTo("taskForm");
    assertThat(taskFromQuery.getProcessDefinitionId()).isEqualTo(processFromQuery.getProcessDefinitionId());
    assertThat(taskFromQuery.getProcessDefinitionVersion()).isEqualTo(processFromQuery.getProcessDefinitionVersion());
}
Also used : CloudTask(org.activiti.cloud.api.task.model.CloudTask) CloudProcessInstance(org.activiti.cloud.api.process.model.CloudProcessInstance) Then(org.jbehave.core.annotations.Then)

Example 2 with CloudProcessInstance

use of org.activiti.cloud.api.process.model.CloudProcessInstance in project activiti-cloud by Activiti.

the class Filters method checkProcessInstances.

public static Collection<CloudProcessInstance> checkProcessInstances(PagedResources<CloudProcessInstance> resource, String processKey) {
    Collection<CloudProcessInstance> rawCollection = resource.getContent();
    Collection<CloudProcessInstance> filteredCollection = new ArrayList<>();
    for (CloudProcessInstance e : rawCollection) {
        if (e.getProcessDefinitionKey().equals(processKey)) {
            filteredCollection.add(e);
        }
    }
    return filteredCollection;
}
Also used : CloudProcessInstance(org.activiti.cloud.api.process.model.CloudProcessInstance) ArrayList(java.util.ArrayList)

Example 3 with CloudProcessInstance

use of org.activiti.cloud.api.process.model.CloudProcessInstance in project activiti-cloud by Activiti.

the class ProcessQuerySteps method checkProcessInstanceStatus.

@Step
public void checkProcessInstanceStatus(String processInstanceId, ProcessInstance.ProcessInstanceStatus expectedStatus) {
    assertThat(expectedStatus).isNotNull();
    await().untilAsserted(() -> {
        CloudProcessInstance processInstance = getProcessInstance(processInstanceId);
        assertThat(processInstance).isNotNull();
        assertThat(processInstance.getStatus()).isEqualTo(expectedStatus);
        assertThat(processInstance.getServiceName()).isNotEmpty();
        assertThat(processInstance.getServiceFullName()).isNotEmpty();
    });
}
Also used : CloudProcessInstance(org.activiti.cloud.api.process.model.CloudProcessInstance) Step(net.thucydides.core.annotations.Step)

Example 4 with CloudProcessInstance

use of org.activiti.cloud.api.process.model.CloudProcessInstance in project activiti-cloud by Activiti.

the class ProcessInstanceResourceAssemblerTest method toResourceShouldReturnResourceWithSelfLinkContainingResourceId.

@Test
public void toResourceShouldReturnResourceWithSelfLinkContainingResourceId() {
    // given
    CloudProcessInstance cloudModel = mock(CloudProcessInstance.class);
    given(cloudModel.getId()).willReturn("my-identifier");
    ProcessInstance model = mock(ProcessInstance.class);
    given(toCloudProcessInstanceConverter.from(model)).willReturn(cloudModel);
    // when
    Resource<CloudProcessInstance> resource = resourceAssembler.toResource(model);
    // then
    Link selfResourceLink = resource.getLink("self");
    assertThat(selfResourceLink).isNotNull();
    assertThat(selfResourceLink.getHref()).contains("my-identifier");
}
Also used : CloudProcessInstance(org.activiti.cloud.api.process.model.CloudProcessInstance) ProcessInstance(org.activiti.api.process.model.ProcessInstance) CloudProcessInstance(org.activiti.cloud.api.process.model.CloudProcessInstance) Link(org.springframework.hateoas.Link) Test(org.junit.jupiter.api.Test)

Example 5 with CloudProcessInstance

use of org.activiti.cloud.api.process.model.CloudProcessInstance in project activiti-cloud by Activiti.

the class ProcessInstanceAdminControllerImpl method start.

@Override
public Resource<CloudProcessInstance> start(@RequestBody StartMessagePayload startMessagePayload) {
    startMessagePayload = variablesPayloadConverter.convert(startMessagePayload);
    ProcessInstance processInstance = processAdminRuntime.start(startMessagePayload);
    return resourceAssembler.toResource(processInstance);
}
Also used : ProcessInstance(org.activiti.api.process.model.ProcessInstance) CloudProcessInstance(org.activiti.cloud.api.process.model.CloudProcessInstance)

Aggregations

CloudProcessInstance (org.activiti.cloud.api.process.model.CloudProcessInstance)77 Test (org.junit.jupiter.api.Test)69 SpringBootTest (org.springframework.boot.test.context.SpringBootTest)68 CloudTask (org.activiti.cloud.api.task.model.CloudTask)25 PagedResources (org.springframework.hateoas.PagedResources)20 CloudRuntimeEvent (org.activiti.cloud.api.model.shared.events.CloudRuntimeEvent)19 Task (org.activiti.api.task.model.Task)17 StartProcessPayload (org.activiti.api.process.model.payloads.StartProcessPayload)16 ProcessInstanceRestTemplate (org.activiti.cloud.starter.tests.helper.ProcessInstanceRestTemplate)15 Assertions.assertThat (org.assertj.core.api.Assertions.assertThat)15 Assertions.tuple (org.assertj.core.api.Assertions.tuple)15 Awaitility.await (org.awaitility.Awaitility.await)15 Autowired (org.springframework.beans.factory.annotation.Autowired)15 ResponseEntity (org.springframework.http.ResponseEntity)15 DirtiesContext (org.springframework.test.annotation.DirtiesContext)15 ActiveProfiles (org.springframework.test.context.ActiveProfiles)15 ContextConfiguration (org.springframework.test.context.ContextConfiguration)15 TestPropertySource (org.springframework.test.context.TestPropertySource)15 List (java.util.List)14 StartProcessPayloadBuilder (org.activiti.api.process.model.builders.StartProcessPayloadBuilder)13