mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
Merged HEAD-BUG-FIX (5.1/Cloud) to HEAD (5.1/Cloud)
97593: Merged NESS/5.0.N-2015_01-20 (5.0.1) to HEAD-BUG-FIX (5.1/Cloud) 97514: MNT-13392 : Rendition - Error in AbstractRenderingEngine with model param using FreemarkerRenderingEngine - FIxed isAssignbleFrom issue when FreemarkerRenderingEngine is using params; added new test for case git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@97631 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -720,7 +720,7 @@ public abstract class AbstractRenderingEngine extends ActionExecuterAbstractBase
|
||||
if(clazz == null)
|
||||
throw new RenditionServiceException("The class must not be null!", new NullPointerException());
|
||||
Class<? extends Serializable> valueClass = value.getClass();
|
||||
if ( !valueClass.isAssignableFrom(clazz))
|
||||
if ( !clazz.isAssignableFrom(valueClass))
|
||||
{
|
||||
throw new RenditionServiceException("The parameter: " + paramName + " must be of type: "
|
||||
+ clazz.getName() + "but was of type: " + valueClass.getName());
|
||||
|
@@ -255,6 +255,45 @@ public class RenditionServiceIntegrationTest extends BaseAlfrescoSpringTest
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void testHTMLRenderFreeMarkerTemplate() throws Exception
|
||||
{
|
||||
this.setComplete();
|
||||
this.endTransaction();
|
||||
final QName renditionName = QName.createQName(NamespaceService.RENDITION_MODEL_1_0_URI,
|
||||
"htmlRenderingDefinition");
|
||||
|
||||
this.renditionNode = transactionHelper
|
||||
.doInTransaction(new RetryingTransactionHelper.RetryingTransactionCallback<NodeRef>()
|
||||
{
|
||||
@Override
|
||||
public NodeRef execute() throws Throwable
|
||||
{
|
||||
// create test model
|
||||
RenditionDefinition htmlDefinition = renditionService
|
||||
.createRenditionDefinition(renditionName,
|
||||
FreemarkerRenderingEngine.NAME);
|
||||
|
||||
htmlDefinition.setParameterValue(
|
||||
FreemarkerRenderingEngine.PARAM_TEMPLATE_NODE,
|
||||
nodeWithFreeMarkerContent);
|
||||
htmlDefinition.setParameterValue(FreemarkerRenderingEngine.PARAM_MIME_TYPE,
|
||||
MimetypeMap.MIMETYPE_HTML);
|
||||
|
||||
Map<String, Serializable> paramMap = new HashMap<String, Serializable>();
|
||||
paramMap.put("test", "test");
|
||||
htmlDefinition.setParameterValue(FreemarkerRenderingEngine.PARAM_MODEL,
|
||||
(Serializable) paramMap);
|
||||
|
||||
|
||||
ChildAssociationRef renditionAssoc = renditionService.render(
|
||||
nodeWithDocContent, htmlDefinition);
|
||||
assertNotNull("The rendition association was null", renditionAssoc);
|
||||
return renditionAssoc.getChildRef();
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
public void testRenderFreeMarkerTemplateOneTransaction() throws Exception
|
||||
{
|
||||
|
Reference in New Issue
Block a user