Search in sources :

Example 41 with Graph

use of org.kie.workbench.common.stunner.core.graph.Graph in project kie-wb-common by kiegroup.

the class StartNoneEventTest method testUnmarshallTopLevelEventFilledProperties.

@Test
@Override
public void testUnmarshallTopLevelEventFilledProperties() throws Exception {
    final String EVENT_NAME = "Hello none start event name ~`!@#$%^&*()_+=-{}|\\][:\";'?><,./";
    final String EVENT_DOCUMENTATION = "~`!@#$%^&*()_+=-{}|\\][:\";'?><,./\nDocumentation";
    Diagram<Graph, Metadata> diagram = unmarshall(marshaller, BPMN_START_EVENT_FILE_PATH);
    assertDiagram(diagram, AMOUNT_OF_NODES_IN_DIAGRAM);
    StartNoneEvent filledTop = getStartNodeById(diagram, FILLED_TOP_LEVEL_EVENT_ID, StartNoneEvent.class);
    assertGeneralSet(filledTop.getGeneral(), EVENT_NAME, EVENT_DOCUMENTATION);
}
Also used : Graph(org.kie.workbench.common.stunner.core.graph.Graph) Metadata(org.kie.workbench.common.stunner.core.diagram.Metadata) StartNoneEvent(org.kie.workbench.common.stunner.bpmn.definition.StartNoneEvent) Test(org.junit.Test)

Example 42 with Graph

use of org.kie.workbench.common.stunner.core.graph.Graph in project kie-wb-common by kiegroup.

the class StartNoneEventTest method testUnmarshallSubprocessLevelEventEmptyProperties.

@Test
@Override
public void testUnmarshallSubprocessLevelEventEmptyProperties() throws Exception {
    Diagram<Graph, Metadata> diagram = unmarshall(marshaller, BPMN_START_EVENT_FILE_PATH);
    assertDiagram(diagram, AMOUNT_OF_NODES_IN_DIAGRAM);
    StartNoneEvent emptySubprocess = getStartNodeById(diagram, EMPTY_SUBPROCESS_LEVEL_EVENT_ID, StartNoneEvent.class);
    assertGeneralSet(emptySubprocess.getGeneral(), EMPTY_VALUE, EMPTY_VALUE);
}
Also used : Graph(org.kie.workbench.common.stunner.core.graph.Graph) Metadata(org.kie.workbench.common.stunner.core.diagram.Metadata) StartNoneEvent(org.kie.workbench.common.stunner.bpmn.definition.StartNoneEvent) Test(org.junit.Test)

Example 43 with Graph

use of org.kie.workbench.common.stunner.core.graph.Graph in project kie-wb-common by kiegroup.

the class StartSignalEventTest method testUnmarshallTopLevelEventFilledProperties.

@Test
@Override
public void testUnmarshallTopLevelEventFilledProperties() throws Exception {
    final String EVENT_NAME = "Signal Start Event with Name";
    final String EVENT_DOCUMENTATION = "Non empty\nDocumentation\n~`!@#$%^&*()_+=-{}|\\][:\";'?><,./";
    final String SIGNAL_REF = "Signal1";
    final String EVENT_DATA_OUTPUT = "||event:String||[dout]event->processVar";
    Diagram<Graph, Metadata> diagram = unmarshall(marshaller, BPMN_START_EVENT_FILE_PATH);
    assertDiagram(diagram, AMOUNT_OF_NODES_IN_DIAGRAM);
    StartSignalEvent filledTop = getStartNodeById(diagram, FILLED_TOP_LEVEL_EVENT_ID, StartSignalEvent.class);
    assertGeneralSet(filledTop.getGeneral(), EVENT_NAME, EVENT_DOCUMENTATION);
    assertSignalEventExecutionSet(filledTop.getExecutionSet(), SIGNAL_REF, INTERRUPTING);
    assertDataIOSet(filledTop.getDataIOSet(), EVENT_DATA_OUTPUT);
}
Also used : StartSignalEvent(org.kie.workbench.common.stunner.bpmn.definition.StartSignalEvent) Graph(org.kie.workbench.common.stunner.core.graph.Graph) Metadata(org.kie.workbench.common.stunner.core.diagram.Metadata) Test(org.junit.Test)

