Search in sources :

Example 61 with CustomTask

use of org.kie.workbench.common.stunner.bpmn.workitem.CustomTask in project kie-wb-common by kiegroup.

the class EmailCustomTaskTest method testUnmarshallSubprocessLevelTaskOneIncomeEmptyProperties.

@Ignore("The test is ignored because there is a bug in new Marshaller.\n" + "It should be enabled after these issues will be resolved:\n" + "https://issues.jboss.org/browse/JBPM-7072\n" + "https://issues.jboss.org/browse/JBPM-7726")
@Test
@Override
public void testUnmarshallSubprocessLevelTaskOneIncomeEmptyProperties() {
    assertDiagram(getDiagram(), AMOUNT_OF_NODES_IN_DIAGRAM);
    CustomTask emptySubprocessLevelTask = getTaskNodeById(getDiagram(), EMPTY_ONE_INCOME_SUBPROCESS_LEVEL_TASK_ID, ONE_INCOME_EDGE, HAS_OUTCOME_EDGE);
    assertGeneralSet(emptySubprocessLevelTask.getGeneral(), EMPTY_VALUE, EMPTY_VALUE);
    assertServiceTaskExecutionSet(emptySubprocessLevelTask.getExecutionSet(), EMPTY_VALUE, TASK_SCRIPT_JAVA_LANGUAGE, EMPTY_VALUE, TASK_SCRIPT_JAVA_LANGUAGE, IS_NOT_ASYNC, NOT_AD_HOC_AUTOSTART, EMPTY_VALUE);
    assertDataIOSet(emptySubprocessLevelTask.getDataIOSet(), EMPTY_TASK_DATA_INPUT_OUTPUT);
}
Also used : CustomTask(org.kie.workbench.common.stunner.bpmn.workitem.CustomTask) Ignore(org.junit.Ignore) Test(org.junit.Test)

Example 62 with CustomTask

use of org.kie.workbench.common.stunner.bpmn.workitem.CustomTask in project kie-wb-common by kiegroup.

the class EmailCustomTaskTest method testUnmarshallTopLevelTaskTwoIncomesEmptyProperties.

@Ignore("The test is ignored because there is a bug in new Marshaller.\n" + "It should be enabled after these issues will be resolved:\n" + "https://issues.jboss.org/browse/JBPM-7072\n" + "https://issues.jboss.org/browse/JBPM-7726")
@Test
@Override
public void testUnmarshallTopLevelTaskTwoIncomesEmptyProperties() {
    assertDiagram(getDiagram(), AMOUNT_OF_NODES_IN_DIAGRAM);
    CustomTask emptyTopLevelTask = getTaskNodeById(getDiagram(), EMPTY_TWO_INCOMES_TOP_LEVEL_TASK_ID, TWO_INCOME_EDGES, HAS_OUTCOME_EDGE);
    assertGeneralSet(emptyTopLevelTask.getGeneral(), EMPTY_VALUE, EMPTY_VALUE);
    assertServiceTaskExecutionSet(emptyTopLevelTask.getExecutionSet(), EMPTY_VALUE, TASK_SCRIPT_JAVA_LANGUAGE, EMPTY_VALUE, TASK_SCRIPT_JAVA_LANGUAGE, IS_NOT_ASYNC, NOT_AD_HOC_AUTOSTART, EMPTY_VALUE);
    assertDataIOSet(emptyTopLevelTask.getDataIOSet(), EMPTY_TASK_DATA_INPUT_OUTPUT);
}
Also used : CustomTask(org.kie.workbench.common.stunner.bpmn.workitem.CustomTask) Ignore(org.junit.Ignore) Test(org.junit.Test)

Example 63 with CustomTask

use of org.kie.workbench.common.stunner.bpmn.workitem.CustomTask in project kie-wb-common by kiegroup.

the class LogCustomTaskTest method testUnmarshallTopLevelTaskFilledProperties.

