@Test public void require_that_fields_in_inner_arrays_are_modified() { def.innerArrayDef("inner").addFileDef("fileVal"); def.innerArrayDef("inner").addStringDef("stringVal"); ConfigPayloadBuilder inner = builder.getArray("inner").append(); inner.setField("fileVal", "bar.txt"); inner.setField("stringVal", "bar.txt"); service.pathToRef.put("bar.txt", new FileNode("barhash").value()); FileSender.sendUserConfiguredFiles(producer, serviceList, new BaseDeployLogger()); assertThat(builder.getArray("inner").get(0).getObject("fileVal").getValue(), is("barhash")); assertThat(builder.getArray("inner").get(0).getObject("stringVal").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);  }