Search in sources :

Example 26 with Command

use of org.uberfire.mvp.Command in project drools-wb by kiegroup.

the class GuidedDecisionTableGraphEditorPresenterTest method testGetSaveAndRenameCommand.

@Test
public void testGetSaveAndRenameCommand() {
    final Command expectedCommand = mock(Command.class);
    final GuidedDecisionTableGraphEditorPresenter presenter = makePresenter();
    doReturn(saveAndRenameCommandBuilder).when(saveAndRenameCommandBuilder).addPathSupplier(any());
    doReturn(saveAndRenameCommandBuilder).when(saveAndRenameCommandBuilder).addValidator(any(Validator.class));
    doReturn(saveAndRenameCommandBuilder).when(saveAndRenameCommandBuilder).addValidator(any(Supplier.class));
    doReturn(saveAndRenameCommandBuilder).when(saveAndRenameCommandBuilder).addRenameService(any());
    doReturn(saveAndRenameCommandBuilder).when(saveAndRenameCommandBuilder).addMetadataSupplier(any());
    doReturn(saveAndRenameCommandBuilder).when(saveAndRenameCommandBuilder).addContentSupplier(any());
    doReturn(saveAndRenameCommandBuilder).when(saveAndRenameCommandBuilder).addIsDirtySupplier(any());
    doReturn(saveAndRenameCommandBuilder).when(saveAndRenameCommandBuilder).addSuccessCallback(any());
    doReturn(expectedCommand).when(saveAndRenameCommandBuilder).build();
    final Command actualCommand = presenter.getSaveAndRenameCommand();
    assertEquals(expectedCommand, actualCommand);
}
Also used : ParameterizedCommand(org.uberfire.mvp.ParameterizedCommand) Command(org.uberfire.mvp.Command) Supplier(java.util.function.Supplier) Validator(org.uberfire.ext.editor.commons.client.validation.Validator) Test(org.junit.Test)

Example 27 with Command

use of org.uberfire.mvp.Command in project kie-wb-common by kiegroup.

the class RelationGridTest method testOnItemSelected.

@Test
public void testOnItemSelected() {
    setupGrid(0);
    final Command command = mock(Command.class);
    final HasListSelectorControl.ListSelectorTextItem listSelectorItem = mock(HasListSelectorControl.ListSelectorTextItem.class);
    when(listSelectorItem.getCommand()).thenReturn(command);
    grid.onItemSelected(listSelectorItem);
    verify(command).execute();
}
Also used : HasListSelectorControl(org.kie.workbench.common.dmn.client.widgets.grid.controls.list.HasListSelectorControl) DeleteRelationColumnCommand(org.kie.workbench.common.dmn.client.commands.expressions.types.relation.DeleteRelationColumnCommand) AddRelationRowCommand(org.kie.workbench.common.dmn.client.commands.expressions.types.relation.AddRelationRowCommand) SetHeaderValueCommand(org.kie.workbench.common.dmn.client.commands.general.SetHeaderValueCommand) AddRelationColumnCommand(org.kie.workbench.common.dmn.client.commands.expressions.types.relation.AddRelationColumnCommand) SetCellValueCommand(org.kie.workbench.common.dmn.client.commands.general.SetCellValueCommand) DeleteHeaderValueCommand(org.kie.workbench.common.dmn.client.commands.general.DeleteHeaderValueCommand) DeleteCellValueCommand(org.kie.workbench.common.dmn.client.commands.general.DeleteCellValueCommand) DeleteRelationRowCommand(org.kie.workbench.common.dmn.client.commands.expressions.types.relation.DeleteRelationRowCommand) Command(org.uberfire.mvp.Command) Test(org.junit.Test)

Example 28 with Command

use of org.uberfire.mvp.Command in project kie-wb-common by kiegroup.

the class UndefinedExpressionGridTest method testOnItemSelected.

@Test
public void testOnItemSelected() {
    setupGrid(0);
    final Command command = mock(Command.class);
    final ListSelectorTextItem listSelectorItem = mock(ListSelectorTextItem.class);
    when(listSelectorItem.getCommand()).thenReturn(command);
    grid.onItemSelected(listSelectorItem);
    verify(command).execute();
}
Also used : SetCellValueCommand(org.kie.workbench.common.dmn.client.commands.general.SetCellValueCommand) Command(org.uberfire.mvp.Command) ListSelectorTextItem(org.kie.workbench.common.dmn.client.widgets.grid.controls.list.HasListSelectorControl.ListSelectorTextItem) Test(org.junit.Test)

Example 29 with Command

use of org.uberfire.mvp.Command in project kie-wb-common by kiegroup.

the class DecisionTableGridTest method testOnItemSelected.

