use of org.uberfire.workbench.events.NotificationEvent in project kie-wb-common by kiegroup.
the class ProductionBuildAndDeployExecutorTest method testBuildAndDeploySingleServerTemplate.
@Test
public void testBuildAndDeploySingleServerTemplate() {
final ServerTemplate serverTemplate = new ServerTemplate(SERVER_TEMPLATE_ID, SERVER_TEMPLATE_NAME);
serverTemplate.setMode(KieServerMode.PRODUCTION);
when(specManagementServiceMock.listServerTemplates()).thenReturn(new ServerTemplateList(Collections.singletonList(serverTemplate)));
runner.run(context);
verify(buildDialog).startBuild();
verify(buildDialog).showBusyIndicator(CONSTANTS.Building());
ArgumentCaptor<ContainerSpec> containerSpecArgumentCaptor = ArgumentCaptor.forClass(ContainerSpec.class);
verify(specManagementServiceMock).saveContainerSpec(eq(serverTemplate.getId()), containerSpecArgumentCaptor.capture());
ContainerSpec containerSpec = containerSpecArgumentCaptor.getValue();
assertEquals(module.getPom().getGav().getArtifactId(), containerSpec.getContainerName());
verify(specManagementServiceMock).startContainer(containerSpecArgumentCaptor.capture());
containerSpec = containerSpecArgumentCaptor.getValue();
assertEquals(module.getPom().getGav().getArtifactId(), containerSpec.getContainerName());
verifyNotification(ProjectEditorResources.CONSTANTS.BuildSuccessful(), NotificationEvent.NotificationType.SUCCESS);
verifyNotification(ProjectEditorResources.CONSTANTS.DeploySuccessfulAndContainerStarted(), NotificationEvent.NotificationType.SUCCESS);
verify(notificationEvent, times(2)).fire(any(NotificationEvent.class));
verify(buildDialog, atLeastOnce()).stopBuild();
verify(deploymentPopup, never()).show(any());
}
use of org.uberfire.workbench.events.NotificationEvent in project kie-wb-common by kiegroup.
the class NewWorkspaceProjectWizard method getSuccessCallback.
private RemoteCallback<WorkspaceProject> getSuccessCallback() {
return new RemoteCallback<WorkspaceProject>() {
@Override
public void callback(final WorkspaceProject project) {
NewWorkspaceProjectWizard.super.complete();
invokeCallback(project);
if (openEditor) {
placeManager.goTo("ProjectSettings");
}
notificationEvent.fire(new NotificationEvent(CommonConstants.INSTANCE.ItemCreatedSuccessfully()));
busyIndicatorView.hideBusyIndicator();
}
};
}
use of org.uberfire.workbench.events.NotificationEvent in project kie-wb-common by kiegroup.
the class AssignmentListItemWidgetViewImpl method init.
@PostConstruct
public void init() {
name.setRegExp(ALLOWED_CHARS, StunnerFormsClientFieldsConstants.CONSTANTS.Removed_invalid_characters_from_name(), StunnerFormsClientFieldsConstants.CONSTANTS.Invalid_character_in_name());
name.addChangeHandler(event -> {
String value = name.getText();
String notifyMessage = null;
if (isMultipleInstanceVariable(value)) {
notifyMessage = StunnerFormsClientFieldsConstants.CONSTANTS.AssignmentNameAlreadyInUseAsMultipleInstanceInputOutputVariable(value);
} else if (!allowDuplicateNames && isDuplicateName(value)) {
notifyMessage = duplicateNameErrorMessage;
}
if (notifyMessage != null) {
notification.fire(new NotificationEvent(notifyMessage, NotificationEvent.NotificationType.ERROR));
name.setValue(EMPTY_VALUE);
ValueChangeEvent.fire(name, EMPTY_VALUE);
}
});
customDataType.setRegExp(StringUtils.ALPHA_NUM_UNDERSCORE_DOT_REGEXP, StunnerFormsClientFieldsConstants.CONSTANTS.Removed_invalid_characters_from_name(), StunnerFormsClientFieldsConstants.CONSTANTS.Invalid_character_in_name());
customDataType.addKeyDownHandler(event -> {
int iChar = event.getNativeKeyCode();
if (iChar == ' ') {
event.preventDefault();
}
});
dataTypeComboBox.init(this, false, dataType, customDataType, false, true, CUSTOM_PROMPT, ENTER_TYPE_PROMPT);
processVarComboBox.init(this, false, processVar, expression, true, true, EXPRESSION_PROMPT, ENTER_EXPRESSION_PROMPT);
}
use of org.uberfire.workbench.events.NotificationEvent in project kie-wb-common by kiegroup.
the class RolesListItemWidgetViewImpl method handleValueChanged.
private void handleValueChanged() {
final String currentRole = row.getModel().getKey();
final String currentCardinality = row.getModel().getValue();
if (StringUtils.isEmpty(currentRole)) {
notification.fire(new NotificationEvent(EMPTY_ERROR_MESSAGE, NotificationEvent.NotificationType.ERROR));
row.getModel().setKey(previousRole);
return;
}
if (!allowDuplicateNames && isDuplicateName(currentRole)) {
notification.fire(new NotificationEvent(DUPLICATE_NAME_ERROR_MESSAGE, NotificationEvent.NotificationType.ERROR));
row.getModel().setKey(previousRole);
return;
}
// skip in case not modified values
if ((Objects.equals(previousRole, currentRole) && Objects.equals(previousCardinality, currentCardinality))) {
return;
}
previousRole = currentRole;
previousCardinality = currentCardinality;
notifyModelChanged();
}
use of org.uberfire.workbench.events.NotificationEvent in project kie-wb-common by kiegroup.
the class AddProjectPopUpPresenterTest method createProjectCallbackBeforeProjectIndexedEventTest.
@Test
public void createProjectCallbackBeforeProjectIndexedEventTest() {
final WorkspaceProject project = mock(WorkspaceProject.class);
final Path projectRootPath = mock(Path.class);
doReturn(projectRootPath).when(project).getRootPath();
doReturn(project).when(projectService).resolveProject(any(Path.class));
doReturn(project).when(libraryService).createProject(any(), any(), any(), Mockito.<String>any());
doReturn("test").when(view).getName();
doReturn("description").when(view).getDescription();
presenter.add();
presenter.onProjectIndexingFinishedEvent(new IndexingFinishedEvent("kClusterId", projectRootPath));
verify(view).setAddButtonEnabled(false);
verify(view).showBusyIndicator(Mockito.<String>any());
verify(view).setAddButtonEnabled(true);
verify(view).hide();
verify(notificationEvent).fire(any(NotificationEvent.class));
verify(libraryPlaces).goToProject(project);
}
Aggregations