Search in sources :

Example 11 with AdHocSubprocess

use of org.kie.workbench.common.stunner.bpmn.definition.AdHocSubprocess in project kie-wb-common by kiegroup.

the class SubProcessConverter method convertAdHocSubprocessNode.

private SubProcessPropertyWriter convertAdHocSubprocessNode(Node<View<AdHocSubprocess>, ?> n) {
    org.eclipse.bpmn2.AdHocSubProcess process = bpmn2.createAdHocSubProcess();
    process.setId(n.getUUID());
    AdHocSubProcessPropertyWriter p = propertyWriterFactory.of(process);
    AdHocSubprocess definition = n.getContent().getDefinition();
    BPMNGeneralSet general = definition.getGeneral();
    p.setName(general.getName().getValue());
    p.setDocumentation(general.getDocumentation().getValue());
    ProcessData processData = definition.getProcessData();
    p.setProcessVariables(processData.getProcessVariables());
    AdHocSubprocessTaskExecutionSet executionSet = definition.getExecutionSet();
    p.setAdHocCompletionCondition(executionSet.getAdHocCompletionCondition());
    p.setAdHocOrdering(executionSet.getAdHocOrdering());
    p.setOnEntryAction(executionSet.getOnEntryAction());
    p.setOnExitAction(executionSet.getOnExitAction());
    p.setSimulationSet(definition.getSimulationSet());
    p.setBounds(n.getContent().getBounds());
    return p;
}
Also used : AdHocSubProcessPropertyWriter(org.kie.workbench.common.stunner.bpmn.backend.converters.fromstunner.properties.AdHocSubProcessPropertyWriter) AdHocSubprocessTaskExecutionSet(org.kie.workbench.common.stunner.bpmn.definition.property.task.AdHocSubprocessTaskExecutionSet) AdHocSubprocess(org.kie.workbench.common.stunner.bpmn.definition.AdHocSubprocess) Factories.bpmn2(org.kie.workbench.common.stunner.bpmn.backend.converters.fromstunner.Factories.bpmn2) BPMNGeneralSet(org.kie.workbench.common.stunner.bpmn.definition.property.general.BPMNGeneralSet) ProcessData(org.kie.workbench.common.stunner.bpmn.definition.property.variables.ProcessData)

Example 12 with AdHocSubprocess

use of org.kie.workbench.common.stunner.bpmn.definition.AdHocSubprocess in project kie-wb-common by kiegroup.

the class ProcessConverterDelegateTest method testPostConvertNodes.

