Search in sources :

Example 1 with SessionManager

use of org.kie.workbench.common.stunner.core.client.api.SessionManager in project kie-wb-common by kiegroup.

the class LiteralExpressionPMMLDocumentModelEditorDefinition method getEditor.

@Override
public Optional<BaseExpressionGrid<? extends Expression, ? extends GridData, ? extends BaseUIModelMapper>> getEditor(final GridCellTuple parent, final Optional<String> nodeUUID, final HasExpression hasExpression, final Optional<HasName> hasName, final boolean isOnlyVisualChangeAllowed, final int nesting) {
    return Optional.of(new LiteralExpressionPMMLGrid(parent, nodeUUID, hasExpression, hasName, getGridPanel(), getGridLayer(), makeGridData(() -> Optional.ofNullable((LiteralExpressionPMMLDocumentModel) hasExpression.getExpression())), definitionUtils, sessionManager, sessionCommandManager, canvasCommandFactory, editorSelectedEvent, refreshFormPropertiesEvent, domainObjectSelectionEvent, getCellEditorControls(), listSelector, translationService, isOnlyVisualChangeAllowed, nesting, headerEditor, readOnlyProvider) {

        @Override
        protected String getPlaceHolder() {
            return translationService.getTranslation(DMNEditorConstants.LiteralExpressionPMMLDocumentModelEditorDefinition_Placeholder);
        }

        @Override
        protected void loadValues(final Consumer<List<String>> consumer) {
            final String pmmlDocumentName = getExpressionPMMLValue(LiteralExpressionPMMLDocument.VARIABLE_DOCUMENT);
            consumer.accept(pmmlDocumentMetadataProvider.getPMMLDocumentModels(pmmlDocumentName));
        }

        @Override
        public Function<GridCellValueTuple, Command> newCellHasValueCommand() {
            return (gridCellValueTuple) -> {
                final CompositeCommand.Builder<AbstractCanvasHandler, CanvasViolation> builder = new CompositeCommand.Builder<>();
                // Command to set the PMMLDocumentModel value
                builder.addCommand(new SetCellValueCommand(gridCellValueTuple, () -> uiModelMapper, gridLayer::batch));
                // Command to set PMMLDocumentModel parameters
                getParentFunctionGrid().ifPresent(parentFunctionGrid -> {
                    final String pmmlDocumentName = getExpressionPMMLValue(LiteralExpressionPMMLDocument.VARIABLE_DOCUMENT);
                    final String pmmlDocumentModelName = StringUtils.createUnquotedString((String) gridCellValueTuple.getValue().getValue());
                    final List<String> parameters = pmmlDocumentMetadataProvider.getPMMLDocumentModelParameterNames(pmmlDocumentName, pmmlDocumentModelName);
                    parentFunctionGrid.getExpression().get().ifPresent(function -> {
                        builder.addCommand(new SetParametersCommand(function, convertParametersToInformationItems(parameters), gridLayer::batch));
                    });
                });
                return builder.build();
            };
        }

        private List<InformationItem> convertParametersToInformationItems(final List<String> parameters) {
            final List<InformationItem> informationItems = new ArrayList<>();
            parameters.forEach(parameter -> informationItems.add(new InformationItem(new Id(), new Description(), new Name(parameter), BuiltInType.ANY.asQName())));
            return informationItems;
        }
    });
}
Also used : DefinitionUtils(org.kie.workbench.common.stunner.core.util.DefinitionUtils) ListSelectorView(org.kie.workbench.common.dmn.client.widgets.grid.controls.list.ListSelectorView) BaseExpressionGrid(org.kie.workbench.common.dmn.client.widgets.grid.BaseExpressionGrid) SetCellValueCommand(org.kie.workbench.common.dmn.client.commands.general.SetCellValueCommand) AbstractCanvasHandler(org.kie.workbench.common.stunner.core.client.canvas.AbstractCanvasHandler) LiteralExpressionPMMLDocument(org.kie.workbench.common.dmn.api.definition.model.LiteralExpressionPMMLDocument) LiteralExpressionPMMLDocumentModel(org.kie.workbench.common.dmn.api.definition.model.LiteralExpressionPMMLDocumentModel) HasName(org.kie.workbench.common.dmn.api.definition.HasName) List(java.util.List) DefaultCanvasCommandFactory(org.kie.workbench.common.dmn.client.commands.factory.DefaultCanvasCommandFactory) InformationItem(org.kie.workbench.common.dmn.api.definition.model.InformationItem) BuiltInType(org.kie.workbench.common.dmn.api.property.dmn.types.BuiltInType) Optional(java.util.Optional) ApplicationScoped(javax.enterprise.context.ApplicationScoped) StringUtils(org.kie.workbench.common.stunner.core.util.StringUtils) ValueAndDataTypePopoverView(org.kie.workbench.common.dmn.client.editors.types.ValueAndDataTypePopoverView) DMNGridData(org.kie.workbench.common.dmn.client.widgets.grid.model.DMNGridData) ExpressionType(org.kie.workbench.common.dmn.client.editors.expressions.types.ExpressionType) Function(java.util.function.Function) Supplier(java.util.function.Supplier) ArrayList(java.util.ArrayList) DMNEditor(org.kie.workbench.common.dmn.api.qualifiers.DMNEditor) ExpressionEditorChanged(org.kie.workbench.common.dmn.client.widgets.grid.model.ExpressionEditorChanged) Inject(javax.inject.Inject) Id(org.kie.workbench.common.dmn.api.property.dmn.Id) RefreshFormPropertiesEvent(org.kie.workbench.common.stunner.forms.client.event.RefreshFormPropertiesEvent) SetParametersCommand(org.kie.workbench.common.dmn.client.commands.expressions.types.function.SetParametersCommand) Name(org.kie.workbench.common.dmn.api.property.dmn.Name) ReadOnlyProvider(org.kie.workbench.common.stunner.core.client.ReadOnlyProvider) HasExpression(org.kie.workbench.common.dmn.api.definition.HasExpression) GridCellTuple(org.kie.workbench.common.dmn.client.widgets.grid.model.GridCellTuple) Description(org.kie.workbench.common.dmn.api.property.dmn.Description) Command(org.kie.workbench.common.stunner.core.command.Command) SessionManager(org.kie.workbench.common.stunner.core.client.api.SessionManager) BaseUIModelMapper(org.kie.workbench.common.dmn.client.widgets.grid.model.BaseUIModelMapper) Event(javax.enterprise.event.Event) DMNEditorConstants(org.kie.workbench.common.dmn.client.resources.i18n.DMNEditorConstants) CanvasViolation(org.kie.workbench.common.stunner.core.client.command.CanvasViolation) TranslationService(org.jboss.errai.ui.client.local.spi.TranslationService) PMMLDocumentMetadataProvider(org.kie.workbench.common.dmn.client.editors.expressions.types.function.supplementary.pmml.PMMLDocumentMetadataProvider) LiteralExpressionPMMLGrid(org.kie.workbench.common.dmn.client.editors.expressions.types.function.supplementary.pmml.LiteralExpressionPMMLGrid) GridData(org.uberfire.ext.wires.core.grids.client.model.GridData) SessionCommandManager(org.kie.workbench.common.stunner.core.client.command.SessionCommandManager) Consumer(java.util.function.Consumer) DomainObjectSelectionEvent(org.kie.workbench.common.stunner.core.client.canvas.event.selection.DomainObjectSelectionEvent) GridCellValueTuple(org.kie.workbench.common.dmn.client.widgets.grid.model.GridCellValueTuple) Expression(org.kie.workbench.common.dmn.api.definition.model.Expression) BaseEditorDefinition(org.kie.workbench.common.dmn.client.editors.expressions.types.BaseEditorDefinition) CompositeCommand(org.kie.workbench.common.stunner.core.command.impl.CompositeCommand) SetParametersCommand(org.kie.workbench.common.dmn.client.commands.expressions.types.function.SetParametersCommand) CanvasViolation(org.kie.workbench.common.stunner.core.client.command.CanvasViolation) LiteralExpressionPMMLGrid(org.kie.workbench.common.dmn.client.editors.expressions.types.function.supplementary.pmml.LiteralExpressionPMMLGrid) Description(org.kie.workbench.common.dmn.api.property.dmn.Description) InformationItem(org.kie.workbench.common.dmn.api.definition.model.InformationItem) CompositeCommand(org.kie.workbench.common.stunner.core.command.impl.CompositeCommand) HasName(org.kie.workbench.common.dmn.api.definition.HasName) Name(org.kie.workbench.common.dmn.api.property.dmn.Name) LiteralExpressionPMMLDocumentModel(org.kie.workbench.common.dmn.api.definition.model.LiteralExpressionPMMLDocumentModel) Function(java.util.function.Function) AbstractCanvasHandler(org.kie.workbench.common.stunner.core.client.canvas.AbstractCanvasHandler) SetCellValueCommand(org.kie.workbench.common.dmn.client.commands.general.SetCellValueCommand) List(java.util.List) ArrayList(java.util.ArrayList) Id(org.kie.workbench.common.dmn.api.property.dmn.Id)

