mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
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:
@@ -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();
|
||||
|
Reference in New Issue
Block a user