Search in sources :

Example 46 with NotificationEvent

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()));
}
Also used : RefreshRuntimeEvent(org.guvnor.ala.ui.client.events.RefreshRuntimeEvent) NotificationEvent(org.uberfire.workbench.events.NotificationEvent) Test(org.junit.Test)

Example 47 with NotificationEvent

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()));
}
Also used : ProviderTypeListRefreshEvent(org.guvnor.ala.ui.client.events.ProviderTypeListRefreshEvent) NotificationEvent(org.uberfire.workbench.events.NotificationEvent) Test(org.junit.Test)

Example 48 with NotificationEvent

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));
}
Also used : NotificationEvent(org.uberfire.workbench.events.NotificationEvent) Test(org.junit.Test)

Example 49 with NotificationEvent

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));
}
Also used : NotificationEvent(org.uberfire.workbench.events.NotificationEvent) PipelineExecutionTraceKey(org.guvnor.ala.ui.model.PipelineExecutionTraceKey) Test(org.junit.Test)

Example 50 with NotificationEvent

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);
}
Also used : ServerTemplate(org.kie.server.controller.api.model.spec.ServerTemplate) ContainerSpec(org.kie.server.controller.api.model.spec.ContainerSpec) NotificationEvent(org.uberfire.workbench.events.NotificationEvent)

Aggregations

NotificationEvent (org.uberfire.workbench.events.NotificationEvent)151 Test (org.junit.Test)65 RemoteCallback (org.jboss.errai.common.client.api.RemoteCallback)34 ServerTemplate (org.kie.server.controller.api.model.spec.ServerTemplate)28 ContainerSpec (org.kie.server.controller.api.model.spec.ContainerSpec)22 ServerTemplateList (org.kie.server.controller.api.model.spec.ServerTemplateList)21 List (java.util.List)17 Path (org.uberfire.backend.vfs.Path)17 ErrorCallback (org.jboss.errai.common.client.api.ErrorCallback)16 ArrayList (java.util.ArrayList)14 Event (javax.enterprise.event.Event)14 Inject (javax.inject.Inject)12 ObservablePath (org.uberfire.backend.vfs.ObservablePath)12 PostConstruct (javax.annotation.PostConstruct)9 Observes (javax.enterprise.event.Observes)9 Caller (org.jboss.errai.common.client.api.Caller)9 Map (java.util.Map)8 Promise (elemental2.promise.Promise)7 Arrays (java.util.Arrays)7 Dependent (javax.enterprise.context.Dependent)7