@Test public void require_that_arrays_are_modified() { def.arrayDef("fileArray").setTypeSpec(new ConfigDefinition.TypeSpec("fileArray", "file", null, null, null, null)); def.arrayDef("pathArray").setTypeSpec(new ConfigDefinition.TypeSpec("pathArray", "path", null, null, null, null)); def.arrayDef("stringArray").setTypeSpec(new ConfigDefinition.TypeSpec("stringArray", "string", null, null, null, null)); builder.getArray("fileArray").append("foo.txt"); builder.getArray("fileArray").append("bar.txt"); builder.getArray("pathArray").append("path.txt"); builder.getArray("stringArray").append("foo.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.getArray("fileArray").get(0).getValue(), is("foohash")); assertThat(builder.getArray("fileArray").get(1).getValue(), is("barhash")); assertThat(builder.getArray("pathArray").get(0).getValue(), is("pathhash")); assertThat(builder.getArray("stringArray").get(0).getValue(), is("foo.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);  }