@Test public void testUserTaskTaskNameInvalid() { UserTask userTask = new UserTask(); userTask.getExecutionSet().setTaskName(new TaskName(TASK_NAME_INVALID)); Set<ConstraintViolation<UserTask>> violations = this.validator.validate(userTask); assertEquals(1, violations.size()); }
@Test public void testUserTaskNameValid() { UserTask userTask = new UserTask(); userTask.getGeneral().setName(new Name(TASK_NAME_VALID)); Set<ConstraintViolation<UserTask>> violations = this.validator.validate(userTask); assertTrue(violations.isEmpty()); }
TWO_INCOME_EDGES, HAS_OUTCOME_EDGE); assertGeneralSet(filledTopLevelTaskJava.getGeneral(), TASK_NAME_JAVA, TASK_DOCUMENTATION_JAVA); assertUserTaskExecutionSet(filledTopLevelTaskJava.getExecutionSet(), TASK_TASK_NAME_JAVA, TASK_SUBJECT_JAVA, TWO_INCOME_EDGES, HAS_OUTCOME_EDGE); assertGeneralSet(filledTopLevelTaskJavascript.getGeneral(), TASK_NAME_JAVASCRIPT, TASK_DOCUMENTATION_JAVASCRIPT); assertUserTaskExecutionSet(filledTopLevelTaskJavascript.getExecutionSet(), TASK_TASK_NAME_JAVASCRIPT, TASK_SUBJECT_JAVASCRIPT, TWO_INCOME_EDGES, HAS_OUTCOME_EDGE); assertGeneralSet(filledTopLevelTaskMvel.getGeneral(), TASK_NAME_MVEL, TASK_DOCUMENTATION_MVEL); assertUserTaskExecutionSet(filledTopLevelTaskMvel.getExecutionSet(), TASK_TASK_NAME_MVEL, TASK_SUBJECT_MVEL,
stageNode.getInEdges().add(stageInEdge); UserTask task = new UserTask(); task.getGeneral().setName(new Name("TaskTest")); task.getGeneral().setDocumentation(new Documentation("TaskTest")); UserTaskExecutionSet executionSet = task.getExecutionSet(); executionSet.setTaskName(new TaskName("TaskTest")); executionSet.setSubject(new Subject("TaskTest")); executionSet.setOnExitAction(new OnExitAction(new ScriptTypeListValue(Collections.singletonList(exitAction)))); task.setExecutionSet(executionSet); taskNode.getLabels().addAll(task.getLabels()); taskNode.getLabels().add("org.kie.workbench.common.stunner.bpmn.definition.UserTask"); taskNode.setContent(taskContent);
@Test public void parseAssociations() throws Exception { Diagram<Graph, Metadata> d = unmarshall(newMarshaller, BPMN_FILE_PATH); Node<View<UserTask>, ?> node = d.getGraph().getNode(TASK_ID); UserTask definition = node.getContent().getDefinition(); AssignmentsInfo assignmentsinfo = definition.getExecutionSet().getAssignmentsinfo(); assertEquals("|Body:String,From:String,Subject:String,To:String||CUSTOM:String,CUSTOM2:String|[din]Body=HELLO,[din]myprocvar->From,[dout]CUSTOM->myprocvar", assignmentsinfo.getValue()); }
private PropertyWriter userTask(Node<View<UserTask>, ?> n) { org.eclipse.bpmn2.UserTask task = bpmn2.createUserTask(); task.setId(n.getUUID()); UserTask definition = n.getContent().getDefinition(); UserTaskPropertyWriter p = propertyWriterFactory.of(task); TaskGeneralSet general = definition.getGeneral(); p.setName(general.getName().getValue()); p.setDocumentation(general.getDocumentation().getValue()); p.setSimulationSet(definition.getSimulationSet()); UserTaskExecutionSet executionSet = definition.getExecutionSet(); p.setTaskName(executionSet.getTaskName().getValue()); p.setActors(executionSet.getActors()); p.setAssignmentsInfo(executionSet.getAssignmentsinfo()); p.setSkippable(executionSet.getSkippable().getValue()); p.setGroupId(executionSet.getGroupid().getValue()); p.setSubject(executionSet.getSubject().getValue()); p.setDescription(executionSet.getDescription().getValue()); p.setPriority(executionSet.getPriority().getValue()); p.setAsync(executionSet.getIsAsync().getValue()); p.setCreatedBy(executionSet.getCreatedBy().getValue()); p.setAdHocAutostart(executionSet.getAdHocAutostart().getValue()); p.setOnEntryAction(executionSet.getOnEntryAction()); p.setOnExitAction(executionSet.getOnExitAction()); p.setContent(executionSet.getContent().getValue()); p.setSLADueDate(executionSet.getSlaDueDate().getValue()); p.setBounds(n.getContent().getBounds()); return p; }
@Test @SuppressWarnings("unchecked") public void testUnmarshallUserTaskAssignments() throws Exception { Diagram<Graph, Metadata> diagram = unmarshall(BPMN_USERTASKASSIGNMENTS); assertDiagram(diagram, 8); assertEquals("UserTaskAssignments", diagram.getMetadata().getTitle()); Node<? extends Definition, ?> selfEvaluationNode = diagram.getGraph().getNode("_6063D302-9D81-4C86-920B-E808A45377C2"); UserTask selfEvaluationTask = (UserTask) selfEvaluationNode.getContent().getDefinition(); assertEquals(selfEvaluationTask.getTaskType().getValue(), TaskTypes.USER); UserTaskExecutionSet executionSet = selfEvaluationTask.getExecutionSet(); AssignmentsInfo assignmentsinfo = executionSet.getAssignmentsinfo(); assertEquals(assignmentsinfo.getValue(), "|reason:com.test.Reason,Comment:Object,Skippable:Object||performance:Object|[din]reason->reason,[dout]performance->performance"); }
UserTaskPropertyReader p = propertyReaderFactory.of(task); definition.setGeneral(new TaskGeneralSet( new Name(p.getName()), new Documentation(p.getDocumentation()) )); definition.setSimulationSet( p.getSimulationSet() ); definition.setExecutionSet(new UserTaskExecutionSet( new TaskName(p.getTaskName()), p.getActors(), definition.setDimensionsSet(p.getRectangleDimensionsSet()); definition.setBackgroundSet(p.getBackgroundSet()); definition.setFontSet(p.getFontSet());
stage1Node.getInEdges().add(stage1InEdge); UserTask task1 = new UserTask(); View<UserTask> task1Content = new ViewImpl<>(task1, Bounds.create(0.0, 0.0, 153.0, 103.0)); Node<View<UserTask>, Edge> task1Node = new NodeImpl<>("_E95AD08A-4595-4FA4-8948-3318D8BE7941"); task1Node.getLabels().addAll(task1.getLabels()); task1Node.getLabels().add("org.kie.workbench.common.stunner.bpmn.definition.UserTask"); task1Node.setContent(task1Content);
UserTask userTask1 = (UserTask) userTask1Node.getContent().getDefinition(); assertEquals("Task1", userTask1.getGeneral().getName().getValue()); assertEquals("Task1Documentation", userTask1.getGeneral().getDocumentation().getValue()); assertEquals(userTask1Node, GraphUtils.getDockParent(catchingEventNode).orElse(null)); UserTask userTask2 = (UserTask) userTask2Node.getContent().getDefinition(); assertEquals("Task2", userTask2.getGeneral().getName().getValue()); assertEquals("Task2Documentation", userTask2.getGeneral().getDocumentation().getValue());
@Test @SuppressWarnings("unchecked") public void testUnmarshallSimulationProperties() throws Exception { Diagram<Graph, Metadata> diagram = unmarshall(BPMN_SIMULATIONPROPERTIES); assertDiagram(diagram, 4); assertEquals("SimulationProperties", diagram.getMetadata().getTitle()); UserTask userTask = findContent(diagram, UserTask.class); SimulationSet simulationSet = userTask.getSimulationSet(); assertEquals(Double.valueOf(111), simulationSet.getQuantity().getValue()); assertEquals("poisson", simulationSet.getDistributionType().getValue()); assertEquals(Double.valueOf(123), simulationSet.getUnitCost().getValue()); assertEquals(Double.valueOf(999), simulationSet.getWorkingHours().getValue()); assertEquals(Double.valueOf(321), simulationSet.getMean().getValue()); }
ZERO_INCOME_EDGES, HAS_NO_OUTCOME_EDGE); assertGeneralSet(emptyTopLevelTask.getGeneral(), TASK_NAME, EMPTY_VALUE); assertUserTaskExecutionSet(emptyTopLevelTask.getExecutionSet(), TASK_TASK_NAME, EMPTY_VALUE,
assignmentsInfo = ((BusinessRuleTask) definition).getDataIOSet().getAssignmentsinfo(); } else if (definition instanceof UserTask) { assignmentsInfo = ((UserTask) definition).getExecutionSet().getAssignmentsinfo(); } else if (definition instanceof ServiceTask) { assignmentsInfo = ((ServiceTask) definition).getDataIOSet().getAssignmentsinfo();
@Test public void testNewViewInstance() throws Exception { tested.newViewInstance(factory, new UserTask()); verify(factory, times(1)).task(); }
@Test @SuppressWarnings("unchecked") public void testUnmarshallUserTaskAssignments() throws Exception { Diagram<Graph, Metadata> diagram = unmarshall(BPMN_USERTASKASSIGNMENTS); assertDiagram(diagram, 8); assertEquals("UserTaskAssignments", diagram.getMetadata().getTitle()); Node<? extends Definition, ?> selfEvaluationNode = diagram.getGraph().getNode("_6063D302-9D81-4C86-920B-E808A45377C2"); UserTask selfEvaluationTask = (UserTask) selfEvaluationNode.getContent().getDefinition(); assertEquals(selfEvaluationTask.getTaskType().getValue(), TaskTypes.USER); UserTaskExecutionSet executionSet = selfEvaluationTask.getExecutionSet(); AssignmentsInfo assignmentsinfo = executionSet.getAssignmentsinfo(); assertEquals(assignmentsinfo.getValue(), "|reason:com.test.Reason,Comment:Object,Skippable:Object||performance:Object|[din]reason->reason,[dout]performance->performance"); }
if (oDefinition instanceof UserTask) { UserTask userTask = (UserTask) oDefinition; simulationSet = userTask.getSimulationSet(); break;
ONE_INCOME_EDGE, HAS_OUTCOME_EDGE); assertGeneralSet(emptyTopLevelTask.getGeneral(), TASK_NAME, EMPTY_VALUE); assertUserTaskExecutionSet(emptyTopLevelTask.getExecutionSet(), TASK_TASK_NAME, EMPTY_VALUE,