use of org.kie.workbench.common.stunner.core.graph.content.HasContentDefinitionId in project kie-wb-common by kiegroup.
the class DecisionNavigatorBaseItemFactoryTest method testMakeOnClickCommandWhenNodeBelongsToCurrentDiagram.
@Test
public void testMakeOnClickCommandWhenNodeBelongsToCurrentDiagram() {
final String nodeUUID = "nodeUUID";
final String nodeDiagramUUID = "diagramUUID";
final String diagramUUID = "diagramUUID";
final View content = mock(View.class);
final HasContentDefinitionId hasContentDefinitionId = mock(HasContentDefinitionId.class);
final DMNDiagramElement dmnDiagramElement = mock(DMNDiagramElement.class);
when(node.getUUID()).thenReturn(nodeUUID);
when(node.getContent()).thenReturn(content);
when(content.getDefinition()).thenReturn(hasContentDefinitionId);
when(hasContentDefinitionId.getDiagramId()).thenReturn(nodeDiagramUUID);
when(dmnDiagramsSession.getCurrentDMNDiagramElement()).thenReturn(Optional.of(dmnDiagramElement));
when(dmnDiagramElement.getId()).thenReturn(new Id(diagramUUID));
factory.makeOnClickCommand(node).execute();
verify(canvasFocusUtils).focus(nodeUUID);
verify(lazyCanvasFocusUtils, never()).lazyFocus(Mockito.<String>any());
verify(selectedEvent, never()).fire(any());
}
use of org.kie.workbench.common.stunner.core.graph.content.HasContentDefinitionId in project kie-wb-common by kiegroup.
the class DecisionNavigatorBaseItemFactoryTest method testMakeOnClickCommandWhenNodeDoesNotBelongToCurrentDiagram.
@Test
public void testMakeOnClickCommandWhenNodeDoesNotBelongToCurrentDiagram() {
final String nodeUUID = "nodeUUID";
final String nodeDiagramUUID = "otherDiagramUUID";
final String diagramUUID = "diagramUUID";
final View content = mock(View.class);
final HasContentDefinitionId hasContentDefinitionId = mock(HasContentDefinitionId.class);
final DMNDiagramElement dmnDiagramElement = mock(DMNDiagramElement.class);
final DMNDiagramElement otherDiagramElement = mock(DMNDiagramElement.class);
when(node.getUUID()).thenReturn(nodeUUID);
when(node.getContent()).thenReturn(content);
when(content.getDefinition()).thenReturn(hasContentDefinitionId);
when(hasContentDefinitionId.getDiagramId()).thenReturn(nodeDiagramUUID);
when(dmnDiagramsSession.getCurrentDMNDiagramElement()).thenReturn(Optional.of(dmnDiagramElement));
when(dmnDiagramsSession.getDMNDiagramElement(nodeDiagramUUID)).thenReturn(otherDiagramElement);
when(dmnDiagramElement.getId()).thenReturn(new Id(diagramUUID));
factory.makeOnClickCommand(node).execute();
verify(canvasFocusUtils, never()).focus(Mockito.<String>any());
verify(lazyCanvasFocusUtils).lazyFocus(nodeUUID);
verify(selectedEvent).fire(diagramSelectedArgumentCaptor.capture());
assertEquals(otherDiagramElement, diagramSelectedArgumentCaptor.getValue().getDiagramElement());
}
use of org.kie.workbench.common.stunner.core.graph.content.HasContentDefinitionId in project kie-wb-common by kiegroup.
the class DeleteNodeConfirmationImplTest method createElementMockWithContentId.
private Element createElementMockWithContentId(final String contentId) {
final Element element = mock(Element.class);
final Definition definition = mock(Definition.class);
final HasContentDefinitionId contentDefinitionId = mock(HasContentDefinitionId.class);
when(element.getContent()).thenReturn(definition);
when(definition.getDefinition()).thenReturn(contentDefinitionId);
when(contentDefinitionId.getContentDefinitionId()).thenReturn(contentId);
return element;
}
Aggregations