@Test public void checkRightResourceType() throws Exception { doReturn(true).when(sourceTypeSelectorMock).validate(); when(sourceTypeSelectorMock.getSelectedType()).thenReturn(ScenarioSimulationModel.Type.RULE); handler.create(new Package(), "newfile.scesim", mock(NewResourcePresenter.class)); verify(busyIndicatorViewMock).showBusyIndicator("Saving"); verify(busyIndicatorViewMock).hideBusyIndicator(); verify(notificationEventMock).fire(any(NotificationEvent.class)); verify(newResourceSuccessEventMock).fire(any(NewResourcePresenter.class)); verify(placeManagerMock).goTo(any(Path.class)); }
@Override public void create(final Package pkg, final String baseFileName, final NewResourcePresenter presenter) { if (!sourceTypeSelector.validate()) { return; } final ScenarioSimulationModel.Type selectedType = sourceTypeSelector.getSelectedType(); String value; switch (selectedType) { case DMN: value = uploadWidget.getSelectedPath(); break; case RULE: default: value = null; } busyIndicatorView.showBusyIndicator(CommonConstants.INSTANCE.Saving()); CustomBusyPopup.showMessage(CommonConstants.INSTANCE.Saving()); scenarioSimulationService.call(getSuccessCallback(presenter), new ScenarioSimulationHasBusyIndicatorDefaultErrorCallback(busyIndicatorView)).create(pkg.getPackageTestResourcesPath(), buildFileName(baseFileName, resourceType), new ScenarioSimulationModel(), "", selectedType, value); }
NewScenarioSimulationHandler extends DefaultNewResourceHandler { @Override public void create(final Package pkg, final String baseFileName, final NewResourcePresenter presenter) { if (!sourceTypeSelector.validate()) { return; } final ScenarioSimulationModel.Type selectedType = sourceTypeSelector.getSelectedType(); String value; switch (selectedType) { case DMN: value = uploadWidget.getSelectedPath(); break; case RULE: default: value = null; } busyIndicatorView.showBusyIndicator(CommonConstants.INSTANCE.Saving()); CustomBusyPopup.showMessage(CommonConstants.INSTANCE.Saving()); scenarioSimulationService.call(getSuccessCallback(presenter), new ScenarioSimulationHasBusyIndicatorDefaultErrorCallback(busyIndicatorView)).create(pkg.getPackageTestResourcesPath(), buildFileName(baseFileName, resourceType), new ScenarioSimulationModel(), "", selectedType, value); } }
NewScenarioSimulationHandler extends DefaultNewResourceHandler { @Override public void create(final Package pkg, final String baseFileName, final NewResourcePresenter presenter) { if (!sourceTypeSelector.validate()) { return; } final ScenarioSimulationModel.Type selectedType = sourceTypeSelector.getSelectedType(); String value; switch (selectedType) { case DMN: value = uploadWidget.getSelectedPath(); break; case RULE: default: value = null; } busyIndicatorView.showBusyIndicator(CommonConstants.INSTANCE.Saving()); CustomBusyPopup.showMessage(CommonConstants.INSTANCE.Saving()); scenarioSimulationService.call(getSuccessCallback(presenter), new ScenarioSimulationHasBusyIndicatorDefaultErrorCallback(busyIndicatorView)).create(pkg.getPackageTestResourcesPath(), buildFileName(baseFileName, resourceType), new ScenarioSimulationModel(), "", selectedType, value); } @Inject  NewScenarioSimulationHandler(final ScenarioSimulationResourceType resourceType,
                                        final BusyIndicatorView busyIndicatorView,
                                        final Event<NotificationEvent> notificationEvent,
                                        final Event<NewResourceSuccessEvent> newResourceSuccessEvent,
                                        final PlaceManager placeManager,
                                        final Caller<ScenarioSimulationService> scenarioSimulationService,
                                        final AuthorizationManager authorizationManager,
                                        final SessionInfo sessionInfo,
                                        @Named(ScenarioSimulationDropdown.BEAN_NAME) final ScenarioSimulationDropdown scenarioSimulationDropdown); }
