public static String fix(final String raw) { if ( raw == null || "".equals( raw.trim() )) { return raw; } MacroProcessor macroProcessor = new MacroProcessor(); macroProcessor.setMacros( macros ); return macroProcessor.parse( raw ); } }
public static String parseMacros(String input, Map<String, Macro> macros) { return new MacroProcessor(macros).parse(input); }
public String parse(String input) { return new String(parse(input.toCharArray())); }
protected void setUp() throws Exception { super.setUp(); Map<String, Macro> macros = new HashMap<String, Macro>(); macros.put("insert", new Macro() { public String doMacro() { return "drools.insert"; } }); macroProcessor = new MacroProcessor(); macroProcessor.setMacros(macros); }
public char[] parse(char[] input) { setExpression(input);
public static String parseMacros(String input, Map<String, Macro> macros) { return new MacroProcessor(macros).parse(input); }
public String parse(String input) { return new String(parse(input.toCharArray())); }
public char[] parse(char[] input) { setExpression(input);
public static String processMacros(String consequence) { MacroProcessor macroProcessor = new MacroProcessor(); macroProcessor.setMacros( macros ); return macroProcessor.parse( delimitExpressions( consequence ) ); }
public static String parseMacros(String input, Map<String, Macro> macros) { return new MacroProcessor(macros).parse(input); }
public String parse(String input) { return new String(parse(input.toCharArray())); }
public char[] parse(char[] input) { setExpression(input);
public static String processMacros(String consequence) { MacroProcessor macroProcessor = new MacroProcessor(); macroProcessor.setMacros( macros ); return macroProcessor.parse( delimitExpressions( consequence ) ); }
public void testParseConsequenceWithComments() { String raw = " // str is null, we are just testing we don't get a null pointer \n " + " list.add( p );"; try { String result = macroProcessor.parse(raw); assertEquals(raw, result); } catch (Exception ex) { ex.printStackTrace(); fail("there shouldn't be any exception: " + ex.getMessage()); } }
public static String fix(final String raw) { if ( raw == null || "".equals( raw.trim() )) { return raw; } MacroProcessor macroProcessor = new MacroProcessor(); macroProcessor.setMacros( macros ); return macroProcessor.parse( raw ); } }
public void testParseStringUnmatchedChars() { String raw = "result.add( \"\\\"\\\' there are } [ unmatched characters in this string (\" );"; try { String result = macroProcessor.parse(raw); assertEquals(raw, result); } catch (Exception ex) { ex.printStackTrace(); fail("there shouldn't be any exception: " + ex.getMessage()); } }
public static String fix(final String raw) { if ( raw == null || "".equals( raw.trim() )) { return raw; } MacroProcessor macroProcessor = new MacroProcessor(); macroProcessor.setMacros( macros ); return macroProcessor.parse( raw ); } }
public void testParseString() { String raw = " l.add( \"rule 2 executed \" + str);"; try { String result = macroProcessor.parse(raw); assertEquals(raw, result); } catch (Exception ex) { ex.printStackTrace(); fail("there shouldn't be any exception: " + ex.getMessage()); } }
public static String processMacros(String consequence) { MacroProcessor macroProcessor = new MacroProcessor(); macroProcessor.setMacros( macros ); return macroProcessor.parse( delimitExpressions( consequence ) ); }
public void testCommentParsingWithMacro() { String raw = "/** This is a block comment **/ insert /** This is a second \n\nblock comment insert **/"; String expected = "/** This is a block comment **/ drools.insert /** This is a second \n\nblock comment insert **/"; try { String result = macroProcessor.parse(raw); assertEquals(expected, result); } catch (Exception ex) { ex.printStackTrace(); fail("there shouldn't be any exception: " + ex.getMessage()); } } }