diff --git a/rm-automation/rm-automation-community-rest-api/pom.xml b/rm-automation/rm-automation-community-rest-api/pom.xml index 3a53363b14..5da82a250c 100644 --- a/rm-automation/rm-automation-community-rest-api/pom.xml +++ b/rm-automation/rm-automation-community-rest-api/pom.xml @@ -30,6 +30,17 @@ ${project.parent.parent.basedir}/license/description.ftl + + org.apache.maven.plugins + maven-jar-plugin + + + + test-jar + + + + diff --git a/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/core/RMRestWrapper.java b/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/core/RMRestWrapper.java index 706efef8d7..d4830e6910 100644 --- a/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/core/RMRestWrapper.java +++ b/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/core/RMRestWrapper.java @@ -50,4 +50,19 @@ public class RMRestWrapper extends RestWrapper { return new RestIGCoreAPI(this, rmRestProperties); } + + @Override + public T processModel(Class classz, RestRequest restRequest) + { + try + { + return super.processModel(classz, restRequest); + } + catch (Exception e) + { + // TODO Hopefully remove this check when TAS stops using checked exceptions. + // See https://gitlab.alfresco.com/tas/alfresco-tas-restapi-test/merge_requests/392 + throw new RuntimeException(e); + } + } } diff --git a/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/core/RestAPIFactory.java b/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/core/RestAPIFactory.java index d2edca7279..bcbb97e875 100644 --- a/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/core/RestAPIFactory.java +++ b/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/core/RestAPIFactory.java @@ -26,6 +26,8 @@ */ package org.alfresco.rest.core; +import javax.annotation.Resource; + import org.alfresco.rest.rm.community.requests.igCoreAPI.FilePlanComponentAPI; import org.alfresco.rest.rm.community.requests.igCoreAPI.FilesAPI; import org.alfresco.rest.rm.community.requests.igCoreAPI.RMSiteAPI; @@ -50,7 +52,7 @@ public class RestAPIFactory @Autowired private DataUser dataUser; - @Autowired + @Resource(name = "RMRestWrapper") private RMRestWrapper rmRestWrapper; /** @@ -96,7 +98,7 @@ public class RestAPIFactory { return getRestIGCoreAPI(userModel).usingRecords(); } - + public FilesAPI getFilesAPI() { return getRestIGCoreAPI(null).usingFiles(); diff --git a/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/requests/igCoreAPI/FilePlanComponentAPI.java b/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/requests/igCoreAPI/FilePlanComponentAPI.java index cdd8530dc1..bfb00548ff 100644 --- a/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/requests/igCoreAPI/FilePlanComponentAPI.java +++ b/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/requests/igCoreAPI/FilePlanComponentAPI.java @@ -28,7 +28,6 @@ package org.alfresco.rest.rm.community.requests.igCoreAPI; import static com.jayway.restassured.RestAssured.basic; import static com.jayway.restassured.RestAssured.given; - import static org.alfresco.rest.core.RestRequest.requestWithBody; import static org.alfresco.rest.core.RestRequest.simpleRequest; import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentType.CONTENT_TYPE; diff --git a/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/requests/igCoreAPI/FilesAPI.java b/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/requests/igCoreAPI/FilesAPI.java index 83df47ab11..afa93ac2f8 100644 --- a/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/requests/igCoreAPI/FilesAPI.java +++ b/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/requests/igCoreAPI/FilesAPI.java @@ -65,7 +65,7 @@ public class FilesAPI extends RMModelRequest public FilePlanComponent declareAsRecord(String fileId, String parameters) throws Exception { mandatoryString("fileId", fileId); - + return getRMRestWrapper().processModel(FilePlanComponent.class, simpleRequest( POST, "/files/{fileId}/declare?{parameters}", @@ -73,7 +73,7 @@ public class FilesAPI extends RMModelRequest parameters )); } - + /** * A no-parameter version of {@link FilesAPI#declareAsRecord} * @param fileId The Id of a file to declare as record diff --git a/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/requests/igCoreAPI/RecordsAPI.java b/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/requests/igCoreAPI/RecordsAPI.java index efcaca97ef..2eab707885 100644 --- a/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/requests/igCoreAPI/RecordsAPI.java +++ b/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/requests/igCoreAPI/RecordsAPI.java @@ -27,7 +27,6 @@ package org.alfresco.rest.rm.community.requests.igCoreAPI; import static com.jayway.restassured.RestAssured.given; - import static org.alfresco.rest.core.RestRequest.requestWithBody; import static org.alfresco.rest.rm.community.util.ParameterCheck.mandatoryObject; import static org.alfresco.rest.rm.community.util.ParameterCheck.mandatoryString; diff --git a/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/util/PojoUtility.java b/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/util/PojoUtility.java index 7653f8ffc0..3ca50bec8a 100644 --- a/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/util/PojoUtility.java +++ b/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/util/PojoUtility.java @@ -30,7 +30,6 @@ import java.io.IOException; import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.core.JsonGenerationException; -import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.databind.JsonMappingException; import com.fasterxml.jackson.databind.ObjectMapper; @@ -46,9 +45,8 @@ public class PojoUtility * Converting object to JSON string * * @param model The java object model to convert - * @throws JsonProcessingException Throws exceptions if the given object doesn't match to the POJO class model */ - public static String toJson(Object model) throws JsonProcessingException + public static String toJson(Object model) { ObjectMapper mapper = new ObjectMapper(); //include only values that differ from default settings to be included