mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
First cut REST group api - read methods working.
git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@13891 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -6,7 +6,22 @@
|
||||
"shortName" : "${authority.shortName}",
|
||||
"fullName" : "${authority.fullName}",
|
||||
"displayName" : "${authority.displayName}",
|
||||
|
||||
<#-- Group specific properties -->
|
||||
<#if authority.rootGroup??>"isRootGroup": ${authority.rootGroup?string("true", "false")}, </#if>
|
||||
<#if authority.adminGroup??>"isAdminGroup": ${authority.adminGroup?string("true", "false")}, </#if>
|
||||
<#if authority.internalGroup??>"isInternalGroup": ${authority.internalGroup?string("true", "false")}, </#if>
|
||||
<#if authority.groupCount??>"groupCount": ${authority.groupCount}, </#if>
|
||||
<#if authority.userCount??>"userCount": ${authority.userCount}, </#if>
|
||||
<#-- end of group specific properties -->
|
||||
|
||||
<#if authority.authorityType = "GROUP" >
|
||||
"url" : "/api/groups/${authority.shortName}"
|
||||
</#if>
|
||||
|
||||
<#if authority.authorityType = "USER" >
|
||||
"url" : "/api/people/${authority.shortName}"
|
||||
</#if>
|
||||
}
|
||||
</#escape>
|
||||
</#macro>
|
@@ -2,8 +2,8 @@
|
||||
<shortname>Get the list of child authorities for a group.</shortname>
|
||||
<description><![CDATA[
|
||||
Get a list of the child authorities of a group. This contains both people and groups.
|
||||
|
||||
The authorityType parameter can be used to specify to return authorities of the given type.
|
||||
<BR />
|
||||
The authorityType parameter can be used to specify to return authorities of the given type. Valid values are GROUP and USER.
|
||||
]]>
|
||||
</description>
|
||||
<url>/api/groups/{shortName}/children?authorityType={authorityType?}</url>
|
||||
|
@@ -1 +1,42 @@
|
||||
// get rootgroups
|
||||
// get children
|
||||
function main ()
|
||||
{
|
||||
|
||||
var urlElements = url.extension.split("/");
|
||||
var shortName = urlElements[0];
|
||||
|
||||
var authorityType = args["authorityType"];
|
||||
|
||||
var group = groups.getGroup(shortName);
|
||||
if (group == null)
|
||||
{
|
||||
// Group cannot be found
|
||||
status.setCode(status.STATUS_NOT_FOUND, "The group :" + shortName + ", does not exist.");
|
||||
return;
|
||||
}
|
||||
|
||||
model.group = group;
|
||||
|
||||
if(authorityType != null)
|
||||
{
|
||||
if(!authorityType.match("[GROUP|USER]"))
|
||||
{
|
||||
status.setCode(status.STATUS_BAD_REQUEST, "The authorityType argument has does not have a correct value.");
|
||||
return;
|
||||
}
|
||||
if(authorityType == "GROUP")
|
||||
{
|
||||
model.children = group.getChildGroups();
|
||||
}
|
||||
if(authorityType == "USER")
|
||||
{
|
||||
model.children = group.getChildUsers();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
model.children = group.getAllChildren();
|
||||
}
|
||||
}
|
||||
|
||||
main();
|
@@ -1 +1,13 @@
|
||||
<#-- get children -->
|
||||
|
||||
<#import "authority.lib.ftl" as authorityLib/>
|
||||
{
|
||||
"data": [
|
||||
|
||||
<#list children as wibble>
|
||||
<@authorityLib.authorityJSON authority=wibble />
|
||||
<#if wibble_has_next>,</#if>
|
||||
</#list>
|
||||
|
||||
]
|
||||
}
|
||||
|
@@ -2,6 +2,9 @@
|
||||
<shortname>Add group or user to a group</shortname>
|
||||
<description><![CDATA[
|
||||
Add a group or user to a group.
|
||||
<br />
|
||||
you must have "administrator" privileges to add a group.
|
||||
</br />
|
||||
|
||||
If the provided group does not exist then it is created.
|
||||
]]>
|
||||
|
@@ -1 +1 @@
|
||||
// get rootgroups
|
||||
// post groups
|
@@ -0,0 +1,13 @@
|
||||
<#-- post children -->
|
||||
|
||||
<#import "authority.lib.ftl" as authorityLib/>
|
||||
{
|
||||
"data": [
|
||||
|
||||
<#list children as wibble>
|
||||
<@authorityLib.authorityJSON authority=wibble />
|
||||
<#if wibble_has_next>,</#if>
|
||||
</#list>
|
||||
|
||||
]
|
||||
}
|
||||
|
@@ -1 +1,21 @@
|
||||
// get rootgroups
|
||||
/**
|
||||
* Get group
|
||||
*/
|
||||
|
||||
function main ()
|
||||
{
|
||||
var urlElements = url.extension.split("/");
|
||||
var shortName = urlElements[0];
|
||||
|
||||
var group = groups.getGroup(shortName);
|
||||
if (group == null)
|
||||
{
|
||||
// Group cannot be found
|
||||
status.setCode(status.STATUS_NOT_FOUND, "The group :" + shortName + ", does not exist.");
|
||||
return;
|
||||
}
|
||||
|
||||
model.group = group;
|
||||
}
|
||||
|
||||
main();
|
@@ -0,0 +1,6 @@
|
||||
<#-- Get Group -->
|
||||
|
||||
<#import "authority.lib.ftl" as authorityLib/>
|
||||
{
|
||||
"data":<@authorityLib.authorityJSON authority=group />
|
||||
}
|
@@ -2,7 +2,9 @@
|
||||
<shortname>Update the details of a group</shortname>
|
||||
<description><![CDATA[
|
||||
Update the details of a group.
|
||||
|
||||
<br />
|
||||
you must have "administrator" privileges to change the name of a group.
|
||||
</br />
|
||||
The follwong properties may be updated.
|
||||
<dl>
|
||||
<dt>displayName</dt><dd>The display name</dd>
|
||||
|
@@ -0,0 +1,6 @@
|
||||
<#-- Update Group -->
|
||||
|
||||
<#import "authority.lib.ftl" as authorityLib/>
|
||||
{
|
||||
"data":<@authorityLib.authorityJSON authority=group />
|
||||
}
|
@@ -2,6 +2,9 @@
|
||||
<shortname>Delete a group.</shortname>
|
||||
<description><![CDATA[
|
||||
Delete a group and all its dependents.
|
||||
<br />
|
||||
You must have "administrator" privileges to delete a group.
|
||||
</br />
|
||||
]]>
|
||||
</description>
|
||||
<url>/api/groups/{shortName}</url>
|
||||
|
@@ -0,0 +1,6 @@
|
||||
<#-- Delete Group -->
|
||||
|
||||
<#import "authority.lib.ftl" as authorityLib/>
|
||||
{
|
||||
|
||||
}
|
@@ -1 +1,22 @@
|
||||
// get rootgroups
|
||||
/**
|
||||
* List/Search groups
|
||||
*/
|
||||
|
||||
function main ()
|
||||
{
|
||||
// Get the args
|
||||
var shortNameFilter = args["shortNameFilter"];
|
||||
var includeInternalStr = args["includeInternal"];
|
||||
|
||||
if(shortNameFilter == null)
|
||||
{
|
||||
shortNameFilter = "";
|
||||
}
|
||||
|
||||
var includeInternal = includeInternalStr == "true" ? true : false;
|
||||
|
||||
// Do the search
|
||||
model.groups = groups.searchGroups(shortNameFilter, includeInternal);
|
||||
}
|
||||
|
||||
main();
|
@@ -0,0 +1,11 @@
|
||||
<#-- list / search / groups -->
|
||||
|
||||
<#import "authority.lib.ftl" as authorityLib/>
|
||||
{
|
||||
"data": [
|
||||
<#list groups as group>
|
||||
<@authorityLib.authorityJSON authority=group />
|
||||
<#if group_has_next>,</#if>
|
||||
</#list>
|
||||
]
|
||||
}
|
@@ -2,8 +2,8 @@
|
||||
<shortname>Get the list of child authorities for a group.</shortname>
|
||||
<description><![CDATA[
|
||||
Get a list of the parent authorities of a group.
|
||||
|
||||
The optional level attribute can be "all" in which case all parents are returned or "immediate" in which case only the immediate parents are returned.
|
||||
<BR />
|
||||
The optional level attribute can be "ALL" in which case all parents are returned.
|
||||
]]>
|
||||
</description>
|
||||
<url>/api/groups/{shortName}/parents?level={level?}</url>
|
||||
|
@@ -1 +1,37 @@
|
||||
// get rootgroups
|
||||
// get parents
|
||||
function main ()
|
||||
{
|
||||
|
||||
var urlElements = url.extension.split("/");
|
||||
var shortName = urlElements[0];
|
||||
|
||||
var level = args["level"];
|
||||
|
||||
|
||||
|
||||
var group = groups.getGroup(shortName);
|
||||
if (group == null)
|
||||
{
|
||||
// Group cannot be found
|
||||
status.setCode(status.STATUS_NOT_FOUND, "The group :" + shortName + ", does not exist.");
|
||||
return;
|
||||
}
|
||||
|
||||
model.group = group;
|
||||
|
||||
if(level != null)
|
||||
{
|
||||
if(!level.match("[ALL]"))
|
||||
{
|
||||
status.setCode(status.STATUS_BAD_REQUEST, "The level argument has does not have a correct value.");
|
||||
return;
|
||||
}
|
||||
model.parents = group.getAllParentGroups();
|
||||
}
|
||||
else
|
||||
{
|
||||
model.parents = group.getParentGroups();
|
||||
}
|
||||
}
|
||||
|
||||
main();
|
@@ -1 +1,11 @@
|
||||
<#-- get parents -->
|
||||
|
||||
<#import "authority.lib.ftl" as authorityLib/>
|
||||
{
|
||||
"data": [
|
||||
<#list parents as thegroup>
|
||||
<@authorityLib.authorityJSON authority=thegroup />
|
||||
<#if thegroup_has_next>,</#if>
|
||||
</#list>
|
||||
]
|
||||
}
|
@@ -40,6 +40,8 @@ import org.alfresco.repo.web.scripts.BaseWebScriptTest;
|
||||
import org.alfresco.service.cmr.repository.NodeRef;
|
||||
import org.alfresco.service.cmr.repository.NodeService;
|
||||
import org.alfresco.service.cmr.security.AuthenticationService;
|
||||
import org.alfresco.service.cmr.security.AuthorityService;
|
||||
import org.alfresco.service.cmr.security.AuthorityType;
|
||||
import org.alfresco.service.cmr.security.PersonService;
|
||||
import org.alfresco.service.cmr.site.SiteInfo;
|
||||
import org.alfresco.service.cmr.site.SiteService;
|
||||
@@ -57,16 +59,24 @@ import org.json.JSONArray;
|
||||
import org.json.JSONObject;
|
||||
|
||||
/**
|
||||
* Unit test of Groups REST APIs.
|
||||
* Unit test of Groups REST APIs. /api/groups
|
||||
*
|
||||
* @author Mark Rogers
|
||||
*/
|
||||
public class GroupsTest extends BaseWebScriptTest
|
||||
{
|
||||
private AuthenticationService authenticationService;
|
||||
private AuthorityService authorityService;
|
||||
private AuthenticationComponent authenticationComponent;
|
||||
private PersonService personService;
|
||||
private NodeService nodeService;
|
||||
|
||||
private String ADMIN_GROUP = "ALFRESCO_ADMINISTRATORS";
|
||||
private String TEST_ROOTGROUP = "GROUPS_TESTROOT";
|
||||
private String TEST_GROUPA = "TestA";
|
||||
private String TEST_GROUPB = "TESTB";
|
||||
private String TEST_GROUPC = "TesTC";
|
||||
private String TEST_GROUPD = "TESTD";
|
||||
private String TEST_ROOTGROUP_DISPLAY_NAME = "GROUPS_TESTROOTDisplayName";
|
||||
|
||||
private static final String USER_ONE = "GroupTestOne";
|
||||
private static final String USER_TWO = "GroupTestTwo";
|
||||
@@ -75,6 +85,19 @@ public class GroupsTest extends BaseWebScriptTest
|
||||
private static final String URL_GROUPS = "/api/groups";
|
||||
private static final String URL_ROOTGROUPS = "/api/rootgroups";
|
||||
|
||||
/**
|
||||
* Test Tree for all group tests
|
||||
*
|
||||
* TEST_ROOTGROUP
|
||||
* GROUPA
|
||||
* GROUPB
|
||||
* GROUPD
|
||||
* USER_TWO
|
||||
* USER_THREE
|
||||
* GROUPC
|
||||
* USER_TWO
|
||||
*/
|
||||
|
||||
@Override
|
||||
protected void setUp() throws Exception
|
||||
{
|
||||
@@ -83,7 +106,7 @@ public class GroupsTest extends BaseWebScriptTest
|
||||
this.authenticationService = (AuthenticationService)getServer().getApplicationContext().getBean("AuthenticationService");
|
||||
this.authenticationComponent = (AuthenticationComponent)getServer().getApplicationContext().getBean("authenticationComponent");
|
||||
this.personService = (PersonService)getServer().getApplicationContext().getBean("PersonService");
|
||||
this.nodeService = (NodeService)getServer().getApplicationContext().getBean("NodeService");
|
||||
this.authorityService = (AuthorityService)getServer().getApplicationContext().getBean("AuthorityService");
|
||||
|
||||
this.authenticationComponent.setSystemUserAsCurrentUser();
|
||||
|
||||
@@ -92,8 +115,21 @@ public class GroupsTest extends BaseWebScriptTest
|
||||
createUser(USER_TWO);
|
||||
createUser(USER_THREE);
|
||||
|
||||
// create a test group tree
|
||||
String rootGroup = authorityService.createAuthority(AuthorityType.GROUP, null, TEST_ROOTGROUP , TEST_ROOTGROUP_DISPLAY_NAME);
|
||||
authorityService.createAuthority(AuthorityType.GROUP, rootGroup, TEST_GROUPA);
|
||||
String groupB = authorityService.createAuthority(AuthorityType.GROUP, rootGroup, TEST_GROUPB);
|
||||
authorityService.createAuthority(AuthorityType.GROUP, groupB, TEST_GROUPD);
|
||||
authorityService.addAuthority(groupB, USER_TWO);
|
||||
authorityService.addAuthority(groupB, USER_THREE);
|
||||
|
||||
String groupC = authorityService.createAuthority(AuthorityType.GROUP, rootGroup, TEST_GROUPC);
|
||||
authorityService.addAuthority(groupC, USER_TWO);
|
||||
|
||||
// Do tests as user one
|
||||
this.authenticationComponent.setCurrentUser(USER_ONE);
|
||||
|
||||
Thread.sleep(10);
|
||||
}
|
||||
|
||||
private void createUser(String userName)
|
||||
@@ -127,21 +163,72 @@ public class GroupsTest extends BaseWebScriptTest
|
||||
public void testGetRootGroup() throws Exception
|
||||
{
|
||||
/**
|
||||
* Get all root groups
|
||||
* Get all root groups should be at least the ALFRESCO_ADMINISTRATORS groups
|
||||
*/
|
||||
{
|
||||
Response response = sendRequest(new GetRequest(URL_ROOTGROUPS), 200);
|
||||
Response response = sendRequest(new GetRequest(URL_ROOTGROUPS), Status.STATUS_OK);
|
||||
JSONObject top = new JSONObject(response.getContentAsString());
|
||||
System.out.println(response.getContentAsString());
|
||||
JSONArray data = top.getJSONArray("data");
|
||||
}
|
||||
assertTrue(data.length() > 0);
|
||||
|
||||
for(int i = 0; i < data.length(); i++)
|
||||
{
|
||||
JSONObject rootGroup = data.getJSONObject(i);
|
||||
if(rootGroup.getString("shortName").equals(TEST_ROOTGROUP))
|
||||
{
|
||||
// This is our test rootgroup
|
||||
assertEquals("shortName wrong", TEST_ROOTGROUP, rootGroup.getString("shortName"));
|
||||
assertEquals("displayName wrong", TEST_ROOTGROUP_DISPLAY_NAME, rootGroup.getString("displayName"));
|
||||
assertEquals("authorityType wrong", "GROUP", rootGroup.getString("authorityType"));
|
||||
assertFalse("test rootgroup is admin group", rootGroup.getBoolean("isAdminGroup"));
|
||||
}
|
||||
if(rootGroup.getString("shortName").equals(ADMIN_GROUP))
|
||||
{
|
||||
//assertTrue("admin group is not admin group", rootGroup.getBoolean("isAdminGroup"));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Detailed test of get group
|
||||
*/
|
||||
public void testGetGroup()
|
||||
public void testGetGroup() throws Exception
|
||||
{
|
||||
{
|
||||
Response response = sendRequest(new GetRequest(URL_GROUPS + "/" + ADMIN_GROUP), 200);
|
||||
JSONObject top = new JSONObject(response.getContentAsString());
|
||||
System.out.println(response.getContentAsString());
|
||||
JSONObject data = top.getJSONObject("data");
|
||||
assertTrue(data.length() > 0);
|
||||
//assertTrue("admin group is not admin group", data.getBoolean("isAdminGroup"));
|
||||
assertTrue("admin group is not root group", data.getBoolean("isRootGroup"));
|
||||
}
|
||||
|
||||
{
|
||||
sendRequest(new GetRequest(URL_GROUPS + "/" + "crap"), Status.STATUS_NOT_FOUND);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get GROUP B
|
||||
*/
|
||||
{
|
||||
Response response = sendRequest(new GetRequest(URL_GROUPS + "/" + TEST_GROUPB), Status.STATUS_OK);
|
||||
JSONObject top = new JSONObject(response.getContentAsString());
|
||||
System.out.println(response.getContentAsString());
|
||||
JSONObject data = top.getJSONObject("data");
|
||||
assertTrue(data.length() > 0);
|
||||
assertFalse("group B is not admin group", data.getBoolean("isAdminGroup"));
|
||||
assertFalse("group B is not root group", data.getBoolean("isRootGroup"));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Detailed test of create root group
|
||||
*/
|
||||
public void testCreateRootGroup() throws Exception
|
||||
{
|
||||
|
||||
}
|
||||
@@ -149,18 +236,152 @@ public class GroupsTest extends BaseWebScriptTest
|
||||
/**
|
||||
* Detailed test of create group
|
||||
*/
|
||||
public void testCreateGroup()
|
||||
public void testCreateGroup() throws Exception
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Detailed test of search groups
|
||||
*<li>if the optional includeInternal parameter is true then will include internal groups, otherwise internalGroups are not returned.</li>
|
||||
<li>If the optional shortNameFilter parameter is set then returns those root groups with a partial match on shortName.</li>
|
||||
*/
|
||||
public void testSearchGroups()
|
||||
public void testSearchGroups() throws Exception
|
||||
{
|
||||
// Search on partial short name
|
||||
{
|
||||
Response response = sendRequest(new GetRequest(URL_GROUPS + "?shortNameFilter=" + "*ADMIN*"), Status.STATUS_OK);
|
||||
JSONObject top = new JSONObject(response.getContentAsString());
|
||||
System.out.println(response.getContentAsString());
|
||||
JSONArray data = top.getJSONArray("data");
|
||||
assertTrue(data.length() > 0);
|
||||
}
|
||||
|
||||
// Search on full shortName
|
||||
{
|
||||
Response response = sendRequest(new GetRequest(URL_GROUPS + "?shortNameFilter=" + ADMIN_GROUP), Status.STATUS_OK);
|
||||
JSONObject top = new JSONObject(response.getContentAsString());
|
||||
System.out.println(response.getContentAsString());
|
||||
JSONArray data = top.getJSONArray("data");
|
||||
assertTrue(data.length() > 0);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Detailed test of get Parents
|
||||
*/
|
||||
public void testGetParents() throws Exception
|
||||
{
|
||||
/**
|
||||
* Get all parents for the root group ALFRESCO_ADMINISTRATORS groups which has no parents
|
||||
*/
|
||||
{
|
||||
Response response = sendRequest(new GetRequest(URL_GROUPS + "/" + ADMIN_GROUP + "/parents"), Status.STATUS_OK);
|
||||
JSONObject top = new JSONObject(response.getContentAsString());
|
||||
System.out.println(response.getContentAsString());
|
||||
JSONArray data = top.getJSONArray("data");
|
||||
// Top level group has no parents
|
||||
assertTrue("top level group has no parents", data.length() == 0);
|
||||
}
|
||||
|
||||
/**synetics
|
||||
*
|
||||
* Get GROUP B Which should be a child of TESTROOT
|
||||
*/
|
||||
{
|
||||
Response response = sendRequest(new GetRequest(URL_GROUPS + "/" + TEST_GROUPB + "/parents"), Status.STATUS_OK);
|
||||
JSONObject top = new JSONObject(response.getContentAsString());
|
||||
System.out.println(response.getContentAsString());
|
||||
JSONArray data = top.getJSONArray("data");
|
||||
assertTrue(data.length() > 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get GROUP D Which should be a child of GROUPB child of TESTROOT
|
||||
*/
|
||||
{
|
||||
Response response = sendRequest(new GetRequest(URL_GROUPS + "/" + TEST_GROUPD + "/parents?level=ALL"), Status.STATUS_OK);
|
||||
JSONObject top = new JSONObject(response.getContentAsString());
|
||||
System.out.println(response.getContentAsString());
|
||||
JSONArray data = top.getJSONArray("data");
|
||||
assertTrue(data.length() >= 2);
|
||||
}
|
||||
/**
|
||||
* Negative test Get GROUP D level="rubbish"
|
||||
*/
|
||||
{
|
||||
sendRequest(new GetRequest(URL_GROUPS + "/" + TEST_GROUPD + "/parents?level=rubbish"), Status.STATUS_BAD_REQUEST);
|
||||
}
|
||||
|
||||
/**
|
||||
* Negative test GROUP(Rubbish) does not exist
|
||||
*/
|
||||
{
|
||||
sendRequest(new GetRequest(URL_GROUPS + "/" + "rubbish" + "/parents?level=all"), Status.STATUS_NOT_FOUND);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Detailed test of get Children
|
||||
*/
|
||||
public void testGetChildren() throws Exception
|
||||
{
|
||||
/**
|
||||
* Get All Children of GROUP B
|
||||
*/
|
||||
{
|
||||
System.out.println("Get children of GROUP B");
|
||||
Response response = sendRequest(new GetRequest(URL_GROUPS + "/" + TEST_GROUPB + "/children"), Status.STATUS_OK);
|
||||
JSONObject top = new JSONObject(response.getContentAsString());
|
||||
System.out.println(response.getContentAsString());
|
||||
JSONArray data = top.getJSONArray("data");
|
||||
//assertTrue(data.length() > 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get All Children of GROUP B which are GROUPS
|
||||
*/
|
||||
{
|
||||
System.out.println("Get child GROUPS of GROUP B");
|
||||
Response response = sendRequest(new GetRequest(URL_GROUPS + "/" + TEST_GROUPB + "/children?authorityType=GROUP"), Status.STATUS_OK);
|
||||
JSONObject top = new JSONObject(response.getContentAsString());
|
||||
System.out.println(response.getContentAsString());
|
||||
JSONArray data = top.getJSONArray("data");
|
||||
assertTrue(data.length() == 1);
|
||||
|
||||
JSONObject subGroup = data.getJSONObject(0);
|
||||
assertEquals("shortName wrong", TEST_GROUPD, subGroup.getString("shortName"));
|
||||
assertEquals("authorityType wrong", "GROUP", subGroup.getString("authorityType"));
|
||||
}
|
||||
|
||||
/**
|
||||
* Get All Children of GROUP B which are USERS
|
||||
*/
|
||||
{
|
||||
System.out.println("Get Child Users of Group B");
|
||||
Response response = sendRequest(new GetRequest(URL_GROUPS + "/" + TEST_GROUPB + "/children?authorityType=USER"), Status.STATUS_OK);
|
||||
JSONObject top = new JSONObject(response.getContentAsString());
|
||||
System.out.println(response.getContentAsString());
|
||||
JSONArray data = top.getJSONArray("data");
|
||||
//assertTrue(data.length() > 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* Negative test All Children of GROUP B, bad authorityType
|
||||
*/
|
||||
{
|
||||
sendRequest(new GetRequest(URL_GROUPS + "/" + TEST_GROUPB + "/children?authorityType=XXX"), Status.STATUS_BAD_REQUEST);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Negative test GROUP(Rubbish) does not exist
|
||||
*/
|
||||
{
|
||||
sendRequest(new GetRequest(URL_GROUPS + "/" + "rubbish" + "/children"), Status.STATUS_NOT_FOUND);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user