use of org.kie.workbench.common.stunner.project.diagram.impl.ProjectDiagramImpl in project kie-wb-common by kiegroup.
the class DMNDiagramUtilsTest method setup.
@Before
public void setup() {
utils = new DMNDiagramUtils();
graph = new GraphImpl<>(UUID.uuid(), new GraphNodeStoreImpl());
diagram = new ProjectDiagramImpl(NAME, graph, metadata);
graph.addNode(node);
when(node.getContent()).thenReturn(definition);
}
use of org.kie.workbench.common.stunner.project.diagram.impl.ProjectDiagramImpl in project kie-wb-common by kiegroup.
the class DMNClientProjectDiagramServiceTest method testGetMarshallerCallback.
@Test
public void testGetMarshallerCallback() {
final DMNContentResource resource = mock(DMNContentResource.class);
final Diagram diagram = mock(Diagram.class);
final Graph graph = mock(Graph.class);
final ProjectMetadata projectMetadata = mock(ProjectMetadata.class);
final String name = "name";
when(diagram.getName()).thenReturn(name);
when(diagram.getGraph()).thenReturn(graph);
when(resource.getMetadata()).thenReturn(projectMetadata);
service.getMarshallerCallback(resource, projectDiagramCallback).onSuccess(diagram);
verify(projectDiagramCallback).onSuccess(projectDiagramArgumentCaptor.capture());
final ProjectDiagramImpl projectDiagram = projectDiagramArgumentCaptor.getValue();
assertEquals(name, projectDiagram.getName());
assertEquals(graph, projectDiagram.getGraph());
assertEquals(projectMetadata, projectDiagram.getMetadata());
}
use of org.kie.workbench.common.stunner.project.diagram.impl.ProjectDiagramImpl in project kie-wb-common by kiegroup.
the class DMNClientProjectDiagramServiceTest method testAsProjectDiagramImpl.
@Test
public void testAsProjectDiagramImpl() {
final Graph graph = mock(Graph.class);
final Diagram diagram = mock(Diagram.class);
final DMNContentResource resource = mock(DMNContentResource.class);
final ProjectMetadata metadata = mock(ProjectMetadata.class);
when(diagram.getName()).thenReturn("Traffic Violation.dmn");
when(diagram.getGraph()).thenReturn(graph);
when(resource.getMetadata()).thenReturn(metadata);
final ProjectDiagramImpl projectDiagram = service.asProjectDiagramImpl(diagram, resource);
assertEquals("Traffic Violation", projectDiagram.getName());
assertEquals(graph, projectDiagram.getGraph());
assertEquals(metadata, projectDiagram.getMetadata());
}
use of org.kie.workbench.common.stunner.project.diagram.impl.ProjectDiagramImpl in project kie-wb-common by kiegroup.
the class ProjectDiagramResourceServiceImplTest method testSaveAndRename.
@Test
public void testSaveAndRename() {
final Path path = mock(Path.class);
final Metadata metadata = mock(Metadata.class);
final ProjectDiagramImpl diagram = mock(ProjectDiagramImpl.class);
final String newName = "newName";
final String comment = "comment";
service.saveAndRename(path, newName, metadata, diagram, comment);
verify(saveAndRenameService).saveAndRename(path, newName, metadata, diagram, comment);
}
use of org.kie.workbench.common.stunner.project.diagram.impl.ProjectDiagramImpl in project kie-wb-common by kiegroup.
the class ProjectDiagramResourceServiceImplTest method testSaveWhenResourceIsProjectDiagram.
@Test
public void testSaveWhenResourceIsProjectDiagram() {
final Path path = mock(Path.class);
final Metadata metadata = mock(Metadata.class);
final ProjectDiagramImpl diagram = mock(ProjectDiagramImpl.class);
final Path expectedPath = mock(Path.class);
final String comment = "comment";
when(projectDiagramService.save(path, diagram, metadata, comment)).thenReturn(expectedPath);
final Path actualPath = service.save(path, diagram, metadata, comment);
assertSame(expectedPath, actualPath);
}
Aggregations