Search in sources :

Example 1 with ScheduleApprovalProcessInstance

use of io.crnk.activiti.example.model.ScheduleApprovalProcessInstance in project crnk-framework by crnk-project.

the class ProcessInstanceRepositoryTest method patchBusinessKey.

@Test
public void patchBusinessKey() {
    ScheduleApprovalProcessInstance processInstance = postProcess(null, null, null);
    processInstance.setBusinessKey("newKey");
    ScheduleApprovalProcessInstance savedProcessInstance = processRepository.save(processInstance);
    Assert.assertEquals("newKey", savedProcessInstance.getBusinessKey());
    Assert.assertNotSame(processInstance, savedProcessInstance);
}
Also used : ScheduleApprovalProcessInstance(io.crnk.activiti.example.model.ScheduleApprovalProcessInstance) Test(org.junit.Test)

Example 2 with ScheduleApprovalProcessInstance

use of io.crnk.activiti.example.model.ScheduleApprovalProcessInstance in project crnk-framework by crnk-project.

the class ProcessInstanceRepositoryTest method checkSetDefaultsOnCreate.

@Test
public void checkSetDefaultsOnCreate() {
    ScheduleApprovalProcessInstance resource = new ScheduleApprovalProcessInstance();
    // will be set by default
    resource.setProcessDefinitionKey(null);
    ScheduleApprovalProcessInstance savedResource = processRepository.create(resource);
    Assert.assertEquals("scheduleChange", savedResource.getProcessDefinitionKey());
}
Also used : ScheduleApprovalProcessInstance(io.crnk.activiti.example.model.ScheduleApprovalProcessInstance) Test(org.junit.Test)

Example 3 with ScheduleApprovalProcessInstance

use of io.crnk.activiti.example.model.ScheduleApprovalProcessInstance in project crnk-framework by crnk-project.

the class ProcessInstanceRepositoryTest method checkDelete.

@Test
public void checkDelete() {
    ScheduleApprovalProcessInstance processInstance = postProcess(null, null, null);
    processRepository.delete(processInstance.getId());
    try {
        processRepository.findOne(processInstance.getId(), new QuerySpec(ScheduleApprovalProcessInstance.class));
        Assert.fail();
    } catch (ResourceNotFoundException e) {
    // ok
    }
}
Also used : ScheduleApprovalProcessInstance(io.crnk.activiti.example.model.ScheduleApprovalProcessInstance) QuerySpec(io.crnk.core.queryspec.QuerySpec) ResourceNotFoundException(io.crnk.core.exception.ResourceNotFoundException) Test(org.junit.Test)

Example 4 with ScheduleApprovalProcessInstance

use of io.crnk.activiti.example.model.ScheduleApprovalProcessInstance in project crnk-framework by crnk-project.

the class ProcessInstanceRepositoryTest method checkResourceMapping.

@Test
public void checkResourceMapping() {
    QuerySpec querySpec = new QuerySpec(ScheduleApprovalProcessInstance.class);
    ScheduleApprovalProcessInstance resource = processRepository.findOne(processInstance.getId(), querySpec);
    assertEqualsNotNull(processInstance.getId(), resource.getId());
    assertEqualsNotNull(processInstance.getName(), resource.getName());
    assertEqualsNotNull(processInstance.isEnded(), resource.isEnded());
    assertEqualsNotNull(processInstance.isSuspended(), resource.isSuspended());
    assertEqualsNotNull(processInstance.getBusinessKey(), resource.getBusinessKey());
    assertEqualsNotNull(processInstance.getProcessDefinitionKey(), resource.getProcessDefinitionKey());
    Map<String, Object> variables = processInstance.getProcessVariables();
    assertEqualsNotNull(variables.get("newValues.name"), resource.getNewValues().getName());
    assertEqualsNotNull(variables.get("resourceId"), resource.getResourceId());
    assertEqualsNotNull(variables.get("resourceType"), resource.getResourceType());
}
Also used : ScheduleApprovalProcessInstance(io.crnk.activiti.example.model.ScheduleApprovalProcessInstance) QuerySpec(io.crnk.core.queryspec.QuerySpec) Test(org.junit.Test)

Example 5 with ScheduleApprovalProcessInstance

use of io.crnk.activiti.example.model.ScheduleApprovalProcessInstance in project crnk-framework by crnk-project.

the class ProcessInstanceRepositoryTest method patchName.

@Test
public void patchName() {
    ScheduleApprovalProcessInstance processInstance = postProcess(null, null, null);
    processInstance.setName("newName");
    ScheduleApprovalProcessInstance savedProcessInstance = processRepository.save(processInstance);
    Assert.assertEquals("newName", savedProcessInstance.getName());
    Assert.assertNotSame(processInstance, savedProcessInstance);
}
Also used : ScheduleApprovalProcessInstance(io.crnk.activiti.example.model.ScheduleApprovalProcessInstance) Test(org.junit.Test)

Aggregations

ScheduleApprovalProcessInstance (io.crnk.activiti.example.model.ScheduleApprovalProcessInstance)12 Test (org.junit.Test)8 QuerySpec (io.crnk.core.queryspec.QuerySpec)5 ApproveTask (io.crnk.activiti.example.model.ApproveTask)2 ScheduleApprovalValues (io.crnk.activiti.example.model.ScheduleApprovalValues)2 ResourceNotFoundException (io.crnk.core.exception.ResourceNotFoundException)1 FilterSpec (io.crnk.core.queryspec.FilterSpec)1 ProcessInstance (org.activiti.engine.runtime.ProcessInstance)1