Search in sources :

Example 1 with ServerTemplateList

use of org.kie.server.controller.api.model.spec.ServerTemplateList in project kie-wb-common by kiegroup.

the class AbstractControllerIT method testSpecManagementService.

@Test
@OperateOnDeployment("workbench")
public void testSpecManagementService() throws Exception {
    final ServerTemplateList serverTemplateList = specManagementService.listServerTemplates();
    assertServerTemplateList(serverTemplateList);
}
Also used : ServerTemplateList(org.kie.server.controller.api.model.spec.ServerTemplateList) OperateOnDeployment(org.jboss.arquillian.container.test.api.OperateOnDeployment) Test(org.junit.Test)

Example 2 with ServerTemplateList

use of org.kie.server.controller.api.model.spec.ServerTemplateList in project kie-wb-common by kiegroup.

the class EmbeddedControllerIT method testEmbeddedEndpoints.

protected void testEmbeddedEndpoints(final KieServerControllerClient client) {
    try {
        final ServerTemplateList serverTemplateList = client.listServerTemplates();
        assertServerTemplateList(serverTemplateList);
    } finally {
        if (client != null) {
            try {
                client.close();
            } catch (IOException ex) {
                LOGGER.warn("Error trying to close client connection: {}", ex.getMessage(), ex);
            }
        }
    }
}
Also used : ServerTemplateList(org.kie.server.controller.api.model.spec.ServerTemplateList) IOException(java.io.IOException)

Example 3 with ServerTemplateList

use of org.kie.server.controller.api.model.spec.ServerTemplateList in project kie-wb-common by kiegroup.

the class BuildExecutorTest method testBuildAndDeployCommandSingleServerTemplateContainerExists.

@Test
public void testBuildAndDeployCommandSingleServerTemplateContainerExists() {
    final String containerId = module.getPom().getGav().getArtifactId() + "_" + module.getPom().getGav().getVersion();
    final String containerName = module.getPom().getGav().getArtifactId();
    final ServerTemplate serverTemplate = new ServerTemplate("id", "name");
    serverTemplate.addContainerSpec(new ContainerSpec(containerId, containerName, null, null, null, null));
    when(specManagementServiceMock.listServerTemplates()).thenReturn(new ServerTemplateList(Collections.singletonList(serverTemplate)));
    buildExecutor.triggerBuildAndDeploy();
    verify(deploymentScreenPopupView).setValidateExistingContainerCallback(any(DeploymentScreenPopupViewImpl.ValidateExistingContainerCallback.class));
    verify(deploymentScreenPopupView).setContainerId(containerId);
    verify(deploymentScreenPopupView).setContainerAlias(containerName);
    verify(deploymentScreenPopupView).setStartContainer(true);
    verify(deploymentScreenPopupView).configure(any(com.google.gwt.user.client.Command.class));
    verify(deploymentScreenPopupView).show();
    verifyNoMoreInteractions(deploymentScreenPopupView);
}
Also used : ServerTemplate(org.kie.server.controller.api.model.spec.ServerTemplate) Command(org.uberfire.mvp.Command) ServerTemplateList(org.kie.server.controller.api.model.spec.ServerTemplateList) ContainerSpec(org.kie.server.controller.api.model.spec.ContainerSpec) Matchers.anyString(org.mockito.Matchers.anyString) Test(org.junit.Test)

Example 4 with ServerTemplateList

use of org.kie.server.controller.api.model.spec.ServerTemplateList in project kie-wb-common by kiegroup.

the class BuildExecutorTest method testBuildAndDeployCommandMultipleServerTemplate.

