Merged DEV/SWIFT to HEAD

27584: ALF-8189: RINF 16: Upgrade peer associations
          - Create scripts and upgrades to add alf_node_assoc.assoc_index for all DBs
          - Part of ALF-7404: RINF 16: Peer association enhancements
   27640: Re-added changes from rev 27125, which were overwritten by 27584 (ALF-8334: RSOLR 013)
   28295: (RECORD ONLY) Upgrade Tika and POI to the latest versions

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@28309 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Derek Hulley
2011-06-09 14:19:10 +00:00
parent ae765f91d9
commit eb64645c97
17 changed files with 425 additions and 60 deletions

View File

@@ -2406,24 +2406,34 @@ public abstract class BaseNodeServiceTest extends BaseSpringTest
}
/**
* Creates a named association between two nodes
*
* @return Returns an array of [source real NodeRef][target reference NodeRef][assoc name String]
* Creates a named association between two new nodes
*/
private AssociationRef createAssociation() throws Exception
{
return createAssociation(null, null);
}
/**
* Creates an association between a given source and a new target
*/
private AssociationRef createAssociation(NodeRef sourceRef, Long insertAfter) throws Exception
{
// TODO: Use insertAfter
Map<QName, Serializable> properties = new HashMap<QName, Serializable>(5);
fillProperties(TYPE_QNAME_TEST_CONTENT, properties);
fillProperties(ASPECT_QNAME_TEST_TITLED, properties);
if (sourceRef == null)
{
ChildAssociationRef childAssocRef = nodeService.createNode(
rootNodeRef,
ASSOC_TYPE_QNAME_TEST_CHILDREN,
QName.createQName(null, "N1"),
TYPE_QNAME_TEST_CONTENT,
properties);
sourceRef = childAssocRef.getChildRef();
}
ChildAssociationRef childAssocRef = nodeService.createNode(
rootNodeRef,
ASSOC_TYPE_QNAME_TEST_CHILDREN,
QName.createQName(null, "N1"),
TYPE_QNAME_TEST_CONTENT,
properties);
NodeRef sourceRef = childAssocRef.getChildRef();
childAssocRef = nodeService.createNode(
rootNodeRef,
ASSOC_TYPE_QNAME_TEST_CHILDREN,
QName.createQName(null, "N2"),
@@ -2511,6 +2521,60 @@ public abstract class BaseNodeServiceTest extends BaseSpringTest
}
}
public void testTargetAssoc_NaturalOrdering() throws Exception
{
AssociationRef assocRef = createAssociation();
NodeRef sourceRef = assocRef.getSourceRef();
QName qname = assocRef.getTypeQName();
for (int i = 0; i < 99; i++)
{
assocRef = createAssociation(sourceRef, null);
}
// Now get the associations and ensure that they are in order of ID
// because they should have been inserted in natural order
List<AssociationRef> assocs = nodeService.getTargetAssocs(sourceRef, ASSOC_TYPE_QNAME_TEST_NEXT);
Long lastId = 0L;
for (AssociationRef associationRef : assocs)
{
Long id = associationRef.getId();
assertNotNull("Null association ID: " + associationRef, id);
assertTrue("Results should be in ID order", id > lastId);
lastId = id;
}
setComplete();
endTransaction();
}
public void DISABLED_testTargetAssoc_InverseOrdering() throws Exception
{
AssociationRef assocRef = createAssociation();
NodeRef sourceRef = assocRef.getSourceRef();
QName qname = assocRef.getTypeQName();
for (int i = 0; i < 99; i++)
{
assocRef = createAssociation(sourceRef, 0L);
}
// Now get the associations and ensure that they are in order of ID
// because they should have been inserted in natural order
List<AssociationRef> assocs = nodeService.getTargetAssocs(sourceRef, ASSOC_TYPE_QNAME_TEST_NEXT);
Long lastId = 0L;
for (AssociationRef associationRef : assocs)
{
Long id = associationRef.getId();
assertNotNull("Null association ID: " + associationRef, id);
assertTrue("Results should be in reverse ID order", id < lastId);
lastId = id;
}
setComplete();
endTransaction();
}
public void testGetSourceAssocs() throws Exception
{
AssociationRef assocRef = createAssociation();