Class RMRestWrapper

java.lang.Object
org.alfresco.rest.core.RMRestWrapper

@Service @Scope("prototype") public class RMRestWrapper extends Object
Extends RestWrapper in order to call GS APIs with our own properties
Since:
2.6
Author:
Tuna Aksoy
  • Constructor Details

    • RMRestWrapper

      public RMRestWrapper()
  • Method Details

    • withGSCoreAPI

      public GSCoreAPI withGSCoreAPI()
    • getRestWrapper

      public RestWrapper getRestWrapper()
      Get the core class that wraps the ReST APIs.
    • authenticateUser

      public void authenticateUser(org.alfresco.utility.model.UserModel userModel)
      Authenticate specific user to Alfresco REST API
    • assertLastError

      public RestErrorModel assertLastError()
      Get the last error thrown (if any).
    • processModels

      public <T> T processModels(Class<T> classz, RestRequest simpleRequest)
      Process responses for a collection of models as RestSiteModelsCollection.
    • processModel

      public <T> T processModel(Class<T> classz, RestRequest restRequest)
      Process responses for a single model as RestSiteModel.
    • processEmptyModel

      public void processEmptyModel(RestRequest simpleRequest)
      Process a response that has no body - basically will need only the status code from it.
    • getLastStatus

      public org.alfresco.utility.model.StatusModel getLastStatus()
      Get the most recently returned status object.
    • getStatusCode

      public String getStatusCode()
      Get the most recently returned status code.
    • setStatusCode

      public void setStatusCode(String statusCode)
      Set the status code. This should only be needed when calling APIs without using the TAS framework.
    • assertStatusCodeIs

      public void assertStatusCodeIs(org.springframework.http.HttpStatus statusCode)
      Assert that a specific status code is returned.
    • getParameters

      public String getParameters()
      Returns:
      A parameters string that you could pass on the request ?param=value
    • getTestUser

      public org.alfresco.utility.model.UserModel getTestUser()
      Create a UserModel for a new test user.
    • withCoreAPI

      public RestCoreAPI withCoreAPI()
      Get the Alfresco Core API.
    • withSearchAPI

      public SearchAPI withSearchAPI()
      Get the Alfresco Search API.
    • configureRequestSpec

      public io.restassured.builder.RequestSpecBuilder configureRequestSpec()
      You can handle the request sent to server by calling this method. If for example you want to sent multipart form data you can use:
       restClient.configureRequestSpec()
                    .addMultiPart("filedata", Utility.getResourceTestDataFile("restapi-resource"))
                    .addFormParam("renditions", "doclib")
                    .addFormParam("autoRename", true);
      
       restClient.withCoreAPI().usingNode(ContentModel.my()).createNode();
       
      This will create the node using the multipart data defined.
    • processHtmlResponse

      public RestHtmlResponse processHtmlResponse(RestRequest simpleRequest)
      Process a response that returns a html
      Throws:
      EmptyJsonResponseException - If there is no response from the server.