Added support for pagesize on site collections for preview

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@10035 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Roy Wetherall
2008-07-25 15:14:53 +00:00
parent f123bca2f3
commit abc95e42d1
4 changed files with 86 additions and 15 deletions

View File

@@ -144,15 +144,31 @@ public class SiteServiceTest extends BaseWebScriptTest
public void testGetSites() throws Exception
{
// == Test basic GET with no filters ==
MockHttpServletResponse response = getRequest(URL_SITES, 200);
JSONArray result = new JSONArray(response.getContentAsString());
JSONArray result = new JSONArray(response.getContentAsString());
assertNotNull(result);
assertEquals(0, result.length());
// TODO formalise this test once i can be sure that i know what's already in the site store
// ie: .. i need to clean up after myself in this test
createSite("myPreset", GUID.generate(), "myTitle", "myDescription", true, 200);
createSite("myPreset", GUID.generate(), "myTitle", "myDescription", true, 200);
createSite("myPreset", GUID.generate(), "myTitle", "myDescription", true, 200);
createSite("myPreset", GUID.generate(), "myTitle", "myDescription", true, 200);
createSite("myPreset", GUID.generate(), "myTitle", "myDescription", true, 200);
System.out.println(response.getContentAsString());
response = getRequest(URL_SITES, 200);
result = new JSONArray(response.getContentAsString());
assertNotNull(result);
assertEquals(5, result.length());
response = getRequest(URL_SITES + "?size=3", 200);
result = new JSONArray(response.getContentAsString());
assertNotNull(result);
assertEquals(3, result.length());
response = getRequest(URL_SITES + "?size=13", 200);
result = new JSONArray(response.getContentAsString());
assertNotNull(result);
assertEquals(5, result.length());
}
public void testGetSite() throws Exception
@@ -378,5 +394,17 @@ public class SiteServiceTest extends BaseWebScriptTest
assertNotNull(result);
assertEquals(0, result.length());
response = getRequest("/api/people/" + USER_ONE + "/sites?size=1", 200);
result = new JSONArray(response.getContentAsString());
assertNotNull(result);
assertEquals(1, result.length());
response = getRequest("/api/people/" + USER_ONE + "/sites?size=5", 200);
result = new JSONArray(response.getContentAsString());
assertNotNull(result);
assertEquals(2, result.length());
}
}