use of org.uberfire.mvp.Command in project kie-wb-common by kiegroup.
the class WorkItemDefinitionMetadataRegistryTest method testLoad.
@Test
@SuppressWarnings("unchecked")
public void testLoad() {
Path path = mock(Path.class);
Metadata metadata = mock(Metadata.class);
Command callback = mock(Command.class);
when(metadata.getRoot()).thenReturn(path);
tested.load(metadata, callback);
verify(workItemsByPathSupplier, times(1)).accept(eq(path), any(Consumer.class));
}
use of org.uberfire.mvp.Command in project kie-wb-common by kiegroup.
the class MetadataWidget method onForceUnlock.
@UiHandler("unlock")
public void onForceUnlock(ClickEvent e) {
final YesNoCancelPopup yesNoCancelPopup = YesNoCancelPopup.newYesNoCancelPopup(MetadataConstants.INSTANCE.ForceUnlockConfirmationTitle(), MetadataConstants.INSTANCE.ForceUnlockConfirmationText(metadata.getLockInfo().lockedBy()), new Command() {
@Override
public void execute() {
forceUnlockHandler.run();
unlock.setEnabled(false);
}
}, new Command() {
@Override
public void execute() {
}
}, null);
yesNoCancelPopup.setClosable(false);
yesNoCancelPopup.show();
}
use of org.uberfire.mvp.Command in project kie-wb-common by kiegroup.
the class KieEditorTest method testAddRenameWhenSaveAndRenameIsEnabled.
@Test
public void testAddRenameWhenSaveAndRenameIsEnabled() {
final Caller saveAndRenameCaller = mock(Caller.class);
final Command command = mock(Command.class);
doReturn(saveAndRenameCaller).when(presenter).getSaveAndRenameServiceCaller();
doReturn(command).when(presenter).getSaveAndRename();
presenter.addRename(fileMenuBuilder);
verify(fileMenuBuilder).addRename(command);
}
use of org.uberfire.mvp.Command in project kie-wb-common by kiegroup.
the class KieEditorTest method testAddSave.
@Test
public void testAddSave() {
final MenuItem menuItem = mock(MenuItem.class);
final Command command = mock(Command.class);
doReturn(command).when(presenter).getSaveActionCommand();
doReturn(menuItem).when(versionRecordManager).newSaveMenuItem(command);
presenter.addSave(fileMenuBuilder);
verify(fileMenuBuilder).addSave(menuItem);
}
use of org.uberfire.mvp.Command in project kie-wb-common by kiegroup.
the class KieMultipleDocumentEditorTest method testDeleteCommand.
@Test
public void testDeleteCommand() {
final TestDocument document = createTestDocument();
final ObservablePath path = document.getLatestPath();
editor.setupMenuBar();
registerDocument(document);
final ArgumentCaptor<Command> deleteCommandCaptor = ArgumentCaptor.forClass(Command.class);
verify(path, times(1)).onDelete(deleteCommandCaptor.capture());
final Command deleteCommand = deleteCommandCaptor.getValue();
assertNotNull(deleteCommand);
deleteCommand.execute();
verify(editor, times(1)).enableMenus(eq(false));
verify(editor, times(4)).enableMenuItem(eq(false), any(MenuItems.class));
verify(saveMenuItem, times(1)).setEnabled(eq(false));
verify(versionManagerMenuItem, times(1)).setEnabled(eq(false));
verify(editor, times(1)).removeDocument(eq(document));
verify(registeredDocumentsMenuBuilder, times(1)).deregisterDocument(document);
}
Aggregations