Merged V2.9 to HEAD

10586: Merged V2.2 to V2.9
      9883: Fix for https://issues.alfresco.com/jira/browse/ETWOTWO-561
      9893: Gave some more time to wait for the threads to finish (QNameDAOTest)
      9955: Added trace logging of calls that possibly cause failures during session flushing
      9956: Part fix ETWOTWO570: RetryingTransactionAdvice needs to use RetryingTransactionHelper
      9958: Fixed ETWOTWO-570: AVM transaction interceptors fail if methods are incorrectly declared
      9973: More missing transaction declarations for AttributeService
      9977: Fixed unit test to rollback properly after expected txn failure
      9978: Fix for ETWOTWO-440: Error : 500: Failed to execute method NodeInfoBean.sendNodeInfo
      9986: LinkValidationService missing txn declaration for onBootstrap
   10588: Merged V2.2 to V2.9
      9898: Fixed handling of cm:name on root nodes
      9900: Empty property sets are allowed
   10589: Merged V2.2 to V2.9
      9965: Fixed unit test to inject 'nodeService' and not 'NodeService'.
      10311: getWebProjectUserRole - change log level from info to debug
      10329: Fix missing and mis-spelt transaction declarations
      10343: Fix for ETWOTWO-32
      10346: Build Fix
      10358: Fix for ETWOTWO-621
      10362: Fix for ETWOTWO-518
      10371: QNameDAO cache doesn't blow up if cache entry is invalid
      10538: Fix for minor XSS issue identified in ETWOTWO-657 item 3
   10678: Merged V2.2 to V2.9
      10205: Fix for ETWOTWO-48: Cancelled import of war into a Web project and Web Project became unusable
      10206: Fix for ETWOTWO-181: Deletion of checked out document


git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@10710 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Derek Hulley
2008-09-04 01:19:51 +00:00
parent 3227355279
commit 76abcf04d9
23 changed files with 592 additions and 239 deletions

View File

@@ -1176,6 +1176,43 @@ public abstract class BaseNodeServiceTest extends BaseSpringTest
}
}
public void testRemoveProperty() throws Exception
{
Map<QName, Serializable> properties = nodeService.getProperties(rootNodeRef);
// Add an aspect with a default value
nodeService.addAspect(rootNodeRef, ASPECT_QNAME_WITH_DEFAULT_VALUE, null);
// Get the default value
Serializable defaultValue = nodeService.getProperty(rootNodeRef, PROP_QNAME_PROP2);
assertNotNull("No default property value assigned", defaultValue);
// Now apply the original node properties which didn't contain the value
nodeService.setProperties(rootNodeRef, properties);
// Ensure that it is now null
Serializable nullValue = nodeService.getProperty(rootNodeRef, PROP_QNAME_PROP2);
assertNull("Property was not removed", nullValue);
// Remove the property by removing the aspect
nodeService.removeAspect(rootNodeRef, ASPECT_QNAME_WITH_DEFAULT_VALUE);
nullValue = nodeService.getProperty(rootNodeRef, PROP_QNAME_PROP2);
assertNull("Property was not removed", nullValue);
// Do the same, but explicitly set the value to null
nodeService.addAspect(rootNodeRef, ASPECT_QNAME_WITH_DEFAULT_VALUE, null);
defaultValue = nodeService.getProperty(rootNodeRef, PROP_QNAME_PROP2);
assertNotNull("No default property value assigned", defaultValue);
nodeService.setProperty(rootNodeRef, PROP_QNAME_PROP2, null);
nullValue = nodeService.getProperty(rootNodeRef, PROP_QNAME_PROP2);
assertNull("Property was not removed", nullValue);
// Now remove the property directly
nodeService.removeAspect(rootNodeRef, ASPECT_QNAME_WITH_DEFAULT_VALUE);
nodeService.addAspect(rootNodeRef, ASPECT_QNAME_WITH_DEFAULT_VALUE, null);
defaultValue = nodeService.getProperty(rootNodeRef, PROP_QNAME_PROP2);
assertNotNull("No default property value assigned", defaultValue);
nodeService.removeProperty(rootNodeRef, PROP_QNAME_PROP2);
nullValue = nodeService.getProperty(rootNodeRef, PROP_QNAME_PROP2);
assertNull("Property was not removed", nullValue);
}
/**
* Makes a read-only transaction and then looks for a property using a non-existent QName.
* The QName persistence must not lazily create QNameEntity instances for queries.