Merged V2.2 to HEAD

11008: FileFolderService no longer uses Lucene
   11014: Fixed ETWOTWO-569: Regression after ContentStoreCleaner overhaul
   11021: Fixed HibernateSessionHelperTest
   11028: Fixed unit test's expected values
   11035: Made cm:auditable optional and fixed 64K limit on property list sizes
   11038: IncompleteNodeTagger handles aspects that are not in the dictionary
   11039: Added tests to ensure that QName caching is case-insensitive
   11040: Fixed use of mixed-case QNames for aspects
   11044: Allow background AND in-transaction indexing to be disabled at the same time.
   11046: Removed Lucene use from RegistryServiceImpl
   11050: Removal of Lucene usage
          - ML services finding root using XPath moved to path query
          - RepoStore now uses simple path query
          - Remove unused imports on PersonServiceImpl


git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@11215 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Derek Hulley
2008-10-06 15:03:24 +00:00
parent 11d8183d8e
commit ad31021fff
26 changed files with 635 additions and 415 deletions

View File

@@ -28,6 +28,7 @@ import java.io.Serializable;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
import java.util.Set;
import org.alfresco.model.ContentModel;
import org.alfresco.service.cmr.repository.ChildAssociationRef;
@@ -88,18 +89,63 @@ public class AuditableAspectTest extends BaseSpringTest
System.out.println(NodeStoreInspector.dumpNodeStore(nodeService, storeRef));
}
/**
* @deprecated <b>cm:auditable</b> is always present (2.2.2)
*/
public void testNoAudit()
{
// Create a person (which doesn't have auditable capability by default)
Map<QName, Serializable> personProps = new HashMap<QName, Serializable>();
personProps.put(ContentModel.PROP_USERNAME, "test person");
personProps.put(ContentModel.PROP_HOMEFOLDER, rootNodeRef);
personProps.put(ContentModel.PROP_FIRSTNAME, "test first name");
personProps.put(ContentModel.PROP_LASTNAME, "test last name");
ChildAssociationRef childAssocRef = nodeService.createNode(
rootNodeRef,
ContentModel.ASSOC_CHILDREN,
QName.createQName("{test}testperson"),
ContentModel.TYPE_PERSON,
personProps);
// Assert the person is not auditable
Set<QName> aspects = nodeService.getAspects(childAssocRef.getChildRef());
assertFalse(aspects.contains(ContentModel.ASPECT_AUDITABLE));
System.out.println(NodeStoreInspector.dumpNodeStore(nodeService, storeRef));
}
/**
* @deprecated <b>cm:auditable</b> is always present (2.2.2)
*/
public void testAddAudit()
{
// Create a person
Map<QName, Serializable> personProps = new HashMap<QName, Serializable>();
personProps.put(ContentModel.PROP_USERNAME, "test person");
personProps.put(ContentModel.PROP_HOMEFOLDER, rootNodeRef);
personProps.put(ContentModel.PROP_FIRSTNAME, "test first name");
personProps.put(ContentModel.PROP_LASTNAME, "test last name");
ChildAssociationRef childAssocRef = nodeService.createNode(
rootNodeRef,
ContentModel.ASSOC_CHILDREN,
QName.createQName("{test}testperson"),
ContentModel.TYPE_PERSON,
personProps);
// Assert the person is not auditable
Set<QName> aspects = nodeService.getAspects(childAssocRef.getChildRef());
assertFalse(aspects.contains(ContentModel.ASPECT_AUDITABLE));
// Add auditable capability
nodeService.addAspect(childAssocRef.getChildRef(), ContentModel.ASPECT_AUDITABLE, null);
nodeService.addAspect(childAssocRef.getChildRef(), ContentModel.ASPECT_TITLED, null);
// Assert the person is now audiable
aspects = nodeService.getAspects(childAssocRef.getChildRef());
assertTrue(aspects.contains(ContentModel.ASPECT_AUDITABLE));
// Assert the person's auditable property
assertAuditableProperties(childAssocRef.getChildRef());
System.out.println(NodeStoreInspector.dumpNodeStore(nodeService, storeRef));
}
public synchronized void testAddAspect() throws Exception
@@ -112,7 +158,7 @@ public class AuditableAspectTest extends BaseSpringTest
personProps.put(ContentModel.PROP_LASTNAME, "test last name");
long t1 = System.currentTimeMillis();
this.wait(100);
this.wait(100); // Needed for system clock inaccuracies
ChildAssociationRef childAssocRef = nodeService.createNode(
rootNodeRef,
@@ -121,9 +167,12 @@ public class AuditableAspectTest extends BaseSpringTest
ContentModel.TYPE_PERSON,
personProps);
NodeRef nodeRef = childAssocRef.getChildRef();
// Add auditable capability
nodeService.addAspect(nodeRef, ContentModel.ASPECT_AUDITABLE, null);
assertAuditableProperties(nodeRef);
this.wait(100); // Needed for system clock inaccuracies
long t2 = System.currentTimeMillis();
// Check that the dates were set correctly