@Test
@SuppressWarnings("unchecked")
public void testPostConvertNodes() {
    TestingGraphMockHandler graphTestHandler = new TestingGraphMockHandler();
    BPMNDiagramImpl bpmnDiagram = new BPMNDiagramImpl();
    StartNoneEvent level0StartNode = new StartNoneEvent();
    EndNoneEvent level0EndNode = new EndNoneEvent();
    UserTask level0Node1 = new UserTask();
    UserTask level0Node2 = new UserTask();
    EmbeddedSubprocess level1SubProcess1 = new EmbeddedSubprocess();
    ScriptTask level1Node1 = new ScriptTask();
    IntermediateSignalEventThrowing level1Node2 = new IntermediateSignalEventThrowing();
    AdHocSubprocess level2SubProcess1 = new AdHocSubprocess();
    BusinessRuleTask level2Node1 = new BusinessRuleTask();
    EndCompensationEvent level2Node2 = new EndCompensationEvent();
    TestingGraphInstanceBuilder2.Level2Graph level2Graph = TestingGraphInstanceBuilder2.buildLevel2Graph(graphTestHandler, bpmnDiagram, level0StartNode, level0Node1, level0Node2, level0EndNode, level1SubProcess1, level1Node1, level1Node2, level2SubProcess1, level2Node1, level2Node2);
    DefinitionsBuildingContext ctx = new DefinitionsBuildingContext(level2Graph.graph);
    PropertyWriterFactory writerFactory = new PropertyWriterFactory();
    ConverterFactory factory = spy(new ConverterFactory(ctx, writerFactory));
    FlowElementPostConverter flowElementPostConverter = mock(FlowElementPostConverter.class);
    when(factory.flowElementPostConverter()).thenReturn(flowElementPostConverter);
    MyProcessConverter abstractProcessConverter = new MyProcessConverter(factory);
    ProcessPropertyWriter processWriter = writerFactory.of(bpmn2.createProcess());
    abstractProcessConverter.postConvertChildNodes(processWriter, ctx);
    verify(flowElementPostConverter, times(10)).postConvert(anyObject(), anyObject(), nodeCaptor.capture());
    Map<String, BPMNViewDefinition> nodes = new HashMap<>();
    nodes.put(LEVEL0_START_NODE.uuid(), level0StartNode);
    nodes.put(LEVEL0_NODE1.uuid(), level0Node1);
    nodes.put(LEVEL0_NODE2.uuid(), level0Node2);
    nodes.put(LEVEL0_END_NODE.uuid(), level0EndNode);
    nodes.put(LEVEL1_SUB_PROCESS1.uuid(), level1SubProcess1);
    nodes.put(LEVEL1_NODE1.uuid(), level1Node1);
    nodes.put(LEVEL1_NODE2.uuid(), level1Node2);
    nodes.put(LEVEL2_SUB_PROCESS1.uuid(), level2SubProcess1);
    nodes.put(LEVEL2_NODE1.uuid(), level2Node1);
    nodes.put(LEVEL2_NODE2.uuid(), level2Node2);
    assertEquals(nodes.size(), nodeCaptor.getAllValues().size());
    nodes.entrySet().forEach(entry -> {
        Optional<Node<View<? extends BPMNViewDefinition>, ?>> processed = nodeCaptor.getAllValues().stream().filter(captured -> entry.getKey().equals(captured.getUUID())).findFirst();
        assertTrue("Node: " + entry.getKey() + " was not present in result", processed.isPresent());
        assertEquals(entry.getValue(), processed.get().getContent().getDefinition());
    });
}
Also used : IntermediateErrorEventCatching(org.kie.workbench.common.stunner.bpmn.definition.IntermediateErrorEventCatching) LEVEL2_SUB_PROCESS1(org.kie.workbench.common.stunner.core.TestingGraphInstanceBuilder2.NODES.LEVEL2_SUB_PROCESS1) ViewImpl(org.kie.workbench.common.stunner.core.graph.content.view.ViewImpl) UserTask(org.kie.workbench.common.stunner.bpmn.definition.UserTask) EdgeImpl(org.kie.workbench.common.stunner.core.graph.impl.EdgeImpl) BPMNViewDefinition(org.kie.workbench.common.stunner.bpmn.definition.BPMNViewDefinition) Map(java.util.Map) ConverterFactory(org.kie.workbench.common.stunner.bpmn.backend.converters.fromstunner.ConverterFactory) NodeImpl(org.kie.workbench.common.stunner.core.graph.impl.NodeImpl) Factories.bpmn2(org.kie.workbench.common.stunner.bpmn.backend.converters.fromstunner.Factories.bpmn2) PropertyWriterFactory(org.kie.workbench.common.stunner.bpmn.backend.converters.fromstunner.properties.PropertyWriterFactory) ArgumentMatchers.anyObject(org.mockito.ArgumentMatchers.anyObject) ScriptTask(org.kie.workbench.common.stunner.bpmn.definition.ScriptTask) LEVEL0_START_NODE(org.kie.workbench.common.stunner.core.TestingGraphInstanceBuilder2.NODES.LEVEL0_START_NODE) GraphImpl(org.kie.workbench.common.stunner.core.graph.impl.GraphImpl) EmbeddedSubprocess(org.kie.workbench.common.stunner.bpmn.definition.EmbeddedSubprocess) LEVEL1_NODE2(org.kie.workbench.common.stunner.core.TestingGraphInstanceBuilder2.NODES.LEVEL1_NODE2) Optional(java.util.Optional) Dock(org.kie.workbench.common.stunner.core.graph.content.relationship.Dock) Bounds(org.kie.workbench.common.stunner.core.graph.content.Bounds) MockitoJUnitRunner(org.mockito.junit.MockitoJUnitRunner) Node(org.kie.workbench.common.stunner.core.graph.Node) Assertions.assertThatCode(org.assertj.core.api.Assertions.assertThatCode) Mockito.mock(org.mockito.Mockito.mock) StartNoneEvent(org.kie.workbench.common.stunner.bpmn.definition.StartNoneEvent) ProcessPropertyWriter(org.kie.workbench.common.stunner.bpmn.backend.converters.fromstunner.properties.ProcessPropertyWriter) BusinessRuleTask(org.kie.workbench.common.stunner.bpmn.definition.BusinessRuleTask) RunWith(org.junit.runner.RunWith) HashMap(java.util.HashMap) LEVEL1_NODE1(org.kie.workbench.common.stunner.core.TestingGraphInstanceBuilder2.NODES.LEVEL1_NODE1) LEVEL1_SUB_PROCESS1(org.kie.workbench.common.stunner.core.TestingGraphInstanceBuilder2.NODES.LEVEL1_SUB_PROCESS1) Mockito.spy(org.mockito.Mockito.spy) Captor(org.mockito.Captor) FlowElementPostConverter(org.kie.workbench.common.stunner.bpmn.backend.converters.fromstunner.FlowElementPostConverter) AdHocSubprocess(org.kie.workbench.common.stunner.bpmn.definition.AdHocSubprocess) View(org.kie.workbench.common.stunner.core.graph.content.view.View) TestingGraphInstanceBuilder2(org.kie.workbench.common.stunner.core.TestingGraphInstanceBuilder2) ArgumentCaptor(org.mockito.ArgumentCaptor) DefinitionsBuildingContext(org.kie.workbench.common.stunner.bpmn.backend.converters.fromstunner.DefinitionsBuildingContext) EndCompensationEvent(org.kie.workbench.common.stunner.bpmn.definition.EndCompensationEvent) IntermediateSignalEventThrowing(org.kie.workbench.common.stunner.bpmn.definition.IntermediateSignalEventThrowing) LEVEL2_NODE1(org.kie.workbench.common.stunner.core.TestingGraphInstanceBuilder2.NODES.LEVEL2_NODE1) LEVEL2_NODE2(org.kie.workbench.common.stunner.core.TestingGraphInstanceBuilder2.NODES.LEVEL2_NODE2) BPMNDiagramImpl(org.kie.workbench.common.stunner.bpmn.definition.BPMNDiagramImpl) Assert.assertTrue(org.junit.Assert.assertTrue) Test(org.junit.Test) Mockito.times(org.mockito.Mockito.times) Mockito.when(org.mockito.Mockito.when) Mockito.verify(org.mockito.Mockito.verify) LEVEL0_NODE2(org.kie.workbench.common.stunner.core.TestingGraphInstanceBuilder2.NODES.LEVEL0_NODE2) LEVEL0_END_NODE(org.kie.workbench.common.stunner.core.TestingGraphInstanceBuilder2.NODES.LEVEL0_END_NODE) LEVEL0_NODE1(org.kie.workbench.common.stunner.core.TestingGraphInstanceBuilder2.NODES.LEVEL0_NODE1) GraphNodeStoreImpl(org.kie.workbench.common.stunner.core.graph.store.GraphNodeStoreImpl) Assert.assertEquals(org.junit.Assert.assertEquals) EndNoneEvent(org.kie.workbench.common.stunner.bpmn.definition.EndNoneEvent) TestingGraphMockHandler(org.kie.workbench.common.stunner.core.TestingGraphMockHandler) HashMap(java.util.HashMap) Node(org.kie.workbench.common.stunner.core.graph.Node) BusinessRuleTask(org.kie.workbench.common.stunner.bpmn.definition.BusinessRuleTask) AdHocSubprocess(org.kie.workbench.common.stunner.bpmn.definition.AdHocSubprocess) FlowElementPostConverter(org.kie.workbench.common.stunner.bpmn.backend.converters.fromstunner.FlowElementPostConverter) ConverterFactory(org.kie.workbench.common.stunner.bpmn.backend.converters.fromstunner.ConverterFactory) BPMNViewDefinition(org.kie.workbench.common.stunner.bpmn.definition.BPMNViewDefinition) PropertyWriterFactory(org.kie.workbench.common.stunner.bpmn.backend.converters.fromstunner.properties.PropertyWriterFactory) EmbeddedSubprocess(org.kie.workbench.common.stunner.bpmn.definition.EmbeddedSubprocess) EndNoneEvent(org.kie.workbench.common.stunner.bpmn.definition.EndNoneEvent) BPMNDiagramImpl(org.kie.workbench.common.stunner.bpmn.definition.BPMNDiagramImpl) StartNoneEvent(org.kie.workbench.common.stunner.bpmn.definition.StartNoneEvent) IntermediateSignalEventThrowing(org.kie.workbench.common.stunner.bpmn.definition.IntermediateSignalEventThrowing) EndCompensationEvent(org.kie.workbench.common.stunner.bpmn.definition.EndCompensationEvent) TestingGraphInstanceBuilder2(org.kie.workbench.common.stunner.core.TestingGraphInstanceBuilder2) UserTask(org.kie.workbench.common.stunner.bpmn.definition.UserTask) DefinitionsBuildingContext(org.kie.workbench.common.stunner.bpmn.backend.converters.fromstunner.DefinitionsBuildingContext) TestingGraphMockHandler(org.kie.workbench.common.stunner.core.TestingGraphMockHandler) ProcessPropertyWriter(org.kie.workbench.common.stunner.bpmn.backend.converters.fromstunner.properties.ProcessPropertyWriter) ScriptTask(org.kie.workbench.common.stunner.bpmn.definition.ScriptTask) Test(org.junit.Test)

