use of org.kie.workbench.common.stunner.core.client.components.toolbox.Toolbox in project kie-wb-common by kiegroup.
the class FlowActionsToolboxFactoryTest method testBuildToolbox.
@Test
@SuppressWarnings("unchecked")
public void testBuildToolbox() {
final Optional<Toolbox<?>> toolbox = tested.build(canvasHandler, element);
assertTrue(toolbox.isPresent());
assertTrue(toolbox.get() instanceof ActionsToolbox);
final ActionsToolbox actionsToolbox = (ActionsToolbox) toolbox.get();
assertEquals(E_UUID, actionsToolbox.getElementUUID());
assertEquals(2, actionsToolbox.size());
final Iterator actionIt = actionsToolbox.iterator();
assertEquals(createConnectorAction, actionIt.next());
assertEquals(createNodeAction, actionIt.next());
verify(createConnectorAction, times(1)).setEdgeId(eq(EDGE_ID));
verify(createNodeAction, times(1)).setEdgeId(eq(EDGE_ID));
verify(createNodeAction, times(1)).setNodeId(eq(NODE_ID));
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.client.components.toolbox.Toolbox in project kie-wb-common by kiegroup.
the class DMNCommonActionsToolboxFactoryTest method testBuildToolboxForNoDecisionType.
@Test
@SuppressWarnings("unchecked")
public void testBuildToolboxForNoDecisionType() {
final Optional<Toolbox<?>> _toolbox = tested.build(canvasHandler, element);
assertTrue(_toolbox.isPresent());
Toolbox<?> toolbox = _toolbox.get();
assertTrue(toolbox instanceof ActionsToolbox);
final ActionsToolbox actionsToolbox = (ActionsToolbox) toolbox;
assertEquals(E_UUID, actionsToolbox.getElementUUID());
assertEquals(1, actionsToolbox.size());
assertEquals(deleteNodeAction, actionsToolbox.iterator().next());
verify(view, times(1)).init(eq(actionsToolbox));
verify(view, times(1)).addButton(any(Glyph.class), anyString(), any(Consumer.class));
}
use of org.kie.workbench.common.stunner.core.client.components.toolbox.Toolbox in project kie-wb-common by kiegroup.
the class DMNCommonActionsToolboxFactoryTest method testBuildToolboxForBusinessKnowledgeModelType.
@Test
@SuppressWarnings("unchecked")
public void testBuildToolboxForBusinessKnowledgeModelType() {
final Node<View<BusinessKnowledgeModel>, Edge> bkmNode = new NodeImpl<>("bkmNode1");
final BusinessKnowledgeModel bkm = new BusinessKnowledgeModel();
final Bounds bounds = new BoundsImpl(new BoundImpl(0d, 0d), new BoundImpl(100d, 150d));
final View<BusinessKnowledgeModel> nodeContent = new ViewImpl<>(bkm, bounds);
bkmNode.setContent(nodeContent);
final Optional<Toolbox<?>> _toolbox = tested.build(canvasHandler, bkmNode);
assertTrue(_toolbox.isPresent());
Toolbox<?> toolbox = _toolbox.get();
assertTrue(toolbox instanceof ActionsToolbox);
final ActionsToolbox actionsToolbox = (ActionsToolbox) toolbox;
assertEquals("bkmNode1", actionsToolbox.getElementUUID());
assertEquals(2, actionsToolbox.size());
final Iterator<ToolboxAction> actionsIt = actionsToolbox.iterator();
assertEquals(deleteNodeAction, actionsIt.next());
assertEquals(editBusinessKnowledgeModelToolboxAction, 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.client.components.toolbox.Toolbox 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.client.components.toolbox.Toolbox in project kie-wb-common by kiegroup.
the class DMNFlowActionsToolboxFactoryTest method testBuildToolbox.
@Test
@SuppressWarnings("unchecked")
public void testBuildToolbox() {
final Optional<Toolbox<?>> toolbox = tested.build(canvasHandler, element);
assertTrue(toolbox.isPresent());
assertTrue(toolbox.get() instanceof ActionsToolbox);
final ActionsToolbox actionsToolbox = (ActionsToolbox) toolbox.get();
assertEquals(E_UUID, actionsToolbox.getElementUUID());
assertEquals(2, actionsToolbox.size());
final Iterator actionIt = actionsToolbox.iterator();
assertEquals(createConnectorAction, actionIt.next());
assertEquals(createNodeAction, actionIt.next());
verify(createConnectorAction, times(1)).setEdgeId(eq(EDGE_ID));
verify(createNodeAction, times(1)).setEdgeId(eq(EDGE_ID));
verify(createNodeAction, times(1)).setNodeId(eq(NODE_ID));
verify(view, times(1)).init(eq(actionsToolbox));
verify(view, times(2)).addButton(any(Glyph.class), anyString(), any(Consumer.class));
}
Aggregations