@Test public void testRenameCommand() { loadContent(); FormEditorPresenter presenterSpy = spy(presenter); FileNameAndCommitMessage details = mock(FileNameAndCommitMessage.class); when(renamePopUpPresenter.getView()).thenReturn(mock(RenamePopUpPresenter.View.class)); doNothing().when(presenterSpy).doLoadContent(any(FormModelerContent.class)); presenterSpy.renameCommand(details, true); verify(view).showBusyIndicator(anyString()); verify(presenterSpy).getRenameErrorCallback(any(RenamePopUpPresenter.View.class)); verify(presenterSpy).getRenameSuccessCallback(any(RenamePopUpPresenter.View.class)); }
protected void renameCommand(FileNameAndCommitMessage details, boolean save) { view.showBusyIndicator(org.kie.workbench.common.widgets.client.resources.i18n.CommonConstants.INSTANCE.Renaming()); editorService.call(getRenameSuccessCallback(renamePopUpPresenter.getView()), getRenameErrorCallback(renamePopUpPresenter.getView())).rename(versionRecordManager.getPathToLatest(), details.getNewFileName(), details.getCommitMessage(), save, editorHelper.getContent(), metadata); }
FormEditorPresenter extends KieEditor<FormModelerContent> { protected void renameCommand(FileNameAndCommitMessage details, boolean save) { view.showBusyIndicator(org.kie.workbench.common.widgets.client.resources.i18n.CommonConstants.INSTANCE.Renaming()); editorService.call(getRenameSuccessCallback(renamePopUpPresenter.getView()), getRenameErrorCallback(renamePopUpPresenter.getView())).rename(versionRecordManager.getPathToLatest(), details.getNewFileName(), details.getCommitMessage(), save, editorHelper.getContent(), metadata); } }
FormEditorPresenter extends KieEditor<FormModelerContent> { protected void renameCommand(FileNameAndCommitMessage details, boolean save) { view.showBusyIndicator(org.kie.workbench.common.widgets.client.resources.i18n.CommonConstants.INSTANCE.Renaming()); editorService.call(getRenameSuccessCallback(renamePopUpPresenter.getView()), getRenameErrorCallback(renamePopUpPresenter.getView())).rename(versionRecordManager.getPathToLatest(), details.getNewFileName(), details.getCommitMessage(), save, editorHelper.getContent(), metadata); } @Inject  FormEditorPresenter(FormEditorView view,
                               ChangesNotificationDisplayer changesNotificationDisplayer,
                               FormDefinitionResourceType resourceType,
                               Caller<FormEditorService> editorService,
                               TranslationService translationService,
                               ManagedInstance<EditorFieldLayoutComponent> editorFieldLayoutComponents,
                               ShowAssetUsagesDisplayer showAssetUsagesDisplayer,
                               ErrorMessageDisplayer errorMessageDisplayer,
                               LayoutEditorPropertiesPresenter layoutEditorPropertiesPresenter); }
FormEditorPresenter extends KieEditor<FormModelerContent> { protected void renameCommand(FileNameAndCommitMessage details, boolean save) { view.showBusyIndicator(org.kie.workbench.common.widgets.client.resources.i18n.CommonConstants.INSTANCE.Renaming()); editorService.call(getRenameSuccessCallback(renamePopUpPresenter.getView()), getRenameErrorCallback(renamePopUpPresenter.getView())).rename(versionRecordManager.getPathToLatest(), details.getNewFileName(), details.getCommitMessage(), save, editorHelper.getContent(), metadata); } @Inject  FormEditorPresenter(FormEditorView view,
                               ChangesNotificationDisplayer changesNotificationDisplayer,
                               FormDefinitionResourceType resourceType,
                               Caller<FormEditorService> editorService,
                               TranslationService translationService,
                               ManagedInstance<EditorFieldLayoutComponent> editorFieldLayoutComponents,
                               ShowAssetUsagesDisplayer showAssetUsagesDisplayer,
                               ErrorMessageDisplayer errorMessageDisplayer,
                               LayoutEditorPropertiesPresenter layoutEditorPropertiesPresenter); @OnStartup void onStartup(final ObservablePath path,
                          final PlaceRequest place); @OnFocus void onFocus(); @Override void hideDocks(); void doLoadContent(final FormModelerContent content); @Override @WorkbenchPartTitle String getTitleText(); @WorkbenchMenu void getMenus(final Consumer<Menus> menusConsumer); @Override @WorkbenchPartView IsWidget getWidget(); void copy(boolean save); void rename(boolean save); LayoutTemplate getFormTemplate(); FormDefinition getFormDefinition(); void onRemoveComponent(@Observes ComponentRemovedEvent event); void onLayoutEditorElementSelectEvent(@Observes LayoutEditorElementSelectEvent event); void onSyncPalette(@Observes FormEditorSyncPaletteEvent event); void onSyncPalette(String formId); void safeDelete(); @OnMayClose Boolean onMayClose(); @PreDestroy void destroy(); void onLockStatusChange(@Observes UpdatedLockStatusEvent updatedLockStatusEvent); }
FormEditorPresenter extends KieEditor<FormModelerContent> { protected void renameCommand(FileNameAndCommitMessage details, boolean save) { view.showBusyIndicator(org.kie.workbench.common.widgets.client.resources.i18n.CommonConstants.INSTANCE.Renaming()); editorService.call(getRenameSuccessCallback(renamePopUpPresenter.getView()), getRenameErrorCallback(renamePopUpPresenter.getView())).rename(versionRecordManager.getPathToLatest(), details.getNewFileName(), details.getCommitMessage(), save, editorHelper.getContent(), metadata); } @Inject  FormEditorPresenter(FormEditorView view,
                               ChangesNotificationDisplayer changesNotificationDisplayer,
                               FormDefinitionResourceType resourceType,
                               Caller<FormEditorService> editorService,
                               TranslationService translationService,
                               ManagedInstance<EditorFieldLayoutComponent> editorFieldLayoutComponents,
                               ShowAssetUsagesDisplayer showAssetUsagesDisplayer,
                               ErrorMessageDisplayer errorMessageDisplayer,
                               LayoutEditorPropertiesPresenter layoutEditorPropertiesPresenter); @OnStartup void onStartup(final ObservablePath path,
                          final PlaceRequest place); @OnFocus void onFocus(); @Override void hideDocks(); void doLoadContent(final FormModelerContent content); @Override @WorkbenchPartTitle String getTitleText(); @WorkbenchMenu void getMenus(final Consumer<Menus> menusConsumer); @Override @WorkbenchPartView IsWidget getWidget(); void copy(boolean save); void rename(boolean save); LayoutTemplate getFormTemplate(); FormDefinition getFormDefinition(); void onRemoveComponent(@Observes ComponentRemovedEvent event); void onLayoutEditorElementSelectEvent(@Observes LayoutEditorElementSelectEvent event); void onSyncPalette(@Observes FormEditorSyncPaletteEvent event); void onSyncPalette(String formId); void safeDelete(); @OnMayClose Boolean onMayClose(); @PreDestroy void destroy(); void onLockStatusChange(@Observes UpdatedLockStatusEvent updatedLockStatusEvent); static final String ID; }