use of org.kie.workbench.common.stunner.bpmn.definition.BPMNDiagramImpl in project kie-wb-common by kiegroup.
the class ProcessVariableProviderTest method mockRootNode.
private Element mockRootNode(String processVariables) {
BPMNDiagramImpl rootNode = new BPMNDiagramImpl();
rootNode.setProcessData(new ProcessData(new ProcessVariables(processVariables)));
return mockNode(rootNode);
}
use of org.kie.workbench.common.stunner.bpmn.definition.BPMNDiagramImpl 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.bpmn.definition.BPMNDiagramImpl in project kie-wb-common by kiegroup.
the class BPMNDiagramMarshallerTest method testUnmarshallProcessProperties.
@Test
@SuppressWarnings("unchecked")
public void testUnmarshallProcessProperties() throws Exception {
Diagram<Graph, Metadata> diagram = unmarshall(BPMN_PROCESSPROPERTIES);
assertDiagram(diagram, 4);
assertEquals("BPSimple", diagram.getMetadata().getTitle());
DiagramSet diagramProperties = 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;
diagramProperties = bpmnDiagram.getDiagramSet();
break;
}
}
}
assertEquals("BPSimple", diagramProperties.getName().getValue());
assertEquals("This is a\n" + "simple\n" + "process", diagramProperties.getDocumentation().getValue());
assertEquals("JDLProj.BPSimple", diagramProperties.getId().getValue());
assertEquals("org.jbpm", diagramProperties.getPackageProperty().getValue());
assertEquals(Boolean.valueOf(true), diagramProperties.getExecutable().getValue());
assertEquals(Boolean.valueOf(true), diagramProperties.getAdHoc().getValue());
assertEquals("This is the\n" + "Process\n" + "Instance\n" + "Description", diagramProperties.getProcessInstanceDescription().getValue());
}
use of org.kie.workbench.common.stunner.bpmn.definition.BPMNDiagramImpl in project kie-wb-common by kiegroup.
the class BPMNDiagramTest method testNameInvalid.
@Test
public void testNameInvalid() {
BPMNDiagramImpl BPMNDiagramImpl = createValidBpmnDiagram();
BPMNDiagramImpl.getDiagramSet().setName(new Name(NAME_INVALID));
Set<ConstraintViolation<BPMNDiagramImpl>> violations = this.validator.validate(BPMNDiagramImpl);
assertEquals(1, violations.size());
}
use of org.kie.workbench.common.stunner.bpmn.definition.BPMNDiagramImpl in project kie-wb-common by kiegroup.
the class BPMNDiagramTest method createValidBpmnDiagram.
public BPMNDiagramImpl createValidBpmnDiagram() {
BPMNDiagramImpl BPMNDiagramImpl = new BPMNDiagramImpl.BPMNDiagramBuilder().build();
DiagramSet diagramSet = BPMNDiagramImpl.getDiagramSet();
diagramSet.setName(new Name(NAME_VALID));
diagramSet.setId(new Id(ID_VALID));
diagramSet.setPackageProperty(new Package(PACKAGE_VALID));
diagramSet.setVersion(new Version(VERSION_VALID));
return BPMNDiagramImpl;
}
Aggregations