Merged 5.2.N (5.2.1) to HEAD (5.2)

129168 mmuller: Merged RETURN-OF-THE-API (5.2.0) to 5.2.N (5.2.1)
      128517 jvonka: REPO-874: Improve REST fwk: improve error message if a POST operation is attempted with multiple items
      - rationalise the code when handling POST for an API "operation" or POST to a collection that is marked as "allowMultiple=false"
      - they should now consistently return the same existing error message: "Only 1 entity is supported in the HTTP request body"
      - add api sanity tests to "create site", "create rating" and some of the node op's, such as "/move" & "/copy"


git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@129342 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Alexandru Epure
2016-08-09 14:12:44 +00:00
parent 2254b1fa0e
commit c3eeea134f
4 changed files with 103 additions and 38 deletions

View File

@@ -29,6 +29,7 @@ import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.fail;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
@@ -47,6 +48,7 @@ import org.alfresco.rest.api.tests.client.data.SiteRole;
import org.alfresco.service.cmr.site.SiteVisibility;
import org.alfresco.util.GUID;
import org.apache.commons.httpclient.HttpStatus;
import org.json.simple.JSONArray;
import org.json.simple.JSONObject;
import org.junit.Before;
import org.junit.Test;
@@ -311,6 +313,15 @@ public class TestSites extends EnterpriseTestApi
sitesProxy.removeSite(siteId); // cleanup
}
// -ve test - cannot create multiple sites in single POST call (unsupported)
{
List<Site> sites = new ArrayList<>(2);
sites.add(new SiteImpl(null, "siteA1", null, "siteA1", null, SiteVisibility.PRIVATE.toString(), null, null));
sites.add(new SiteImpl(null, "siteB1", null, "siteB1", null, SiteVisibility.PRIVATE.toString(), null, null));
sitesProxy.create("sites", null, null, null, JSONArray.toJSONString(sites), null, 405);
}
// -ve tests - belts-and-braces for unsupported methods
{