mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-14 17:58:59 +00:00
Merged 5.2.N (5.2.1) to HEAD (5.2)
129126 mmuller: Merged RETURN-OF-THE-API (5.2.0) to 5.2.N (5.2.1) 128134 jvonka: v1 REST API: minor bug fix(es) to error handling when creating node with assocs + sanity api tests REPO-476, REPO-477 git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@129320 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -1488,6 +1488,8 @@ public class NodeAssociationsApiTest extends AbstractBaseApiTest
|
||||
response = post(getNodeChildrenUrl(myFolderNodeId), user1, toJsonAsStringNonNull(n), 201);
|
||||
String f2Id = RestApiUtil.parseRestApiEntry(response.getJsonResponse(), Node.class).getId();
|
||||
|
||||
String f3Id = createFolder(user1, myFolderNodeId, "f3").getId();
|
||||
|
||||
try
|
||||
{
|
||||
Paging paging = getPaging(0, 100);
|
||||
@@ -1506,13 +1508,42 @@ public class NodeAssociationsApiTest extends AbstractBaseApiTest
|
||||
|
||||
|
||||
// -ve test - minor: error code if creating a cyclic child assoc (REPO-475)
|
||||
String myNodeId = getMyNodeId(user1);
|
||||
n = new Node();
|
||||
n.setName("my-folder-1");
|
||||
n.setName("my-folder");
|
||||
n.setNodeType(TYPE_CM_FOLDER);
|
||||
AssocChild assocChild = new AssocChild(myNodeId, "cm:contains");
|
||||
AssocChild assocChild = new AssocChild(myFolderNodeId, "cm:contains");
|
||||
n.setSecondaryChildren(Collections.singletonList(assocChild));
|
||||
post(getNodeChildrenUrl(myNodeId), user1, RestApiUtil.toJsonAsStringNonNull(n), 400);
|
||||
post(getNodeChildrenUrl(myFolderNodeId), user1, RestApiUtil.toJsonAsStringNonNull(n), 400);
|
||||
|
||||
// -ve tests - missing targetId / childId or assocType
|
||||
|
||||
n = new Node();
|
||||
n.setName("my-folder");
|
||||
n.setNodeType(TYPE_CM_FOLDER);
|
||||
assocChild = new AssocChild(null, ASSOC_TYPE_CM_CONTAINS);
|
||||
n.setSecondaryChildren(Collections.singletonList(assocChild));
|
||||
post(getNodeChildrenUrl(f3Id), user1, RestApiUtil.toJsonAsStringNonNull(n), 400);
|
||||
|
||||
n = new Node();
|
||||
n.setName("my-folder");
|
||||
n.setNodeType(TYPE_CM_FOLDER);
|
||||
assocChild = new AssocChild(f2Id, null);
|
||||
n.setSecondaryChildren(Collections.singletonList(assocChild));
|
||||
post(getNodeChildrenUrl(f3Id), user1, RestApiUtil.toJsonAsStringNonNull(n), 400);
|
||||
|
||||
n = new Node();
|
||||
n.setName("my-folder");
|
||||
n.setNodeType(TYPE_CM_FOLDER);
|
||||
tgt = new AssocTarget(null, ASSOC_TYPE_CM_REFERENCES);
|
||||
n.setTargets(Collections.singletonList(tgt));
|
||||
post(getNodeChildrenUrl(f3Id), user1, RestApiUtil.toJsonAsStringNonNull(n), 400);
|
||||
|
||||
n = new Node();
|
||||
n.setName("my-folder");
|
||||
n.setNodeType(TYPE_CM_FOLDER);
|
||||
tgt = new AssocTarget(f2Id, null);
|
||||
n.setTargets(Collections.singletonList(tgt));
|
||||
post(getNodeChildrenUrl(f3Id), user1, RestApiUtil.toJsonAsStringNonNull(n), 400);
|
||||
}
|
||||
finally
|
||||
{
|
||||
@@ -1520,6 +1551,7 @@ public class NodeAssociationsApiTest extends AbstractBaseApiTest
|
||||
Map<String, String> params = Collections.singletonMap(Nodes.PARAM_PERMANENT, "true");
|
||||
delete(URL_NODES, user1, f1Id, params, 204);
|
||||
delete(URL_NODES, user1, f2Id, params, 204);
|
||||
delete(URL_NODES, user1, f3Id, params, 204);
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user