use of org.kie.server.controller.api.model.runtime.ContainerList in project kie-wb-common by kiegroup.
the class RuntimeManagementServiceCDI method getContainersByContainerSpec.
@Override
public ContainerSpecData getContainersByContainerSpec(final String serverTemplateId, final String containerSpecId) {
final ServerTemplate serverTemplate = specManagementService.getServerTemplate(serverTemplateId);
if (serverTemplate == null) {
throw new RuntimeException("Server template with id " + serverTemplateId + " not found");
}
final ContainerSpec containerSpec = serverTemplate.getContainerSpec(containerSpecId);
if (containerSpec == null) {
throw new RuntimeException("Container with id " + containerSpecId + " not found");
}
final ContainerList containerList = service.getContainers(serverTemplate, containerSpec);
final List<Container> containers = Arrays.asList(containerList.getContainers());
return new ContainerSpecData(containerSpec, containers);
}
use of org.kie.server.controller.api.model.runtime.ContainerList 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);
final ServerInstanceKeyList instances = client.getServerInstances(serverTemplateList.getServerTemplates()[0].getId());
assertNotNull(instances);
assertEquals(1, instances.getServerInstanceKeys().length);
final ServerTemplate serverTemplate = serverTemplateList.getServerTemplates()[0];
// Deploy container for kie server instance.
ContainerSpec containerToDeploy = new ContainerSpec(CONTAINER_ID, CONTAINER_NAME, serverTemplate, RELEASE_ID, KieContainerStatus.STARTED, new HashMap());
client.saveContainerSpec(serverTemplate.getId(), containerToDeploy);
ContainerList containers = client.getContainers(instances.getServerInstanceKeys()[0]);
assertNotNull(containers);
assertEquals(1, containers.getContainers().length);
client.deleteContainerSpec(serverTemplate.getId(), containerToDeploy.getId());
containers = client.getContainers(instances.getServerInstanceKeys()[0]);
assertNotNull(containers);
assertEquals(0, containers.getContainers().length);
} finally {
if (client != null) {
try {
client.close();
} catch (IOException ex) {
LOGGER.warn("Error trying to close client connection: {}", ex.getMessage(), ex);
}
}
}
}
Aggregations