use of org.kie.workbench.common.stunner.core.client.canvas.controls.clipboard.LocalClipboardControl in project kie-wb-common by kiegroup.
the class CopySelectionSessionCommandTest method setUp.
@Before
public void setUp() throws Exception {
eventArgumentCaptor = ArgumentCaptor.forClass(CopySelectionSessionCommandExecutedEvent.class);
clipboardControl = spy(new LocalClipboardControl());
super.setup();
TestingGraphMockHandler graphMockHandler = new TestingGraphMockHandler();
this.graphInstance = TestingGraphInstanceBuilder.newGraph2(graphMockHandler);
this.copySelectionSessionCommand = getCommand();
node = graphInstance.startNode;
when(session.getSelectionControl()).thenReturn(selectionControl);
when(selectionControl.getSelectedItems()).thenReturn(Arrays.asList(node.getUUID()));
when(session.getCanvasHandler()).thenReturn(canvasHandler);
when(canvasHandler.getGraphIndex()).thenReturn(graphMockHandler.graphIndex);
when(session.getClipboardControl()).thenReturn(clipboardControl);
}
use of org.kie.workbench.common.stunner.core.client.canvas.controls.clipboard.LocalClipboardControl in project kie-wb-common by kiegroup.
the class PasteSelectionSessionCommandTest method setUp.
@Before
@SuppressWarnings("unchecked")
public void setUp() throws Exception {
clipboardControl = spy(new LocalClipboardControl());
TestingGraphMockHandler graphMockHandler = new TestingGraphMockHandler();
this.graphInstance = TestingGraphInstanceBuilder.newGraph2(graphMockHandler);
node = graphInstance.startNode;
node.setContent(view);
node2 = graphInstance.intermNode;
node2.setContent(view);
when(session.getCanvasHandler()).thenReturn(canvasHandler);
when(canvasHandler.getGraphIndex()).thenReturn(graphMockHandler.graphIndex);
when(view.getBounds()).thenReturn(new BoundsImpl(new BoundImpl(X, Y), new BoundImpl(X + NODE_SIZE, Y + NODE_SIZE)));
when(canvasHandler.getDiagram()).thenReturn(diagram);
when(diagram.getMetadata()).thenReturn(metadata);
when(metadata.getCanvasRootUUID()).thenReturn(CANVAS_UUID);
when(sessionCommandManager.execute(eq(canvasHandler), any())).thenReturn(commandResult);
when(sessionCommandManager.execute(canvasHandler, cloneConnectorCommand)).thenReturn(commandResultConnector);
when(commandResult.getType()).thenReturn(CommandResult.Type.INFO);
when(commandResultConnector.getType()).thenReturn(CommandResult.Type.INFO);
when(clone.getUUID()).thenReturn(CLONE_UUID);
when(clone2.getUUID()).thenReturn(CLONE2_UUID);
when(session.getClipboardControl()).thenReturn(clipboardControl);
when(sessionCommandFactory.newCopySelectionCommand()).thenReturn(copySelectionSessionCommand);
when(sessionCommandManager.getRegistry()).thenReturn(commandRegistry);
cloneMap = new HashMap() {
{
put(node, clone);
put(node2, clone2);
}
};
super.setup();
this.pasteSelectionSessionCommand = getCommand();
}
Aggregations