@Test
@Override
public void testUnmarshallTopLevelTaskFilledProperties() {
    final String TASK_NAME_JAVA = "Log task01 name ~!@#$%^&*()_+`-={}|[]\\:\";'<>?,./";
    final String TASK_DOCUMENTATION_JAVA = "Log task01 doc\n ~!@#$%^&*()_+`1234567890-={}|[]\\:\";'<>?,./";
    final String TASK_ON_ENTRY_ACTION_JAVA = "System.out.println(\"On Entry Action from Log Task.\");";
    final String TASK_ON_EXIT_ACTION_JAVA = "System.out.println(\"On Exit Action from Log Task.\");";
    final String TASK_NAME_JAVASCRIPT = "Log task04 name ~!@#$%^&*()_+`-={}|[]\\:\";'<>?,./";
    final String TASK_DOCUMENTATION_JAVASCRIPT = "Log task04 doc\n ~!@#$%^&*()_+`1234567890-={}|[]\\:\";'<>?,./";
    final String TASK_ON_ENTRY_ACTION_JAVASCRIPT = "console.log(\"On Entry Action from Log Task.\");";
    final String TASK_ON_EXIT_ACTION_JAVASCRIPT = "console.log(\"On Exit Action from Log Task.\");";
    final String TASK_NAME_MVEL = "Log task07 name ~!@#$%^&*()_+`-={}|[]\\:\";'<>?,./";
    final String TASK_DOCUMENTATION_MVEL = "Log task07 doc\n ~!@#$%^&*()_+`1234567890-={}|[]\\:\";'<>?,./";
    final String TASK_ON_ENTRY_ACTION_MVEL = "System.out.println(\"On Entry Action from Log Task.\");";
    final String TASK_ON_EXIT_ACTION_MVEL = "System.out.println(\"On Exit Action from Log Task.\");";
    final String TASK_DATA_INPUT_OUTPUT = "|Message:String,input:String||output:String|[din]processGlobalVar->input,[dout]output->processGlobalVar";
    assertDiagram(getDiagram(), AMOUNT_OF_NODES_IN_DIAGRAM);
    CustomTask filledTopLevelTaskJava = getTaskNodeById(getDiagram(), FILLED_TOP_LEVEL_TASK_JAVA_ID, ZERO_INCOME_EDGES, HAS_NO_OUTCOME_EDGE);
    assertGeneralSet(filledTopLevelTaskJava.getGeneral(), TASK_NAME_JAVA, TASK_DOCUMENTATION_JAVA);
    assertServiceTaskExecutionSet(filledTopLevelTaskJava.getExecutionSet(), TASK_ON_ENTRY_ACTION_JAVA, TASK_SCRIPT_JAVA_LANGUAGE, TASK_ON_EXIT_ACTION_JAVA, TASK_SCRIPT_JAVA_LANGUAGE, IS_ASYNC, AD_HOC_AUTOSTART, SLA_DUE_DATE);
    assertDataIOSet(filledTopLevelTaskJava.getDataIOSet(), TASK_DATA_INPUT_OUTPUT);
    CustomTask filledTopLevelTaskJavascript = getTaskNodeById(getDiagram(), FILLED_TOP_LEVEL_TASK_JAVASCRIPT_ID, ZERO_INCOME_EDGES, HAS_NO_OUTCOME_EDGE);
    assertGeneralSet(filledTopLevelTaskJavascript.getGeneral(), TASK_NAME_JAVASCRIPT, TASK_DOCUMENTATION_JAVASCRIPT);
    assertServiceTaskExecutionSet(filledTopLevelTaskJavascript.getExecutionSet(), TASK_ON_ENTRY_ACTION_JAVASCRIPT, TASK_SCRIPT_JAVASCRIPT_LANGUAGE, TASK_ON_EXIT_ACTION_JAVASCRIPT, TASK_SCRIPT_JAVASCRIPT_LANGUAGE, IS_ASYNC, AD_HOC_AUTOSTART, SLA_DUE_DATE);
    assertDataIOSet(filledTopLevelTaskJavascript.getDataIOSet(), TASK_DATA_INPUT_OUTPUT);
    CustomTask filledTopLevelTaskMvel = getTaskNodeById(getDiagram(), FILLED_TOP_LEVEL_TASK_MVEL_ID, ZERO_INCOME_EDGES, HAS_NO_OUTCOME_EDGE);
    assertGeneralSet(filledTopLevelTaskMvel.getGeneral(), TASK_NAME_MVEL, TASK_DOCUMENTATION_MVEL);
    assertServiceTaskExecutionSet(filledTopLevelTaskMvel.getExecutionSet(), TASK_ON_ENTRY_ACTION_MVEL, TASK_SCRIPT_MVEL_LANGUAGE, TASK_ON_EXIT_ACTION_MVEL, TASK_SCRIPT_MVEL_LANGUAGE, IS_ASYNC, AD_HOC_AUTOSTART, SLA_DUE_DATE);
    assertDataIOSet(filledTopLevelTaskMvel.getDataIOSet(), TASK_DATA_INPUT_OUTPUT);
}
Also used : CustomTask(org.kie.workbench.common.stunner.bpmn.workitem.CustomTask) Test(org.junit.Test)

