use of org.kie.workbench.common.stunner.core.graph.Element in project kie-wb-common by kiegroup.
the class ProcessVariableProviderTest method testGetSelectorDataWithNoValues.
@Override
public void testGetSelectorDataWithNoValues() {
List<Element> nodes = new ArrayList<>();
nodes.add(mockRootNodeWithoutProcessVariables());
when(graph.nodes()).thenReturn(nodes);
when(graph.getNode(eq(ROOT_NODE_UUID))).thenReturn((Node) nodes.get(0));
SelectorData selectorData = provider.getSelectorData(renderingContext);
Map values = selectorData.getValues();
assertTrue(values.isEmpty());
}
use of org.kie.workbench.common.stunner.core.graph.Element in project kie-wb-common by kiegroup.
the class BPMNDiagramMarshallerTest method testUnmarshallUserTaskAssignees.
@Test
@SuppressWarnings("unchecked")
public void testUnmarshallUserTaskAssignees() throws Exception {
Diagram<Graph, Metadata> diagram = unmarshall(BPMN_USERTASKASSIGNEES);
assertDiagram(diagram, 6);
assertEquals("UserGroups", diagram.getMetadata().getTitle());
UserTaskExecutionSet executionSet = 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 UserTask) {
UserTask userTask = (UserTask) oDefinition;
executionSet = userTask.getExecutionSet();
break;
}
}
}
assertEquals("user,user1", executionSet.getActors().getValue());
assertEquals("admin,kiemgmt", executionSet.getGroupid().getValue());
}
use of org.kie.workbench.common.stunner.core.graph.Element in project kie-wb-common by kiegroup.
the class BPMNDiagramMarshallerTest method testUnmarshallProcessVariables.
@Test
@SuppressWarnings("unchecked")
public void testUnmarshallProcessVariables() throws Exception {
Diagram<Graph, Metadata> diagram = unmarshall(BPMN_PROCESSVARIABLES);
assertDiagram(diagram, 8);
assertEquals("ProcessVariables", diagram.getMetadata().getTitle());
ProcessVariables variables = 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 BPMNDiagram) {
BPMNDiagramImpl bpmnDiagram = (BPMNDiagramImpl) oDefinition;
variables = bpmnDiagram.getProcessData().getProcessVariables();
break;
}
}
}
assertEquals(variables.getValue(), "employee:java.lang.String,reason:java.lang.String,performance:java.lang.String");
Node<? extends Definition, ?> diagramNode = diagram.getGraph().getNode("_luRBMdEjEeWXpsZ1tNStKQ");
assertTrue(diagramNode.getContent().getDefinition() instanceof BPMNDiagram);
BPMNDiagramImpl bpmnDiagram = (BPMNDiagramImpl) diagramNode.getContent().getDefinition();
assertTrue(bpmnDiagram.getProcessData() != null);
assertTrue(bpmnDiagram.getProcessData().getProcessVariables() != null);
variables = bpmnDiagram.getProcessData().getProcessVariables();
assertEquals(variables.getValue(), "employee:java.lang.String,reason:java.lang.String,performance:java.lang.String");
}
use of org.kie.workbench.common.stunner.core.graph.Element in project kie-wb-common by kiegroup.
the class BPMNDiagramMarshallerTest method testUnmarshallReusableSubprocess.
@Test
public void testUnmarshallReusableSubprocess() throws Exception {
Diagram<Graph, Metadata> diagram = unmarshall(BPMN_REUSABLE_SUBPROCESS);
ReusableSubprocess reusableSubprocess = 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 ReusableSubprocess) {
reusableSubprocess = (ReusableSubprocess) oDefinition;
break;
}
}
}
assertNotNull(reusableSubprocess);
assertNotNull(reusableSubprocess.getExecutionSet());
assertNotNull(reusableSubprocess.getExecutionSet().getCalledElement());
assertNotNull(reusableSubprocess.getGeneral());
BPMNGeneralSet generalSet = reusableSubprocess.getGeneral();
ReusableSubprocessTaskExecutionSet executionSet = reusableSubprocess.getExecutionSet();
assertNotNull(generalSet);
assertNotNull(executionSet);
assertEquals("my subprocess", generalSet.getName().getValue());
assertEquals("my-called-element", executionSet.getCalledElement().getValue());
assertEquals(false, executionSet.getIndependent().getValue());
assertEquals(false, executionSet.getWaitForCompletion().getValue());
String assignmentsInfo = reusableSubprocess.getDataIOSet().getAssignmentsinfo().getValue();
assertEquals("|input1:String,input2:Float||output1:String,output2:Float|[din]pv1->input1,[din]pv2->input2,[dout]output1->pv1,[dout]output2->pv2", assignmentsInfo);
assertEquals("true", reusableSubprocess.getExecutionSet().getIsAsync().getValue().toString());
}
use of org.kie.workbench.common.stunner.core.graph.Element 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());
}
Aggregations