Example 13 with AdHocSubprocess

use of org.kie.workbench.common.stunner.bpmn.definition.AdHocSubprocess in project kie-wb-common by kiegroup.

the class AbstractDataTypeCache method extractFromItem.

public void extractFromItem(View view) {
    Object definition = view.getDefinition();
    if (definition instanceof DataObject) {
        DataObject dataObject = (DataObject) definition;
        allDataTypes.add(dataObject.getType().getValue().getType());
    } else if (definition instanceof AdHocSubprocess) {
        AdHocSubprocess adhoc = (AdHocSubprocess) definition;
        allDataTypes.addAll(getDataTypes(adhoc.getProcessData().getProcessVariables().getValue()));
    } else if (definition instanceof BPMNDiagramImpl) {
        BPMNDiagramImpl diagram = (BPMNDiagramImpl) definition;
        allDataTypes.addAll(getDataTypes(diagram.getProcessData().getProcessVariables().getValue()));
    } else if (definition instanceof EmbeddedSubprocess) {
        EmbeddedSubprocess embeddedSubprocess = (EmbeddedSubprocess) definition;
        allDataTypes.addAll(getDataTypes(embeddedSubprocess.getProcessData().getProcessVariables().getValue()));
    } else if (definition instanceof EventSubprocess) {
        EventSubprocess eventSubprocess = (EventSubprocess) definition;
        allDataTypes.addAll(getDataTypes(eventSubprocess.getProcessData().getProcessVariables().getValue()));
    } else if (definition instanceof MultipleInstanceSubprocess) {
        MultipleInstanceSubprocess multipleInstanceSubprocess = (MultipleInstanceSubprocess) definition;
        allDataTypes.addAll(getDataTypes(multipleInstanceSubprocess.getProcessData().getProcessVariables().getValue()));
        allDataTypes.addAll(getDataTypes(multipleInstanceSubprocess.getExecutionSet().getMultipleInstanceDataInput().getValue()));
        allDataTypes.addAll(getDataTypes(multipleInstanceSubprocess.getExecutionSet().getMultipleInstanceDataOutput().getValue()));
    } else if (definition instanceof UserTask) {
        UserTask userTask = (UserTask) definition;
        allDataTypes.addAll(processAssignments(userTask.getExecutionSet().getAssignmentsinfo()));
    } else if (definition instanceof GenericServiceTask) {
        GenericServiceTask genericServiceTask = (GenericServiceTask) definition;
        allDataTypes.addAll(processAssignments(genericServiceTask.getExecutionSet().getAssignmentsinfo()));
    } else if (definition instanceof BusinessRuleTask) {
        BusinessRuleTask businessRuleTask = (BusinessRuleTask) definition;
        allDataTypes.addAll(processAssignments(businessRuleTask.getDataIOSet().getAssignmentsinfo()));
    } else if (definition instanceof EndErrorEvent) {
        EndErrorEvent endErrorEvent = (EndErrorEvent) definition;
        allDataTypes.addAll(processAssignments(endErrorEvent.getDataIOSet().getAssignmentsinfo()));
    } else if (definition instanceof EndEscalationEvent) {
        EndEscalationEvent endEscalationEvent = (EndEscalationEvent) definition;
        allDataTypes.addAll(processAssignments(endEscalationEvent.getDataIOSet().getAssignmentsinfo()));
    } else if (definition instanceof EndMessageEvent) {
        EndMessageEvent endMessageEvent = (EndMessageEvent) definition;
        allDataTypes.addAll(processAssignments(endMessageEvent.getDataIOSet().getAssignmentsinfo()));
    } else if (definition instanceof EndSignalEvent) {
        EndSignalEvent endSignalEvent = (EndSignalEvent) definition;
        allDataTypes.addAll(processAssignments(endSignalEvent.getDataIOSet().getAssignmentsinfo()));
    } else if (definition instanceof IntermediateLinkEventCatching) {
        IntermediateLinkEventCatching intermediateLinkEventCatching = (IntermediateLinkEventCatching) definition;
        allDataTypes.addAll(processAssignments(intermediateLinkEventCatching.getDataIOSet().getAssignmentsinfo()));
    } else if (definition instanceof IntermediateLinkEventThrowing) {
        IntermediateLinkEventThrowing intermediateLinkEventThrowing = (IntermediateLinkEventThrowing) definition;
        allDataTypes.addAll(processAssignments(intermediateLinkEventThrowing.getDataIOSet().getAssignmentsinfo()));
    } else if (definition instanceof IntermediateErrorEventCatching) {
        IntermediateErrorEventCatching intermediateErrorEventCatching = (IntermediateErrorEventCatching) definition;
        allDataTypes.addAll(processAssignments(intermediateErrorEventCatching.getDataIOSet().getAssignmentsinfo()));
    } else if (definition instanceof IntermediateEscalationEvent) {
        IntermediateEscalationEvent intermediateEscalationEvent = (IntermediateEscalationEvent) definition;
        allDataTypes.addAll(processAssignments(intermediateEscalationEvent.getDataIOSet().getAssignmentsinfo()));
    } else if (definition instanceof IntermediateEscalationEventThrowing) {
        IntermediateEscalationEventThrowing intermediateEscalationEventThrowing = (IntermediateEscalationEventThrowing) definition;
        allDataTypes.addAll(processAssignments(intermediateEscalationEventThrowing.getDataIOSet().getAssignmentsinfo()));
    } else if (definition instanceof IntermediateMessageEventCatching) {
        IntermediateMessageEventCatching intermediateMessageEventCatching = (IntermediateMessageEventCatching) definition;
        allDataTypes.addAll(processAssignments(intermediateMessageEventCatching.getDataIOSet().getAssignmentsinfo()));
    } else if (definition instanceof IntermediateMessageEventThrowing) {
        IntermediateMessageEventThrowing intermediateMessageEventThrowing = (IntermediateMessageEventThrowing) definition;
        allDataTypes.addAll(processAssignments(intermediateMessageEventThrowing.getDataIOSet().getAssignmentsinfo()));
    } else if (definition instanceof IntermediateSignalEventCatching) {
        IntermediateSignalEventCatching intermediateSignalEventCatching = (IntermediateSignalEventCatching) definition;
        allDataTypes.addAll(processAssignments(intermediateSignalEventCatching.getDataIOSet().getAssignmentsinfo()));
    } else if (definition instanceof IntermediateSignalEventThrowing) {
        IntermediateSignalEventThrowing intermediateSignalEventThrowing = (IntermediateSignalEventThrowing) definition;
        allDataTypes.addAll(processAssignments(intermediateSignalEventThrowing.getDataIOSet().getAssignmentsinfo()));
    } else if (definition instanceof ReusableSubprocess) {
        ReusableSubprocess reusableSubprocess = (ReusableSubprocess) definition;
        allDataTypes.addAll(processAssignments(reusableSubprocess.getDataIOSet().getAssignmentsinfo()));
    } else if (definition instanceof StartErrorEvent) {
        StartErrorEvent startErrorEvent = (StartErrorEvent) definition;
        allDataTypes.addAll(processAssignments(startErrorEvent.getDataIOSet().getAssignmentsinfo()));
    } else if (definition instanceof StartEscalationEvent) {
        StartEscalationEvent startEscalationEvent = (StartEscalationEvent) definition;
        allDataTypes.addAll(processAssignments(startEscalationEvent.getDataIOSet().getAssignmentsinfo()));
    } else if (definition instanceof StartMessageEvent) {
        StartMessageEvent startMessageEvent = (StartMessageEvent) definition;
        allDataTypes.addAll(processAssignments(startMessageEvent.getDataIOSet().getAssignmentsinfo()));
    } else if (definition instanceof StartSignalEvent) {
        StartSignalEvent startSignalEvent = (StartSignalEvent) definition;
        allDataTypes.addAll(processAssignments(startSignalEvent.getDataIOSet().getAssignmentsinfo()));
    } else if (definition instanceof CustomTask) {
        CustomTask customTask = (CustomTask) definition;
        allDataTypes.addAll(processAssignments(customTask.getDataIOSet().getAssignmentsinfo()));
    }
}
Also used : StartSignalEvent(org.kie.workbench.common.stunner.bpmn.definition.StartSignalEvent) EndSignalEvent(org.kie.workbench.common.stunner.bpmn.definition.EndSignalEvent) GenericServiceTask(org.kie.workbench.common.stunner.bpmn.definition.GenericServiceTask) BusinessRuleTask(org.kie.workbench.common.stunner.bpmn.definition.BusinessRuleTask) AdHocSubprocess(org.kie.workbench.common.stunner.bpmn.definition.AdHocSubprocess) EndEscalationEvent(org.kie.workbench.common.stunner.bpmn.definition.EndEscalationEvent) StartEscalationEvent(org.kie.workbench.common.stunner.bpmn.definition.StartEscalationEvent) MultipleInstanceSubprocess(org.kie.workbench.common.stunner.bpmn.definition.MultipleInstanceSubprocess) IntermediateEscalationEventThrowing(org.kie.workbench.common.stunner.bpmn.definition.IntermediateEscalationEventThrowing) IntermediateEscalationEvent(org.kie.workbench.common.stunner.bpmn.definition.IntermediateEscalationEvent) StartMessageEvent(org.kie.workbench.common.stunner.bpmn.definition.StartMessageEvent) EventSubprocess(org.kie.workbench.common.stunner.bpmn.definition.EventSubprocess) IntermediateLinkEventCatching(org.kie.workbench.common.stunner.bpmn.definition.IntermediateLinkEventCatching) IntermediateErrorEventCatching(org.kie.workbench.common.stunner.bpmn.definition.IntermediateErrorEventCatching) EmbeddedSubprocess(org.kie.workbench.common.stunner.bpmn.definition.EmbeddedSubprocess) IntermediateMessageEventThrowing(org.kie.workbench.common.stunner.bpmn.definition.IntermediateMessageEventThrowing) IntermediateMessageEventCatching(org.kie.workbench.common.stunner.bpmn.definition.IntermediateMessageEventCatching) BPMNDiagramImpl(org.kie.workbench.common.stunner.bpmn.definition.BPMNDiagramImpl) IntermediateSignalEventThrowing(org.kie.workbench.common.stunner.bpmn.definition.IntermediateSignalEventThrowing) IntermediateLinkEventThrowing(org.kie.workbench.common.stunner.bpmn.definition.IntermediateLinkEventThrowing) IntermediateSignalEventCatching(org.kie.workbench.common.stunner.bpmn.definition.IntermediateSignalEventCatching) UserTask(org.kie.workbench.common.stunner.bpmn.definition.UserTask) EndErrorEvent(org.kie.workbench.common.stunner.bpmn.definition.EndErrorEvent) DataObject(org.kie.workbench.common.stunner.bpmn.definition.DataObject) ReusableSubprocess(org.kie.workbench.common.stunner.bpmn.definition.ReusableSubprocess) DataObject(org.kie.workbench.common.stunner.bpmn.definition.DataObject) EndMessageEvent(org.kie.workbench.common.stunner.bpmn.definition.EndMessageEvent) StartErrorEvent(org.kie.workbench.common.stunner.bpmn.definition.StartErrorEvent) CustomTask(org.kie.workbench.common.stunner.bpmn.workitem.CustomTask)