Example 64 with CustomTask

use of org.kie.workbench.common.stunner.bpmn.workitem.CustomTask in project kie-wb-common by kiegroup.

the class BPMNDirectDiagramMarshallerTest method testUnmarshallWorkItems.

@Test
@SuppressWarnings("unchecked")
public void testUnmarshallWorkItems() throws Exception {
    Diagram<Graph, Metadata> diagram = unmarshall(BPMN_SERVICE_TASKS);
    assertDiagram(diagram, 5);
    // Email service task assertions.
    Node<? extends Definition, ?> emailNode = diagram.getGraph().getNode("_277CE006-5E6E-4960-A68C-CC8A5347C33F");
    assertTrue(emailNode.getContent().getDefinition() instanceof CustomTask);
    CustomTask email = (CustomTask) emailNode.getContent().getDefinition();
    assertEquals(WorkItemDefinitionMockRegistry.EMAIL.getName(), email.getName());
    assertEquals(WorkItemDefinitionMockRegistry.EMAIL.getCategory(), email.getCategory());
    assertEquals(WorkItemDefinitionMockRegistry.EMAIL.getDefaultHandler(), email.getDefaultHandler());
    assertEquals(WorkItemDefinitionMockRegistry.EMAIL.getDescription(), email.getDescription());
    assertEquals(WorkItemDefinitionMockRegistry.EMAIL.getDisplayName(), email.getGeneral().getName().getValue());
    assertEquals(WorkItemDefinitionMockRegistry.EMAIL.getDocumentation(), email.getGeneral().getDocumentation().getValue());
    // Log service task assertions.
    Node<? extends Definition, ?> logNode = diagram.getGraph().getNode("_A940748F-A658-4FB8-84FD-B69F4B7A9205");
    assertTrue(logNode.getContent().getDefinition() instanceof CustomTask);
    CustomTask log = (CustomTask) logNode.getContent().getDefinition();
    assertEquals(WorkItemDefinitionMockRegistry.LOG.getName(), log.getName());
    assertEquals(WorkItemDefinitionMockRegistry.LOG.getCategory(), log.getCategory());
    assertEquals(WorkItemDefinitionMockRegistry.LOG.getDefaultHandler(), log.getDefaultHandler());
    assertEquals(WorkItemDefinitionMockRegistry.LOG.getDescription(), log.getDescription());
    assertEquals(WorkItemDefinitionMockRegistry.LOG.getDisplayName(), log.getGeneral().getName().getValue());
    assertEquals(WorkItemDefinitionMockRegistry.LOG.getDocumentation(), log.getGeneral().getDocumentation().getValue());
}
Also used : Graph(org.kie.workbench.common.stunner.core.graph.Graph) Metadata(org.kie.workbench.common.stunner.core.diagram.Metadata) CustomTask(org.kie.workbench.common.stunner.bpmn.workitem.CustomTask) Test(org.junit.Test)

