Search in sources :

Example 11 with UserTask

use of org.eclipse.bpmn2.UserTask in project kie-wb-common by kiegroup.

the class BPMNDirectDiagramMarshallerTest method testUnmarshallUserTaskProperties.

@Test
@SuppressWarnings("unchecked")
public void testUnmarshallUserTaskProperties() throws Exception {
    Diagram<Graph, Metadata> diagram = unmarshall(BPMN_USERTASKPROPERTIES);
    assertDiagram(diagram, 4);
    assertEquals("MyBP", diagram.getMetadata().getTitle());
    UserTaskExecutionSet userTaskExecutionSet = null;
    Iterator<Element> it = nodesIterator(diagram);
    while (it.hasNext()) {
        Element element = it.next();
        if (element.getContent() instanceof View) {
            Object oDefinition = ((View) element.getContent()).getDefinition();
            if (oDefinition instanceof UserTask) {
                UserTask userTask = (UserTask) oDefinition;
                userTaskExecutionSet = userTask.getExecutionSet();
                break;
            }
        }
    }
    assertEquals("MyUserTask", userTaskExecutionSet.getTaskName().getValue());
    assertEquals("true", userTaskExecutionSet.getIsAsync().getValue().toString());
    assertEquals("false", userTaskExecutionSet.getSkippable().getValue().toString());
    assertEquals("my subject", userTaskExecutionSet.getSubject().getValue());
    assertEquals("admin", userTaskExecutionSet.getCreatedBy().getValue());
    assertEquals("my description", userTaskExecutionSet.getDescription().getValue());
    assertEquals("3", userTaskExecutionSet.getPriority().getValue());
    assertEquals("true", userTaskExecutionSet.getAdHocAutostart().getValue().toString());
    assertEquals("System.out.println(\"Hello\");", userTaskExecutionSet.getOnEntryAction().getValue().getValues().get(0).getScript());
    assertEquals("java", userTaskExecutionSet.getOnEntryAction().getValue().getValues().get(0).getLanguage());
    assertEquals("System.out.println(\"Bye\");", userTaskExecutionSet.getOnExitAction().getValue().getValues().get(0).getScript());
    assertEquals("java", userTaskExecutionSet.getOnExitAction().getValue().getValues().get(0).getLanguage());
}
Also used : Graph(org.kie.workbench.common.stunner.core.graph.Graph) UserTaskExecutionSet(org.kie.workbench.common.stunner.bpmn.definition.property.task.UserTaskExecutionSet) ItemAwareElement(org.eclipse.bpmn2.ItemAwareElement) FlowElement(org.eclipse.bpmn2.FlowElement) RootElement(org.eclipse.bpmn2.RootElement) Element(org.kie.workbench.common.stunner.core.graph.Element) Metadata(org.kie.workbench.common.stunner.core.diagram.Metadata) UserTask(org.kie.workbench.common.stunner.bpmn.definition.UserTask) View(org.kie.workbench.common.stunner.core.graph.content.view.View) Test(org.junit.Test)

Example 12 with UserTask

use of org.eclipse.bpmn2.UserTask in project kie-wb-common by kiegroup.

the class BPMNDiagramMarshallerTest method testUnmarshallUserTaskAssignees.

@Test
@SuppressWarnings("unchecked")
public void testUnmarshallUserTaskAssignees() throws Exception {
    Diagram<Graph, Metadata> diagram = unmarshall(BPMN_USERTASKASSIGNEES);
    assertDiagram(diagram, 6);
    assertEquals("UserGroups", diagram.getMetadata().getTitle());
    UserTaskExecutionSet executionSet = null;
    Iterator<Element> it = nodesIterator(diagram);
    while (it.hasNext()) {
        Element element = it.next();
        if (element.getContent() instanceof View) {
            Object oDefinition = ((View) element.getContent()).getDefinition();
            if (oDefinition instanceof UserTask) {
                UserTask userTask = (UserTask) oDefinition;
                executionSet = userTask.getExecutionSet();
                break;
            }
        }
    }
    assertEquals("user,user1", executionSet.getActors().getValue());
    assertEquals("admin,kiemgmt", executionSet.getGroupid().getValue());
}
Also used : Graph(org.kie.workbench.common.stunner.core.graph.Graph) UserTaskExecutionSet(org.kie.workbench.common.stunner.bpmn.definition.property.task.UserTaskExecutionSet) ItemAwareElement(org.eclipse.bpmn2.ItemAwareElement) FlowElement(org.eclipse.bpmn2.FlowElement) RootElement(org.eclipse.bpmn2.RootElement) Element(org.kie.workbench.common.stunner.core.graph.Element) Metadata(org.kie.workbench.common.stunner.core.diagram.Metadata) UserTask(org.kie.workbench.common.stunner.bpmn.definition.UserTask) View(org.kie.workbench.common.stunner.core.graph.content.view.View) Test(org.junit.Test)

Aggregations

ItemAwareElement (org.eclipse.bpmn2.ItemAwareElement)9 Test (org.junit.Test)8 UserTask (org.kie.workbench.common.stunner.bpmn.definition.UserTask)8 Metadata (org.kie.workbench.common.stunner.core.diagram.Metadata)8 Graph (org.kie.workbench.common.stunner.core.graph.Graph)8 FlowElement (org.eclipse.bpmn2.FlowElement)7 RootElement (org.eclipse.bpmn2.RootElement)7 Element (org.kie.workbench.common.stunner.core.graph.Element)6 View (org.kie.workbench.common.stunner.core.graph.content.view.View)6 DataInput (org.eclipse.bpmn2.DataInput)5 DataOutput (org.eclipse.bpmn2.DataOutput)4 UserTaskExecutionSet (org.kie.workbench.common.stunner.bpmn.definition.property.task.UserTaskExecutionSet)4 ArrayList (java.util.ArrayList)3 DataInputAssociation (org.eclipse.bpmn2.DataInputAssociation)3 List (java.util.List)2 Assignment (org.eclipse.bpmn2.Assignment)2 DataOutputAssociation (org.eclipse.bpmn2.DataOutputAssociation)2 Definitions (org.eclipse.bpmn2.Definitions)2 FormalExpression (org.eclipse.bpmn2.FormalExpression)2 InputSet (org.eclipse.bpmn2.InputSet)2