@Test public void testCallRemoteKieServerOperationWhenContainerSpecIsNull() { final List<Container> containers = instanceManager.callRemoteKieServerOperation(serverTemplate, null, operation); assertTrue(containers.isEmpty()); }
protected List<Container> callRemoteKieServerOperation(ServerTemplate serverTemplate, ContainerSpec containerSpec, RemoteKieServerOperation operation) { List<Container> containers = new ArrayList<org.kie.server.controller.api.model.runtime.Container>(); if (serverTemplate.getServerInstanceKeys() == null || serverTemplate.getServerInstanceKeys().isEmpty() || containerSpec == null) { return containers; } for (ServerInstanceKey instanceUrl : serverTemplate.getServerInstanceKeys()) { Container container = new Container(); container.setContainerSpecId(containerSpec.getId()); container.setServerTemplateId(serverTemplate.getId()); container.setServerInstanceId(instanceUrl.getServerInstanceId()); container.setUrl(instanceUrl.getUrl() + "/containers/" + containerSpec.getId()); container.setStatus(containerSpec.getStatus()); try { final KieServicesClient client = getClient(instanceUrl.getUrl()); operation.doOperation(client, container); containers.add(container); } catch (Exception e) { logger.debug("Unable to connect to {}", instanceUrl); } } return containers; }
KieServerInstanceManager { protected List<Container> callRemoteKieServerOperation(ServerTemplate serverTemplate, ContainerSpec containerSpec, RemoteKieServerOperation operation) { List<Container> containers = new ArrayList<org.kie.server.controller.api.model.runtime.Container>(); if (serverTemplate.getServerInstanceKeys() == null || serverTemplate.getServerInstanceKeys().isEmpty() || containerSpec == null) { return containers; } for (ServerInstanceKey instanceUrl : serverTemplate.getServerInstanceKeys()) { Container container = new Container(); container.setContainerSpecId(containerSpec.getId()); container.setServerTemplateId(serverTemplate.getId()); container.setServerInstanceId(instanceUrl.getServerInstanceId()); container.setUrl(instanceUrl.getUrl() + "/containers/" + containerSpec.getId()); container.setStatus(containerSpec.getStatus()); try { final KieServicesClient client = getClient(instanceUrl.getUrl()); operation.doOperation(client, container); containers.add(container); } catch (Exception e) { logger.debug("Unable to connect to {}", instanceUrl); } } return containers; } }
KieServerInstanceManager { protected List<Container> callRemoteKieServerOperation(ServerTemplate serverTemplate, ContainerSpec containerSpec, RemoteKieServerOperation operation) { List<Container> containers = new ArrayList<org.kie.server.controller.api.model.runtime.Container>(); if (serverTemplate.getServerInstanceKeys() == null || serverTemplate.getServerInstanceKeys().isEmpty() || containerSpec == null) { return containers; } for (ServerInstanceKey instanceUrl : serverTemplate.getServerInstanceKeys()) { Container container = new Container(); container.setContainerSpecId(containerSpec.getId()); container.setServerTemplateId(serverTemplate.getId()); container.setServerInstanceId(instanceUrl.getServerInstanceId()); container.setUrl(instanceUrl.getUrl() + "/containers/" + containerSpec.getId()); container.setStatus(containerSpec.getStatus()); try { final KieServicesClient client = getClient(instanceUrl.getUrl()); operation.doOperation(client, container); containers.add(container); } catch (Exception e) { logger.debug("Unable to connect to {}", instanceUrl); } } return containers; } KieServerInstanceManager(); }
KieServerInstanceManager { protected List<Container> callRemoteKieServerOperation(ServerTemplate serverTemplate, ContainerSpec containerSpec, RemoteKieServerOperation operation) { List<Container> containers = new ArrayList<org.kie.server.controller.api.model.runtime.Container>(); if (serverTemplate.getServerInstanceKeys() == null || serverTemplate.getServerInstanceKeys().isEmpty() || containerSpec == null) { return containers; } for (ServerInstanceKey instanceUrl : serverTemplate.getServerInstanceKeys()) { Container container = new Container(); container.setContainerSpecId(containerSpec.getId()); container.setServerTemplateId(serverTemplate.getId()); container.setServerInstanceId(instanceUrl.getServerInstanceId()); container.setUrl(instanceUrl.getUrl() + "/containers/" + containerSpec.getId()); container.setStatus(containerSpec.getStatus()); try { final KieServicesClient client = getClient(instanceUrl.getUrl()); operation.doOperation(client, container); containers.add(container); } catch (Exception e) { logger.debug("Unable to connect to {}", instanceUrl); } } return containers; } KieServerInstanceManager(); static KieServerInstanceManager getInstance(); List<Container> startScanner(ServerTemplate serverTemplate,
                                        final ContainerSpec containerSpec,
                                        final long interval); List<Container> stopScanner(ServerTemplate serverTemplate,
                                       final ContainerSpec containerSpec); List<Container> scanNow(ServerTemplate serverTemplate,
                                   final ContainerSpec containerSpec); synchronized List<Container> startContainer(final ServerTemplate serverTemplate,
                                                       final ContainerSpec containerSpec); synchronized List<Container> stopContainer(ServerTemplate serverTemplate,
                                                      final ContainerSpec containerSpec); List<Container> upgradeContainer(final ServerTemplate serverTemplate,
                                            final ContainerSpec containerSpec); List<Container> upgradeContainer(final ServerTemplate serverTemplate,
                                            final ContainerSpec containerSpec,
                                            final boolean resetBeforeUpdate); List<Container> upgradeAndStartContainer(final ServerTemplate serverTemplate,
                                                    final ContainerSpec containerSpec); List<Container> upgradeAndStartContainer(final ServerTemplate serverTemplate,
                                                    final ContainerSpec containerSpec,
                                                    final boolean resetBeforeUpdate); List<Container> getContainers(final ServerTemplate serverTemplate,
                                         final ContainerSpec containerSpec); List<Container> getContainers(ServerInstanceKey serverInstanceKey); synchronized List<Container> activateContainer(final ServerTemplate serverTemplate, final ContainerSpec containerSpec); synchronized List<Container> deactivateContainer(final ServerTemplate serverTemplate, final ContainerSpec containerSpec); boolean isAlive(ServerInstanceKey serverInstanceKey); }
