Search in sources :

Example 46 with CustomTask

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

the class WebServiceCustomTaskTest method testUnmarshallSubprocessLevelTaskFilledProperties.

@Test
@Override
public void testUnmarshallSubprocessLevelTaskFilledProperties() {
    final String TASK_NAME_JAVA = "WebService task10 name ~!@#$%^&*()_+`-={}|[]\\:\";'<>?,./";
    final String TASK_DOCUMENTATION_JAVA = "WebService task10 doc\n ~!@#$%^&*()_+`1234567890-={}|[]\\:\";'<>?,./";
    final String TASK_ON_ENTRY_ACTION_JAVA = "System.out.println(\"On Entry Action from WebService Task.\");";
    final String TASK_ON_EXIT_ACTION_JAVA = "System.out.println(\"On Exit Action from WebService Task.\");";
    final String TASK_NAME_JAVASCRIPT = "WebService task13 name ~!@#$%^&*()_+`-={}|[]\\:\";'<>?,./";
    final String TASK_DOCUMENTATION_JAVASCRIPT = "WebService task13 doc\n ~!@#$%^&*()_+`1234567890-={}|[]\\:\";'<>?,./";
    final String TASK_ON_ENTRY_ACTION_JAVASCRIPT = "console.log(\"On Entry Action from WebService Task.\");";
    final String TASK_ON_EXIT_ACTION_JAVASCRIPT = "console.log(\"On Exit Action from WebService Task.\");";
    final String TASK_NAME_MVEL = "WebService task16 name ~!@#$%^&*()_+`-={}|[]\\:\";'<>?,./";
    final String TASK_DOCUMENTATION_MVEL = "WebService task16 doc\n ~!@#$%^&*()_+`1234567890-={}|[]\\:\";'<>?,./";
    final String TASK_ON_ENTRY_ACTION_MVEL = "System.out.println(\"On Entry Action from WebService Task.\");";
    final String TASK_ON_EXIT_ACTION_MVEL = "System.out.println(\"On Exit Action from WebService Task.\");";
    final String TASK_DATA_INPUT_OUTPUT = "|Endpoint:String,Interface:String,Mode:String,Namespace:String,Operation:String,Parameter:String,Url:String,input:String||Result:java.lang.Object,output:String|[din]processGlobalVar->input,[dout]output->processGlobalVar";
    assertDiagram(getDiagram(), AMOUNT_OF_NODES_IN_DIAGRAM);
    CustomTask filledSubprocessLevelTaskJava = getTaskNodeById(getDiagram(), FILLED_SUBPROCESS_LEVEL_TASK_JAVA_ID, ZERO_INCOME_EDGES, HAS_NO_OUTCOME_EDGE);
    assertGeneralSet(filledSubprocessLevelTaskJava.getGeneral(), TASK_NAME_JAVA, TASK_DOCUMENTATION_JAVA);
    assertServiceTaskExecutionSet(filledSubprocessLevelTaskJava.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(filledSubprocessLevelTaskJava.getDataIOSet(), TASK_DATA_INPUT_OUTPUT);
    CustomTask filledSubprocessLevelTaskJavascript = getTaskNodeById(getDiagram(), FILLED_SUBPROCESS_LEVEL_TASK_JAVASCRIPT_ID, ZERO_INCOME_EDGES, HAS_NO_OUTCOME_EDGE);
    assertGeneralSet(filledSubprocessLevelTaskJavascript.getGeneral(), TASK_NAME_JAVASCRIPT, TASK_DOCUMENTATION_JAVASCRIPT);
    assertServiceTaskExecutionSet(filledSubprocessLevelTaskJavascript.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(filledSubprocessLevelTaskJavascript.getDataIOSet(), TASK_DATA_INPUT_OUTPUT);
    CustomTask filledSubprocessLevelTaskMvel = getTaskNodeById(getDiagram(), FILLED_SUBPROCESS_LEVEL_TASK_MVEL_ID, ZERO_INCOME_EDGES, HAS_NO_OUTCOME_EDGE);
    assertGeneralSet(filledSubprocessLevelTaskMvel.getGeneral(), TASK_NAME_MVEL, TASK_DOCUMENTATION_MVEL);
    assertServiceTaskExecutionSet(filledSubprocessLevelTaskMvel.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(filledSubprocessLevelTaskMvel.getDataIOSet(), TASK_DATA_INPUT_OUTPUT);
}
Also used : CustomTask(org.kie.workbench.common.stunner.bpmn.workitem.CustomTask) Test(org.junit.Test)

Example 47 with CustomTask

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

the class WebServiceCustomTaskTest method testUnmarshallTopLevelTaskOneIncomeEmptyProperties.

@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 testUnmarshallTopLevelTaskOneIncomeEmptyProperties() {
    assertDiagram(getDiagram(), AMOUNT_OF_NODES_IN_DIAGRAM);
    CustomTask emptyTopLevelTask = getTaskNodeById(getDiagram(), EMPTY_ONE_INCOME_TOP_LEVEL_TASK_ID, ONE_INCOME_EDGE, 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 48 with CustomTask

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

the class WebServiceCustomTaskTest method testUnmarshallSubprocessLevelTaskTwoIncomesFilledProperties.

@Test
@Override
public void testUnmarshallSubprocessLevelTaskTwoIncomesFilledProperties() {
    final String TASK_NAME_JAVA = "WebService task12 name ~!@#$%^&*()_+`-={}|[]\\:\";'<>?,./";
    final String TASK_DOCUMENTATION_JAVA = "WebService task12 doc\n ~!@#$%^&*()_+`1234567890-={}|[]\\:\";'<>?,./";
    final String TASK_ON_ENTRY_ACTION_JAVA = "System.out.println(\"On Entry Action from WebService Task.\");";
    final String TASK_ON_EXIT_ACTION_JAVA = "System.out.println(\"On Exit Action from WebService Task.\");";
    final String TASK_NAME_JAVASCRIPT = "WebService task15 name ~!@#$%^&*()_+`-={}|[]\\:\";'<>?,./";
    final String TASK_DOCUMENTATION_JAVASCRIPT = "WebService task15 doc\n ~!@#$%^&*()_+`1234567890-={}|[]\\:\";'<>?,./";
    final String TASK_ON_ENTRY_ACTION_JAVASCRIPT = "console.log(\"On Entry Action from WebService Task.\");";
    final String TASK_ON_EXIT_ACTION_JAVASCRIPT = "console.log(\"On Exit Action from WebService Task.\");";
    final String TASK_NAME_MVEL = "WebService task18 name ~!@#$%^&*()_+`-={}|[]\\:\";'<>?,./";
    final String TASK_DOCUMENTATION_MVEL = "WebService task18 doc\n ~!@#$%^&*()_+`1234567890-={}|[]\\:\";'<>?,./";
    final String TASK_ON_ENTRY_ACTION_MVEL = "System.out.println(\"On Entry Action from WebService Task.\");";
    final String TASK_ON_EXIT_ACTION_MVEL = "System.out.println(\"On Exit Action from WebService Task.\");";
    final String TASK_DATA_INPUT_OUTPUT = "|Endpoint:String,Interface:String,Mode:String,Namespace:String,Operation:String,Parameter:String,Url:String,input:String||Result:java.lang.Object,output:String|[din]processGlobalVar->input,[dout]output->processGlobalVar";
    assertDiagram(getDiagram(), AMOUNT_OF_NODES_IN_DIAGRAM);
    CustomTask filledSubprocessLevelTaskJava = getTaskNodeById(getDiagram(), FILLED_TWO_INCOMES_SUBPROCESS_LEVEL_TASK_JAVA_ID, TWO_INCOME_EDGES, HAS_OUTCOME_EDGE);
    assertGeneralSet(filledSubprocessLevelTaskJava.getGeneral(), TASK_NAME_JAVA, TASK_DOCUMENTATION_JAVA);
    assertServiceTaskExecutionSet(filledSubprocessLevelTaskJava.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(filledSubprocessLevelTaskJava.getDataIOSet(), TASK_DATA_INPUT_OUTPUT);
    CustomTask filledSubprocessLevelTaskJavascript = getTaskNodeById(getDiagram(), FILLED_TWO_INCOMES_SUBPROCESS_LEVEL_TASK_JAVASCRIPT_ID, TWO_INCOME_EDGES, HAS_OUTCOME_EDGE);
    assertGeneralSet(filledSubprocessLevelTaskJavascript.getGeneral(), TASK_NAME_JAVASCRIPT, TASK_DOCUMENTATION_JAVASCRIPT);
    assertServiceTaskExecutionSet(filledSubprocessLevelTaskJavascript.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(filledSubprocessLevelTaskJavascript.getDataIOSet(), TASK_DATA_INPUT_OUTPUT);
    CustomTask filledSubprocessLevelTaskMvel = getTaskNodeById(getDiagram(), FILLED_TWO_INCOMES_SUBPROCESS_LEVEL_TASK_MVEL_ID, TWO_INCOME_EDGES, HAS_OUTCOME_EDGE);
    assertGeneralSet(filledSubprocessLevelTaskMvel.getGeneral(), TASK_NAME_MVEL, TASK_DOCUMENTATION_MVEL);
    assertServiceTaskExecutionSet(filledSubprocessLevelTaskMvel.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(filledSubprocessLevelTaskMvel.getDataIOSet(), TASK_DATA_INPUT_OUTPUT);
}
Also used : CustomTask(org.kie.workbench.common.stunner.bpmn.workitem.CustomTask) Test(org.junit.Test)

Example 49 with CustomTask

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

the class CustomTaskTest method testBasicBidi.

@Test
@SuppressWarnings("unchecked")
public void testBasicBidi() throws Exception {
    Diagram<Graph, Metadata> d = unmarshall(marshaller, BPMN_SERVICE_TASK_PROPERTIES_FILE_PATH);
    String marshall = marshaller.marshall(d);
    Diagram<Graph, Metadata> d2 = Unmarshalling.unmarshall(marshaller, new ByteArrayInputStream(marshall.getBytes(Charset.forName("UTF-8"))));
    Node<View<CustomTask>, ?> node = d2.getGraph().getNode(SERVICE_TASK_ID);
    CustomTask definition = node.getContent().getDefinition();
    assertEquals("Custom Email", definition.getGeneral().getName().getValue());
    assertEquals("This is an email task", definition.getGeneral().getDocumentation().getValue());
}
Also used : Graph(org.kie.workbench.common.stunner.core.graph.Graph) ByteArrayInputStream(java.io.ByteArrayInputStream) Metadata(org.kie.workbench.common.stunner.core.diagram.Metadata) CustomTask(org.kie.workbench.common.stunner.bpmn.workitem.CustomTask) View(org.kie.workbench.common.stunner.core.graph.content.view.View) Test(org.junit.Test) BPMNDiagramMarshallerBaseTest(org.kie.workbench.common.stunner.bpmn.backend.service.diagram.marshalling.BPMNDiagramMarshallerBaseTest)

Example 50 with CustomTask

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

the class LogCustomTaskTest method testUnmarshallSubprocessLevelTaskEmptyProperties.

@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 testUnmarshallSubprocessLevelTaskEmptyProperties() {
    assertDiagram(getDiagram(), AMOUNT_OF_NODES_IN_DIAGRAM);
    CustomTask emptySubprocessLevelTask = getTaskNodeById(getDiagram(), EMPTY_SUBPROCESS_LEVEL_TASK_ID, ZERO_INCOME_EDGES, HAS_NO_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)

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