Search in sources :

Example 11 with BuildExecutionContext

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

the class DeploymentPopupTest method testSingleTemplate.

@Test
public void testSingleTemplate() {
    context = new BuildExecutionContext(CONTAINER3, CONTAINER3, null);
    context.setServerTemplate(template1);
    DefaultDeploymentPopupDriver driver = new DefaultDeploymentPopupDriver(context, DeploymentPopup.Mode.SINGLE_SERVER, () -> templates, callback, cancelCallback);
    popup.show(driver);
    verify(view).initContainerId(eq(CONTAINER3), eq(true));
    verify(view).initContainerAlias(eq(CONTAINER3), eq(true));
    verify(view).initStartContainer(eq(true), eq(true));
    verify(view, never()).initServerTemplates(any(), any());
    verify(view).disableServerTemplates();
    initViewWithValues(context.getContainerId(), context.getContainerAlias(), context.isStartContainer(), template1.getId());
    popup.onOk();
    verify(view).clearValidations();
    verify(view).hide();
    verify(callback).execute();
}
Also used : BuildExecutionContext(org.kie.workbench.common.screens.projecteditor.client.build.exec.BuildExecutionContext) Test(org.junit.Test)

Example 12 with BuildExecutionContext

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

the class DeploymentPopupTest method testMultipleTemplate.

@Test
public void testMultipleTemplate() {
    context = new BuildExecutionContext(CONTAINER3, CONTAINER3, null);
    context.setServerTemplate(template1);
    DefaultDeploymentPopupDriver driver = new DefaultDeploymentPopupDriver(context, DeploymentPopup.Mode.MULTIPLE_SERVER, () -> templates, callback, cancelCallback);
    popup.show(driver);
    verify(view).initContainerId(eq(CONTAINER3), eq(true));
    verify(view).initContainerAlias(eq(CONTAINER3), eq(true));
    verify(view).initStartContainer(eq(true), eq(true));
    verify(view).initServerTemplates(any(), any());
    verify(view, never()).disableServerTemplates();
    initViewWithValues(context.getContainerId(), context.getContainerAlias(), context.isStartContainer(), template1.getId());
    popup.onOk();
    verify(view).clearValidations();
    verify(view).hide();
    verify(callback).execute();
}
Also used : BuildExecutionContext(org.kie.workbench.common.screens.projecteditor.client.build.exec.BuildExecutionContext) Test(org.junit.Test)

Example 13 with BuildExecutionContext

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

the class DeploymentPopupTest method testSingleTemplateWithValidationFailure.

@Test
public void testSingleTemplateWithValidationFailure() {
    context = new BuildExecutionContext(CONTAINER3, CONTAINER3, null);
    context.setServerTemplate(template1);
    DefaultDeploymentPopupDriver driver = new DefaultDeploymentPopupDriver(context, DeploymentPopup.Mode.SINGLE_SERVER, () -> templates, callback, cancelCallback);
    popup.show(driver);
    verify(view).initContainerId(eq(CONTAINER3), eq(true));
    verify(view).initContainerAlias(eq(CONTAINER3), eq(true));
    verify(view).initStartContainer(eq(true), eq(true));
    verify(view, never()).initServerTemplates(any(), any());
    verify(view).disableServerTemplates();
    popup.onOk();
    verify(view).clearValidations();
    verify(view).invalidateContainerId(any());
    verify(view).invalidateContainerAlias(any());
    verify(view, never()).hide();
    verify(callback, never()).execute();
}
Also used : BuildExecutionContext(org.kie.workbench.common.screens.projecteditor.client.build.exec.BuildExecutionContext) Test(org.junit.Test)

Example 14 with BuildExecutionContext

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

the class SnapshotBuildAndDeployExecutor method buildDeployWithMultipleServerTemplates.

@Override
void buildDeployWithMultipleServerTemplates(BuildExecutionContext context, List<ServerTemplate> serverTemplates) {
    GAV gav = context.getModule().getPom().getGav();
    Optional<SnapshotDeployment> optional = settings.getDeployment(gav.getGroupId(), gav.getArtifactId());
    if (optional.isPresent()) {
        SnapshotDeployment previousDeployment = optional.get();
        Optional<ServerTemplate> serverOptional = serverTemplates.stream().filter(s -> s.getId().equals(previousDeployment.getServer())).findFirst();
        if (serverOptional.isPresent()) {
            buildDeployWithOneServerTemplate(context, serverOptional.get());
            return;
        }
    }
    context.setServerTemplate(serverTemplates.get(0));
    deploymentPopup.show(new DefaultDeploymentPopupDriver(context, DeploymentPopup.Mode.MULTIPLE_SERVER_FORCED, () -> serverTemplates, () -> buildDeployWithOneServerTemplate(context, context.getServerTemplate()), () -> finish()));
}
Also used : Event(javax.enterprise.event.Event) SnapshotDeploymentSettings(org.kie.workbench.common.screens.projecteditor.build.exec.SnapshotDeploymentSettings) BuildResults(org.guvnor.common.services.project.builder.model.BuildResults) ErrorCallback(org.jboss.errai.common.client.api.ErrorCallback) ServerTemplate(org.kie.server.controller.api.model.spec.ServerTemplate) DefaultDeploymentPopupDriver(org.kie.workbench.common.screens.projecteditor.client.editor.DefaultDeploymentPopupDriver) GAV(org.guvnor.common.services.project.model.GAV) BuildDialog(org.kie.workbench.common.screens.projecteditor.client.build.exec.dialog.BuildDialog) KieServerMode(org.kie.server.api.model.KieServerMode) SnapshotDeployment(org.kie.workbench.common.screens.projecteditor.build.exec.SnapshotDeployment) RemoteCallback(org.jboss.errai.common.client.api.RemoteCallback) NotificationEvent(org.uberfire.workbench.events.NotificationEvent) BuildExecutionContext(org.kie.workbench.common.screens.projecteditor.client.build.exec.BuildExecutionContext) DeploymentPopup(org.kie.workbench.common.screens.projecteditor.client.editor.DeploymentPopup) List(java.util.List) DeploymentMode(org.guvnor.common.services.project.service.DeploymentMode) Message(org.jboss.errai.bus.client.api.messaging.Message) Caller(org.jboss.errai.common.client.api.Caller) SnapshotContextValidator(org.kie.workbench.common.screens.projecteditor.client.build.exec.impl.executors.validators.SnapshotContextValidator) Optional(java.util.Optional) SpecManagementService(org.kie.workbench.common.screens.server.management.service.SpecManagementService) BuildService(org.guvnor.common.services.project.builder.service.BuildService) SnapshotDeployment(org.kie.workbench.common.screens.projecteditor.build.exec.SnapshotDeployment) ServerTemplate(org.kie.server.controller.api.model.spec.ServerTemplate) DefaultDeploymentPopupDriver(org.kie.workbench.common.screens.projecteditor.client.editor.DefaultDeploymentPopupDriver) GAV(org.guvnor.common.services.project.model.GAV)

Example 15 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 testSnapshotBuild.

@Test
public void testSnapshotBuild() {
    module.getPom().getGav().setVersion(VERSION + SNAPSHOT);
    buildExecutor.triggerBuild();
    verify(buildExecutionManager).execute(eq(BuildType.BUILD), 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)

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