use of org.uberfire.workbench.events.NotificationEvent in project kie-wb-common by kiegroup.
the class EnableProviderTypeWizardTest method testEnableProviderFailure.
@Test
public void testEnableProviderFailure() {
// initialize and start the wizard.
wizard.start(providerTypeStatus);
// emulate the user completing the wizard.
preCompleteWizard();
prepareServiceCallerError(providerTypeService, providerTypeServiceCaller);
// emulates the user pressing the finish button
wizard.complete();
verify(providerTypeService, times(1)).enableProviderTypes(selectedProviders);
verify(notification, times(1)).fire(new NotificationEvent(ERROR_MESSAGE, NotificationEvent.NotificationType.ERROR));
}
use of org.uberfire.workbench.events.NotificationEvent in project kie-wb-common by kiegroup.
the class DataModelerScreenPresenter method getSaveSuccessCallback.
private RemoteCallback<GenerationResult> getSaveSuccessCallback(final Path currentPath) {
return new RemoteCallback<GenerationResult>() {
@Override
public void callback(GenerationResult result) {
view.hideBusyIndicator();
Boolean oldDirtyStatus = isDirty();
if (result.hasErrors()) {
context.setParseStatus(DataModelerContext.ParseStatus.PARSE_ERRORS);
updateEditorView(null);
context.setDataObject(null);
if (isEditorTabSelected()) {
// un common case
showParseErrorsDialog(Constants.INSTANCE.modelEditor_message_file_parsing_errors(), true, result.getErrors(), getOnSaveParseErrorCommand());
}
} else {
context.setParseStatus(DataModelerContext.ParseStatus.PARSED);
if (context.isSourceChanged()) {
updateEditorView(result.getDataObject());
context.setDataObject(result.getDataObject());
}
cleanSystemMessages(getCurrentMessageType());
}
setSource(result.getSource());
context.setEditionStatus(DataModelerContext.EditionStatus.NO_CHANGES);
setOriginalHash(context.getDataObject() != null ? context.getDataObject().hashCode() : null);
originalSourceHash = getSource().hashCode();
notification.fire(new NotificationEvent(org.kie.workbench.common.widgets.client.resources.i18n.CommonConstants.INSTANCE.ItemSavedSuccessfully(), NotificationEvent.NotificationType.SUCCESS));
dataModelerEvent.fire(new DataModelStatusChangeEvent(context.getContextId(), DataModelerEvent.DATA_MODEL_BROWSER, oldDirtyStatus, false));
dataModelerEvent.fire(new DataModelSaved(context.getContextId(), null));
versionRecordManager.reloadVersions(currentPath);
}
};
}
use of org.uberfire.workbench.events.NotificationEvent in project kie-wb-common by kiegroup.
the class DataModelerScreenPresenter method getRenameSuccessCallback.
private RemoteCallback<Path> getRenameSuccessCallback(final RenamePopUpPresenter.View renamePopupView) {
return new RemoteCallback<Path>() {
@Override
public void callback(final Path targetPath) {
renamePopupView.hide();
view.hideBusyIndicator();
notification.fire(new NotificationEvent(org.kie.workbench.common.widgets.client.resources.i18n.CommonConstants.INSTANCE.ItemRenamedSuccessfully(), NotificationEvent.NotificationType.SUCCESS));
}
};
}
use of org.uberfire.workbench.events.NotificationEvent in project kie-wb-common by kiegroup.
the class NewDataSourceDefWizard method getCreateSuccessCallback.
private RemoteCallback<Path> getCreateSuccessCallback() {
return new RemoteCallback<Path>() {
@Override
public void callback(Path path) {
notification.fire(new NotificationEvent(translationService.format(DataSourceManagementConstants.NewDataSourceDefWizard_DataSourceCreatedMessage, path.toString())));
NewDataSourceDefWizard.super.complete();
}
};
}
use of org.uberfire.workbench.events.NotificationEvent in project kie-wb-common by kiegroup.
the class NewDriverWizardTest method testCreate.
/**
* Emulates a sequence of valid data entering and the wizard completion.
*/
private void testCreate(final Module module) {
when(path.toString()).thenReturn("target_driver_path");
when(translationService.format(eq(DataSourceManagementConstants.NewDriverDefWizard_DriverCreatedMessage), anyVararg())).thenReturn("OkMessage");
if (module != null) {
when(driverDefService.create(any(DriverDef.class), eq(module))).thenReturn(path);
driverDefWizard.setModule(module);
} else {
when(driverDefService.createGlobal(any(DriverDef.class))).thenReturn(path);
}
driverDefWizard.start();
completeValidDefPage();
driverDefWizard.complete();
DriverDef expectedDriverDef = new DriverDef();
expectedDriverDef.setName(NAME);
expectedDriverDef.setGroupId(GROUP_ID);
expectedDriverDef.setArtifactId(ARTIFACT_ID);
expectedDriverDef.setVersion(VERSION);
expectedDriverDef.setDriverClass(DRIVER_CLASS);
if (module != null) {
verify(driverDefService, times(1)).create(expectedDriverDef, module);
} else {
verify(driverDefService, times(1)).createGlobal(expectedDriverDef);
}
verify(notificationEvent, times(1)).fire(new NotificationEvent("OkMessage"));
}
Aggregations