Example 44 with Graph

use of org.kie.workbench.common.stunner.core.graph.Graph in project kie-wb-common by kiegroup.

the class StartTimerEventTest method testUnmarshallSubprocessLevelEventFilledProperties.

@Test
@Override
public void testUnmarshallSubprocessLevelEventFilledProperties() throws Exception {
    final String EVENT_NAME_MULTIPLE = "~`!@#$%^&*()_+=-{}|\\][:\";'?><,./ name";
    final String EVENT_DOCUMENTATION_MULTIPLE = "Some documentation for this event\n\n~`!@#$%^&*()_+=-{}|\\][:\";'?><,./";
    final String TIMER_VALUE_MULTIPLE = "R3/PT8M3S";
    // "none" is a "not a cron" for engine and looks like ISO in GUI
    final String TIMER_VALUE_LANGUAGE_MULTIPLE = "none";
    // Should be uncommented after https://issues.jboss.org/browse/JBPM-7038 will be fixed
    // final String timerDataOutputMultiple = "||hello:String||[dout]hello->processVar";
    final String EVENT_NAME_SPECIFIC_DATE = "~`!@#$%^&*()_+=-{}|\\][:\";'?><,./ hello how are you?";
    final String EVENT_DOCUMENTATION_SPECIFIC_DATE = "~`!@#$%^&*()_+=-{}|\\][:\";'?><,./\ndocumentaion";
    final String TIMER_VALUE_SPECIFIC_DATE = "2018-03-16T13:50:59+01:00";
    // Should be uncommented after https://issues.jboss.org/browse/JBPM-7038 will be fixed
    // final String timerDataOutputSpecificDate = "||hello:String||[dout]hello->processVar";
    final String EVENT_NAME_AFTER_DURATION = "\"non empty name\"";
    final String EVENT_DOCUMENTATION_AFTER_DURATION = "Time is here: ~`!@#$%^&*()_+=-{}|\\][:\";'?><,./";
    final String TIMER_VALUE_AFTER_DURATION = "PT1H15M";
    // Should be uncommented after https://issues.jboss.org/browse/JBPM-7038 will be fixed
    // final String timerDataOutputDuration = "||hello:String||[dout]hello->processVar";
    Diagram<Graph, Metadata> diagram = unmarshall(marshaller, BPMN_START_EVENT_FILE_PATH);
    assertDiagram(diagram, AMOUNT_OF_NODES_IN_DIAGRAM);
    StartTimerEvent filledTopMultiple = getStartNodeById(diagram, FILLED_SUBPROCESS_LEVEL_EVENT_MULTIPLE_ID, StartTimerEvent.class);
    assertGeneralSet(filledTopMultiple.getGeneral(), EVENT_NAME_MULTIPLE, EVENT_DOCUMENTATION_MULTIPLE);
    assertTimerEventMultiple(filledTopMultiple.getExecutionSet(), TIMER_VALUE_MULTIPLE, TIMER_VALUE_LANGUAGE_MULTIPLE, INTERRUPTING);
    // Know issue. Should be uncommented after https://issues.jboss.org/browse/JBPM-7038 will be fixed
    // assertDataIOSet(filledTopMultiple.getDataIOSet(), timerDataOutputMultiple);
    StartTimerEvent filledTopSpecificDate = getStartNodeById(diagram, FILLED_SUBPROCESS_LEVEL_EVENT_SPECIFIC_DATE_ID, StartTimerEvent.class);
    assertGeneralSet(filledTopSpecificDate.getGeneral(), EVENT_NAME_SPECIFIC_DATE, EVENT_DOCUMENTATION_SPECIFIC_DATE);
    assertTimerEventSpecificDate(filledTopSpecificDate.getExecutionSet(), TIMER_VALUE_SPECIFIC_DATE, INTERRUPTING);
    // Know issue. Should be uncommented after https://issues.jboss.org/browse/JBPM-7038 will be fixed
    // assertDataIOSet(filledTopSpecificDate.getDataIOSet(), timerDataOutputSpecificDate);
    StartTimerEvent filledTopAfterDuration = getStartNodeById(diagram, FILLED_SUBPROCESS_LEVEL_EVENT_AFTER_DURATION_ID, StartTimerEvent.class);
    assertGeneralSet(filledTopAfterDuration.getGeneral(), EVENT_NAME_AFTER_DURATION, EVENT_DOCUMENTATION_AFTER_DURATION);
    assertTimerEventAfterDuration(filledTopAfterDuration.getExecutionSet(), TIMER_VALUE_AFTER_DURATION, INTERRUPTING);
// Know issue. Should be uncommented after https://issues.jboss.org/browse/JBPM-7038 will be fixed
// assertDataIOSet(filledTopSpecificDate.getDataIOSet(), timerDataOutputDuration);
}
Also used : Graph(org.kie.workbench.common.stunner.core.graph.Graph) StartTimerEvent(org.kie.workbench.common.stunner.bpmn.definition.StartTimerEvent) Metadata(org.kie.workbench.common.stunner.core.diagram.Metadata) Test(org.junit.Test)