Example 2 with SessionManager

use of org.kie.workbench.common.stunner.core.client.api.SessionManager in project kie-wb-common by kiegroup.

the class PasteSelectionSessionCommandTest method executeWithMultiSelection.

@Test
@SuppressWarnings("unchecked")
public void executeWithMultiSelection() {
    pasteSelectionSessionCommand.bind(session);
    pasteSelectionSessionCommand.setTestEdgeFoundInCanvas(true);
    pasteSelectionSessionCommand.setTestEdgeFoundInClipboard(false);
    // Mock the callback of CloneNodeCommand
    ArgumentCaptor<Consumer> consumerNode = ArgumentCaptor.forClass(Consumer.class);
    ArgumentCaptor<Consumer> consumerNode2 = ArgumentCaptor.forClass(Consumer.class);
    when(cloneNodeCommand.getCandidate()).thenReturn(node);
    when(cloneNodeCommand2.getCandidate()).thenReturn(node2);
    when(canvasCommandFactory.cloneNode(eq(node), any(), any(), consumerNode.capture())).thenReturn(cloneNodeCommand);
    when(canvasCommandFactory.cloneNode(eq(node2), any(), any(), consumerNode2.capture())).thenReturn(cloneNodeCommand2);
    Map<Node, ArgumentCaptor<Consumer>> consumerMap = new HashMap() {

        {
            put(node, consumerNode);
            put(node2, consumerNode2);
        }
    };
    // Mock the callback of CloneConnectorCommand
    ArgumentCaptor<Consumer> consumerEdge = ArgumentCaptor.forClass(Consumer.class);
    when(canvasCommandFactory.cloneConnector(any(), Mockito.<String>any(), Mockito.<String>any(), Mockito.<String>any(), consumerEdge.capture())).thenReturn(cloneConnectorCommand);
    // apply callbacks mocks
    when(sessionCommandManager.execute(eq(canvasHandler), any())).thenAnswer(param -> {
        CompositeCommand argument = param.getArgument(1, CompositeCommand.class);
        // callback to nodes
        argument.getCommands().stream().filter(c -> c instanceof CloneNodeCommand).forEach(c -> {
            CloneNodeCommand cloneNodeCommand = (CloneNodeCommand) c;
            Node candidate = cloneNodeCommand.getCandidate();
            consumerMap.get(candidate).getValue().accept(cloneMap.get(candidate));
        });
        // callback to connectors
        argument.getCommands().stream().filter(c -> c instanceof CloneConnectorCommand).forEach(c -> consumerEdge.getValue().accept(cloneEdge));
        return commandResult;
    });
    // Executing the command
    clipboardControl.set(graphInstance.startNode, graphInstance.edge1, graphInstance.intermNode);
    when(selectionControl.getSelectedItems()).thenReturn(Arrays.asList(graphInstance.startNode.getUUID(), graphInstance.edge1.getUUID(), graphInstance.intermNode.getUUID()));
    CopySelectionSessionCommand.getInstance(sessionManager).bind(session);
    pasteSelectionSessionCommand.execute(callback);
    verify(canvasCommandFactory, times(1)).cloneNode(eq(graphInstance.startNode), eq(graphInstance.parentNode.getUUID()), eq(new Point2D(X, DEFAULT_PADDING + Y + NODE_SIZE)), any());
    verify(canvasCommandFactory, times(1)).cloneConnector(eq(graphInstance.edge1), Mockito.<String>any(), Mockito.<String>any(), Mockito.<String>any(), any());
    // check command registry update after execution to allow a single undo/redo
    verify(commandRegistry, times(2)).pop();
    ArgumentCaptor<Command> commandArgumentCaptor = ArgumentCaptor.forClass(Command.class);
    verify(commandRegistry, times(1)).register(commandArgumentCaptor.capture());
    assertTrue(commandArgumentCaptor.getValue() instanceof CompositeCommand);
    assertEquals(2, ((CompositeCommand) commandArgumentCaptor.getValue()).size());
}
Also used : Arrays(java.util.Arrays) DefinitionUtils(org.kie.workbench.common.stunner.core.util.DefinitionUtils) ArgumentMatchers.eq(org.mockito.ArgumentMatchers.eq) ManagedInstance(org.jboss.errai.ioc.client.api.ManagedInstance) Edge(org.kie.workbench.common.stunner.core.graph.Edge) AbstractCanvas(org.kie.workbench.common.stunner.core.client.canvas.AbstractCanvas) UUID(org.kie.workbench.common.stunner.core.util.UUID) DEFAULT_PADDING(org.kie.workbench.common.stunner.core.client.session.command.impl.PasteSelectionSessionCommand.DEFAULT_PADDING) CloneNodeCommand(org.kie.workbench.common.stunner.core.client.canvas.command.CloneNodeCommand) CanvasSelectionEvent(org.kie.workbench.common.stunner.core.client.canvas.event.selection.CanvasSelectionEvent) Map(java.util.Map) Diagram(org.kie.workbench.common.stunner.core.diagram.Diagram) Registry(org.appformer.client.stateControl.registry.Registry) Point2D(org.kie.workbench.common.stunner.core.graph.content.view.Point2D) CanvasCommandFactory(org.kie.workbench.common.stunner.core.client.command.CanvasCommandFactory) AbstractCanvasHandler(org.kie.workbench.common.stunner.core.client.canvas.AbstractCanvasHandler) ClientSession(org.kie.workbench.common.stunner.core.client.session.ClientSession) Metadata(org.kie.workbench.common.stunner.core.diagram.Metadata) Objects(java.util.Objects) EdgeClipboard(org.kie.workbench.common.stunner.core.client.canvas.controls.EdgeClipboard) Annotation(java.lang.annotation.Annotation) Bounds(org.kie.workbench.common.stunner.core.graph.content.Bounds) MockitoJUnitRunner(org.mockito.junit.MockitoJUnitRunner) Node(org.kie.workbench.common.stunner.core.graph.Node) Mockito.mock(org.mockito.Mockito.mock) LocalClipboardControl(org.kie.workbench.common.stunner.core.client.canvas.controls.clipboard.LocalClipboardControl) ArgumentMatchers.any(org.mockito.ArgumentMatchers.any) Connection(org.kie.workbench.common.stunner.core.graph.content.view.Connection) Mock(org.mockito.Mock) RunWith(org.junit.runner.RunWith) HashMap(java.util.HashMap) Mockito.spy(org.mockito.Mockito.spy) View(org.kie.workbench.common.stunner.core.graph.content.view.View) ArgumentCaptor(org.mockito.ArgumentCaptor) ClientSessionCommand(org.kie.workbench.common.stunner.core.client.session.command.ClientSessionCommand) Element(org.kie.workbench.common.stunner.core.graph.Element) KeyboardEvent(org.kie.workbench.common.stunner.core.client.event.keyboard.KeyboardEvent) Command(org.kie.workbench.common.stunner.core.command.Command) SessionManager(org.kie.workbench.common.stunner.core.client.api.SessionManager) CommandResult(org.kie.workbench.common.stunner.core.command.CommandResult) Before(org.junit.Before) Event(javax.enterprise.event.Event) CloneConnectorCommand(org.kie.workbench.common.stunner.core.client.canvas.command.CloneConnectorCommand) TestingGraphInstanceBuilder(org.kie.workbench.common.stunner.core.TestingGraphInstanceBuilder) Assert.assertTrue(org.junit.Assert.assertTrue) Test(org.junit.Test) Mockito.times(org.mockito.Mockito.times) Mockito.when(org.mockito.Mockito.when) ClipboardControl(org.kie.workbench.common.stunner.core.client.canvas.controls.ClipboardControl) SessionCommandManager(org.kie.workbench.common.stunner.core.client.command.SessionCommandManager) ViewConnector(org.kie.workbench.common.stunner.core.graph.content.view.ViewConnector) Mockito.verify(org.mockito.Mockito.verify) Consumer(java.util.function.Consumer) Mockito(org.mockito.Mockito) Mockito.never(org.mockito.Mockito.never) CompositeCommand(org.kie.workbench.common.stunner.core.command.impl.CompositeCommand) Collections(java.util.Collections) Mockito.reset(org.mockito.Mockito.reset) Assert.assertEquals(org.junit.Assert.assertEquals) TestingGraphMockHandler(org.kie.workbench.common.stunner.core.TestingGraphMockHandler) ArgumentCaptor(org.mockito.ArgumentCaptor) HashMap(java.util.HashMap) Node(org.kie.workbench.common.stunner.core.graph.Node) CloneNodeCommand(org.kie.workbench.common.stunner.core.client.canvas.command.CloneNodeCommand) CompositeCommand(org.kie.workbench.common.stunner.core.command.impl.CompositeCommand) CloneConnectorCommand(org.kie.workbench.common.stunner.core.client.canvas.command.CloneConnectorCommand) Consumer(java.util.function.Consumer) Point2D(org.kie.workbench.common.stunner.core.graph.content.view.Point2D) CloneNodeCommand(org.kie.workbench.common.stunner.core.client.canvas.command.CloneNodeCommand) ClientSessionCommand(org.kie.workbench.common.stunner.core.client.session.command.ClientSessionCommand) Command(org.kie.workbench.common.stunner.core.command.Command) CloneConnectorCommand(org.kie.workbench.common.stunner.core.client.canvas.command.CloneConnectorCommand) CompositeCommand(org.kie.workbench.common.stunner.core.command.impl.CompositeCommand) Test(org.junit.Test)

