use of org.kie.workbench.common.stunner.core.diagram.GraphsProvider in project kie-wb-common by kiegroup.
the class ContentDefinitionIdUtilsTest method testNodeBelongsToCurrentGraph.
@Test
public void testNodeBelongsToCurrentGraph() {
final String currentDiagramId = "currentDiagramId";
final Node node = createNode(currentDiagramId);
final GraphsProvider graphsProvider = createGraphsProvider(currentDiagramId);
assertTrue(belongsToCurrentGraph(node, graphsProvider));
}
use of org.kie.workbench.common.stunner.core.diagram.GraphsProvider in project kie-wb-common by kiegroup.
the class ContentDefinitionIdUtilsTest method testEdgeBelongsToCurrentGraphWhenDoesNot.
@Test
public void testEdgeBelongsToCurrentGraphWhenDoesNot() {
final String nodeDiagramId = "nodeDiagramId";
final String currentDiagramId = "currentDiagramId";
final Node node = createNode(nodeDiagramId);
final Edge edge = createEdge(node, null);
final GraphsProvider graphsProvider = createGraphsProvider(currentDiagramId);
assertFalse(belongsToCurrentGraph(edge, graphsProvider));
}
use of org.kie.workbench.common.stunner.core.diagram.GraphsProvider in project kie-wb-common by kiegroup.
the class ContentDefinitionIdUtilsTest method testNodeBelongsToCurrentGraphWhenDoesNot.
@Test
public void testNodeBelongsToCurrentGraphWhenDoesNot() {
final String nodeDiagramId = "nodeDiagramId";
final String currentDiagramId = "currentDiagramId";
final Node node = createNode(nodeDiagramId);
final GraphsProvider graphsProvider = createGraphsProvider(currentDiagramId);
assertFalse(belongsToCurrentGraph(node, graphsProvider));
}
use of org.kie.workbench.common.stunner.core.diagram.GraphsProvider in project kie-wb-common by kiegroup.
the class ContentDefinitionIdUtilsTest method createGraphsProvider.
private GraphsProvider createGraphsProvider(final String currentDiagramId) {
final GraphsProvider graphsProvider = mock(GraphsProvider.class);
when(graphsProvider.getCurrentDiagramId()).thenReturn(currentDiagramId);
return graphsProvider;
}
use of org.kie.workbench.common.stunner.core.diagram.GraphsProvider in project kie-wb-common by kiegroup.
the class DeleteNodeConfirmationImplTest method testInit.
@Test
public void testInit() {
final ClientSession session = mock(ClientSession.class);
final CanvasHandler canvasHandler = mock(CanvasHandler.class);
final Diagram diagram = mock(Diagram.class);
final Metadata metadata = mock(Metadata.class);
final String definitionId = "definitionId";
final Annotation qualifier = mock(Annotation.class);
final ManagedInstance<GraphsProvider> foundInstances = mock(ManagedInstance.class);
final GraphsProvider foundInstance = mock(GraphsProvider.class);
when(foundInstances.isUnsatisfied()).thenReturn(false);
when(foundInstances.get()).thenReturn(foundInstance);
when(graphsProviderInstances.select(GraphsProvider.class, qualifier)).thenReturn(foundInstances);
when(definitionUtils.getQualifier(definitionId)).thenReturn(qualifier);
when(metadata.getDefinitionSetId()).thenReturn(definitionId);
when(diagram.getMetadata()).thenReturn(metadata);
when(canvasHandler.getDiagram()).thenReturn(diagram);
when(session.getCanvasHandler()).thenReturn(canvasHandler);
when(sessionManager.getCurrentSession()).thenReturn(session);
confirmation.init();
final GraphsProvider actualProvider = confirmation.getGraphsProvider();
assertEquals(actualProvider, foundInstance);
}
Aggregations