@Test public void makeMenuBarCanUpdateProjectTrue() { doReturn(Optional.of(mock(WorkspaceProject.class))).when(workbenchContextMock).getActiveWorkspaceProject(); doReturn(promises.resolve(true)).when(projectControllerMock).canUpdateProject(any()); scenarioSimulationEditorBusinessClientWrapper.makeMenuBar(); verify(scenarioSimulationEditorPresenterMock, times(1)).makeMenuBar(same(fileMenuBuilderMock)); }
@Override protected Promise<Void> makeMenuBar() { scenarioSimulationEditorPresenter.makeMenuBar(fileMenuBuilder); if (workbenchContext.getActiveWorkspaceProject().isPresent()) { final WorkspaceProject activeProject = workbenchContext.getActiveWorkspaceProject().orElseThrow(IllegalStateException::new); return projectController.canUpdateProject(activeProject).then(canUpdateProject -> { if (Boolean.TRUE.equals(canUpdateProject)) { addSave(fileMenuBuilder); addCopy(fileMenuBuilder); addRename(fileMenuBuilder); addDelete(fileMenuBuilder); } addDownloadMenuItem(fileMenuBuilder); addCommonActions(fileMenuBuilder); return promises.resolve(); }); } return promises.resolve(); }
ScenarioSimulationEditorBusinessCentralWrapper extends KieEditor<ScenarioSimulationModel> implements ScenarioSimulationEditorWrapper { @Override protected Promise<Void> makeMenuBar() { scenarioSimulationEditorPresenter.makeMenuBar(fileMenuBuilder); if (workbenchContext.getActiveWorkspaceProject().isPresent()) { final WorkspaceProject activeProject = workbenchContext.getActiveWorkspaceProject().orElseThrow(IllegalStateException::new); return projectController.canUpdateProject(activeProject).then(canUpdateProject -> { if (Boolean.TRUE.equals(canUpdateProject)) { addSave(fileMenuBuilder); addCopy(fileMenuBuilder); addRename(fileMenuBuilder); addDelete(fileMenuBuilder); } addDownloadMenuItem(fileMenuBuilder); addCommonActions(fileMenuBuilder); return promises.resolve(); }); } return promises.resolve(); } }
ScenarioSimulationEditorBusinessCentralWrapper extends KieEditor<ScenarioSimulationModel> implements ScenarioSimulationEditorWrapper { @Override protected Promise<Void> makeMenuBar() { scenarioSimulationEditorPresenter.makeMenuBar(fileMenuBuilder); if (workbenchContext.getActiveWorkspaceProject().isPresent()) { final WorkspaceProject activeProject = workbenchContext.getActiveWorkspaceProject().orElseThrow(IllegalStateException::new); return projectController.canUpdateProject(activeProject).then(canUpdateProject -> { if (Boolean.TRUE.equals(canUpdateProject)) { addSave(fileMenuBuilder); addCopy(fileMenuBuilder); addRename(fileMenuBuilder); addDelete(fileMenuBuilder); } addDownloadMenuItem(fileMenuBuilder); addCommonActions(fileMenuBuilder); return promises.resolve(); }); } return promises.resolve(); } ScenarioSimulationEditorBusinessCentralWrapper(); @Inject  ScenarioSimulationEditorBusinessCentralWrapper(final Caller<ScenarioSimulationService> service,
                                                          final ScenarioSimulationEditorPresenter scenarioSimulationEditorPresenter,
                                                          final ImportsWidgetPresenter importsWidget,
                                                          final AsyncPackageDataModelOracleFactory oracleFactory,
                                                          final PlaceManager placeManager,
                                                          final Caller<DMNTypeService> dmnTypeService,
                                                          final Caller<ImportExportService> importExportService,
                                                          final Caller<RunnerReportService> runnerReportService,
                                                          final ScenarioSimulationBusinessCentralDocksHandler scenarioSimulationBusinessCentralDocksHandler); }
