@Test void evaluateVelocityCount() throws XWikiVelocityException { this.engine.initialize(new Properties()); assertEvaluate("1true2true3true4true5false", "#foreach($nb in [1,2,3,4,5])$velocityCount$velocityHasNext#end", DEFAULT_TEMPLATE_NAME); assertEquals("Deprecated binding [$velocityCount] used in [mytemplate]", logCapture.getMessage(0)); assertEquals("Deprecated binding [$velocityHasNext] used in [mytemplate]", logCapture.getMessage(1)); assertEquals("Deprecated binding [$velocityCount] used in [mytemplate]", logCapture.getMessage(2)); assertEquals("Deprecated binding [$velocityHasNext] used in [mytemplate]", logCapture.getMessage(3)); assertEquals("Deprecated binding [$velocityCount] used in [mytemplate]", logCapture.getMessage(4)); assertEquals("Deprecated binding [$velocityHasNext] used in [mytemplate]", logCapture.getMessage(5)); assertEquals("Deprecated binding [$velocityCount] used in [mytemplate]", logCapture.getMessage(6)); assertEquals("Deprecated binding [$velocityHasNext] used in [mytemplate]", logCapture.getMessage(7)); assertEquals("Deprecated binding [$velocityCount] used in [mytemplate]", logCapture.getMessage(8)); assertEquals("Deprecated binding [$velocityHasNext] used in [mytemplate]", logCapture.getMessage(9)); }
@Override public void initialize(Properties overridingProperties) throws XWikiVelocityException { RuntimeInstance runtime = new RuntimeInstance(); runtime.setApplicationAttribute(ComponentManager.class.getName(), this.componentManager); initializeProperties(runtime, this.velocityConfiguration.getProperties(), overridingProperties); runtime.loadDirective(TryCatchDirective.class.getName()); try { runtime.init(); } catch (Exception e) { throw new XWikiVelocityException("Cannot start the Velocity engine", e); } this.runtimeInstance = runtime; this.globalEntry = new TemplateEntry(""); }
DefaultVelocityEngine implements VelocityEngine { @Override public void initialize(Properties overridingProperties) throws XWikiVelocityException { RuntimeInstance runtime = new RuntimeInstance(); runtime.setApplicationAttribute(ComponentManager.class.getName(), this.componentManager); initializeProperties(runtime, this.velocityConfiguration.getProperties(), overridingProperties); runtime.loadDirective(TryCatchDirective.class.getName()); try { runtime.init(); } catch (Exception e) { throw new XWikiVelocityException("Cannot start the Velocity engine", e); } this.runtimeInstance = runtime; this.globalEntry = new TemplateEntry(""); } }
DefaultVelocityEngine implements VelocityEngine { @Override public void initialize(Properties overridingProperties) throws XWikiVelocityException { RuntimeInstance runtime = new RuntimeInstance(); runtime.setApplicationAttribute(ComponentManager.class.getName(), this.componentManager); initializeProperties(runtime, this.velocityConfiguration.getProperties(), overridingProperties); runtime.loadDirective(TryCatchDirective.class.getName()); try { runtime.init(); } catch (Exception e) { throw new XWikiVelocityException("Cannot start the Velocity engine", e); } this.runtimeInstance = runtime; this.globalEntry = new TemplateEntry(""); }  }
DefaultVelocityEngine implements VelocityEngine { @Override public void initialize(Properties overridingProperties) throws XWikiVelocityException { RuntimeInstance runtime = new RuntimeInstance(); runtime.setApplicationAttribute(ComponentManager.class.getName(), this.componentManager); initializeProperties(runtime, this.velocityConfiguration.getProperties(), overridingProperties); runtime.loadDirective(TryCatchDirective.class.getName()); try { runtime.init(); } catch (Exception e) { throw new XWikiVelocityException("Cannot start the Velocity engine", e); } this.runtimeInstance = runtime; this.globalEntry = new TemplateEntry(""); }  @Override void initialize(Properties overridingProperties); @Override boolean evaluate(Context context, Writer out, String templateName, String source); @Override boolean evaluate(Context context, Writer out, String namespace, Reader source); @Override @Deprecated void clearMacroNamespace(String namespace); @Override void startedUsingMacroNamespace(String namespace); @Override void stoppedUsingMacroNamespace(String namespace); }
DefaultVelocityEngine implements VelocityEngine { @Override public void initialize(Properties overridingProperties) throws XWikiVelocityException { RuntimeInstance runtime = new RuntimeInstance(); runtime.setApplicationAttribute(ComponentManager.class.getName(), this.componentManager); initializeProperties(runtime, this.velocityConfiguration.getProperties(), overridingProperties); runtime.loadDirective(TryCatchDirective.class.getName()); try { runtime.init(); } catch (Exception e) { throw new XWikiVelocityException("Cannot start the Velocity engine", e); } this.runtimeInstance = runtime; this.globalEntry = new TemplateEntry(""); }  @Override void initialize(Properties overridingProperties); @Override boolean evaluate(Context context, Writer out, String templateName, String source); @Override boolean evaluate(Context context, Writer out, String namespace, Reader source); @Override @Deprecated void clearMacroNamespace(String namespace); @Override void startedUsingMacroNamespace(String namespace); @Override void stoppedUsingMacroNamespace(String namespace);  }