Search in sources :

Example 6 with StartTimerEvent

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

the class BPMNDiagramMarshallerTest method testUnmarshallStartTimerEvent.

@Test
@SuppressWarnings("unchecked")
public void testUnmarshallStartTimerEvent() throws Exception {
    Diagram<Graph, Metadata> diagram = unmarshall(BPMN_STARTTIMEREVENT);
    assertDiagram(diagram, 4);
    assertEquals("StartTimerEvent", diagram.getMetadata().getTitle());
    Node<? extends Definition, ?> startTimerEventNode = diagram.getGraph().getNode("_49ADC988-B63D-4AEB-B811-67969F305FD0");
    StartTimerEvent startTimerEvent = (StartTimerEvent) startTimerEventNode.getContent().getDefinition();
    IsInterrupting isInterrupting = startTimerEvent.getExecutionSet().getIsInterrupting();
    assertEquals(false, isInterrupting.getValue());
}
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) IsInterrupting(org.kie.workbench.common.stunner.bpmn.definition.property.event.IsInterrupting) Test(org.junit.Test)

Example 7 with StartTimerEvent

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

the class StartTimerEventTest method testUnmarshallTopLevelEmptyEventProperties.

@Test
@Override
public void testUnmarshallTopLevelEmptyEventProperties() throws Exception {
    Diagram<Graph, Metadata> diagram = unmarshall(marshaller, BPMN_START_EVENT_FILE_PATH);
    assertDiagram(diagram, AMOUNT_OF_NODES_IN_DIAGRAM);
    StartTimerEvent emptyTop = getStartNodeById(diagram, EMPTY_TOP_LEVEL_EVENT_ID, StartTimerEvent.class);
    assertGeneralSet(emptyTop.getGeneral(), EMPTY_VALUE, EMPTY_VALUE);
    assertTimerEventEmpty(emptyTop.getExecutionSet(), NON_INTERRUPTING);
// Know issue. Should be uncommented after https://issues.jboss.org/browse/JBPM-7038 will be fixed
// assertDataIOSet(emptySubprocess.getDataIOSet(), EMPTY_VALUE);
}
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 8 with StartTimerEvent

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

the class StartTimerEventTest 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);
    StartTimerEvent emptySubprocess = getStartNodeById(diagram, EMPTY_SUBPROCESS_LEVEL_EVENT_ID, StartTimerEvent.class);
    assertGeneralSet(emptySubprocess.getGeneral(), EMPTY_VALUE, EMPTY_VALUE);
    assertTimerEventEmpty(emptySubprocess.getExecutionSet(), NON_INTERRUPTING);
// Know issue. Should be uncommented after https://issues.jboss.org/browse/JBPM-7038 will be fixed
// assertDataIOSet(emptySubprocess.getDataIOSet(), EMPTY_VALUE);
}
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 9 with StartTimerEvent

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

the class StartTimerEventTest method testUnmarshallTopLevelEventFilledProperties.