Example 65 with CustomTask

use of org.kie.workbench.common.stunner.bpmn.workitem.CustomTask in project kie-wb-common by kiegroup.

the class CustomTaskShapeDefTest method init.

@Before
@SuppressWarnings("unchecked")
public void init() throws Exception {
    this.task = new CustomTask();
    task.getDimensionsSet().getWidth().setValue(WIDTH);
    task.getDimensionsSet().getHeight().setValue(HEIGHT);
    this.task.setName(WID_ID_1);
    when(node.getDefinition()).thenReturn(task);
    when(node.getBounds()).thenReturn(BOUNDS);
    when(registry.items()).thenReturn(Collections.singleton(DEF_1));
    when(registry.get(eq(WID_ID_1))).thenReturn(DEF_1);
    when(registry.get(eq(WID_ID_2))).thenReturn(null);
    when(registry.get(eq(WID_ID_3))).thenThrow(new RuntimeException("Just for Testing"));
    when(view.getChildren()).thenReturn(Collections.singletonList(imageSvgPrimitive));
    when(imageSvgPrimitive.getId()).thenReturn(CustomTaskShapeViewHandler.WID_ICON_ID);
    when(imageSvgPrimitive.get()).thenReturn(imagePrimitive);
    when(imageSvgPrimitive.getPrimitiveId()).thenReturn(CustomTaskShapeViewHandler.WID_ICON_ID);
    when(imagePrimitive.getID()).thenReturn(CustomTaskShapeViewHandler.WID_ICON_ID);
    when(imagePrimitive.getImageProxy()).thenReturn(imageProxy);
    this.tested = new CustomTaskShapeDef(() -> registry, iconDataGlyphGenerator);
}
Also used : CustomTask(org.kie.workbench.common.stunner.bpmn.workitem.CustomTask) Before(org.junit.Before)

Aggregations

CustomTask (org.kie.workbench.common.stunner.bpmn.workitem.CustomTask)66 Test (org.junit.Test)58 Ignore (org.junit.Ignore)18 View (org.kie.workbench.common.stunner.core.graph.content.view.View)5 Before (org.junit.Before)4 BPMNDiagramImpl (org.kie.workbench.common.stunner.bpmn.definition.BPMNDiagramImpl)3 TaskGeneralSet (org.kie.workbench.common.stunner.bpmn.definition.property.general.TaskGeneralSet)3 Graph (org.kie.workbench.common.stunner.core.graph.Graph)3 Collections (java.util.Collections)2 Consumer (java.util.function.Consumer)2 Function (java.util.function.Function)2 GenericServiceTaskPropertyReader (org.kie.workbench.common.stunner.bpmn.backend.converters.tostunner.properties.GenericServiceTaskPropertyReader)2 ServiceTaskPropertyReader (org.kie.workbench.common.stunner.bpmn.backend.converters.tostunner.properties.ServiceTaskPropertyReader)2 Lane (org.kie.workbench.common.stunner.bpmn.definition.Lane)2 NoneTask (org.kie.workbench.common.stunner.bpmn.definition.NoneTask)2 SequenceFlow (org.kie.workbench.common.stunner.bpmn.definition.SequenceFlow)2 DataIOSet (org.kie.workbench.common.stunner.bpmn.definition.property.dataio.DataIOSet)2 CustomTaskExecutionSet (org.kie.workbench.common.stunner.bpmn.workitem.CustomTaskExecutionSet)2 WorkItemDefinition (org.kie.workbench.common.stunner.bpmn.workitem.WorkItemDefinition)2 WorkItemDefinitionRegistry (org.kie.workbench.common.stunner.bpmn.workitem.WorkItemDefinitionRegistry)2