Search in sources :

Example 41 with BPMNGeneralSet

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

the class BPMNDiagramMarshallerTest method testUnmarshallAddHocSubprocess.

@Test
public void testUnmarshallAddHocSubprocess() throws Exception {
    Diagram<Graph, Metadata> diagram = unmarshall(BPMN_ADHOC_SUBPROCESS);
    AdHocSubprocess adHocSubprocess = 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 AdHocSubprocess) {
                adHocSubprocess = (AdHocSubprocess) oDefinition;
                break;
            }
        }
    }
    assertNotNull(adHocSubprocess);
    BPMNGeneralSet generalSet = adHocSubprocess.getGeneral();
    AdHocSubprocessTaskExecutionSet executionSet = adHocSubprocess.getExecutionSet();
    ProcessData processData = adHocSubprocess.getProcessData();
    assertNotNull(generalSet);
    assertNotNull(executionSet);
    assertNotNull(processData);
    assertEquals("AdHocSubprocess1", generalSet.getName().getValue());
    assertEquals("AdHocSubprocess1Documentation", generalSet.getDocumentation().getValue());
    assertNotNull(executionSet.getAdHocCompletionCondition());
    assertNotNull(executionSet.getAdHocCompletionCondition().getValue());
    assertNotNull(executionSet.getAdHocOrdering());
    assertNotNull(executionSet.getOnEntryAction());
    assertNotNull(executionSet.getOnExitAction());
    assertEquals("autocomplete", executionSet.getAdHocCompletionCondition().getValue().getScript());
    assertEquals("drools", executionSet.getAdHocCompletionCondition().getValue().getLanguage());
    assertEquals("Sequential", executionSet.getAdHocOrdering().getValue());
    assertEquals(1, executionSet.getOnEntryAction().getValue().getValues().size());
    assertEquals("System.out.println(\"onEntryAction\");", executionSet.getOnEntryAction().getValue().getValues().get(0).getScript());
    assertEquals("mvel", executionSet.getOnEntryAction().getValue().getValues().get(0).getLanguage());
    assertEquals(1, executionSet.getOnExitAction().getValue().getValues().size());
    assertEquals("System.out.println(\"onExitAction\");", executionSet.getOnExitAction().getValue().getValues().get(0).getScript());
    assertEquals("java", executionSet.getOnExitAction().getValue().getValues().get(0).getLanguage());
    assertEquals("subProcessVar1:String,subProcessVar2:String", processData.getProcessVariables().getValue());
}
Also used : Graph(org.kie.workbench.common.stunner.core.graph.Graph) 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) AdHocSubprocessTaskExecutionSet(org.kie.workbench.common.stunner.bpmn.definition.property.task.AdHocSubprocessTaskExecutionSet) AdHocSubprocess(org.kie.workbench.common.stunner.bpmn.definition.AdHocSubprocess) BPMNGeneralSet(org.kie.workbench.common.stunner.bpmn.definition.property.general.BPMNGeneralSet) View(org.kie.workbench.common.stunner.core.graph.content.view.View) ProcessData(org.kie.workbench.common.stunner.bpmn.definition.property.variables.ProcessData) Test(org.junit.Test)

Example 42 with BPMNGeneralSet

use of org.kie.workbench.common.stunner.bpmn.definition.property.general.BPMNGeneralSet 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)

Example 43 with BPMNGeneralSet

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

the class BPMNDiagramMarshallerTest method testUnmarshallIsInterruptingStartErrorEvent.

