use of org.springframework.extensions.webscripts.TestWebScriptServer.Response in project alfresco-remote-api by Alfresco.
the class InviteServiceTest method deleteInvitation.
/**
* Adapted from similar method in org.alfresco.repo.web.scripts.invitation.InvitationWebScriptTest
*/
JSONObject deleteInvitation(String invitationID, String siteShortName, int expectedStatus) throws Exception {
assertNotNull(invitationID);
assertNotNull(siteShortName);
assertFalse(invitationID.isEmpty());
assertFalse(siteShortName.isEmpty());
Response response = sendRequest(new DeleteRequest(URL_SITES + "/" + siteShortName + "/invitations/" + invitationID), expectedStatus);
JSONObject jsonResponse = new JSONObject(response.getContentAsString());
assertNotNull(jsonResponse);
return jsonResponse;
}
use of org.springframework.extensions.webscripts.TestWebScriptServer.Response in project alfresco-remote-api by Alfresco.
the class InviteServiceTest method getInvitesByInviteId.
private JSONObject getInvitesByInviteId(String inviteId, int expectedStatus) throws Exception {
// construct get invites URL
String getInvitesUrl = URL_INVITES + "?inviteId=" + inviteId;
// invoke get invites web script
Response response = sendRequest(new GetRequest(getInvitesUrl), expectedStatus);
JSONObject result = new JSONObject(response.getContentAsString());
return result;
}
use of org.springframework.extensions.webscripts.TestWebScriptServer.Response in project alfresco-remote-api by Alfresco.
the class InviteServiceTest method getInvitesByInviteeUserName.
private JSONObject getInvitesByInviteeUserName(String inviteeUserName, int expectedStatus) throws Exception {
// construct get invites URL
String getInvitesUrl = URL_INVITES + "?inviteeUserName=" + inviteeUserName;
// invoke get invites web script
Response response = sendRequest(new GetRequest(getInvitesUrl), expectedStatus);
JSONObject result = new JSONObject(response.getContentAsString());
return result;
}
use of org.springframework.extensions.webscripts.TestWebScriptServer.Response in project alfresco-remote-api by Alfresco.
the class InviteServiceTest method createModeratedInvitation.
private String createModeratedInvitation(String siteName, String inviteeComments, String inviteeUserName, String inviteeRoleName) throws Exception {
String URL_SITES = "/api/sites";
/*
* Create a new moderated invitation
*/
JSONObject newInvitation = new JSONObject();
newInvitation.put("invitationType", "MODERATED");
newInvitation.put("inviteeRoleName", inviteeRoleName);
newInvitation.put("inviteeComments", inviteeComments);
newInvitation.put("inviteeUserName", inviteeUserName);
Response response = sendRequest(new PostRequest(URL_SITES + "/" + siteName + "/invitations", newInvitation.toString(), "application/json"), 201);
JSONObject top = new JSONObject(response.getContentAsString());
JSONObject data = top.getJSONObject("data");
String inviteId = data.getString("inviteId");
return inviteId;
}
use of org.springframework.extensions.webscripts.TestWebScriptServer.Response in project alfresco-remote-api by Alfresco.
the class InviteServiceTest method getInviteInfo.
private JSONObject getInviteInfo(String inviteId, String inviteTicket, String inviteeUid) throws Exception {
String url = "/api/invite/" + inviteId + "/" + inviteTicket + "?inviteeUserName=" + inviteeUid;
String runAsUser = AuthenticationUtil.getRunAsUser();
Response response = sendRequest(new GetRequest(url), Status.STATUS_OK);
if (!runAsUser.equals(AuthenticationUtil.getRunAsUser())) {
AuthenticationUtil.setRunAsUser(runAsUser);
}
JSONObject result = new JSONObject(response.getContentAsString());
return result;
}
Aggregations