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:
Alan Davis
2015-02-20 15:04:58 +00:00
parent e397049530
commit fb978c53cc
2 changed files with 40 additions and 1 deletions

View File

@@ -720,7 +720,7 @@ public abstract class AbstractRenderingEngine extends ActionExecuterAbstractBase
if(clazz == null) if(clazz == null)
throw new RenditionServiceException("The class must not be null!", new NullPointerException()); throw new RenditionServiceException("The class must not be null!", new NullPointerException());
Class<? extends Serializable> valueClass = value.getClass(); Class<? extends Serializable> valueClass = value.getClass();
if ( !valueClass.isAssignableFrom(clazz)) if ( !clazz.isAssignableFrom(valueClass))
{ {
throw new RenditionServiceException("The parameter: " + paramName + " must be of type: " throw new RenditionServiceException("The parameter: " + paramName + " must be of type: "
+ clazz.getName() + "but was of type: " + valueClass.getName()); + clazz.getName() + "but was of type: " + valueClass.getName());

View File

@@ -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 public void testRenderFreeMarkerTemplateOneTransaction() throws Exception
{ {