use of org.kie.workbench.common.stunner.core.diagram.Diagram in project kie-wb-common by kiegroup.
the class BPMNDirectDiagramMarshallerTest method testMarshallEvaluationTwice.
@Test
public void testMarshallEvaluationTwice() throws Exception {
Diagram diagram = unmarshall(BPMN_EVALUATION);
String result = tested.marshall(diagram);
assertDiagram(result, 1, 7, 7);
Diagram diagram2 = unmarshall(BPMN_EVALUATION);
String result2 = tested.marshall(diagram2);
assertDiagram(result2, 1, 7, 7);
}
use of org.kie.workbench.common.stunner.core.diagram.Diagram in project kie-wb-common by kiegroup.
the class DMNGraphUtilsTest method testGetDefinitionsWithDiagram.
@Test
public void testGetDefinitionsWithDiagram() {
final Definitions expectedDefinitions = mock(Definitions.class);
final Diagram diagram = mock(Diagram.class);
when(dmnDiagramUtils.getDefinitions(diagram)).thenReturn(expectedDefinitions);
final Definitions actualDefinitions = utils.getDefinitions(diagram);
assertNotNull(actualDefinitions);
assertEquals(expectedDefinitions, actualDefinitions);
}
use of org.kie.workbench.common.stunner.core.diagram.Diagram in project kie-wb-common by kiegroup.
the class ProjectDiagramServiceControllerTest method testGetDiagramByPathWhenStunnerSVGFileExists.
@Test
public void testGetDiagramByPathWhenStunnerSVGFileExists() throws IOException {
final Path path = mockGetDiagramByPathObjects();
final Path expectedSVGPath = prepareSVGFile(path, DIAGRAM_SVG);
prepareLoadDiagramByPath(path);
final Diagram result = diagramService.getDiagramByPath(path);
assertEquals(diagram, result);
verifyExpectedResult(path, result, expectedSVGPath, ProjectMetadata.SVGGenerator.STUNNER);
}
use of org.kie.workbench.common.stunner.core.diagram.Diagram in project kie-wb-common by kiegroup.
the class ProjectValidationServiceImplTest method setUp.
@Before
@SuppressWarnings("unchecked")
public void setUp() {
domainViolationList = Arrays.asList(domainViolation, domainViolation2, domainViolation3, domainViolation4, domainViolationNull, domainViolationNullStr);
domainValidator = new DomainValidator() {
@Override
public String getDefinitionSetId() {
return DEF_SET_ID;
}
@Override
public void validate(Diagram entity, Consumer<Collection<DomainViolation>> resultConsumer) {
resultConsumer.accept(domainViolationList);
}
};
when(diagram.getMetadata()).thenReturn(metadata);
when(metadata.getDefinitionSetId()).thenReturn(DEF_SET_ID);
when(diagram.getGraph()).thenReturn(graph);
when(graph.getUUID()).thenReturn(GRAPH_UUID);
mockViolations(domainViolationList);
validationService = new ProjectValidationServiceImpl(new MockInstanceImpl(domainValidator));
}
use of org.kie.workbench.common.stunner.core.diagram.Diagram in project kie-wb-common by kiegroup.
the class CaseManagementDrawCommand method execute.
@Override
@SuppressWarnings("unchecked")
public CommandResult<CanvasViolation> execute(final AbstractCanvasHandler context) {
final Diagram diagram = context.getDiagram();
final String shapeSetId = context.getDiagram().getMetadata().getShapeSetId();
childrenTraverseProcessor.traverse(diagram.getGraph(), new AbstractChildrenTraverseCallback<Node<View, Edge>, Edge<Child, Node>>() {
@Override
public void startNodeTraversal(final Node<View, Edge> node) {
super.startNodeTraversal(node);
addNode(node);
}
@Override
public boolean startNodeTraversal(final List<Node<View, Edge>> parents, final Node<View, Edge> node) {
super.startNodeTraversal(parents, node);
addNode(node);
context.addChild(parents.get(parents.size() - 1), node);
return true;
}
private void addNode(final Node<View, Edge> node) {
context.register(shapeSetId, node);
context.applyElementMutation(node, MutationContext.STATIC);
}
@Override
public void endGraphTraversal() {
super.endGraphTraversal();
context.getCanvas().draw();
}
});
return buildResult();
}
Aggregations