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:
Alan Davis
2016-11-03 13:59:46 +00:00
parent 373d976faa
commit d2322f56a2
4 changed files with 221 additions and 84 deletions

View File

@@ -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