@Test
public void testBuildAndDeployCommandMultipleServerTemplate() {
    final String containerId = module.getPom().getGav().getArtifactId() + "_" + module.getPom().getGav().getVersion();
    final String containerName = module.getPom().getGav().getArtifactId();
    final ServerTemplate serverTemplate1 = new ServerTemplate("id1", "name1");
    final ServerTemplate serverTemplate2 = new ServerTemplate("id2", "name2");
    when(specManagementServiceMock.listServerTemplates()).thenReturn(new ServerTemplateList(Arrays.asList(serverTemplate1, serverTemplate2)));
    buildExecutor.triggerBuildAndDeploy();
    verify(deploymentScreenPopupView).setValidateExistingContainerCallback(any(DeploymentScreenPopupViewImpl.ValidateExistingContainerCallback.class));
    verify(deploymentScreenPopupView).setContainerId(containerId);
    verify(deploymentScreenPopupView).setContainerAlias(containerName);
    verify(deploymentScreenPopupView).setStartContainer(true);
    verify(deploymentScreenPopupView).addServerTemplates(eq(Sets.newHashSet("id1", "id2")));
    verify(deploymentScreenPopupView).configure(any(com.google.gwt.user.client.Command.class));
    verify(deploymentScreenPopupView).show();
    verifyNoMoreInteractions(deploymentScreenPopupView);
}
Also used : ServerTemplate(org.kie.server.controller.api.model.spec.ServerTemplate) Command(org.uberfire.mvp.Command) ServerTemplateList(org.kie.server.controller.api.model.spec.ServerTemplateList) Matchers.anyString(org.mockito.Matchers.anyString) Test(org.junit.Test)

Example 5 with ServerTemplateList

use of org.kie.server.controller.api.model.spec.ServerTemplateList in project kie-wb-common by kiegroup.

the class BuildExecutorTest method testBuildAndDeployCommandSingleServerTemplate.

@Test
public void testBuildAndDeployCommandSingleServerTemplate() {
    final ServerTemplate serverTemplate = new ServerTemplate("id", "name");
    when(specManagementServiceMock.listServerTemplates()).thenReturn(new ServerTemplateList(Collections.singletonList(serverTemplate)));
    buildExecutor.triggerBuildAndDeploy();
    ArgumentCaptor<ContainerSpec> containerSpecArgumentCaptor = ArgumentCaptor.forClass(ContainerSpec.class);
    verify(specManagementServiceMock).saveContainerSpec(eq(serverTemplate.getId()), containerSpecArgumentCaptor.capture());
    final ContainerSpec containerSpec = containerSpecArgumentCaptor.getValue();
    assertEquals(module.getPom().getGav().getArtifactId(), containerSpec.getContainerName());
    verifyNotification(ProjectEditorResources.CONSTANTS.BuildSuccessful(), NotificationEvent.NotificationType.SUCCESS);
    verifyNotification(ProjectEditorResources.CONSTANTS.DeploySuccessful(), NotificationEvent.NotificationType.SUCCESS);
    verify(notificationEvent, times(2)).fire(any(NotificationEvent.class));
    verifyBusyShowHideAnyString(1, 1);
}
Also used : ServerTemplate(org.kie.server.controller.api.model.spec.ServerTemplate) ServerTemplateList(org.kie.server.controller.api.model.spec.ServerTemplateList) ContainerSpec(org.kie.server.controller.api.model.spec.ContainerSpec) NotificationEvent(org.uberfire.workbench.events.NotificationEvent) Test(org.junit.Test)

Aggregations

ServerTemplateList (org.kie.server.controller.api.model.spec.ServerTemplateList)5 Test (org.junit.Test)4 ServerTemplate (org.kie.server.controller.api.model.spec.ServerTemplate)3 ContainerSpec (org.kie.server.controller.api.model.spec.ContainerSpec)2 Matchers.anyString (org.mockito.Matchers.anyString)2 Command (org.uberfire.mvp.Command)2 IOException (java.io.IOException)1 OperateOnDeployment (org.jboss.arquillian.container.test.api.OperateOnDeployment)1 NotificationEvent (org.uberfire.workbench.events.NotificationEvent)1