Example 45 with Graph

use of org.kie.workbench.common.stunner.core.graph.Graph in project kie-wb-common by kiegroup.

the class BPMNDiagramMarshallerTest method testMarshallIsInterruptingStartErrorEvent.

@Test
public void testMarshallIsInterruptingStartErrorEvent() throws Exception {
    Diagram<Graph, Metadata> testIt = unmarshall(BPMN_EVENT_SUBPROCESS_STARTERROREVENT);
    String result = tested.marshall(testIt);
    assertDiagram(result, 1, 6, 2);
    Diagram<Graph, Metadata> marshalledDiagram = unmarshall(getStream(result));
    assertDiagram(marshalledDiagram, 7);
    assertEquals("EventSubprocessStartErrorEvent", marshalledDiagram.getMetadata().getTitle());
    Node<? extends Definition, ?> filledEventNode = testIt.getGraph().getNode("9ABD5C04-C6E2-4DF3-829F-ADB283330AD6");
    Node<? extends Definition, ?> marshalledFilledEventNode = marshalledDiagram.getGraph().getNode("9ABD5C04-C6E2-4DF3-829F-ADB283330AD6");
    assertEquals(filledEventNode, marshalledFilledEventNode);
    Node<? extends Definition, ?> emptyEventNode = marshalledDiagram.getGraph().getNode("50B93E5E-C05D-40DD-BF48-2B6AE919763E");
    Node<? extends Definition, ?> marshalledEmptyEventNode = marshalledDiagram.getGraph().getNode("50B93E5E-C05D-40DD-BF48-2B6AE919763E");
    assertEquals(emptyEventNode, marshalledEmptyEventNode);
}
Also used : Graph(org.kie.workbench.common.stunner.core.graph.Graph) Metadata(org.kie.workbench.common.stunner.core.diagram.Metadata) Matchers.anyString(org.mockito.Matchers.anyString) Test(org.junit.Test)

Aggregations

Graph (org.kie.workbench.common.stunner.core.graph.Graph)190 Metadata (org.kie.workbench.common.stunner.core.diagram.Metadata)162 Test (org.junit.Test)152 Matchers.anyString (org.mockito.Matchers.anyString)54 View (org.kie.workbench.common.stunner.core.graph.content.view.View)45 Element (org.kie.workbench.common.stunner.core.graph.Element)31 AssignmentsInfo (org.kie.workbench.common.stunner.bpmn.definition.property.dataio.AssignmentsInfo)30 Node (org.kie.workbench.common.stunner.core.graph.Node)30 Edge (org.kie.workbench.common.stunner.core.graph.Edge)29 ItemAwareElement (org.eclipse.bpmn2.ItemAwareElement)28 RootElement (org.eclipse.bpmn2.RootElement)28 DataIOSet (org.kie.workbench.common.stunner.bpmn.definition.property.dataio.DataIOSet)28 FlowElement (org.eclipse.bpmn2.FlowElement)26 UserTask (org.kie.workbench.common.stunner.bpmn.definition.UserTask)17 ArrayList (java.util.ArrayList)14 List (java.util.List)13 ViewConnector (org.kie.workbench.common.stunner.core.graph.content.view.ViewConnector)13 MessageRef (org.kie.workbench.common.stunner.bpmn.definition.property.event.message.MessageRef)10 Optional (java.util.Optional)9 Definitions (org.eclipse.bpmn2.Definitions)9