Example 14 with AdHocSubprocess

use of org.kie.workbench.common.stunner.bpmn.definition.AdHocSubprocess in project kie-wb-common by kiegroup.

the class AdHocSubProcessTest method testUnmarshallSubProcessLevelFilledPropertiesSubProcess.

@Test
@Override
public void testUnmarshallSubProcessLevelFilledPropertiesSubProcess() {
    final String SUB_PROCESS_NAME_JAVA = "Ad-hoc sub-process04 name ~!@#$%^&*()_+`1234567890-={}|[]\\:\";'<>?,./";
    final String SUB_PROCESS_DOCUMENTATION_JAVA = "Ad-hoc sub-process04 doc\n ~!@#$%^&*()_+`1234567890-={}|[]\\:\";'<>?,./";
    final String SUB_PROCESS_NAME_JAVASCRIPT = "Ad-hoc sub-process05 name ~!@#$%^&*()_+`1234567890-={}|[]\\:\";'<>?,./";
    final String SUB_PROCESS_DOCUMENTATION_JAVASCRIPT = "Ad-hoc sub-process05 doc\n ~!@#$%^&*()_+`1234567890-={}|[]\\:\";'<>?,./";
    final String SUB_PROCESS_NAME_MVEL = "Ad-hoc sub-process06 name ~!@#$%^&*()_+`1234567890-={}|[]\\:\";'<>?,./";
    final String SUB_PROCESS_DOCUMENTATION_MVEL = "Ad-hoc sub-process06 doc\n ~!@#$%^&*()_+`1234567890-={}|[]\\:\";'<>?,./";
    final String SUB_PROCESS_VARIABLES_JAVA = "subVar04:String:[]";
    final String SUB_PROCESS_VARIABLES_JAVASCRIPT = "subVar05:String:[]";
    final String SUB_PROCESS_VARIABLES_MVEL = "subVarString:String:[],subVarCustom:CustomType:[],subVarBoolean:Boolean:[],subVarFloat:Float:[],subVarInteger:Integer:[],subVarObject:Object:[]";
    Diagram<Graph, Metadata> diagram = getDiagram();
    assertDiagram(diagram, AMOUNT_OF_NODES_IN_DIAGRAM);
    AdHocSubprocess subProcessLevelSubProcessJava = getSubProcessNodeById(diagram, SUBPROCESS_LEVEL_FILLED_SUBPROCESS_JAVA_ID, EMPTY_INCOME_EDGES, EMPTY_OUTCOME_EDGES);
    assertGeneralSet(subProcessLevelSubProcessJava.getGeneral(), SUB_PROCESS_NAME_JAVA, SUB_PROCESS_DOCUMENTATION_JAVA);
    assertAdHocSubProcessExecutionSet(subProcessLevelSubProcessJava.getExecutionSet(), ADHOC_COMPLETION_CONDITION_SCRIPT_DEFAULT, ADHOC_COMPLETION_CONDITION_LANGUAGE_MVEL, ADHOC_ORDERING_SEQUENTIAL, SUBPROCESS_ON_ENTRY_ACTION_JAVA, SUBPROCESS_SCRIPT_JAVA_LANGUAGE, SUBPROCESS_ON_EXIT_ACTION_JAVA, SUBPROCESS_SCRIPT_JAVA_LANGUAGE, IS_ASYNC, SLA_DUE_DATE);
    assertSubProcessProcessData(subProcessLevelSubProcessJava.getProcessData(), SUB_PROCESS_VARIABLES_JAVA);
    AdHocSubprocess subProcessLevelSubProcessJavascript = getSubProcessNodeById(diagram, SUBPROCESS_LEVEL_FILLED_SUBPROCESS_JAVASCRIPT_ID, EMPTY_INCOME_EDGES, EMPTY_OUTCOME_EDGES);
    assertGeneralSet(subProcessLevelSubProcessJavascript.getGeneral(), SUB_PROCESS_NAME_JAVASCRIPT, SUB_PROCESS_DOCUMENTATION_JAVASCRIPT);
    assertAdHocSubProcessExecutionSet(subProcessLevelSubProcessJavascript.getExecutionSet(), ADHOC_COMPLETION_CONDITION_SCRIPT, ADHOC_COMPLETION_CONDITION_LANGUAGE_DROOLS, ADHOC_ORDERING_PARALLEL, SUBPROCESS_ON_ENTRY_ACTION_JAVASCRIPT, SUBPROCESS_SCRIPT_JAVASCRIPT_LANGUAGE, SUBPROCESS_ON_EXIT_ACTION_JAVASCRIPT, SUBPROCESS_SCRIPT_JAVASCRIPT_LANGUAGE, IS_ASYNC, SLA_DUE_DATE);
    assertSubProcessProcessData(subProcessLevelSubProcessJavascript.getProcessData(), SUB_PROCESS_VARIABLES_JAVASCRIPT);
    AdHocSubprocess subProcessLevelSubProcessMVEL = getSubProcessNodeById(diagram, SUBPROCESS_LEVEL_FILLED_SUBPROCESS_MVEL_ID, EMPTY_INCOME_EDGES, EMPTY_OUTCOME_EDGES);
    assertGeneralSet(subProcessLevelSubProcessMVEL.getGeneral(), SUB_PROCESS_NAME_MVEL, SUB_PROCESS_DOCUMENTATION_MVEL);
    assertAdHocSubProcessExecutionSet(subProcessLevelSubProcessMVEL.getExecutionSet(), ADHOC_COMPLETION_CONDITION_SCRIPT_DEFAULT, ADHOC_COMPLETION_CONDITION_LANGUAGE_MVEL, ADHOC_ORDERING_SEQUENTIAL, SUBPROCESS_ON_ENTRY_ACTION_MVEL, SUBPROCESS_SCRIPT_MVEL_LANGUAGE, SUBPROCESS_ON_EXIT_ACTION_MVEL, SUBPROCESS_SCRIPT_MVEL_LANGUAGE, IS_ASYNC, SLA_DUE_DATE);
    assertSubProcessProcessData(subProcessLevelSubProcessMVEL.getProcessData(), SUB_PROCESS_VARIABLES_MVEL);
}
Also used : Graph(org.kie.workbench.common.stunner.core.graph.Graph) Metadata(org.kie.workbench.common.stunner.core.diagram.Metadata) AdHocSubprocess(org.kie.workbench.common.stunner.bpmn.definition.AdHocSubprocess) Test(org.junit.Test)