NewScenarioSimulationHandler extends DefaultNewResourceHandler { @Override public void create(final Package pkg, final String baseFileName, final NewResourcePresenter presenter) { if (!sourceTypeSelector.validate()) { return; } final ScenarioSimulationModel.Type selectedType = sourceTypeSelector.getSelectedType(); String value; switch (selectedType) { case DMN: value = uploadWidget.getSelectedPath(); break; case RULE: default: value = null; } busyIndicatorView.showBusyIndicator(CommonConstants.INSTANCE.Saving()); CustomBusyPopup.showMessage(CommonConstants.INSTANCE.Saving()); scenarioSimulationService.call(getSuccessCallback(presenter), new ScenarioSimulationHasBusyIndicatorDefaultErrorCallback(busyIndicatorView)).create(pkg.getPackageTestResourcesPath(), buildFileName(baseFileName, resourceType), new ScenarioSimulationModel(), "", selectedType, value); } @Inject  NewScenarioSimulationHandler(final ScenarioSimulationResourceType resourceType,
                                        final BusyIndicatorView busyIndicatorView,
                                        final Event<NotificationEvent> notificationEvent,
                                        final Event<NewResourceSuccessEvent> newResourceSuccessEvent,
                                        final PlaceManager placeManager,
                                        final Caller<ScenarioSimulationService> scenarioSimulationService,
                                        final AuthorizationManager authorizationManager,
                                        final SessionInfo sessionInfo,
                                        @Named(ScenarioSimulationDropdown.BEAN_NAME) final ScenarioSimulationDropdown scenarioSimulationDropdown); @Override String getDescription(); @Override IsWidget getIcon(); @Override ResourceTypeDefinition getResourceType(); @Override boolean canCreate(); @Override Command getCommand(final NewResourcePresenter newResourcePresenter); @Override void create(final Package pkg,
                       final String baseFileName,
                       final NewResourcePresenter presenter); @PostConstruct void setupExtensions(); }
NewScenarioSimulationHandler extends DefaultNewResourceHandler { @Override public void create(final Package pkg, final String baseFileName, final NewResourcePresenter presenter) { if (!sourceTypeSelector.validate()) { return; } final ScenarioSimulationModel.Type selectedType = sourceTypeSelector.getSelectedType(); String value; switch (selectedType) { case DMN: value = uploadWidget.getSelectedPath(); break; case RULE: default: value = null; } busyIndicatorView.showBusyIndicator(CommonConstants.INSTANCE.Saving()); CustomBusyPopup.showMessage(CommonConstants.INSTANCE.Saving()); scenarioSimulationService.call(getSuccessCallback(presenter), new ScenarioSimulationHasBusyIndicatorDefaultErrorCallback(busyIndicatorView)).create(pkg.getPackageTestResourcesPath(), buildFileName(baseFileName, resourceType), new ScenarioSimulationModel(), "", selectedType, value); } @Inject  NewScenarioSimulationHandler(final ScenarioSimulationResourceType resourceType,
                                        final BusyIndicatorView busyIndicatorView,
                                        final Event<NotificationEvent> notificationEvent,
                                        final Event<NewResourceSuccessEvent> newResourceSuccessEvent,
                                        final PlaceManager placeManager,
                                        final Caller<ScenarioSimulationService> scenarioSimulationService,
                                        final AuthorizationManager authorizationManager,
                                        final SessionInfo sessionInfo,
                                        @Named(ScenarioSimulationDropdown.BEAN_NAME) final ScenarioSimulationDropdown scenarioSimulationDropdown); @Override String getDescription(); @Override IsWidget getIcon(); @Override ResourceTypeDefinition getResourceType(); @Override boolean canCreate(); @Override Command getCommand(final NewResourcePresenter newResourcePresenter); @Override void create(final Package pkg,
                       final String baseFileName,
                       final NewResourcePresenter presenter); @PostConstruct void setupExtensions();  }