Search in sources :

Example 16 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 testDefaultBuildAndDeploy.

@Test
public void testDefaultBuildAndDeploy() {
    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 17 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 testSnapshotRedeploy.

@Test
public void testSnapshotRedeploy() {
    module.getPom().getGav().setVersion(VERSION + SNAPSHOT);
    buildExecutor.triggerRedeploy();
    verify(buildExecutionManager).execute(eq(BuildType.REDEPLOY), 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 18 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 testSnapshotInstall.

@Test
public void testSnapshotInstall() {
    module.getPom().getGav().setVersion(VERSION + SNAPSHOT);
    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 19 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 updateContainerSpec.

protected void updateContainerSpec(final BuildExecutionContext context, final ContainerSpec containerSpec) {
    ServerTemplate serverTemplate = context.getServerTemplate();
    if (serverTemplate.getMode().equals(KieServerMode.DEVELOPMENT)) {
        containerSpec.setStatus(serverTemplate.getContainerSpec(containerSpec.getId()).getStatus());
        specManagementService.call(ignore -> {
            notifyUpdateSuccess();
        }, (o, throwable) -> {
            notifyUpdateError();
            return false;
        }).updateContainerSpec(context.getServerTemplate().getId(), containerSpec);
    } else {
        notificationEvent.fire(new NotificationEvent(CONSTANTS.DeploymentSkippedCannotUpdateDeploymentsOnProduction(), ERROR).setAutoHide(false).setNavigation(CONSTANTS.ViewDeploymentDetails(), new DefaultPlaceRequest(SERVER_MANAGEMENT)));
        finish();
    }
}
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) ServerTemplate(org.kie.server.controller.api.model.spec.ServerTemplate) NotificationEvent(org.uberfire.workbench.events.NotificationEvent) DefaultPlaceRequest(org.uberfire.mvp.impl.DefaultPlaceRequest)

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