Search in sources :

Example 26 with GetRequest

use of org.springframework.extensions.webscripts.TestWebScriptServer.GetRequest 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;
}
Also used : Response(org.springframework.extensions.webscripts.TestWebScriptServer.Response) JSONObject(org.json.JSONObject) GetRequest(org.springframework.extensions.webscripts.TestWebScriptServer.GetRequest)

Example 27 with GetRequest

use of org.springframework.extensions.webscripts.TestWebScriptServer.GetRequest 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;
}
Also used : Response(org.springframework.extensions.webscripts.TestWebScriptServer.Response) JSONObject(org.json.JSONObject) GetRequest(org.springframework.extensions.webscripts.TestWebScriptServer.GetRequest)

Example 28 with GetRequest

use of org.springframework.extensions.webscripts.TestWebScriptServer.GetRequest 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;
}
Also used : Response(org.springframework.extensions.webscripts.TestWebScriptServer.Response) JSONObject(org.json.JSONObject) GetRequest(org.springframework.extensions.webscripts.TestWebScriptServer.GetRequest)

Example 29 with GetRequest

use of org.springframework.extensions.webscripts.TestWebScriptServer.GetRequest in project alfresco-remote-api by Alfresco.

the class InviteServiceTest method getInvitesByInviterUserName.

private JSONObject getInvitesByInviterUserName(String inviterUserName, int expectedStatus) throws Exception {
    // construct get invites URL
    String getInvitesUrl = URL_INVITES + "?inviterUserName=" + inviterUserName;
    // invoke get invites web script
    Response response = sendRequest(new GetRequest(getInvitesUrl), expectedStatus);
    JSONObject result = new JSONObject(response.getContentAsString());
    return result;
}
Also used : Response(org.springframework.extensions.webscripts.TestWebScriptServer.Response) JSONObject(org.json.JSONObject) GetRequest(org.springframework.extensions.webscripts.TestWebScriptServer.GetRequest)

Example 30 with GetRequest

use of org.springframework.extensions.webscripts.TestWebScriptServer.GetRequest in project alfresco-remote-api by Alfresco.

the class LinksRestApiTest method getLinks.

// Test helper methods
private JSONObject getLinks(String filter, String username) throws Exception {
    String origUser = this.authenticationComponent.getCurrentUserName();
    if (username != null) {
        this.authenticationComponent.setCurrentUser(username);
        filter = "user";
    }
    String url = URL_LINKS_LIST;
    if (filter == null) {
        filter = "all";
    }
    url += "?filter=" + filter;
    url += "&startIndex=0&page=1&pageSize=4";
    Response response = sendRequest(new GetRequest(url), 200);
    JSONObject result = new JSONObject(response.getContentAsString());
    if (username != null) {
        this.authenticationComponent.setCurrentUser(origUser);
    }
    return result;
}
Also used : Response(org.springframework.extensions.webscripts.TestWebScriptServer.Response) JSONObject(org.json.JSONObject) GetRequest(org.springframework.extensions.webscripts.TestWebScriptServer.GetRequest)

Aggregations

GetRequest (org.springframework.extensions.webscripts.TestWebScriptServer.GetRequest)182 Response (org.springframework.extensions.webscripts.TestWebScriptServer.Response)171 JSONObject (org.json.JSONObject)141 JSONArray (org.json.JSONArray)89 PostRequest (org.springframework.extensions.webscripts.TestWebScriptServer.PostRequest)25 HashMap (java.util.HashMap)23 JSONTokener (org.json.JSONTokener)23 DeleteRequest (org.springframework.extensions.webscripts.TestWebScriptServer.DeleteRequest)21 PutRequest (org.springframework.extensions.webscripts.TestWebScriptServer.PutRequest)17 NodeRef (org.alfresco.service.cmr.repository.NodeRef)14 Serializable (java.io.Serializable)13 WorkflowDefinition (org.alfresco.service.cmr.workflow.WorkflowDefinition)13 QName (org.alfresco.service.namespace.QName)13 ArrayList (java.util.ArrayList)12 WorkflowPath (org.alfresco.service.cmr.workflow.WorkflowPath)12 Date (java.util.Date)11 WorkflowTask (org.alfresco.service.cmr.workflow.WorkflowTask)11 JSONStringer (org.json.JSONStringer)7 Calendar (java.util.Calendar)6 UserTransaction (javax.transaction.UserTransaction)6