@Test public void require_that_leaf_maps_are_modified() { def.leafMapDef("fileMap").setTypeSpec(new ConfigDefinition.TypeSpec("fileMap", "file", null, null, null, null)); def.leafMapDef("pathMap").setTypeSpec(new ConfigDefinition.TypeSpec("pathMap", "path", null, null, null, null)); def.leafMapDef("stringMap").setTypeSpec(new ConfigDefinition.TypeSpec("stringMap", "string", null, null, null, null)); builder.getMap("fileMap").put("foo", "foo.txt"); builder.getMap("fileMap").put("bar", "bar.txt"); builder.getMap("pathMap").put("path", "path.txt"); builder.getMap("stringMap").put("bar", "bar.txt"); service.pathToRef.put("foo.txt", new FileNode("foohash").value()); service.pathToRef.put("bar.txt", new FileNode("barhash").value()); service.pathToRef.put("path.txt", new FileNode("pathhash").value()); FileSender.sendUserConfiguredFiles(producer, serviceList, new BaseDeployLogger()); assertThat(builder.getMap("fileMap").get("foo").getValue(), is("foohash")); assertThat(builder.getMap("fileMap").get("bar").getValue(), is("barhash")); assertThat(builder.getMap("pathMap").get("path").getValue(), is("pathhash")); assertThat(builder.getMap("stringMap").get("bar").getValue(), is("bar.txt")); }
public static <PRODUCER extends AbstractConfigProducer<?>> void sendUserConfiguredFiles(PRODUCER producer, Collection<? extends AbstractService> services, DeployLogger logger) { if (services.isEmpty()) return; UserConfigRepo userConfigs = producer.getUserConfigs(); Map<String, FileReference> sentFiles = new HashMap<>(); for (ConfigDefinitionKey key : userConfigs.configsProduced()) { ConfigPayloadBuilder builder = userConfigs.get(key); try { sendUserConfiguredFiles(builder, sentFiles, services, key, logger); } catch (IllegalArgumentException e) { throw new IllegalArgumentException("Unable to send files for " + key, e); } } }
FileSender implements Serializable { public static <PRODUCER extends AbstractConfigProducer<?>> void sendUserConfiguredFiles(PRODUCER producer, Collection<? extends AbstractService> services, DeployLogger logger) { if (services.isEmpty()) return; UserConfigRepo userConfigs = producer.getUserConfigs(); Map<String, FileReference> sentFiles = new HashMap<>(); for (ConfigDefinitionKey key : userConfigs.configsProduced()) { ConfigPayloadBuilder builder = userConfigs.get(key); try { sendUserConfiguredFiles(builder, sentFiles, services, key, logger); } catch (IllegalArgumentException e) { throw new IllegalArgumentException("Unable to send files for " + key, e); } } } }
FileSender implements Serializable { public static <PRODUCER extends AbstractConfigProducer<?>> void sendUserConfiguredFiles(PRODUCER producer, Collection<? extends AbstractService> services, DeployLogger logger) { if (services.isEmpty()) return; UserConfigRepo userConfigs = producer.getUserConfigs(); Map<String, FileReference> sentFiles = new HashMap<>(); for (ConfigDefinitionKey key : userConfigs.configsProduced()) { ConfigPayloadBuilder builder = userConfigs.get(key); try { sendUserConfiguredFiles(builder, sentFiles, services, key, logger); } catch (IllegalArgumentException e) { throw new IllegalArgumentException("Unable to send files for " + key, e); } } }  }
FileSender implements Serializable { public static <PRODUCER extends AbstractConfigProducer<?>> void sendUserConfiguredFiles(PRODUCER producer, Collection<? extends AbstractService> services, DeployLogger logger) { if (services.isEmpty()) return; UserConfigRepo userConfigs = producer.getUserConfigs(); Map<String, FileReference> sentFiles = new HashMap<>(); for (ConfigDefinitionKey key : userConfigs.configsProduced()) { ConfigPayloadBuilder builder = userConfigs.get(key); try { sendUserConfiguredFiles(builder, sentFiles, services, key, logger); } catch (IllegalArgumentException e) { throw new IllegalArgumentException("Unable to send files for " + key, e); } } }  static FileReference sendFileToServices(String relativePath,
                                                   Collection<? extends AbstractService> services); static FileReference sendUriToServices(String uri, Collection<? extends AbstractService> services); static void sendUserConfiguredFiles(PRODUCER producer, Collection<? extends AbstractService> services, DeployLogger logger); }
FileSender implements Serializable { public static <PRODUCER extends AbstractConfigProducer<?>> void sendUserConfiguredFiles(PRODUCER producer, Collection<? extends AbstractService> services, DeployLogger logger) { if (services.isEmpty()) return; UserConfigRepo userConfigs = producer.getUserConfigs(); Map<String, FileReference> sentFiles = new HashMap<>(); for (ConfigDefinitionKey key : userConfigs.configsProduced()) { ConfigPayloadBuilder builder = userConfigs.get(key); try { sendUserConfiguredFiles(builder, sentFiles, services, key, logger); } catch (IllegalArgumentException e) { throw new IllegalArgumentException("Unable to send files for " + key, e); } } }  static FileReference sendFileToServices(String relativePath,
                                                   Collection<? extends AbstractService> services); static FileReference sendUriToServices(String uri, Collection<? extends AbstractService> services); static void sendUserConfiguredFiles(PRODUCER producer, Collection<? extends AbstractService> services, DeployLogger logger);  }