Search in sources :

Example 66 with ObjectNode

use of com.fasterxml.jackson.databind.node.ObjectNode in project Activiti by Activiti.

the class DisabledDefinitionInfoCacheTest method testChangeClassName.

@Deployment
public void testChangeClassName() {
    // first test without changing the class name
    Map<String, Object> varMap = new HashMap<String, Object>();
    varMap.put("count", 0);
    varMap.put("count2", 0);
    ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("dynamicServiceTask", varMap);
    Task task = taskService.createTaskQuery().processInstanceId(processInstance.getId()).singleResult();
    taskService.complete(task.getId());
    assertEquals(1, runtimeService.getVariable(processInstance.getId(), "count"));
    assertEquals(0, runtimeService.getVariable(processInstance.getId(), "count2"));
    task = taskService.createTaskQuery().processInstanceId(processInstance.getId()).singleResult();
    taskService.complete(task.getId());
    assertProcessEnded(processInstance.getId());
    // now test with changing the class name
    varMap = new HashMap<String, Object>();
    varMap.put("count", 0);
    varMap.put("count2", 0);
    processInstance = runtimeService.startProcessInstanceByKey("dynamicServiceTask", varMap);
    String processDefinitionId = processInstance.getProcessDefinitionId();
    ObjectNode infoNode = dynamicBpmnService.changeServiceTaskClassName("service", "org.activiti.engine.test.bpmn.servicetask.DummyServiceTask2");
    dynamicBpmnService.saveProcessDefinitionInfo(processDefinitionId, infoNode);
    task = taskService.createTaskQuery().processInstanceId(processInstance.getId()).singleResult();
    taskService.complete(task.getId());
    assertEquals(1, runtimeService.getVariable(processInstance.getId(), "count"));
    assertEquals(0, runtimeService.getVariable(processInstance.getId(), "count2"));
    task = taskService.createTaskQuery().processInstanceId(processInstance.getId()).singleResult();
    taskService.complete(task.getId());
    assertProcessEnded(processInstance.getId());
}
Also used : Task(org.activiti.engine.task.Task) ObjectNode(com.fasterxml.jackson.databind.node.ObjectNode) HashMap(java.util.HashMap) ProcessInstance(org.activiti.engine.runtime.ProcessInstance) Deployment(org.activiti.engine.test.Deployment)

Example 67 with ObjectNode

use of com.fasterxml.jackson.databind.node.ObjectNode in project Activiti by Activiti.

the class DisabledDefinitionInfoCacheTest method testChangeFormKey.

@Deployment
public void testChangeFormKey() {
    // first test without changing the form key
    ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("dynamicUserTask");
    String processDefinitionId = processInstance.getProcessDefinitionId();
    Task task = taskService.createTaskQuery().processInstanceId(processInstance.getId()).singleResult();
    assertEquals("test", task.getFormKey());
    taskService.complete(task.getId());
    assertProcessEnded(processInstance.getId());
    // now test with changing the form key
    ObjectNode infoNode = dynamicBpmnService.changeUserTaskFormKey("task1", "test2");
    dynamicBpmnService.saveProcessDefinitionInfo(processDefinitionId, infoNode);
    processInstance = runtimeService.startProcessInstanceByKey("dynamicUserTask");
    task = taskService.createTaskQuery().processInstanceId(processInstance.getId()).singleResult();
    assertEquals("test", task.getFormKey());
    taskService.complete(task.getId());
    assertProcessEnded(processInstance.getId());
}
Also used : Task(org.activiti.engine.task.Task) ObjectNode(com.fasterxml.jackson.databind.node.ObjectNode) ProcessInstance(org.activiti.engine.runtime.ProcessInstance) Deployment(org.activiti.engine.test.Deployment)

Example 68 with ObjectNode

use of com.fasterxml.jackson.databind.node.ObjectNode in project Activiti by Activiti.

the class DynamicUserTaskTest method testChangeOwner.

@Deployment(resources = { "org/activiti/engine/test/bpmn/usertask/DynamicUserTaskTest.assignment.bpmn20.xml" })
public void testChangeOwner() {
    // first test without changing the form key
    ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("dynamicUserTask");
    String processDefinitionId = processInstance.getProcessDefinitionId();
    Task task = taskService.createTaskQuery().processInstanceId(processInstance.getId()).singleResult();
    assertEquals("ownerTest", task.getOwner());
    taskService.complete(task.getId());
    assertProcessEnded(processInstance.getId());
    // now test with changing the form key
    ObjectNode infoNode = dynamicBpmnService.changeUserTaskOwner("task1", "ownerTest2");
    dynamicBpmnService.saveProcessDefinitionInfo(processDefinitionId, infoNode);
    processInstance = runtimeService.startProcessInstanceByKey("dynamicUserTask");
    task = taskService.createTaskQuery().processInstanceId(processInstance.getId()).singleResult();
    assertEquals("ownerTest2", task.getOwner());
    taskService.complete(task.getId());
    assertProcessEnded(processInstance.getId());
}
Also used : Task(org.activiti.engine.task.Task) ObjectNode(com.fasterxml.jackson.databind.node.ObjectNode) ProcessInstance(org.activiti.engine.runtime.ProcessInstance) Deployment(org.activiti.engine.test.Deployment)

