mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
Added extra checks on MLText and null values
git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@22016 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -121,14 +121,32 @@ public class FullNodeServiceTest extends BaseNodeServiceTest
|
||||
|
||||
public void testNullMLText() throws Exception
|
||||
{
|
||||
Map<QName, Serializable> properties = nodeService.getProperties(rootNodeRef);
|
||||
// Set an ML value to null
|
||||
properties.put(BaseNodeServiceTest.PROP_QNAME_ML_TEXT_VALUE, null);
|
||||
nodeService.setProperty(rootNodeRef, BaseNodeServiceTest.PROP_QNAME_ML_TEXT_VALUE, null);
|
||||
// Get them again
|
||||
Serializable mlTextSer = nodeService.getProperty(rootNodeRef, BaseNodeServiceTest.PROP_QNAME_ML_TEXT_VALUE);
|
||||
MLText mlText = DefaultTypeConverter.INSTANCE.convert(MLText.class, mlTextSer);
|
||||
assertNull("Value returned is not null", mlText);
|
||||
|
||||
// Now create an MLText object with a null entry
|
||||
mlText = new MLText(null);
|
||||
nodeService.setProperty(rootNodeRef, BaseNodeServiceTest.PROP_QNAME_ML_TEXT_VALUE, null);
|
||||
MLText mlTextCheck = (MLText) nodeService.getProperty(rootNodeRef, BaseNodeServiceTest.PROP_QNAME_ML_TEXT_VALUE);
|
||||
assertNull("MLText value should have been converted to a null String", mlTextCheck);
|
||||
|
||||
// Do the same as ML-aware
|
||||
MLPropertyInterceptor.setMLAware(true);
|
||||
try
|
||||
{
|
||||
mlText = new MLText(null);
|
||||
nodeService.setProperty(rootNodeRef, BaseNodeServiceTest.PROP_QNAME_ML_TEXT_VALUE, null);
|
||||
mlTextCheck = (MLText) nodeService.getProperty(rootNodeRef, BaseNodeServiceTest.PROP_QNAME_ML_TEXT_VALUE);
|
||||
assertEquals("MLText value was not pulled out the same as it went in", mlText, mlTextCheck);
|
||||
}
|
||||
finally
|
||||
{
|
||||
MLPropertyInterceptor.setMLAware(false); // Don't mess up the thread
|
||||
}
|
||||
}
|
||||
|
||||
public void testMLValuesOnCreate() throws Exception
|
||||
@@ -335,10 +353,6 @@ public class FullNodeServiceTest extends BaseNodeServiceTest
|
||||
assertEquals("First collection incorrect", 2, ((Collection)checkValues.get(0)).size());
|
||||
assertEquals("Second collection incorrect", 2, ((Collection)checkValues.get(1)).size());
|
||||
}
|
||||
catch (DictionaryException e)
|
||||
{
|
||||
// expected
|
||||
}
|
||||
finally
|
||||
{
|
||||
try { txn.rollback(); } catch (Throwable e) {}
|
||||
|
Reference in New Issue
Block a user