Search in sources :

Example 6 with BuildExecutionContext

use of org.kie.workbench.common.screens.projecteditor.client.build.exec.BuildExecutionContext in project kie-wb-common by kiegroup.

the class BuildExecutorTest method testDefaultInstall.

@Test
public void testDefaultInstall() {
    buildExecutor.triggerBuildAndInstall();
    verify(buildExecutionManager).execute(eq(BuildType.INSTALL), contextCaptor.capture());
    BuildExecutionContext context = contextCaptor.getValue();
    Assertions.assertThat(context).returns(buildExecutor.defaultContainerId(), BuildExecutionContext::getContainerId).returns(buildExecutor.defaultContainerAlias(), BuildExecutionContext::getContainerAlias).returns(module, BuildExecutionContext::getModule);
}
Also used : BuildExecutionContext(org.kie.workbench.common.screens.projecteditor.client.build.exec.BuildExecutionContext) Test(org.junit.Test)

Example 7 with BuildExecutionContext

use of org.kie.workbench.common.screens.projecteditor.client.build.exec.BuildExecutionContext in project kie-wb-common by kiegroup.

the class BuildExecutorTest method testSnapshotBuildAndDeploy.

@Test
public void testSnapshotBuildAndDeploy() {
    module.getPom().getGav().setVersion(VERSION + SNAPSHOT);
    buildExecutor.triggerBuildAndDeploy();
    verify(buildExecutionManager).execute(eq(BuildType.DEPLOY), contextCaptor.capture());
    BuildExecutionContext context = contextCaptor.getValue();
    Assertions.assertThat(context).returns(buildExecutor.defaultContainerId(), BuildExecutionContext::getContainerId).returns(buildExecutor.defaultContainerAlias(), BuildExecutionContext::getContainerAlias).returns(module, BuildExecutionContext::getModule);
}
Also used : BuildExecutionContext(org.kie.workbench.common.screens.projecteditor.client.build.exec.BuildExecutionContext) Test(org.junit.Test)

Example 8 with BuildExecutionContext

use of org.kie.workbench.common.screens.projecteditor.client.build.exec.BuildExecutionContext in project kie-wb-common by kiegroup.

the class AbstractBuildAndDeployExecutor method saveContainerSpecAndMaybeStartContainer.

protected void saveContainerSpecAndMaybeStartContainer(final BuildExecutionContext context, final ContainerSpec containerSpec) {
    specManagementService.call(ignore -> {
        if (!context.isStartContainer()) {
            notificationEvent.fire(new NotificationEvent(CONSTANTS.DeploySuccessful(), NotificationEvent.NotificationType.SUCCESS).setAutoHide(false).setNavigation(CONSTANTS.ViewDeploymentDetails(), new DefaultPlaceRequest(SERVER_MANAGEMENT)));
            finish();
            return;
        }
        specManagementService.call(ignore2 -> {
            notificationEvent.fire(new NotificationEvent(CONSTANTS.DeploySuccessfulAndContainerStarted(), NotificationEvent.NotificationType.SUCCESS).setAutoHide(false).setNavigation(CONSTANTS.ViewDeploymentDetails(), new DefaultPlaceRequest(SERVER_MANAGEMENT)));
            finish();
        }, (o, throwable) -> {
            notificationEvent.fire(new NotificationEvent(CONSTANTS.DeploySuccessfulButContainerFailedToStart(), NotificationEvent.NotificationType.WARNING).setAutoHide(false).setNavigation(CONSTANTS.ViewDeploymentDetails(), new DefaultPlaceRequest(SERVER_MANAGEMENT)));
            finish();
            return false;
        }).startContainer(containerSpec);
    }, (o, throwable) -> {
        notificationEvent.fire(new NotificationEvent(CONSTANTS.DeployFailed(), NotificationEvent.NotificationType.ERROR).setAutoHide(false).setNavigation(CONSTANTS.ViewDeploymentDetails(), new DefaultPlaceRequest(SERVER_MANAGEMENT)));
        finish();
        return false;
    }).saveContainerSpec(context.getServerTemplate().getId(), containerSpec);
}
Also used : ErrorCallback(org.jboss.errai.common.client.api.ErrorCallback) ServerTemplate(org.kie.server.controller.api.model.spec.ServerTemplate) BuildDialog(org.kie.workbench.common.screens.projecteditor.client.build.exec.dialog.BuildDialog) KieServerMode(org.kie.server.api.model.KieServerMode) ServerTemplateList(org.kie.server.controller.api.model.spec.ServerTemplateList) ContainerSpec(org.kie.server.controller.api.model.spec.ContainerSpec) NotificationEvent(org.uberfire.workbench.events.NotificationEvent) CONSTANTS(org.kie.workbench.common.screens.projecteditor.client.resources.ProjectEditorResources.CONSTANTS) BuildExecutionContext(org.kie.workbench.common.screens.projecteditor.client.build.exec.BuildExecutionContext) DefaultPlaceRequest(org.uberfire.mvp.impl.DefaultPlaceRequest) DeploymentPopup(org.kie.workbench.common.screens.projecteditor.client.editor.DeploymentPopup) ERROR(org.uberfire.workbench.events.NotificationEvent.NotificationType.ERROR) SpecManagementService(org.kie.workbench.common.screens.server.management.service.SpecManagementService) BuildService(org.guvnor.common.services.project.builder.service.BuildService) SERVER_MANAGEMENT(org.kie.workbench.common.services.shared.resources.PerspectiveIds.SERVER_MANAGEMENT) Event(javax.enterprise.event.Event) BuildResults(org.guvnor.common.services.project.builder.model.BuildResults) AbstractExecutor(org.kie.workbench.common.screens.projecteditor.client.build.exec.impl.executors.AbstractExecutor) Predicate(java.util.function.Predicate) RemoteCallback(org.jboss.errai.common.client.api.RemoteCallback) Collectors(java.util.stream.Collectors) List(java.util.List) DeploymentMode(org.guvnor.common.services.project.service.DeploymentMode) Message(org.jboss.errai.bus.client.api.messaging.Message) Stream(java.util.stream.Stream) BuildUtils(org.kie.workbench.common.screens.projecteditor.client.build.exec.impl.executors.utils.BuildUtils) SUCCESS(org.uberfire.workbench.events.NotificationEvent.NotificationType.SUCCESS) Caller(org.jboss.errai.common.client.api.Caller) Optional(java.util.Optional) ContextValidator(org.kie.workbench.common.screens.projecteditor.client.build.exec.impl.executors.ContextValidator) Collections(java.util.Collections) NotificationEvent(org.uberfire.workbench.events.NotificationEvent) DefaultPlaceRequest(org.uberfire.mvp.impl.DefaultPlaceRequest)

