Search in sources :

Example 6 with IntermediateTimerEvent

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

the class BPMNDirectDiagramMarshallerTest method testMarshallIntermediateTimerEvent.

@Test
public void testMarshallIntermediateTimerEvent() throws Exception {
    Diagram<Graph, Metadata> diagram = unmarshall(BPMN_TIMER_EVENT);
    IntermediateTimerEvent timerEvent = null;
    Iterator<Element> it = nodesIterator(diagram);
    while (it.hasNext()) {
        Element element = it.next();
        if (element.getContent() instanceof View) {
            Object oDefinition = ((View) element.getContent()).getDefinition();
            if (oDefinition instanceof IntermediateTimerEvent) {
                timerEvent = (IntermediateTimerEvent) oDefinition;
                break;
            }
        }
    }
    assertNotNull(timerEvent);
    assertNotNull(timerEvent.getGeneral());
    assertNotNull(timerEvent.getExecutionSet());
    assertEquals("myTimeDateValue", timerEvent.getExecutionSet().getTimerSettings().getValue().getTimeDate());
    assertEquals("MyTimeDurationValue", timerEvent.getExecutionSet().getTimerSettings().getValue().getTimeDuration());
    assertEquals("myTimeCycleValue", timerEvent.getExecutionSet().getTimerSettings().getValue().getTimeCycle());
    assertEquals("cron", timerEvent.getExecutionSet().getTimerSettings().getValue().getTimeCycleLanguage());
}
Also used : Graph(org.kie.workbench.common.stunner.core.graph.Graph) IntermediateTimerEvent(org.kie.workbench.common.stunner.bpmn.definition.IntermediateTimerEvent) ItemAwareElement(org.eclipse.bpmn2.ItemAwareElement) FlowElement(org.eclipse.bpmn2.FlowElement) RootElement(org.eclipse.bpmn2.RootElement) Element(org.kie.workbench.common.stunner.core.graph.Element) Metadata(org.kie.workbench.common.stunner.core.diagram.Metadata) View(org.kie.workbench.common.stunner.core.graph.content.view.View) Test(org.junit.Test)

Example 7 with IntermediateTimerEvent

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

the class EventCancelActivityViewHandlerTest method testHandleTimerIsCancel.

@Test
@SuppressWarnings("unchecked")
public void testHandleTimerIsCancel() {
    final IntermediateTimerEvent bean = new IntermediateTimerEvent.IntermediateTimerEventBuilder().build();
    bean.getExecutionSet().getCancelActivity().setValue(true);
    tested.handle(bean, view);
    verify(prim1).setAlpha(eq(1d));
    verify(prim2).setAlpha(eq(0d));
}
Also used : IntermediateTimerEvent(org.kie.workbench.common.stunner.bpmn.definition.IntermediateTimerEvent) Test(org.junit.Test)

Example 8 with IntermediateTimerEvent

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

the class BPMNDiagramMarshallerTest method testUnmarshallIntermediateTimerEvent.

@Test
@SuppressWarnings("unchecked")
public void testUnmarshallIntermediateTimerEvent() throws Exception {
    Diagram<Graph, Metadata> diagram = unmarshall(BPMN_INTERMEDIATE_TIMER_EVENT);
    assertDiagram(diagram, 2);
    assertEquals("intermediateTimer", diagram.getMetadata().getTitle());
    Node<? extends Definition, ?> intermediateEventNode = diagram.getGraph().getNode("_8D881072-284F-4F0D-8CF2-AD1F4540FC4E");
    IntermediateTimerEvent intermediateTimerEvent = (IntermediateTimerEvent) intermediateEventNode.getContent().getDefinition();
    assertNotNull(intermediateTimerEvent.getGeneral());
    assertEquals("MyTimer", intermediateTimerEvent.getGeneral().getName().getValue());
    assertNotNull(intermediateTimerEvent.getExecutionSet());
    assertEquals("abc", intermediateTimerEvent.getExecutionSet().getTimerSettings().getValue().getTimeCycle());
    assertEquals("none", intermediateTimerEvent.getExecutionSet().getTimerSettings().getValue().getTimeCycleLanguage());
    assertEquals("abc", intermediateTimerEvent.getExecutionSet().getTimerSettings().getValue().getTimeDate());
    assertEquals("abc", intermediateTimerEvent.getExecutionSet().getTimerSettings().getValue().getTimeDuration());
}
Also used : Graph(org.kie.workbench.common.stunner.core.graph.Graph) IntermediateTimerEvent(org.kie.workbench.common.stunner.bpmn.definition.IntermediateTimerEvent) Metadata(org.kie.workbench.common.stunner.core.diagram.Metadata) Test(org.junit.Test)

Example 9 with IntermediateTimerEvent

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

the class IntermediateCatchEventConverter method timerEvent.

private PropertyWriter timerEvent(Node<View<IntermediateTimerEvent>, ?> n) {
    CatchEventPropertyWriter p = createCatchEventPropertyWriter(n);
    p.getFlowElement().setId(n.getUUID());
    IntermediateTimerEvent definition = n.getContent().getDefinition();
    BPMNGeneralSet general = definition.getGeneral();
    p.setName(general.getName().getValue());
    p.setDocumentation(general.getDocumentation().getValue());
    CancellingTimerEventExecutionSet executionSet = definition.getExecutionSet();
    p.addTimer(executionSet.getTimerSettings());
    p.setBounds(n.getContent().getBounds());
    return p;
}
Also used : CancellingTimerEventExecutionSet(org.kie.workbench.common.stunner.bpmn.definition.property.event.timer.CancellingTimerEventExecutionSet) CatchEventPropertyWriter(org.kie.workbench.common.stunner.bpmn.backend.converters.fromstunner.properties.CatchEventPropertyWriter) IntermediateTimerEvent(org.kie.workbench.common.stunner.bpmn.definition.IntermediateTimerEvent) BPMNGeneralSet(org.kie.workbench.common.stunner.bpmn.definition.property.general.BPMNGeneralSet)

Aggregations

IntermediateTimerEvent (org.kie.workbench.common.stunner.bpmn.definition.IntermediateTimerEvent)9 Test (org.junit.Test)7 Metadata (org.kie.workbench.common.stunner.core.diagram.Metadata)5 Graph (org.kie.workbench.common.stunner.core.graph.Graph)5 CancellingTimerEventExecutionSet (org.kie.workbench.common.stunner.bpmn.definition.property.event.timer.CancellingTimerEventExecutionSet)3 View (org.kie.workbench.common.stunner.core.graph.content.view.View)3 FlowElement (org.eclipse.bpmn2.FlowElement)2 ItemAwareElement (org.eclipse.bpmn2.ItemAwareElement)2 RootElement (org.eclipse.bpmn2.RootElement)2 TimerSettings (org.kie.workbench.common.stunner.bpmn.definition.property.event.timer.TimerSettings)2 BPMNGeneralSet (org.kie.workbench.common.stunner.bpmn.definition.property.general.BPMNGeneralSet)2 Element (org.kie.workbench.common.stunner.core.graph.Element)2 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 CancelActivity (org.kie.workbench.common.stunner.bpmn.definition.property.event.CancelActivity)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