Search in sources :

Example 1 with ProjectDiagramImpl

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);
}
Also used : GraphNodeStoreImpl(org.kie.workbench.common.stunner.core.graph.store.GraphNodeStoreImpl) ProjectDiagramImpl(org.kie.workbench.common.stunner.project.diagram.impl.ProjectDiagramImpl) Before(org.junit.Before)

Example 2 with ProjectDiagramImpl

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());
}
Also used : Graph(org.kie.workbench.common.stunner.core.graph.Graph) ProjectMetadata(org.kie.workbench.common.stunner.project.diagram.ProjectMetadata) DMNContentResource(org.kie.workbench.common.dmn.api.DMNContentResource) ProjectDiagram(org.kie.workbench.common.stunner.project.diagram.ProjectDiagram) Diagram(org.kie.workbench.common.stunner.core.diagram.Diagram) ProjectDiagramImpl(org.kie.workbench.common.stunner.project.diagram.impl.ProjectDiagramImpl) Test(org.junit.Test)

Example 3 with ProjectDiagramImpl

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());
}
Also used : Graph(org.kie.workbench.common.stunner.core.graph.Graph) ProjectMetadata(org.kie.workbench.common.stunner.project.diagram.ProjectMetadata) ProjectDiagram(org.kie.workbench.common.stunner.project.diagram.ProjectDiagram) Diagram(org.kie.workbench.common.stunner.core.diagram.Diagram) DMNContentResource(org.kie.workbench.common.dmn.api.DMNContentResource) ProjectDiagramImpl(org.kie.workbench.common.stunner.project.diagram.impl.ProjectDiagramImpl) Test(org.junit.Test)

Example 4 with ProjectDiagramImpl

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);
}
Also used : Path(org.uberfire.backend.vfs.Path) Metadata(org.guvnor.common.services.shared.metadata.model.Metadata) ProjectDiagramImpl(org.kie.workbench.common.stunner.project.diagram.impl.ProjectDiagramImpl) Test(org.junit.Test)

Example 5 with ProjectDiagramImpl

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);
}
Also used : Path(org.uberfire.backend.vfs.Path) Metadata(org.guvnor.common.services.shared.metadata.model.Metadata) ProjectDiagramImpl(org.kie.workbench.common.stunner.project.diagram.impl.ProjectDiagramImpl) Test(org.junit.Test)

Aggregations

ProjectDiagramImpl (org.kie.workbench.common.stunner.project.diagram.impl.ProjectDiagramImpl)6 Test (org.junit.Test)4 Graph (org.kie.workbench.common.stunner.core.graph.Graph)3 ProjectMetadata (org.kie.workbench.common.stunner.project.diagram.ProjectMetadata)3 Metadata (org.guvnor.common.services.shared.metadata.model.Metadata)2 DMNContentResource (org.kie.workbench.common.dmn.api.DMNContentResource)2 Diagram (org.kie.workbench.common.stunner.core.diagram.Diagram)2 ProjectDiagram (org.kie.workbench.common.stunner.project.diagram.ProjectDiagram)2 Path (org.uberfire.backend.vfs.Path)2 Before (org.junit.Before)1 GraphNodeStoreImpl (org.kie.workbench.common.stunner.core.graph.store.GraphNodeStoreImpl)1