Example 9 with BuildExecutionContext

use of org.kie.workbench.common.screens.projecteditor.client.build.exec.BuildExecutionContext in project kie-wb-common by kiegroup.

the class BuildExecutor method trigger.

private void trigger(final BuildType buildType) {
    if (projectContext.getActiveModule().isPresent()) {
        Module module = projectContext.getActiveModule().get();
        buildExecutionManager.execute(buildType, new BuildExecutionContext(defaultContainerId(), defaultContainerAlias(), module));
    }
}
Also used : BuildExecutionContext(org.kie.workbench.common.screens.projecteditor.client.build.exec.BuildExecutionContext) Module(org.guvnor.common.services.project.model.Module)

Example 10 with BuildExecutionContext

use of org.kie.workbench.common.screens.projecteditor.client.build.exec.BuildExecutionContext in project kie-wb-common by kiegroup.

the class AbstractExecutorTest method getSnapshotContext.

protected BuildExecutionContext getSnapshotContext() {
    module.getPom().getGav().setVersion(VERSION + SNAPSHOT);
    context = new BuildExecutionContext(ARTIFACT + "_" + VERSION + SNAPSHOT, ARTIFACT, module);
    return context;
}
Also used : BuildExecutionContext(org.kie.workbench.common.screens.projecteditor.client.build.exec.BuildExecutionContext)

Aggregations

BuildExecutionContext (org.kie.workbench.common.screens.projecteditor.client.build.exec.BuildExecutionContext)19 Test (org.junit.Test)14 List (java.util.List)3 Optional (java.util.Optional)3 Event (javax.enterprise.event.Event)3 BuildResults (org.guvnor.common.services.project.builder.model.BuildResults)3 BuildService (org.guvnor.common.services.project.builder.service.BuildService)3 DeploymentMode (org.guvnor.common.services.project.service.DeploymentMode)3 Message (org.jboss.errai.bus.client.api.messaging.Message)3 Caller (org.jboss.errai.common.client.api.Caller)3 ErrorCallback (org.jboss.errai.common.client.api.ErrorCallback)3 RemoteCallback (org.jboss.errai.common.client.api.RemoteCallback)3 KieServerMode (org.kie.server.api.model.KieServerMode)3 ServerTemplate (org.kie.server.controller.api.model.spec.ServerTemplate)3 BuildDialog (org.kie.workbench.common.screens.projecteditor.client.build.exec.dialog.BuildDialog)3 DeploymentPopup (org.kie.workbench.common.screens.projecteditor.client.editor.DeploymentPopup)3 SpecManagementService (org.kie.workbench.common.screens.server.management.service.SpecManagementService)3 NotificationEvent (org.uberfire.workbench.events.NotificationEvent)3 Collections (java.util.Collections)2 Predicate (java.util.function.Predicate)2