public void testInvalid() { Enumeration e = invalidRsls.keys(); String key; String rsl; while (e.hasMoreElements()) { key = (String) e.nextElement(); rsl = invalidRsls.getProperty(key); System.out.println("Parsing invalid rsl " + key + ": " + rsl); try { RslNode tree = RSLParser.parse(rsl); fail("Failed to catch parse error of " + rsl); } catch (Exception ex) { } } }
public void testValid() { Enumeration e = validRsls.keys(); String key; String rsl; while (e.hasMoreElements()) { key = (String) e.nextElement(); rsl = validRsls.getProperty(key); System.out.println("Parsing valid rsl " + key + ": " + rsl); try { RSLParser.parse(rsl); } catch (Exception ex) { ex.printStackTrace(); fail("Failed to parse!!!"); } } }
/** * This method is used to get the String that contain key value pair from the propertise. * * @param String * @return String. */ public String list(String propfile) { Properties properties = (Properties) cachedPropertyFiles.get(propfile); if (properties == null) return ""; synchronized (properties) { StringBuffer buf = new StringBuffer(properties.size() * 50); for (Enumeration e = properties.keys(); e.hasMoreElements(); ) { String key = (String) e.nextElement(); String val = (String) properties.get(key); if (val.length() > 40) { val = val.substring(0, 37) + "..."; } buf.append(key); buf.append('='); buf.append(val); buf.append('\n'); } return buf.toString(); } }