Package org.alfresco.rest.core
Class RMRestWrapper
- java.lang.Object
-
- org.alfresco.rest.core.RMRestWrapper
-
@Service @Scope("prototype") public class RMRestWrapper extends ObjectExtendsRestWrapperin order to call GS APIs with our own properties- Since:
- 2.6
- Author:
- Tuna Aksoy
-
-
Constructor Summary
Constructors Constructor Description RMRestWrapper()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description org.alfresco.rest.model.RestErrorModelassertLastError()Get the last error thrown (if any).voidassertStatusCodeIs(org.springframework.http.HttpStatus statusCode)Assert that a specific status code is returned.voidauthenticateUser(org.alfresco.utility.model.UserModel userModel)Authenticate specific user to Alfresco REST APIio.restassured.builder.RequestSpecBuilderconfigureRequestSpec()You can handle the request sent to server by calling this method.org.alfresco.utility.model.StatusModelgetLastStatus()Get the most recently returned status object.StringgetParameters()org.alfresco.rest.core.RestWrappergetRestWrapper()Get the core class that wraps the ReST APIs.StringgetStatusCode()Get the most recently returned status code.org.alfresco.utility.model.UserModelgetTestUser()Create aUserModelfor a new test user.voidprocessEmptyModel(org.alfresco.rest.core.RestRequest simpleRequest)Process a response that has no body - basically will need only the status code from it.org.alfresco.rest.model.RestHtmlResponseprocessHtmlResponse(org.alfresco.rest.core.RestRequest simpleRequest)Process a response that returns a html<T> TprocessModel(Class<T> classz, org.alfresco.rest.core.RestRequest restRequest)Process responses for a single model asRestSiteModel.<T> TprocessModels(Class<T> classz, org.alfresco.rest.core.RestRequest simpleRequest)Process responses for a collection of models asRestSiteModelsCollection.voidsetStatusCode(String statusCode)Set the status code.org.alfresco.rest.requests.coreAPI.RestCoreAPIwithCoreAPI()Get the Alfresco Core API.GSCoreAPIwithGSCoreAPI()org.alfresco.rest.requests.search.SearchAPIwithSearchAPI()Get the Alfresco Search API.
-
-
-
Method Detail
-
withGSCoreAPI
public GSCoreAPI withGSCoreAPI()
-
getRestWrapper
public org.alfresco.rest.core.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 org.alfresco.rest.model.RestErrorModel assertLastError()
Get the last error thrown (if any).
-
processModels
public <T> T processModels(Class<T> classz, org.alfresco.rest.core.RestRequest simpleRequest)
Process responses for a collection of models asRestSiteModelsCollection.
-
processModel
public <T> T processModel(Class<T> classz, org.alfresco.rest.core.RestRequest restRequest)
Process responses for a single model asRestSiteModel.
-
processEmptyModel
public void processEmptyModel(org.alfresco.rest.core.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 aUserModelfor a new test user.
-
withCoreAPI
public org.alfresco.rest.requests.coreAPI.RestCoreAPI withCoreAPI()
Get the Alfresco Core API.
-
withSearchAPI
public org.alfresco.rest.requests.search.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 org.alfresco.rest.model.RestHtmlResponse processHtmlResponse(org.alfresco.rest.core.RestRequest simpleRequest)
Process a response that returns a html- Throws:
org.alfresco.rest.exception.EmptyJsonResponseException- If there is no response from the server.
-
-