ScenarioSimulationEditorBusinessCentralWrapper extends KieEditor<ScenarioSimulationModel> implements ScenarioSimulationEditorWrapper { @Override protected Promise<Void> makeMenuBar() { scenarioSimulationEditorPresenter.makeMenuBar(fileMenuBuilder); if (workbenchContext.getActiveWorkspaceProject().isPresent()) { final WorkspaceProject activeProject = workbenchContext.getActiveWorkspaceProject().orElseThrow(IllegalStateException::new); return projectController.canUpdateProject(activeProject).then(canUpdateProject -> { if (Boolean.TRUE.equals(canUpdateProject)) { addSave(fileMenuBuilder); addCopy(fileMenuBuilder); addRename(fileMenuBuilder); addDelete(fileMenuBuilder); } addDownloadMenuItem(fileMenuBuilder); addCommonActions(fileMenuBuilder); return promises.resolve(); }); } return promises.resolve(); } ScenarioSimulationEditorBusinessCentralWrapper(); @Inject  ScenarioSimulationEditorBusinessCentralWrapper(final Caller<ScenarioSimulationService> service,
                                                          final ScenarioSimulationEditorPresenter scenarioSimulationEditorPresenter,
                                                          final ImportsWidgetPresenter importsWidget,
                                                          final AsyncPackageDataModelOracleFactory oracleFactory,
                                                          final PlaceManager placeManager,
                                                          final Caller<DMNTypeService> dmnTypeService,
                                                          final Caller<ImportExportService> importExportService,
                                                          final Caller<RunnerReportService> runnerReportService,
                                                          final ScenarioSimulationBusinessCentralDocksHandler scenarioSimulationBusinessCentralDocksHandler); @OnStartup void onStartup(final ObservablePath path,
                          final PlaceRequest place); @OnClose @Override void onClose(); @OnMayClose boolean mayClose(); @Override @WorkbenchPartTitle String getTitleText(); @Override @WorkbenchPartTitleDecoration IsWidget getTitle(); @Override @WorkbenchPartView IsWidget getWidget(); @Override @WorkbenchMenu void getMenus(final Consumer<Menus> menusConsumer); @Override void showDocks(); @Override void wrappedRegisterDock(String id, IsWidget widget); @Override void onImport(String fileContents, RemoteCallback<AbstractScesimModel> importCallBack, ErrorCallback<Object> importErrorCallback, AbstractScesimModel<? extends AbstractScesimData> scesimModel); @Override void onExportToCsv(RemoteCallback<String> exportCallBack, ScenarioSimulationHasBusyIndicatorDefaultErrorCallback scenarioSimulationHasBusyIndicatorDefaultErrorCallback, AbstractScesimModel<? extends AbstractScesimData> scesimModel); @Override void onDownloadReportToCsv(RemoteCallback<String> exportCallBack,
                                      ScenarioSimulationHasBusyIndicatorDefaultErrorCallback scenarioSimulationHasBusyIndicatorDefaultErrorCallback,
                                      SimulationRunMetadata simulationRunMetadata,
                                      ScenarioSimulationModel.Type modelType); @Override void hideDocks(); @Override void onRunScenario(RemoteCallback<SimulationRunResult> refreshModelCallback, ScenarioSimulationHasBusyIndicatorDefaultErrorCallback scenarioSimulationHasBusyIndicatorDefaultErrorCallback, ScesimModelDescriptor simulationDescriptor, Settings settings, List<ScenarioWithIndex> toRun, Background background); @Override Integer getOriginalHash(); @Override void addDownloadMenuItem(FileMenuBuilder fileMenuBuilder); @Override void validate(Simulation simulation, Settings settings, RemoteCallback<?> callback); @Override void onRefreshedModelContent(SimulationRunResult testResult); @Override void onEditTabSelected(); @Override void onOverviewSelected(); @Override void addBackgroundPage(final ScenarioGridWidget scenarioGridWidget); @Override void selectSimulationTab(); @Override void selectBackgroundTab(); @Override AbstractScenarioSimulationDocksHandler getScenarioSimulationDocksHandler(); @Override ScenarioSimulationEditorPresenter getScenarioSimulationEditorPresenter(); @Override void populateDocks(String identifier); }