Example 15 with AdHocSubprocess

use of org.kie.workbench.common.stunner.bpmn.definition.AdHocSubprocess in project kie-wb-common by kiegroup.

the class AdHocSubProcessTest method testUnmarshallTopLevelEmptyPropertiesSubProcess.

@Test
@Override
public void testUnmarshallTopLevelEmptyPropertiesSubProcess() {
    Diagram<Graph, Metadata> diagram = getDiagram();
    assertDiagram(diagram, AMOUNT_OF_NODES_IN_DIAGRAM);
    AdHocSubprocess topLevelSubProcess = getSubProcessNodeById(diagram, TOP_LEVEL_EMPTY_SUBPROCESS_ID, EMPTY_INCOME_EDGES, EMPTY_OUTCOME_EDGES);
    assertGeneralSet(topLevelSubProcess.getGeneral(), DEFAULT_NAME, DEFAULT_DOCUMENTATION);
    assertAdHocSubProcessExecutionSet(topLevelSubProcess.getExecutionSet(), EMPTY_VALUE, ADHOC_COMPLETION_CONDITION_LANGUAGE_MVEL, ADHOC_ORDERING_SEQUENTIAL, EMPTY_VALUE, SUBPROCESS_SCRIPT_JAVA_LANGUAGE, EMPTY_VALUE, SUBPROCESS_SCRIPT_JAVA_LANGUAGE, IS_NOT_ASYNC, EMPTY_VALUE);
    assertSubProcessProcessData(topLevelSubProcess.getProcessData(), EMPTY_VALUE);
}
Also used : Graph(org.kie.workbench.common.stunner.core.graph.Graph) Metadata(org.kie.workbench.common.stunner.core.diagram.Metadata) AdHocSubprocess(org.kie.workbench.common.stunner.bpmn.definition.AdHocSubprocess) Test(org.junit.Test)

