use of org.kie.server.controller.client.exception.KieServerControllerClientException in project droolsjbpm-integration by kiegroup.
the class KieControllerManagementIntegrationTest method testEmptyListContainers.
@Test
public void testEmptyListContainers() {
try {
controllerClient.listContainerSpec(kieServerInfo.getServerId());
fail("Should throw exception about server template not existing.");
} catch (KieServerControllerClientException e) {
assertNotFoundException((T) e);
assertThat(e.getMessage()).endsWith("No server template found for id " + kieServerInfo.getServerId());
}
// Create kie server instance connection in controller.
createServerTemplate();
ContainerSpecList emptyList = controllerClient.listContainerSpec(kieServerInfo.getServerId());
KieServerAssert.assertNullOrEmpty("Active containers found!", emptyList.getContainerSpecs());
}
use of org.kie.server.controller.client.exception.KieServerControllerClientException in project droolsjbpm-integration by kiegroup.
the class KieControllerManagementIntegrationTest method testUpdateContainerId.
@Test
public void testUpdateContainerId() {
// Create kie server instance connection in controller.
ServerTemplate serverTemplate = createServerTemplate();
// Deploy container for kie server instance.
ContainerSpec containerToDeploy = new ContainerSpec(CONTAINER_ID, CONTAINER_NAME, serverTemplate, RELEASE_ID, KieContainerStatus.STOPPED, Collections.EMPTY_MAP);
controllerClient.saveContainerSpec(serverTemplate.getId(), containerToDeploy);
// Get container using kie controller.
ContainerSpec containerResponseEntity = controllerClient.getContainerInfo(kieServerInfo.getServerId(), CONTAINER_ID);
checkContainer(containerResponseEntity, KieContainerStatus.STOPPED);
assertEquals(CONTAINER_NAME, containerResponseEntity.getContainerName());
containerToDeploy.setId("newID");
try {
controllerClient.updateContainerSpec(serverTemplate.getId(), CONTAINER_ID, containerToDeploy);
fail("Container has updated id.");
} catch (KieServerControllerClientException e) {
assertBadRequestException((T) e);
KieServerAssert.assertResultContainsString(e.getMessage(), "Cannot update container newID on container " + CONTAINER_ID);
}
}
use of org.kie.server.controller.client.exception.KieServerControllerClientException in project droolsjbpm-integration by kiegroup.
the class KieControllerManagementIntegrationTest method testStartNotExistingContainer.
@Test
public void testStartNotExistingContainer() throws Exception {
ContainerSpec containerSpec = new ContainerSpec();
containerSpec.setId(CONTAINER_ID);
containerSpec.setServerTemplateKey(new ServerTemplateKey(kieServerInfo.getServerId(), null));
// Try to start not existing container using kie controller without created kie server instance.
try {
controllerClient.startContainer(containerSpec);
fail("Should throw exception about server template not found.");
} catch (KieServerControllerClientException e) {
assertNotFoundException((T) e);
assertThat(e.getMessage()).endsWith("No server template found for id " + kieServerInfo.getServerId());
}
createServerTemplate();
// Try to start not existing container using kie controller with created kie server instance.
try {
controllerClient.startContainer(containerSpec);
fail("Should throw exception about container not found.");
} catch (KieServerControllerClientException e) {
assertNotFoundException((T) e);
assertThat(e.getMessage()).endsWith("No container spec found for id " + CONTAINER_ID + " within server template with id " + kieServerInfo.getServerId());
}
}
use of org.kie.server.controller.client.exception.KieServerControllerClientException in project droolsjbpm-integration by kiegroup.
the class KieControllerManagementIntegrationTest method testCreateDuplicitContainer.
@Test
public void testCreateDuplicitContainer() {
// Create kie server instance connection in controller.
ServerTemplate serverTemplate = createServerTemplate();
// Deploy container for kie server instance.
ContainerSpec containerToDeploy = new ContainerSpec(CONTAINER_ID, CONTAINER_NAME, serverTemplate, RELEASE_ID, KieContainerStatus.STOPPED, new HashMap());
controllerClient.saveContainerSpec(serverTemplate.getId(), containerToDeploy);
try {
// Try to create same container.
controllerClient.saveContainerSpec(serverTemplate.getId(), containerToDeploy);
fail("Should throw exception about container being created already.");
} catch (KieServerControllerClientException e) {
assertBadRequestException((T) e);
assertThat(e.getMessage()).endsWith("Server template with id " + serverTemplate.getId() + " associated already with container " + CONTAINER_ID);
}
}
use of org.kie.server.controller.client.exception.KieServerControllerClientException in project droolsjbpm-integration by kiegroup.
the class KieControllerManagementIntegrationTest method testCreateContainerByUpdateContainer.
@Test
public void testCreateContainerByUpdateContainer() {
// Create kie server instance connection in controller.
ServerTemplate serverTemplate = createServerTemplate();
// Deploy container for kie server instance.
ContainerSpec containerToDeploy = new ContainerSpec(CONTAINER_ID, CONTAINER_NAME, serverTemplate, RELEASE_ID, KieContainerStatus.STOPPED, Collections.EMPTY_MAP);
try {
controllerClient.updateContainerSpec(serverTemplate.getId(), containerToDeploy);
fail("Container was created by update command - REST Post method.");
} catch (KieServerControllerClientException e) {
assertNotFoundException((T) e);
}
KieServerAssert.assertNullOrEmpty("Found deployed container.", controllerClient.listContainerSpec(serverTemplate.getId()).getContainerSpecs());
}
Aggregations