ALF-2086: CMIS Web Service policy and aspect unit tests

- Added Alfresco-specific unit tests, actually run by the build
- Fixed exception handling in getProperty
- Fix null value handling in createProperty

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@19451 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Dave Ward
2010-03-22 12:08:30 +00:00
parent e31bab4ce7
commit 56d4c7c51a
6 changed files with 420 additions and 24 deletions

View File

@@ -123,17 +123,20 @@ public class PropertyUtil
* @param defaultValue - some value of the appropriate for conversion type. Also <b>null</b> may be accepted by this parameter
* @return value instance of the appropriate type if specified object has such property and <i>defaultValue</i> if requested property value or <i>objectNodeRef</i> or
* <i>propertyName</i> are <b>null</b> or if some exception occurred during property receiving
* @throws CMISInvalidArgumentException
*/
public <ResultType> ResultType getProperty(NodeRef objectNodeRef, String propertyName, ResultType defaultValue)
throws CMISInvalidArgumentException
{
if ((null == objectNodeRef) || (null == propertyName))
{
return defaultValue;
}
Serializable value = cmisService.getProperty(objectNodeRef, propertyName);
try
{
return convertPropertyValue(cmisService.getProperty(objectNodeRef, propertyName), defaultValue);
return convertPropertyValue(value, defaultValue);
}
catch (Exception exception)
{
@@ -511,6 +514,11 @@ public class PropertyUtil
@SuppressWarnings("unchecked")
public CmisProperty createProperty(String pdid, CMISDataTypeEnum dataType, Serializable value)
{
if (value == null)
{
return null;
}
switch (dataType)
{
case BOOLEAN: