mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
Better debugging and toString() methods for GetChildCannedQuery (found while investigating ALF-10224)
git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@30385 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -645,6 +645,12 @@ public class GetChildrenCannedQuery extends AbstractCannedQueryPermissions<NodeR
|
||||
this.propVals = propVals;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString()
|
||||
{
|
||||
return "FilterSortNode [nodeRef=" + nodeRef + ", propVals=" + propVals + "]";
|
||||
}
|
||||
|
||||
public NodeRef getNodeRef()
|
||||
{
|
||||
return nodeRef;
|
||||
|
@@ -429,7 +429,7 @@ public class GetChildrenCannedQueryTest extends TestCase
|
||||
}
|
||||
}
|
||||
|
||||
public void DISABLED_testPropertySorting() throws Exception
|
||||
public void testPropertySorting() throws Exception
|
||||
{
|
||||
NodeRef parentNodeRef = repositoryHelper.getCompanyHome();
|
||||
|
||||
@@ -763,11 +763,15 @@ public class GetChildrenCannedQueryTest extends TestCase
|
||||
|
||||
// check order
|
||||
Serializable prevVal = null;
|
||||
NodeRef prevNodeRef = null;
|
||||
int currentIteration = 0;
|
||||
|
||||
boolean allValsNull = true;
|
||||
|
||||
for (NodeRef nodeRef : results.getPage())
|
||||
{
|
||||
currentIteration++;
|
||||
|
||||
Serializable val = null;
|
||||
|
||||
if (sortPropQName.equals(GetChildrenCannedQuery.SORT_QNAME_CONTENT_SIZE) || sortPropQName.equals(GetChildrenCannedQuery.SORT_QNAME_CONTENT_MIMETYPE))
|
||||
@@ -835,19 +839,30 @@ public class GetChildrenCannedQueryTest extends TestCase
|
||||
}
|
||||
else
|
||||
{
|
||||
fail("Unsupported sort type: "+val.getClass().getName());
|
||||
fail("Unsupported sort type ("+nodeRef+"): "+val.getClass().getName());
|
||||
}
|
||||
|
||||
if (! sortAscending)
|
||||
{
|
||||
assertTrue("Not descending: ["+sortPropQName+","+val+","+prevVal+"]", result <= 0);
|
||||
assertTrue(
|
||||
"Not descending: \n" +
|
||||
" Iteration: " + currentIteration + " out of " + count + "\n" +
|
||||
" Previous: " + prevNodeRef + " had " + prevVal + "\n" +
|
||||
" Current : " + nodeRef + " had " + val,
|
||||
result <= 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
assertTrue("Not ascending: ["+sortPropQName+","+val+","+prevVal+"]", result >= 0);
|
||||
assertTrue(
|
||||
"Not ascending: \n" +
|
||||
" Iteration: " + currentIteration + " out of " + count + "\n" +
|
||||
" Previous: " + prevNodeRef + " had " + prevVal + "\n" +
|
||||
" Current : " + nodeRef + " had " + val,
|
||||
result >= 0);
|
||||
}
|
||||
}
|
||||
prevVal = val;
|
||||
prevNodeRef = nodeRef;
|
||||
}
|
||||
|
||||
assertFalse("All values were null", allValsNull);
|
||||
|
Reference in New Issue
Block a user