@Test public void testRenderWorkflowFileWithSystemEnvironmentVariables() throws IOException, ParserConfigurationException, SAXException{ environmentVariables.set("ANTENNATESTVARIABLE", "WARN"); Map<String, String> systemEnvs = System.getenv(); assertThat(systemEnvs.get("ANTENNATESTVARIABLE")).isEqualTo("WARN"); HashMap<String, Object> contextMap = new HashMap<>(); File workflowDefFile = new File(TemplateRendererTest.class.getResource("/workflow.xml").getFile()); TemplateRenderer tr = new TemplateRenderer(contextMap); String renderedWorkflow = tr.renderTemplateFile(workflowDefFile); Workflow workflow; XmlSettingsReader workflowReader = new XmlSettingsReader(renderedWorkflow); workflow = workflowReader.getComplexType("workflow", Workflow.class); assertThat(workflow.getProcessors().getStep().stream().findFirst().get().getConfiguration().getEntry() .stream() .filter(entry -> entry.getKey().equals("incompleteSourcesSeverity")) .findFirst() .get() .getValue()) .isEqualTo("WARN"); }
public String renderTemplateFile(File templateFile, Map<String, Object> contextMap) { for (Map.Entry<String, Object> entry : contextMap.entrySet()) { renderContext.put(entry.getKey(), entry.getValue()); } return renderTemplateFile(templateFile); }
TemplateRenderer { public String renderTemplateFile(File templateFile, Map<String, Object> contextMap) { for (Map.Entry<String, Object> entry : contextMap.entrySet()) { renderContext.put(entry.getKey(), entry.getValue()); } return renderTemplateFile(templateFile); } }
TemplateRenderer { public String renderTemplateFile(File templateFile, Map<String, Object> contextMap) { for (Map.Entry<String, Object> entry : contextMap.entrySet()) { renderContext.put(entry.getKey(), entry.getValue()); } return renderTemplateFile(templateFile); } TemplateRenderer();  TemplateRenderer(Map<String, Object> initMap); }
TemplateRenderer { public String renderTemplateFile(File templateFile, Map<String, Object> contextMap) { for (Map.Entry<String, Object> entry : contextMap.entrySet()) { renderContext.put(entry.getKey(), entry.getValue()); } return renderTemplateFile(templateFile); } TemplateRenderer();  TemplateRenderer(Map<String, Object> initMap); String renderTemplateFile(File templateFile, Map<String, Object> contextMap); String renderTemplateFile(File templateFile); Optional<String> renderClassPathWorkflow(); }
TemplateRenderer { public String renderTemplateFile(File templateFile, Map<String, Object> contextMap) { for (Map.Entry<String, Object> entry : contextMap.entrySet()) { renderContext.put(entry.getKey(), entry.getValue()); } return renderTemplateFile(templateFile); } TemplateRenderer();  TemplateRenderer(Map<String, Object> initMap); String renderTemplateFile(File templateFile, Map<String, Object> contextMap); String renderTemplateFile(File templateFile); Optional<String> renderClassPathWorkflow(); static final String CLASSPATH_WORKFLOW_XML; }