ScenarioSimulationEditorBusinessCentralWrapper extends KieEditor<ScenarioSimulationModel> implements ScenarioSimulationEditorWrapper { @Override protected Promise<Void> makeMenuBar() { scenarioSimulationEditorPresenter.makeMenuBar(fileMenuBuilder); if (workbenchContext.getActiveWorkspaceProject().isPresent()) { final WorkspaceProject activeProject = workbenchContext.getActiveWorkspaceProject().orElseThrow(IllegalStateException::new); return projectController.canUpdateProject(activeProject).then(canUpdateProject -> { if (Boolean.TRUE.equals(canUpdateProject)) { addSave(fileMenuBuilder); addCopy(fileMenuBuilder); addRename(fileMenuBuilder); addDelete(fileMenuBuilder); } addDownloadMenuItem(fileMenuBuilder); addCommonActions(fileMenuBuilder); return promises.resolve(); }); } return promises.resolve(); } ScenarioSimulationEditorBusinessCentralWrapper(); @Inject  ScenarioSimulationEditorBusinessCentralWrapper(final Caller<ScenarioSimulationService> service,
                                                          final ScenarioSimulationEditorPresenter scenarioSimulationEditorPresenter,
                                                          final ImportsWidgetPresenter importsWidget,
                                                          final AsyncPackageDataModelOracleFactory oracleFactory,
                                                          final PlaceManager placeManager,
                                                          final Caller<DMNTypeService> dmnTypeService,
                                                          final Caller<ImportExportService> importExportService,
                                                          final Caller<RunnerReportService> runnerReportService,
                                                          final ScenarioSimulationBusinessCentralDocksHandler scenarioSimulationBusinessCentralDocksHandler); @OnStartup void onStartup(final ObservablePath path,
                          final PlaceRequest place); @OnClose @Override void onClose(); @OnMayClose boolean mayClose(); @Override @WorkbenchPartTitle String getTitleText(); @Override @WorkbenchPartTitleDecoration IsWidget getTitle(); @Override @WorkbenchPartView IsWidget getWidget(); @Override @WorkbenchMenu void getMenus(final Consumer<Menus> menusConsumer); @Override void showDocks(); @Override void wrappedRegisterDock(String id, IsWidget widget); @Override void onImport(String fileContents, RemoteCallback<AbstractScesimModel> importCallBack, ErrorCallback<Object> importErrorCallback, AbstractScesimModel<? extends AbstractScesimData> scesimModel); @Override void onExportToCsv(RemoteCallback<String> exportCallBack, ScenarioSimulationHasBusyIndicatorDefaultErrorCallback scenarioSimulationHasBusyIndicatorDefaultErrorCallback, AbstractScesimModel<? extends AbstractScesimData> scesimModel); @Override void onDownloadReportToCsv(RemoteCallback<String> exportCallBack,
                                      ScenarioSimulationHasBusyIndicatorDefaultErrorCallback scenarioSimulationHasBusyIndicatorDefaultErrorCallback,
                                      SimulationRunMetadata simulationRunMetadata,
                                      ScenarioSimulationModel.Type modelType); @Override void hideDocks(); @Override void onRunScenario(RemoteCallback<SimulationRunResult> refreshModelCallback, ScenarioSimulationHasBusyIndicatorDefaultErrorCallback scenarioSimulationHasBusyIndicatorDefaultErrorCallback, ScesimModelDescriptor simulationDescriptor, Settings settings, List<ScenarioWithIndex> toRun, Background background); @Override Integer getOriginalHash(); @Override void addDownloadMenuItem(FileMenuBuilder fileMenuBuilder); @Override void validate(Simulation simulation, Settings settings, RemoteCallback<?> callback); @Override void onRefreshedModelContent(SimulationRunResult testResult); @Override void onEditTabSelected(); @Override void onOverviewSelected(); @Override void addBackgroundPage(final ScenarioGridWidget scenarioGridWidget); @Override void selectSimulationTab(); @Override void selectBackgroundTab(); @Override AbstractScenarioSimulationDocksHandler getScenarioSimulationDocksHandler(); @Override ScenarioSimulationEditorPresenter getScenarioSimulationEditorPresenter(); @Override void populateDocks(String identifier);  }