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