mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-07-07 18:25:23 +00:00
33836: Fix for ALF-10651 Fix patches that trigger reindexing and ALF-10656 SOLR: Patches execute search during bootstrap causing deadlock 33842: Fixes ALF-12797: i18n strings in activiti-admin login-screen escaped properly 33844: Fix for ALF-10651 Fix patches that trigger reindexing and ALF-10656 SOLR: Patches execute search during bootstrap causing deadlock - batch touch to limit the in clause size generated 33845: Manually added extra core Share extensions needed for the V4.0 Records Management module from the development branch. - Refactored JSON property decorators for the Document Library data webscripts - Document List banners (e.g. working copy) moved into metadata template config - Ability to override default document/folder title within Document Library (<title> element in metadata template - unused in core code) - Additional extension point in surf-doclist to override remote data URL - Better handling for missing content property 33852: ALF-12725: Merged V3.4-BUG-FIX (3.4.9) to V4.0-BUG-FIX (4.0.1) 33849: Merged V3 (3.4.8) to V3.4-BUG-FIX (3.4.9) 33848: ALF-10976 (relates to ALF-10412) Fixed bug to do with preview being stuck as always being 'Content cannot be previewed. Do you wish to download?' or a 'blank preview after a transformer is not found' for all content with the same mimetype. Cache in ThumbnailRegistory.getThumbnailDefinitions() now understands that transformers may have an upper content size limit. The choice between the two options was based on the size of the first file previewed of each mimetype. Needed to add getMaxSourceSizeBytes() to support this (see below). - refactored (previous refactor was incomplete) ContentTransformer so that the two halfs of isTransformable is now split into sub methods isTransformableMimetypes and isTransformableSize. This is why there are so many files changed. - Moved getMaxSourceSizeBytes() from AbstractContentTransformerLimits to ContentTransformer as there were becomming too many places in the code that needed needed to check if the ContentTransformer was an instanceof AbstractContentTransformerLimits before calling this method. - TransformerDebug now uses KB MB GB values in output to make it simpler to read. - TransformerDebug now uses thousand separaters in millisecond values to make it simpler to read. - TransformerDebug now reports the 'parent' transformer name rather than the sub-transformer name when an unavailable transformer is found. Makes it simpler to tie up with the 'available transformer' list with the new pushIsTransformableSize() calls. - TransformerDebug now uses trace logging for calls from ThumbnailRegistory.isThumbnailDefinitionAvailable() as it is normally followed by a ContentService.transform() which is logged at debug level anyway. - TransformerDebug now turns logging level to trace if the file size is 0 bytes. Request from Jan. Not sure how one uploads such a file! - Modified ComplexContentTransformer.isTransformable() so that it checks the mimetypes before the sizes so that TransformerDebug does not report 'unavailable transformers' that don't support the mimetype conversion. - Modified ComplexContentTransformer.getLimits and ComplexContentTransformer.isPageLimitSupported() to include the limits from the first sub transformer. Was not an issue until ContentTransformer.getMaxSourceSizeBytes() was introduced. - Added logger to RhinoScriptProcessor to debug requests run javascript on the server. - Dropped the sourceUrl parameter from ThumbnailRegistry.getThumbnailDefinitions() which was introduced with limits as it is logicall not needed. 33853: DiskInterface.renameFile() can now throw PermissionDeniedException to return a different status to the client. Part of ALF-12717. 33856: Merged V3.4-BUG-FIX to V4.0-BUG-FIX 33835: ALF-12546: Remove references to retired RegPaths.exe from installed apply_amps.bat script 33843: Fix for ALF-12775 33855: Merged V3.4 to V3.4-BUG-FIX 33851: ALF-12588: Documents Intermittently Do Not Appear in Share - Fix by Alex Busel for regression I accidentally caused in 3.4.6 - Simple typo in mergeDeletions() caused path deletions to sometimes not get applied or get processed twice - Yikes! git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@33857 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
150 lines
5.9 KiB
Java
150 lines
5.9 KiB
Java
/*
|
|
* Copyright (C) 2005-2012 Alfresco Software Limited.
|
|
*
|
|
* This file is part of Alfresco
|
|
*
|
|
* Alfresco is free software: you can redistribute it and/or modify
|
|
* it under the terms of the GNU Lesser General Public License as published by
|
|
* the Free Software Foundation, either version 3 of the License, or
|
|
* (at your option) any later version.
|
|
*
|
|
* Alfresco is distributed in the hope that it will be useful,
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
* GNU Lesser General Public License for more details.
|
|
*
|
|
* You should have received a copy of the GNU Lesser General Public License
|
|
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
|
|
*/
|
|
package org.alfresco.repo.version;
|
|
|
|
import org.alfresco.model.ContentModel;
|
|
import org.alfresco.repo.content.transform.ContentTransformer;
|
|
import org.alfresco.service.cmr.repository.ContentReader;
|
|
import org.alfresco.service.cmr.repository.ContentService;
|
|
import org.alfresco.service.cmr.repository.ContentWriter;
|
|
import org.alfresco.service.cmr.repository.NodeRef;
|
|
import org.alfresco.service.cmr.repository.TransformationOptions;
|
|
import org.alfresco.service.cmr.version.Version;
|
|
|
|
/**
|
|
* Tests for retrieving frozen content from a verioned node
|
|
*
|
|
* @author Roy Wetherall
|
|
*/
|
|
public class ContentServiceImplTest extends BaseVersionStoreTest
|
|
{
|
|
/**
|
|
* Test content data
|
|
*/
|
|
private final static String UPDATED_CONTENT = "This content has been updated with a new value.";
|
|
|
|
/**
|
|
* The version content store
|
|
*/
|
|
private ContentService contentService;
|
|
|
|
/**
|
|
* Called during the transaction setup
|
|
*/
|
|
protected void onSetUpInTransaction() throws Exception
|
|
{
|
|
super.onSetUpInTransaction();
|
|
|
|
// Get the instance of the required content service
|
|
this.contentService = (ContentService)this.applicationContext.getBean("contentService");
|
|
}
|
|
|
|
/**
|
|
* Test getReader
|
|
*/
|
|
public void testGetReader()
|
|
{
|
|
// Create a new versionable node
|
|
NodeRef versionableNode = createNewVersionableNode();
|
|
|
|
// Create a new version
|
|
Version version = createVersion(versionableNode, this.versionProperties);
|
|
NodeRef versionNodeRef = version.getFrozenStateNodeRef();
|
|
|
|
// Get the content reader for the frozen node
|
|
ContentReader contentReader = this.contentService.getReader(versionNodeRef, ContentModel.PROP_CONTENT);
|
|
assertNotNull(contentReader);
|
|
assertEquals(TEST_CONTENT, contentReader.getContentString());
|
|
|
|
// Now update the content and verison again
|
|
ContentWriter contentWriter = this.contentService.getWriter(versionableNode, ContentModel.PROP_CONTENT, true);
|
|
assertNotNull(contentWriter);
|
|
contentWriter.putContent(UPDATED_CONTENT);
|
|
Version version2 = createVersion(versionableNode, this.versionProperties);
|
|
NodeRef version2NodeRef = version2.getFrozenStateNodeRef();
|
|
|
|
// Get the content reader for the new verisoned content
|
|
ContentReader contentReader2 = this.contentService.getReader(version2NodeRef, ContentModel.PROP_CONTENT);
|
|
assertNotNull(contentReader2);
|
|
assertEquals(UPDATED_CONTENT, contentReader2.getContentString());
|
|
}
|
|
|
|
/**
|
|
* Test getWriter
|
|
*/
|
|
public void testGetWriter()
|
|
{
|
|
// Create a new versionable node
|
|
NodeRef versionableNode = createNewVersionableNode();
|
|
|
|
// Create a new version
|
|
Version version = createVersion(versionableNode, this.versionProperties);
|
|
|
|
// Get writer is not supported by the version content service
|
|
try
|
|
{
|
|
ContentWriter contentWriter = this.contentService.getWriter(
|
|
version.getFrozenStateNodeRef(),
|
|
ContentModel.PROP_CONTENT,
|
|
true);
|
|
contentWriter.putContent("bobbins");
|
|
fail("This operation is not supported.");
|
|
}
|
|
catch (Exception exception)
|
|
{
|
|
// An exception should be raised
|
|
}
|
|
}
|
|
|
|
public void testGetTransformer0()
|
|
{
|
|
ContentTransformer transformer = contentService.getTransformer("test", "application/vnd.ms-excel", 0,
|
|
"application/x-shockwave-flash", new TransformationOptions());
|
|
assertTrue("Found have found a transformer for 0 bytes", transformer != null);
|
|
}
|
|
|
|
public void testGetTransformer10K()
|
|
{
|
|
ContentTransformer transformer = contentService.getTransformer("test", "application/vnd.ms-excel", 1024*10,
|
|
"application/x-shockwave-flash", new TransformationOptions());
|
|
assertTrue("Found have found a transformer for 10 K", transformer != null);
|
|
}
|
|
|
|
public void testGetTransformer1M()
|
|
{
|
|
ContentTransformer transformer = contentService.getTransformer("test", "application/vnd.ms-excel", 1024*1024,
|
|
"application/x-shockwave-flash", new TransformationOptions());
|
|
assertTrue("Found have found a transformer for 1M", transformer != null);
|
|
}
|
|
|
|
public void testGetTransformer10M()
|
|
{
|
|
ContentTransformer transformer = contentService.getTransformer("test", "application/vnd.ms-excel", 1024*1024*10,
|
|
"application/x-shockwave-flash", new TransformationOptions());
|
|
assertTrue("Found NOT have found a transformer for 10M as the is a 1M limit on xsl mimetype", transformer == null);
|
|
}
|
|
|
|
public void testGetMaxSourceSizeByes()
|
|
{
|
|
long maxSourceSizeBytes = contentService.getMaxSourceSizeBytes("application/vnd.ms-excel",
|
|
"application/x-shockwave-flash", new TransformationOptions());
|
|
assertEquals("Found have found a transformer that can handle 1M", 1024*1024, maxSourceSizeBytes);
|
|
}
|
|
}
|