@Test public void testFunctionTest_DefaultValues() throws FileNotFoundException { Element configRoot = getDocument(new FileReader(new File("src/test/cfg/admin/userconfigs/functiontest-defaultvalues.xml"))); ConfigPayload config = ConfigPayload.fromBuilder(new DomConfigPayloadBuilder(null).build(configRoot)); String expected = "" + "{" + "\"bool_val\":\"false\"," + "\"int_val\":\"5\"," + "\"long_val\":\"1234567890123\"," + "\"double_val\":\"41.23\"," + "\"string_val\":\"foo\"," + "\"enum_val\":\"FOOBAR\"," + "\"refval\":\":parent:\"," + "\"fileVal\":\"vespa.log\"," + "\"basicStruct\":{\"bar\":\"3\",\"intArr\":[\"10\"]}," + "\"rootStruct\":{\"inner0\":{\"index\":\"11\"},\"inner1\":{\"index\":\"12\"}," + "\"innerArr\":[{\"stringVal\":\"deep\"}]}," + "\"boolarr\":[\"false\"]," + "\"doublearr\":[\"2344\",\"123\"]," + "\"stringarr\":[\"bar\"]," + "\"enumarr\":[\"VALUES\"]," + "\"myarray\":[{\"refval\":\":parent:\",\"fileVal\":\"command.com\",\"myStruct\":{\"a\":\"1\"},\"stringval\":[\"baah\",\"yikes\"],\"anotherarray\":[{\"foo\":\"7\"}]},{\"refval\":\":parent:\",\"fileVal\":\"display.sys\",\"myStruct\":{\"a\":\"-1\"},\"anotherarray\":[{\"foo\":\"1\"},{\"foo\":\"2\"}]}]" + "}"; assertPayload(expected, config); }
public ConfigPayloadBuilder build(Element configE) { parseConfigName(configE); ConfigPayloadBuilder payloadBuilder = new ConfigPayloadBuilder(configDefinition); for (Element child : XML.getChildren(configE)) { parseElement(child, payloadBuilder, null); } return payloadBuilder; }
DomConfigPayloadBuilder { public ConfigPayloadBuilder build(Element configE) { parseConfigName(configE); ConfigPayloadBuilder payloadBuilder = new ConfigPayloadBuilder(configDefinition); for (Element child : XML.getChildren(configE)) { parseElement(child, payloadBuilder, null); } return payloadBuilder; } }
DomConfigPayloadBuilder { public ConfigPayloadBuilder build(Element configE) { parseConfigName(configE); ConfigPayloadBuilder payloadBuilder = new ConfigPayloadBuilder(configDefinition); for (Element child : XML.getChildren(configE)) { parseElement(child, payloadBuilder, null); } return payloadBuilder; } DomConfigPayloadBuilder(ConfigDefinition configDefinition); }
DomConfigPayloadBuilder { public ConfigPayloadBuilder build(Element configE) { parseConfigName(configE); ConfigPayloadBuilder payloadBuilder = new ConfigPayloadBuilder(configDefinition); for (Element child : XML.getChildren(configE)) { parseElement(child, payloadBuilder, null); } return payloadBuilder; } DomConfigPayloadBuilder(ConfigDefinition configDefinition); ConfigPayloadBuilder build(Element configE); static ConfigDefinitionKey parseConfigName(Element configE); }
DomConfigPayloadBuilder { public ConfigPayloadBuilder build(Element configE) { parseConfigName(configE); ConfigPayloadBuilder payloadBuilder = new ConfigPayloadBuilder(configDefinition); for (Element child : XML.getChildren(configE)) { parseElement(child, payloadBuilder, null); } return payloadBuilder; } DomConfigPayloadBuilder(ConfigDefinition configDefinition); ConfigPayloadBuilder build(Element configE); static ConfigDefinitionKey parseConfigName(Element configE);  }