Added more unit tests for RenditionNodeManager which is used by the RenditionServiceImpl to decide where to create a rendition node and how to handle the old rendition node if one exists.

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@19445 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
N Smith
2010-03-22 11:05:04 +00:00
parent 9a6f2ccdae
commit f83eb0d509
4 changed files with 419 additions and 40 deletions

View File

@@ -51,6 +51,8 @@ import org.alfresco.util.GUID;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import com.sun.star.lang.NullPointerException;
/**
* This class adds some new behaviour to the standard ActionExecuterAbstractBase
* in order to support the RenditionService.
@@ -450,8 +452,10 @@ public abstract class AbstractRenderingEngine extends ActionExecuterAbstractBase
return null;
else
{
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 ( !valueClass.isAssignableFrom(clazz))
{
throw new RenditionServiceException("The parameter: " + paramName + " must be of type: "
+ clazz.getName() + "but was of type: " + valueClass.getName());
@@ -476,6 +480,8 @@ public abstract class AbstractRenderingEngine extends ActionExecuterAbstractBase
@SuppressWarnings("unchecked")
public static <T> T getParamWithDefault(String paramName, T defaultValue, RenditionDefinition definition)
{
if(defaultValue == null)
throw new RenditionServiceException("The defaultValue cannot be null!", new NullPointerException());
Class<? extends T> clazz = (Class<? extends T>) defaultValue.getClass();
T result = getCheckedParam(paramName, clazz, definition);
if (result == null)