Example 3 with SessionManager

use of org.kie.workbench.common.stunner.core.client.api.SessionManager in project kie-wb-common by kiegroup.

the class PasteSelectionSessionCommandTest method executeWithMultiSelectionWithEdgesClipboard.

@Test
@SuppressWarnings("unchecked")
public void executeWithMultiSelectionWithEdgesClipboard() {
    final Connection sourceConnection = (Connection) ((ViewConnector) graphInstance.edge1.getContent()).getSourceConnection().orElse(null);
    final Connection targetConnection = (Connection) ((ViewConnector) graphInstance.edge1.getContent()).getTargetConnection().orElse(null);
    final EdgeClipboard clipboard = clipboardControl.buildNewEdgeClipboard(graphInstance.startNode.getUUID(), sourceConnection, graphInstance.intermNode.getUUID(), targetConnection);
    clipboardControl.set(graphInstance.startNode, graphInstance.edge1, graphInstance.intermNode);
    final Map<String, EdgeClipboard> map = new HashMap<>();
    map.put(graphInstance.edge1.getUUID(), clipboard);
    when(clipboardControl.getEdgeMap()).thenReturn(map);
    assertEquals(1, clipboardControl.getEdgeMap().size());
    pasteSelectionSessionCommand.bind(session);
    pasteSelectionSessionCommand.setTestEdgeFoundInCanvas(false);
    pasteSelectionSessionCommand.setTestEdgeFoundInClipboard(true);
    assertEquals(false, pasteSelectionSessionCommand.isEdgeFoundInCanvas(graphInstance.edge1));
    assertEquals(true, pasteSelectionSessionCommand.isEdgeFoundInClipboard(graphInstance.edge1));
    // Mock the callback of CloneNodeCommand
    ArgumentCaptor<Consumer> consumerNode = ArgumentCaptor.forClass(Consumer.class);
    ArgumentCaptor<Consumer> consumerNode2 = ArgumentCaptor.forClass(Consumer.class);
    when(cloneNodeCommand.getCandidate()).thenReturn(node);
    when(cloneNodeCommand2.getCandidate()).thenReturn(node2);
    when(canvasCommandFactory.cloneNode(eq(node), any(), any(), consumerNode.capture())).thenReturn(cloneNodeCommand);
    when(canvasCommandFactory.cloneNode(eq(node2), any(), any(), consumerNode2.capture())).thenReturn(cloneNodeCommand2);
    Map<Node, ArgumentCaptor<Consumer>> consumerMap = new HashMap() {

        {
            put(node, consumerNode);
            put(node2, consumerNode2);
        }
    };
    // Mock the callback of CloneConnectorCommand
    ArgumentCaptor<Consumer> consumerEdge = ArgumentCaptor.forClass(Consumer.class);
    when(canvasCommandFactory.cloneConnector(any(), Mockito.<String>any(), Mockito.<String>any(), Mockito.<String>any(), consumerEdge.capture())).thenReturn(cloneConnectorCommand);
    // apply callbacks mocks
    when(sessionCommandManager.execute(eq(canvasHandler), any())).thenAnswer(param -> {
        CompositeCommand argument = param.getArgument(1, CompositeCommand.class);
        // callback to nodes
        argument.getCommands().stream().filter(c -> c instanceof CloneNodeCommand).forEach(c -> {
            CloneNodeCommand cloneNodeCommand = (CloneNodeCommand) c;
            Node candidate = cloneNodeCommand.getCandidate();
            consumerMap.get(candidate).getValue().accept(cloneMap.get(candidate));
        });
        // callback to connectors
        argument.getCommands().stream().filter(c -> c instanceof CloneConnectorCommand).forEach(c -> consumerEdge.getValue().accept(cloneEdge));
        return commandResult;
    });
    // Executing the command
    clipboardControl.set(graphInstance.startNode, graphInstance.edge1, graphInstance.intermNode);
    when(selectionControl.getSelectedItems()).thenReturn(Arrays.asList(graphInstance.startNode.getUUID(), graphInstance.edge1.getUUID(), graphInstance.intermNode.getUUID()));
    CopySelectionSessionCommand.getInstance(sessionManager).bind(session);
    pasteSelectionSessionCommand.execute(callback);
    verify(canvasCommandFactory, times(1)).cloneNode(eq(graphInstance.startNode), eq(graphInstance.parentNode.getUUID()), eq(new Point2D(X, DEFAULT_PADDING + Y + NODE_SIZE)), any());
    verify(canvasCommandFactory, times(1)).cloneConnector(eq(graphInstance.edge1), Mockito.<String>any(), Mockito.<String>any(), Mockito.<String>any(), any());
    // check command registry update after execution to allow a single undo/redo
    verify(commandRegistry, times(2)).pop();
    ArgumentCaptor<Command> commandArgumentCaptor = ArgumentCaptor.forClass(Command.class);
    verify(commandRegistry, times(1)).register(commandArgumentCaptor.capture());
    assertTrue(commandArgumentCaptor.getValue() instanceof CompositeCommand);
    assertEquals(2, ((CompositeCommand) commandArgumentCaptor.getValue()).size());
}
Also used : Arrays(java.util.Arrays) DefinitionUtils(org.kie.workbench.common.stunner.core.util.DefinitionUtils) ArgumentMatchers.eq(org.mockito.ArgumentMatchers.eq) ManagedInstance(org.jboss.errai.ioc.client.api.ManagedInstance) Edge(org.kie.workbench.common.stunner.core.graph.Edge) AbstractCanvas(org.kie.workbench.common.stunner.core.client.canvas.AbstractCanvas) UUID(org.kie.workbench.common.stunner.core.util.UUID) DEFAULT_PADDING(org.kie.workbench.common.stunner.core.client.session.command.impl.PasteSelectionSessionCommand.DEFAULT_PADDING) CloneNodeCommand(org.kie.workbench.common.stunner.core.client.canvas.command.CloneNodeCommand) CanvasSelectionEvent(org.kie.workbench.common.stunner.core.client.canvas.event.selection.CanvasSelectionEvent) Map(java.util.Map) Diagram(org.kie.workbench.common.stunner.core.diagram.Diagram) Registry(org.appformer.client.stateControl.registry.Registry) Point2D(org.kie.workbench.common.stunner.core.graph.content.view.Point2D) CanvasCommandFactory(org.kie.workbench.common.stunner.core.client.command.CanvasCommandFactory) AbstractCanvasHandler(org.kie.workbench.common.stunner.core.client.canvas.AbstractCanvasHandler) ClientSession(org.kie.workbench.common.stunner.core.client.session.ClientSession) Metadata(org.kie.workbench.common.stunner.core.diagram.Metadata) Objects(java.util.Objects) EdgeClipboard(org.kie.workbench.common.stunner.core.client.canvas.controls.EdgeClipboard) Annotation(java.lang.annotation.Annotation) Bounds(org.kie.workbench.common.stunner.core.graph.content.Bounds) MockitoJUnitRunner(org.mockito.junit.MockitoJUnitRunner) Node(org.kie.workbench.common.stunner.core.graph.Node) Mockito.mock(org.mockito.Mockito.mock) LocalClipboardControl(org.kie.workbench.common.stunner.core.client.canvas.controls.clipboard.LocalClipboardControl) ArgumentMatchers.any(org.mockito.ArgumentMatchers.any) Connection(org.kie.workbench.common.stunner.core.graph.content.view.Connection) Mock(org.mockito.Mock) RunWith(org.junit.runner.RunWith) HashMap(java.util.HashMap) Mockito.spy(org.mockito.Mockito.spy) View(org.kie.workbench.common.stunner.core.graph.content.view.View) ArgumentCaptor(org.mockito.ArgumentCaptor) ClientSessionCommand(org.kie.workbench.common.stunner.core.client.session.command.ClientSessionCommand) Element(org.kie.workbench.common.stunner.core.graph.Element) KeyboardEvent(org.kie.workbench.common.stunner.core.client.event.keyboard.KeyboardEvent) Command(org.kie.workbench.common.stunner.core.command.Command) SessionManager(org.kie.workbench.common.stunner.core.client.api.SessionManager) CommandResult(org.kie.workbench.common.stunner.core.command.CommandResult) Before(org.junit.Before) Event(javax.enterprise.event.Event) CloneConnectorCommand(org.kie.workbench.common.stunner.core.client.canvas.command.CloneConnectorCommand) TestingGraphInstanceBuilder(org.kie.workbench.common.stunner.core.TestingGraphInstanceBuilder) Assert.assertTrue(org.junit.Assert.assertTrue) Test(org.junit.Test) Mockito.times(org.mockito.Mockito.times) Mockito.when(org.mockito.Mockito.when) ClipboardControl(org.kie.workbench.common.stunner.core.client.canvas.controls.ClipboardControl) SessionCommandManager(org.kie.workbench.common.stunner.core.client.command.SessionCommandManager) ViewConnector(org.kie.workbench.common.stunner.core.graph.content.view.ViewConnector) Mockito.verify(org.mockito.Mockito.verify) Consumer(java.util.function.Consumer) Mockito(org.mockito.Mockito) Mockito.never(org.mockito.Mockito.never) CompositeCommand(org.kie.workbench.common.stunner.core.command.impl.CompositeCommand) Collections(java.util.Collections) Mockito.reset(org.mockito.Mockito.reset) Assert.assertEquals(org.junit.Assert.assertEquals) TestingGraphMockHandler(org.kie.workbench.common.stunner.core.TestingGraphMockHandler) ViewConnector(org.kie.workbench.common.stunner.core.graph.content.view.ViewConnector) ArgumentCaptor(org.mockito.ArgumentCaptor) HashMap(java.util.HashMap) Node(org.kie.workbench.common.stunner.core.graph.Node) Connection(org.kie.workbench.common.stunner.core.graph.content.view.Connection) CloneNodeCommand(org.kie.workbench.common.stunner.core.client.canvas.command.CloneNodeCommand) CompositeCommand(org.kie.workbench.common.stunner.core.command.impl.CompositeCommand) CloneConnectorCommand(org.kie.workbench.common.stunner.core.client.canvas.command.CloneConnectorCommand) Consumer(java.util.function.Consumer) Point2D(org.kie.workbench.common.stunner.core.graph.content.view.Point2D) CloneNodeCommand(org.kie.workbench.common.stunner.core.client.canvas.command.CloneNodeCommand) ClientSessionCommand(org.kie.workbench.common.stunner.core.client.session.command.ClientSessionCommand) Command(org.kie.workbench.common.stunner.core.command.Command) CloneConnectorCommand(org.kie.workbench.common.stunner.core.client.canvas.command.CloneConnectorCommand) CompositeCommand(org.kie.workbench.common.stunner.core.command.impl.CompositeCommand) EdgeClipboard(org.kie.workbench.common.stunner.core.client.canvas.controls.EdgeClipboard) Test(org.junit.Test)

Aggregations

Consumer (java.util.function.Consumer)3 Event (javax.enterprise.event.Event)3 SessionManager (org.kie.workbench.common.stunner.core.client.api.SessionManager)3 AbstractCanvasHandler (org.kie.workbench.common.stunner.core.client.canvas.AbstractCanvasHandler)3 SessionCommandManager (org.kie.workbench.common.stunner.core.client.command.SessionCommandManager)3 Command (org.kie.workbench.common.stunner.core.command.Command)3 CompositeCommand (org.kie.workbench.common.stunner.core.command.impl.CompositeCommand)3 DefinitionUtils (org.kie.workbench.common.stunner.core.util.DefinitionUtils)3 Annotation (java.lang.annotation.Annotation)2 Arrays (java.util.Arrays)2 Collections (java.util.Collections)2 HashMap (java.util.HashMap)2 Map (java.util.Map)2 Objects (java.util.Objects)2 Registry (org.appformer.client.stateControl.registry.Registry)2 ManagedInstance (org.jboss.errai.ioc.client.api.ManagedInstance)2 Assert.assertEquals (org.junit.Assert.assertEquals)2 Assert.assertTrue (org.junit.Assert.assertTrue)2 Before (org.junit.Before)2 Test (org.junit.Test)2