Example 69 with ObjectNode

use of com.fasterxml.jackson.databind.node.ObjectNode in project Activiti by Activiti.

the class DynamicUserTaskTest method testChangeAssignee.

@Deployment(resources = { "org/activiti/engine/test/bpmn/usertask/DynamicUserTaskTest.assignment.bpmn20.xml" })
public void testChangeAssignee() {
    // first test without changing the form key
    ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("dynamicUserTask");
    String processDefinitionId = processInstance.getProcessDefinitionId();
    Task task = taskService.createTaskQuery().processInstanceId(processInstance.getId()).singleResult();
    assertEquals("test", task.getAssignee());
    taskService.complete(task.getId());
    assertProcessEnded(processInstance.getId());
    // now test with changing the form key
    ObjectNode infoNode = dynamicBpmnService.changeUserTaskAssignee("task1", "test2");
    dynamicBpmnService.saveProcessDefinitionInfo(processDefinitionId, infoNode);
    processInstance = runtimeService.startProcessInstanceByKey("dynamicUserTask");
    task = taskService.createTaskQuery().processInstanceId(processInstance.getId()).singleResult();
    assertEquals("test2", task.getAssignee());
    taskService.complete(task.getId());
    assertProcessEnded(processInstance.getId());
}
Also used : Task(org.activiti.engine.task.Task) ObjectNode(com.fasterxml.jackson.databind.node.ObjectNode) ProcessInstance(org.activiti.engine.runtime.ProcessInstance) Deployment(org.activiti.engine.test.Deployment)

Example 70 with ObjectNode

use of com.fasterxml.jackson.databind.node.ObjectNode in project Activiti by Activiti.

the class DynamicUserTaskTest method testChangeNameAndDescription.

@Deployment(resources = { "org/activiti/engine/test/bpmn/usertask/DynamicUserTaskTest.basictask.bpmn20.xml" })
public void testChangeNameAndDescription() {
    // first test without changing the form key
    ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("dynamicUserTask");
    String processDefinitionId = processInstance.getProcessDefinitionId();
    Task task = taskService.createTaskQuery().processInstanceId(processInstance.getId()).singleResult();
    assertNull(task.getName());
    assertNull(task.getDescription());
    taskService.complete(task.getId());
    assertProcessEnded(processInstance.getId());
    // now test with changing the form key
    ObjectNode infoNode = dynamicBpmnService.changeUserTaskName("task1", "Task name test");
    dynamicBpmnService.changeUserTaskDescription("task1", "Task description test", infoNode);
    dynamicBpmnService.saveProcessDefinitionInfo(processDefinitionId, infoNode);
    processInstance = runtimeService.startProcessInstanceByKey("dynamicUserTask");
    task = taskService.createTaskQuery().processInstanceId(processInstance.getId()).singleResult();
    assertEquals("Task name test", task.getName());
    assertEquals("Task description test", task.getDescription());
    taskService.complete(task.getId());
    assertProcessEnded(processInstance.getId());
}
Also used : Task(org.activiti.engine.task.Task) ObjectNode(com.fasterxml.jackson.databind.node.ObjectNode) ProcessInstance(org.activiti.engine.runtime.ProcessInstance) Deployment(org.activiti.engine.test.Deployment)

Aggregations

ObjectNode (com.fasterxml.jackson.databind.node.ObjectNode)769 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)185 ArrayNode (com.fasterxml.jackson.databind.node.ArrayNode)167 JsonNode (com.fasterxml.jackson.databind.JsonNode)165 Test (org.junit.Test)112 StringEntity (org.apache.http.entity.StringEntity)88 Deployment (org.activiti.engine.test.Deployment)84 CloseableHttpResponse (org.apache.http.client.methods.CloseableHttpResponse)67 ProcessInstance (org.activiti.engine.runtime.ProcessInstance)64 Task (org.activiti.engine.task.Task)49 HttpPost (org.apache.http.client.methods.HttpPost)49 JCodeModel (com.sun.codemodel.JCodeModel)45 JPackage (com.sun.codemodel.JPackage)44 IOException (java.io.IOException)44 HttpPut (org.apache.http.client.methods.HttpPut)40 JType (com.sun.codemodel.JType)39 HashMap (java.util.HashMap)39 Cluster (org.apache.geode.tools.pulse.internal.data.Cluster)39 Map (java.util.Map)33 ArrayList (java.util.ArrayList)32