Aggregations

AdHocSubprocess (org.kie.workbench.common.stunner.bpmn.definition.AdHocSubprocess)20 Test (org.junit.Test)14 Metadata (org.kie.workbench.common.stunner.core.diagram.Metadata)8 Graph (org.kie.workbench.common.stunner.core.graph.Graph)8 View (org.kie.workbench.common.stunner.core.graph.content.view.View)8 ProcessData (org.kie.workbench.common.stunner.bpmn.definition.property.variables.ProcessData)5 ViewImpl (org.kie.workbench.common.stunner.core.graph.content.view.ViewImpl)5 NodeImpl (org.kie.workbench.common.stunner.core.graph.impl.NodeImpl)5 AdHocSubProcessPropertyWriter (org.kie.workbench.common.stunner.bpmn.backend.converters.fromstunner.properties.AdHocSubProcessPropertyWriter)4 EmbeddedSubprocess (org.kie.workbench.common.stunner.bpmn.definition.EmbeddedSubprocess)4 BPMNGeneralSet (org.kie.workbench.common.stunner.bpmn.definition.property.general.BPMNGeneralSet)4 AdHocSubprocessTaskExecutionSet (org.kie.workbench.common.stunner.bpmn.definition.property.task.AdHocSubprocessTaskExecutionSet)4 SubProcessPropertyWriter (org.kie.workbench.common.stunner.bpmn.backend.converters.fromstunner.properties.SubProcessPropertyWriter)3 BPMNDiagramImpl (org.kie.workbench.common.stunner.bpmn.definition.BPMNDiagramImpl)3 BaseAdHocSubprocess (org.kie.workbench.common.stunner.bpmn.definition.BaseAdHocSubprocess)3 EventSubprocess (org.kie.workbench.common.stunner.bpmn.definition.EventSubprocess)3 MultipleInstanceSubprocess (org.kie.workbench.common.stunner.bpmn.definition.MultipleInstanceSubprocess)3 Node (org.kie.workbench.common.stunner.core.graph.Node)3 AdHocSubProcess (org.eclipse.bpmn2.AdHocSubProcess)2 FlowElement (org.eclipse.bpmn2.FlowElement)2