KieServerInstanceManager { protected List<Container> callRemoteKieServerOperation(ServerTemplate serverTemplate, ContainerSpec containerSpec, RemoteKieServerOperation operation) { List<Container> containers = new ArrayList<org.kie.server.controller.api.model.runtime.Container>(); if (serverTemplate.getServerInstanceKeys() == null || serverTemplate.getServerInstanceKeys().isEmpty() || containerSpec == null) { return containers; } for (ServerInstanceKey instanceUrl : serverTemplate.getServerInstanceKeys()) { Container container = new Container(); container.setContainerSpecId(containerSpec.getId()); container.setServerTemplateId(serverTemplate.getId()); container.setServerInstanceId(instanceUrl.getServerInstanceId()); container.setUrl(instanceUrl.getUrl() + "/containers/" + containerSpec.getId()); container.setStatus(containerSpec.getStatus()); try { final KieServicesClient client = getClient(instanceUrl.getUrl()); operation.doOperation(client, container); containers.add(container); } catch (Exception e) { logger.debug("Unable to connect to {}", instanceUrl); } } return containers; } KieServerInstanceManager(); static KieServerInstanceManager getInstance(); List<Container> startScanner(ServerTemplate serverTemplate,
                                        final ContainerSpec containerSpec,
                                        final long interval); List<Container> stopScanner(ServerTemplate serverTemplate,
                                       final ContainerSpec containerSpec); List<Container> scanNow(ServerTemplate serverTemplate,
                                   final ContainerSpec containerSpec); synchronized List<Container> startContainer(final ServerTemplate serverTemplate,
                                                       final ContainerSpec containerSpec); synchronized List<Container> stopContainer(ServerTemplate serverTemplate,
                                                      final ContainerSpec containerSpec); List<Container> upgradeContainer(final ServerTemplate serverTemplate,
                                            final ContainerSpec containerSpec); List<Container> upgradeContainer(final ServerTemplate serverTemplate,
                                            final ContainerSpec containerSpec,
                                            final boolean resetBeforeUpdate); List<Container> upgradeAndStartContainer(final ServerTemplate serverTemplate,
                                                    final ContainerSpec containerSpec); List<Container> upgradeAndStartContainer(final ServerTemplate serverTemplate,
                                                    final ContainerSpec containerSpec,
                                                    final boolean resetBeforeUpdate); List<Container> getContainers(final ServerTemplate serverTemplate,
                                         final ContainerSpec containerSpec); List<Container> getContainers(ServerInstanceKey serverInstanceKey); synchronized List<Container> activateContainer(final ServerTemplate serverTemplate, final ContainerSpec containerSpec); synchronized List<Container> deactivateContainer(final ServerTemplate serverTemplate, final ContainerSpec containerSpec); boolean isAlive(ServerInstanceKey serverInstanceKey);  }