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());
}
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());
}
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());
}
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());
}
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());
}
Aggregations