mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
Site service membership API (Java and JavaScript) and associated unit tests
git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@9012 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -129,7 +129,7 @@ public abstract class BaseWebScriptTest extends TestCase
|
|||||||
throws IOException
|
throws IOException
|
||||||
{
|
{
|
||||||
MockHttpServletResponse response = BaseWebScriptTest.getServer().submitRequest(method, url, new HashMap<String, String>(), body, contentType);
|
MockHttpServletResponse response = BaseWebScriptTest.getServer().submitRequest(method, url, new HashMap<String, String>(), body, contentType);
|
||||||
if (expectedStatus != response.getStatus())
|
if (expectedStatus > 0 && expectedStatus != response.getStatus())
|
||||||
{
|
{
|
||||||
if (response.getStatus() == 500)
|
if (response.getStatus() == 500)
|
||||||
{
|
{
|
||||||
|
@@ -24,6 +24,9 @@
|
|||||||
*/
|
*/
|
||||||
package org.alfresco.repo.web.scripts.site;
|
package org.alfresco.repo.web.scripts.site;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
import org.alfresco.repo.web.scripts.BaseWebScriptTest;
|
import org.alfresco.repo.web.scripts.BaseWebScriptTest;
|
||||||
import org.alfresco.util.GUID;
|
import org.alfresco.util.GUID;
|
||||||
import org.json.JSONArray;
|
import org.json.JSONArray;
|
||||||
@@ -40,6 +43,23 @@ public class SiteServiceTest extends BaseWebScriptTest
|
|||||||
private static final String URL_SITES = "/api/sites";
|
private static final String URL_SITES = "/api/sites";
|
||||||
private static final String URL_SITE = "/api/site/";
|
private static final String URL_SITE = "/api/site/";
|
||||||
|
|
||||||
|
private List<String> createdSites = new ArrayList<String>(5);
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void tearDown() throws Exception
|
||||||
|
{
|
||||||
|
super.tearDown();
|
||||||
|
|
||||||
|
// Tidy-up any site's create during the execution of the test
|
||||||
|
for (String shortName : this.createdSites)
|
||||||
|
{
|
||||||
|
deleteRequest(URL_SITE + shortName, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Clear the list
|
||||||
|
this.createdSites.clear();
|
||||||
|
}
|
||||||
|
|
||||||
public void testCreateSite() throws Exception
|
public void testCreateSite() throws Exception
|
||||||
{
|
{
|
||||||
String shortName = GUID.generate();
|
String shortName = GUID.generate();
|
||||||
@@ -66,6 +86,7 @@ public class SiteServiceTest extends BaseWebScriptTest
|
|||||||
site.put("description", description);
|
site.put("description", description);
|
||||||
site.put("isPublic", isPublic);
|
site.put("isPublic", isPublic);
|
||||||
MockHttpServletResponse response = postRequest(URL_SITES, expectedStatus, site.toString(), "application/json");
|
MockHttpServletResponse response = postRequest(URL_SITES, expectedStatus, site.toString(), "application/json");
|
||||||
|
this.createdSites.add(shortName);
|
||||||
return new JSONObject(response.getContentAsString());
|
return new JSONObject(response.getContentAsString());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user