@Test
public void testUnmarshallIsInterruptingStartErrorEvent() throws Exception {
    Diagram<Graph, Metadata> diagram = unmarshall(BPMN_EVENT_SUBPROCESS_STARTERROREVENT);
    assertDiagram(diagram, 7);
    assertEquals("EventSubprocessStartErrorEvent", diagram.getMetadata().getTitle());
    // Check first start event with all FILLED properties
    Node<? extends Definition, ?> startEventNode = diagram.getGraph().getNode("9ABD5C04-C6E2-4DF3-829F-ADB283330AD6");
    StartErrorEvent startErrorEvent = (StartErrorEvent) startEventNode.getContent().getDefinition();
    BPMNGeneralSet eventGeneralSet = startErrorEvent.getGeneral();
    assertNotNull(eventGeneralSet);
    assertEquals("StartErrorEvent", eventGeneralSet.getName().getValue());
    assertEquals("Some not empty\nDocumentation\n~`!@#$%^&*()_+=-{}|[]\\:\";'<>/?.,", eventGeneralSet.getDocumentation().getValue());
    InterruptingErrorEventExecutionSet eventExecutionSet = startErrorEvent.getExecutionSet();
    assertNotNull(eventExecutionSet);
    assertNotNull(eventExecutionSet.getErrorRef());
    assertEquals("Error1", eventExecutionSet.getErrorRef().getValue());
    assertEquals(true, eventExecutionSet.getIsInterrupting().getValue());
    DataIOSet eventDataIOSet = startErrorEvent.getDataIOSet();
    AssignmentsInfo assignmentsInfo = eventDataIOSet.getAssignmentsinfo();
    assertEquals("||Var1:String||[dout]Var1->Var1", assignmentsInfo.getValue());
    // Check second start event with all EMPTY properties
    Node<? extends Definition, ?> emptyEventNode = diagram.getGraph().getNode("50B93E5E-C05D-40DD-BF48-2B6AE919763E");
    StartErrorEvent emptyErrorEvent = (StartErrorEvent) emptyEventNode.getContent().getDefinition();
    BPMNGeneralSet emptyEventGeneralSet = emptyErrorEvent.getGeneral();
    assertNotNull(emptyEventGeneralSet);
    assertEquals("", emptyEventGeneralSet.getName().getValue());
    assertEquals("", emptyEventGeneralSet.getDocumentation().getValue());
    InterruptingErrorEventExecutionSet emptyExecutionSet = emptyErrorEvent.getExecutionSet();
    assertNotNull(emptyExecutionSet);
    assertNotNull(emptyExecutionSet.getErrorRef());
    assertEquals("", emptyExecutionSet.getErrorRef().getValue());
    assertEquals(false, emptyExecutionSet.getIsInterrupting().getValue());
    DataIOSet emptyDataIOSet = emptyErrorEvent.getDataIOSet();
    AssignmentsInfo emptyAssignmentsInfo = emptyDataIOSet.getAssignmentsinfo();
    assertEquals("", emptyAssignmentsInfo.getValue());
}
Also used : DataIOSet(org.kie.workbench.common.stunner.bpmn.definition.property.dataio.DataIOSet) Graph(org.kie.workbench.common.stunner.core.graph.Graph) InterruptingErrorEventExecutionSet(org.kie.workbench.common.stunner.bpmn.definition.property.event.error.InterruptingErrorEventExecutionSet) AssignmentsInfo(org.kie.workbench.common.stunner.bpmn.definition.property.dataio.AssignmentsInfo) Metadata(org.kie.workbench.common.stunner.core.diagram.Metadata) BPMNGeneralSet(org.kie.workbench.common.stunner.bpmn.definition.property.general.BPMNGeneralSet) StartErrorEvent(org.kie.workbench.common.stunner.bpmn.definition.StartErrorEvent) Test(org.junit.Test)

Example 44 with BPMNGeneralSet

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

the class BPMNDiagramMarshallerTest method testUnmarshallIsInterruptingStartSignalEvent.

@Test
public void testUnmarshallIsInterruptingStartSignalEvent() throws Exception {
    Diagram<Graph, Metadata> diagram = unmarshall(BPMN_EVENT_SUBPROCESS_STARTSIGNALEVENT);
    assertDiagram(diagram, 7);
    assertEquals("EventSubprocessStartSignalEvent", diagram.getMetadata().getTitle());
    // Check first start event with all FILLED properties
    Node<? extends Definition, ?> startEventNode = diagram.getGraph().getNode("_B6B3A062-F04A-4E45-A08B-C1F0971C3DF9");
    StartSignalEvent startSignalEvent = (StartSignalEvent) startEventNode.getContent().getDefinition();
    BPMNGeneralSet eventGeneralSet = startSignalEvent.getGeneral();
    assertNotNull(eventGeneralSet);
    assertEquals("StartSignalEvent", eventGeneralSet.getName().getValue());
    assertEquals("Some not empty\nDocumentation\n~`!@#$%^&*()_+=-{}|[]\\:\";'<>/?.,", eventGeneralSet.getDocumentation().getValue());
    InterruptingSignalEventExecutionSet eventExecutionSet = startSignalEvent.getExecutionSet();
    assertNotNull(eventExecutionSet);
    assertNotNull(eventExecutionSet.getSignalRef());
    assertEquals("Signal1", eventExecutionSet.getSignalRef().getValue());
    assertEquals(true, eventExecutionSet.getIsInterrupting().getValue());
    DataIOSet eventDataIOSet = startSignalEvent.getDataIOSet();
    AssignmentsInfo assignmentsInfo = eventDataIOSet.getAssignmentsinfo();
    assertEquals("||Var1:String||[dout]Var1->Var1", assignmentsInfo.getValue());
    // Check second start event with all EMPTY properties
    Node<? extends Definition, ?> emptyEventNode = diagram.getGraph().getNode("_A8B9513C-D237-4BDA-B7BC-7C79F7D12BB5");
    StartSignalEvent emptySignalEvent = (StartSignalEvent) emptyEventNode.getContent().getDefinition();
    BPMNGeneralSet emptyEventGeneralSet = emptySignalEvent.getGeneral();
    assertNotNull(emptyEventGeneralSet);
    assertEquals("", emptyEventGeneralSet.getName().getValue());
    assertEquals("", emptyEventGeneralSet.getDocumentation().getValue());
    InterruptingSignalEventExecutionSet emptyExecutionSet = emptySignalEvent.getExecutionSet();
    assertNotNull(emptyExecutionSet);
    assertNotNull(emptyExecutionSet.getSignalRef());
    assertEquals("", emptyExecutionSet.getSignalRef().getValue());
    assertEquals(false, emptyExecutionSet.getIsInterrupting().getValue());
    DataIOSet emptyDataIOSet = emptySignalEvent.getDataIOSet();
    AssignmentsInfo emptyAssignmentsInfo = emptyDataIOSet.getAssignmentsinfo();
    assertEquals("", emptyAssignmentsInfo.getValue());
}
Also used : DataIOSet(org.kie.workbench.common.stunner.bpmn.definition.property.dataio.DataIOSet) StartSignalEvent(org.kie.workbench.common.stunner.bpmn.definition.StartSignalEvent) Graph(org.kie.workbench.common.stunner.core.graph.Graph) AssignmentsInfo(org.kie.workbench.common.stunner.bpmn.definition.property.dataio.AssignmentsInfo) Metadata(org.kie.workbench.common.stunner.core.diagram.Metadata) BPMNGeneralSet(org.kie.workbench.common.stunner.bpmn.definition.property.general.BPMNGeneralSet) InterruptingSignalEventExecutionSet(org.kie.workbench.common.stunner.bpmn.definition.property.event.signal.InterruptingSignalEventExecutionSet) Test(org.junit.Test)

