mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-21 18:09:20 +00:00
Merged 5.2.N (5.2.1) to HEAD (5.2)
131862 mward: Merged 131680:131794 from DEV/mward/5.2.n-createperson to 5.2.N REPO-892: make sure not all fields need to be supplied during create. REPO-892: throws error if fields exclusively belonging to Person (that are not part of PersonUpdate) are sent in request. REPO-892: cleaned up PersonUpdateJSONSerializer a little, by removing unnecessary 'fullVisibility' switch. REPO-892: improved test for optional fields; added test for too few fields. REPO-892: added tests (and impl where needed) for -ve response codes as given in the open api spec for create person. REPO-892: fixed broken test due to reuse of username. git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@132308 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -1072,12 +1072,25 @@ public class PublicApiClient
|
||||
return retSite;
|
||||
}
|
||||
|
||||
public Person create(PersonUpdate person, boolean fullVisibility) throws PublicApiException
|
||||
public Person create(PersonUpdate person) throws PublicApiException
|
||||
{
|
||||
return create(person, 201);
|
||||
}
|
||||
|
||||
public Person create(PersonUpdate person, int expectedStatus) throws PublicApiException
|
||||
{
|
||||
TestPeople.PersonUpdateJSONSerializer jsonizer = new TestPeople.PersonUpdateJSONSerializer(person) ;
|
||||
HttpResponse response = create("people", null, null, null, jsonizer.toJSON(fullVisibility).toString(), "Failed to create person");
|
||||
Person retSite = Person.parsePerson((JSONObject)response.getJsonResponse().get("entry"));
|
||||
return retSite;
|
||||
HttpResponse response = create("people", null, null, null, jsonizer.toJSON().toString(), "Failed to create person", expectedStatus);
|
||||
if ((response != null) && (response.getJsonResponse() != null))
|
||||
{
|
||||
Object entry = response.getJsonResponse().get("entry");
|
||||
// entry will be null if there is an "error" data structure returned instead.
|
||||
if (entry != null)
|
||||
{
|
||||
return Person.parsePerson((JSONObject) entry);
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public void remove(Person person) throws PublicApiException
|
||||
|
Reference in New Issue
Block a user