use of org.mvel2.templates.SimpleTemplateRegistry in project mvel by mikebrock.
the class TemplateTests method testInclusionOfNamedTemplate.
// public void testTemplateFile2() {
// String s = (String) TemplateRuntime.eval(new File("src/test/java/org/mvel2/tests/templates/templateDeclareTest.mv"),
// base, new MapVariableResolverFactory(map), null);
//
// System.out.println(s);
//
// }
public void testInclusionOfNamedTemplate() {
SimpleTemplateRegistry registry = new SimpleTemplateRegistry();
registry.addNamedTemplate("footemplate", compileTemplate("@{_foo_}@{_bar_}"));
registry.addNamedTemplate("bartemplate", compileTemplate("@{_bar_}@{_foo_}"));
String s = "@includeNamed{'footemplate'} :: @includeNamed{'bartemplate'}";
assertEquals("FooBar :: BarFoo", TemplateRuntime.eval(s, map, registry));
}
use of org.mvel2.templates.SimpleTemplateRegistry in project drools by kiegroup.
the class AccumulateTemplateTest method getInvokerTemplateRegistry.
private TemplateRegistry getInvokerTemplateRegistry() {
TemplateRegistry invokerRegistry = new SimpleTemplateRegistry();
CompiledTemplate compiled = TemplateCompiler.compileTemplate(JavaRuleBuilderHelper.class.getResourceAsStream("javaInvokers.mvel"), (Map<String, Class<? extends Node>>) null);
TemplateRuntime.execute(compiled, null, invokerRegistry);
return invokerRegistry;
}
use of org.mvel2.templates.SimpleTemplateRegistry in project drools by kiegroup.
the class AccumulateTemplateTest method getRuleTemplateRegistry.
private TemplateRegistry getRuleTemplateRegistry() {
TemplateRegistry ruleRegistry = new SimpleTemplateRegistry();
CompiledTemplate compiled = TemplateCompiler.compileTemplate(JavaRuleBuilderHelper.class.getResourceAsStream("javaRule.mvel"), (Map<String, Class<? extends Node>>) null);
TemplateRuntime.execute(compiled, null, ruleRegistry);
return ruleRegistry;
}
use of org.mvel2.templates.SimpleTemplateRegistry in project drools by kiegroup.
the class JavaRuleBuilderHelper method setInvokerTemplate.
public static void setInvokerTemplate(String name) {
JAVA_INVOKERS_MVEL = name;
INVOKER_REGISTRY = new SimpleTemplateRegistry();
}
use of org.mvel2.templates.SimpleTemplateRegistry in project drools by kiegroup.
the class JavaRuleBuilderHelper method setConsequenceTemplate.
public static void setConsequenceTemplate(String name) {
JAVA_RULE_MVEL = name;
RULE_REGISTRY = new SimpleTemplateRegistry();
}
Aggregations