com.atlassian.bamboo.freemarker
Class FreemarkerTestHelper

java.lang.Object
  extended by com.atlassian.bamboo.freemarker.FreemarkerTestHelper

public class FreemarkerTestHelper
extends java.lang.Object

Helper to write freemarker 'unit' tests


Constructor Summary
FreemarkerTestHelper()
           
 
Method Summary
static freemarker.template.Configuration createTestingConfiguration(java.lang.Class<?> clazz, java.lang.String template)
          Create FreeMarker testing configuration
static java.lang.String runFreemarkerMacro(java.lang.Class<?> clazz, java.util.Map datamodel, java.lang.String template, java.lang.String macro, java.lang.String macroParams)
          Process a template macro using FreeMarker and return the results If template has some 'not macro' code it will be run anyway...
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FreemarkerTestHelper

public FreemarkerTestHelper()
Method Detail

createTestingConfiguration

public static freemarker.template.Configuration createTestingConfiguration(java.lang.Class<?> clazz,
                                                                           java.lang.String template)
                                                                    throws java.io.IOException
Create FreeMarker testing configuration

Parameters:
clazz - class to get classloader from for loading templates
template - example template to be loaded with this configuration (to detect if it's run locally)
Returns:
freemarker configuration
Throws:
java.io.IOException

runFreemarkerMacro

public static java.lang.String runFreemarkerMacro(java.lang.Class<?> clazz,
                                                  java.util.Map datamodel,
                                                  java.lang.String template,
                                                  java.lang.String macro,
                                                  java.lang.String macroParams)
                                           throws java.lang.Exception
Process a template macro using FreeMarker and return the results If template has some 'not macro' code it will be run anyway...

Parameters:
clazz - class to get classloader from for loading templates
datamodel - FreeMarker context
template - template file name
macro - macro name in template
macroParams - call parameters of macro
Returns:
result of macro processing
Throws:
java.lang.Exception - if processing went wrong


Copyright © 2014 Atlassian Software Systems Pty Ltd. All Rights Reserved.