use of org.activiti.api.process.model.ProcessDefinition in project Activiti by Activiti.
the class ProcessRuntimeIT method updateProcessInstanceAdmin.
@Test
public void updateProcessInstanceAdmin() {
securityUtil.logInAs("admin");
Page<ProcessDefinition> processDefinitionPage = processAdminRuntime.processDefinitions(Pageable.of(0, 50));
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 = processAdminRuntime.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");
// update a process
Page<ProcessInstance> processInstancePage = processAdminRuntime.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 = processAdminRuntime.update(updateProcessPayload);
assertThat(updatedProcessInstance).isNotNull();
processInstancePage = processAdminRuntime.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 = processAdminRuntime.delete(ProcessPayloadBuilder.delete(categorizeProcess));
assertThat(deletedProcessInstance).isNotNull();
assertThat(deletedProcessInstance.getStatus()).isEqualTo(ProcessInstance.ProcessInstanceStatus.CANCELLED);
}
use of org.activiti.api.process.model.ProcessDefinition in project Activiti by Activiti.
the class ProcessRuntimeIT method should_OnlyProcessDefinitionsFromLatestVersionRetrieved.
@Test
public void should_OnlyProcessDefinitionsFromLatestVersionRetrieved() {
Deployment deployment = processRuntime.selectLatestDeployment();
Page<ProcessDefinition> processDefinitionPage = processRuntime.processDefinitions(PAGEABLE);
assertThat(processDefinitionPage.getContent().stream().filter(c -> c.getKey().equals(SUPER_PROCESS))).extracting(ProcessDefinition::getAppVersion).containsOnly(deployment.getVersion().toString());
}
use of org.activiti.api.process.model.ProcessDefinition in project Activiti by Activiti.
the class ProcessRuntimeIT method shouldGetProcessDefinitionFromDefinitionKey.
@Test
public void shouldGetProcessDefinitionFromDefinitionKey() {
// when
ProcessDefinition categorizeHumanProcess = processRuntime.processDefinition(CATEGORIZE_HUMAN_PROCESS);
// then
assertThat(categorizeHumanProcess).isNotNull();
assertThat(categorizeHumanProcess.getName()).isEqualTo(CATEGORIZE_HUMAN_PROCESS);
assertThat(categorizeHumanProcess.getId()).contains(CATEGORIZE_HUMAN_PROCESS);
}
use of org.activiti.api.process.model.ProcessDefinition in project Activiti by Activiti.
the class ProcessRuntimeSecurityPoliciesIT method getRestrictedProcessDefs.
@Test
public void getRestrictedProcessDefs() {
securityUtil.logInAs("user");
// @TODO: I should get the security policies defined here.
ProcessRuntimeConfiguration configuration = processRuntime.configuration();
assertThat(configuration).isNotNull();
Page<ProcessDefinition> processDefinitionPage = processRuntime.processDefinitions(Pageable.of(0, 50));
assertThat(processDefinitionPage.getContent()).isNotNull();
assertThat(processDefinitionPage.getContent()).hasSize(2);
}
use of org.activiti.api.process.model.ProcessDefinition in project Activiti by Activiti.
the class ProcessDefinitionFormKeyIT method processDefinitionHasFormKey.
@Test
public void processDefinitionHasFormKey() {
securityUtil.logInAs("garth");
ProcessDefinition processDefinition = processRuntime.processDefinition(SINGLE_TASK_PROCESS);
assertThat(processDefinition.getFormKey()).isEqualTo("startForm");
}
Aggregations