Search in sources :

Example 1 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 testOnCancel.

@Test
public void testOnCancel() {
    context = new BuildExecutionContext(CONTAINER1, CONTAINER1, null);
    context.setServerTemplate(template1);
    DefaultDeploymentPopupDriver driver = new DefaultDeploymentPopupDriver(context, DeploymentPopup.Mode.MULTIPLE_SERVER_FORCED, () -> templates, callback, cancelCallback);
    popup.show(driver);
    popup.onCancel();
    verify(view).hide();
    verify(cancelCallback).execute();
}
Also used : BuildExecutionContext(org.kie.workbench.common.screens.projecteditor.client.build.exec.BuildExecutionContext) Test(org.junit.Test)

Example 2 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 testMultipleTemplateWithValidationFailure.

@Test
public void testMultipleTemplateWithValidationFailure() {
    context = new BuildExecutionContext(CONTAINER1, CONTAINER1, null);
    context.setServerTemplate(template1);
    DefaultDeploymentPopupDriver driver = new DefaultDeploymentPopupDriver(context, DeploymentPopup.Mode.MULTIPLE_SERVER, () -> templates, callback, cancelCallback);
    popup.show(driver);
    verify(view).initContainerId(eq(CONTAINER1), eq(true));
    verify(view).initContainerAlias(eq(CONTAINER1), eq(true));
    verify(view).initStartContainer(eq(true), eq(true));
    verify(view).initServerTemplates(any(), any());
    verify(view, never()).disableServerTemplates();
    initViewWithValues(CONTAINER1, null, context.isStartContainer(), TEMPLATE1_ID);
    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 3 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 testMultipleForcedTemplateWithValidationFailure.

@Test
public void testMultipleForcedTemplateWithValidationFailure() {
    context = new BuildExecutionContext(CONTAINER1, CONTAINER1, null);
    context.setServerTemplate(template1);
    DefaultDeploymentPopupDriver driver = new DefaultDeploymentPopupDriver(context, DeploymentPopup.Mode.MULTIPLE_SERVER_FORCED, () -> templates, callback, cancelCallback);
    popup.show(driver);
    verify(view).initContainerId(eq(CONTAINER1), eq(false));
    verify(view).initContainerAlias(eq(CONTAINER1), eq(false));
    verify(view).initStartContainer(eq(true), eq(false));
    verify(view).initServerTemplates(any(), any());
    verify(view, never()).disableServerTemplates();
    initViewWithValues(CONTAINER1, CONTAINER1, context.isStartContainer(), null);
    popup.onOk();
    verify(view).clearValidations();
    verify(view).invalidateContainerServerTemplate(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 4 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 testMultipleForcedTemplate.

@Test
public void testMultipleForcedTemplate() {
    context = new BuildExecutionContext(CONTAINER3, CONTAINER3, null);
    context.setServerTemplate(template1);
    DefaultDeploymentPopupDriver driver = new DefaultDeploymentPopupDriver(context, DeploymentPopup.Mode.MULTIPLE_SERVER_FORCED, () -> templates, callback, cancelCallback);
    popup.show(driver);
    verify(view).initContainerId(eq(CONTAINER3), eq(false));
    verify(view).initContainerAlias(eq(CONTAINER3), eq(false));
    verify(view).initStartContainer(eq(true), eq(false));
    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 5 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 testDefaultBuild.

@Test
public void testDefaultBuild() {
    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