use of org.kie.workbench.common.stunner.core.TestingGraphMockHandler in project kie-wb-common by kiegroup.
the class SafeDeleteNodeProcessorTest method setup.
@Before
public void setup() throws Exception {
this.graphTestHandler = new TestingGraphMockHandler();
this.graphTestHandlerContainer = new TestingGraphMockHandler();
this.graphHolder = TestingGraphInstanceBuilder.newGraph2(graphTestHandler);
this.graphHolderContainer = TestingGraphInstanceBuilder.newGraph3(graphTestHandlerContainer);
}
use of org.kie.workbench.common.stunner.core.TestingGraphMockHandler in project kie-wb-common by kiegroup.
the class BPMNProcessVariableDeleteHandlerTest method setUp.
@Before
public void setUp() throws Exception {
assignmentsInfoString = PROPERTY_ID_INPUT + "," + PROPERTY_ID_OUTPUT;
bpmnProcessVariableDeleteHandler = new BPMNProcessVariableDeleteHandler();
this.graphTestHandler = new TestingGraphMockHandler();
graphInstance = TestingGraphInstanceBuilder.newGraph2(graphTestHandler);
when(userTask.getExecutionSet()).thenReturn(userTaskExecutionSet);
when(userTask.getExecutionSet().getAssignmentsinfo()).thenReturn(assignmentsInfo);
when(userTask.getExecutionSet().getAssignmentsinfo().getValue()).thenReturn(assignmentsInfoString);
when(businessRuleTask.getDataIOSet()).thenReturn(businessRuleDataIOSet);
when(businessRuleTask.getDataIOSet().getAssignmentsinfo()).thenReturn(assignmentsInfo);
when(businessRuleTask.getDataIOSet().getAssignmentsinfo().getValue()).thenReturn(assignmentsInfoString);
graphInstance.intermNode.setContent(definition);
}
use of org.kie.workbench.common.stunner.core.TestingGraphMockHandler in project kie-wb-common by kiegroup.
the class CanvasLayoutUtilsTest method getNextOutOfCanvas.
// TODO (AlessioP & Roger):
@Test
@Ignore
@SuppressWarnings("unchecked")
public void getNextOutOfCanvas() {
when(ruleManager.evaluate(eq(ruleSet), any(RuleEvaluationContext.class))).thenReturn(ruleViolations);
when(ruleViolations.violations(Violation.Type.ERROR)).thenReturn(ruleViolationIterable);
when(ruleViolations.violations(Violation.Type.ERROR).iterator()).thenReturn(ruleViolationIterator);
when(ruleViolations.violations(Violation.Type.ERROR).iterator().hasNext()).thenReturn(true);
this.graphTestHandler = new TestingGraphMockHandler();
graphInstance = TestingGraphInstanceBuilder.newGraph1(graphTestHandler);
Node node = mock(Node.class);
Bounds boundsNode = new BoundsImpl(new BoundImpl(100d, 0d), new BoundImpl(300d, 1400d));
View viewNode = mock(View.class);
when(node.getContent()).thenReturn(viewNode);
when(viewNode.getBounds()).thenReturn(boundsNode);
Node newNode = mock(Node.class);
Bounds boundsNewNode = new BoundsImpl(new BoundImpl(100d, 200d), new BoundImpl(300d, 300d));
View viewNewNode = mock(View.class);
when(newNode.getContent()).thenReturn(viewNewNode);
when(viewNewNode.getBounds()).thenReturn(boundsNewNode);
when(canvasHandler.getDiagram().getGraph()).thenReturn(graphInstance.graph);
when(graphBoundsIndexer.getAt(140.0, 0.0, 200.0, 100.0, null)).thenReturn(node);
graphInstance.startNode.getOutEdges().clear();
Point2D next = canvasLayoutUtils.getNext(canvasHandler, graphInstance.startNode, newNode);
Node<View<?>, Edge> intermNode = (Node<View<?>, Edge>) graphInstance.intermNode;
double[] size = GraphUtils.getNodeSize(intermNode.getContent());
assertTrue(next.getX() > size[0]);
assertTrue(next.getY() == CanvasLayoutUtils.getPaddingY());
}
use of org.kie.workbench.common.stunner.core.TestingGraphMockHandler 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.TestingGraphMockHandler 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