@Test
@Override
public void testUnmarshallTopLevelEventFilledProperties() throws Exception {
    final String EVENT_NAME_MULTIPLE = "~`!@#$%^&*()_+=-{}|\\][:\";'?><,./";
    final String EVENT_DOCUMENTATION_MULTIPLE = "~`!@#$%^&*()_+=-{}|\\][:\";'?><,./\n~`!@#$%^&*()_+=-{}|\\][:\";'?><,./\n~`!@#$%^&*()_+=-{}|\\][:\";'?><,./";
    final String TIMER_VALUE_MULTIPLE = "5m3s";
    final String TIMER_VALUE_LANGUAGE_MULTIPLE = "cron";
    // 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 = "~`!@#$%^&*()_+=-{}|\\][:\";'?><,./";
    final String EVENT_DOCUMENTATION_SPECIFIC_DATE = "Why not\n~`!@#$%^&*()_+=-{}|\\][:\";'?><,./\nhere\n~`!@#$%^&*()_+=-{}|\\][:\";'?><,./";
    final String TIMER_VALUE_SPECIFIC_DATE = "2018-03-16T13:50:59+02:00";
    // 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_AFTER_DURATION = "'Some name'";
    final String EVENT_DOCUMENTATION_AFTER_DURATION = "And some documentation\n\n~`!@#$%^&*()_+=-{}|\\][:\";'?><,./";
    final String TIMER_VALUE_AFTER_DURATION = "PT1H17M";
    // Should be uncommented after https://issues.jboss.org/browse/JBPM-7038 will be fixed
    // final String timerDataOutputMultiple = "||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_TOP_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);
    // Should be uncommented after https://issues.jboss.org/browse/JBPM-7038 will be fixed
    // final String timerDataOutputMultiple = "||hello:String||[dout]hello->processVar";
    StartTimerEvent filledTopSpecificDate = getStartNodeById(diagram, FILLED_TOP_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);
    // Should be uncommented after https://issues.jboss.org/browse/JBPM-7038 will be fixed
    // final String timerDataOutputSpecificDate = "||hello:String||[dout]hello->processVar";
    StartTimerEvent filledTopAfterDuration = getStartNodeById(diagram, FILLED_TOP_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 10 with StartTimerEvent

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

the class BPMNDiagramMarshallerTest method testUnmarshallIsInterruptingStartTimerEvent.

@Test
public void testUnmarshallIsInterruptingStartTimerEvent() throws Exception {
    Diagram<Graph, Metadata> diagram = unmarshall(BPMN_EVENT_SUBPROCESS_STARTTIMEREVENT);
    assertDiagram(diagram, 7);
    assertEquals("EventSubprocessStartTimerEvent", diagram.getMetadata().getTitle());
    // Check first start event with all FILLED properties
    Node<? extends Definition, ?> startEventNode = diagram.getGraph().getNode("_4A4F40C5-C9F1-4761-BD95-C61DDBDC9C19");
    StartTimerEvent startTimerEvent = (StartTimerEvent) startEventNode.getContent().getDefinition();
    BPMNGeneralSet eventGeneralSet = startTimerEvent.getGeneral();
    assertNotNull(eventGeneralSet);
    assertEquals("StartTimerEvent", eventGeneralSet.getName().getValue());
    assertEquals("Some not empty\nDocumentation\n~`!@#$%^&*()_+=-{}|[]\\:\";'<>/?.,", eventGeneralSet.getDocumentation().getValue());
    InterruptingTimerEventExecutionSet eventExecutionSet = startTimerEvent.getExecutionSet();
    assertNotNull(eventExecutionSet);
    assertNotNull(eventExecutionSet.getTimerSettings());
    assertEquals("*/2 * * * *", eventExecutionSet.getTimerSettings().getValue().getTimeCycle());
    assertEquals("cron", eventExecutionSet.getTimerSettings().getValue().getTimeCycleLanguage());
    assertEquals("201702081535", eventExecutionSet.getTimerSettings().getValue().getTimeDate());
    assertEquals("P4H", eventExecutionSet.getTimerSettings().getValue().getTimeDuration());
    assertEquals(true, eventExecutionSet.getIsInterrupting().getValue());
    // Check second start event with all EMPTY properties
    Node<? extends Definition, ?> emptyEventNode = diagram.getGraph().getNode("_BF94EA1F-519D-4E52-AB2A-C7687E11ABDC");
    StartTimerEvent emptyTimerEvent = (StartTimerEvent) emptyEventNode.getContent().getDefinition();
    BPMNGeneralSet emptyEventGeneralSet = emptyTimerEvent.getGeneral();
    assertNotNull(emptyEventGeneralSet);
    assertEquals("", emptyEventGeneralSet.getName().getValue());
    assertEquals("", emptyEventGeneralSet.getDocumentation().getValue());
    InterruptingTimerEventExecutionSet emptyExecutionSet = emptyTimerEvent.getExecutionSet();
    assertNotNull(emptyExecutionSet);
    assertNotNull(emptyExecutionSet.getTimerSettings());
    assertNull(emptyExecutionSet.getTimerSettings().getValue().getTimeCycle());
    assertNull(emptyExecutionSet.getTimerSettings().getValue().getTimeCycleLanguage());
    assertNull(emptyExecutionSet.getTimerSettings().getValue().getTimeDate());
    assertNull(emptyExecutionSet.getTimerSettings().getValue().getTimeDuration());
    assertEquals(false, emptyExecutionSet.getIsInterrupting().getValue());
}
Also used : InterruptingTimerEventExecutionSet(org.kie.workbench.common.stunner.bpmn.definition.property.event.timer.InterruptingTimerEventExecutionSet) 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) BPMNGeneralSet(org.kie.workbench.common.stunner.bpmn.definition.property.general.BPMNGeneralSet) Test(org.junit.Test)

Aggregations

StartTimerEvent (org.kie.workbench.common.stunner.bpmn.definition.StartTimerEvent)11 Test (org.junit.Test)9 Metadata (org.kie.workbench.common.stunner.core.diagram.Metadata)7 Graph (org.kie.workbench.common.stunner.core.graph.Graph)7 IsInterrupting (org.kie.workbench.common.stunner.bpmn.definition.property.event.IsInterrupting)3 InterruptingTimerEventExecutionSet (org.kie.workbench.common.stunner.bpmn.definition.property.event.timer.InterruptingTimerEventExecutionSet)3 BPMNGeneralSet (org.kie.workbench.common.stunner.bpmn.definition.property.general.BPMNGeneralSet)3 StartEvent (org.eclipse.bpmn2.StartEvent)1 CatchEventPropertyWriter (org.kie.workbench.common.stunner.bpmn.backend.converters.fromstunner.properties.CatchEventPropertyWriter)1 CatchEventPropertyReader (org.kie.workbench.common.stunner.bpmn.backend.converters.tostunner.properties.CatchEventPropertyReader)1 EventPropertyReader (org.kie.workbench.common.stunner.bpmn.backend.converters.tostunner.properties.EventPropertyReader)1 BaseStartEvent (org.kie.workbench.common.stunner.bpmn.definition.BaseStartEvent)1 TimerSettings (org.kie.workbench.common.stunner.bpmn.definition.property.event.timer.TimerSettings)1 Documentation (org.kie.workbench.common.stunner.bpmn.definition.property.general.Documentation)1 Name (org.kie.workbench.common.stunner.bpmn.definition.property.general.Name)1 Edge (org.kie.workbench.common.stunner.core.graph.Edge)1 View (org.kie.workbench.common.stunner.core.graph.content.view.View)1