From e6a946a443dfc4833abf4ed3cbfaa64169fda52f Mon Sep 17 00:00:00 2001 From: Ancuta Morarasu Date: Wed, 11 May 2016 11:21:01 +0000 Subject: [PATCH] Merged HEAD (5.2) to 5.2.N (5.2.1) 126447 jkaabimofrad: Merged FILE-FOLDER-API (5.2.0) to HEAD (5.2) 121977 jvonka: Nodes (FileFolder) API - demonstrate nodeType query without subTypes using cm:link - however, need to workaround subtle issue (if super-type qname has never existed) where FileFolder list (via GetChildren CQ) does not match and returns all ... RA-811, RA-634 git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/BRANCHES/DEV/5.2.N/root@126792 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261 --- .../alfresco/rest/api/tests/NodeApiTest.java | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/source/test-java/org/alfresco/rest/api/tests/NodeApiTest.java b/source/test-java/org/alfresco/rest/api/tests/NodeApiTest.java index 41f4e80f35..f6468a6713 100644 --- a/source/test-java/org/alfresco/rest/api/tests/NodeApiTest.java +++ b/source/test-java/org/alfresco/rest/api/tests/NodeApiTest.java @@ -1436,7 +1436,17 @@ public class NodeApiTest extends AbstractBaseApiTest // filtering, via where clause (nodeType + subTypes) - List linkIds = Arrays.asList(n1Id, n2Id); + // note: subtle issue - in order to filter by "cm:link" the qname must have been created in the DB (in a write txn) + // otherwise query will not match a missing qname (hmm). Workaround here by forcing the create of an explicit "cm:link". + + // create link (dangling here) + nodeName = "link 3"; + nodeType = "cm:link"; + + nodeResp = createNode(user1, f2Id, nodeName, nodeType, props); + String n3Id = nodeResp.getId(); + + List linkIds = Arrays.asList(n1Id, n2Id, n3Id); Map params = new HashMap<>(); params.put("where", "(nodeType='cm:link')"); @@ -1446,9 +1456,7 @@ public class NodeApiTest extends AbstractBaseApiTest response = getAll(getChildrenUrl(f2Id), user1, paging, params, 200); List nodes = jacksonUtil.parseEntries(response.getJsonResponse(), Node.class); - // TODO review - //assertEquals(0, nodes.size()); - assertEquals(2, nodes.size()); + assertEquals(1, nodes.size()); params = new HashMap<>(); params.put("where", "(nodeType='cm:link' and subTypes=true)"); @@ -1457,7 +1465,7 @@ public class NodeApiTest extends AbstractBaseApiTest response = getAll(getChildrenUrl(f2Id), user1, paging, params, 200); nodes = jacksonUtil.parseEntries(response.getJsonResponse(), Node.class); - assertEquals(2, nodes.size()); + assertEquals(3, nodes.size()); assertTrue(linkIds.contains(nodes.get(0).getId())); assertTrue(linkIds.contains(nodes.get(1).getId()));