@SuppressWarnings("unchecked") @Test public void testFromJson_InputStreamReader() throws FileNotFoundException { InputStream in = this.getClass().getResourceAsStream(JSON_FILE); InputStreamReader reader = new InputStreamReader(in); PipelineConfiguration cfg = new JsonPipelineUtil().fromJson(reader); assertEquals("contacts", cfg.getPipelineName()); assertEquals(1, cfg.getStages().size()); Map<String, Object> stage = cfg.getStages().get(0); assertEquals("regexdates", stage.get("stageName")); assertEquals("com.findwise.hydra.stage.RegexStage", stage.get("stageClass")); assertEquals("basic", stage.get("jarId")); assertArrayEquals(new String[]{"touched(mergeFields,true)"}, ((List) stage.get("queryOptions")).toArray()); List<Map<String, String>> listOfRegexConfigs = (List<Map<String, String>>) stage.get("regexConfigs"); assertEquals(1, listOfRegexConfigs.size()); Map<String, String> regexConfig = listOfRegexConfigs.get(0); assertEquals(4, regexConfig.size()); assertEquals("releasedatetime", regexConfig.get("inField")); assertEquals("releasedatetime", regexConfig.get("outField")); assertEquals("(.*)(\\+\\d{2}):(\\d{2})", regexConfig.get("regex")); assertEquals("$1$2$3", regexConfig.get("substitute")); System.out.println("* " + cfg.toString()); }
public PipelineConfiguration fromJson(InputStreamReader reader) { PipelineConfiguration pipeline = gson.fromJson(reader, PipelineConfiguration.class); return pipeline; }
JsonPipelineUtil { public PipelineConfiguration fromJson(InputStreamReader reader) { PipelineConfiguration pipeline = gson.fromJson(reader, PipelineConfiguration.class); return pipeline; } }
JsonPipelineUtil { public PipelineConfiguration fromJson(InputStreamReader reader) { PipelineConfiguration pipeline = gson.fromJson(reader, PipelineConfiguration.class); return pipeline; } JsonPipelineUtil(); }
JsonPipelineUtil { public PipelineConfiguration fromJson(InputStreamReader reader) { PipelineConfiguration pipeline = gson.fromJson(reader, PipelineConfiguration.class); return pipeline; } JsonPipelineUtil(); PipelineConfiguration fromJson(InputStreamReader reader); PipelineConfiguration fromJson(String fileName); String toJson(PipelineConfiguration pipeline); }
JsonPipelineUtil { public PipelineConfiguration fromJson(InputStreamReader reader) { PipelineConfiguration pipeline = gson.fromJson(reader, PipelineConfiguration.class); return pipeline; } JsonPipelineUtil(); PipelineConfiguration fromJson(InputStreamReader reader); PipelineConfiguration fromJson(String fileName); String toJson(PipelineConfiguration pipeline);  }