@Test public void testConfigParse() { String xmlConfig = "<xmlSign>\n" + " <Students>\n" + " <Student>\n" + " <Name>lct-1</Name>\n" + " <Num>1006010022</Num>\n" + " <Classes>major-1</Classes>\n" + " <Address>hangzhou</Address>\n" + " <Tel>123456</Tel>\n" + " </Student>\n" + " <Student>\n" + " <Name>lct-2</Name>\n" + " <Num>1006010033</Num>\n" + " <Classes>major-2</Classes>\n" + " <Address>shengzheng</Address>\n" + " <Tel>234567</Tel>\n" + " </Student>\n" + " <Student>\n" + " <Name>lct-3</Name>\n" + " <Num>1006010044</Num>\n" + " <Classes>major-3</Classes>\n" + " <Address>wenzhou</Address>\n" + " <Tel>345678</Tel>\n" + " </Student>\n" + " <Student>\n" + " <Name>lct-4</Name>\n" + " <Num>1006010055</Num>\n" + " <Classes>major-3</Classes>\n" + " <Address>wuhan</Address>\n" + " <Tel>456789</Tel>\n" + " </Student>\n" + " </Students>\n" + "</xmlSign>"; Assert.assertEquals(0, ConfigParseUtils.toProperties(dataId, group, xmlConfig, "xml").size()); Assert.assertEquals(1, atomicInteger.get()); Properties properties = ConfigParseUtils.toProperties(xmlConfig, "XML"); Assert.assertTrue(0 != properties.size()); System.out.println(ConfigParse.class.isAssignableFrom(CustomerParse.class)); System.out.println(properties); }
public static Properties toProperties(final String context, String type) { if (context == null) { return new Properties(); } type = type.toLowerCase(); Properties properties = new Properties(); if (DEFAULT_CONFIG_PARSE_MAP.containsKey(type)) { ConfigParse configParse = DEFAULT_CONFIG_PARSE_MAP.get(type); properties.putAll(configParse.parse(context)); return properties; } else { throw new UnsupportedOperationException( "Parsing is not yet supported for this type profile : " + type); } }
ConfigParseUtils { public static Properties toProperties(final String context, String type) { if (context == null) { return new Properties(); } type = type.toLowerCase(); Properties properties = new Properties(); if (DEFAULT_CONFIG_PARSE_MAP.containsKey(type)) { ConfigParse configParse = DEFAULT_CONFIG_PARSE_MAP.get(type); properties.putAll(configParse.parse(context)); return properties; } else { throw new UnsupportedOperationException( "Parsing is not yet supported for this type profile : " + type); } } }
ConfigParseUtils { public static Properties toProperties(final String context, String type) { if (context == null) { return new Properties(); } type = type.toLowerCase(); Properties properties = new Properties(); if (DEFAULT_CONFIG_PARSE_MAP.containsKey(type)) { ConfigParse configParse = DEFAULT_CONFIG_PARSE_MAP.get(type); properties.putAll(configParse.parse(context)); return properties; } else { throw new UnsupportedOperationException( "Parsing is not yet supported for this type profile : " + type); } }  }
ConfigParseUtils { public static Properties toProperties(final String context, String type) { if (context == null) { return new Properties(); } type = type.toLowerCase(); Properties properties = new Properties(); if (DEFAULT_CONFIG_PARSE_MAP.containsKey(type)) { ConfigParse configParse = DEFAULT_CONFIG_PARSE_MAP.get(type); properties.putAll(configParse.parse(context)); return properties; } else { throw new UnsupportedOperationException( "Parsing is not yet supported for this type profile : " + type); } }  static Properties toProperties(final String context, String type); static Properties toProperties(final String dataId, final String group,
			final String context, String type); }
ConfigParseUtils { public static Properties toProperties(final String context, String type) { if (context == null) { return new Properties(); } type = type.toLowerCase(); Properties properties = new Properties(); if (DEFAULT_CONFIG_PARSE_MAP.containsKey(type)) { ConfigParse configParse = DEFAULT_CONFIG_PARSE_MAP.get(type); properties.putAll(configParse.parse(context)); return properties; } else { throw new UnsupportedOperationException( "Parsing is not yet supported for this type profile : " + type); } }  static Properties toProperties(final String context, String type); static Properties toProperties(final String dataId, final String group,
			final String context, String type);  }