Example 45 with BPMNGeneralSet

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

the class StartNoneEventTest method testBPMNGeneralSetNameEmpty.

@Test
public void testBPMNGeneralSetNameEmpty() {
    BPMNGeneralSet bpmnGeneralSet = new BPMNGeneralSet();
    bpmnGeneralSet.setName(new Name(""));
    Set<ConstraintViolation<BPMNGeneralSet>> violations = this.validator.validate(bpmnGeneralSet);
    assertTrue(violations.isEmpty());
}
Also used : ConstraintViolation(javax.validation.ConstraintViolation) BPMNGeneralSet(org.kie.workbench.common.stunner.bpmn.definition.property.general.BPMNGeneralSet) Name(org.kie.workbench.common.stunner.bpmn.definition.property.general.Name) Test(org.junit.Test)

Aggregations

BPMNGeneralSet (org.kie.workbench.common.stunner.bpmn.definition.property.general.BPMNGeneralSet)61 View (org.kie.workbench.common.stunner.core.graph.content.view.View)29 Name (org.kie.workbench.common.stunner.bpmn.definition.property.general.Name)28 Documentation (org.kie.workbench.common.stunner.bpmn.definition.property.general.Documentation)25 Edge (org.kie.workbench.common.stunner.core.graph.Edge)24 EventPropertyReader (org.kie.workbench.common.stunner.bpmn.backend.converters.tostunner.properties.EventPropertyReader)16 DataIOSet (org.kie.workbench.common.stunner.bpmn.definition.property.dataio.DataIOSet)15 Test (org.junit.Test)11 CatchEventPropertyWriter (org.kie.workbench.common.stunner.bpmn.backend.converters.fromstunner.properties.CatchEventPropertyWriter)9 Metadata (org.kie.workbench.common.stunner.core.diagram.Metadata)9 Graph (org.kie.workbench.common.stunner.core.graph.Graph)9 CatchEventPropertyReader (org.kie.workbench.common.stunner.bpmn.backend.converters.tostunner.properties.CatchEventPropertyReader)8 ProcessData (org.kie.workbench.common.stunner.bpmn.definition.property.variables.ProcessData)8 ThrowEventPropertyWriter (org.kie.workbench.common.stunner.bpmn.backend.converters.fromstunner.properties.ThrowEventPropertyWriter)7 ThrowEventPropertyReader (org.kie.workbench.common.stunner.bpmn.backend.converters.tostunner.properties.ThrowEventPropertyReader)7 EndEvent (org.eclipse.bpmn2.EndEvent)5 StartEvent (org.eclipse.bpmn2.StartEvent)5 BaseEndEvent (org.kie.workbench.common.stunner.bpmn.definition.BaseEndEvent)5 BaseStartEvent (org.kie.workbench.common.stunner.bpmn.definition.BaseStartEvent)5 IsInterrupting (org.kie.workbench.common.stunner.bpmn.definition.property.event.IsInterrupting)5