use of org.kie.workbench.common.stunner.core.graph.content.Bounds in project kie-wb-common by kiegroup.
the class AbstractGraphCommandTest method mockView.
public static View mockView(final double x, final double y, final double w, final double h) {
View view = mock(View.class);
Bounds bounds = mockBounds(x, y, w, h);
when(view.getBounds()).thenReturn(bounds);
return view;
}
use of org.kie.workbench.common.stunner.core.graph.content.Bounds in project kie-wb-common by kiegroup.
the class AbstractGraphCommandTest method init.
@SuppressWarnings("unchecked")
public void init(final double width, final double height) {
MockitoAnnotations.initMocks(this);
Bounds bounds = mockBounds(0, 0, width, height);
when(graphContent.getBounds()).thenReturn(bounds);
when(graph.getUUID()).thenReturn(GRAPH_UUID);
when(graph.getContent()).thenReturn(graphContent);
when(graph.nodes()).thenReturn(graphNodes);
when(definitionManager.adapters()).thenReturn(adapterManager);
when(adapterManager.registry()).thenReturn(adapterRegistry);
when(adapterManager.forDefinition()).thenReturn(definitionAdapter);
when(adapterManager.forProperty()).thenReturn(propertyAdapter);
when(adapterRegistry.getDefinitionAdapter(any(Class.class))).thenReturn(definitionAdapter);
when(adapterRegistry.getPropertyAdapter(any(Class.class))).thenReturn(propertyAdapter);
when(graphCommandExecutionContext.getDefinitionManager()).thenReturn(definitionManager);
when(graphCommandExecutionContext.getFactoryManager()).thenReturn(factoryManager);
when(graphCommandExecutionContext.getRuleManager()).thenReturn(ruleManager);
when(graphCommandExecutionContext.getGraphIndex()).thenReturn(graphIndex);
when(graphCommandExecutionContext.getRuleSet()).thenReturn(ruleSet);
when(graphIndex.getGraph()).thenReturn(graph);
when(ruleManager.evaluate(any(RuleSet.class), any(RuleEvaluationContext.class))).thenReturn(EMPTY_VIOLATIONS);
}
use of org.kie.workbench.common.stunner.core.graph.content.Bounds in project kie-wb-common by kiegroup.
the class DMNCommonActionsToolboxFactoryTest method testBuildToolboxForDecisionType.
@Test
@SuppressWarnings("unchecked")
public void testBuildToolboxForDecisionType() {
final Node<View<Decision>, Edge> decisionNode = new NodeImpl<>("decisionNode1");
final Decision decision = new Decision();
final Bounds bounds = new BoundsImpl(new BoundImpl(0d, 0d), new BoundImpl(100d, 150d));
final View<Decision> nodeContent = new ViewImpl<>(decision, bounds);
decisionNode.setContent(nodeContent);
final Optional<Toolbox<?>> _toolbox = tested.build(canvasHandler, decisionNode);
assertTrue(_toolbox.isPresent());
Toolbox<?> toolbox = _toolbox.get();
assertTrue(toolbox instanceof ActionsToolbox);
final ActionsToolbox actionsToolbox = (ActionsToolbox) toolbox;
assertEquals("decisionNode1", actionsToolbox.getElementUUID());
assertEquals(2, actionsToolbox.size());
final Iterator<ToolboxAction> actionsIt = actionsToolbox.iterator();
assertEquals(deleteNodeAction, actionsIt.next());
assertEquals(editDecisionToolboxAction, actionsIt.next());
assertFalse(actionsIt.hasNext());
verify(view, times(1)).init(eq(actionsToolbox));
verify(view, times(2)).addButton(any(Glyph.class), anyString(), any(Consumer.class));
}
use of org.kie.workbench.common.stunner.core.graph.content.Bounds in project kie-wb-common by kiegroup.
the class DMNEditDecisionToolboxActionTest method setup.
@Before
public void setup() throws Exception {
decisionNode = new NodeImpl<>(E_UUID);
decision = new Decision();
final Bounds bounds = new BoundsImpl(new BoundImpl(0d, 0d), new BoundImpl(100d, 150d));
final View<Decision> nodeContent = new ViewImpl<>(decision, bounds);
decisionNode.setContent(nodeContent);
when(canvasHandler.getGraphIndex()).thenReturn(graphIndex);
when(graphIndex.get(eq(E_UUID))).thenReturn(decisionNode);
when(sessionManager.getCurrentSession()).thenReturn(session);
this.tested = new DMNEditDecisionToolboxAction(sessionManager, translationService, editExpressionEvent);
}
Aggregations