@Test
public void testOnItemSelected() {
    setupGrid(makeHasNameForDecision(), 0);
    final Command command = mock(Command.class);
    final HasListSelectorControl.ListSelectorTextItem listSelectorItem = mock(HasListSelectorControl.ListSelectorTextItem.class);
    when(listSelectorItem.getCommand()).thenReturn(command);
    grid.onItemSelected(listSelectorItem);
    verify(command).execute();
}
Also used : HasListSelectorControl(org.kie.workbench.common.dmn.client.widgets.grid.controls.list.HasListSelectorControl) UpdateElementPropertyCommand(org.kie.workbench.common.stunner.core.client.canvas.command.UpdateElementPropertyCommand) SetHeaderValueCommand(org.kie.workbench.common.dmn.client.commands.general.SetHeaderValueCommand) AddDecisionRuleCommand(org.kie.workbench.common.dmn.client.commands.expressions.types.dtable.AddDecisionRuleCommand) DeleteDecisionRuleCommand(org.kie.workbench.common.dmn.client.commands.expressions.types.dtable.DeleteDecisionRuleCommand) AddOutputClauseCommand(org.kie.workbench.common.dmn.client.commands.expressions.types.dtable.AddOutputClauseCommand) DeleteOutputClauseCommand(org.kie.workbench.common.dmn.client.commands.expressions.types.dtable.DeleteOutputClauseCommand) SetCellValueCommand(org.kie.workbench.common.dmn.client.commands.general.SetCellValueCommand) DeleteHeaderValueCommand(org.kie.workbench.common.dmn.client.commands.general.DeleteHeaderValueCommand) DeleteCellValueCommand(org.kie.workbench.common.dmn.client.commands.general.DeleteCellValueCommand) AddInputClauseCommand(org.kie.workbench.common.dmn.client.commands.expressions.types.dtable.AddInputClauseCommand) SetHitPolicyCommand(org.kie.workbench.common.dmn.client.commands.expressions.types.dtable.SetHitPolicyCommand) SetBuiltinAggregatorCommand(org.kie.workbench.common.dmn.client.commands.expressions.types.dtable.SetBuiltinAggregatorCommand) SetOrientationCommand(org.kie.workbench.common.dmn.client.commands.expressions.types.dtable.SetOrientationCommand) Command(org.uberfire.mvp.Command) DeleteInputClauseCommand(org.kie.workbench.common.dmn.client.commands.expressions.types.dtable.DeleteInputClauseCommand) CompositeCommand(org.kie.workbench.common.stunner.core.command.impl.CompositeCommand) Test(org.junit.Test)

Example 30 with Command

use of org.uberfire.mvp.Command in project kie-wb-common by kiegroup.

the class FunctionGridTest method testOnItemSelected.

@Test
public void testOnItemSelected() {
    setupGrid(0);
    final Command command = mock(Command.class);
    final HasListSelectorControl.ListSelectorTextItem listSelectorItem = mock(HasListSelectorControl.ListSelectorTextItem.class);
    when(listSelectorItem.getCommand()).thenReturn(command);
    grid.onItemSelected(listSelectorItem);
    verify(command).execute();
}
Also used : HasListSelectorControl(org.kie.workbench.common.dmn.client.widgets.grid.controls.list.HasListSelectorControl) UpdateElementPropertyCommand(org.kie.workbench.common.stunner.core.client.canvas.command.UpdateElementPropertyCommand) UpdateParameterNameCommand(org.kie.workbench.common.dmn.client.commands.expressions.types.function.UpdateParameterNameCommand) RemoveParameterCommand(org.kie.workbench.common.dmn.client.commands.expressions.types.function.RemoveParameterCommand) SetHeaderValueCommand(org.kie.workbench.common.dmn.client.commands.general.SetHeaderValueCommand) ClearExpressionTypeCommand(org.kie.workbench.common.dmn.client.commands.expressions.types.function.ClearExpressionTypeCommand) DeleteHeaderValueCommand(org.kie.workbench.common.dmn.client.commands.general.DeleteHeaderValueCommand) AddParameterCommand(org.kie.workbench.common.dmn.client.commands.expressions.types.function.AddParameterCommand) Command(org.uberfire.mvp.Command) SetKindCommand(org.kie.workbench.common.dmn.client.commands.expressions.types.function.SetKindCommand) Test(org.junit.Test)

Aggregations

Command (org.uberfire.mvp.Command)117 Test (org.junit.Test)66 ParameterizedCommand (org.uberfire.mvp.ParameterizedCommand)15 ClientSessionCommand (org.kie.workbench.common.stunner.core.client.session.command.ClientSessionCommand)11 Group (com.ait.lienzo.client.core.shape.Group)9 YesNoCancelPopup (org.uberfire.ext.widgets.common.client.common.popups.YesNoCancelPopup)9 Before (org.junit.Before)8 HasListSelectorControl (org.kie.workbench.common.dmn.client.widgets.grid.controls.list.HasListSelectorControl)7 Path (org.uberfire.backend.vfs.Path)7 ArrayList (java.util.ArrayList)6 Collection (java.util.Collection)6 PlaceRequest (org.uberfire.mvp.PlaceRequest)5 MenuItem (org.uberfire.workbench.model.menu.MenuItem)5 IsWidget (com.google.gwt.user.client.ui.IsWidget)4 Inject (javax.inject.Inject)4 OrganizationalUnit (org.guvnor.structure.organizationalunit.OrganizationalUnit)4 RemoteCallback (org.jboss.errai.common.client.api.RemoteCallback)4 DeleteHeaderValueCommand (org.kie.workbench.common.dmn.client.commands.general.DeleteHeaderValueCommand)4 SetCellValueCommand (org.kie.workbench.common.dmn.client.commands.general.SetCellValueCommand)4 SetHeaderValueCommand (org.kie.workbench.common.dmn.client.commands.general.SetHeaderValueCommand)4