Search in sources :

Example 21 with ServiceTask

use of org.activiti.bpmn.model.ServiceTask in project Activiti by Activiti.

the class ServiceTaskConverterTest method validateModel.

private void validateModel(BpmnModel model) {
    FlowElement flowElement = model.getMainProcess().getFlowElement("servicetask");
    assertNotNull(flowElement);
    assertTrue(flowElement instanceof ServiceTask);
    assertEquals("servicetask", flowElement.getId());
    ServiceTask serviceTask = (ServiceTask) flowElement;
    assertEquals("servicetask", serviceTask.getId());
    assertEquals("Service task", serviceTask.getName());
    List<FieldExtension> fields = serviceTask.getFieldExtensions();
    assertEquals(2, fields.size());
    FieldExtension field = (FieldExtension) fields.get(0);
    assertEquals("testField", field.getFieldName());
    assertEquals("test", field.getStringValue());
    field = (FieldExtension) fields.get(1);
    assertEquals("testField2", field.getFieldName());
    assertEquals("${test}", field.getExpression());
    List<ActivitiListener> listeners = serviceTask.getExecutionListeners();
    assertEquals(3, listeners.size());
    ActivitiListener listener = (ActivitiListener) listeners.get(0);
    assertTrue(ImplementationType.IMPLEMENTATION_TYPE_CLASS.equals(listener.getImplementationType()));
    assertEquals("org.test.TestClass", listener.getImplementation());
    assertEquals("start", listener.getEvent());
    listener = (ActivitiListener) listeners.get(1);
    assertTrue(ImplementationType.IMPLEMENTATION_TYPE_EXPRESSION.equals(listener.getImplementationType()));
    assertEquals("${testExpression}", listener.getImplementation());
    assertEquals("end", listener.getEvent());
    listener = (ActivitiListener) listeners.get(2);
    assertTrue(ImplementationType.IMPLEMENTATION_TYPE_DELEGATEEXPRESSION.equals(listener.getImplementationType()));
    assertEquals("${delegateExpression}", listener.getImplementation());
    assertEquals("start", listener.getEvent());
}
Also used : ServiceTask(org.activiti.bpmn.model.ServiceTask) FlowElement(org.activiti.bpmn.model.FlowElement) FieldExtension(org.activiti.bpmn.model.FieldExtension) ActivitiListener(org.activiti.bpmn.model.ActivitiListener)

Aggregations

ServiceTask (org.activiti.bpmn.model.ServiceTask)21 FlowElement (org.activiti.bpmn.model.FlowElement)9 FieldExtension (org.activiti.bpmn.model.FieldExtension)6 ActivitiListener (org.activiti.bpmn.model.ActivitiListener)4 UserTask (org.activiti.bpmn.model.UserTask)3 ScriptServiceTaskBuilder (org.activiti.workflow.simple.alfresco.conversion.script.ScriptServiceTaskBuilder)3 BoundaryEvent (org.activiti.bpmn.model.BoundaryEvent)2 MultiInstanceLoopCharacteristics (org.activiti.bpmn.model.MultiInstanceLoopCharacteristics)2 Process (org.activiti.bpmn.model.Process)2 SequenceFlow (org.activiti.bpmn.model.SequenceFlow)2 PropertyReference (org.activiti.workflow.simple.alfresco.conversion.script.PropertyReference)2 M2Model (org.activiti.workflow.simple.alfresco.model.M2Model)2 M2Type (org.activiti.workflow.simple.alfresco.model.M2Type)2 Test (org.junit.Test)2 JsonNode (com.fasterxml.jackson.databind.JsonNode)1 ArrayNode (com.fasterxml.jackson.databind.node.ArrayNode)1 ObjectNode (com.fasterxml.jackson.databind.node.ObjectNode)1 List (java.util.List)1 Activity (org.activiti.bpmn.model.Activity)1 Artifact (org.activiti.bpmn.model.Artifact)1