- Added custom namespace definition for (spring-template-1.2.xsd) the associated entry in NamespaceParserRegistry

- Added documentation for the spring template nvelocity implementation
This commit is contained in:
erezmazor
2009-07-11 20:25:38 +00:00
parent 3c7d8eabf7
commit c75ee59140
9 changed files with 596 additions and 4 deletions

View File

@@ -80,6 +80,19 @@ namespace Spring.Template.Velocity.Tests.Template.Velocity {
Assert.AreEqual(string.Format("value={0}", TEST_VALUE), mergedTemplate);
}
/// <summary>
/// Test the fileBasedVelocityEngine bean configuration from VelocityEngineFactoryObjectTests.xml
/// </summary>
[Test]
public void TestMergeUsingCustomNamespaceDefinition() {
VelocityEngine velocityEngine =
appContext.GetObject("customNamespaceVelocityTemplate") as VelocityEngine;
Assert.IsNotNull(velocityEngine, "velocityEngine is null");
string mergedTemplate = VelocityEngineUtils.MergeTemplateIntostring(velocityEngine, "SimpleTemplate.vm",
Encoding.UTF8.WebName, model);
Assert.AreEqual(string.Format("value={0}", "TEST_VALUE"), mergedTemplate);
}
/// <summary>
/// Test using definition of ResourceLoaderPath (file-based configuration) referencing just the template name
/// </summary>

View File

@@ -1,5 +1,12 @@
<?xml version="1.0" encoding="utf-8" ?>
<objects xmlns="http://www.springframework.net">
<objects xmlns="http://www.springframework.net" xmlns:template="http://www.springframework.net/template">
<template:nvelocity id="customNamespaceVelocityTemplate" >
<template:resource-loader>
<template:file path="Template/Velocity/" />
</template:resource-loader>
</template:nvelocity>
<!-- Does file system access with hot tracking with NVelocity assembly resource loader -->
<object id="assemblyBasedVelocityEngine" type="Spring.Template.Velocity.VelocityEngineFactoryObject, Spring.Template.Velocity">
@@ -39,5 +46,4 @@
<property name="ResourceLoaderPath " value="Template/Velocity/" />
<property name="PreferFileSystemAccess " value="false" />
</object>
</objects>