@Test public void testInstallAndStartMonitoringThrowsException() throws Exception { given(gatewayConfigService.getAllGatewayConfigs(any(Stack.class))).willReturn(null); doThrow(new CloudbreakOrchestratorFailedException("error")).when(telemetryOrchestrator).installAndStartMonitoring( anyList(), anySet(), any(ExitCriteriaModel.class)); underTest.installAndStartMonitoring(createStack(), createTelemetry()); verify(gatewayConfigService, times(1)).getAllGatewayConfigs(any(Stack.class)); }
public void installAndStartMonitoring(Stack stack, Telemetry telemetry) throws CloudbreakException { if (telemetry != null && telemetry.isMonitoringFeatureEnabled()) { try { LOGGER.info("Install and start monitoring for CM server."); Set<InstanceMetaData> instanceMetaDataSet = stack.getNotDeletedInstanceMetaDataSet(); List<GatewayConfig> gatewayConfigs = gatewayConfigService.getAllGatewayConfigs(stack); Set<Node> allNodes = instanceMetaDataSet.stream() .map(im -> new Node(im.getPrivateIp(), im.getPublicIp(), im.getInstanceId(), im.getInstanceGroup().getTemplate().getInstanceType(), im.getDiscoveryFQDN(), im.getInstanceGroup().getGroupName())) .collect(Collectors.toSet()); telemetryOrchestrator.installAndStartMonitoring(gatewayConfigs, allNodes, clusterDeletionBasedModel(stack.getId(), stack.getCluster().getId())); } catch (CloudbreakOrchestratorFailedException ex) { throw new CloudbreakException(ex); } } }
ClusterMonitoringEngine { public void installAndStartMonitoring(Stack stack, Telemetry telemetry) throws CloudbreakException { if (telemetry != null && telemetry.isMonitoringFeatureEnabled()) { try { LOGGER.info("Install and start monitoring for CM server."); Set<InstanceMetaData> instanceMetaDataSet = stack.getNotDeletedInstanceMetaDataSet(); List<GatewayConfig> gatewayConfigs = gatewayConfigService.getAllGatewayConfigs(stack); Set<Node> allNodes = instanceMetaDataSet.stream() .map(im -> new Node(im.getPrivateIp(), im.getPublicIp(), im.getInstanceId(), im.getInstanceGroup().getTemplate().getInstanceType(), im.getDiscoveryFQDN(), im.getInstanceGroup().getGroupName())) .collect(Collectors.toSet()); telemetryOrchestrator.installAndStartMonitoring(gatewayConfigs, allNodes, clusterDeletionBasedModel(stack.getId(), stack.getCluster().getId())); } catch (CloudbreakOrchestratorFailedException ex) { throw new CloudbreakException(ex); } } } }
ClusterMonitoringEngine { public void installAndStartMonitoring(Stack stack, Telemetry telemetry) throws CloudbreakException { if (telemetry != null && telemetry.isMonitoringFeatureEnabled()) { try { LOGGER.info("Install and start monitoring for CM server."); Set<InstanceMetaData> instanceMetaDataSet = stack.getNotDeletedInstanceMetaDataSet(); List<GatewayConfig> gatewayConfigs = gatewayConfigService.getAllGatewayConfigs(stack); Set<Node> allNodes = instanceMetaDataSet.stream() .map(im -> new Node(im.getPrivateIp(), im.getPublicIp(), im.getInstanceId(), im.getInstanceGroup().getTemplate().getInstanceType(), im.getDiscoveryFQDN(), im.getInstanceGroup().getGroupName())) .collect(Collectors.toSet()); telemetryOrchestrator.installAndStartMonitoring(gatewayConfigs, allNodes, clusterDeletionBasedModel(stack.getId(), stack.getCluster().getId())); } catch (CloudbreakOrchestratorFailedException ex) { throw new CloudbreakException(ex); } } } ClusterMonitoringEngine(TelemetryOrchestrator telemetryOrchestrator, GatewayConfigService gatewayConfigService); }
ClusterMonitoringEngine { public void installAndStartMonitoring(Stack stack, Telemetry telemetry) throws CloudbreakException { if (telemetry != null && telemetry.isMonitoringFeatureEnabled()) { try { LOGGER.info("Install and start monitoring for CM server."); Set<InstanceMetaData> instanceMetaDataSet = stack.getNotDeletedInstanceMetaDataSet(); List<GatewayConfig> gatewayConfigs = gatewayConfigService.getAllGatewayConfigs(stack); Set<Node> allNodes = instanceMetaDataSet.stream() .map(im -> new Node(im.getPrivateIp(), im.getPublicIp(), im.getInstanceId(), im.getInstanceGroup().getTemplate().getInstanceType(), im.getDiscoveryFQDN(), im.getInstanceGroup().getGroupName())) .collect(Collectors.toSet()); telemetryOrchestrator.installAndStartMonitoring(gatewayConfigs, allNodes, clusterDeletionBasedModel(stack.getId(), stack.getCluster().getId())); } catch (CloudbreakOrchestratorFailedException ex) { throw new CloudbreakException(ex); } } } ClusterMonitoringEngine(TelemetryOrchestrator telemetryOrchestrator, GatewayConfigService gatewayConfigService); void installAndStartMonitoring(Stack stack, Telemetry telemetry); }
ClusterMonitoringEngine { public void installAndStartMonitoring(Stack stack, Telemetry telemetry) throws CloudbreakException { if (telemetry != null && telemetry.isMonitoringFeatureEnabled()) { try { LOGGER.info("Install and start monitoring for CM server."); Set<InstanceMetaData> instanceMetaDataSet = stack.getNotDeletedInstanceMetaDataSet(); List<GatewayConfig> gatewayConfigs = gatewayConfigService.getAllGatewayConfigs(stack); Set<Node> allNodes = instanceMetaDataSet.stream() .map(im -> new Node(im.getPrivateIp(), im.getPublicIp(), im.getInstanceId(), im.getInstanceGroup().getTemplate().getInstanceType(), im.getDiscoveryFQDN(), im.getInstanceGroup().getGroupName())) .collect(Collectors.toSet()); telemetryOrchestrator.installAndStartMonitoring(gatewayConfigs, allNodes, clusterDeletionBasedModel(stack.getId(), stack.getCluster().getId())); } catch (CloudbreakOrchestratorFailedException ex) { throw new CloudbreakException(ex); } } } ClusterMonitoringEngine(TelemetryOrchestrator telemetryOrchestrator, GatewayConfigService gatewayConfigService); void installAndStartMonitoring(Stack stack, Telemetry telemetry);  }