use of org.uberfire.workbench.events.NotificationEvent in project kie-wb-common by kiegroup.
the class NewDeployWizardTest method testStartDeploymentSuccess.
@Test
public void testStartDeploymentSuccess() {
// initialize and start the wizard.
wizard.start(provider, pipelines);
verifyStart();
// e.g. PIPELINE1 was selected.
preSelectForms(PIPELINE1_KEY);
// emulate the user completing the wizard.
preCompleteWizard(PIPELINE1_KEY, RUNTIME);
// emulates the user pressing the finish button
wizard.complete();
// the parameters must the the values collected by the forms.
Map<String, String> expectedPrams = buildExpectedParams(paramsFormsValues);
expectedPrams.put(RUNTIME_NAME, RUNTIME);
verify(runtimeService, times(1)).createRuntime(provider.getKey(), RUNTIME, PIPELINE1_KEY, expectedPrams);
verify(notification, times(1)).fire(new NotificationEvent(SUCCESS_MESSAGE, NotificationEvent.NotificationType.SUCCESS));
verify(refreshRuntimeEvent, times(1)).fire(new RefreshRuntimeEvent(provider.getKey()));
}
use of org.uberfire.workbench.events.NotificationEvent in project kie-wb-common by kiegroup.
the class EnableProviderTypeWizardTest method testEnableProviderSuccess.
@Test
public void testEnableProviderSuccess() {
// initialize and start the wizard.
wizard.start(providerTypeStatus);
// emulate the user completing the wizard.
preCompleteWizard();
// emulates the user pressing the finish button
wizard.complete();
// verify the provider types has been enabled and the proper notifications were fired.
verify(providerTypeService, times(1)).enableProviderTypes(selectedProviders);
verify(notification, times(1)).fire(new NotificationEvent(SUCCESS_MESSAGE, NotificationEvent.NotificationType.SUCCESS));
verify(providerTypeListRefreshEvent, times(1)).fire(new ProviderTypeListRefreshEvent(selectedProviders.get(0).getKey()));
}
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 RuntimePresenterActionsTest method testDeletePipelineConfirmYesAndSuccessful.
@Test
public void testDeletePipelineConfirmYesAndSuccessful() {
preparePipelineDelete();
PipelineExecutionTraceKey currentKey = trace.getKey();
when(translationService.format(RuntimePresenter_PipelineExecutionDeleteSuccessMessage, currentKey.getId())).thenReturn(SUCCESS_MESSAGE);
yesCommandCaptor.getValue().execute();
verify(runtimeService, times(1)).deletePipelineExecution(currentKey);
verify(notificationEvent, times(1)).fire(new NotificationEvent(SUCCESS_MESSAGE, NotificationEvent.NotificationType.SUCCESS));
}
use of org.uberfire.workbench.events.NotificationEvent in project kie-wb-common by kiegroup.
the class AbstractBuildAndDeployExecutor method onBuildDeploySuccess.
protected void onBuildDeploySuccess(final BuildExecutionContext context, final BuildResults result) {
if (result.getErrorMessages().isEmpty()) {
notificationEvent.fire(new NotificationEvent(CONSTANTS.BuildSuccessful(), SUCCESS));
ServerTemplate serverTemplate = context.getServerTemplate();
if (serverTemplate != null && serverTemplate.getId() != null) {
ContainerSpec containerSpec = BuildUtils.makeContainerSpec(context, result.getParameters());
Optional<ContainerSpec> optional = Optional.ofNullable(context.getServerTemplate().getContainerSpec(containerSpec.getId()));
if (optional.isPresent()) {
updateContainerSpec(context, containerSpec);
} else {
saveContainerSpecAndMaybeStartContainer(context, containerSpec);
}
}
} else {
notificationEvent.fire(new NotificationEvent(CONSTANTS.BuildFailed(), ERROR));
finish();
}
buildResultsEvent.fire(result);
}
Aggregations