@Test public void testNoProxyConfig() { proxyConfigProvider.decoratePillarWithProxyDataIfNeeded(servicePillar, cluster); assertTrue(servicePillar.isEmpty()); }
public void decoratePillarWithProxyDataIfNeeded(Map<String, SaltPillarProperties> servicePillar, Cluster cluster) { Optional<ProxyConfig> proxyConfig = proxyConfigDtoService.getByCrnWithEnvironmentFallback(cluster.getProxyConfigCrn(), cluster.getEnvironmentCrn()); proxyConfig.ifPresent(pc -> { Map<String, Object> proxy = new HashMap<>(); proxy.put("host", pc.getServerHost()); proxy.put("port", pc.getServerPort()); proxy.put("protocol", pc.getProtocol()); pc.getProxyAuthentication().ifPresent(auth -> { proxy.put("user", auth.getUserName()); proxy.put("password", auth.getPassword()); }); servicePillar.put(PROXY_KEY, new SaltPillarProperties(PROXY_SLS_PATH, singletonMap(PROXY_KEY, proxy))); LOGGER.info("Salt pillar properties extend with proxy config: {}", pc); }); }
ProxyConfigProvider { public void decoratePillarWithProxyDataIfNeeded(Map<String, SaltPillarProperties> servicePillar, Cluster cluster) { Optional<ProxyConfig> proxyConfig = proxyConfigDtoService.getByCrnWithEnvironmentFallback(cluster.getProxyConfigCrn(), cluster.getEnvironmentCrn()); proxyConfig.ifPresent(pc -> { Map<String, Object> proxy = new HashMap<>(); proxy.put("host", pc.getServerHost()); proxy.put("port", pc.getServerPort()); proxy.put("protocol", pc.getProtocol()); pc.getProxyAuthentication().ifPresent(auth -> { proxy.put("user", auth.getUserName()); proxy.put("password", auth.getPassword()); }); servicePillar.put(PROXY_KEY, new SaltPillarProperties(PROXY_SLS_PATH, singletonMap(PROXY_KEY, proxy))); LOGGER.info("Salt pillar properties extend with proxy config: {}", pc); }); } }
ProxyConfigProvider { public void decoratePillarWithProxyDataIfNeeded(Map<String, SaltPillarProperties> servicePillar, Cluster cluster) { Optional<ProxyConfig> proxyConfig = proxyConfigDtoService.getByCrnWithEnvironmentFallback(cluster.getProxyConfigCrn(), cluster.getEnvironmentCrn()); proxyConfig.ifPresent(pc -> { Map<String, Object> proxy = new HashMap<>(); proxy.put("host", pc.getServerHost()); proxy.put("port", pc.getServerPort()); proxy.put("protocol", pc.getProtocol()); pc.getProxyAuthentication().ifPresent(auth -> { proxy.put("user", auth.getUserName()); proxy.put("password", auth.getPassword()); }); servicePillar.put(PROXY_KEY, new SaltPillarProperties(PROXY_SLS_PATH, singletonMap(PROXY_KEY, proxy))); LOGGER.info("Salt pillar properties extend with proxy config: {}", pc); }); }  }
ProxyConfigProvider { public void decoratePillarWithProxyDataIfNeeded(Map<String, SaltPillarProperties> servicePillar, Cluster cluster) { Optional<ProxyConfig> proxyConfig = proxyConfigDtoService.getByCrnWithEnvironmentFallback(cluster.getProxyConfigCrn(), cluster.getEnvironmentCrn()); proxyConfig.ifPresent(pc -> { Map<String, Object> proxy = new HashMap<>(); proxy.put("host", pc.getServerHost()); proxy.put("port", pc.getServerPort()); proxy.put("protocol", pc.getProtocol()); pc.getProxyAuthentication().ifPresent(auth -> { proxy.put("user", auth.getUserName()); proxy.put("password", auth.getPassword()); }); servicePillar.put(PROXY_KEY, new SaltPillarProperties(PROXY_SLS_PATH, singletonMap(PROXY_KEY, proxy))); LOGGER.info("Salt pillar properties extend with proxy config: {}", pc); }); }  void decoratePillarWithProxyDataIfNeeded(Map<String, SaltPillarProperties> servicePillar, Cluster cluster); }
ProxyConfigProvider { public void decoratePillarWithProxyDataIfNeeded(Map<String, SaltPillarProperties> servicePillar, Cluster cluster) { Optional<ProxyConfig> proxyConfig = proxyConfigDtoService.getByCrnWithEnvironmentFallback(cluster.getProxyConfigCrn(), cluster.getEnvironmentCrn()); proxyConfig.ifPresent(pc -> { Map<String, Object> proxy = new HashMap<>(); proxy.put("host", pc.getServerHost()); proxy.put("port", pc.getServerPort()); proxy.put("protocol", pc.getProtocol()); pc.getProxyAuthentication().ifPresent(auth -> { proxy.put("user", auth.getUserName()); proxy.put("password", auth.getPassword()); }); servicePillar.put(PROXY_KEY, new SaltPillarProperties(PROXY_SLS_PATH, singletonMap(PROXY_KEY, proxy))); LOGGER.info("Salt pillar properties extend with proxy config: {}", pc); }); }  void decoratePillarWithProxyDataIfNeeded(Map<String, SaltPillarProperties> servicePillar, Cluster cluster); static final String PROXY_KEY; static final String PROXY_SLS_PATH; }