Merged 5.0.N (5.0.4) to 5.1.N (5.1.1)

120957 rneamtu: Merged NESS/5.0.N-2016-01-05/ (5.0.4) to 5.0.N (5.0.4)
      120843: MNT-14386 : renditionService.render method is creating a temporary file in User's trashcan
         - Added temporary aspect on temporary rendition before delete it
      120927: MNT-14386 : renditionService.render method is creating a temporary file in User's trashcan
         - Added a test for case


git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/BRANCHES/DEV/5.1.N/root@120969 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Ancuta Morarasu
2016-01-18 09:23:41 +00:00
parent 480038998d
commit 1311c3af3a
2 changed files with 22 additions and 2 deletions

View File

@@ -980,6 +980,9 @@ public abstract class AbstractRenderingEngine extends ActionExecuterAbstractBase
String renditionName = getRenditionName(tempRenditionNode, renditionLocation, renditionDefinition); String renditionName = getRenditionName(tempRenditionNode, renditionLocation, renditionDefinition);
nodeService.setProperty(renditionNode.getChildRef(), ContentModel.PROP_NAME, renditionName); // to manager nodeService.setProperty(renditionNode.getChildRef(), ContentModel.PROP_NAME, renditionName); // to manager
// Add temporary aspect for temporary rendition node
// When this node id deleted, will not appear in user's trashcan
nodeService.addAspect(tempRendition.getChildRef(), ContentModel.ASPECT_TEMPORARY, null);
// Delete the temporary rendition. // Delete the temporary rendition.
nodeService.removeChildAssociation(tempRendition); nodeService.removeChildAssociation(tempRendition);
if (logger.isDebugEnabled()) if (logger.isDebugEnabled())

View File

@@ -264,6 +264,7 @@ public class RenditionServiceIntegrationTest extends BaseAlfrescoSpringTest
final QName renditionName = QName.createQName(NamespaceService.RENDITION_MODEL_1_0_URI, final QName renditionName = QName.createQName(NamespaceService.RENDITION_MODEL_1_0_URI,
"htmlRenderingDefinition"); "htmlRenderingDefinition");
int numberOfItemsInTrashcanBeforeRendition = getNumberOfItemsInTrashcan();
this.renditionNode = transactionHelper this.renditionNode = transactionHelper
.doInTransaction(new RetryingTransactionHelper.RetryingTransactionCallback<NodeRef>() .doInTransaction(new RetryingTransactionHelper.RetryingTransactionCallback<NodeRef>()
{ {
@@ -294,8 +295,24 @@ public class RenditionServiceIntegrationTest extends BaseAlfrescoSpringTest
} }
}); });
//testcase for MNT-14386
int numberOfItemsInTrashcanAfterRendition = getNumberOfItemsInTrashcan();
assertEquals(numberOfItemsInTrashcanBeforeRendition, numberOfItemsInTrashcanAfterRendition);
} }
/**
* This method returns the number of items from trashcan
*
* @return int
*/
private int getNumberOfItemsInTrashcan()
{
NodeRef archiveRootNodeRef = nodeService.getRootNode(StoreRef.STORE_REF_ARCHIVE_SPACESSTORE);
return nodeService.countChildAssocs(archiveRootNodeRef, true);
}
public void testRenderFreeMarkerTemplateOneTransaction() throws Exception public void testRenderFreeMarkerTemplateOneTransaction() throws Exception
{ {
this.setComplete(); this.setComplete();
@@ -1934,7 +1951,7 @@ public class RenditionServiceIntegrationTest extends BaseAlfrescoSpringTest
assertEquals(MimetypeMap.MIMETYPE_FLASH, webpreviewRenditionDef.getParameterValue(AbstractRenderingEngine.PARAM_MIME_TYPE)); assertEquals(MimetypeMap.MIMETYPE_FLASH, webpreviewRenditionDef.getParameterValue(AbstractRenderingEngine.PARAM_MIME_TYPE));
assertEquals(MimetypeMap.MIMETYPE_IMAGE_PNG, avatarRenditionDef.getParameterValue(AbstractRenderingEngine.PARAM_MIME_TYPE)); assertEquals(MimetypeMap.MIMETYPE_IMAGE_PNG, avatarRenditionDef.getParameterValue(AbstractRenderingEngine.PARAM_MIME_TYPE));
} }
/** /**
* This test checks that for a node with an existing rendition, that if you update its content with content * This test checks that for a node with an existing rendition, that if you update its content with content
* that cannot be renditioned (thumbnailed), that existing rendition nodes for failed re-renditions are removed. * that cannot be renditioned (thumbnailed), that existing rendition nodes for failed re-renditions are removed.