From 6100204eb36e1044c7f3f17957882e9f2dd43789 Mon Sep 17 00:00:00 2001 From: Tuna Aksoy Date: Mon, 12 Dec 2016 16:00:02 +0000 Subject: [PATCH 1/9] RM-4489 (API: Review period cannot be updated if the review period type and expression are set) --- .../rest/core/ExtendedRestProperties.java | 23 + .../rest/core/ExtendedRestWrapper.java | 33 ++ .../FilePlanComponentModel.java | 421 ++++++++++++++++++ .../requests/FilePlanComponents.java | 183 ++++++++ .../requests/igCoreAPI/RestIGCoreAPI.java | 45 ++ 5 files changed, 705 insertions(+) create mode 100644 rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/core/ExtendedRestProperties.java create mode 100644 rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/core/ExtendedRestWrapper.java create mode 100644 rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/model/fileplancomponents/FilePlanComponentModel.java create mode 100644 rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/requests/FilePlanComponents.java create mode 100644 rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/requests/igCoreAPI/RestIGCoreAPI.java diff --git a/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/core/ExtendedRestProperties.java b/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/core/ExtendedRestProperties.java new file mode 100644 index 0000000000..bebe739099 --- /dev/null +++ b/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/core/ExtendedRestProperties.java @@ -0,0 +1,23 @@ +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 Alfresco Software Limited + * %% + * License rights for this program may be obtained from Alfresco Software, Ltd. + * pursuant to a written agreement and any use of this program without such an + * agreement is prohibited. + * #L% + */ +package org.alfresco.rest.core; + +/** + * FIXME!!! + * + * @author Tuna Aksoy + * @since 2.6 + */ +public class ExtendedRestProperties extends RestProperties +{ + +} diff --git a/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/core/ExtendedRestWrapper.java b/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/core/ExtendedRestWrapper.java new file mode 100644 index 0000000000..464cd01195 --- /dev/null +++ b/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/core/ExtendedRestWrapper.java @@ -0,0 +1,33 @@ +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 Alfresco Software Limited + * %% + * License rights for this program may be obtained from Alfresco Software, Ltd. + * pursuant to a written agreement and any use of this program without such an + * agreement is prohibited. + * #L% + */ +package org.alfresco.rest.core; + +import org.alfresco.rest.core.RestWrapper; +import org.alfresco.rest.rm.community.requests.igCoreAPI.RestIGCoreAPI; +import org.springframework.beans.factory.annotation.Autowired; + +/** + * FIXME!!! + * + * @author Tuna Aksoy + * @since 2.6 + */ +public class ExtendedRestWrapper extends RestWrapper +{ + @Autowired + private ExtendedRestProperties extendedRestProperties; + + public RestIGCoreAPI withIGCoreAPI() + { + return new RestIGCoreAPI(this, extendedRestProperties); + } +} diff --git a/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/model/fileplancomponents/FilePlanComponentModel.java b/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/model/fileplancomponents/FilePlanComponentModel.java new file mode 100644 index 0000000000..cea1b952a1 --- /dev/null +++ b/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/model/fileplancomponents/FilePlanComponentModel.java @@ -0,0 +1,421 @@ +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 Alfresco Software Limited + * %% + * This file is part of the Alfresco software. + * - + * If the software was purchased under a paid Alfresco license, the terms of + * the paid license agreement will prevail. Otherwise, the software is + * provided under the following open source license terms: + * - + * Alfresco is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * - + * Alfresco is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * - + * You should have received a copy of the GNU Lesser General Public License + * along with Alfresco. If not, see . + * #L% + */ +package org.alfresco.rest.rm.community.model.fileplancomponents; + +import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.ALLOWABLE_OPERATIONS; +import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.IS_CLOSED; +import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PROPERTIES; + +import java.util.List; + +import com.fasterxml.jackson.annotation.JsonProperty; + +import org.alfresco.utility.model.TestModel; + +/** + * POJO for file plan component + * + * @author Tuna Aksoy + * @author Rodica Sutu + * @since 2.6 + */ +public class FilePlanComponentModel extends TestModel +{ + @JsonProperty (required = true) + private String id; + + @JsonProperty (required = true) + private String parentId; + + @JsonProperty (required = true) + private String name; + + @JsonProperty (required = true) + private String nodeType; + + @JsonProperty (required = true) + private Boolean isCategory; + + @JsonProperty (required = true) + private Boolean isRecordFolder; + + @JsonProperty (required = true) + private Boolean isFile; + + @JsonProperty + private Boolean hasRetentionSchedule; + + @JsonProperty(value = IS_CLOSED) + private Boolean isClosed; + + @JsonProperty + private Boolean isCompleted; + + @JsonProperty (required = true) + private List aspectNames; + + @JsonProperty (required = true) + private FilePlanComponentUserInfo createdByUser; + + @JsonProperty(value = PROPERTIES, required = true) + private FilePlanComponentProperties properties; + + @JsonProperty (value = ALLOWABLE_OPERATIONS) + private List allowableOperations; + + private FilePlanComponentPath path; + + @JsonProperty (required = true) + private String modifiedAt; + + @JsonProperty (required = true) + private String createdAt; + + @JsonProperty (required = true) + private FilePlanComponentUserInfo modifiedByUser; + + + /**Helper constructor for creating the file plan component using + * + * @param name File Plan Component name + * @param nodeType File Plan Component node type + * @param properties File Plan Component properties + */ + public FilePlanComponentModel(String name, String nodeType, FilePlanComponentProperties properties) + { + this.name = name; + this.nodeType = nodeType; + this.properties = properties; + } + + /** + * Helper constructor to create empty file plan component + */ + public FilePlanComponentModel() { } + + /** + * Helper constructor for creating the file plan component using + * + * @param name File Plan Component name + */ + public FilePlanComponentModel(String name) + { + this.name = name; + } + + /** + * Helper constructor for creating the file plan component using + * + * @param name File Plan Component name + * @param properties File Plan Component properties + */ + public FilePlanComponentModel(String name, FilePlanComponentProperties properties) + { + this.name = name; + this.properties = properties; + } + + /** + * @return the id + */ + public String getId() + { + return this.id; + } + + /** + * @param id the id to set + */ + public void setId(String id) + { + this.id = id; + } + + /** + * @return the parentId + */ + public String getParentId() + { + return this.parentId; + } + + /** + * @param parentId the parentId to set + */ + public void setParentId(String parentId) + { + this.parentId = parentId; + } + + /** + * @return the name + */ + public String getName() + { + return this.name; + } + + /** + * @param name the name to set + */ + public void setName(String name) + { + this.name = name; + } + + /** + * @return the nodeType + */ + public String getNodeType() + { + return this.nodeType; + } + + /** + * @param nodeType the nodeType to set + */ + public void setNodeType(String nodeType) + { + this.nodeType = nodeType; + } + + /** + * @return the isCategory + */ + public Boolean isCategory() + { + return this.isCategory; + } + + /** + * @param isCategory the isCategory to set + */ + public void setCategory(Boolean isCategory) + { + this.isCategory = isCategory; + } + + /** + * @return the isRecordFolder + */ + public Boolean isRecordFolder() + { + return this.isRecordFolder; + } + + /** + * @param isRecordFolder the isRecordFolder to set + */ + public void setRecordFolder(Boolean isRecordFolder) + { + this.isRecordFolder = isRecordFolder; + } + + /** + * @return the isFile + */ + public Boolean isFile() + { + return this.isFile; + } + + /** + * @param isFile the isFile to set + */ + public void setFile(Boolean isFile) + { + this.isFile = isFile; + } + + /** + * @return the hasRetentionSchedule + */ + public Boolean hasRetentionSchedule() + { + return this.hasRetentionSchedule; + } + + /** + * @param hasRetentionSchedule the hasRetentionSchedule to set + */ + public void setHasRetentionSchedule(Boolean hasRetentionSchedule) + { + this.hasRetentionSchedule = hasRetentionSchedule; + } + + /** + * @return the properties + */ + public FilePlanComponentProperties getProperties() + { + return properties; + } + + /** + * @param properties the properties to set + */ + public void setProperties(FilePlanComponentProperties properties) + { + this.properties = properties; + } + + /** + * @return the aspectNames + */ + public List getAspectNames() + { + return this.aspectNames; + } + + /** + * @param aspectNames the aspectNames to set + */ + public void setAspectNames(List aspectNames) + { + this.aspectNames = aspectNames; + } + + /** + * @return the createdByUser + */ + public FilePlanComponentUserInfo getCreatedByUser() + { + return this.createdByUser; + } + + /** + * @param createdByUser the createdByUser to set + */ + public void setCreatedByUser(FilePlanComponentUserInfo createdByUser) + { + this.createdByUser = createdByUser; + } + + /** + * @return the allowableOperations + */ + public List getAllowableOperations() + { + return this.allowableOperations; + } + + /** + * @return the path + */ + public FilePlanComponentPath getPath() + { + return this.path; + } + + /** + * @param path the path to set + */ + public void setPath(FilePlanComponentPath path) + { + this.path = path; + } + + /** + * @param modifiedAt the modifiedAt to set + */ + public void setModifiedAt(String modifiedAt) + { + this.modifiedAt = modifiedAt; + } + + /** + * @param createdAt the createdAt to set + */ + public void setCreatedAt(String createdAt) + { + this.createdAt = createdAt; + } + + /** + * @param modifiedByUser the modifiedByUser to set + */ + public void setModifiedByUser(FilePlanComponentUserInfo modifiedByUser) + { + this.modifiedByUser = modifiedByUser; + } + + /** + * @return the modifiedAt + */ + public String getModifiedAt() + { + return this.modifiedAt; + } + + /** + * @return the createdAt + */ + public String getCreatedAt() + { + return this.createdAt; + } + + /** + * @return the modifiedByUser + */ + public FilePlanComponentUserInfo getModifiedByUser() + { + return this.modifiedByUser; + } + + /** + * @return the isClosed + */ + public Boolean isClosed() + { + return this.isClosed; + } + + /** + * @param closed the isClosed to set + */ + public void setClosed(Boolean closed) + { + this.isClosed = closed; + } + + /** + * @return the isCompleted + */ + public Boolean isCompleted() + { + return this.isCompleted; + } + + /** + * @param completed the isCompleted to set + */ + public void setCompleted(Boolean completed) + { + this.isCompleted = completed; + } +} diff --git a/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/requests/FilePlanComponents.java b/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/requests/FilePlanComponents.java new file mode 100644 index 0000000000..07aef4c24a --- /dev/null +++ b/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/requests/FilePlanComponents.java @@ -0,0 +1,183 @@ +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 Alfresco Software Limited + * %% + * License rights for this program may be obtained from Alfresco Software, Ltd. + * pursuant to a written agreement and any use of this program without such an + * agreement is prohibited. + * #L% + */ +package org.alfresco.rest.rm.community.requests; + +import static org.alfresco.rest.core.RestRequest.requestWithBody; +import static org.alfresco.rest.core.RestRequest.simpleRequest; +import static org.alfresco.rest.rm.community.util.ParameterCheck.mandatoryObject; +import static org.alfresco.rest.rm.community.util.ParameterCheck.mandatoryString; +import static org.alfresco.rest.rm.community.util.PojoUtility.toJson; +import static org.springframework.http.HttpMethod.DELETE; +import static org.springframework.http.HttpMethod.GET; +import static org.springframework.http.HttpMethod.POST; +import static org.springframework.http.HttpMethod.PUT; + +import org.alfresco.rest.core.RestWrapper; +import org.alfresco.rest.requests.ModelRequest; +import org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponent; +import org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentModel; +import org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentsCollection; + +/** + * FIXME!!! + * + * @author Tuna Aksoy + * @since 2.6 + */ +public class FilePlanComponents extends ModelRequest +{ + private FilePlanComponentModel filePlanComponentModel; + + /** + * @param restWrapper + */ + public FilePlanComponents(FilePlanComponentModel filePlanComponentModel, RestWrapper restWrapper) + { + super(restWrapper); + this.filePlanComponentModel = filePlanComponentModel; + } + + /** + * Get a file plan component + * + * @param filePlanComponentId The id of the file plan component to get + * @return The {@link FilePlanComponent} for the given file plan component id + * @throws Exception for the following cases: + *
    + *
  • {@code fileplanComponentId} is not a valid format
  • + *
  • authentication fails
  • + *
  • {@code fileplanComponentId} does not exist
  • + *
+ */ + public FilePlanComponent getFilePlanComponent(String filePlanComponentId) throws Exception + { + mandatoryString("filePlanComponentId", filePlanComponentId); + + /* + return restWrapper.processModel(FilePlanComponent.class, simpleRequest( + GET, + "fileplan-components/{fileplanComponentId}?{parameters}", + filePlanComponentId, getParameters() + */ + // FIXME!!! + return restWrapper.processModel(FilePlanComponent.class, simpleRequest( + GET, + "fileplan-components/{fileplanComponentId}", + filePlanComponentId + )); + } + + /** + * List child components of a file plan component + * + * @param filePlanComponentId The id of the file plan component of which to get child components + * @return The {@link FilePlanComponent} for the given file plan component id + * @throws Exception for the following cases: + *
    + *
  • {@code fileplanComponentId} is not a valid format
  • + *
  • authentication fails
  • + *
  • {@code fileplanComponentId} does not exist
  • + *
+ */ + public FilePlanComponentsCollection listChildComponents(String filePlanComponentId) throws Exception + { + mandatoryString("filePlanComponentId", filePlanComponentId); + + return restWrapper.processModels(FilePlanComponentsCollection.class, simpleRequest( + GET, + "fileplan-components/{fileplanComponentId}/children", + filePlanComponentId + )); + } + + /** + * Creates a file plan component with the given properties under the parent node with the given id + * + * @param filePlanComponentModel The properties of the file plan component to be created + * @param parentId The id of the parent where the new file plan component should be created + * @return The {@link FilePlanComponent} with the given properties + * @throws Exception for the following cases: + *
    + *
  • {@code fileplanComponentId} is not a valid format
  • + *
  • authentication fails
  • + *
  • current user does not have permission to add children to {@code fileplanComponentId}
  • + *
  • {@code fileplanComponentId} does not exist
  • + *
  • new name clashes with an existing node in the current parent container
  • + *
  • model integrity exception, including node name with invalid characters
  • + *
+ */ + public FilePlanComponent createFilePlanComponent(FilePlanComponent filePlanComponentModel, String parentId) throws Exception + { + mandatoryObject("filePlanComponentProperties", filePlanComponentModel); + mandatoryString("parentId", parentId); + + return restWrapper.processModel(FilePlanComponent.class, requestWithBody( + POST, + toJson(filePlanComponentModel), + "fileplan-components/{fileplanComponentId}/children", + parentId + )); + } + + /** + * Updates a file plan component + * + * @param filePlanComponent The properties to be updated + * @param filePlanComponentId The id of the file plan component which will be updated + * @param returns The updated {@link FilePlanComponent} + * @throws Exception for the following cases: + *
    + *
  • the update request is invalid or {@code fileplanComponentId} is not a valid format or {@code filePlanComponentProperties} is invalid
  • + *
  • authentication fails
  • + *
  • current user does not have permission to update {@code fileplanComponentId}
  • + *
  • {@code fileplanComponentId} does not exist
  • + *
  • the updated name clashes with an existing node in the current parent folder
  • + *
  • model integrity exception, including node name with invalid characters
  • + *
+ */ + public FilePlanComponent updateFilePlanComponent(FilePlanComponent filePlanComponent, String filePlanComponentId) throws Exception + { + mandatoryObject("filePlanComponentProperties", filePlanComponent); + mandatoryString("filePlanComponentId", filePlanComponentId); + + return restWrapper.processModel(FilePlanComponent.class, requestWithBody( + PUT, + toJson(filePlanComponent), + "fileplan-components/{fileplanComponentId}", + filePlanComponentId + )); + } + + /** + * Delete file plan component + * + * @param filePlanComponentId The id of the file plan component to be deleted + * @throws Exception for the following cases: + *
    + *
  • {@code fileplanComponentId} is not a valid format
  • + *
  • authentication fails
  • + *
  • current user does not have permission to delete {@code fileplanComponentId}
  • + *
  • {@code fileplanComponentId} does not exist
  • + *
  • {@code fileplanComponentId} is locked and cannot be deleted
  • + *
+ */ + public void deleteFilePlanComponent(String filePlanComponentId) throws Exception + { + mandatoryString("filePlanComponentId", filePlanComponentId); + + restWrapper.processEmptyModel(simpleRequest( + DELETE, + "fileplan-components/{fileplanComponentId}", + filePlanComponentId + )); + } +} diff --git a/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/requests/igCoreAPI/RestIGCoreAPI.java b/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/requests/igCoreAPI/RestIGCoreAPI.java new file mode 100644 index 0000000000..cfd62126f6 --- /dev/null +++ b/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/requests/igCoreAPI/RestIGCoreAPI.java @@ -0,0 +1,45 @@ +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 Alfresco Software Limited + * %% + * License rights for this program may be obtained from Alfresco Software, Ltd. + * pursuant to a written agreement and any use of this program without such an + * agreement is prohibited. + * #L% + */ +package org.alfresco.rest.rm.community.requests.igCoreAPI; + +import com.jayway.restassured.RestAssured; + +import org.alfresco.rest.core.ExtendedRestProperties; +import org.alfresco.rest.core.RestWrapper; +import org.alfresco.rest.requests.ModelRequest; + +/** + * FIXME!!! + * + * @author Tuna Aksoy + * @since 2.6 + */ +public class RestIGCoreAPI extends ModelRequest +{ + private ExtendedRestProperties extendedRestProperties; + + /** + * FIXME!!! + * + * @param restWrapper FIXME!!! + * @param restProperties FIXME!!! + */ + public RestIGCoreAPI(RestWrapper restWrapper, ExtendedRestProperties extendedRestProperties) + { + super(restWrapper); + this.extendedRestProperties = extendedRestProperties; + // FIXME + RestAssured.baseURI = extendedRestProperties.envProperty().getTestServerUrl(); + RestAssured.port = extendedRestProperties.envProperty().getPort(); + RestAssured.basePath = extendedRestProperties.getRestWorkflowPath(); + } +} From c91bf852d9c3dad267d6cb0b37295121651a890a Mon Sep 17 00:00:00 2001 From: Tuna Aksoy Date: Sat, 24 Dec 2016 20:48:23 +0000 Subject: [PATCH 2/9] RM-4488 (Refactor REST API Automation test code according to the latest changes) --- .../rm-automation-community-rest-api/pom.xml | 1 + .../rest/core/ExtendedRestProperties.java | 23 -- .../rest/core/ExtendedRestWrapper.java | 33 -- .../alfresco/rest/core/RMRestProperties.java | 88 +++++ .../org/alfresco/rest/core/RMRestWrapper.java | 47 +++ .../fileplancomponents/FilePlanComponent.java | 117 ------ .../FilePlanComponentAlias.java | 54 +-- .../FilePlanComponentContent.java | 2 +- .../FilePlanComponentEntry.java | 10 +- .../FilePlanComponentIdNamePair.java | 1 - .../FilePlanComponentModel.java | 339 +----------------- .../FilePlanComponentPath.java | 3 +- .../FilePlanComponentProperties.java | 13 +- .../FilePlanComponentType.java | 70 +--- .../FilePlanComponentUserInfo.java | 1 - .../site/{RMSite.java => RMSiteModel.java} | 10 +- .../requests/FilePlanComponentAPI.java | 275 -------------- .../requests/FilePlanComponents.java | 203 +++++++++-- .../rm/community/requests/RMModelRequest.java | 57 +++ .../requests/{RMSiteAPI.java => RMSite.java} | 58 +-- .../rest/rm/community/requests/RMUserAPI.java | 14 +- .../requests/igCoreAPI/RestIGCoreAPI.java | 77 +++- .../rest/rm/community/util/PojoUtility.java | 1 - .../util/ReviewPeriodSerializer.java | 5 - .../resources/config.properties | 0 .../rest/rm/community/base/BaseRestTest.java | 192 +++++----- .../rest/rm/community/base/TestData.java | 28 +- .../fileplancomponents/DeleteRecordTests.java | 143 ++++---- .../ElectronicRecordTests.java | 80 ++--- .../fileplancomponents/FilePlanTests.java | 108 +++--- .../NonElectronicRecordTests.java | 90 +++-- .../RecordCategoryTest.java | 102 +++--- .../fileplancomponents/RecordFolderTests.java | 132 ++++--- .../UnfiledRecordsFolderTests.java | 81 ++--- .../rest/rm/community/site/RMSiteTests.java | 133 ++++--- 35 files changed, 1041 insertions(+), 1550 deletions(-) delete mode 100644 rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/core/ExtendedRestProperties.java delete mode 100644 rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/core/ExtendedRestWrapper.java create mode 100644 rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/core/RMRestProperties.java create mode 100644 rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/core/RMRestWrapper.java delete mode 100644 rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/model/fileplancomponents/FilePlanComponent.java rename rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/model/site/{RMSite.java => RMSiteModel.java} (90%) delete mode 100644 rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/requests/FilePlanComponentAPI.java create mode 100644 rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/requests/RMModelRequest.java rename rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/requests/{RMSiteAPI.java => RMSite.java} (76%) rename rm-automation/rm-automation-community-rest-api/src/{test => main}/resources/config.properties (100%) diff --git a/rm-automation/rm-automation-community-rest-api/pom.xml b/rm-automation/rm-automation-community-rest-api/pom.xml index 0579d444e2..3a53363b14 100644 --- a/rm-automation/rm-automation-community-rest-api/pom.xml +++ b/rm-automation/rm-automation-community-rest-api/pom.xml @@ -12,6 +12,7 @@ + 1.8 alfresco-rm-community-share alfresco-rm-community-repo 5.2.0-0 diff --git a/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/core/ExtendedRestProperties.java b/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/core/ExtendedRestProperties.java deleted file mode 100644 index bebe739099..0000000000 --- a/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/core/ExtendedRestProperties.java +++ /dev/null @@ -1,23 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 Alfresco Software Limited - * %% - * License rights for this program may be obtained from Alfresco Software, Ltd. - * pursuant to a written agreement and any use of this program without such an - * agreement is prohibited. - * #L% - */ -package org.alfresco.rest.core; - -/** - * FIXME!!! - * - * @author Tuna Aksoy - * @since 2.6 - */ -public class ExtendedRestProperties extends RestProperties -{ - -} diff --git a/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/core/ExtendedRestWrapper.java b/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/core/ExtendedRestWrapper.java deleted file mode 100644 index 464cd01195..0000000000 --- a/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/core/ExtendedRestWrapper.java +++ /dev/null @@ -1,33 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 Alfresco Software Limited - * %% - * License rights for this program may be obtained from Alfresco Software, Ltd. - * pursuant to a written agreement and any use of this program without such an - * agreement is prohibited. - * #L% - */ -package org.alfresco.rest.core; - -import org.alfresco.rest.core.RestWrapper; -import org.alfresco.rest.rm.community.requests.igCoreAPI.RestIGCoreAPI; -import org.springframework.beans.factory.annotation.Autowired; - -/** - * FIXME!!! - * - * @author Tuna Aksoy - * @since 2.6 - */ -public class ExtendedRestWrapper extends RestWrapper -{ - @Autowired - private ExtendedRestProperties extendedRestProperties; - - public RestIGCoreAPI withIGCoreAPI() - { - return new RestIGCoreAPI(this, extendedRestProperties); - } -} diff --git a/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/core/RMRestProperties.java b/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/core/RMRestProperties.java new file mode 100644 index 0000000000..7afa2cb8cb --- /dev/null +++ b/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/core/RMRestProperties.java @@ -0,0 +1,88 @@ +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 Alfresco Software Limited + * %% + * This file is part of the Alfresco software. + * - + * If the software was purchased under a paid Alfresco license, the terms of + * the paid license agreement will prevail. Otherwise, the software is + * provided under the following open source license terms: + * - + * Alfresco is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * - + * Alfresco is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * - + * You should have received a copy of the GNU Lesser General Public License + * along with Alfresco. If not, see . + * #L% + */ +package org.alfresco.rest.core; + +import org.springframework.beans.factory.annotation.Value; +import org.springframework.context.annotation.Configuration; +import org.springframework.context.annotation.PropertySource; + +/** + * FIXME!!! + * + * @author Tuna Aksoy + * @since 2.6 + */ +@Configuration +@PropertySource(value = {"classpath:default.properties", "classpath:config.properties"}) +@PropertySource(value = "classpath:module.properties", ignoreResourceNotFound = true) +@PropertySource(value = "classpath:local.properties", ignoreResourceNotFound = true) +public class RMRestProperties extends RestProperties +{ + @Value ("${alfresco.scheme}") + private String scheme; + + @Value ("${alfresco.server}") + private String server; + + @Value ("${alfresco.port}") + private String port; + + @Value ("${rest.rmPath}") + private String restRmPath; + + /** + * @return the scheme + */ + public String getScheme() + { + return this.scheme; + } + + /** + * @return the server + */ + public String getServer() + { + return this.server; + } + + /** + * @return the port + */ + public String getPort() + { + return this.port; + } + + /** + * @return the restRmPath + */ + public String getRestRmPath() + { + return this.restRmPath; + } +} 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 new file mode 100644 index 0000000000..1956a6cbf6 --- /dev/null +++ b/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/core/RMRestWrapper.java @@ -0,0 +1,47 @@ +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 Alfresco Software Limited + * %% + * This file is part of the Alfresco software. + * - + * If the software was purchased under a paid Alfresco license, the terms of + * the paid license agreement will prevail. Otherwise, the software is + * provided under the following open source license terms: + * - + * Alfresco is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * - + * Alfresco is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * - + * You should have received a copy of the GNU Lesser General Public License + * along with Alfresco. If not, see . + * #L% + */ +package org.alfresco.rest.core; + +import org.alfresco.rest.rm.community.requests.igCoreAPI.RestIGCoreAPI; +import org.springframework.beans.factory.annotation.Autowired; + +/** + * FIXME!!! + * + * @author Tuna Aksoy + * @since 2.6 + */ +public class RMRestWrapper extends RestWrapper +{ + @Autowired + private RMRestProperties rmRestProperties; + + public RestIGCoreAPI withIGCoreAPI() + { + return new RestIGCoreAPI(this, rmRestProperties); + } +} diff --git a/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/model/fileplancomponents/FilePlanComponent.java b/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/model/fileplancomponents/FilePlanComponent.java deleted file mode 100644 index b9edeb4002..0000000000 --- a/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/model/fileplancomponents/FilePlanComponent.java +++ /dev/null @@ -1,117 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ -package org.alfresco.rest.rm.community.model.fileplancomponents; - -import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.ALLOWABLE_OPERATIONS; -import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.IS_CLOSED; -import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PATH; -import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PROPERTIES; -import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.RELATIVE_PATH; - -import java.util.List; - -import com.fasterxml.jackson.annotation.JsonProperty; - -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.Data; -import lombok.NoArgsConstructor; - -/** - * POJO for file plan component - * - * @author Tuna Aksoy - * @author Rodica Sutu - * @since 2.6 - */ -@Builder -@Data -@NoArgsConstructor -@AllArgsConstructor -public class FilePlanComponent -{ - @JsonProperty (required = true) - private String id; - - @JsonProperty (required = true) - private String parentId; - - @JsonProperty (required = true) - private String name; - - @JsonProperty (required = true) - private String nodeType; - - @JsonProperty (required = true) - private Boolean isCategory; - - @JsonProperty (required = true) - private Boolean isRecordFolder; - - @JsonProperty (required = true) - private Boolean isFile; - - @JsonProperty - private Boolean hasRetentionSchedule; - - @JsonProperty(value = IS_CLOSED) - private Boolean isClosed; - - @JsonProperty - private Boolean isCompleted; - - @JsonProperty (required = true) - private List aspectNames; - - @JsonProperty (required = true) - private FilePlanComponentUserInfo createdByUser; - - @JsonProperty(value = PROPERTIES, required = true) - private FilePlanComponentProperties properties; - - @JsonProperty (value = ALLOWABLE_OPERATIONS) - private List allowableOperations; - - @JsonProperty (required = false) - private FilePlanComponentContent content; - - @JsonProperty (value = PATH) - private FilePlanComponentPath path; - - @JsonProperty (required = true) - private String modifiedAt; - - @JsonProperty (required = true) - private String createdAt; - - @JsonProperty (required = true) - private FilePlanComponentUserInfo modifiedByUser; - - @JsonProperty (value = RELATIVE_PATH) - private String relativePath; - -} diff --git a/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/model/fileplancomponents/FilePlanComponentAlias.java b/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/model/fileplancomponents/FilePlanComponentAlias.java index 11268d55c0..d5855794ab 100644 --- a/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/model/fileplancomponents/FilePlanComponentAlias.java +++ b/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/model/fileplancomponents/FilePlanComponentAlias.java @@ -26,58 +26,16 @@ */ package org.alfresco.rest.rm.community.model.fileplancomponents; -import static org.alfresco.rest.rm.community.util.ParameterCheck.mandatoryString; - /** - * File plan component alias enumeration + * File plan component alias * * @author Tuna Aksoy * @since 2.6 */ -public enum FilePlanComponentAlias +public class FilePlanComponentAlias { - FILE_PLAN_ALIAS("-filePlan-"), - TRANSFERS_ALIAS("-transfers-"), - UNFILED_RECORDS_CONTAINER_ALIAS("-unfiled-"), - HOLDS_ALIAS("-holds-"); - - private String alias; - - private FilePlanComponentAlias(String alias) - { - this.alias = alias; - } - - public static final FilePlanComponentAlias getFilePlanComponentAlias(String alias) - { - mandatoryString("alias", alias); - - FilePlanComponentAlias result = null; - FilePlanComponentAlias[] values = values(); - - for (FilePlanComponentAlias filePlanComponentAlias : values) - { - if (filePlanComponentAlias.toString().equals(alias)) - { - result = filePlanComponentAlias; - break; - } - } - - if (result == null) - { - throw new IllegalArgumentException("Invalid file plan component alias enum value: '" + alias + "'."); - } - - return result; - } - - /** - * @see java.lang.Enum#toString() - */ - @Override - public String toString() - { - return this.alias; - } + public static final String FILE_PLAN_ALIAS = "-filePlan-"; + public static final String TRANSFERS_ALIAS = "-transfers-"; + public static final String UNFILED_RECORDS_CONTAINER_ALIAS = "-unfiled-"; + public static final String HOLDS_ALIAS = "-holds-"; } diff --git a/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/model/fileplancomponents/FilePlanComponentContent.java b/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/model/fileplancomponents/FilePlanComponentContent.java index 5a22064c4a..1c2c90f9db 100644 --- a/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/model/fileplancomponents/FilePlanComponentContent.java +++ b/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/model/fileplancomponents/FilePlanComponentContent.java @@ -30,6 +30,7 @@ import com.fasterxml.jackson.annotation.JsonProperty; /** * POJO for FilePlanComponent content field + * * @author Kristijan Conkas * @since 2.6 */ @@ -46,5 +47,4 @@ public class FilePlanComponentContent @JsonProperty (required = true) private Integer sizeInBytes; - } diff --git a/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/model/fileplancomponents/FilePlanComponentEntry.java b/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/model/fileplancomponents/FilePlanComponentEntry.java index 6aa037599b..947610243a 100644 --- a/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/model/fileplancomponents/FilePlanComponentEntry.java +++ b/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/model/fileplancomponents/FilePlanComponentEntry.java @@ -30,11 +30,13 @@ import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanCo import com.fasterxml.jackson.annotation.JsonProperty; +import org.alfresco.rest.core.RestModels; + import lombok.AllArgsConstructor; import lombok.Builder; import lombok.Data; +import lombok.EqualsAndHashCode; import lombok.NoArgsConstructor; -import org.alfresco.rest.core.RestModels; /** * POJO for file plan component entry @@ -44,11 +46,11 @@ import org.alfresco.rest.core.RestModels; */ @Builder @Data +@EqualsAndHashCode(callSuper = true) @NoArgsConstructor @AllArgsConstructor -public class FilePlanComponentEntry extends RestModels +public class FilePlanComponentEntry extends RestModels { @JsonProperty(ENTRY) - FilePlanComponent filePlanComponent; - + FilePlanComponentModel filePlanComponentModel; } diff --git a/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/model/fileplancomponents/FilePlanComponentIdNamePair.java b/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/model/fileplancomponents/FilePlanComponentIdNamePair.java index 25b9f3eadb..aee4276c8c 100644 --- a/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/model/fileplancomponents/FilePlanComponentIdNamePair.java +++ b/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/model/fileplancomponents/FilePlanComponentIdNamePair.java @@ -45,5 +45,4 @@ public class FilePlanComponentIdNamePair { public String id; public String name; - } diff --git a/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/model/fileplancomponents/FilePlanComponentModel.java b/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/model/fileplancomponents/FilePlanComponentModel.java index cea1b952a1..4d22bc232c 100644 --- a/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/model/fileplancomponents/FilePlanComponentModel.java +++ b/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/model/fileplancomponents/FilePlanComponentModel.java @@ -28,7 +28,9 @@ package org.alfresco.rest.rm.community.model.fileplancomponents; import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.ALLOWABLE_OPERATIONS; import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.IS_CLOSED; +import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PATH; import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PROPERTIES; +import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.RELATIVE_PATH; import java.util.List; @@ -36,6 +38,12 @@ import com.fasterxml.jackson.annotation.JsonProperty; import org.alfresco.utility.model.TestModel; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.NoArgsConstructor; + /** * POJO for file plan component * @@ -43,6 +51,11 @@ import org.alfresco.utility.model.TestModel; * @author Rodica Sutu * @since 2.6 */ +@Builder +@Data +@EqualsAndHashCode(callSuper = true) +@NoArgsConstructor +@AllArgsConstructor public class FilePlanComponentModel extends TestModel { @JsonProperty (required = true) @@ -87,6 +100,10 @@ public class FilePlanComponentModel extends TestModel @JsonProperty (value = ALLOWABLE_OPERATIONS) private List allowableOperations; + @JsonProperty (required = false) + private FilePlanComponentContent content; + + @JsonProperty (value = PATH) private FilePlanComponentPath path; @JsonProperty (required = true) @@ -98,324 +115,6 @@ public class FilePlanComponentModel extends TestModel @JsonProperty (required = true) private FilePlanComponentUserInfo modifiedByUser; - - /**Helper constructor for creating the file plan component using - * - * @param name File Plan Component name - * @param nodeType File Plan Component node type - * @param properties File Plan Component properties - */ - public FilePlanComponentModel(String name, String nodeType, FilePlanComponentProperties properties) - { - this.name = name; - this.nodeType = nodeType; - this.properties = properties; - } - - /** - * Helper constructor to create empty file plan component - */ - public FilePlanComponentModel() { } - - /** - * Helper constructor for creating the file plan component using - * - * @param name File Plan Component name - */ - public FilePlanComponentModel(String name) - { - this.name = name; - } - - /** - * Helper constructor for creating the file plan component using - * - * @param name File Plan Component name - * @param properties File Plan Component properties - */ - public FilePlanComponentModel(String name, FilePlanComponentProperties properties) - { - this.name = name; - this.properties = properties; - } - - /** - * @return the id - */ - public String getId() - { - return this.id; - } - - /** - * @param id the id to set - */ - public void setId(String id) - { - this.id = id; - } - - /** - * @return the parentId - */ - public String getParentId() - { - return this.parentId; - } - - /** - * @param parentId the parentId to set - */ - public void setParentId(String parentId) - { - this.parentId = parentId; - } - - /** - * @return the name - */ - public String getName() - { - return this.name; - } - - /** - * @param name the name to set - */ - public void setName(String name) - { - this.name = name; - } - - /** - * @return the nodeType - */ - public String getNodeType() - { - return this.nodeType; - } - - /** - * @param nodeType the nodeType to set - */ - public void setNodeType(String nodeType) - { - this.nodeType = nodeType; - } - - /** - * @return the isCategory - */ - public Boolean isCategory() - { - return this.isCategory; - } - - /** - * @param isCategory the isCategory to set - */ - public void setCategory(Boolean isCategory) - { - this.isCategory = isCategory; - } - - /** - * @return the isRecordFolder - */ - public Boolean isRecordFolder() - { - return this.isRecordFolder; - } - - /** - * @param isRecordFolder the isRecordFolder to set - */ - public void setRecordFolder(Boolean isRecordFolder) - { - this.isRecordFolder = isRecordFolder; - } - - /** - * @return the isFile - */ - public Boolean isFile() - { - return this.isFile; - } - - /** - * @param isFile the isFile to set - */ - public void setFile(Boolean isFile) - { - this.isFile = isFile; - } - - /** - * @return the hasRetentionSchedule - */ - public Boolean hasRetentionSchedule() - { - return this.hasRetentionSchedule; - } - - /** - * @param hasRetentionSchedule the hasRetentionSchedule to set - */ - public void setHasRetentionSchedule(Boolean hasRetentionSchedule) - { - this.hasRetentionSchedule = hasRetentionSchedule; - } - - /** - * @return the properties - */ - public FilePlanComponentProperties getProperties() - { - return properties; - } - - /** - * @param properties the properties to set - */ - public void setProperties(FilePlanComponentProperties properties) - { - this.properties = properties; - } - - /** - * @return the aspectNames - */ - public List getAspectNames() - { - return this.aspectNames; - } - - /** - * @param aspectNames the aspectNames to set - */ - public void setAspectNames(List aspectNames) - { - this.aspectNames = aspectNames; - } - - /** - * @return the createdByUser - */ - public FilePlanComponentUserInfo getCreatedByUser() - { - return this.createdByUser; - } - - /** - * @param createdByUser the createdByUser to set - */ - public void setCreatedByUser(FilePlanComponentUserInfo createdByUser) - { - this.createdByUser = createdByUser; - } - - /** - * @return the allowableOperations - */ - public List getAllowableOperations() - { - return this.allowableOperations; - } - - /** - * @return the path - */ - public FilePlanComponentPath getPath() - { - return this.path; - } - - /** - * @param path the path to set - */ - public void setPath(FilePlanComponentPath path) - { - this.path = path; - } - - /** - * @param modifiedAt the modifiedAt to set - */ - public void setModifiedAt(String modifiedAt) - { - this.modifiedAt = modifiedAt; - } - - /** - * @param createdAt the createdAt to set - */ - public void setCreatedAt(String createdAt) - { - this.createdAt = createdAt; - } - - /** - * @param modifiedByUser the modifiedByUser to set - */ - public void setModifiedByUser(FilePlanComponentUserInfo modifiedByUser) - { - this.modifiedByUser = modifiedByUser; - } - - /** - * @return the modifiedAt - */ - public String getModifiedAt() - { - return this.modifiedAt; - } - - /** - * @return the createdAt - */ - public String getCreatedAt() - { - return this.createdAt; - } - - /** - * @return the modifiedByUser - */ - public FilePlanComponentUserInfo getModifiedByUser() - { - return this.modifiedByUser; - } - - /** - * @return the isClosed - */ - public Boolean isClosed() - { - return this.isClosed; - } - - /** - * @param closed the isClosed to set - */ - public void setClosed(Boolean closed) - { - this.isClosed = closed; - } - - /** - * @return the isCompleted - */ - public Boolean isCompleted() - { - return this.isCompleted; - } - - /** - * @param completed the isCompleted to set - */ - public void setCompleted(Boolean completed) - { - this.isCompleted = completed; - } + @JsonProperty (value = RELATIVE_PATH) + private String relativePath; } diff --git a/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/model/fileplancomponents/FilePlanComponentPath.java b/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/model/fileplancomponents/FilePlanComponentPath.java index 5660d0e895..03f4ab7043 100644 --- a/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/model/fileplancomponents/FilePlanComponentPath.java +++ b/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/model/fileplancomponents/FilePlanComponentPath.java @@ -37,7 +37,7 @@ import lombok.NoArgsConstructor; /** * POJO for FilePlanComponent path parameter - *
+ * * @author Kristijan Conkas * @since 2.6 */ @@ -51,5 +51,4 @@ public class FilePlanComponentPath private String name; private Boolean isComplete; private List elements; - } diff --git a/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/model/fileplancomponents/FilePlanComponentProperties.java b/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/model/fileplancomponents/FilePlanComponentProperties.java index b95bf61720..bd3d20045e 100644 --- a/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/model/fileplancomponents/FilePlanComponentProperties.java +++ b/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/model/fileplancomponents/FilePlanComponentProperties.java @@ -67,7 +67,6 @@ import lombok.NoArgsConstructor; @AllArgsConstructor public class FilePlanComponentProperties { - @JsonProperty(PROPERTIES_VITAL_RECORD_INDICATOR) private Boolean vitalRecord; @@ -92,21 +91,19 @@ public class FilePlanComponentProperties @JsonProperty(value = PROPERTIES_IS_CLOSED, required = false) private Boolean isClosed; - + @JsonProperty(value = PROPERTIES_BOX, required = false) private String box; - + @JsonProperty(value = PROPERTIES_FILE, required = false) private String file; - + @JsonProperty(value = PROPERTIES_SHELF, required = false) private String shelf; - + @JsonProperty(value = PROPERTIES_NUMBER_OF_COPIES, required = false) private Integer numberOfCopies; - + @JsonProperty(value = PROPERTIES_PHYSICAL_SIZE, required = false) private Integer physicalSize; - - } diff --git a/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/model/fileplancomponents/FilePlanComponentType.java b/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/model/fileplancomponents/FilePlanComponentType.java index 4398087e56..4eb3a01dbe 100644 --- a/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/model/fileplancomponents/FilePlanComponentType.java +++ b/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/model/fileplancomponents/FilePlanComponentType.java @@ -26,66 +26,24 @@ */ package org.alfresco.rest.rm.community.model.fileplancomponents; -import static org.alfresco.rest.rm.community.util.ParameterCheck.mandatoryString; - /** - * File plan component type enumeration + * File plan component type * * @author Tuna Aksoy * @since 2.6 */ -public enum FilePlanComponentType +public class FilePlanComponentType { - FILE_PLAN_TYPE("rma:filePlan"), - RECORD_CATEGORY_TYPE("rma:recordCategory"), - RECORD_FOLDER_TYPE("rma:recordFolder"), - HOLD_TYPE("rma:hold"), - UNFILED_RECORD_FOLDER_TYPE("rma:unfiledRecordFolder"), - HOLD_CONTAINER_TYPE("rma:holdContainer"), - TRANSFER_TYPE("rma:transfer"), - TRANSFER_CONTAINER_TYPE("rma:transferContainer"), - UNFILED_CONTAINER_TYPE("rma:unfiledRecordContainer"), - FOLDER_TYPE("cm:folder"), - CONTENT_TYPE("cm:content"), - NON_ELECTRONIC_RECORD_TYPE("rma:nonElectronicDocument"); - - private String type; - - private FilePlanComponentType(String type) - { - this.type = type; - } - - public static final FilePlanComponentType getFilePlanComponentType(String type) - { - mandatoryString("type", type); - - FilePlanComponentType result = null; - FilePlanComponentType[] values = values(); - - for (FilePlanComponentType filePlanComponentType : values) - { - if (filePlanComponentType.toString().equals(filePlanComponentType)) - { - result = filePlanComponentType; - break; - } - } - - if (result == null) - { - throw new IllegalArgumentException("Invalid file plan component type enum value: '" + type + "'."); - } - - return result; - } - - /** - * @see java.lang.Enum#toString() - */ - @Override - public String toString() - { - return this.type; - } + public static final String FILE_PLAN_TYPE = "rma:filePlan"; + public static final String RECORD_CATEGORY_TYPE = "rma:recordCategory"; + public static final String RECORD_FOLDER_TYPE = "rma:recordFolder"; + public static final String HOLD_TYPE = "rma:hold"; + public static final String UNFILED_RECORD_FOLDER_TYPE = "rma:unfiledRecordFolder"; + public static final String HOLD_CONTAINER_TYPE = "rma:holdContainer"; + public static final String TRANSFER_TYPE = "rma:transfer"; + public static final String TRANSFER_CONTAINER_TYPE = "rma:transferContainer"; + public static final String UNFILED_CONTAINER_TYPE = "rma:unfiledRecordContainer"; + public static final String FOLDER_TYPE = "cm:folder"; + public static final String CONTENT_TYPE = "cm:content"; + public static final String NON_ELECTRONIC_RECORD_TYPE = "rma:nonElectronicDocument"; } diff --git a/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/model/fileplancomponents/FilePlanComponentUserInfo.java b/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/model/fileplancomponents/FilePlanComponentUserInfo.java index f2c7cf4a1b..f43a8e2ff2 100644 --- a/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/model/fileplancomponents/FilePlanComponentUserInfo.java +++ b/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/model/fileplancomponents/FilePlanComponentUserInfo.java @@ -45,5 +45,4 @@ public class FilePlanComponentUserInfo { private String id; private String displayName; - } diff --git a/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/model/site/RMSite.java b/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/model/site/RMSiteModel.java similarity index 90% rename from rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/model/site/RMSite.java rename to rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/model/site/RMSiteModel.java index 8added36da..20d8aa2a5f 100644 --- a/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/model/site/RMSite.java +++ b/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/model/site/RMSiteModel.java @@ -30,11 +30,13 @@ import static org.alfresco.rest.rm.community.model.site.RMSiteFields.COMPLIANCE; import com.fasterxml.jackson.annotation.JsonProperty; +import org.alfresco.rest.model.RestSiteModel; + import lombok.AllArgsConstructor; import lombok.Builder; import lombok.Data; +import lombok.EqualsAndHashCode; import lombok.NoArgsConstructor; -import org.alfresco.rest.model.RestSiteModel; /** * POJO for RM Site component @@ -44,11 +46,11 @@ import org.alfresco.rest.model.RestSiteModel; */ @Builder @Data +@EqualsAndHashCode(callSuper = true) @NoArgsConstructor @AllArgsConstructor -public class RMSite extends RestSiteModel +public class RMSiteModel extends RestSiteModel { - @JsonProperty (value = COMPLIANCE,required = true) + @JsonProperty (value = COMPLIANCE, required = true) private RMSiteCompliance compliance; - } diff --git a/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/requests/FilePlanComponentAPI.java b/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/requests/FilePlanComponentAPI.java deleted file mode 100644 index 39431a9cef..0000000000 --- a/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/requests/FilePlanComponentAPI.java +++ /dev/null @@ -1,275 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ -package org.alfresco.rest.rm.community.requests; - -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.util.ParameterCheck.mandatoryObject; -import static org.alfresco.rest.rm.community.util.ParameterCheck.mandatoryString; -import static org.alfresco.rest.rm.community.util.PojoUtility.toJson; -import static org.springframework.http.HttpMethod.DELETE; -import static org.springframework.http.HttpMethod.GET; -import static org.springframework.http.HttpMethod.POST; -import static org.springframework.http.HttpMethod.PUT; -import static org.testng.Assert.fail; - -import java.io.File; -import java.util.Iterator; - -import com.fasterxml.jackson.databind.JsonNode; -import com.fasterxml.jackson.databind.ObjectMapper; -import com.google.common.io.Resources; -import com.jayway.restassured.builder.RequestSpecBuilder; -import com.jayway.restassured.http.ContentType; -import com.jayway.restassured.response.Response; - -import org.alfresco.rest.core.RestAPI; -import org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponent; -import org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentType; -import org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentsCollection; -import org.alfresco.utility.model.UserModel; -import org.springframework.context.annotation.Scope; -import org.springframework.stereotype.Component; - -/** - * File plan component REST API Wrapper - * - * @author Tuna Aksoy - * @author Kristijan Conkas - * @since 2.6 - */ -@Component -@Scope(value = "prototype") -public class FilePlanComponentAPI extends RestAPI -{ - /** - * Get a file plan component - * - * @param filePlanComponentId The id of the file plan component to get - * @return The {@link FilePlanComponent} for the given file plan component id - * @throws Exception for the following cases: - *
    - *
  • {@code fileplanComponentId} is not a valid format
  • - *
  • authentication fails
  • - *
  • {@code fileplanComponentId} does not exist
  • - *
- */ - public FilePlanComponent getFilePlanComponent(String filePlanComponentId) throws Exception - { - mandatoryString("filePlanComponentId", filePlanComponentId); - - return usingRestWrapper().processModel(FilePlanComponent.class, simpleRequest( - GET, - "fileplan-components/{fileplanComponentId}?{parameters}", - filePlanComponentId, getParameters() - )); - } - - /** - * List child components of a file plan component - * - * @param filePlanComponentId The id of the file plan component of which to get child components - * @return The {@link FilePlanComponent} for the given file plan component id - * @throws Exception for the following cases: - *
    - *
  • {@code fileplanComponentId} is not a valid format
  • - *
  • authentication fails
  • - *
  • {@code fileplanComponentId} does not exist
  • - *
- */ - public FilePlanComponentsCollection listChildComponents(String filePlanComponentId) throws Exception - { - mandatoryString("filePlanComponentId", filePlanComponentId); - - return usingRestWrapper().processModels(FilePlanComponentsCollection.class, simpleRequest( - GET, - "fileplan-components/{fileplanComponentId}/children", - filePlanComponentId - )); - } - - /** - * Creates a file plan component with the given properties under the parent node with the given id - * - * @param filePlanComponentModel The properties of the file plan component to be created - * @param parentId The id of the parent where the new file plan component should be created - * @return The {@link FilePlanComponent} with the given properties - * @throws Exception for the following cases: - *
    - *
  • {@code fileplanComponentId} is not a valid format
  • - *
  • authentication fails
  • - *
  • current user does not have permission to add children to {@code fileplanComponentId}
  • - *
  • {@code fileplanComponentId} does not exist
  • - *
  • new name clashes with an existing node in the current parent container
  • - *
  • model integrity exception, including node name with invalid characters
  • - *
- */ - public FilePlanComponent createFilePlanComponent(FilePlanComponent filePlanComponentModel, String parentId) throws Exception - { - mandatoryObject("filePlanComponentProperties", filePlanComponentModel); - mandatoryString("parentId", parentId); - - return usingRestWrapper().processModel(FilePlanComponent.class, requestWithBody( - POST, - toJson(filePlanComponentModel), - "fileplan-components/{fileplanComponentId}/children?{parameters}", - parentId, - getParameters())); - } - - /** - * Create electronic record from file resource - * @param electronicRecordModel {@link FilePlanComponent} for electronic record to be created - * @param fileName the name of the resource file - * @param parentId parent container id - * @return newly created {@link FilePlanComponent} - * @throws Exception if operation failed - */ - public FilePlanComponent createElectronicRecord(FilePlanComponent electronicRecordModel, String fileName, String parentId) throws Exception - { - return createElectronicRecord(electronicRecordModel, new File(Resources.getResource(fileName).getFile()), parentId); - } - - /** - * Create electronic record from file resource - * @param electronicRecordModel {@link FilePlanComponent} for electronic record to be created - * @param recordContent {@link File} pointing to the content of the electronic record to be created - * @param parentId parent container id - * @return newly created {@link FilePlanComponent} - * @throws Exception if operation failed - */ - public FilePlanComponent createElectronicRecord(FilePlanComponent electronicRecordModel, File recordContent, String parentId) throws Exception - { - mandatoryObject("filePlanComponentProperties", electronicRecordModel); - mandatoryString("parentId", parentId); - if (!electronicRecordModel.getNodeType().equals(FilePlanComponentType.CONTENT_TYPE.toString())) - { - fail("Only electronic records are supported"); - } - - UserModel currentUser = usingRestWrapper().getTestUser(); - - /* - * For file uploads nodeBodyCreate is ignored hence can't be used. Append all FilePlanComponent fields - * to the request. - */ - RequestSpecBuilder builder = new RequestSpecBuilder(); - builder.setAuth(basic(currentUser.getUsername(), currentUser.getPassword())); - - ObjectMapper mapper = new ObjectMapper(); - JsonNode root = mapper.readTree(toJson(electronicRecordModel)); - - Iterator fieldNames = root.fieldNames(); - while (fieldNames.hasNext()) - { - String f = fieldNames.next(); - try - { - builder.addMultiPart(f, root.get(f).asText(), ContentType.JSON.name()); - } - catch (Exception error) - { - LOG.error("Failed to set " + f + " error: " + error); - } - } - - builder.addMultiPart("filedata", recordContent, ContentType.BINARY.name()); - - /* - * RestWrapper adds some headers which break multipart/form-data uploads and also assumes json POST requests. - * Upload the file using RestAssured library. - */ - Response response = given() - .spec(builder.build()) - .when() - .post("fileplan-components/{fileplanComponentId}/children?{parameters}", parentId, getParameters()) - .andReturn(); - usingRestWrapper().setStatusCode(Integer.toString(response.getStatusCode())); - LOG.info("electronic record created: " + response.getBody().prettyPrint()); - - /* return a FilePlanComponent object representing Response */ - return response.jsonPath().getObject("entry", FilePlanComponent.class); - } - - /** - * Updates a file plan component - * - * @param filePlanComponent The properties to be updated - * @param filePlanComponentId The id of the file plan component which will be updated - * @param returns The updated {@link FilePlanComponent} - * @throws Exception for the following cases: - *
    - *
  • the update request is invalid or {@code fileplanComponentId} is not a valid format or {@code filePlanComponentProperties} is invalid
  • - *
  • authentication fails
  • - *
  • current user does not have permission to update {@code fileplanComponentId}
  • - *
  • {@code fileplanComponentId} does not exist
  • - *
  • the updated name clashes with an existing node in the current parent folder
  • - *
  • model integrity exception, including node name with invalid characters
  • - *
- */ - public FilePlanComponent updateFilePlanComponent(FilePlanComponent filePlanComponent, String filePlanComponentId) throws Exception - { - mandatoryObject("filePlanComponentProperties", filePlanComponent); - mandatoryString("filePlanComponentId", filePlanComponentId); - - return usingRestWrapper().processModel(FilePlanComponent.class, requestWithBody( - PUT, - toJson(filePlanComponent), - "fileplan-components/{fileplanComponentId}?{parameters}", - filePlanComponentId, - getParameters() - )); - } - - /** - * Delete file plan component - * - * @param filePlanComponentId The id of the file plan component to be deleted - * @throws Exception for the following cases: - *
    - *
  • {@code fileplanComponentId} is not a valid format
  • - *
  • authentication fails
  • - *
  • current user does not have permission to delete {@code fileplanComponentId}
  • - *
  • {@code fileplanComponentId} does not exist
  • - *
  • {@code fileplanComponentId} is locked and cannot be deleted
  • - *
- */ - public void deleteFilePlanComponent(String filePlanComponentId) throws Exception - { - mandatoryString("filePlanComponentId", filePlanComponentId); - - usingRestWrapper().processEmptyModel(simpleRequest( - DELETE, - "fileplan-components/{fileplanComponentId}", - filePlanComponentId - )); - } - -} diff --git a/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/requests/FilePlanComponents.java b/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/requests/FilePlanComponents.java index 07aef4c24a..e5345c868f 100644 --- a/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/requests/FilePlanComponents.java +++ b/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/requests/FilePlanComponents.java @@ -4,28 +4,58 @@ * %% * Copyright (C) 2005 - 2016 Alfresco Software Limited * %% - * License rights for this program may be obtained from Alfresco Software, Ltd. - * pursuant to a written agreement and any use of this program without such an - * agreement is prohibited. + * This file is part of the Alfresco software. + * - + * If the software was purchased under a paid Alfresco license, the terms of + * the paid license agreement will prevail. Otherwise, the software is + * provided under the following open source license terms: + * - + * Alfresco is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * - + * Alfresco is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * - + * You should have received a copy of the GNU Lesser General Public License + * along with Alfresco. If not, see . * #L% */ package org.alfresco.rest.rm.community.requests; +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; import static org.alfresco.rest.rm.community.util.ParameterCheck.mandatoryObject; import static org.alfresco.rest.rm.community.util.ParameterCheck.mandatoryString; import static org.alfresco.rest.rm.community.util.PojoUtility.toJson; +import static org.apache.commons.lang3.StringUtils.EMPTY; import static org.springframework.http.HttpMethod.DELETE; import static org.springframework.http.HttpMethod.GET; import static org.springframework.http.HttpMethod.POST; import static org.springframework.http.HttpMethod.PUT; +import static org.testng.Assert.fail; -import org.alfresco.rest.core.RestWrapper; -import org.alfresco.rest.requests.ModelRequest; -import org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponent; +import java.io.File; +import java.util.Iterator; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.google.common.io.Resources; +import com.jayway.restassured.builder.RequestSpecBuilder; +import com.jayway.restassured.http.ContentType; +import com.jayway.restassured.response.Response; + +import org.alfresco.rest.core.RMRestWrapper; import org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentModel; import org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentsCollection; +import org.alfresco.utility.model.UserModel; /** * FIXME!!! @@ -33,24 +63,21 @@ import org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponent * @author Tuna Aksoy * @since 2.6 */ -public class FilePlanComponents extends ModelRequest +public class FilePlanComponents extends RMModelRequest { - private FilePlanComponentModel filePlanComponentModel; - /** * @param restWrapper */ - public FilePlanComponents(FilePlanComponentModel filePlanComponentModel, RestWrapper restWrapper) + public FilePlanComponents(RMRestWrapper rmRestWrapper) { - super(restWrapper); - this.filePlanComponentModel = filePlanComponentModel; + super(rmRestWrapper); } /** * Get a file plan component * * @param filePlanComponentId The id of the file plan component to get - * @return The {@link FilePlanComponent} for the given file plan component id + * @return The {@link FilePlanComponentModel} for the given file plan component id * @throws Exception for the following cases: *
    *
  • {@code fileplanComponentId} is not a valid format
  • @@ -58,21 +85,30 @@ public class FilePlanComponents extends ModelRequest *
  • {@code fileplanComponentId} does not exist
  • *
*/ - public FilePlanComponent getFilePlanComponent(String filePlanComponentId) throws Exception + public FilePlanComponentModel getFilePlanComponent(String filePlanComponentId) throws Exception { mandatoryString("filePlanComponentId", filePlanComponentId); - /* - return restWrapper.processModel(FilePlanComponent.class, simpleRequest( + return getFilePlanComponent(filePlanComponentId, EMPTY); + } + + /** + * FIXME!!! + * + * @param filePlanComponentId FIXME!!! + * @param parameters FIXME!!! + * @return FIXME!!! + * @throws Exception FIXME!!! + */ + public FilePlanComponentModel getFilePlanComponent(String filePlanComponentId, String parameters) throws Exception + { + mandatoryString("filePlanComponentId", filePlanComponentId); + + return getRMRestWrapper().processModel(FilePlanComponentModel.class, simpleRequest( GET, "fileplan-components/{fileplanComponentId}?{parameters}", - filePlanComponentId, getParameters() - */ - // FIXME!!! - return restWrapper.processModel(FilePlanComponent.class, simpleRequest( - GET, - "fileplan-components/{fileplanComponentId}", - filePlanComponentId + filePlanComponentId, + parameters )); } @@ -92,7 +128,7 @@ public class FilePlanComponents extends ModelRequest { mandatoryString("filePlanComponentId", filePlanComponentId); - return restWrapper.processModels(FilePlanComponentsCollection.class, simpleRequest( + return getRMRestWrapper().processModels(FilePlanComponentsCollection.class, simpleRequest( GET, "fileplan-components/{fileplanComponentId}/children", filePlanComponentId @@ -104,7 +140,7 @@ public class FilePlanComponents extends ModelRequest * * @param filePlanComponentModel The properties of the file plan component to be created * @param parentId The id of the parent where the new file plan component should be created - * @return The {@link FilePlanComponent} with the given properties + * @return The {@link FilePlanComponentModel} with the given properties * @throws Exception for the following cases: *
    *
  • {@code fileplanComponentId} is not a valid format
  • @@ -115,23 +151,107 @@ public class FilePlanComponents extends ModelRequest *
  • model integrity exception, including node name with invalid characters
  • *
*/ - public FilePlanComponent createFilePlanComponent(FilePlanComponent filePlanComponentModel, String parentId) throws Exception + public FilePlanComponentModel createFilePlanComponent(FilePlanComponentModel filePlanComponentModel, String parentId) throws Exception { mandatoryObject("filePlanComponentProperties", filePlanComponentModel); mandatoryString("parentId", parentId); - return restWrapper.processModel(FilePlanComponent.class, requestWithBody( + return createFilePlanComponent(filePlanComponentModel, parentId, EMPTY); + } + + /** + * FIXME!!! + * + * @param filePlanComponentModel FIXME!!! + * @param parentId FIXME!!! + * @param parameters FIXME!!! + * @return FIXME!!! + * @throws Exception FIXME!!! + */ + public FilePlanComponentModel createFilePlanComponent(FilePlanComponentModel filePlanComponentModel, String parentId, String parameters) throws Exception + { + mandatoryObject("filePlanComponentProperties", filePlanComponentModel); + mandatoryString("parentId", parentId); + + return getRMRestWrapper().processModel(FilePlanComponentModel.class, requestWithBody( POST, toJson(filePlanComponentModel), - "fileplan-components/{fileplanComponentId}/children", - parentId - )); + "fileplan-components/{fileplanComponentId}/children?{parameters}", + parentId, + parameters + )); + } + + /** + * Create electronic record from file resource + * @param electronicRecordModel {@link FilePlanComponent} for electronic record to be created + * @param fileName the name of the resource file + * @param parentId parent container id + * @return newly created {@link FilePlanComponent} + * @throws Exception if operation failed + */ + public FilePlanComponentModel createElectronicRecord(FilePlanComponentModel electronicRecordModel, String fileName, String parentId) throws Exception + { + return createElectronicRecord(electronicRecordModel, new File(Resources.getResource(fileName).getFile()), parentId); + } + + /** + * Create electronic record from file resource + * @param electronicRecordModel {@link FilePlanComponent} for electronic record to be created + * @param recordContent {@link File} pointing to the content of the electronic record to be created + * @param parentId parent container id + * @return newly created {@link FilePlanComponent} + * @throws Exception if operation failed + */ + public FilePlanComponentModel createElectronicRecord(FilePlanComponentModel electronicRecordModel, File recordContent, String parentId) throws Exception + { + mandatoryObject("filePlanComponentProperties", electronicRecordModel); + mandatoryString("parentId", parentId); + if (!electronicRecordModel.getNodeType().equals(CONTENT_TYPE)) + { + fail("Only electronic records are supported"); + } + + UserModel currentUser = getRMRestWrapper().getTestUser(); + + /* + * For file uploads nodeBodyCreate is ignored hence can't be used. Append all FilePlanComponent fields + * to the request. + */ + RequestSpecBuilder builder = new RequestSpecBuilder(); + builder.setAuth(basic(currentUser.getUsername(), currentUser.getPassword())); + + ObjectMapper mapper = new ObjectMapper(); + JsonNode root = mapper.readTree(toJson(electronicRecordModel)); + + Iterator fieldNames = root.fieldNames(); + while (fieldNames.hasNext()) + { + String fieldName = fieldNames.next(); + builder.addMultiPart(fieldName, root.get(fieldName).asText(), ContentType.JSON.name()); + } + + builder.addMultiPart("filedata", recordContent, ContentType.BINARY.name()); + + /* + * RestWrapper adds some headers which break multipart/form-data uploads and also assumes json POST requests. + * Upload the file using RestAssured library. + */ + Response response = given() + .spec(builder.build()) + .when() + .post("fileplan-components/{fileplanComponentId}/children?{parameters}", parentId, getRMRestWrapper().getParameters()) + .andReturn(); + getRMRestWrapper().setStatusCode(Integer.toString(response.getStatusCode())); + + /* return a FilePlanComponent object representing Response */ + return response.jsonPath().getObject("entry", FilePlanComponentModel.class); } /** * Updates a file plan component * - * @param filePlanComponent The properties to be updated + * @param filePlanComponentModel The properties to be updated * @param filePlanComponentId The id of the file plan component which will be updated * @param returns The updated {@link FilePlanComponent} * @throws Exception for the following cases: @@ -144,17 +264,26 @@ public class FilePlanComponents extends ModelRequest *
  • model integrity exception, including node name with invalid characters
  • * */ - public FilePlanComponent updateFilePlanComponent(FilePlanComponent filePlanComponent, String filePlanComponentId) throws Exception + public FilePlanComponentModel updateFilePlanComponent(FilePlanComponentModel filePlanComponentModel, String filePlanComponentId) throws Exception + { + mandatoryObject("filePlanComponentProperties", filePlanComponentModel); + mandatoryString("filePlanComponentId", filePlanComponentId); + + return updateFilePlanComponent(filePlanComponentModel, filePlanComponentId, EMPTY); + } + + public FilePlanComponentModel updateFilePlanComponent(FilePlanComponentModel filePlanComponent, String filePlanComponentId, String parameters) throws Exception { mandatoryObject("filePlanComponentProperties", filePlanComponent); mandatoryString("filePlanComponentId", filePlanComponentId); - return restWrapper.processModel(FilePlanComponent.class, requestWithBody( + return getRMRestWrapper().processModel(FilePlanComponentModel.class, requestWithBody( PUT, toJson(filePlanComponent), - "fileplan-components/{fileplanComponentId}", - filePlanComponentId - )); + "fileplan-components/{fileplanComponentId}?{parameters}", + filePlanComponentId, + parameters + )); } /** @@ -174,7 +303,7 @@ public class FilePlanComponents extends ModelRequest { mandatoryString("filePlanComponentId", filePlanComponentId); - restWrapper.processEmptyModel(simpleRequest( + getRMRestWrapper().processEmptyModel(simpleRequest( DELETE, "fileplan-components/{fileplanComponentId}", filePlanComponentId diff --git a/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/requests/RMModelRequest.java b/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/requests/RMModelRequest.java new file mode 100644 index 0000000000..6edebd710a --- /dev/null +++ b/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/requests/RMModelRequest.java @@ -0,0 +1,57 @@ +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 Alfresco Software Limited + * %% + * This file is part of the Alfresco software. + * - + * If the software was purchased under a paid Alfresco license, the terms of + * the paid license agreement will prevail. Otherwise, the software is + * provided under the following open source license terms: + * - + * Alfresco is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * - + * Alfresco is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * - + * You should have received a copy of the GNU Lesser General Public License + * along with Alfresco. If not, see . + * #L% + */ +package org.alfresco.rest.rm.community.requests; + +import org.alfresco.rest.core.RMRestWrapper; +import org.alfresco.rest.requests.ModelRequest; + +/** + * FIXME!!! + * + * @author Tuna Aksoy + * @since 2.6 + */ +public abstract class RMModelRequest extends ModelRequest +{ + private RMRestWrapper rmRestWrapper; + + /** + * @return the rmRestWrapper + */ + protected RMRestWrapper getRMRestWrapper() + { + return this.rmRestWrapper; + } + + /** + * @param restWrapper + */ + public RMModelRequest(RMRestWrapper rmRestWrapper) + { + super(rmRestWrapper); + } +} diff --git a/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/requests/RMSiteAPI.java b/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/requests/RMSite.java similarity index 76% rename from rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/requests/RMSiteAPI.java rename to rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/requests/RMSite.java index 57c7745cbc..3cb203261f 100644 --- a/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/requests/RMSiteAPI.java +++ b/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/requests/RMSite.java @@ -36,31 +36,35 @@ import static org.springframework.http.HttpMethod.POST; import static org.springframework.http.HttpMethod.PUT; import static org.springframework.http.HttpStatus.OK; -import org.alfresco.rest.core.RestAPI; -import org.alfresco.rest.rm.community.model.site.RMSite; +import org.alfresco.rest.core.RMRestWrapper; +import org.alfresco.rest.rm.community.model.site.RMSiteModel; import org.alfresco.utility.data.DataUser; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.context.annotation.Scope; -import org.springframework.stereotype.Component; /** - * File plan component REST API Wrapper + * FIXME!!! * * @author Tuna Aksoy - * @author Rodica Sutu * @since 2.6 */ -@Component -@Scope (value = "prototype") -public class RMSiteAPI extends RestAPI +public class RMSite extends RMModelRequest { + // FIXME!!! @Autowired private DataUser dataUser; + /** + * @param restWrapper + */ + public RMSite(RMRestWrapper rmRestWrapper) + { + super(rmRestWrapper); + } + /** * Get the RM site * - * @return The {@link RMSite} for the given file plan component id + * @return The {@link RMSiteModel} for the given file plan component id * @throws Exception for the following cases: *
      *
    • Api Response code 400 Invalid parameter: GET request is supported only for the RM site
    • @@ -69,9 +73,9 @@ public class RMSiteAPI extends RestAPI *
    • Api Response code default Unexpected error
    • *
    */ - public RMSite getSite() throws Exception + public RMSiteModel getSite() throws Exception { - return usingRestWrapper().processModel(RMSite.class, simpleRequest( + return getRMRestWrapper().processModel(RMSiteModel.class, simpleRequest( GET, "ig-sites/rm" )); @@ -81,7 +85,7 @@ public class RMSiteAPI extends RestAPI * Create the RM site * * @param rmSite The properties of the rm site to be created - * @return The {@link RMSite} with the given properties + * @return The {@link RMSiteModel} with the given properties * @throws Exception for the following cases: *
      *
    • Api Response code 400 Invalid parameter: title, or description exceed the maximum length; or siteBodyCreate invalid
    • @@ -90,13 +94,13 @@ public class RMSiteAPI extends RestAPI *
    • Api Response code default Unexpected error
    • *
    */ - public RMSite createRMSite(RMSite rmSite) throws Exception + public RMSiteModel createRMSite(RMSiteModel rmSiteModel) throws Exception { - mandatoryObject("rmSiteProperties", rmSite); + mandatoryObject("rmSiteModel", rmSiteModel); - return usingRestWrapper().processModel(RMSite.class, requestWithBody( + return getRMRestWrapper().processModel(RMSiteModel.class, requestWithBody( POST, - toJson(rmSite), + toJson(rmSiteModel), "ig-sites" )); } @@ -114,7 +118,7 @@ public class RMSiteAPI extends RestAPI */ public void deleteRMSite() throws Exception { - usingRestWrapper().processEmptyModel(simpleRequest( + getRMRestWrapper().processEmptyModel(simpleRequest( DELETE, "ig-sites/rm" )); @@ -124,23 +128,23 @@ public class RMSiteAPI extends RestAPI * Update RM site * * @param rmSiteProperties The properties to be updated - * @return The updated {@link RMSite} + * @return The updated {@link RMSiteModel} * @throws Exception for the following cases: *
      - *
    • Api Response code 400 the update request is invalid {@code rmSiteProperties} is invalid
    • + *
    • Api Response code 400 the update request is invalid {@code rmSiteModel} is invalid
    • *
    • Api Response code 401 If authentication fails
    • *
    • Api Response code 403 does not have permission to update {@code RMSite}
    • - *
    • Api Response code 404 {@code RMSite} does not exist
    • + *
    • Api Response code 404 {@code RMSiteModel} does not exist
    • *
    • Api Response code default Unexpected error,model integrity exception
    • *
    */ - public RMSite updateRMSite(RMSite rmSiteProperties) throws Exception + public RMSiteModel updateRMSite(RMSiteModel rmSiteModel) throws Exception { - mandatoryObject("rmSiteProperties", rmSiteProperties); + mandatoryObject("rmSiteProperties", rmSiteModel); - return usingRestWrapper().processModel(RMSite.class, requestWithBody( + return getRMRestWrapper().processModel(RMSiteModel.class, requestWithBody( PUT, - toJson(rmSiteProperties), + toJson(rmSiteModel), "ig-sites/rm" )); } @@ -159,8 +163,8 @@ public class RMSiteAPI extends RestAPI */ public boolean existsRMSite() throws Exception { - usingRestWrapper().authenticateUser(dataUser.getAdminUser()); + getRMRestWrapper().authenticateUser(dataUser.getAdminUser()); getSite(); - return usingRestWrapper().getStatusCode().equals(OK.toString()); + return getRMRestWrapper().getStatusCode().equals(OK.toString()); } } diff --git a/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/requests/RMUserAPI.java b/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/requests/RMUserAPI.java index ec5e0e6d9a..07ac74f0c1 100644 --- a/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/requests/RMUserAPI.java +++ b/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/requests/RMUserAPI.java @@ -42,12 +42,12 @@ import org.springframework.stereotype.Component; /** * RM user management API - * + * * @author Kristijan Conkas * @since 2.6 */ -// FIXME: As of December 2016 there is no v1-style API for managing RM users and users' -// roles. Until such APIs have become available, methods in this class are just proxies to +// FIXME: As of December 2016 there is no v1-style API for managing RM users and users' +// roles. Until such APIs have become available, methods in this class are just proxies to // "old-style" API calls. @Component @Scope (value = "prototype") @@ -55,21 +55,21 @@ public class RMUserAPI extends RestAPI { @Autowired private DataUser dataUser; - + @Autowired private AlfrescoHttpClientFactory alfrescoHttpClientFactory; - + public void assignRoleToUser(String userName, String userRole) throws Exception { // get an "old-style" REST API client AlfrescoHttpClient client = alfrescoHttpClientFactory.getObject(); - + // override v1 baseURI and basePath RequestSpecification spec = new RequestSpecBuilder() .setBaseUri(client.getApiUrl()) .setBasePath("/") .build(); - + Response response = given() .spec(spec) .log().all() diff --git a/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/requests/igCoreAPI/RestIGCoreAPI.java b/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/requests/igCoreAPI/RestIGCoreAPI.java index cfd62126f6..8a31dce555 100644 --- a/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/requests/igCoreAPI/RestIGCoreAPI.java +++ b/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/requests/igCoreAPI/RestIGCoreAPI.java @@ -4,42 +4,83 @@ * %% * Copyright (C) 2005 - 2016 Alfresco Software Limited * %% - * License rights for this program may be obtained from Alfresco Software, Ltd. - * pursuant to a written agreement and any use of this program without such an - * agreement is prohibited. + * This file is part of the Alfresco software. + * - + * If the software was purchased under a paid Alfresco license, the terms of + * the paid license agreement will prevail. Otherwise, the software is + * provided under the following open source license terms: + * - + * Alfresco is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * - + * Alfresco is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * - + * You should have received a copy of the GNU Lesser General Public License + * along with Alfresco. If not, see . * #L% */ package org.alfresco.rest.rm.community.requests.igCoreAPI; +import static java.lang.Integer.parseInt; +import static java.lang.String.format; + import com.jayway.restassured.RestAssured; -import org.alfresco.rest.core.ExtendedRestProperties; -import org.alfresco.rest.core.RestWrapper; -import org.alfresco.rest.requests.ModelRequest; +import org.alfresco.rest.core.RMRestProperties; +import org.alfresco.rest.core.RMRestWrapper; +import org.alfresco.rest.rm.community.requests.FilePlanComponents; +import org.alfresco.rest.rm.community.requests.RMModelRequest; +import org.alfresco.rest.rm.community.requests.RMSite; /** - * FIXME!!! + * Defines the entire IG Core API + * {@link http://host:port/ig-api-explorer} select "IG Core API" * * @author Tuna Aksoy * @since 2.6 */ -public class RestIGCoreAPI extends ModelRequest +public class RestIGCoreAPI extends RMModelRequest { - private ExtendedRestProperties extendedRestProperties; + @SuppressWarnings("unused") + private RMRestProperties rmRestProperties; /** * FIXME!!! * - * @param restWrapper FIXME!!! - * @param restProperties FIXME!!! + * @param rmRestWrapper FIXME!!! + * @param rmRestProperties FIXME!!! */ - public RestIGCoreAPI(RestWrapper restWrapper, ExtendedRestProperties extendedRestProperties) + public RestIGCoreAPI(RMRestWrapper rmRestWrapper, RMRestProperties rmRestProperties) { - super(restWrapper); - this.extendedRestProperties = extendedRestProperties; - // FIXME - RestAssured.baseURI = extendedRestProperties.envProperty().getTestServerUrl(); - RestAssured.port = extendedRestProperties.envProperty().getPort(); - RestAssured.basePath = extendedRestProperties.getRestWorkflowPath(); + super(rmRestWrapper); + this.rmRestProperties = rmRestProperties; + RestAssured.baseURI = format("%s://%s", rmRestProperties.getScheme(), rmRestProperties.getServer()); + RestAssured.port = parseInt(rmRestProperties.getPort()); + RestAssured.basePath = rmRestProperties.getRestRmPath(); + } + + /** + * Provides DSL on all REST calls under ig-sites/rm/... API path + * + * @return {@link RMSite} + */ + public RMSite usingRMSite() + { + return new RMSite(getRMRestWrapper()); + } + + /** + * FIXME!!! + * + * @return FIXME!!! + */ + public FilePlanComponents usingFilePlanComponents() + { + return new FilePlanComponents(getRMRestWrapper()); } } 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 7ecb945d9c..23afe5905e 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 @@ -57,7 +57,6 @@ public class PojoUtility { //return the json object return mapper.writerWithDefaultPrettyPrinter().writeValueAsString(model); - } catch (JsonGenerationException e) { diff --git a/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/util/ReviewPeriodSerializer.java b/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/util/ReviewPeriodSerializer.java index 97c8847dcf..ab2ce28bbd 100644 --- a/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/util/ReviewPeriodSerializer.java +++ b/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/util/ReviewPeriodSerializer.java @@ -35,7 +35,6 @@ import com.fasterxml.jackson.databind.SerializerProvider; import org.alfresco.rest.rm.community.model.fileplancomponents.ReviewPeriod; - /** * Utility class for serializing the Review Period type * @@ -44,7 +43,6 @@ import org.alfresco.rest.rm.community.model.fileplancomponents.ReviewPeriod; */ public class ReviewPeriodSerializer extends JsonSerializer { - /** * @param value The Review Period value that is being serialized. * @param gen Jackson utility is responsible for writing JSON @@ -57,8 +55,5 @@ public class ReviewPeriodSerializer extends JsonSerializer { //create the custom string value for the Review Period type gen.writeString(new StringBuilder().append(value.getPeriodType()).append("|").append(value.getExpression()).toString()); - } } - - diff --git a/rm-automation/rm-automation-community-rest-api/src/test/resources/config.properties b/rm-automation/rm-automation-community-rest-api/src/main/resources/config.properties similarity index 100% rename from rm-automation/rm-automation-community-rest-api/src/test/resources/config.properties rename to rm-automation/rm-automation-community-rest-api/src/main/resources/config.properties diff --git a/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/base/BaseRestTest.java b/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/base/BaseRestTest.java index cb478cf65f..bd08761bb6 100644 --- a/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/base/BaseRestTest.java +++ b/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/base/BaseRestTest.java @@ -26,8 +26,6 @@ */ package org.alfresco.rest.rm.community.base; -import static java.lang.Integer.parseInt; - import static com.jayway.restassured.RestAssured.given; import static org.alfresco.rest.rm.community.base.TestData.CATEGORY_TITLE; @@ -44,7 +42,6 @@ import static org.springframework.http.HttpStatus.CREATED; import static org.springframework.http.HttpStatus.OK; import com.google.gson.JsonObject; -import com.jayway.restassured.RestAssured; import com.jayway.restassured.builder.RequestSpecBuilder; import com.jayway.restassured.http.ContentType; import com.jayway.restassured.response.Response; @@ -53,19 +50,17 @@ import com.jayway.restassured.specification.RequestSpecification; import org.alfresco.dataprep.AlfrescoHttpClient; import org.alfresco.dataprep.AlfrescoHttpClientFactory; import org.alfresco.rest.RestTest; -import org.alfresco.rest.core.RestWrapper; -import org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponent; +import org.alfresco.rest.core.RMRestWrapper; +import org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentModel; import org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentProperties; -import org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentType; -import org.alfresco.rest.rm.community.model.site.RMSite; -import org.alfresco.rest.rm.community.requests.FilePlanComponentAPI; -import org.alfresco.rest.rm.community.requests.RMSiteAPI; +import org.alfresco.rest.rm.community.model.site.RMSiteModel; +import org.alfresco.rest.rm.community.model.user.UserPermissions; +import org.alfresco.rest.rm.community.requests.FilePlanComponents; +import org.alfresco.rest.rm.community.requests.RMSite; import org.alfresco.utility.data.DataUser; import org.alfresco.utility.model.UserModel; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.beans.factory.annotation.Value; -import org.springframework.context.annotation.Configuration; -import org.springframework.context.annotation.PropertySource; +import org.springframework.http.HttpStatus; import org.testng.annotations.BeforeClass; import org.testng.annotations.DataProvider; @@ -76,39 +71,49 @@ import org.testng.annotations.DataProvider; * @author Tuna Aksoy * @since 2.6 */ -@Configuration -@PropertySource(value = {"classpath:default.properties", "classpath:config.properties"}) -@PropertySource(value = "classpath:module.properties", ignoreResourceNotFound = true) -@PropertySource(value = "classpath:local.properties", ignoreResourceNotFound = true) public class BaseRestTest extends RestTest { - @Value ("${alfresco.scheme}") - private String scheme; - - @Value ("${alfresco.server}") - private String server; - - @Value ("${alfresco.port}") - private String port; - - @Value ("${rest.rmPath}") - private String restRmPath; - - @Value ("${rest.basePath}") - private String restCorePath; - @Autowired - private RMSiteAPI rmSiteAPI; - + private RMRestWrapper rmRestWrapper; + @Autowired private DataUser dataUser; - @Autowired - public FilePlanComponentAPI filePlanComponentAPI; - @Autowired private AlfrescoHttpClientFactory alfrescoHttpClientFactory; - + + private RMSite rmSite; + + private FilePlanComponents filePlanComponents; + + protected RMSite getRMSiteAPI() + { + if (rmSite == null) + { + rmSite = getRmRestWrapper().withIGCoreAPI().usingRMSite(); + } + + return rmSite; + } + + protected FilePlanComponents getFilePlanComponentsAPI() + { + if (filePlanComponents == null) + { + filePlanComponents = getRmRestWrapper().withIGCoreAPI().usingFilePlanComponents(); + } + + return filePlanComponents; + } + + /** + * @return the rmRestWrapper + */ + protected RMRestWrapper getRmRestWrapper() + { + return this.rmRestWrapper; + } + // Constants public static final String RM_ID = "rm"; public static final String RM_TITLE = "Records Management"; @@ -116,14 +121,16 @@ public class BaseRestTest extends RestTest /** Valid root containers where electronic and non-electronic records can be created */ @DataProvider(name = "validRootContainers") - public Object[][] getValidRootContainers() throws Exception { - return new Object[][] { + public Object[][] getValidRootContainers() throws Exception + { + return new Object[][] + { // an arbitrary record folder - { createCategoryFolderInFilePlan(dataUser.getAdminUser(), FILE_PLAN_ALIAS.toString()) }, + { createCategoryFolderInFilePlan(dataUser.getAdminUser(), FILE_PLAN_ALIAS) }, // unfiled records root - { getFilePlanComponentAsUser(dataUser.getAdminUser(), UNFILED_RECORDS_CONTAINER_ALIAS.toString()) }, + { getFilePlanComponentAsUser(dataUser.getAdminUser(), UNFILED_RECORDS_CONTAINER_ALIAS) }, // an arbitrary unfiled records folder - { createUnfiledRecordsFolder(UNFILED_RECORDS_CONTAINER_ALIAS.toString(), "Unfiled Folder " + getRandomAlphanumeric()) } + { createUnfiledRecordsFolder(UNFILED_RECORDS_CONTAINER_ALIAS, "Unfiled Folder " + getRandomAlphanumeric()) } }; } @@ -134,14 +141,30 @@ public class BaseRestTest extends RestTest @BeforeClass (alwaysRun = true) public void checkServerHealth() throws Exception { - RestAssured.baseURI = scheme + "://" + server; - RestAssured.port = parseInt(port); - RestAssured.basePath = restRmPath; - // Create RM Site if not exist createRMSiteIfNotExists(); } + /** + * FIXME!!! + * + * @param userModel FIXME!!! + */ + protected void authenticateUser(UserModel userModel) + { + getRmRestWrapper().authenticateUser(userModel); + } + + protected void assertStatusCodeIs(HttpStatus httpStatus) + { + getRmRestWrapper().assertStatusCodeIs(httpStatus); + } + + protected void disconnect() + { + getRmRestWrapper().disconnect(); + } + /** * Helper method to create the RM Site via the POST request * if the site doesn't exist @@ -149,18 +172,18 @@ public class BaseRestTest extends RestTest public void createRMSiteIfNotExists() throws Exception { // Check RM site doesn't exist - if (!rmSiteAPI.existsRMSite()) + if (!rmSite.existsRMSite()) { - rmSiteAPI.usingRestWrapper().authenticateUser(dataUser.getAdminUser()); + authenticateUser(dataUser.getAdminUser()); // Create the RM site - RMSite rmSite = RMSite.builder().compliance(STANDARD).build(); - rmSite.setTitle(RM_TITLE); - rmSite.setDescription(RM_DESCRIPTION); - rmSiteAPI.createRMSite(rmSite); + RMSiteModel rmSiteModel = RMSiteModel.builder().compliance(STANDARD).build(); + rmSiteModel.setTitle(RM_TITLE); + rmSiteModel.setDescription(RM_DESCRIPTION); + rmSite.createRMSite(rmSiteModel); // Verify the status code - rmSiteAPI.usingRestWrapper().assertStatusCodeIs(CREATED); + assertStatusCodeIs(CREATED); } } @@ -172,7 +195,7 @@ public class BaseRestTest extends RestTest * @return The created category * @throws Exception on unsuccessful component creation */ - public FilePlanComponent createCategory(String parentCategoryId, String categoryName) throws Exception + public FilePlanComponentModel createCategory(String parentCategoryId, String categoryName) throws Exception { return createComponent(parentCategoryId, categoryName, RECORD_CATEGORY_TYPE, CATEGORY_TITLE); } @@ -185,7 +208,7 @@ public class BaseRestTest extends RestTest * @return The created category * @throws Exception on unsuccessful component creation */ - public FilePlanComponent createFolder(String parentCategoryId, String folderName) throws Exception + public FilePlanComponentModel createFolder(String parentCategoryId, String folderName) throws Exception { return createComponent(parentCategoryId, folderName, RECORD_FOLDER_TYPE, FOLDER_TITLE); } @@ -198,7 +221,7 @@ public class BaseRestTest extends RestTest * @return The created folder * @throws Exception on unsuccessful component creation */ - public FilePlanComponent createUnfiledRecordsFolder(String parentId, String folderName) throws Exception + public FilePlanComponentModel createUnfiledRecordsFolder(String parentId, String folderName) throws Exception { return createComponent(parentId, folderName, UNFILED_RECORD_FOLDER_TYPE, FOLDER_TITLE); } @@ -213,20 +236,21 @@ public class BaseRestTest extends RestTest * @return The created file plan component * @throws Exception */ - private FilePlanComponent createComponent(String parentComponentId, String componentName, FilePlanComponentType componentType, String componentTitle) throws Exception + private FilePlanComponentModel createComponent(String parentComponentId, String componentName, String componentType, String componentTitle) throws Exception { - RestWrapper restWrapper = filePlanComponentAPI.usingRestWrapper().authenticateUser(dataUser.getAdminUser()); + authenticateUser(dataUser.getAdminUser()); - FilePlanComponent filePlanComponent = FilePlanComponent.builder() + FilePlanComponentModel filePlanComponent = FilePlanComponentModel.builder() .name(componentName) - .nodeType(componentType.toString()) + .nodeType(componentType) .properties(FilePlanComponentProperties.builder() .title(componentTitle) .build()) .build(); - FilePlanComponent fpc = filePlanComponentAPI.createFilePlanComponent(filePlanComponent, parentComponentId); - restWrapper.assertStatusCodeIs(CREATED); + FilePlanComponentModel fpc = getFilePlanComponentsAPI().createFilePlanComponent(filePlanComponent, parentComponentId); + assertStatusCodeIs(CREATED); + return fpc; } @@ -236,21 +260,21 @@ public class BaseRestTest extends RestTest * @return * @throws Exception */ - public FilePlanComponent closeFolder(String folderId) throws Exception + public FilePlanComponentModel closeFolder(String folderId) throws Exception { - RestWrapper restWrapper = filePlanComponentAPI.usingRestWrapper().authenticateUser(dataUser.getAdminUser()); - + authenticateUser(dataUser.getAdminUser()); + // build fileplan component + properties for update request FilePlanComponentProperties properties = new FilePlanComponentProperties(); properties.setIsClosed(true); - FilePlanComponent filePlanComponent = new FilePlanComponent(); + FilePlanComponentModel filePlanComponent = new FilePlanComponentModel(); filePlanComponent.setProperties(properties); - - FilePlanComponent updatedComponent = filePlanComponentAPI.updateFilePlanComponent(filePlanComponent, folderId); - restWrapper.assertStatusCodeIs(OK); + + FilePlanComponentModel updatedComponent = getFilePlanComponentsAPI().updateFilePlanComponent(filePlanComponent, folderId); + assertStatusCodeIs(OK); return updatedComponent; } - + /** * Helper method to create a randomly-named / structure in fileplan * @param user user under whose privileges this structure is going to be created @@ -258,17 +282,17 @@ public class BaseRestTest extends RestTest * @return record folder * @throws Exception on failed creation */ - public FilePlanComponent createCategoryFolderInFilePlan(UserModel user, String parentId) throws Exception + public FilePlanComponentModel createCategoryFolderInFilePlan(UserModel user, String parentId) throws Exception { - filePlanComponentAPI.usingRestWrapper().authenticateUser(user); - + authenticateUser(user); + // create root category - FilePlanComponent recordCategory = createCategory(parentId, "Category " + getRandomAlphanumeric()); - + FilePlanComponentModel recordCategory = createCategory(parentId, "Category " + getRandomAlphanumeric()); + // and return a folder underneath return createFolder(recordCategory.getId(), "Folder " + getRandomAlphanumeric()); } - + /** * Helper method to retieve a fileplan component with user's privilege * @param user user under whose privileges a component is to be read @@ -276,12 +300,12 @@ public class BaseRestTest extends RestTest * @return {@link FilePlanComponent} for given componentId * @throws Exception if user doesn't have sufficient privileges */ - public FilePlanComponent getFilePlanComponentAsUser(UserModel user, String componentId) throws Exception + public FilePlanComponentModel getFilePlanComponentAsUser(UserModel user, String componentId) throws Exception { - filePlanComponentAPI.usingRestWrapper().authenticateUser(user); - return filePlanComponentAPI.getFilePlanComponent(componentId); + authenticateUser(user); + return getFilePlanComponentsAPI().getFilePlanComponent(componentId); } - + /** * Helper method to add permission on a component to user * @param component {@link FilePlanComponent} on which permission should be given @@ -291,11 +315,11 @@ public class BaseRestTest extends RestTest // FIXME: As of December 2016 there is no v1-style API for managing RM permissions. // Until such APIs have become available, this method is just a proxy to an "old-style" // API call. - public void addUserPermission(FilePlanComponent component, UserModel user, String permission) + public void addUserPermission(FilePlanComponentModel component, UserModel user, String permission) { // get an "old-style" REST API client AlfrescoHttpClient client = alfrescoHttpClientFactory.getObject(); - + JsonObject bodyJson = buildObject() .addArray("permissions") .addObject() @@ -309,7 +333,7 @@ public class BaseRestTest extends RestTest .setBaseUri(client.getApiUrl()) .setBasePath("/") .build(); - + // execute an "old-style" API call Response response = given() .spec(spec) @@ -322,6 +346,6 @@ public class BaseRestTest extends RestTest .post("/node/workspace/SpacesStore/{nodeId}/rmpermissions") .prettyPeek() .andReturn(); - filePlanComponentAPI.usingRestWrapper().setStatusCode(Integer.toString(response.getStatusCode())); + rmRestWrapper.setStatusCode(Integer.toString(response.getStatusCode())); } } \ No newline at end of file diff --git a/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/base/TestData.java b/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/base/TestData.java index ee890dfab9..5727a6e416 100644 --- a/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/base/TestData.java +++ b/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/base/TestData.java @@ -50,7 +50,7 @@ import org.testng.annotations.DataProvider; * @since 2.6 */ public interface TestData -{ +{ /** * A user with ALFRESCO_ADMINISTRATORS role. *

    "GROUP_ANOTHER_ADMIN_EXISTS" The ANOTHER_ADMIN user has been created. @@ -75,10 +75,10 @@ public interface TestData public static Object[][] getContainers() { return new Object[][] { - { FILE_PLAN_ALIAS.toString() }, - { TRANSFERS_ALIAS.toString() }, - { HOLDS_ALIAS.toString() }, - { UNFILED_RECORDS_CONTAINER_ALIAS.toString() }, + { FILE_PLAN_ALIAS }, + { TRANSFERS_ALIAS }, + { HOLDS_ALIAS }, + { UNFILED_RECORDS_CONTAINER_ALIAS }, }; } @@ -130,15 +130,15 @@ public interface TestData public static Object[][] childrenNotAllowedForCategory() { return new Object[][] { - { FILE_PLAN_TYPE.toString() }, - { TRANSFER_CONTAINER_TYPE.toString() }, - { HOLD_CONTAINER_TYPE.toString() }, - { UNFILED_CONTAINER_TYPE.toString() }, - { UNFILED_RECORD_FOLDER_TYPE.toString()}, - { HOLD_TYPE.toString()}, - { TRANSFER_TYPE.toString()}, - { FOLDER_TYPE.toString()}, - { CONTENT_TYPE.toString()} + { FILE_PLAN_TYPE }, + { TRANSFER_CONTAINER_TYPE }, + { HOLD_CONTAINER_TYPE }, + { UNFILED_CONTAINER_TYPE }, + { UNFILED_RECORD_FOLDER_TYPE }, + { HOLD_TYPE }, + { TRANSFER_TYPE }, + { FOLDER_TYPE }, + { CONTENT_TYPE } }; } } diff --git a/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/fileplancomponents/DeleteRecordTests.java b/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/fileplancomponents/DeleteRecordTests.java index 056a465611..dd1e11b40d 100644 --- a/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/fileplancomponents/DeleteRecordTests.java +++ b/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/fileplancomponents/DeleteRecordTests.java @@ -38,11 +38,9 @@ import static org.springframework.http.HttpStatus.NO_CONTENT; import static org.springframework.http.HttpStatus.OK; import org.alfresco.rest.rm.community.base.BaseRestTest; -import org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponent; +import org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentModel; import org.alfresco.rest.rm.community.model.user.UserPermissions; import org.alfresco.rest.rm.community.model.user.UserRoles; -import org.alfresco.rest.rm.community.requests.FilePlanComponentAPI; -import org.alfresco.rest.rm.community.requests.RMSiteAPI; import org.alfresco.rest.rm.community.requests.RMUserAPI; import org.alfresco.test.AlfrescoTest; import org.alfresco.utility.constants.UserRole; @@ -64,16 +62,10 @@ import org.testng.annotations.Test; public class DeleteRecordTests extends BaseRestTest { @Autowired - private FilePlanComponentAPI filePlanComponentAPI; + private RMUserAPI rmUserAPI; - @Autowired - private RMUserAPI rmUserAPI; - @Autowired private DataUser dataUser; - - @Autowired - private RMSiteAPI rmSiteAPI; /** image resource file to be used for records body */ private static final String IMAGE_FILE = "money.JPG"; @@ -86,7 +78,7 @@ public class DeleteRecordTests extends BaseRestTest * When I delete the record * Then it is deleted from the file plan * - * + * * @param container * @throws Exception */ @@ -96,21 +88,21 @@ public class DeleteRecordTests extends BaseRestTest description = "Admin user can delete an electronic record" ) @AlfrescoTest(jira="RM-4363") - public void adminCanDeleteElectronicRecord(FilePlanComponent container) throws Exception + public void adminCanDeleteElectronicRecord(FilePlanComponentModel container) throws Exception { - filePlanComponentAPI.usingRestWrapper().authenticateUser(dataUser.getAdminUser()); + authenticateUser(dataUser.getAdminUser()); // create an electronic record - FilePlanComponent record = FilePlanComponent.builder() + FilePlanComponentModel record = FilePlanComponentModel.builder() .name("Record " + getRandomAlphanumeric()) - .nodeType(CONTENT_TYPE.toString()) + .nodeType(CONTENT_TYPE) .build(); - FilePlanComponent newRecord = filePlanComponentAPI.createElectronicRecord(record, IMAGE_FILE, container.getId()); - filePlanComponentAPI.usingRestWrapper().assertStatusCodeIs(CREATED); + FilePlanComponentModel newRecord = getFilePlanComponentsAPI().createElectronicRecord(record, IMAGE_FILE, container.getId()); + assertStatusCodeIs(CREATED); deleteAndVerify(newRecord); } - + /** *

          * Given a record
    @@ -119,7 +111,7 @@ public class DeleteRecordTests extends BaseRestTest
          * When I delete the record
          * Then it is deleted from the file plan
          * 
    - * + * * @param container * @throws Exception */ @@ -129,23 +121,23 @@ public class DeleteRecordTests extends BaseRestTest description = "Admin user can delete a non-electronic record" ) @AlfrescoTest(jira="RM-4363") - public void adminCanDeleteNonElectronicRecord(FilePlanComponent container) throws Exception + public void adminCanDeleteNonElectronicRecord(FilePlanComponentModel container) throws Exception { - filePlanComponentAPI.usingRestWrapper().authenticateUser(dataUser.getAdminUser()); + authenticateUser(dataUser.getAdminUser()); // create a non-electronic record - FilePlanComponent record = FilePlanComponent.builder() + FilePlanComponentModel record = FilePlanComponentModel.builder() .name("Record " + getRandomAlphanumeric()) - .nodeType(NON_ELECTRONIC_RECORD_TYPE.toString()) + .nodeType(NON_ELECTRONIC_RECORD_TYPE) .build(); - FilePlanComponent newRecord = filePlanComponentAPI.createFilePlanComponent( + FilePlanComponentModel newRecord = getFilePlanComponentsAPI().createFilePlanComponent( record, container.getId()); - filePlanComponentAPI.usingRestWrapper().assertStatusCodeIs(CREATED); + assertStatusCodeIs(CREATED); deleteAndVerify(newRecord); } - + /** *
          * Given a record
    @@ -154,7 +146,7 @@ public class DeleteRecordTests extends BaseRestTest
          * Then nothing happens
          * And error gets reported
          * 
    - * + * * @param container * @throws Exception */ @@ -165,37 +157,37 @@ public class DeleteRecordTests extends BaseRestTest @AlfrescoTest(jira="RM-4363") public void userWithoutWritePermissionsCantDeleteRecord() throws Exception { - filePlanComponentAPI.usingRestWrapper().authenticateUser(dataUser.getAdminUser()); - rmSiteAPI.usingRestWrapper().authenticateUser(dataUser.getAdminUser()); - + authenticateUser(dataUser.getAdminUser()); + authenticateUser(dataUser.getAdminUser()); + // create a non-electronic record in unfiled records - FilePlanComponent record = FilePlanComponent.builder() + FilePlanComponentModel record = FilePlanComponentModel.builder() .name("Record " + getRandomAlphanumeric()) - .nodeType(NON_ELECTRONIC_RECORD_TYPE.toString()) + .nodeType(NON_ELECTRONIC_RECORD_TYPE) .build(); - FilePlanComponent newRecord = filePlanComponentAPI.createFilePlanComponent( + FilePlanComponentModel newRecord = getFilePlanComponentsAPI().createFilePlanComponent( record, - UNFILED_RECORDS_CONTAINER_ALIAS.toString()); - filePlanComponentAPI.usingRestWrapper().assertStatusCodeIs(CREATED); - + UNFILED_RECORDS_CONTAINER_ALIAS); + assertStatusCodeIs(CREATED); + // create test user and add it with collab. privileges UserModel deleteUser = dataUser.createRandomTestUser("delnoperm"); deleteUser.setUserRole(UserRole.SiteCollaborator); logger.info("test user: " + deleteUser.getUsername()); - dataUser.addUserToSite(deleteUser, new SiteModel(rmSiteAPI.getSite().getId()), UserRole.SiteCollaborator); - + dataUser.addUserToSite(deleteUser, new SiteModel(getRMSiteAPI().getSite().getId()), UserRole.SiteCollaborator); + // add RM role to user rmUserAPI.assignRoleToUser(deleteUser.getUsername(), UserRoles.ROLE_RM_POWER_USER); rmUserAPI.usingRestWrapper().assertStatusCodeIs(OK); - + // log in as deleteUser - filePlanComponentAPI.usingRestWrapper().authenticateUser(deleteUser); - + authenticateUser(deleteUser); + // try to delete newRecord - filePlanComponentAPI.deleteFilePlanComponent(newRecord.getId()); - filePlanComponentAPI.usingRestWrapper().assertStatusCodeIs(FORBIDDEN); + getFilePlanComponentsAPI().deleteFilePlanComponent(newRecord.getId()); + assertStatusCodeIs(FORBIDDEN); } - + /** *
          * Given a record
    @@ -204,7 +196,7 @@ public class DeleteRecordTests extends BaseRestTest
          * Then nothing happens
          * And error gets reported
          * 
    - * + * * @param container * @throws Exception */ @@ -215,66 +207,65 @@ public class DeleteRecordTests extends BaseRestTest @AlfrescoTest(jira="RM-4363") public void userWithoutDeleteRecordsCapabilityCantDeleteRecord() throws Exception { - filePlanComponentAPI.usingRestWrapper().authenticateUser(dataUser.getAdminUser()); - rmSiteAPI.usingRestWrapper().authenticateUser(dataUser.getAdminUser()); - + authenticateUser(dataUser.getAdminUser()); + // create test user and add it with collab. privileges UserModel deleteUser = dataUser.createRandomTestUser("delnoperm"); deleteUser.setUserRole(UserRole.SiteCollaborator); - dataUser.addUserToSite(deleteUser, new SiteModel(rmSiteAPI.getSite().getId()), UserRole.SiteCollaborator); + dataUser.addUserToSite(deleteUser, new SiteModel(getRMSiteAPI().getSite().getId()), UserRole.SiteCollaborator); logger.info("test user: " + deleteUser.getUsername()); - + // add RM role to user, RM Power User doesn't have the Delete Record capabilities rmUserAPI.assignRoleToUser(deleteUser.getUsername(), UserRoles.ROLE_RM_POWER_USER); rmUserAPI.usingRestWrapper().assertStatusCodeIs(OK); - + // create random folder - FilePlanComponent randomFolder = createCategoryFolderInFilePlan(dataUser.getAdminUser(), FILE_PLAN_ALIAS.toString()); + FilePlanComponentModel randomFolder = createCategoryFolderInFilePlan(dataUser.getAdminUser(), FILE_PLAN_ALIAS); logger.info("random folder:" + randomFolder.getName()); - + // grant deleteUser Filing privileges on randomFolder category, this will be // inherited to randomFolder - addUserPermission(filePlanComponentAPI.getFilePlanComponent(randomFolder.getParentId()), + addUserPermission(getFilePlanComponentsAPI().getFilePlanComponent(randomFolder.getParentId()), deleteUser, UserPermissions.PERMISSION_FILING); - filePlanComponentAPI.usingRestWrapper().assertStatusCodeIs(OK); - + assertStatusCodeIs(OK); + // create a non-electronic record in randomFolder - FilePlanComponent record = FilePlanComponent.builder() + FilePlanComponentModel record = FilePlanComponentModel.builder() .name("Record " + getRandomAlphanumeric()) - .nodeType(NON_ELECTRONIC_RECORD_TYPE.toString()) + .nodeType(NON_ELECTRONIC_RECORD_TYPE) .build(); - FilePlanComponent newRecord = filePlanComponentAPI.createFilePlanComponent( + FilePlanComponentModel newRecord = getFilePlanComponentsAPI().createFilePlanComponent( record, randomFolder.getId()); - filePlanComponentAPI.usingRestWrapper().assertStatusCodeIs(CREATED); + assertStatusCodeIs(CREATED); // log in as deleteUser - filePlanComponentAPI.usingRestWrapper().authenticateUser(deleteUser); - + authenticateUser(deleteUser); + // verify the user can see the newRecord - filePlanComponentAPI.getFilePlanComponent(newRecord.getId()); - filePlanComponentAPI.usingRestWrapper().assertStatusCodeIs(OK); - + getFilePlanComponentsAPI().getFilePlanComponent(newRecord.getId()); + assertStatusCodeIs(OK); + // try to delete newRecord - filePlanComponentAPI.deleteFilePlanComponent(newRecord.getId()); - filePlanComponentAPI.usingRestWrapper().assertStatusCodeIs(FORBIDDEN); + getFilePlanComponentsAPI().deleteFilePlanComponent(newRecord.getId()); + assertStatusCodeIs(FORBIDDEN); } - + /** * Utility method to delete a record and verify successful deletion * @param record * @throws Exception */ - private void deleteAndVerify(FilePlanComponent record) throws Exception + private void deleteAndVerify(FilePlanComponentModel record) throws Exception { - filePlanComponentAPI.usingRestWrapper().authenticateUser(dataUser.getAdminUser()); - + authenticateUser(dataUser.getAdminUser()); + // delete it and verify status - filePlanComponentAPI.deleteFilePlanComponent(record.getId()); - filePlanComponentAPI.usingRestWrapper().assertStatusCodeIs(NO_CONTENT); - + getFilePlanComponentsAPI().deleteFilePlanComponent(record.getId()); + assertStatusCodeIs(NO_CONTENT); + // try to get deleted file plan component - filePlanComponentAPI.getFilePlanComponent(record.getId()); - filePlanComponentAPI.usingRestWrapper().assertStatusCodeIs(NOT_FOUND); + getFilePlanComponentsAPI().getFilePlanComponent(record.getId()); + assertStatusCodeIs(NOT_FOUND); } } diff --git a/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/fileplancomponents/ElectronicRecordTests.java b/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/fileplancomponents/ElectronicRecordTests.java index 34312c3c3c..209d1c0a5c 100644 --- a/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/fileplancomponents/ElectronicRecordTests.java +++ b/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/fileplancomponents/ElectronicRecordTests.java @@ -40,8 +40,7 @@ import static org.testng.Assert.assertFalse; import static org.testng.Assert.assertTrue; import org.alfresco.rest.rm.community.base.BaseRestTest; -import org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponent; -import org.alfresco.rest.rm.community.requests.FilePlanComponentAPI; +import org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentModel; import org.alfresco.utility.data.DataUser; import org.springframework.beans.factory.annotation.Autowired; import org.testng.annotations.DataProvider; @@ -58,9 +57,6 @@ import org.testng.annotations.Test; */ public class ElectronicRecordTests extends BaseRestTest { - @Autowired - private FilePlanComponentAPI filePlanComponentAPI; - @Autowired private DataUser dataUser; @@ -73,13 +69,13 @@ public class ElectronicRecordTests extends BaseRestTest return new Object[][] { // record category { getFilePlanComponentAsUser(dataUser.getAdminUser(), - createCategoryFolderInFilePlan(dataUser.getAdminUser(), FILE_PLAN_ALIAS.toString()).getParentId()) }, + createCategoryFolderInFilePlan(dataUser.getAdminUser(), FILE_PLAN_ALIAS).getParentId()) }, // file plan root - { getFilePlanComponentAsUser(dataUser.getAdminUser(), FILE_PLAN_ALIAS.toString()) }, + { getFilePlanComponentAsUser(dataUser.getAdminUser(), FILE_PLAN_ALIAS) }, // transfers - { getFilePlanComponentAsUser(dataUser.getAdminUser(), TRANSFERS_ALIAS.toString()) }, + { getFilePlanComponentAsUser(dataUser.getAdminUser(), TRANSFERS_ALIAS) }, // holds - { getFilePlanComponentAsUser(dataUser.getAdminUser(), HOLDS_ALIAS.toString()) }, + { getFilePlanComponentAsUser(dataUser.getAdminUser(), HOLDS_ALIAS) }, }; } @@ -98,19 +94,19 @@ public class ElectronicRecordTests extends BaseRestTest dataProvider = "invalidParentContainers", description = "Electronic records can't be created in invalid parent containers" ) - public void cantCreateElectronicRecordsInInvalidContainers(FilePlanComponent container) throws Exception + public void cantCreateElectronicRecordsInInvalidContainers(FilePlanComponentModel container) throws Exception { - filePlanComponentAPI.usingRestWrapper().authenticateUser(dataUser.getAdminUser()); + authenticateUser(dataUser.getAdminUser()); // Build object the filePlan - FilePlanComponent record = FilePlanComponent.builder() + FilePlanComponentModel record = FilePlanComponentModel.builder() .name("Record " + getRandomAlphanumeric()) - .nodeType(CONTENT_TYPE.toString()) + .nodeType(CONTENT_TYPE) .build(); - filePlanComponentAPI.createElectronicRecord(record, IMAGE_FILE, container.getId()); + getFilePlanComponentsAPI().createElectronicRecord(record, IMAGE_FILE, container.getId()); // verify the create request status code - filePlanComponentAPI.usingRestWrapper().assertStatusCodeIs(UNPROCESSABLE_ENTITY); + assertStatusCodeIs(UNPROCESSABLE_ENTITY); } /** @@ -126,8 +122,8 @@ public class ElectronicRecordTests extends BaseRestTest @Test(description = "Electronic record can't be created in closed record folder") public void cantCreateElectronicRecordInClosedFolder() throws Exception { - filePlanComponentAPI.usingRestWrapper().authenticateUser(dataUser.getAdminUser()); - FilePlanComponent recordFolder = createCategoryFolderInFilePlan(dataUser.getAdminUser(), FILE_PLAN_ALIAS.toString()); + authenticateUser(dataUser.getAdminUser()); + FilePlanComponentModel recordFolder = createCategoryFolderInFilePlan(dataUser.getAdminUser(), FILE_PLAN_ALIAS); // the folder should be open assertFalse(recordFolder.getProperties().getIsClosed()); @@ -136,14 +132,14 @@ public class ElectronicRecordTests extends BaseRestTest closeFolder(recordFolder.getId()); // try to create it, this should fail - FilePlanComponent record = FilePlanComponent.builder() + FilePlanComponentModel record = FilePlanComponentModel.builder() .name("Record " + getRandomAlphanumeric()) - .nodeType(CONTENT_TYPE.toString()) + .nodeType(CONTENT_TYPE) .build(); - filePlanComponentAPI.createElectronicRecord(record, IMAGE_FILE, recordFolder.getId()); + getFilePlanComponentsAPI().createElectronicRecord(record, IMAGE_FILE, recordFolder.getId()); // verify the status code - filePlanComponentAPI.usingRestWrapper().assertStatusCodeIs(UNPROCESSABLE_ENTITY); + assertStatusCodeIs(UNPROCESSABLE_ENTITY); } /** @@ -171,27 +167,27 @@ public class ElectronicRecordTests extends BaseRestTest dataProvider = "validRootContainers", description = "Electronic record can only be created if all mandatory properties are given" ) - public void canCreateElectronicRecordOnlyWithMandatoryProperties(FilePlanComponent container) throws Exception + public void canCreateElectronicRecordOnlyWithMandatoryProperties(FilePlanComponentModel container) throws Exception { - filePlanComponentAPI.usingRestWrapper().authenticateUser(dataUser.getAdminUser()); + authenticateUser(dataUser.getAdminUser()); logger.info("Root container:\n" + toJson(container)); - if (container.getNodeType().equals(RECORD_FOLDER_TYPE.toString())) + if (container.getNodeType().equals(RECORD_FOLDER_TYPE)) { // only record folders can be open or closed assertFalse(container.getProperties().getIsClosed()); } // component without name - FilePlanComponent record = FilePlanComponent.builder() - .nodeType(CONTENT_TYPE.toString()) + FilePlanComponentModel record = FilePlanComponentModel.builder() + .nodeType(CONTENT_TYPE) .build(); // try to create it - filePlanComponentAPI.createFilePlanComponent(record, container.getId()); + getFilePlanComponentsAPI().createFilePlanComponent(record, container.getId()); // verify the status code is BAD_REQUEST - filePlanComponentAPI.usingRestWrapper().assertStatusCodeIs(BAD_REQUEST); + assertStatusCodeIs(BAD_REQUEST); } /** @@ -216,21 +212,21 @@ public class ElectronicRecordTests extends BaseRestTest dataProvider = "validRootContainers", description = "Electronic records can be created in unfiled record folder or unfiled record root" ) - public void canCreateElectronicRecordsInValidContainers(FilePlanComponent container) throws Exception + public void canCreateElectronicRecordsInValidContainers(FilePlanComponentModel container) throws Exception { - filePlanComponentAPI.usingRestWrapper().authenticateUser(dataUser.getAdminUser()); + authenticateUser(dataUser.getAdminUser()); - FilePlanComponent record = FilePlanComponent.builder() + FilePlanComponentModel record = FilePlanComponentModel.builder() .name("Record " + getRandomAlphanumeric()) - .nodeType(CONTENT_TYPE.toString()) + .nodeType(CONTENT_TYPE) .build(); - String newRecordId = filePlanComponentAPI.createElectronicRecord(record, IMAGE_FILE, container.getId()).getId(); + String newRecordId = getFilePlanComponentsAPI().createElectronicRecord(record, IMAGE_FILE, container.getId()).getId(); // verify the create request status code - filePlanComponentAPI.usingRestWrapper().assertStatusCodeIs(CREATED); + assertStatusCodeIs(CREATED); // get newly created electonic record and verify its properties - FilePlanComponent electronicRecord = filePlanComponentAPI.getFilePlanComponent(newRecordId); + FilePlanComponentModel electronicRecord = getFilePlanComponentsAPI().getFilePlanComponent(newRecordId); // created record will have record identifier inserted in its name but will be prefixed with // the name it was created as assertTrue(electronicRecord.getName().startsWith(record.getName())); @@ -247,22 +243,22 @@ public class ElectronicRecordTests extends BaseRestTest dataProvider = "validRootContainers", description = "Electronic records can be created in unfiled record folder or unfiled record root" ) - public void recordNameDerivedFromFileName(FilePlanComponent container) throws Exception + public void recordNameDerivedFromFileName(FilePlanComponentModel container) throws Exception { - filePlanComponentAPI.usingRestWrapper().authenticateUser(dataUser.getAdminUser()); + authenticateUser(dataUser.getAdminUser()); // record object without name set - FilePlanComponent record = FilePlanComponent.builder() - .nodeType(CONTENT_TYPE.toString()) + FilePlanComponentModel record = FilePlanComponentModel.builder() + .nodeType(CONTENT_TYPE) .build(); - String newRecordId = filePlanComponentAPI.createElectronicRecord(record, IMAGE_FILE, container.getId()).getId(); + String newRecordId = getFilePlanComponentsAPI().createElectronicRecord(record, IMAGE_FILE, container.getId()).getId(); // verify the create request status code - filePlanComponentAPI.usingRestWrapper().assertStatusCodeIs(CREATED); + assertStatusCodeIs(CREATED); // get newly created electonic record and verify its properties - FilePlanComponent electronicRecord = filePlanComponentAPI.getFilePlanComponent(newRecordId); + FilePlanComponentModel electronicRecord = getFilePlanComponentsAPI().getFilePlanComponent(newRecordId); // record will have record identifier inserted in its name but will for sure start with file name // and end with its extension assertTrue(electronicRecord.getName().startsWith(IMAGE_FILE.substring(0, IMAGE_FILE.indexOf(".")))); diff --git a/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/fileplancomponents/FilePlanTests.java b/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/fileplancomponents/FilePlanTests.java index 9280b306db..9c5b3c7544 100644 --- a/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/fileplancomponents/FilePlanTests.java +++ b/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/fileplancomponents/FilePlanTests.java @@ -43,15 +43,10 @@ import static org.testng.Assert.assertEquals; import static org.testng.Assert.assertFalse; import static org.testng.Assert.assertTrue; -import org.alfresco.rest.core.RestWrapper; import org.alfresco.rest.rm.community.base.BaseRestTest; import org.alfresco.rest.rm.community.base.TestData; -import org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponent; -import org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentAlias; +import org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentModel; import org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentProperties; -import org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentType; -import org.alfresco.rest.rm.community.requests.FilePlanComponentAPI; -import org.alfresco.rest.rm.community.requests.RMSiteAPI; import org.alfresco.utility.data.DataUser; import org.alfresco.utility.model.UserModel; import org.alfresco.utility.report.Bug; @@ -67,15 +62,6 @@ import org.testng.annotations.Test; */ public class FilePlanTests extends BaseRestTest { - @Autowired - private FilePlanComponentAPI filePlanComponentAPI; - - @Autowired - protected RestWrapper restWrapper; - - @Autowired - private RMSiteAPI rmSiteAPI; - @Autowired private DataUser dataUser; @@ -90,23 +76,23 @@ public class FilePlanTests extends BaseRestTest dataProviderClass = TestData.class, dataProvider = "getContainers" ) - public void getFilePlanComponentWhenRMIsNotCreated(String filePlanAlias) throws Exception + public void getFilePlanComponentWhenRMIsNotCreated(String filePlanComponentAlias) throws Exception { // Check RM Site Exist - if (rmSiteAPI.existsRMSite()) + if (getRMSiteAPI().existsRMSite()) { // Delete RM Site - rmSiteAPI.deleteRMSite(); + getRMSiteAPI().deleteRMSite(); } // Authenticate with admin user - filePlanComponentAPI.usingRestWrapper().authenticateUser(dataUser.getAdminUser()); + authenticateUser(dataUser.getAdminUser()); // Get the file plan component - filePlanComponentAPI.getFilePlanComponent(filePlanAlias.toString()); + getFilePlanComponentsAPI().getFilePlanComponent(filePlanComponentAlias); //check the response code is NOT_FOUND - filePlanComponentAPI.usingRestWrapper().assertStatusCodeIs(NOT_FOUND); + assertStatusCodeIs(NOT_FOUND); } @@ -122,22 +108,22 @@ public class FilePlanTests extends BaseRestTest dataProviderClass = TestData.class, dataProvider = "getContainersAndTypes" ) - public void getFilePlanComponentWhenRMIsCreated(FilePlanComponentAlias filePlanAlias, FilePlanComponentType rmType) throws Exception + public void getFilePlanComponentWhenRMIsCreated(String filePlanComponentAlias, String filePlanComponentType) throws Exception { // Create RM Site if doesn't exist createRMSiteIfNotExists(); // Authenticate with admin user - filePlanComponentAPI.usingRestWrapper().authenticateUser(dataUser.getAdminUser()); + authenticateUser(dataUser.getAdminUser()); // Get the file plan special container - FilePlanComponent filePlanComponent = filePlanComponentAPI.getFilePlanComponent(filePlanAlias.toString()); + FilePlanComponentModel filePlanComponent = getFilePlanComponentsAPI().getFilePlanComponent(filePlanComponentAlias); // Check the response code - filePlanComponentAPI.usingRestWrapper().assertStatusCodeIs(OK); + assertStatusCodeIs(OK); // Check the response contains the right node type - assertEquals(filePlanComponent.getNodeType(), rmType.toString()); + assertEquals(filePlanComponent.getNodeType(), filePlanComponentType); } /** @@ -157,13 +143,13 @@ public class FilePlanTests extends BaseRestTest createRMSiteIfNotExists(); // Authenticate with admin user - filePlanComponentAPI.usingRestWrapper().authenticateUser(dataUser.getAdminUser()); + authenticateUser(dataUser.getAdminUser()); // Get the file plan special containers with the optional parameter allowableOperations - FilePlanComponent filePlanComponent = filePlanComponentAPI.withParams("include="+ ALLOWABLE_OPERATIONS).getFilePlanComponent(specialContainerAlias); + FilePlanComponentModel filePlanComponent = getFilePlanComponentsAPI().getFilePlanComponent(specialContainerAlias, "include=" + ALLOWABLE_OPERATIONS); // Check the list of allowableOperations returned - if(specialContainerAlias.equals(TRANSFERS_ALIAS.toString())) + if(specialContainerAlias.equals(TRANSFERS_ALIAS)) { assertTrue(filePlanComponent.getAllowableOperations().containsAll(asList(UPDATE)), "Wrong list of the allowable operations is return" + filePlanComponent.getAllowableOperations().toString()); @@ -196,10 +182,10 @@ public class FilePlanTests extends BaseRestTest createRMSiteIfNotExists(); // Authenticate with admin user - filePlanComponentAPI.usingRestWrapper().authenticateUser(dataUser.getAdminUser()); + authenticateUser(dataUser.getAdminUser()); // Build object for updating the filePlan - FilePlanComponent filePlanComponent = FilePlanComponent.builder() + FilePlanComponentModel filePlanComponent = FilePlanComponentModel.builder() .properties(FilePlanComponentProperties.builder() .title(FILE_PLAN_TITLE) .description(FILE_PLAN_DESCRIPTION) @@ -207,10 +193,10 @@ public class FilePlanTests extends BaseRestTest .build(); // Update the record category - FilePlanComponent renamedFilePlanComponent = filePlanComponentAPI.updateFilePlanComponent(filePlanComponent,FILE_PLAN_ALIAS.toString()); + FilePlanComponentModel renamedFilePlanComponent = getFilePlanComponentsAPI().updateFilePlanComponent(filePlanComponent, FILE_PLAN_ALIAS); // Verify the response status code - filePlanComponentAPI.usingRestWrapper().assertStatusCodeIs(OK); + assertStatusCodeIs(OK); // Verify the returned description field for the file plan component assertEquals(renamedFilePlanComponent.getProperties().getDescription(), FILE_PLAN_DESCRIPTION); @@ -230,19 +216,19 @@ public class FilePlanTests extends BaseRestTest dataProviderClass = TestData.class, dataProvider = "getContainers" ) - public void deleteFilePlanSpecialComponents(String filePlanAlias) throws Exception + public void deleteFilePlanSpecialComponents(String filePlanComponentAlias) throws Exception { // Create RM Site if doesn't exist createRMSiteIfNotExists(); // Authenticate with admin user - filePlanComponentAPI.usingRestWrapper().authenticateUser(dataUser.getAdminUser()); + authenticateUser(dataUser.getAdminUser()); // Delete the file plan component - filePlanComponentAPI.deleteFilePlanComponent(filePlanAlias.toString()); + getFilePlanComponentsAPI().deleteFilePlanComponent(filePlanComponentAlias); // Check the DELETE response status code - filePlanComponentAPI.usingRestWrapper().assertStatusCodeIs(UNPROCESSABLE_ENTITY); + assertStatusCodeIs(UNPROCESSABLE_ENTITY); } /** @@ -256,27 +242,27 @@ public class FilePlanTests extends BaseRestTest dataProviderClass = TestData.class, dataProvider = "getContainers" ) - public void deleteFilePlanSpecialComponentsNonRMUser(String filePlanAlias) throws Exception + public void deleteFilePlanSpecialComponentsNonRMUser(String filePlanComponentAlias) throws Exception { // Create RM Site if doesn't exist createRMSiteIfNotExists(); // Disconnect the current user from the API session - rmSiteAPI.usingRestWrapper().disconnect(); + disconnect(); // Authenticate admin user to Alfresco REST API - restClient.authenticateUser(dataUser.getAdminUser()); + authenticateUser(dataUser.getAdminUser()); // Create a random user UserModel nonRMuser = dataUser.createRandomTestUser("testUser"); // Authenticate using the random user - filePlanComponentAPI.usingRestWrapper().authenticateUser(nonRMuser); + authenticateUser(nonRMuser); // Delete the file plan component - filePlanComponentAPI.deleteFilePlanComponent(filePlanAlias.toString()); + getFilePlanComponentsAPI().deleteFilePlanComponent(filePlanComponentAlias); // Check the DELETE response status code - filePlanComponentAPI.usingRestWrapper().assertStatusCodeIs(FORBIDDEN); + assertStatusCodeIs(FORBIDDEN); } /** @@ -291,40 +277,40 @@ public class FilePlanTests extends BaseRestTest dataProvider = "getContainersAndTypes" ) @Bug(id = "RM-4296") - public void createFilePlanSpecialContainerWhenExists(FilePlanComponentAlias filePlanAlias, FilePlanComponentType rmType) throws Exception + public void createFilePlanSpecialContainerWhenExists(String filePlanComponentAlias, String filePlanComponentType) throws Exception { // Create RM Site if doesn't exist createRMSiteIfNotExists(); // Authenticate with admin user - rmSiteAPI.usingRestWrapper().authenticateUser(dataUser.getAdminUser()); + authenticateUser(dataUser.getAdminUser()); // Get the RM site ID - String rmSiteId = rmSiteAPI.getSite().getGuid(); - String name = filePlanAlias + getRandomAlphanumeric(); + String rmSiteId = getRMSiteAPI().getSite().getGuid(); + String name = filePlanComponentAlias + getRandomAlphanumeric(); // Build the file plan root properties - FilePlanComponent filePlanComponent = FilePlanComponent.builder() + FilePlanComponentModel filePlanComponent = FilePlanComponentModel.builder() .name(name) - .nodeType(rmType.toString()) + .nodeType(filePlanComponentType) .properties(FilePlanComponentProperties.builder() .build()) .build(); // Authenticate with admin user - filePlanComponentAPI.usingRestWrapper().authenticateUser(dataUser.getAdminUser()); + authenticateUser(dataUser.getAdminUser()); // Create the special containers into RM site - parent folder - filePlanComponentAPI.createFilePlanComponent(filePlanComponent, rmSiteId); - filePlanComponentAPI.usingRestWrapper().assertStatusCodeIs(UNPROCESSABLE_ENTITY); + getFilePlanComponentsAPI().createFilePlanComponent(filePlanComponent, rmSiteId); + assertStatusCodeIs(UNPROCESSABLE_ENTITY); // Create the special containers into RM site - parent folder - filePlanComponentAPI.createFilePlanComponent(filePlanComponent, FILE_PLAN_ALIAS.toString()); - filePlanComponentAPI.usingRestWrapper().assertStatusCodeIs(UNPROCESSABLE_ENTITY); + getFilePlanComponentsAPI().createFilePlanComponent(filePlanComponent, FILE_PLAN_ALIAS); + assertStatusCodeIs(UNPROCESSABLE_ENTITY); // Create the special containers into the root of special containers containers - filePlanComponentAPI.createFilePlanComponent(filePlanComponent, filePlanAlias.toString()); - filePlanComponentAPI.usingRestWrapper().assertStatusCodeIs(UNPROCESSABLE_ENTITY); + getFilePlanComponentsAPI().createFilePlanComponent(filePlanComponent, filePlanComponentAlias); + assertStatusCodeIs(UNPROCESSABLE_ENTITY); } /** @@ -338,13 +324,13 @@ public class FilePlanTests extends BaseRestTest dataProviderClass = TestData.class, dataProvider = "getContainers" ) - public void getSpecialFilePlanComponentsWithNonRMuser(String filePlanAlias) throws Exception + public void getSpecialFilePlanComponentsWithNonRMuser(String filePlanComponentAlias) throws Exception { // Create RM Site if doesn't exist createRMSiteIfNotExists(); // Disconnect user from REST API session - rmSiteAPI.usingRestWrapper().disconnect(); + disconnect(); // Authenticate admin user to Alfresco REST API restClient.authenticateUser(dataUser.getAdminUser()); @@ -353,12 +339,12 @@ public class FilePlanTests extends BaseRestTest UserModel nonRMuser = dataUser.createRandomTestUser("testUser"); // Authenticate using the random user - filePlanComponentAPI.usingRestWrapper().authenticateUser(nonRMuser); + authenticateUser(nonRMuser); // Get the special file plan components - filePlanComponentAPI.getFilePlanComponent(filePlanAlias.toString()); + getFilePlanComponentsAPI().getFilePlanComponent(filePlanComponentAlias); // Check the response status code is FORBIDDEN - filePlanComponentAPI.usingRestWrapper().assertStatusCodeIs(FORBIDDEN); + assertStatusCodeIs(FORBIDDEN); } } diff --git a/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/fileplancomponents/NonElectronicRecordTests.java b/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/fileplancomponents/NonElectronicRecordTests.java index 968edbe9dd..2e67efa457 100644 --- a/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/fileplancomponents/NonElectronicRecordTests.java +++ b/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/fileplancomponents/NonElectronicRecordTests.java @@ -46,10 +46,8 @@ import static org.testng.Assert.assertFalse; import java.util.Random; import org.alfresco.rest.rm.community.base.BaseRestTest; -import org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponent; +import org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentModel; import org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentProperties; -import org.alfresco.rest.rm.community.requests.FilePlanComponentAPI; -import org.alfresco.rest.rm.community.requests.RMSiteAPI; import org.alfresco.utility.constants.UserRole; import org.alfresco.utility.data.DataUser; import org.alfresco.utility.model.SiteModel; @@ -65,15 +63,9 @@ import org.testng.annotations.Test; */ public class NonElectronicRecordTests extends BaseRestTest { - @Autowired - private FilePlanComponentAPI filePlanComponentAPI; - @Autowired private DataUser dataUser; - @Autowired - private RMSiteAPI rmSiteAPI; - /** *
          * Given a parent container that is NOT a record folder or an unfiled record folder
    @@ -86,37 +78,37 @@ public class NonElectronicRecordTests extends BaseRestTest
         @Test(description = "Non-electronic record can't be created as a child of invalid parent Id")
         public void cantCreateForInvalidParentIds() throws Exception
         {
    -        filePlanComponentAPI.usingRestWrapper().authenticateUser(dataUser.getAdminUser());
    +        authenticateUser(dataUser.getAdminUser());
     
             // non-electronic record object to be used for create tests
    -        FilePlanComponent nonElectronicRecord = FilePlanComponent.builder()
    +        FilePlanComponentModel nonElectronicRecord = FilePlanComponentModel.builder()
                                                     .name("Record " + getRandomAlphanumeric())
    -                                                .nodeType(NON_ELECTRONIC_RECORD_TYPE.toString())
    +                                                .nodeType(NON_ELECTRONIC_RECORD_TYPE)
                                                     .build();
     
             // create record category, non-electronic records can't be its children
    -        FilePlanComponent recordCategoryModel = FilePlanComponent.builder()
    +        FilePlanComponentModel recordCategoryModel = FilePlanComponentModel.builder()
                                                              .name("Category " + getRandomAlphanumeric())
    -                                                         .nodeType(RECORD_CATEGORY_TYPE.toString())
    +                                                         .nodeType(RECORD_CATEGORY_TYPE)
                                                              .build();
     
    -        FilePlanComponent recordCategory = filePlanComponentAPI.createFilePlanComponent(recordCategoryModel, FILE_PLAN_ALIAS.toString());
    +        FilePlanComponentModel recordCategory = getFilePlanComponentsAPI().createFilePlanComponent(recordCategoryModel, FILE_PLAN_ALIAS);
     
             // iterate through all invalid parent containers and try to create/file an electronic record
    -        asList(FILE_PLAN_ALIAS.toString(), TRANSFERS_ALIAS.toString(), HOLDS_ALIAS.toString(), recordCategory.getId())
    +        asList(FILE_PLAN_ALIAS, TRANSFERS_ALIAS, HOLDS_ALIAS, recordCategory.getId())
                 .stream()
                 .forEach(id ->
                 {
                     try
                     {
    -                    filePlanComponentAPI.createFilePlanComponent(nonElectronicRecord, id);
    +                    getFilePlanComponentsAPI().createFilePlanComponent(nonElectronicRecord, id);
                     }
                     catch (Exception error)
                     {
                     }
     
                     // Verify the status code
    -                filePlanComponentAPI.usingRestWrapper().assertStatusCodeIs(UNPROCESSABLE_ENTITY);
    +                assertStatusCodeIs(UNPROCESSABLE_ENTITY);
                 });
         }
     
    @@ -142,12 +134,12 @@ public class NonElectronicRecordTests extends BaseRestTest
             dataProvider = "validRootContainers",
             description = "Non-electronic records can be created in valid containers"
         )
    -    public void canCreateInValidContainers(FilePlanComponent container) throws Exception
    +    public void canCreateInValidContainers(FilePlanComponentModel container) throws Exception
         {
    -        filePlanComponentAPI.usingRestWrapper().authenticateUser(dataUser.getAdminUser());
    +        authenticateUser(dataUser.getAdminUser());
     
             logger.info("Root container:\n" + toJson(container));
    -        if (container.getNodeType().equals(RECORD_FOLDER_TYPE.toString()))
    +        if (container.getNodeType().equals(RECORD_FOLDER_TYPE))
             {
                 // only record folders can be open or closed
                 assertFalse(container.getProperties().getIsClosed());
    @@ -166,9 +158,9 @@ public class NonElectronicRecordTests extends BaseRestTest
             Integer size = random.nextInt(Integer.MAX_VALUE);
     
             // set values of all available properties for the non electronic records
    -        FilePlanComponent filePlanComponent = FilePlanComponent.builder()
    +        FilePlanComponentModel filePlanComponent = FilePlanComponentModel.builder()
                                                                .name("Record " + getRandomAlphanumeric())
    -                                                           .nodeType(NON_ELECTRONIC_RECORD_TYPE.toString())
    +                                                           .nodeType(NON_ELECTRONIC_RECORD_TYPE)
                                                                .properties(FilePlanComponentProperties.builder()
                                                                                                       .title(title)
                                                                                                       .description(description)
    @@ -182,15 +174,15 @@ public class NonElectronicRecordTests extends BaseRestTest
                                                                .build();
     
             // create non-electronic record
    -        String nonElectronicId = filePlanComponentAPI.createFilePlanComponent(
    +        String nonElectronicId = getFilePlanComponentsAPI().createFilePlanComponent(
                 filePlanComponent,
                 container.getId()).getId();
     
             // verify the create request status code
    -        filePlanComponentAPI.usingRestWrapper().assertStatusCodeIs(CREATED);
    +        assertStatusCodeIs(CREATED);
     
             // get newly created non-electonic record and verify its properties
    -        FilePlanComponent nonElectronicRecord = filePlanComponentAPI.getFilePlanComponent(nonElectronicId);
    +        FilePlanComponentModel nonElectronicRecord = getFilePlanComponentsAPI().getFilePlanComponent(nonElectronicId);
     
             assertEquals(title, nonElectronicRecord.getProperties().getTitle());
             assertEquals(description, nonElectronicRecord.getProperties().getDescription());
    @@ -215,8 +207,8 @@ public class NonElectronicRecordTests extends BaseRestTest
         @Test(description = "Non-electronic record can't be created in closed record folder")
         public void cantCreateInClosedFolder() throws Exception
         {
    -        filePlanComponentAPI.usingRestWrapper().authenticateUser(dataUser.getAdminUser());
    -        FilePlanComponent recordFolder = createCategoryFolderInFilePlan(dataUser.getAdminUser(), FILE_PLAN_ALIAS.toString());
    +        authenticateUser(dataUser.getAdminUser());
    +        FilePlanComponentModel recordFolder = createCategoryFolderInFilePlan(dataUser.getAdminUser(), FILE_PLAN_ALIAS);
     
             // the folder should be open
             assertFalse(recordFolder.getProperties().getIsClosed());
    @@ -226,15 +218,15 @@ public class NonElectronicRecordTests extends BaseRestTest
     
             // try to create it, this should fail and throw an exception
     
    -        filePlanComponentAPI.createFilePlanComponent(FilePlanComponent.builder()
    +        getFilePlanComponentsAPI().createFilePlanComponent(FilePlanComponentModel.builder()
                                                                           .name("Record " + getRandomAlphanumeric())
    -                                                                      .nodeType(NON_ELECTRONIC_RECORD_TYPE.toString())
    +                                                                      .nodeType(NON_ELECTRONIC_RECORD_TYPE)
                                                                           .build(),
                                                         recordFolder.getId())
                                                                         .getId();
     
             // verify the status code
    -        filePlanComponentAPI.usingRestWrapper().assertStatusCodeIs(UNPROCESSABLE_ENTITY);
    +        assertStatusCodeIs(UNPROCESSABLE_ENTITY);
         }
     
         /**
    @@ -261,22 +253,22 @@ public class NonElectronicRecordTests extends BaseRestTest
             dataProvider = "validRootContainers",
             description = "Non-electronic record can only be created if all mandatory properties are given"
         )
    -    public void allMandatoryPropertiesRequired(FilePlanComponent container) throws Exception
    +    public void allMandatoryPropertiesRequired(FilePlanComponentModel container) throws Exception
         {
    -        filePlanComponentAPI.usingRestWrapper().authenticateUser(dataUser.getAdminUser());
    +        authenticateUser(dataUser.getAdminUser());
     
             logger.info("Root container:\n" + toJson(container));
    -        if (container.getNodeType().equals(RECORD_FOLDER_TYPE.toString()))
    +        if (container.getNodeType().equals(RECORD_FOLDER_TYPE))
             {
                 // only record folders can be open or closed
                 assertFalse(container.getProperties().getIsClosed());
             }
     
             // component without name and title
    -        FilePlanComponent noNameOrTitle = getDummyNonElectronicRecord();
    +        FilePlanComponentModel noNameOrTitle = getDummyNonElectronicRecord();
     
             // component with title only
    -        FilePlanComponent titleOnly = getDummyNonElectronicRecord();
    +        FilePlanComponentModel titleOnly = getDummyNonElectronicRecord();
             FilePlanComponentProperties properties = FilePlanComponentProperties.builder()
                                                                                 .title("Title " + getRandomAlphanumeric())
                                                                                 .build();
    @@ -296,14 +288,14 @@ public class NonElectronicRecordTests extends BaseRestTest
                 // this should fail and throw an exception
                 try
                 {
    -                filePlanComponentAPI.createFilePlanComponent(c, container.getId());
    +                getFilePlanComponentsAPI().createFilePlanComponent(c, container.getId());
                 }
                 catch (Exception e)
                 {
                 }
     
                 // verify the status code is BAD_REQUEST
    -            filePlanComponentAPI.usingRestWrapper().assertStatusCodeIs(BAD_REQUEST);
    +            assertStatusCodeIs(BAD_REQUEST);
             });
         }
     
    @@ -321,45 +313,45 @@ public class NonElectronicRecordTests extends BaseRestTest
             dataProvider = "validRootContainers",
             description = "Non-electronic record can't be created if user doesn't have RM privileges"
         )
    -    public void cantCreateIfNoRmPrivileges(FilePlanComponent container) throws Exception
    +    public void cantCreateIfNoRmPrivileges(FilePlanComponentModel container) throws Exception
         {
             String username = "zzzuser";
             UserModel user = createUserWithRole(username, UserRole.SiteManager);
     
    -        filePlanComponentAPI.usingRestWrapper().authenticateUser(user);
    +        authenticateUser(user);
     
             // try to create a fileplan component
    -        FilePlanComponent record=FilePlanComponent.builder()
    +        FilePlanComponentModel record = FilePlanComponentModel.builder()
                                                       .properties(FilePlanComponentProperties.builder()
                                                                                              .description("Description")
                                                                                              .title("Title")
                                                                                              .build())
                                                       .name("Record Name")
    -                                                  .nodeType(NON_ELECTRONIC_RECORD_TYPE.toString())
    +                                                  .nodeType(NON_ELECTRONIC_RECORD_TYPE)
                                                       .build();
     
     
             // this should fail and throw an exception
             try
             {
    -            filePlanComponentAPI.createFilePlanComponent(record, container.getId());
    +            getFilePlanComponentsAPI().createFilePlanComponent(record, container.getId());
             }
             catch (Exception e)
             {
             }
     
             // user who isn't an RM site member can't access the container path
    -        filePlanComponentAPI.usingRestWrapper().assertStatusCodeIs(FORBIDDEN);
    +        assertStatusCodeIs(FORBIDDEN);
         }
     
         /**
          * Helper function to return an empty FilePlanComponent for non-electronic record
          * @return
          */
    -    private FilePlanComponent getDummyNonElectronicRecord()
    +    private FilePlanComponentModel getDummyNonElectronicRecord()
         {
    -        FilePlanComponent component=FilePlanComponent.builder()
    -                                            .nodeType(NON_ELECTRONIC_RECORD_TYPE.toString())
    +        FilePlanComponentModel component = FilePlanComponentModel.builder()
    +                                            .nodeType(NON_ELECTRONIC_RECORD_TYPE)
                                                 .build();
             return component;
         }
    @@ -378,8 +370,8 @@ public class NonElectronicRecordTests extends BaseRestTest
          */
         private UserModel createUserWithRole(String userName, UserRole userRole) throws Exception
         {
    -        rmSiteAPI.usingRestWrapper().authenticateUser(dataUser.getAdminUser());
    -        String siteId = rmSiteAPI.getSite().getId();
    +        authenticateUser(dataUser.getAdminUser());
    +        String siteId = getRMSiteAPI().getSite().getId();
     
             // check if user exists
             UserModel user = new UserModel();
    diff --git a/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/fileplancomponents/RecordCategoryTest.java b/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/fileplancomponents/RecordCategoryTest.java
    index 12e8c9ed28..4ecf10de67 100644
    --- a/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/fileplancomponents/RecordCategoryTest.java
    +++ b/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/fileplancomponents/RecordCategoryTest.java
    @@ -44,14 +44,11 @@ import static org.testng.Assert.fail;
     import java.util.ArrayList;
     import java.util.NoSuchElementException;
     
    -import org.alfresco.rest.core.RestWrapper;
     import org.alfresco.rest.rm.community.base.BaseRestTest;
     import org.alfresco.rest.rm.community.base.TestData;
    -import org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponent;
    +import org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentModel;
     import org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentProperties;
    -import org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentType;
     import org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentsCollection;
    -import org.alfresco.rest.rm.community.requests.FilePlanComponentAPI;
     import org.alfresco.utility.data.DataUser;
     import org.alfresco.utility.report.Bug;
     import org.springframework.beans.factory.annotation.Autowired;
    @@ -66,9 +63,6 @@ import org.testng.annotations.Test;
      */
     public class RecordCategoryTest extends BaseRestTest
     {
    -    @Autowired
    -    private FilePlanComponentAPI filePlanComponentAPI;
    -
         @Autowired
         private DataUser dataUser;
     
    @@ -88,15 +82,15 @@ public class RecordCategoryTest extends BaseRestTest
         public void createCategoryTest() throws Exception
         {
             // Authenticate with admin user
    -        RestWrapper restWrapper = filePlanComponentAPI.usingRestWrapper().authenticateUser(dataUser.getAdminUser());
    +        authenticateUser(dataUser.getAdminUser());
     
             String categoryName = "Category name " + getRandomAlphanumeric();
             String categoryTitle = "Category title " + getRandomAlphanumeric();
     
             // Build the record category properties
    -        FilePlanComponent recordCategory = FilePlanComponent.builder()
    +        FilePlanComponentModel recordCategory = FilePlanComponentModel.builder()
                 .name(categoryName)
    -            .nodeType(RECORD_CATEGORY_TYPE.toString())
    +            .nodeType(RECORD_CATEGORY_TYPE)
                 .properties(
                         FilePlanComponentProperties.builder()
                             .title(categoryTitle)
    @@ -104,10 +98,10 @@ public class RecordCategoryTest extends BaseRestTest
                 .build();
     
             // Create the record category
    -        FilePlanComponent filePlanComponent = filePlanComponentAPI.createFilePlanComponent(recordCategory, FILE_PLAN_ALIAS.toString());
    +        FilePlanComponentModel filePlanComponent = getFilePlanComponentsAPI().createFilePlanComponent(recordCategory, FILE_PLAN_ALIAS);
     
             // Verify the status code
    -        restWrapper.assertStatusCodeIs(CREATED);
    +        assertStatusCodeIs(CREATED);
     
             // Verify the returned file plan component
             assertTrue(filePlanComponent.getIsCategory());
    @@ -115,7 +109,7 @@ public class RecordCategoryTest extends BaseRestTest
             assertFalse(filePlanComponent.getIsRecordFolder());
     
             assertEquals(filePlanComponent.getName(), categoryName);
    -        assertEquals(filePlanComponent.getNodeType(), RECORD_CATEGORY_TYPE.toString());
    +        assertEquals(filePlanComponent.getNodeType(), RECORD_CATEGORY_TYPE);
     
             assertEquals(filePlanComponent.getCreatedByUser().getId(), dataUser.getAdminUser().getUsername());
     
    @@ -139,16 +133,16 @@ public class RecordCategoryTest extends BaseRestTest
         public void renameCategory() throws Exception
         {
             // Authenticate with admin user
    -        RestWrapper restWrapper = filePlanComponentAPI.usingRestWrapper().authenticateUser(dataUser.getAdminUser());
    +        authenticateUser(dataUser.getAdminUser());
     
             // Create record category first
             String categoryName = "Category name " + getRandomAlphanumeric();
             String categoryTitle = "Category title " + getRandomAlphanumeric();
     
             // Build the record category properties
    -        FilePlanComponent recordCategory = FilePlanComponent.builder()
    +        FilePlanComponentModel recordCategory = FilePlanComponentModel.builder()
                 .name(categoryName)
    -            .nodeType(RECORD_CATEGORY_TYPE.toString())
    +            .nodeType(RECORD_CATEGORY_TYPE)
                 .properties(
                         FilePlanComponentProperties.builder()
                             .title(categoryTitle)
    @@ -156,24 +150,24 @@ public class RecordCategoryTest extends BaseRestTest
                 .build();
     
             // Create the record category
    -        FilePlanComponent filePlanComponent = filePlanComponentAPI.createFilePlanComponent(recordCategory, FILE_PLAN_ALIAS.toString());
    +        FilePlanComponentModel filePlanComponent = getFilePlanComponentsAPI().createFilePlanComponent(recordCategory, FILE_PLAN_ALIAS);
     
             String newCategoryName = "Rename " + categoryName;
     
             // Build the properties which will be updated
    -        FilePlanComponent recordCategoryUpdated = FilePlanComponent.builder().name(newCategoryName).build();
    +        FilePlanComponentModel recordCategoryUpdated = FilePlanComponentModel.builder().name(newCategoryName).build();
     
             // Update the record category
    -        FilePlanComponent renamedFilePlanComponent = filePlanComponentAPI.updateFilePlanComponent(recordCategoryUpdated, filePlanComponent.getId());
    +        FilePlanComponentModel renamedFilePlanComponent = getFilePlanComponentsAPI().updateFilePlanComponent(recordCategoryUpdated, filePlanComponent.getId());
     
             // Verify the status code
    -        restWrapper.assertStatusCodeIs(OK);
    +        assertStatusCodeIs(OK);
     
             // Verify the returned file plan component
             assertEquals(renamedFilePlanComponent.getName(), newCategoryName);
     
             // Get actual FILE_PLAN_ALIAS id
    -        FilePlanComponent parentComponent = filePlanComponentAPI.getFilePlanComponent(FILE_PLAN_ALIAS.toString());
    +        FilePlanComponentModel parentComponent = getFilePlanComponentsAPI().getFilePlanComponent(FILE_PLAN_ALIAS);
     
             // verify renamed component still has this parent
             assertEquals(renamedFilePlanComponent.getParentId(), parentComponent.getId());
    @@ -192,16 +186,16 @@ public class RecordCategoryTest extends BaseRestTest
         public void deleteCategory() throws Exception
         {
             // Authenticate with admin user
    -        RestWrapper restWrapper = filePlanComponentAPI.usingRestWrapper().authenticateUser(dataUser.getAdminUser());
    +        authenticateUser(dataUser.getAdminUser());
     
             // Create record category first
             String categoryName = "Category name " + getRandomAlphanumeric();
             String categoryTitle = "Category title " + getRandomAlphanumeric();
     
             // Build the record category properties
    -        FilePlanComponent recordCategory = FilePlanComponent.builder()
    +        FilePlanComponentModel recordCategory = FilePlanComponentModel.builder()
                     .name(categoryName)
    -                .nodeType(RECORD_CATEGORY_TYPE.toString())
    +                .nodeType(RECORD_CATEGORY_TYPE)
                     .properties(
                             FilePlanComponentProperties.builder()
                                 .title(categoryTitle)
    @@ -209,17 +203,17 @@ public class RecordCategoryTest extends BaseRestTest
                     .build();
     
             // Create the record category
    -        FilePlanComponent filePlanComponent = filePlanComponentAPI.createFilePlanComponent(recordCategory, FILE_PLAN_ALIAS.toString());
    +        FilePlanComponentModel filePlanComponent = getFilePlanComponentsAPI().createFilePlanComponent(recordCategory, FILE_PLAN_ALIAS);
     
             // Delete the record category
    -        filePlanComponentAPI.deleteFilePlanComponent(filePlanComponent.getId());
    +        getFilePlanComponentsAPI().deleteFilePlanComponent(filePlanComponent.getId());
     
             // Verify the status code
    -        restWrapper.assertStatusCodeIs(NO_CONTENT);
    +        assertStatusCodeIs(NO_CONTENT);
     
             // Deleted component should no longer be retrievable
    -        filePlanComponentAPI.getFilePlanComponent(filePlanComponent.getId());
    -        restWrapper.assertStatusCodeIs(NOT_FOUND);
    +        getFilePlanComponentsAPI().getFilePlanComponent(filePlanComponent.getId());
    +        assertStatusCodeIs(NOT_FOUND);
         }
     
         /**
    @@ -235,11 +229,11 @@ public class RecordCategoryTest extends BaseRestTest
         public void createSubcategory() throws Exception
         {
             // Create root level category
    -        FilePlanComponent rootCategory = createCategory(FILE_PLAN_ALIAS.toString(), getRandomAlphanumeric());
    +        FilePlanComponentModel rootCategory = createCategory(FILE_PLAN_ALIAS, getRandomAlphanumeric());
             assertNotNull(rootCategory.getId());
     
             // Create subcategory as a child of rootCategory
    -        FilePlanComponent childCategory = createCategory(rootCategory.getId(), getRandomAlphanumeric());
    +        FilePlanComponentModel childCategory = createCategory(rootCategory.getId(), getRandomAlphanumeric());
     
             // Child category created?
             assertNotNull(childCategory.getId());
    @@ -249,7 +243,7 @@ public class RecordCategoryTest extends BaseRestTest
             assertTrue(childCategory.getIsCategory());
             assertFalse(childCategory.getIsFile());
             assertFalse(childCategory.getIsRecordFolder());
    -        assertEquals(childCategory.getNodeType(), RECORD_CATEGORY_TYPE.toString());
    +        assertEquals(childCategory.getNodeType(), RECORD_CATEGORY_TYPE);
         }
     
         /**
    @@ -267,15 +261,15 @@ public class RecordCategoryTest extends BaseRestTest
         public void listChildren() throws Exception
         {
             // Create root level category
    -        FilePlanComponent rootCategory = createCategory(FILE_PLAN_ALIAS.toString(), getRandomAlphanumeric());
    +        FilePlanComponentModel rootCategory = createCategory(FILE_PLAN_ALIAS, getRandomAlphanumeric());
             assertNotNull(rootCategory.getId());
     
             // Add child categories/folders
    -        ArrayList children = new ArrayList();
    +        ArrayList children = new ArrayList();
             for (int i=0; i < NUMBER_OF_CHILDREN; i++)
             {
                 // Create a child
    -            FilePlanComponent child = createComponent(rootCategory.getId(),
    +            FilePlanComponentModel child = createComponent(rootCategory.getId(),
                     getRandomAlphanumeric(),
                     // half of the children should be subcategories, the other subfolders
                     (i <= NUMBER_OF_CHILDREN / 2) ? RECORD_CATEGORY_TYPE : RECORD_FOLDER_TYPE);
    @@ -284,26 +278,26 @@ public class RecordCategoryTest extends BaseRestTest
             }
     
             // Authenticate with admin user
    -        RestWrapper restWrapper = filePlanComponentAPI.usingRestWrapper().authenticateUser(dataUser.getAdminUser());
    +        authenticateUser(dataUser.getAdminUser());
     
             // List children from API
    -        FilePlanComponentsCollection apiChildren = filePlanComponentAPI.listChildComponents(rootCategory.getId());
    +        FilePlanComponentsCollection apiChildren = getFilePlanComponentsAPI().listChildComponents(rootCategory.getId());
     
             // Check status code
    -        restWrapper.assertStatusCodeIs(OK);
    +        assertStatusCodeIs(OK);
             logger.info("parent: " + rootCategory.getId());
     
             // Check listed children against created list
             apiChildren.getEntries().forEach(c ->
             {
    -            FilePlanComponent filePlanComponent = c.getFilePlanComponent();
    +            FilePlanComponentModel filePlanComponent = c.getFilePlanComponentModel();
                 assertNotNull(filePlanComponent.getId());
                 logger.info("Checking child " + filePlanComponent.getId());
     
                 try
                 {
                     // Find this child in created children list
    -                FilePlanComponent createdComponent = children.stream()
    +                FilePlanComponentModel createdComponent = children.stream()
                         .filter(child -> child.getId().equals(filePlanComponent.getId()))
                         .findFirst()
                         .get();
    @@ -319,7 +313,7 @@ public class RecordCategoryTest extends BaseRestTest
     
                     // Boolean properties related to node type
                     // Only RECORD_CATEGORY_TYPE and RECORD_FOLDER_TYPE have been created
    -                if (filePlanComponent.getNodeType().equals(RECORD_CATEGORY_TYPE.toString()))
    +                if (filePlanComponent.getNodeType().equals(RECORD_CATEGORY_TYPE))
                     {
                         assertTrue(filePlanComponent.getIsCategory());
                         assertFalse(filePlanComponent.getIsRecordFolder());
    @@ -362,13 +356,13 @@ public class RecordCategoryTest extends BaseRestTest
             String COMPONENT_NAME = "Component"+getRandomAlphanumeric();
     
             // Authenticate with admin user
    -        filePlanComponentAPI.usingRestWrapper().authenticateUser(dataUser.getAdminUser());
    +        authenticateUser(dataUser.getAdminUser());
     
             //Create the category
    -        FilePlanComponent category = createCategory(FILE_PLAN_ALIAS.toString(), COMPONENT_NAME);
    +        FilePlanComponentModel category = createCategory(FILE_PLAN_ALIAS, COMPONENT_NAME);
     
             //Build node  properties
    -        FilePlanComponent recordCategory = FilePlanComponent.builder()
    +        FilePlanComponentModel recordCategory = FilePlanComponentModel.builder()
                     .name(COMPONENT_NAME)
                     .nodeType(nodeType)
                     .properties(
    @@ -378,8 +372,8 @@ public class RecordCategoryTest extends BaseRestTest
                     .build();
     
             //create the invalid node type
    -        filePlanComponentAPI.createFilePlanComponent(recordCategory, category.getId());
    -        filePlanComponentAPI.usingRestWrapper().assertStatusCodeIs(UNPROCESSABLE_ENTITY);
    +        getFilePlanComponentsAPI().createFilePlanComponent(recordCategory, category.getId());
    +        assertStatusCodeIs(UNPROCESSABLE_ENTITY);
         }
     
     
    @@ -391,7 +385,7 @@ public class RecordCategoryTest extends BaseRestTest
          * @return The created category
          * @throws Exception on unsuccessful component creation
          */
    -    public FilePlanComponent createCategory(String parentCategoryId, String categoryName) throws Exception
    +    public FilePlanComponentModel createCategory(String parentCategoryId, String categoryName) throws Exception
         {
             return createComponent(parentCategoryId, categoryName, RECORD_CATEGORY_TYPE);
         }
    @@ -405,20 +399,22 @@ public class RecordCategoryTest extends BaseRestTest
          * @return The created file plan component
          * @throws Exception
          */
    -    private FilePlanComponent createComponent(String parentComponentId, String componentName, FilePlanComponentType componentType) throws Exception
    +    private FilePlanComponentModel createComponent(String parentComponentId, String componentName, String componentType) throws Exception
         {
    -        RestWrapper restWrapper = filePlanComponentAPI.usingRestWrapper().authenticateUser(dataUser.getAdminUser());
    +        authenticateUser(dataUser.getAdminUser());
    +
             //Build node  properties
    -        FilePlanComponent component = FilePlanComponent.builder()
    +        FilePlanComponentModel component = FilePlanComponentModel.builder()
                     .name(componentName)
    -                .nodeType(componentType.toString())
    +                .nodeType(componentType)
                     .properties(FilePlanComponentProperties.builder()
                             .title("Title for " + componentName)
                             .build())
                     .build();
     
    -        FilePlanComponent fpc = filePlanComponentAPI.createFilePlanComponent(component, parentComponentId);
    -        restWrapper.assertStatusCodeIs(CREATED);
    +        FilePlanComponentModel fpc = getFilePlanComponentsAPI().createFilePlanComponent(component, parentComponentId);
    +        assertStatusCodeIs(CREATED);
    +
             return fpc;
         }
     }
    diff --git a/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/fileplancomponents/RecordFolderTests.java b/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/fileplancomponents/RecordFolderTests.java
    index bab76aec0c..396ccfafe5 100644
    --- a/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/fileplancomponents/RecordFolderTests.java
    +++ b/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/fileplancomponents/RecordFolderTests.java
    @@ -49,14 +49,12 @@ import java.time.LocalDateTime;
     import java.util.ArrayList;
     import java.util.NoSuchElementException;
     
    -import org.alfresco.rest.core.RestWrapper;
     import org.alfresco.rest.rm.community.base.BaseRestTest;
     import org.alfresco.rest.rm.community.base.TestData;
    -import org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponent;
    +import org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentModel;
     import org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentProperties;
     import org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentsCollection;
     import org.alfresco.rest.rm.community.model.fileplancomponents.ReviewPeriod;
    -import org.alfresco.rest.rm.community.requests.FilePlanComponentAPI;
     import org.alfresco.utility.data.DataUser;
     import org.alfresco.utility.report.Bug;
     import org.springframework.beans.factory.annotation.Autowired;
    @@ -72,9 +70,6 @@ import org.testng.annotations.Test;
      */
     public class RecordFolderTests extends BaseRestTest
     {
    -    @Autowired
    -    public FilePlanComponentAPI filePlanComponentAPI;
    -
         @Autowired
         public DataUser dataUser;
     
    @@ -92,22 +87,21 @@ public class RecordFolderTests extends BaseRestTest
         {
             String CATEGORY = CATEGORY_NAME + getRandomAlphanumeric();
             // Authenticate with admin user
    -        filePlanComponentAPI.usingRestWrapper().authenticateUser(dataUser.getAdminUser());
    -        FilePlanComponent filePlanComponent = createCategory(FILE_PLAN_ALIAS.toString(), CATEGORY);
    +        authenticateUser(dataUser.getAdminUser());
    +        FilePlanComponentModel filePlanComponent = createCategory(FILE_PLAN_ALIAS, CATEGORY);
     
    -        FilePlanComponent recordFolder = FilePlanComponent.builder()
    +        FilePlanComponentModel recordFolder = FilePlanComponentModel.builder()
                     .name(FOLDER_NAME)
    -                .nodeType(RECORD_FOLDER_TYPE.toString())
    +                .nodeType(RECORD_FOLDER_TYPE)
                     .properties(FilePlanComponentProperties.builder()
                             .title(FOLDER_TITLE)
                             .build())
                     .build();
     
             // Create the record folder
    -        FilePlanComponent folder = filePlanComponentAPI.createFilePlanComponent(recordFolder, filePlanComponent.getId());
    +        FilePlanComponentModel folder = getFilePlanComponentsAPI().createFilePlanComponent(recordFolder, filePlanComponent.getId());
     
    -
    -        filePlanComponentAPI.usingRestWrapper().assertStatusCodeIs(CREATED);
    +        assertStatusCodeIs(CREATED);
     
             // Check folder has been created  within the category created
             assertEquals(filePlanComponent.getId(),folder.getParentId());
    @@ -117,7 +111,7 @@ public class RecordFolderTests extends BaseRestTest
             assertTrue(folder.getIsRecordFolder());
     
             assertEquals(folder.getName(), FOLDER_NAME);
    -        assertEquals(folder.getNodeType(), RECORD_FOLDER_TYPE.toString());
    +        assertEquals(folder.getNodeType(), RECORD_FOLDER_TYPE);
             assertEquals(folder.getCreatedByUser().getId(), dataUser.getAdminUser().getUsername());
     
             // Verify the returned file plan component properties
    @@ -140,24 +134,24 @@ public class RecordFolderTests extends BaseRestTest
         public void createFolderIntoSpecialContainers(String filePlanComponent) throws Exception
         {
             // Authenticate with admin user
    -        filePlanComponentAPI.usingRestWrapper().authenticateUser(dataUser.getAdminUser());
    +        authenticateUser(dataUser.getAdminUser());
     
    -        String componentID = filePlanComponentAPI.getFilePlanComponent(filePlanComponent).getId();
    +        String componentID = getFilePlanComponentsAPI().getFilePlanComponent(filePlanComponent).getId();
     
             // Build the record category properties
    -        FilePlanComponent recordFolder = FilePlanComponent.builder()
    +        FilePlanComponentModel recordFolder = FilePlanComponentModel.builder()
                     .name(FOLDER_NAME)
    -                .nodeType(RECORD_FOLDER_TYPE.toString())
    +                .nodeType(RECORD_FOLDER_TYPE)
                     .properties(FilePlanComponentProperties.builder()
                                     .title(FOLDER_TITLE)
                                     .build())
                     .build();
     
             // Create a record folder
    -        filePlanComponentAPI.createFilePlanComponent(recordFolder, componentID);
    +        getFilePlanComponentsAPI().createFilePlanComponent(recordFolder, componentID);
     
             // Check the API Response code
    -        filePlanComponentAPI.usingRestWrapper().assertStatusCodeIs(UNPROCESSABLE_ENTITY);
    +        assertStatusCodeIs(UNPROCESSABLE_ENTITY);
         }
     
         /**
    @@ -173,14 +167,14 @@ public class RecordFolderTests extends BaseRestTest
         {
             String CATEGORY = CATEGORY_NAME + getRandomAlphanumeric();
             // Authenticate with admin user
    -        filePlanComponentAPI.usingRestWrapper().authenticateUser(dataUser.getAdminUser());
    -        FilePlanComponent category = createCategory(FILE_PLAN_ALIAS.toString(), CATEGORY);
    -        FilePlanComponent folder = createFolder(category.getId(),FOLDER_NAME);
    +        authenticateUser(dataUser.getAdminUser());
    +        FilePlanComponentModel category = createCategory(FILE_PLAN_ALIAS, CATEGORY);
    +        FilePlanComponentModel folder = createFolder(category.getId(),FOLDER_NAME);
     
    -        FilePlanComponent folderDetails = filePlanComponentAPI.withParams("include="+IS_CLOSED).getFilePlanComponent(folder.getId());
    +        FilePlanComponentModel folderDetails = getFilePlanComponentsAPI().getFilePlanComponent(folder.getId(), "include=" + IS_CLOSED);
     
             // Verify the returned properties for the file plan component - record folder
    -        assertEquals(RECORD_FOLDER_TYPE.toString(),folderDetails.getNodeType());
    +        assertEquals(RECORD_FOLDER_TYPE, folderDetails.getNodeType());
             assertTrue(folderDetails.getIsRecordFolder());
             assertFalse(folderDetails.getIsCategory());
             assertFalse(folderDetails.getIsFile());
    @@ -190,7 +184,6 @@ public class RecordFolderTests extends BaseRestTest
             assertEquals(dataUser.getAdminUser().getUsername(),folderDetails.getCreatedByUser().getId());
             assertEquals(dataUser.getAdminUser().getUsername(), folderDetails.getModifiedByUser().getId());
             assertEquals(FOLDER_TITLE,folderDetails.getProperties().getTitle());
    -
         }
     
     
    @@ -208,13 +201,15 @@ public class RecordFolderTests extends BaseRestTest
         public void updateTheRecordFolderProperties() throws Exception
         {
             String CATEGORY = CATEGORY_NAME + getRandomAlphanumeric();
    +
             // Authenticate with admin user
    -        filePlanComponentAPI.usingRestWrapper().authenticateUser(dataUser.getAdminUser());
    +        authenticateUser(dataUser.getAdminUser());
    +
             //Create a record category
    -        FilePlanComponent category = createCategory(FILE_PLAN_ALIAS.toString(), CATEGORY);
    +        FilePlanComponentModel category = createCategory(FILE_PLAN_ALIAS, CATEGORY);
     
             //Create a record folder
    -        FilePlanComponent folder = createFolder(category.getId(), FOLDER_NAME);
    +        FilePlanComponentModel folder = createFolder(category.getId(), FOLDER_NAME);
     
             // Create record category first
             String folderDescription = "The folder description is updated" + getRandomAlphanumeric();
    @@ -223,7 +218,7 @@ public class RecordFolderTests extends BaseRestTest
             String location = "Location"+getRandomAlphanumeric();
     
             //Create the file plan component properties to update
    -        FilePlanComponent recordFolder = FilePlanComponent.builder()
    +        FilePlanComponentModel recordFolder = FilePlanComponentModel.builder()
                     .name(folderName)
                     .properties(FilePlanComponentProperties.builder()
                                     .title(folderTitle)
    @@ -235,10 +230,10 @@ public class RecordFolderTests extends BaseRestTest
                     .build();
     
             // Update the record category
    -        FilePlanComponent folderUpdated = filePlanComponentAPI.updateFilePlanComponent(recordFolder, folder.getId());
    +        FilePlanComponentModel folderUpdated = getFilePlanComponentsAPI().updateFilePlanComponent(recordFolder, folder.getId());
     
             // Check the Response Status Code
    -        filePlanComponentAPI.usingRestWrapper().assertStatusCodeIs(OK);
    +        assertStatusCodeIs(OK);
     
             // Verify the returned properties for the file plan component - record folder
             assertEquals(folderName, folderUpdated.getName());
    @@ -265,21 +260,23 @@ public class RecordFolderTests extends BaseRestTest
             String CATEGORY = CATEGORY_NAME + getRandomAlphanumeric();
     
             // Authenticate with admin user
    -        filePlanComponentAPI.usingRestWrapper().authenticateUser(dataUser.getAdminUser());
    +        authenticateUser(dataUser.getAdminUser());
    +
             // Create the record category
    -        FilePlanComponent category = createCategory(FILE_PLAN_ALIAS.toString(), CATEGORY);
    +        FilePlanComponentModel category = createCategory(FILE_PLAN_ALIAS, CATEGORY);
     
             // Create the record folder
    -        FilePlanComponent folder = createFolder(category.getId(), FOLDER_NAME);
    +        FilePlanComponentModel folder = createFolder(category.getId(), FOLDER_NAME);
     
             // Delete the Record folder
    -        filePlanComponentAPI.deleteFilePlanComponent(folder.getId());
    +        getFilePlanComponentsAPI().deleteFilePlanComponent(folder.getId());
             // Check the Response Status Code
    -        filePlanComponentAPI.usingRestWrapper().assertStatusCodeIs(NO_CONTENT);
    +        assertStatusCodeIs(NO_CONTENT);
    +
             // Check the File Plan Component is not found
    -        filePlanComponentAPI.getFilePlanComponent(folder.getId());
    +        getFilePlanComponentsAPI().getFilePlanComponent(folder.getId());
             // Check the Response Status Code
    -        filePlanComponentAPI.usingRestWrapper().assertStatusCodeIs(NOT_FOUND);
    +        assertStatusCodeIs(NOT_FOUND);
         }
     
         /**
    @@ -299,40 +296,40 @@ public class RecordFolderTests extends BaseRestTest
             String CATEGORY = CATEGORY_NAME + getRandomAlphanumeric();
     
             // Authenticate with admin user
    -        filePlanComponentAPI.usingRestWrapper().authenticateUser(dataUser.getAdminUser());
    -        FilePlanComponent category = createCategory(FILE_PLAN_ALIAS.toString(), CATEGORY);
    +        authenticateUser(dataUser.getAdminUser());
    +        FilePlanComponentModel category = createCategory(FILE_PLAN_ALIAS, CATEGORY);
     
             // Add child olders
    -        ArrayList children = new ArrayList();
    +        ArrayList children = new ArrayList();
             for (int i = 0; i < NUMBER_OF_FOLDERS; i++)
             {
                 // Create a child
    -            FilePlanComponent child = createFolder(category.getId(),
    +            FilePlanComponentModel child = createFolder(category.getId(),
                         getRandomAlphanumeric());
                 assertNotNull(child.getId());
                 children.add(child);
             }
     
             // Authenticate with admin user
    -        RestWrapper restWrapper = filePlanComponentAPI.usingRestWrapper().authenticateUser(dataUser.getAdminUser());
    +        authenticateUser(dataUser.getAdminUser());
     
             // List children from API
    -        FilePlanComponentsCollection apiChildren = filePlanComponentAPI.listChildComponents(category.getId());
    +        FilePlanComponentsCollection apiChildren = getFilePlanComponentsAPI().listChildComponents(category.getId());
     
             // Check status code
    -        restWrapper.assertStatusCodeIs(OK);
    +        assertStatusCodeIs(OK);
     
             // Check listed children against created list
             apiChildren.getEntries().forEach(c ->
                     {
    -                    FilePlanComponent filePlanComponent = c.getFilePlanComponent();
    +                    FilePlanComponentModel filePlanComponent = c.getFilePlanComponentModel();
                         assertNotNull(filePlanComponent.getId());
                         logger.info("Checking child " + filePlanComponent.getId());
     
                         try
                         {
                             // Find this child in created children list
    -                        FilePlanComponent createdComponent = children.stream()
    +                        FilePlanComponentModel createdComponent = children.stream()
                                                                          .filter(child -> child.getId().equals(filePlanComponent.getId()))
                                                                          .findFirst()
                                                                          .get();
    @@ -379,18 +376,18 @@ public class RecordFolderTests extends BaseRestTest
             String RELATIVE_PATH = LocalDateTime.now().getYear()+"/"+ LocalDateTime.now().getMonth()+"/"+ LocalDateTime.now().getDayOfMonth();
     
             // Authenticate with admin user
    -        filePlanComponentAPI.usingRestWrapper().authenticateUser(dataUser.getAdminUser());
    +        authenticateUser(dataUser.getAdminUser());
             //The record folder to be created
    -        FilePlanComponent recordFolder = FilePlanComponent.builder()
    +        FilePlanComponentModel recordFolder = FilePlanComponentModel.builder()
                                                               .name(FOLDER_NAME)
    -                                                          .nodeType(RECORD_FOLDER_TYPE.toString())
    +                                                          .nodeType(RECORD_FOLDER_TYPE)
                                                               .relativePath(RELATIVE_PATH)
                                                               .build();
     
             // Create the record folder
    -        FilePlanComponent folder = filePlanComponentAPI.withParams("include="+ PATH).createFilePlanComponent(recordFolder,FILE_PLAN_ALIAS.toString());
    +        FilePlanComponentModel folder = getFilePlanComponentsAPI().createFilePlanComponent(recordFolder, FILE_PLAN_ALIAS, "include=" + PATH);
             //Check the API response code
    -        filePlanComponentAPI.usingRestWrapper().assertStatusCodeIs(CREATED);
    +        assertStatusCodeIs(CREATED);
     
             // Verify the returned properties for the file plan component - record folder
             assertFalse(folder.getIsCategory());
    @@ -400,12 +397,12 @@ public class RecordFolderTests extends BaseRestTest
             //Check the path return contains the RELATIVE_PATH
             assertTrue(folder.getPath().getName().contains(RELATIVE_PATH));
             //check the parent is a category
    -        assertTrue(filePlanComponentAPI.getFilePlanComponent(folder.getParentId()).getIsCategory());
    +        assertTrue(getFilePlanComponentsAPI().getFilePlanComponent(folder.getParentId()).getIsCategory());
     
             //check the created folder from the server
    -        folder=filePlanComponentAPI.withParams("include=" + PATH).getFilePlanComponent(folder.getId());
    +        folder = getFilePlanComponentsAPI().getFilePlanComponent(folder.getId(), "include=" + PATH);
             //Check the API response code
    -        filePlanComponentAPI.usingRestWrapper().assertStatusCodeIs(OK);
    +        assertStatusCodeIs(OK);
             // Verify the returned properties for the file plan component - record folder
             assertFalse(folder.getIsCategory());
             assertFalse(folder.getIsFile());
    @@ -417,16 +414,16 @@ public class RecordFolderTests extends BaseRestTest
             //New Relative Path only a part of containers need to be created before the record folder
             String NEW_RELATIVE_PATH = LocalDateTime.now().getYear() + "/" + LocalDateTime.now().getMonth() + "/" +( LocalDateTime.now().getDayOfMonth()+1);
             //The record folder to be created
    -        FilePlanComponent recordFolder2 = FilePlanComponent.builder()
    +        FilePlanComponentModel recordFolder2 = FilePlanComponentModel.builder()
                                                               .name(FOLDER_NAME)
    -                                                          .nodeType(RECORD_FOLDER_TYPE.toString())
    +                                                          .nodeType(RECORD_FOLDER_TYPE)
                                                               .relativePath(NEW_RELATIVE_PATH)
                                                               .build();
     
             // Create the record folder
    -        FilePlanComponent folder2 = filePlanComponentAPI.withParams("include=" + PATH).createFilePlanComponent(recordFolder2, FILE_PLAN_ALIAS.toString());
    +        FilePlanComponentModel folder2 = getFilePlanComponentsAPI().createFilePlanComponent(recordFolder2, FILE_PLAN_ALIAS, "include=" + PATH);
             //Check the API response code
    -        filePlanComponentAPI.usingRestWrapper().assertStatusCodeIs(CREATED);
    +        assertStatusCodeIs(CREATED);
     
             // Verify the returned properties for the file plan component - record folder
             assertFalse(folder2.getIsCategory());
    @@ -436,12 +433,12 @@ public class RecordFolderTests extends BaseRestTest
             assertTrue(folder2.getPath().getName().contains(NEW_RELATIVE_PATH));
     
             //check the parent is a category
    -        assertTrue(filePlanComponentAPI.getFilePlanComponent(folder.getParentId()).getIsCategory());
    +        assertTrue(getFilePlanComponentsAPI().getFilePlanComponent(folder.getParentId()).getIsCategory());
     
             // Check the folder created on the server
    -        folder2 = filePlanComponentAPI.withParams("include=" + PATH).getFilePlanComponent(folder2.getId());
    +        folder2 = getFilePlanComponentsAPI().getFilePlanComponent(folder2.getId(), "include=" + PATH);
             //Check the API response code
    -        filePlanComponentAPI.usingRestWrapper().assertStatusCodeIs(OK);
    +        assertStatusCodeIs(OK);
     
             // Verify the returned properties for the file plan component - record folder
             assertFalse(folder2.getIsCategory());
    @@ -454,12 +451,12 @@ public class RecordFolderTests extends BaseRestTest
         @AfterClass (alwaysRun = true)
         public void tearDown() throws Exception
         {
    -        filePlanComponentAPI.usingRestWrapper().authenticateUser(dataUser.getAdminUser());
    -        filePlanComponentAPI.listChildComponents(FILE_PLAN_ALIAS.toString()).getEntries().forEach(filePlanComponentEntry ->
    +        authenticateUser(dataUser.getAdminUser());
    +        getFilePlanComponentsAPI().listChildComponents(FILE_PLAN_ALIAS).getEntries().forEach(filePlanComponentEntry ->
             {
                 try
                 {
    -                filePlanComponentAPI.deleteFilePlanComponent(filePlanComponentEntry.getFilePlanComponent().getId());
    +                getFilePlanComponentsAPI().deleteFilePlanComponent(filePlanComponentEntry.getFilePlanComponentModel().getId());
                 }
                 catch (Exception e)
                 {
    @@ -467,7 +464,4 @@ public class RecordFolderTests extends BaseRestTest
                 }
             });
         }
    -
    -
    -
     }
    diff --git a/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/fileplancomponents/UnfiledRecordsFolderTests.java b/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/fileplancomponents/UnfiledRecordsFolderTests.java
    index d008d5fbae..53fa557042 100644
    --- a/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/fileplancomponents/UnfiledRecordsFolderTests.java
    +++ b/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/fileplancomponents/UnfiledRecordsFolderTests.java
    @@ -48,13 +48,10 @@ import static org.testng.Assert.assertTrue;
     import java.util.List;
     import java.util.stream.Collectors;
     
    -import org.alfresco.rest.core.RestWrapper;
     import org.alfresco.rest.rm.community.base.BaseRestTest;
    -import org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponent;
    +import org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentModel;
     import org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentProperties;
    -import org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentType;
     import org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentsCollection;
    -import org.alfresco.rest.rm.community.requests.FilePlanComponentAPI;
     import org.alfresco.utility.data.DataUser;
     import org.springframework.beans.factory.annotation.Autowired;
     import org.testng.annotations.DataProvider;
    @@ -68,9 +65,6 @@ import org.testng.annotations.Test;
      */
     public class UnfiledRecordsFolderTests extends BaseRestTest
     {
    -    @Autowired
    -    private FilePlanComponentAPI filePlanComponentAPI;
    -
         @Autowired
         private DataUser dataUser;
     
    @@ -100,27 +94,26 @@ public class UnfiledRecordsFolderTests extends BaseRestTest
         public void createRootUnfiledRecordsFolder() throws Exception
         {
             // Authenticate with admin user
    -        filePlanComponentAPI.usingRestWrapper().authenticateUser(dataUser.getAdminUser());
    +        authenticateUser(dataUser.getAdminUser());
     
             String folderName = "Folder " + getRandomAlphanumeric();
             String folderTitle = folderName + " Title";
             String folderDescription = folderName + " Description";
     
             // Build unfiled records folder properties
    -        FilePlanComponent unfiledFolder = FilePlanComponent.builder()
    +        FilePlanComponentModel unfiledFolder = FilePlanComponentModel.builder()
                     .name(folderName)
    -                .nodeType(UNFILED_RECORD_FOLDER_TYPE.toString())
    +                .nodeType(UNFILED_RECORD_FOLDER_TYPE)
                     .properties(FilePlanComponentProperties.builder()
                                     .title(folderTitle)
                                     .description(folderDescription)
                                     .build())
                     .build();
     
    -        FilePlanComponent filePlanComponent = filePlanComponentAPI.createFilePlanComponent(unfiledFolder,
    -            UNFILED_RECORDS_CONTAINER_ALIAS.toString());
    +        FilePlanComponentModel filePlanComponent = getFilePlanComponentsAPI().createFilePlanComponent(unfiledFolder, UNFILED_RECORDS_CONTAINER_ALIAS);
     
             // Verify the status code
    -        filePlanComponentAPI.usingRestWrapper().assertStatusCodeIs(CREATED);
    +        assertStatusCodeIs(CREATED);
     
             // Verify the returned file plan component
             assertFalse(filePlanComponent.getIsCategory());
    @@ -128,7 +121,7 @@ public class UnfiledRecordsFolderTests extends BaseRestTest
             assertFalse(filePlanComponent.getIsRecordFolder()); // it is not a _normal_ record folder!
     
             assertEquals(filePlanComponent.getName(), folderName);
    -        assertEquals(filePlanComponent.getNodeType(), UNFILED_RECORD_FOLDER_TYPE.toString());
    +        assertEquals(filePlanComponent.getNodeType(), UNFILED_RECORD_FOLDER_TYPE);
     
             assertEquals(filePlanComponent.getCreatedByUser().getId(), dataUser.getAdminUser().getUsername());
     
    @@ -146,20 +139,20 @@ public class UnfiledRecordsFolderTests extends BaseRestTest
             dataProvider = "invalidRootTypes",
             description = "Only unfiled records folders can be created at unfiled records root level"
         )
    -    public void onlyRecordFoldersCanBeCreatedAtUnfiledRecordsRoot(FilePlanComponentType componentType)
    +    public void onlyRecordFoldersCanBeCreatedAtUnfiledRecordsRoot(String filePlanComponentType)
         {
    -        filePlanComponentAPI.usingRestWrapper().authenticateUser(dataUser.getAdminUser());
    +        authenticateUser(dataUser.getAdminUser());
     
             String folderName = "Folder " + getRandomAlphanumeric();
             String folderTitle = folderName + " Title";
             String folderDescription = folderName + " Description";
     
    -        logger.info("creating " + componentType.toString());
    +        logger.info("creating " + filePlanComponentType);
     
             // Build unfiled records folder properties
    -        FilePlanComponent unfiledFolder = FilePlanComponent.builder()
    +        FilePlanComponentModel unfiledFolder = FilePlanComponentModel.builder()
                 .name(folderName)
    -            .nodeType(componentType.toString())
    +            .nodeType(filePlanComponentType)
                 .properties(FilePlanComponentProperties.builder()
                                 .title(folderTitle)
                                 .description(folderDescription)
    @@ -168,15 +161,14 @@ public class UnfiledRecordsFolderTests extends BaseRestTest
     
             try
             {
    -            filePlanComponentAPI.createFilePlanComponent(unfiledFolder,
    -                UNFILED_RECORDS_CONTAINER_ALIAS.toString());
    +            getFilePlanComponentsAPI().createFilePlanComponent(unfiledFolder, UNFILED_RECORDS_CONTAINER_ALIAS);
             }
             catch (Exception error)
             {
             }
     
             // Verify the status code
    -        filePlanComponentAPI.usingRestWrapper().assertStatusCodeIs(UNPROCESSABLE_ENTITY);
    +        assertStatusCodeIs(UNPROCESSABLE_ENTITY);
         }
     
         /**
    @@ -189,7 +181,7 @@ public class UnfiledRecordsFolderTests extends BaseRestTest
         @Test(description = "Child unfiled records folder can be created in a parent unfiled records folder")
         public void childUnfiledRecordsFolderCanBeCreated() throws Exception
         {
    -        RestWrapper restWrapper = filePlanComponentAPI.usingRestWrapper().authenticateUser(dataUser.getAdminUser());
    +        authenticateUser(dataUser.getAdminUser());
     
             String parentFolderName = "Parent Folder " + getRandomAlphanumeric();
             String childFolderName = "Child Folder " + getRandomAlphanumeric();
    @@ -197,13 +189,13 @@ public class UnfiledRecordsFolderTests extends BaseRestTest
             String childFolderDescription = childFolderName + " Description";
     
             // No need for fine control, create it using utility function
    -        FilePlanComponent parentFolder = createUnfiledRecordsFolder(UNFILED_RECORDS_CONTAINER_ALIAS.toString(), parentFolderName);
    +        FilePlanComponentModel parentFolder = createUnfiledRecordsFolder(UNFILED_RECORDS_CONTAINER_ALIAS, parentFolderName);
             assertEquals(parentFolderName, parentFolder.getName());
     
             // Build the unfiled records folder properties
    -        FilePlanComponent unfiledFolder = FilePlanComponent.builder()
    +        FilePlanComponentModel unfiledFolder = FilePlanComponentModel.builder()
                     .name(childFolderName)
    -                .nodeType(UNFILED_RECORD_FOLDER_TYPE.toString())
    +                .nodeType(UNFILED_RECORD_FOLDER_TYPE)
                     .properties(FilePlanComponentProperties.builder()
                             .title(childFolderTitle)
                             .description(childFolderDescription)
    @@ -211,11 +203,10 @@ public class UnfiledRecordsFolderTests extends BaseRestTest
                     .build();
     
             // Create it as a child of parentFolder
    -        FilePlanComponent childFolder = filePlanComponentAPI.createFilePlanComponent(unfiledFolder,
    -            parentFolder.getId());
    +        FilePlanComponentModel childFolder = getFilePlanComponentsAPI().createFilePlanComponent(unfiledFolder, parentFolder.getId());
     
             // Verify the status code
    -        restWrapper.assertStatusCodeIs(CREATED);
    +        assertStatusCodeIs(CREATED);
     
             // Verify the returned file plan component
             assertFalse(childFolder.getIsCategory());
    @@ -223,7 +214,7 @@ public class UnfiledRecordsFolderTests extends BaseRestTest
             assertFalse(childFolder.getIsRecordFolder()); // it is not a _normal_ record folder!
     
             assertEquals(childFolder.getName(), childFolderName);
    -        assertEquals(childFolder.getNodeType(), UNFILED_RECORD_FOLDER_TYPE.toString());
    +        assertEquals(childFolder.getNodeType(), UNFILED_RECORD_FOLDER_TYPE);
             assertEquals(childFolder.getCreatedByUser().getId(), dataUser.getAdminUser().getUsername());
     
             // Verify the returned file plan component properties
    @@ -236,11 +227,11 @@ public class UnfiledRecordsFolderTests extends BaseRestTest
     
             // Does child's parent point to it?
             // Perform another call as our parentFolder had been executed before childFolder existed
    -        FilePlanComponentsCollection parentsChildren = filePlanComponentAPI.listChildComponents(parentFolder.getId());
    -        restWrapper.assertStatusCodeIs(OK);
    +        FilePlanComponentsCollection parentsChildren = getFilePlanComponentsAPI().listChildComponents(parentFolder.getId());
    +        assertStatusCodeIs(OK);
             List childIds = parentsChildren.getEntries()
                 .stream()
    -            .map(c -> c.getFilePlanComponent().getId())
    +            .map(c -> c.getFilePlanComponentModel().getId())
                 .collect(Collectors.toList());
     
             // Child folder is listed in parent
    @@ -260,16 +251,16 @@ public class UnfiledRecordsFolderTests extends BaseRestTest
         @Test(description = "Unfiled record folder")
         public void editUnfiledRecordsFolder() throws Exception
         {
    -        RestWrapper restWrapper = filePlanComponentAPI.usingRestWrapper().authenticateUser(dataUser.getAdminUser());
    +        authenticateUser(dataUser.getAdminUser());
             String modified = "Modified ";
             String folderName = "Folder To Modify" + getRandomAlphanumeric();
     
             // No need for fine control, create it using utility function
    -        FilePlanComponent folderToModify = createUnfiledRecordsFolder(UNFILED_RECORDS_CONTAINER_ALIAS.toString(), folderName);
    +        FilePlanComponentModel folderToModify = createUnfiledRecordsFolder(UNFILED_RECORDS_CONTAINER_ALIAS, folderName);
             assertEquals(folderName, folderToModify.getName());
     
             // Build the properties which will be updated
    -        FilePlanComponent folderToUpdate = FilePlanComponent.builder()
    +        FilePlanComponentModel folderToUpdate = FilePlanComponentModel.builder()
                 .name(modified + folderToModify.getName())
                 .properties(FilePlanComponentProperties.builder().
                         title(modified + folderToModify.getProperties().getTitle()).
    @@ -278,12 +269,12 @@ public class UnfiledRecordsFolderTests extends BaseRestTest
                 .build();
     
             // Update the unfiled records folder
    -        filePlanComponentAPI.updateFilePlanComponent(folderToUpdate, folderToModify.getId());
    +        getFilePlanComponentsAPI().updateFilePlanComponent(folderToUpdate, folderToModify.getId());
             // Verify the status code
    -        restWrapper.assertStatusCodeIs(OK);
    +        assertStatusCodeIs(OK);
     
             // This is to ensure the change was actually applied, rather than simply trusting the object returned by PUT
    -        FilePlanComponent renamedFolder = filePlanComponentAPI.getFilePlanComponent(folderToModify.getId());
    +        FilePlanComponentModel renamedFolder = getFilePlanComponentsAPI().getFilePlanComponent(folderToModify.getId());
     
             // Verify the returned file plan component
             assertEquals(modified + folderToModify.getName(), renamedFolder.getName());
    @@ -301,21 +292,21 @@ public class UnfiledRecordsFolderTests extends BaseRestTest
         @Test(description = "Delete unfiled record folder")
         public void deleteUnfiledRecordsFolder() throws Exception
         {
    -        RestWrapper restWrapper = filePlanComponentAPI.usingRestWrapper().authenticateUser(dataUser.getAdminUser());
    +        authenticateUser(dataUser.getAdminUser());
             String folderName = "Folder To Delete" + getRandomAlphanumeric();
     
             // Create folderToDelete
    -        FilePlanComponent folderToDelete = createUnfiledRecordsFolder(UNFILED_RECORDS_CONTAINER_ALIAS.toString(), folderName);
    +        FilePlanComponentModel folderToDelete = createUnfiledRecordsFolder(UNFILED_RECORDS_CONTAINER_ALIAS, folderName);
             assertEquals(folderName, folderToDelete.getName());
     
             // Delete folderToDelete
    -        filePlanComponentAPI.deleteFilePlanComponent(folderToDelete.getId());
    +        getFilePlanComponentsAPI().deleteFilePlanComponent(folderToDelete.getId());
     
             // Verify the status code
    -        restWrapper.assertStatusCodeIs(NO_CONTENT);
    +        assertStatusCodeIs(NO_CONTENT);
     
             // Deleted component should no longer be retrievable
    -        filePlanComponentAPI.getFilePlanComponent(folderToDelete.getId());
    -        restWrapper.assertStatusCodeIs(NOT_FOUND);
    +        getFilePlanComponentsAPI().getFilePlanComponent(folderToDelete.getId());
    +        assertStatusCodeIs(NOT_FOUND);
         }
     }
    diff --git a/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/site/RMSiteTests.java b/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/site/RMSiteTests.java
    index cb562d6525..8b46820486 100644
    --- a/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/site/RMSiteTests.java
    +++ b/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/site/RMSiteTests.java
    @@ -43,10 +43,8 @@ import static org.testng.Assert.assertEquals;
     import static org.testng.Assert.assertNotNull;
     
     import org.alfresco.dataprep.UserService;
    -import org.alfresco.rest.core.RestWrapper;
     import org.alfresco.rest.rm.community.base.BaseRestTest;
    -import org.alfresco.rest.rm.community.model.site.RMSite;
    -import org.alfresco.rest.rm.community.requests.RMSiteAPI;
    +import org.alfresco.rest.rm.community.model.site.RMSiteModel;
     import org.alfresco.utility.constants.UserRole;
     import org.alfresco.utility.data.DataUser;
     import org.alfresco.utility.data.RandomData;
    @@ -67,9 +65,6 @@ public class RMSiteTests extends BaseRestTest
         @Autowired
         private UserService userService;
     
    -    @Autowired
    -    private RMSiteAPI rmSiteAPI;
    -
         @Autowired
         private DataUser dataUser;
     
    @@ -85,24 +80,24 @@ public class RMSiteTests extends BaseRestTest
         public void createRMSiteAsAdminUser() throws Exception
         {
             // Authenticate with admin user
    -        rmSiteAPI.usingRestWrapper().authenticateUser(dataUser.getAdminUser());
    +        authenticateUser(dataUser.getAdminUser());
     
             // Check if the RM site exists
    -        if (rmSiteAPI.existsRMSite())
    +        if (getRMSiteAPI().existsRMSite())
             {
                 // Delete the RM site
    -            rmSiteAPI.deleteRMSite();
    +            getRMSiteAPI().deleteRMSite();
             }
     
             // Create the RM site
    -        RMSite rmSite =RMSite.builder().compliance(STANDARD).build();
    -        rmSite.setTitle(RM_TITLE);
    -        rmSite.setDescription(RM_DESCRIPTION);
    +        RMSiteModel rmSiteModel = RMSiteModel.builder().compliance(STANDARD).build();
    +        rmSiteModel.setTitle(RM_TITLE);
    +        rmSiteModel.setDescription(RM_DESCRIPTION);
     
    -        RMSite rmSiteResponse = rmSiteAPI.createRMSite(rmSite);
    +        RMSiteModel rmSiteResponse = getRMSiteAPI().createRMSite(rmSiteModel);
     
             // Verify the status code
    -        rmSiteAPI.usingRestWrapper().assertStatusCodeIs(CREATED);
    +        assertStatusCodeIs(CREATED);
     
             // Verify the returned file plan component
             assertEquals(rmSiteResponse.getId(), RM_ID);
    @@ -128,21 +123,21 @@ public class RMSiteTests extends BaseRestTest
             createRMSiteIfNotExists();
     
             // Authenticate with admin user
    -        RestWrapper restWrapper = rmSiteAPI.usingRestWrapper().authenticateUser(dataUser.getAdminUser());
    +        authenticateUser(dataUser.getAdminUser());
     
             // Construct new properties
             String newTitle = RM_TITLE + "createRMSiteWhenSiteExists";
             String newDescription = RM_DESCRIPTION + "createRMSiteWhenSiteExists";
     
             // Create the RM site
    -        RMSite rmSite = RMSite.builder().compliance(STANDARD).build();
    -        rmSite.setTitle(newTitle);
    -        rmSite.setDescription(newDescription);
    +        RMSiteModel rmSiteModel = RMSiteModel.builder().compliance(STANDARD).build();
    +        rmSiteModel.setTitle(newTitle);
    +        rmSiteModel.setDescription(newDescription);
     
    -        rmSiteAPI.createRMSite(rmSite);
    +        getRMSiteAPI().createRMSite(rmSiteModel);
     
             // Verify the status code
    -        restWrapper.assertStatusCodeIs(CONFLICT);
    +        assertStatusCodeIs(CONFLICT);
         }
     
         /**
    @@ -157,13 +152,13 @@ public class RMSiteTests extends BaseRestTest
         public void deleteRMSite() throws Exception
         {
             // Authenticate with admin user
    -        RestWrapper restWrapper = rmSiteAPI.usingRestWrapper().authenticateUser(dataUser.getAdminUser());
    +        authenticateUser(dataUser.getAdminUser());
     
             // Delete the RM site
    -        rmSiteAPI.deleteRMSite();
    +        getRMSiteAPI().deleteRMSite();
     
             // Verify the status code
    -        restWrapper.assertStatusCodeIs(NO_CONTENT);
    +        assertStatusCodeIs(NO_CONTENT);
         }
     
         /**
    @@ -178,26 +173,26 @@ public class RMSiteTests extends BaseRestTest
         public void getRMSite() throws Exception
         {
             // Authenticate with admin user
    -        RestWrapper restWrapper = rmSiteAPI.usingRestWrapper().authenticateUser(dataUser.getAdminUser());
    +        authenticateUser(dataUser.getAdminUser());
     
             // Check if RM site exists
    -        if (!rmSiteAPI.existsRMSite())
    +        if (!getRMSiteAPI().existsRMSite())
             {
                 // Verify the status code when RM site  doesn't exist
    -            restWrapper.assertStatusCodeIs(NOT_FOUND);
    +            assertStatusCodeIs(NOT_FOUND);
                 createRMSiteIfNotExists();
             }
             else
             {
                 // Get the RM site
    -            RMSite rmSite = rmSiteAPI.getSite();
    +            RMSiteModel rmSiteModel = getRMSiteAPI().getSite();
     
                 // Verify the status code
    -            restWrapper.assertStatusCodeIs(OK);
    -            assertEquals(rmSite.getId(), RM_ID);
    -            assertEquals(rmSite.getDescription(), RM_DESCRIPTION);
    -            assertEquals(rmSite.getCompliance(), STANDARD);
    -            assertEquals(rmSite.getVisibility(), PUBLIC);
    +            assertStatusCodeIs(OK);
    +            assertEquals(rmSiteModel.getId(), RM_ID);
    +            assertEquals(rmSiteModel.getDescription(), RM_DESCRIPTION);
    +            assertEquals(rmSiteModel.getCompliance(), STANDARD);
    +            assertEquals(rmSiteModel.getVisibility(), PUBLIC);
             }
         }
     
    @@ -214,17 +209,17 @@ public class RMSiteTests extends BaseRestTest
         public void createRMSiteAsAnotherAdminUser() throws Exception
         {
             // Authenticate with admin user
    -        rmSiteAPI.usingRestWrapper().authenticateUser(dataUser.getAdminUser());
    +        authenticateUser(dataUser.getAdminUser());
     
             // Check if the RM site exists
    -        if (rmSiteAPI.existsRMSite())
    +        if (getRMSiteAPI().existsRMSite())
             {
                 // Delete the RM site
    -            rmSiteAPI.deleteRMSite();
    +            getRMSiteAPI().deleteRMSite();
             }
     
             // Disconnect the current user from the API session
    -        rmSiteAPI.usingRestWrapper().disconnect();
    +        disconnect();
     
             // Create user
             userService.create(dataUser.getAdminUser().getUsername(),
    @@ -239,24 +234,24 @@ public class RMSiteTests extends BaseRestTest
             UserModel userModel = new UserModel(ANOTHER_ADMIN,DEFAULT_PASSWORD);
     
             // Authenticate as that new user
    -        rmSiteAPI.usingRestWrapper().authenticateUser(userModel);
    +        authenticateUser(userModel);
     
             // Create the RM site
    -        RMSite rmSite = RMSite.builder().compliance(DOD5015).build();
    -        rmSite.setTitle(RM_TITLE);
    -        rmSite.setDescription(RM_DESCRIPTION);
    -        rmSite=rmSiteAPI.createRMSite(rmSite);
    +        RMSiteModel rmSiteModel = RMSiteModel.builder().compliance(DOD5015).build();
    +        rmSiteModel.setTitle(RM_TITLE);
    +        rmSiteModel.setDescription(RM_DESCRIPTION);
    +        rmSiteModel = getRMSiteAPI().createRMSite(rmSiteModel);
     
             // Verify the status code
    -        rmSiteAPI.usingRestWrapper().assertStatusCodeIs(CREATED);
    +        assertStatusCodeIs(CREATED);
     
             // Verify the returned file plan component
    -        assertEquals(rmSite.getId(), RM_ID);
    -        assertEquals(rmSite.getTitle(), RM_TITLE);
    -        assertEquals(rmSite.getDescription(), RM_DESCRIPTION);
    -        assertEquals(rmSite.getCompliance(), DOD5015);
    -        assertEquals(rmSite.getVisibility(), PUBLIC);
    -        assertEquals(rmSite.getRole(), UserRole.SiteManager.toString());
    +        assertEquals(rmSiteModel.getId(), RM_ID);
    +        assertEquals(rmSiteModel.getTitle(), RM_TITLE);
    +        assertEquals(rmSiteModel.getDescription(), RM_DESCRIPTION);
    +        assertEquals(rmSiteModel.getCompliance(), DOD5015);
    +        assertEquals(rmSiteModel.getVisibility(), PUBLIC);
    +        assertEquals(rmSiteModel.getRole(), UserRole.SiteManager.toString());
         }
     
         /**
    @@ -270,52 +265,52 @@ public class RMSiteTests extends BaseRestTest
         public void updateRMSiteDetails()throws Exception
         {
             String NEW_TITLE = RM_TITLE + RandomData.getRandomAlphanumeric();
    -        String NEW_DESCRIPTION = RM_DESCRIPTION+ RandomData.getRandomAlphanumeric();
    +        String NEW_DESCRIPTION = RM_DESCRIPTION + RandomData.getRandomAlphanumeric();
     
             // Authenticate with admin user
    -        rmSiteAPI.usingRestWrapper().authenticateUser(dataUser.getAdminUser());
    +        authenticateUser(dataUser.getAdminUser());
     
             // Create the site if it does not exist
             createRMSiteIfNotExists();
     
    -        //Create RM site model
    -        RMSite rmSiteToUpdate = new RMSite();
    +        // Create RM site model
    +        RMSiteModel rmSiteToUpdate = RMSiteModel.builder().build();
             rmSiteToUpdate.setTitle(NEW_TITLE);
             rmSiteToUpdate.setDescription(NEW_DESCRIPTION);
     
             // Disconnect the user from the API session
    -        rmSiteAPI.usingRestWrapper().disconnect();
    +        disconnect();
     
             // Create a random user
             UserModel nonRMuser = dataUser.createRandomTestUser("testUser");
     
             // Authenticate as that random user
    -        rmSiteAPI.usingRestWrapper().authenticateUser(nonRMuser);
    +        authenticateUser(nonRMuser);
     
             // Create the RM site
    -        rmSiteAPI.updateRMSite(rmSiteToUpdate);
    +        getRMSiteAPI().updateRMSite(rmSiteToUpdate);
     
             // Verify the status code
    -        rmSiteAPI.usingRestWrapper().assertStatusCodeIs(FORBIDDEN);
    +        assertStatusCodeIs(FORBIDDEN);
     
             // Disconnect the user from the API session
    -        rmSiteAPI.usingRestWrapper().disconnect();
    +        disconnect();
     
             // Authenticate with admin user
    -        rmSiteAPI.usingRestWrapper().authenticateUser(dataUser.getAdminUser());
    +        authenticateUser(dataUser.getAdminUser());
     
             // Update the RM Site
    -        RMSite rmSite = rmSiteAPI.updateRMSite(rmSiteToUpdate);
    +        RMSiteModel rmSiteModel = getRMSiteAPI().updateRMSite(rmSiteToUpdate);
     
             // Verify the response status code
    -        rmSiteAPI.usingRestWrapper().assertStatusCodeIs(OK);
    +        assertStatusCodeIs(OK);
     
             // Verify the returned file plan component
    -        assertEquals(rmSite.getId(), RM_ID);
    -        assertEquals(rmSite.getTitle(), NEW_TITLE);
    -        assertEquals(rmSite.getDescription(), NEW_DESCRIPTION);
    -        assertNotNull(rmSite.getCompliance());
    -        assertEquals(rmSite.getVisibility(), PUBLIC);
    +        assertEquals(rmSiteModel.getId(), RM_ID);
    +        assertEquals(rmSiteModel.getTitle(), NEW_TITLE);
    +        assertEquals(rmSiteModel.getDescription(), NEW_DESCRIPTION);
    +        assertNotNull(rmSiteModel.getCompliance());
    +        assertEquals(rmSiteModel.getVisibility(), PUBLIC);
         }
     
         /**
    @@ -327,18 +322,18 @@ public class RMSiteTests extends BaseRestTest
         public void updateRMSiteComplianceAsAdmin() throws Exception
         {
             // Authenticate with admin user
    -        rmSiteAPI.usingRestWrapper().authenticateUser(dataUser.getAdminUser());
    +        authenticateUser(dataUser.getAdminUser());
     
             // Create the RM site if it does not exist
             createRMSiteIfNotExists();
     
             // Build the RM site properties
    -        RMSite rmSiteToUpdate =  RMSite.builder().compliance(DOD5015).build();
    +        RMSiteModel rmSiteToUpdate =  RMSiteModel.builder().compliance(DOD5015).build();
     
             // Update the RM site
    -        rmSiteAPI.updateRMSite(rmSiteToUpdate);
    +        getRMSiteAPI().updateRMSite(rmSiteToUpdate);
     
             // Verify the response status code
    -        rmSiteAPI.usingRestWrapper().assertStatusCodeIs(BAD_REQUEST);
    +        assertStatusCodeIs(BAD_REQUEST);
         }
     }
    
    From 8e81ff9e10d5f6889000dea5122185c7a2c5983f Mon Sep 17 00:00:00 2001
    From: Tuna Aksoy 
    Date: Sun, 25 Dec 2016 00:05:40 +0000
    Subject: [PATCH 3/9] RM-4488 (Refactor REST API Automation test code according
     to the latest changes)
    
    ---
     .../rest/rm/community/requests/RMSite.java    |   7 -
     .../rest/rm/community/requests/RMUserAPI.java |  69 +++++-
     .../rest/rm/community/base/BaseRestTest.java  | 230 ++++++++----------
     .../rest/rm/community/base/TestData.java      |   2 +-
     .../fileplancomponents/DeleteRecordTests.java |  85 ++-----
     .../ElectronicRecordTests.java                |  65 ++---
     .../fileplancomponents/FilePlanTests.java     |  62 +----
     .../NonElectronicRecordTests.java             |  46 +---
     .../RecordCategoryTest.java                   |  37 +--
     .../fileplancomponents/RecordFolderTests.java |  53 ++--
     .../UnfiledRecordsFolderTests.java            |  23 +-
     .../rest/rm/community/site/RMSiteTests.java   | 106 ++------
     .../utils/FilePlanComponentsUtil.java         | 101 ++++++++
     .../rest/rm/community/utils/RMSiteUtil.java   |  87 +++++++
     14 files changed, 488 insertions(+), 485 deletions(-)
     create mode 100644 rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/utils/FilePlanComponentsUtil.java
     create mode 100644 rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/utils/RMSiteUtil.java
    
    diff --git a/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/requests/RMSite.java b/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/requests/RMSite.java
    index 3cb203261f..adff114ef2 100644
    --- a/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/requests/RMSite.java
    +++ b/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/requests/RMSite.java
    @@ -38,8 +38,6 @@ import static org.springframework.http.HttpStatus.OK;
     
     import org.alfresco.rest.core.RMRestWrapper;
     import org.alfresco.rest.rm.community.model.site.RMSiteModel;
    -import org.alfresco.utility.data.DataUser;
    -import org.springframework.beans.factory.annotation.Autowired;
     
     /**
      * FIXME!!!
    @@ -49,10 +47,6 @@ import org.springframework.beans.factory.annotation.Autowired;
      */
     public class RMSite extends RMModelRequest
     {
    -    // FIXME!!!
    -    @Autowired
    -    private DataUser dataUser;
    -
         /**
          * @param restWrapper
          */
    @@ -163,7 +157,6 @@ public class RMSite extends RMModelRequest
          */
         public boolean existsRMSite() throws Exception
         {
    -        getRMRestWrapper().authenticateUser(dataUser.getAdminUser());
             getSite();
             return getRMRestWrapper().getStatusCode().equals(OK.toString());
         }
    diff --git a/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/requests/RMUserAPI.java b/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/requests/RMUserAPI.java
    index 07ac74f0c1..9a58f13f37 100644
    --- a/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/requests/RMUserAPI.java
    +++ b/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/requests/RMUserAPI.java
    @@ -28,14 +28,21 @@ package org.alfresco.rest.rm.community.requests;
     
     import static com.jayway.restassured.RestAssured.given;
     
    +import static org.jglue.fluentjson.JsonBuilderFactory.buildObject;
    +
    +import com.google.gson.JsonObject;
     import com.jayway.restassured.builder.RequestSpecBuilder;
    +import com.jayway.restassured.http.ContentType;
     import com.jayway.restassured.response.Response;
     import com.jayway.restassured.specification.RequestSpecification;
     
     import org.alfresco.dataprep.AlfrescoHttpClient;
     import org.alfresco.dataprep.AlfrescoHttpClientFactory;
    +import org.alfresco.dataprep.UserService;
     import org.alfresco.rest.core.RestAPI;
    +import org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentModel;
     import org.alfresco.utility.data.DataUser;
    +import org.alfresco.utility.model.UserModel;
     import org.springframework.beans.factory.annotation.Autowired;
     import org.springframework.context.annotation.Scope;
     import org.springframework.stereotype.Component;
    @@ -47,12 +54,15 @@ import org.springframework.stereotype.Component;
      * @since 2.6
      */
     // FIXME: As of December 2016 there is no v1-style API for managing RM users and users'
    -// roles. Until such APIs have become available, methods in this class are just proxies to
    +// roles/permissions. Until such APIs have become available, methods in this class are just proxies to
     // "old-style" API calls.
     @Component
     @Scope (value = "prototype")
     public class RMUserAPI extends RestAPI
     {
    +    @Autowired
    +    private UserService userService;
    +
         @Autowired
         private DataUser dataUser;
     
    @@ -83,4 +93,61 @@ public class RMUserAPI extends RestAPI
                 .andReturn();
             usingRestWrapper().setStatusCode(Integer.toString(response.getStatusCode()));
         }
    +
    +    /**
    +     * Helper method to add permission on a component to user
    +     * @param component {@link FilePlanComponent} on which permission should be given
    +     * @param user {@link UserModel} for a user to be granted permission
    +     * @param permission {@link UserPermissions} to be granted
    +     */
    +    public void addUserPermission(FilePlanComponentModel component, UserModel user, String permission)
    +    {
    +        // get an "old-style" REST API client
    +        AlfrescoHttpClient client = alfrescoHttpClientFactory.getObject();
    +
    +        JsonObject bodyJson = buildObject()
    +            .addArray("permissions")
    +                .addObject()
    +                    .add("authority", user.getUsername())
    +                    .add("role", permission)
    +                    .end()
    +                    .getJson();
    +
    +        // override v1 baseURI and basePath
    +        RequestSpecification spec = new RequestSpecBuilder()
    +            .setBaseUri(client.getApiUrl())
    +            .setBasePath("/")
    +            .build();
    +
    +        // execute an "old-style" API call
    +        Response response = given()
    +            .spec(spec)
    +            .auth().basic(dataUser.getAdminUser().getUsername(), dataUser.getAdminUser().getPassword())
    +            .contentType(ContentType.JSON)
    +            .body(bodyJson.toString())
    +            .pathParam("nodeId", component.getId())
    +            .log().all()
    +        .when()
    +            .post("/node/workspace/SpacesStore/{nodeId}/rmpermissions")
    +            .prettyPeek()
    +            .andReturn();
    +        usingRestWrapper().setStatusCode(Integer.toString(response.getStatusCode()));
    +    }
    +
    +    /**
    +     * FIXME!!!
    +     *
    +     * @param userName FIXME!!!
    +     * @return FIXME!!!
    +     */
    +    public boolean createUser(String userName)
    +    {
    +        return userService.create(dataUser.getAdminUser().getUsername(),
    +                dataUser.getAdminUser().getPassword(),
    +                userName,
    +                "password",
    +                "default@alfresco.com",
    +                userName,
    +                userName);
    +    }
     }
    diff --git a/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/base/BaseRestTest.java b/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/base/BaseRestTest.java
    index bd08761bb6..a7d5ccadf8 100644
    --- a/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/base/BaseRestTest.java
    +++ b/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/base/BaseRestTest.java
    @@ -26,8 +26,6 @@
      */
     package org.alfresco.rest.rm.community.base;
     
    -import static com.jayway.restassured.RestAssured.given;
    -
     import static org.alfresco.rest.rm.community.base.TestData.CATEGORY_TITLE;
     import static org.alfresco.rest.rm.community.base.TestData.FOLDER_TITLE;
     import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentAlias.FILE_PLAN_ALIAS;
    @@ -35,26 +33,16 @@ import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanCo
     import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentType.RECORD_CATEGORY_TYPE;
     import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentType.RECORD_FOLDER_TYPE;
     import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentType.UNFILED_RECORD_FOLDER_TYPE;
    -import static org.alfresco.rest.rm.community.model.site.RMSiteCompliance.STANDARD;
    +import static org.alfresco.rest.rm.community.utils.FilePlanComponentsUtil.createFilePlanComponentModel;
    +import static org.alfresco.rest.rm.community.utils.RMSiteUtil.createStandardRMSiteModel;
     import static org.alfresco.utility.data.RandomData.getRandomAlphanumeric;
    -import static org.jglue.fluentjson.JsonBuilderFactory.buildObject;
     import static org.springframework.http.HttpStatus.CREATED;
     import static org.springframework.http.HttpStatus.OK;
     
    -import com.google.gson.JsonObject;
    -import com.jayway.restassured.builder.RequestSpecBuilder;
    -import com.jayway.restassured.http.ContentType;
    -import com.jayway.restassured.response.Response;
    -import com.jayway.restassured.specification.RequestSpecification;
    -
    -import org.alfresco.dataprep.AlfrescoHttpClient;
    -import org.alfresco.dataprep.AlfrescoHttpClientFactory;
     import org.alfresco.rest.RestTest;
     import org.alfresco.rest.core.RMRestWrapper;
     import org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentModel;
     import org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentProperties;
    -import org.alfresco.rest.rm.community.model.site.RMSiteModel;
    -import org.alfresco.rest.rm.community.model.user.UserPermissions;
     import org.alfresco.rest.rm.community.requests.FilePlanComponents;
     import org.alfresco.rest.rm.community.requests.RMSite;
     import org.alfresco.utility.data.DataUser;
    @@ -79,31 +67,26 @@ public class BaseRestTest extends RestTest
         @Autowired
         private DataUser dataUser;
     
    -    @Autowired
    -    private AlfrescoHttpClientFactory alfrescoHttpClientFactory;
    -
    -    private RMSite rmSite;
    -
    -    private FilePlanComponents filePlanComponents;
    -
         protected RMSite getRMSiteAPI()
         {
    -        if (rmSite == null)
    -        {
    -            rmSite = getRmRestWrapper().withIGCoreAPI().usingRMSite();
    -        }
    +        return getRMSiteAPI(dataUser.getAdminUser());
    +    }
     
    -        return rmSite;
    +    protected RMSite getRMSiteAPI(UserModel userModel)
    +    {
    +        getRmRestWrapper().authenticateUser(userModel);
    +        return getRmRestWrapper().withIGCoreAPI().usingRMSite();
         }
     
         protected FilePlanComponents getFilePlanComponentsAPI()
         {
    -        if (filePlanComponents == null)
    -        {
    -            filePlanComponents = getRmRestWrapper().withIGCoreAPI().usingFilePlanComponents();
    -        }
    +        return getFilePlanComponentsAPI(dataUser.getAdminUser());
    +    }
     
    -        return filePlanComponents;
    +    protected FilePlanComponents getFilePlanComponentsAPI(UserModel userModel)
    +    {
    +        getRmRestWrapper().authenticateUser(userModel);
    +        return getRmRestWrapper().withIGCoreAPI().usingFilePlanComponents();
         }
     
         /**
    @@ -114,11 +97,6 @@ public class BaseRestTest extends RestTest
             return this.rmRestWrapper;
         }
     
    -    // Constants
    -    public static final String RM_ID = "rm";
    -    public static final String RM_TITLE = "Records Management";
    -    public static final String RM_DESCRIPTION = "Records Management Site";
    -
         /** Valid root containers where electronic and non-electronic records can be created */
         @DataProvider(name = "validRootContainers")
         public Object[][] getValidRootContainers() throws Exception
    @@ -126,9 +104,9 @@ public class BaseRestTest extends RestTest
             return new Object[][]
             {
                 // an arbitrary record folder
    -            { createCategoryFolderInFilePlan(dataUser.getAdminUser(), FILE_PLAN_ALIAS) },
    +            { createCategoryFolderInFilePlan() },
                 // unfiled records root
    -            { getFilePlanComponentAsUser(dataUser.getAdminUser(), UNFILED_RECORDS_CONTAINER_ALIAS) },
    +            { getFilePlanComponent(UNFILED_RECORDS_CONTAINER_ALIAS) },
                 // an arbitrary unfiled records folder
                 { createUnfiledRecordsFolder(UNFILED_RECORDS_CONTAINER_ALIAS, "Unfiled Folder " + getRandomAlphanumeric()) }
             };
    @@ -148,23 +126,13 @@ public class BaseRestTest extends RestTest
         /**
          * FIXME!!!
          *
    -     * @param userModel FIXME!!!
    +     * @param httpStatus FIXME!!!
          */
    -    protected void authenticateUser(UserModel userModel)
    -    {
    -        getRmRestWrapper().authenticateUser(userModel);
    -    }
    -
    -    protected void assertStatusCodeIs(HttpStatus httpStatus)
    +    protected void assertStatusCode(HttpStatus httpStatus)
         {
             getRmRestWrapper().assertStatusCodeIs(httpStatus);
         }
     
    -    protected void disconnect()
    -    {
    -        getRmRestWrapper().disconnect();
    -    }
    -
         /**
          * Helper method to create the RM Site via the POST request
          * if the site doesn't exist
    @@ -172,86 +140,115 @@ public class BaseRestTest extends RestTest
         public void createRMSiteIfNotExists() throws Exception
         {
             // Check RM site doesn't exist
    -        if (!rmSite.existsRMSite())
    +        if (!getRMSiteAPI().existsRMSite())
             {
    -            authenticateUser(dataUser.getAdminUser());
    -
                 // Create the RM site
    -            RMSiteModel rmSiteModel =  RMSiteModel.builder().compliance(STANDARD).build();
    -            rmSiteModel.setTitle(RM_TITLE);
    -            rmSiteModel.setDescription(RM_DESCRIPTION);
    -            rmSite.createRMSite(rmSiteModel);
    +            getRMSiteAPI().createRMSite(createStandardRMSiteModel());
     
                 // Verify the status code
    -            assertStatusCodeIs(CREATED);
    +            assertStatusCode(CREATED);
             }
         }
     
         /**
          * Helper method to create child category
          *
    +     * @param user user under whose privileges this structure is going to be created
          * @param parentCategoryId The id of the parent category
          * @param categoryName     The name of the category
          * @return The created category
          * @throws Exception on unsuccessful component creation
          */
    +    public FilePlanComponentModel createCategory(UserModel user, String parentCategoryId, String categoryName) throws Exception
    +    {
    +        return createComponent(user, parentCategoryId, categoryName, RECORD_CATEGORY_TYPE, CATEGORY_TITLE);
    +    }
    +
    +    /**
    +     * FIXME!!!
    +     *
    +     * @param parentCategoryId FIXME!!!
    +     * @param categoryName FIXME!!!
    +     * @return FIXME!!!
    +     * @throws Exception FIXME!!!
    +     */
         public FilePlanComponentModel createCategory(String parentCategoryId, String categoryName) throws Exception
         {
    -        return createComponent(parentCategoryId, categoryName, RECORD_CATEGORY_TYPE, CATEGORY_TITLE);
    +        return createCategory(dataUser.getAdminUser(), parentCategoryId, categoryName);
         }
     
         /**
          * Helper method to create child folder
          *
    +     * @param user user under whose privileges this structure is going to be created
          * @param parentCategoryId The id of the parent category
          * @param folderName       The name of the category
          * @return The created category
          * @throws Exception on unsuccessful component creation
          */
    +    public FilePlanComponentModel createFolder(UserModel user, String parentCategoryId, String folderName) throws Exception
    +    {
    +        return createComponent(user, parentCategoryId, folderName, RECORD_FOLDER_TYPE, FOLDER_TITLE);
    +    }
    +
    +    /**
    +     * FIXME!!!
    +     *
    +     * @param parentCategoryId FIXME!!!
    +     * @param folderName FIXME!!!
    +     * @return FIXME!!!
    +     * @throws Exception FIXME!!!
    +     */
         public FilePlanComponentModel createFolder(String parentCategoryId, String folderName) throws Exception
         {
    -        return createComponent(parentCategoryId, folderName, RECORD_FOLDER_TYPE, FOLDER_TITLE);
    +        return createFolder(dataUser.getAdminUser(), parentCategoryId, folderName);
         }
     
         /**
          * Helper method to create child unfiled record folder
          *
    +     * @param user user under whose privileges this structure is going to be created
          * @param parentId The id of the parent folder
          * @param folderName       The name of the folder
          * @return The created folder
          * @throws Exception on unsuccessful component creation
          */
    +    public FilePlanComponentModel createUnfiledRecordsFolder(UserModel user, String parentId, String folderName) throws Exception
    +    {
    +        return createComponent(user, parentId, folderName, UNFILED_RECORD_FOLDER_TYPE, FOLDER_TITLE);
    +    }
    +
    +    /**
    +     * FIXME!!!
    +     *
    +     * @param parentId FIXME!!!
    +     * @param folderName FIXME!!!
    +     * @return FIXME!!!
    +     * @throws Exception FIXME!!!
    +     */
         public FilePlanComponentModel createUnfiledRecordsFolder(String parentId, String folderName) throws Exception
         {
    -        return createComponent(parentId, folderName, UNFILED_RECORD_FOLDER_TYPE, FOLDER_TITLE);
    +        return createUnfiledRecordsFolder(dataUser.getAdminUser(), parentId, folderName);
         }
     
         /**
          * Helper method to create generic child component
          *
    +     * @param user user under whose privileges this structure is going to be created
          * @param parentComponentId The id of the parent file plan component
          * @param componentName     The name of the file plan component
    -     * @param componentType     The name of the file plan component
    -     * @param componentTitle
    +     * @param componentType     The type of the file plan component
    +     * @param componentTitle    The title of the file plan component
          * @return The created file plan component
          * @throws Exception
          */
    -    private FilePlanComponentModel createComponent(String parentComponentId, String componentName, String componentType, String componentTitle) throws Exception
    +    private FilePlanComponentModel createComponent(UserModel user, String parentComponentId, String componentName, String componentType, String componentTitle) throws Exception
         {
    -        authenticateUser(dataUser.getAdminUser());
    +        FilePlanComponentModel filePlanComponentModel = createFilePlanComponentModel(componentName, componentType, componentTitle);
    +        FilePlanComponentModel filePlanComponent = getFilePlanComponentsAPI(user).createFilePlanComponent(filePlanComponentModel, parentComponentId);
    +        assertStatusCode(CREATED);
     
    -        FilePlanComponentModel filePlanComponent = FilePlanComponentModel.builder()
    -            .name(componentName)
    -            .nodeType(componentType)
    -            .properties(FilePlanComponentProperties.builder()
    -                            .title(componentTitle)
    -                            .build())
    -            .build();
    -
    -        FilePlanComponentModel fpc = getFilePlanComponentsAPI().createFilePlanComponent(filePlanComponent, parentComponentId);
    -        assertStatusCodeIs(CREATED);
    -
    -        return fpc;
    +        return filePlanComponent;
         }
     
         /**
    @@ -262,39 +259,48 @@ public class BaseRestTest extends RestTest
          */
         public FilePlanComponentModel closeFolder(String folderId) throws Exception
         {
    -        authenticateUser(dataUser.getAdminUser());
    -
    -        // build fileplan component + properties for update request
    +        // build file plan component + properties for update request
             FilePlanComponentProperties properties = new FilePlanComponentProperties();
             properties.setIsClosed(true);
             FilePlanComponentModel filePlanComponent = new FilePlanComponentModel();
             filePlanComponent.setProperties(properties);
     
             FilePlanComponentModel updatedComponent = getFilePlanComponentsAPI().updateFilePlanComponent(filePlanComponent, folderId);
    -        assertStatusCodeIs(OK);
    +        assertStatusCode(OK);
             return updatedComponent;
         }
     
         /**
    -     * Helper method to create a randomly-named / structure in fileplan
    +     * Helper method to create a randomly-named / structure in file plan
    +     *
          * @param user user under whose privileges this structure is going to be created
          * @param parentId parent container id
          * @return record folder
          * @throws Exception on failed creation
          */
    -    public FilePlanComponentModel createCategoryFolderInFilePlan(UserModel user, String parentId) throws Exception
    +    public FilePlanComponentModel createCategoryFolderInFilePlan(UserModel user) throws Exception
         {
    -        authenticateUser(user);
    -
             // create root category
    -        FilePlanComponentModel recordCategory = createCategory(parentId, "Category " + getRandomAlphanumeric());
    +        FilePlanComponentModel recordCategory = createCategory(user, FILE_PLAN_ALIAS, "Category " + getRandomAlphanumeric());
     
             // and return a folder underneath
    -        return createFolder(recordCategory.getId(), "Folder " + getRandomAlphanumeric());
    +        return createFolder(user, recordCategory.getId(), "Folder " + getRandomAlphanumeric());
         }
     
         /**
    -     * Helper method to retieve a fileplan component with user's privilege
    +     * FIXME!!!
    +     *
    +     * @param parentId FIXME!!!
    +     * @return FIXME!!!
    +     * @throws Exception FIXME!!!
    +     */
    +    public FilePlanComponentModel createCategoryFolderInFilePlan() throws Exception
    +    {
    +        return createCategoryFolderInFilePlan(dataUser.getAdminUser());
    +    }
    +
    +    /**
    +     * Helper method to retrieve a file plan component with user's privilege
          * @param user user under whose privileges a component is to be read
          * @param componentId id of the component to read
          * @return {@link FilePlanComponent} for given componentId
    @@ -302,50 +308,18 @@ public class BaseRestTest extends RestTest
          */
         public FilePlanComponentModel getFilePlanComponentAsUser(UserModel user, String componentId) throws Exception
         {
    -        authenticateUser(user);
    -        return getFilePlanComponentsAPI().getFilePlanComponent(componentId);
    +        return getFilePlanComponentsAPI(user).getFilePlanComponent(componentId);
         }
     
         /**
    -     * Helper method to add permission on a component to user
    -     * @param component {@link FilePlanComponent} on which permission should be given
    -     * @param user {@link UserModel} for a user to be granted permission
    -     * @param permission {@link UserPermissions} to be granted
    +     * FIXME!!!
    +     *
    +     * @param componentId FIXME!!!
    +     * @return FIXME!!!
    +     * @throws Exception FIXME!!!
          */
    -     // FIXME: As of December 2016 there is no v1-style API for managing RM permissions.
    -     // Until such APIs have become available, this method is just a proxy to an "old-style"
    -     // API call.
    -    public void addUserPermission(FilePlanComponentModel component, UserModel user, String permission)
    +    public FilePlanComponentModel getFilePlanComponent(String componentId) throws Exception
         {
    -        // get an "old-style" REST API client
    -        AlfrescoHttpClient client = alfrescoHttpClientFactory.getObject();
    -
    -        JsonObject bodyJson = buildObject()
    -            .addArray("permissions")
    -                .addObject()
    -                    .add("authority", user.getUsername())
    -                    .add("role", permission)
    -                    .end()
    -                    .getJson();
    -
    -        // override v1 baseURI and basePath
    -        RequestSpecification spec = new RequestSpecBuilder()
    -            .setBaseUri(client.getApiUrl())
    -            .setBasePath("/")
    -            .build();
    -
    -        // execute an "old-style" API call
    -        Response response = given()
    -            .spec(spec)
    -            .auth().basic(dataUser.getAdminUser().getUsername(), dataUser.getAdminUser().getPassword())
    -            .contentType(ContentType.JSON)
    -            .body(bodyJson.toString())
    -            .pathParam("nodeId", component.getId())
    -            .log().all()
    -        .when()
    -            .post("/node/workspace/SpacesStore/{nodeId}/rmpermissions")
    -            .prettyPeek()
    -            .andReturn();
    -        rmRestWrapper.setStatusCode(Integer.toString(response.getStatusCode()));
    +        return getFilePlanComponentAsUser(dataUser.getAdminUser(), componentId);
         }
     }
    \ No newline at end of file
    diff --git a/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/base/TestData.java b/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/base/TestData.java
    index 5727a6e416..4cae9ef36c 100644
    --- a/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/base/TestData.java
    +++ b/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/base/TestData.java
    @@ -102,7 +102,7 @@ public interface TestData
         /**
          * The default CATEGORY name used when creating categories
          */
    -    public static String CATEGORY_NAME = "CATEGORY NAME"+ getRandomAlphanumeric();
    +    public static String CATEGORY_NAME = "CATEGORY NAME" + getRandomAlphanumeric();
     
         /**
          * The default CATEGORY title used when creating categories
    diff --git a/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/fileplancomponents/DeleteRecordTests.java b/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/fileplancomponents/DeleteRecordTests.java
    index dd1e11b40d..2328a6a0a3 100644
    --- a/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/fileplancomponents/DeleteRecordTests.java
    +++ b/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/fileplancomponents/DeleteRecordTests.java
    @@ -26,11 +26,9 @@
      */
     package org.alfresco.rest.rm.community.fileplancomponents;
     
    -import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentAlias.FILE_PLAN_ALIAS;
     import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentAlias.UNFILED_RECORDS_CONTAINER_ALIAS;
    -import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentType.CONTENT_TYPE;
    -import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentType.NON_ELECTRONIC_RECORD_TYPE;
    -import static org.alfresco.utility.data.RandomData.getRandomAlphanumeric;
    +import static org.alfresco.rest.rm.community.utils.FilePlanComponentsUtil.createElectronicRecordModel;
    +import static org.alfresco.rest.rm.community.utils.FilePlanComponentsUtil.createNonElectronicRecordModel;
     import static org.springframework.http.HttpStatus.CREATED;
     import static org.springframework.http.HttpStatus.FORBIDDEN;
     import static org.springframework.http.HttpStatus.NOT_FOUND;
    @@ -90,15 +88,9 @@ public class DeleteRecordTests extends BaseRestTest
         @AlfrescoTest(jira="RM-4363")
         public void adminCanDeleteElectronicRecord(FilePlanComponentModel container) throws Exception
         {
    -        authenticateUser(dataUser.getAdminUser());
    +        FilePlanComponentModel newRecord = getFilePlanComponentsAPI().createElectronicRecord(createElectronicRecordModel(), IMAGE_FILE, container.getId());
     
    -        // create an electronic record
    -        FilePlanComponentModel record = FilePlanComponentModel.builder()
    -            .name("Record " + getRandomAlphanumeric())
    -            .nodeType(CONTENT_TYPE)
    -            .build();
    -        FilePlanComponentModel newRecord = getFilePlanComponentsAPI().createElectronicRecord(record, IMAGE_FILE, container.getId());
    -        assertStatusCodeIs(CREATED);
    +        assertStatusCode(CREATED);
     
             deleteAndVerify(newRecord);
         }
    @@ -123,17 +115,10 @@ public class DeleteRecordTests extends BaseRestTest
         @AlfrescoTest(jira="RM-4363")
         public void adminCanDeleteNonElectronicRecord(FilePlanComponentModel container) throws Exception
         {
    -        authenticateUser(dataUser.getAdminUser());
    -
             // create a non-electronic record
    -        FilePlanComponentModel record = FilePlanComponentModel.builder()
    -            .name("Record " + getRandomAlphanumeric())
    -            .nodeType(NON_ELECTRONIC_RECORD_TYPE)
    -            .build();
    -        FilePlanComponentModel newRecord = getFilePlanComponentsAPI().createFilePlanComponent(
    -            record,
    -            container.getId());
    -        assertStatusCodeIs(CREATED);
    +        FilePlanComponentModel newRecord = getFilePlanComponentsAPI().createFilePlanComponent(createNonElectronicRecordModel(), container.getId());
    +
    +        assertStatusCode(CREATED);
     
             deleteAndVerify(newRecord);
         }
    @@ -157,18 +142,10 @@ public class DeleteRecordTests extends BaseRestTest
         @AlfrescoTest(jira="RM-4363")
         public void userWithoutWritePermissionsCantDeleteRecord() throws Exception
         {
    -        authenticateUser(dataUser.getAdminUser());
    -        authenticateUser(dataUser.getAdminUser());
    -
             // create a non-electronic record in unfiled records
    -        FilePlanComponentModel record = FilePlanComponentModel.builder()
    -            .name("Record " + getRandomAlphanumeric())
    -            .nodeType(NON_ELECTRONIC_RECORD_TYPE)
    -            .build();
    -        FilePlanComponentModel newRecord = getFilePlanComponentsAPI().createFilePlanComponent(
    -            record,
    -            UNFILED_RECORDS_CONTAINER_ALIAS);
    -        assertStatusCodeIs(CREATED);
    +        FilePlanComponentModel newRecord = getFilePlanComponentsAPI().createFilePlanComponent(createNonElectronicRecordModel(), UNFILED_RECORDS_CONTAINER_ALIAS);
    +
    +        assertStatusCode(CREATED);
     
             // create test user and add it with collab. privileges
             UserModel deleteUser = dataUser.createRandomTestUser("delnoperm");
    @@ -180,12 +157,9 @@ public class DeleteRecordTests extends BaseRestTest
             rmUserAPI.assignRoleToUser(deleteUser.getUsername(), UserRoles.ROLE_RM_POWER_USER);
             rmUserAPI.usingRestWrapper().assertStatusCodeIs(OK);
     
    -        // log in as deleteUser
    -        authenticateUser(deleteUser);
    -
             // try to delete newRecord
    -        getFilePlanComponentsAPI().deleteFilePlanComponent(newRecord.getId());
    -        assertStatusCodeIs(FORBIDDEN);
    +        getFilePlanComponentsAPI(deleteUser).deleteFilePlanComponent(newRecord.getId());
    +        assertStatusCode(FORBIDDEN);
         }
     
         /**
    @@ -207,8 +181,6 @@ public class DeleteRecordTests extends BaseRestTest
         @AlfrescoTest(jira="RM-4363")
         public void userWithoutDeleteRecordsCapabilityCantDeleteRecord() throws Exception
         {
    -        authenticateUser(dataUser.getAdminUser());
    -
             // create test user and add it with collab. privileges
             UserModel deleteUser = dataUser.createRandomTestUser("delnoperm");
             deleteUser.setUserRole(UserRole.SiteCollaborator);
    @@ -220,35 +192,26 @@ public class DeleteRecordTests extends BaseRestTest
             rmUserAPI.usingRestWrapper().assertStatusCodeIs(OK);
     
             // create random folder
    -        FilePlanComponentModel randomFolder = createCategoryFolderInFilePlan(dataUser.getAdminUser(), FILE_PLAN_ALIAS);
    +        FilePlanComponentModel randomFolder = createCategoryFolderInFilePlan();
             logger.info("random folder:" + randomFolder.getName());
     
             // grant deleteUser Filing privileges on randomFolder category, this will be
             // inherited to randomFolder
    -        addUserPermission(getFilePlanComponentsAPI().getFilePlanComponent(randomFolder.getParentId()),
    +        rmUserAPI.addUserPermission(getFilePlanComponentsAPI().getFilePlanComponent(randomFolder.getParentId()),
                 deleteUser, UserPermissions.PERMISSION_FILING);
    -        assertStatusCodeIs(OK);
    +        rmUserAPI.usingRestWrapper().assertStatusCodeIs(OK);
     
             // create a non-electronic record in randomFolder
    -        FilePlanComponentModel record = FilePlanComponentModel.builder()
    -            .name("Record " + getRandomAlphanumeric())
    -            .nodeType(NON_ELECTRONIC_RECORD_TYPE)
    -            .build();
    -        FilePlanComponentModel newRecord = getFilePlanComponentsAPI().createFilePlanComponent(
    -            record,
    -            randomFolder.getId());
    -        assertStatusCodeIs(CREATED);
    -
    -        // log in as deleteUser
    -        authenticateUser(deleteUser);
    +        FilePlanComponentModel newRecord = getFilePlanComponentsAPI().createFilePlanComponent(createNonElectronicRecordModel(), randomFolder.getId());
    +        assertStatusCode(CREATED);
     
             // verify the user can see the newRecord
    -        getFilePlanComponentsAPI().getFilePlanComponent(newRecord.getId());
    -        assertStatusCodeIs(OK);
    +        getFilePlanComponentsAPI(deleteUser).getFilePlanComponent(newRecord.getId());
    +        assertStatusCode(OK);
     
             // try to delete newRecord
    -        getFilePlanComponentsAPI().deleteFilePlanComponent(newRecord.getId());
    -        assertStatusCodeIs(FORBIDDEN);
    +        getFilePlanComponentsAPI(deleteUser).deleteFilePlanComponent(newRecord.getId());
    +        assertStatusCode(FORBIDDEN);
         }
     
         /**
    @@ -258,14 +221,12 @@ public class DeleteRecordTests extends BaseRestTest
          */
         private void deleteAndVerify(FilePlanComponentModel record) throws Exception
         {
    -        authenticateUser(dataUser.getAdminUser());
    -
             // delete it and verify status
             getFilePlanComponentsAPI().deleteFilePlanComponent(record.getId());
    -        assertStatusCodeIs(NO_CONTENT);
    +        assertStatusCode(NO_CONTENT);
     
             // try to get deleted file plan component
             getFilePlanComponentsAPI().getFilePlanComponent(record.getId());
    -        assertStatusCodeIs(NOT_FOUND);
    +        assertStatusCode(NOT_FOUND);
         }
     }
    diff --git a/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/fileplancomponents/ElectronicRecordTests.java b/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/fileplancomponents/ElectronicRecordTests.java
    index 209d1c0a5c..29094c8f3e 100644
    --- a/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/fileplancomponents/ElectronicRecordTests.java
    +++ b/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/fileplancomponents/ElectronicRecordTests.java
    @@ -32,7 +32,7 @@ import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanCo
     import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentType.CONTENT_TYPE;
     import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentType.RECORD_FOLDER_TYPE;
     import static org.alfresco.rest.rm.community.util.PojoUtility.toJson;
    -import static org.alfresco.utility.data.RandomData.getRandomAlphanumeric;
    +import static org.alfresco.rest.rm.community.utils.FilePlanComponentsUtil.createElectronicRecordModel;
     import static org.springframework.http.HttpStatus.BAD_REQUEST;
     import static org.springframework.http.HttpStatus.CREATED;
     import static org.springframework.http.HttpStatus.UNPROCESSABLE_ENTITY;
    @@ -41,8 +41,6 @@ import static org.testng.Assert.assertTrue;
     
     import org.alfresco.rest.rm.community.base.BaseRestTest;
     import org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentModel;
    -import org.alfresco.utility.data.DataUser;
    -import org.springframework.beans.factory.annotation.Autowired;
     import org.testng.annotations.DataProvider;
     import org.testng.annotations.Test;
     
    @@ -57,25 +55,23 @@ import org.testng.annotations.Test;
      */
     public class ElectronicRecordTests extends BaseRestTest
     {
    -    @Autowired
    -    private DataUser dataUser;
    -
         /** image resource file to be used for records body */
         private static final String IMAGE_FILE = "money.JPG";
     
         /** Valid root containers where electronic records can be created */
         @DataProvider(name = "invalidParentContainers")
    -    public Object[][] invalidContainers() throws Exception {
    -        return new Object[][] {
    +    public Object[][] invalidContainers() throws Exception
    +    {
    +        return new Object[][]
    +        {
                 // record category
    -            { getFilePlanComponentAsUser(dataUser.getAdminUser(),
    -                createCategoryFolderInFilePlan(dataUser.getAdminUser(), FILE_PLAN_ALIAS).getParentId()) },
    +            { getFilePlanComponent(createCategoryFolderInFilePlan().getParentId()) },
                 // file plan root
    -            { getFilePlanComponentAsUser(dataUser.getAdminUser(), FILE_PLAN_ALIAS) },
    +            { getFilePlanComponent(FILE_PLAN_ALIAS) },
                 // transfers
    -            { getFilePlanComponentAsUser(dataUser.getAdminUser(), TRANSFERS_ALIAS) },
    +            { getFilePlanComponent(TRANSFERS_ALIAS) },
                 // holds
    -            { getFilePlanComponentAsUser(dataUser.getAdminUser(), HOLDS_ALIAS) },
    +            { getFilePlanComponent(HOLDS_ALIAS) },
             };
         }
     
    @@ -96,17 +92,11 @@ public class ElectronicRecordTests extends BaseRestTest
         )
         public void cantCreateElectronicRecordsInInvalidContainers(FilePlanComponentModel container) throws Exception
         {
    -        authenticateUser(dataUser.getAdminUser());
    -
             // Build object the filePlan
    -        FilePlanComponentModel record = FilePlanComponentModel.builder()
    -                                                .name("Record " + getRandomAlphanumeric())
    -                                                .nodeType(CONTENT_TYPE)
    -                                                .build();
    -        getFilePlanComponentsAPI().createElectronicRecord(record, IMAGE_FILE, container.getId());
    +        getFilePlanComponentsAPI().createElectronicRecord(createElectronicRecordModel(), IMAGE_FILE, container.getId());
     
             // verify the create request status code
    -        assertStatusCodeIs(UNPROCESSABLE_ENTITY);
    +        assertStatusCode(UNPROCESSABLE_ENTITY);
         }
     
         /**
    @@ -122,8 +112,7 @@ public class ElectronicRecordTests extends BaseRestTest
         @Test(description = "Electronic record can't be created in closed record folder")
         public void cantCreateElectronicRecordInClosedFolder() throws Exception
         {
    -        authenticateUser(dataUser.getAdminUser());
    -        FilePlanComponentModel recordFolder = createCategoryFolderInFilePlan(dataUser.getAdminUser(), FILE_PLAN_ALIAS);
    +        FilePlanComponentModel recordFolder = createCategoryFolderInFilePlan();
     
             // the folder should be open
             assertFalse(recordFolder.getProperties().getIsClosed());
    @@ -132,14 +121,10 @@ public class ElectronicRecordTests extends BaseRestTest
             closeFolder(recordFolder.getId());
     
             // try to create it, this should fail
    -        FilePlanComponentModel record = FilePlanComponentModel.builder()
    -                                                .name("Record " + getRandomAlphanumeric())
    -                                                .nodeType(CONTENT_TYPE)
    -                                                .build();
    -        getFilePlanComponentsAPI().createElectronicRecord(record, IMAGE_FILE, recordFolder.getId());
    +        getFilePlanComponentsAPI().createElectronicRecord(createElectronicRecordModel(), IMAGE_FILE, recordFolder.getId());
     
             // verify the status code
    -        assertStatusCodeIs(UNPROCESSABLE_ENTITY);
    +        assertStatusCode(UNPROCESSABLE_ENTITY);
         }
     
         /**
    @@ -169,9 +154,8 @@ public class ElectronicRecordTests extends BaseRestTest
         )
         public void canCreateElectronicRecordOnlyWithMandatoryProperties(FilePlanComponentModel container) throws Exception
         {
    -        authenticateUser(dataUser.getAdminUser());
    -
             logger.info("Root container:\n" + toJson(container));
    +
             if (container.getNodeType().equals(RECORD_FOLDER_TYPE))
             {
                 // only record folders can be open or closed
    @@ -187,7 +171,7 @@ public class ElectronicRecordTests extends BaseRestTest
             getFilePlanComponentsAPI().createFilePlanComponent(record, container.getId());
     
             // verify the status code is BAD_REQUEST
    -        assertStatusCodeIs(BAD_REQUEST);
    +        assertStatusCode(BAD_REQUEST);
         }
     
         /**
    @@ -214,18 +198,13 @@ public class ElectronicRecordTests extends BaseRestTest
         )
         public void canCreateElectronicRecordsInValidContainers(FilePlanComponentModel container) throws Exception
         {
    -        authenticateUser(dataUser.getAdminUser());
    -
    -        FilePlanComponentModel record = FilePlanComponentModel.builder()
    -                                                    .name("Record " + getRandomAlphanumeric())
    -                                                    .nodeType(CONTENT_TYPE)
    -                                                    .build();
    -        String newRecordId = getFilePlanComponentsAPI().createElectronicRecord(record, IMAGE_FILE, container.getId()).getId();
    +        FilePlanComponentModel record = createElectronicRecordModel();
    +        String newRecordId = getFilePlanComponentsAPI().createElectronicRecord(createElectronicRecordModel(), IMAGE_FILE, container.getId()).getId();
     
             // verify the create request status code
    -        assertStatusCodeIs(CREATED);
    +        assertStatusCode(CREATED);
     
    -        // get newly created electonic record and verify its properties
    +        // get newly created electronic record and verify its properties
             FilePlanComponentModel electronicRecord = getFilePlanComponentsAPI().getFilePlanComponent(newRecordId);
             // created record will have record identifier inserted in its name but will be prefixed with
             // the name it was created as
    @@ -245,8 +224,6 @@ public class ElectronicRecordTests extends BaseRestTest
         )
         public void recordNameDerivedFromFileName(FilePlanComponentModel container) throws Exception
         {
    -        authenticateUser(dataUser.getAdminUser());
    -
             // record object without name set
             FilePlanComponentModel record = FilePlanComponentModel.builder()
                     .nodeType(CONTENT_TYPE)
    @@ -255,7 +232,7 @@ public class ElectronicRecordTests extends BaseRestTest
             String newRecordId = getFilePlanComponentsAPI().createElectronicRecord(record, IMAGE_FILE, container.getId()).getId();
     
             // verify the create request status code
    -        assertStatusCodeIs(CREATED);
    +        assertStatusCode(CREATED);
     
             // get newly created electonic record and verify its properties
             FilePlanComponentModel electronicRecord = getFilePlanComponentsAPI().getFilePlanComponent(newRecordId);
    diff --git a/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/fileplancomponents/FilePlanTests.java b/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/fileplancomponents/FilePlanTests.java
    index 9c5b3c7544..aecb62c8a9 100644
    --- a/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/fileplancomponents/FilePlanTests.java
    +++ b/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/fileplancomponents/FilePlanTests.java
    @@ -85,18 +85,13 @@ public class FilePlanTests extends BaseRestTest
                 getRMSiteAPI().deleteRMSite();
             }
     
    -        // Authenticate with admin user
    -        authenticateUser(dataUser.getAdminUser());
    -
             // Get the file plan component
             getFilePlanComponentsAPI().getFilePlanComponent(filePlanComponentAlias);
     
             //check the response code is NOT_FOUND
    -        assertStatusCodeIs(NOT_FOUND);
    +        assertStatusCode(NOT_FOUND);
         }
     
    -
    -
         /**
          * Given that a file plan exists
          * When I ask the API for the details of the file plan
    @@ -113,14 +108,11 @@ public class FilePlanTests extends BaseRestTest
             // Create RM Site if doesn't exist
             createRMSiteIfNotExists();
     
    -        // Authenticate with admin user
    -        authenticateUser(dataUser.getAdminUser());
    -
             // Get the file plan special container
             FilePlanComponentModel filePlanComponent = getFilePlanComponentsAPI().getFilePlanComponent(filePlanComponentAlias);
     
             // Check the response code
    -        assertStatusCodeIs(OK);
    +        assertStatusCode(OK);
     
             // Check the response contains the right node type
             assertEquals(filePlanComponent.getNodeType(), filePlanComponentType);
    @@ -142,9 +134,6 @@ public class FilePlanTests extends BaseRestTest
             // Create RM Site if doesn't exist
             createRMSiteIfNotExists();
     
    -        // Authenticate with admin user
    -        authenticateUser(dataUser.getAdminUser());
    -
             // Get the file plan special containers with the optional parameter allowableOperations
             FilePlanComponentModel filePlanComponent = getFilePlanComponentsAPI().getFilePlanComponent(specialContainerAlias, "include=" + ALLOWABLE_OPERATIONS);
     
    @@ -181,9 +170,6 @@ public class FilePlanTests extends BaseRestTest
             // Create RM Site if doesn't exist
             createRMSiteIfNotExists();
     
    -        // Authenticate with admin user
    -        authenticateUser(dataUser.getAdminUser());
    -
             // Build object for updating the filePlan
             FilePlanComponentModel filePlanComponent = FilePlanComponentModel.builder()
                 .properties(FilePlanComponentProperties.builder()
    @@ -196,7 +182,7 @@ public class FilePlanTests extends BaseRestTest
             FilePlanComponentModel renamedFilePlanComponent = getFilePlanComponentsAPI().updateFilePlanComponent(filePlanComponent, FILE_PLAN_ALIAS);
     
             // Verify the response status code
    -        assertStatusCodeIs(OK);
    +        assertStatusCode(OK);
     
             // Verify the returned description field for the file plan component
             assertEquals(renamedFilePlanComponent.getProperties().getDescription(), FILE_PLAN_DESCRIPTION);
    @@ -221,14 +207,11 @@ public class FilePlanTests extends BaseRestTest
             // Create RM Site if doesn't exist
             createRMSiteIfNotExists();
     
    -        // Authenticate with admin user
    -        authenticateUser(dataUser.getAdminUser());
    -
             // Delete the file plan component
             getFilePlanComponentsAPI().deleteFilePlanComponent(filePlanComponentAlias);
     
             // Check the DELETE response status code
    -        assertStatusCodeIs(UNPROCESSABLE_ENTITY);
    +        assertStatusCode(UNPROCESSABLE_ENTITY);
         }
     
         /**
    @@ -247,22 +230,14 @@ public class FilePlanTests extends BaseRestTest
             // Create RM Site if doesn't exist
             createRMSiteIfNotExists();
     
    -        // Disconnect the current user from the API session
    -        disconnect();
    -        // Authenticate admin user to Alfresco REST API
    -        authenticateUser(dataUser.getAdminUser());
    -
             // Create a random user
             UserModel nonRMuser = dataUser.createRandomTestUser("testUser");
     
    -        // Authenticate using the random user
    -        authenticateUser(nonRMuser);
    -
             // Delete the file plan component
    -        getFilePlanComponentsAPI().deleteFilePlanComponent(filePlanComponentAlias);
    +        getFilePlanComponentsAPI(nonRMuser).deleteFilePlanComponent(filePlanComponentAlias);
     
             // Check the DELETE response status code
    -        assertStatusCodeIs(FORBIDDEN);
    +        assertStatusCode(FORBIDDEN);
         }
     
         /**
    @@ -282,9 +257,6 @@ public class FilePlanTests extends BaseRestTest
             // Create RM Site if doesn't exist
             createRMSiteIfNotExists();
     
    -        // Authenticate with admin user
    -        authenticateUser(dataUser.getAdminUser());
    -
             // Get the RM site ID
             String rmSiteId = getRMSiteAPI().getSite().getGuid();
             String name = filePlanComponentAlias + getRandomAlphanumeric();
    @@ -297,20 +269,17 @@ public class FilePlanTests extends BaseRestTest
                                     .build())
                     .build();
     
    -        // Authenticate with admin user
    -        authenticateUser(dataUser.getAdminUser());
    -
             // Create the special containers into RM site - parent folder
             getFilePlanComponentsAPI().createFilePlanComponent(filePlanComponent, rmSiteId);
    -        assertStatusCodeIs(UNPROCESSABLE_ENTITY);
    +        assertStatusCode(UNPROCESSABLE_ENTITY);
     
             // Create the special containers into RM site - parent folder
             getFilePlanComponentsAPI().createFilePlanComponent(filePlanComponent, FILE_PLAN_ALIAS);
    -        assertStatusCodeIs(UNPROCESSABLE_ENTITY);
    +        assertStatusCode(UNPROCESSABLE_ENTITY);
     
             // Create the special containers into the root of special containers containers
             getFilePlanComponentsAPI().createFilePlanComponent(filePlanComponent, filePlanComponentAlias);
    -        assertStatusCodeIs(UNPROCESSABLE_ENTITY);
    +        assertStatusCode(UNPROCESSABLE_ENTITY);
         }
     
         /**
    @@ -329,22 +298,13 @@ public class FilePlanTests extends BaseRestTest
             // Create RM Site if doesn't exist
             createRMSiteIfNotExists();
     
    -        // Disconnect user from REST API session
    -        disconnect();
    -
    -        // Authenticate admin user to Alfresco REST API
    -        restClient.authenticateUser(dataUser.getAdminUser());
    -
             // Create a random user
             UserModel nonRMuser = dataUser.createRandomTestUser("testUser");
     
    -        // Authenticate using the random user
    -        authenticateUser(nonRMuser);
    -
             // Get the special file plan components
    -        getFilePlanComponentsAPI().getFilePlanComponent(filePlanComponentAlias);
    +        getFilePlanComponentsAPI(nonRMuser).getFilePlanComponent(filePlanComponentAlias);
     
             // Check the response status code is FORBIDDEN
    -        assertStatusCodeIs(FORBIDDEN);
    +        assertStatusCode(FORBIDDEN);
         }
     }
    diff --git a/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/fileplancomponents/NonElectronicRecordTests.java b/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/fileplancomponents/NonElectronicRecordTests.java
    index 2e67efa457..fa3cb2c256 100644
    --- a/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/fileplancomponents/NonElectronicRecordTests.java
    +++ b/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/fileplancomponents/NonElectronicRecordTests.java
    @@ -35,6 +35,8 @@ import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanCo
     import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentType.RECORD_CATEGORY_TYPE;
     import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentType.RECORD_FOLDER_TYPE;
     import static org.alfresco.rest.rm.community.util.PojoUtility.toJson;
    +import static org.alfresco.rest.rm.community.utils.FilePlanComponentsUtil.createNonElectronicRecordModel;
    +import static org.alfresco.utility.constants.UserRole.SiteManager;
     import static org.alfresco.utility.data.RandomData.getRandomAlphanumeric;
     import static org.springframework.http.HttpStatus.BAD_REQUEST;
     import static org.springframework.http.HttpStatus.CREATED;
    @@ -78,14 +80,6 @@ public class NonElectronicRecordTests extends BaseRestTest
         @Test(description = "Non-electronic record can't be created as a child of invalid parent Id")
         public void cantCreateForInvalidParentIds() throws Exception
         {
    -        authenticateUser(dataUser.getAdminUser());
    -
    -        // non-electronic record object to be used for create tests
    -        FilePlanComponentModel nonElectronicRecord = FilePlanComponentModel.builder()
    -                                                .name("Record " + getRandomAlphanumeric())
    -                                                .nodeType(NON_ELECTRONIC_RECORD_TYPE)
    -                                                .build();
    -
             // create record category, non-electronic records can't be its children
             FilePlanComponentModel recordCategoryModel = FilePlanComponentModel.builder()
                                                              .name("Category " + getRandomAlphanumeric())
    @@ -101,14 +95,14 @@ public class NonElectronicRecordTests extends BaseRestTest
                 {
                     try
                     {
    -                    getFilePlanComponentsAPI().createFilePlanComponent(nonElectronicRecord, id);
    +                    getFilePlanComponentsAPI().createFilePlanComponent(createNonElectronicRecordModel(), id);
                     }
                     catch (Exception error)
                     {
                     }
     
                     // Verify the status code
    -                assertStatusCodeIs(UNPROCESSABLE_ENTITY);
    +                assertStatusCode(UNPROCESSABLE_ENTITY);
                 });
         }
     
    @@ -136,9 +130,8 @@ public class NonElectronicRecordTests extends BaseRestTest
         )
         public void canCreateInValidContainers(FilePlanComponentModel container) throws Exception
         {
    -        authenticateUser(dataUser.getAdminUser());
    -
             logger.info("Root container:\n" + toJson(container));
    +
             if (container.getNodeType().equals(RECORD_FOLDER_TYPE))
             {
                 // only record folders can be open or closed
    @@ -179,7 +172,7 @@ public class NonElectronicRecordTests extends BaseRestTest
                 container.getId()).getId();
     
             // verify the create request status code
    -        assertStatusCodeIs(CREATED);
    +        assertStatusCode(CREATED);
     
             // get newly created non-electonic record and verify its properties
             FilePlanComponentModel nonElectronicRecord = getFilePlanComponentsAPI().getFilePlanComponent(nonElectronicId);
    @@ -207,8 +200,7 @@ public class NonElectronicRecordTests extends BaseRestTest
         @Test(description = "Non-electronic record can't be created in closed record folder")
         public void cantCreateInClosedFolder() throws Exception
         {
    -        authenticateUser(dataUser.getAdminUser());
    -        FilePlanComponentModel recordFolder = createCategoryFolderInFilePlan(dataUser.getAdminUser(), FILE_PLAN_ALIAS);
    +        FilePlanComponentModel recordFolder = createCategoryFolderInFilePlan();
     
             // the folder should be open
             assertFalse(recordFolder.getProperties().getIsClosed());
    @@ -217,16 +209,10 @@ public class NonElectronicRecordTests extends BaseRestTest
             closeFolder(recordFolder.getId());
     
             // try to create it, this should fail and throw an exception
    -
    -        getFilePlanComponentsAPI().createFilePlanComponent(FilePlanComponentModel.builder()
    -                                                                      .name("Record " + getRandomAlphanumeric())
    -                                                                      .nodeType(NON_ELECTRONIC_RECORD_TYPE)
    -                                                                      .build(),
    -                                                    recordFolder.getId())
    -                                                                    .getId();
    +        getFilePlanComponentsAPI().createFilePlanComponent(createNonElectronicRecordModel(), recordFolder.getId());
     
             // verify the status code
    -        assertStatusCodeIs(UNPROCESSABLE_ENTITY);
    +        assertStatusCode(UNPROCESSABLE_ENTITY);
         }
     
         /**
    @@ -255,8 +241,6 @@ public class NonElectronicRecordTests extends BaseRestTest
         )
         public void allMandatoryPropertiesRequired(FilePlanComponentModel container) throws Exception
         {
    -        authenticateUser(dataUser.getAdminUser());
    -
             logger.info("Root container:\n" + toJson(container));
             if (container.getNodeType().equals(RECORD_FOLDER_TYPE))
             {
    @@ -295,7 +279,7 @@ public class NonElectronicRecordTests extends BaseRestTest
                 }
     
                 // verify the status code is BAD_REQUEST
    -            assertStatusCodeIs(BAD_REQUEST);
    +            assertStatusCode(BAD_REQUEST);
             });
         }
     
    @@ -315,10 +299,7 @@ public class NonElectronicRecordTests extends BaseRestTest
         )
         public void cantCreateIfNoRmPrivileges(FilePlanComponentModel container) throws Exception
         {
    -        String username = "zzzuser";
    -        UserModel user = createUserWithRole(username, UserRole.SiteManager);
    -
    -        authenticateUser(user);
    +        UserModel user = createUserWithRole("zzzuser", SiteManager);
     
             // try to create a fileplan component
             FilePlanComponentModel record = FilePlanComponentModel.builder()
    @@ -334,14 +315,14 @@ public class NonElectronicRecordTests extends BaseRestTest
             // this should fail and throw an exception
             try
             {
    -            getFilePlanComponentsAPI().createFilePlanComponent(record, container.getId());
    +            getFilePlanComponentsAPI(user).createFilePlanComponent(record, container.getId());
             }
             catch (Exception e)
             {
             }
     
             // user who isn't an RM site member can't access the container path
    -        assertStatusCodeIs(FORBIDDEN);
    +        assertStatusCode(FORBIDDEN);
         }
     
         /**
    @@ -370,7 +351,6 @@ public class NonElectronicRecordTests extends BaseRestTest
          */
         private UserModel createUserWithRole(String userName, UserRole userRole) throws Exception
         {
    -        authenticateUser(dataUser.getAdminUser());
             String siteId = getRMSiteAPI().getSite().getId();
     
             // check if user exists
    diff --git a/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/fileplancomponents/RecordCategoryTest.java b/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/fileplancomponents/RecordCategoryTest.java
    index 4ecf10de67..92f620d693 100644
    --- a/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/fileplancomponents/RecordCategoryTest.java
    +++ b/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/fileplancomponents/RecordCategoryTest.java
    @@ -81,9 +81,6 @@ public class RecordCategoryTest extends BaseRestTest
         )
         public void createCategoryTest() throws Exception
         {
    -        // Authenticate with admin user
    -        authenticateUser(dataUser.getAdminUser());
    -
             String categoryName = "Category name " + getRandomAlphanumeric();
             String categoryTitle = "Category title " + getRandomAlphanumeric();
     
    @@ -101,7 +98,7 @@ public class RecordCategoryTest extends BaseRestTest
             FilePlanComponentModel filePlanComponent = getFilePlanComponentsAPI().createFilePlanComponent(recordCategory, FILE_PLAN_ALIAS);
     
             // Verify the status code
    -        assertStatusCodeIs(CREATED);
    +        assertStatusCode(CREATED);
     
             // Verify the returned file plan component
             assertTrue(filePlanComponent.getIsCategory());
    @@ -132,9 +129,6 @@ public class RecordCategoryTest extends BaseRestTest
         )
         public void renameCategory() throws Exception
         {
    -        // Authenticate with admin user
    -        authenticateUser(dataUser.getAdminUser());
    -
             // Create record category first
             String categoryName = "Category name " + getRandomAlphanumeric();
             String categoryTitle = "Category title " + getRandomAlphanumeric();
    @@ -161,7 +155,7 @@ public class RecordCategoryTest extends BaseRestTest
             FilePlanComponentModel renamedFilePlanComponent = getFilePlanComponentsAPI().updateFilePlanComponent(recordCategoryUpdated, filePlanComponent.getId());
     
             // Verify the status code
    -        assertStatusCodeIs(OK);
    +        assertStatusCode(OK);
     
             // Verify the returned file plan component
             assertEquals(renamedFilePlanComponent.getName(), newCategoryName);
    @@ -185,9 +179,6 @@ public class RecordCategoryTest extends BaseRestTest
         )
         public void deleteCategory() throws Exception
         {
    -        // Authenticate with admin user
    -        authenticateUser(dataUser.getAdminUser());
    -
             // Create record category first
             String categoryName = "Category name " + getRandomAlphanumeric();
             String categoryTitle = "Category title " + getRandomAlphanumeric();
    @@ -209,11 +200,11 @@ public class RecordCategoryTest extends BaseRestTest
             getFilePlanComponentsAPI().deleteFilePlanComponent(filePlanComponent.getId());
     
             // Verify the status code
    -        assertStatusCodeIs(NO_CONTENT);
    +        assertStatusCode(NO_CONTENT);
     
             // Deleted component should no longer be retrievable
             getFilePlanComponentsAPI().getFilePlanComponent(filePlanComponent.getId());
    -        assertStatusCodeIs(NOT_FOUND);
    +        assertStatusCode(NOT_FOUND);
         }
     
         /**
    @@ -277,14 +268,11 @@ public class RecordCategoryTest extends BaseRestTest
                 children.add(child);
             }
     
    -        // Authenticate with admin user
    -        authenticateUser(dataUser.getAdminUser());
    -
             // List children from API
             FilePlanComponentsCollection apiChildren = getFilePlanComponentsAPI().listChildComponents(rootCategory.getId());
     
             // Check status code
    -        assertStatusCodeIs(OK);
    +        assertStatusCode(OK);
             logger.info("parent: " + rootCategory.getId());
     
             // Check listed children against created list
    @@ -355,9 +343,6 @@ public class RecordCategoryTest extends BaseRestTest
         {
             String COMPONENT_NAME = "Component"+getRandomAlphanumeric();
     
    -        // Authenticate with admin user
    -        authenticateUser(dataUser.getAdminUser());
    -
             //Create the category
             FilePlanComponentModel category = createCategory(FILE_PLAN_ALIAS, COMPONENT_NAME);
     
    @@ -373,7 +358,7 @@ public class RecordCategoryTest extends BaseRestTest
     
             //create the invalid node type
             getFilePlanComponentsAPI().createFilePlanComponent(recordCategory, category.getId());
    -        assertStatusCodeIs(UNPROCESSABLE_ENTITY);
    +        assertStatusCode(UNPROCESSABLE_ENTITY);
         }
     
     
    @@ -401,9 +386,7 @@ public class RecordCategoryTest extends BaseRestTest
          */
         private FilePlanComponentModel createComponent(String parentComponentId, String componentName, String componentType) throws Exception
         {
    -        authenticateUser(dataUser.getAdminUser());
    -
    -        //Build node  properties
    +        // Build node  properties
             FilePlanComponentModel component = FilePlanComponentModel.builder()
                     .name(componentName)
                     .nodeType(componentType)
    @@ -412,9 +395,9 @@ public class RecordCategoryTest extends BaseRestTest
                             .build())
                     .build();
     
    -        FilePlanComponentModel fpc = getFilePlanComponentsAPI().createFilePlanComponent(component, parentComponentId);
    -        assertStatusCodeIs(CREATED);
    +        FilePlanComponentModel filePlanComponent = getFilePlanComponentsAPI().createFilePlanComponent(component, parentComponentId);
    +        assertStatusCode(CREATED);
     
    -        return fpc;
    +        return filePlanComponent;
         }
     }
    diff --git a/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/fileplancomponents/RecordFolderTests.java b/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/fileplancomponents/RecordFolderTests.java
    index 396ccfafe5..a51a5dbcfe 100644
    --- a/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/fileplancomponents/RecordFolderTests.java
    +++ b/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/fileplancomponents/RecordFolderTests.java
    @@ -73,7 +73,7 @@ public class RecordFolderTests extends BaseRestTest
         @Autowired
         public DataUser dataUser;
     
    -    private static final int NUMBER_OF_FOLDERS= 5;
    +    private static final int NUMBER_OF_FOLDERS = 5;
         /**
          * Given that a record category exists
          * When I use the API to create a new record folder
    @@ -86,8 +86,8 @@ public class RecordFolderTests extends BaseRestTest
         public void createFolderTest() throws Exception
         {
             String CATEGORY = CATEGORY_NAME + getRandomAlphanumeric();
    +
             // Authenticate with admin user
    -        authenticateUser(dataUser.getAdminUser());
             FilePlanComponentModel filePlanComponent = createCategory(FILE_PLAN_ALIAS, CATEGORY);
     
             FilePlanComponentModel recordFolder = FilePlanComponentModel.builder()
    @@ -101,7 +101,7 @@ public class RecordFolderTests extends BaseRestTest
             // Create the record folder
             FilePlanComponentModel folder = getFilePlanComponentsAPI().createFilePlanComponent(recordFolder, filePlanComponent.getId());
     
    -        assertStatusCodeIs(CREATED);
    +        assertStatusCode(CREATED);
     
             // Check folder has been created  within the category created
             assertEquals(filePlanComponent.getId(),folder.getParentId());
    @@ -133,9 +133,6 @@ public class RecordFolderTests extends BaseRestTest
         @Bug(id="RM-4327")
         public void createFolderIntoSpecialContainers(String filePlanComponent) throws Exception
         {
    -        // Authenticate with admin user
    -        authenticateUser(dataUser.getAdminUser());
    -
             String componentID = getFilePlanComponentsAPI().getFilePlanComponent(filePlanComponent).getId();
     
             // Build the record category properties
    @@ -151,7 +148,7 @@ public class RecordFolderTests extends BaseRestTest
             getFilePlanComponentsAPI().createFilePlanComponent(recordFolder, componentID);
     
             // Check the API Response code
    -        assertStatusCodeIs(UNPROCESSABLE_ENTITY);
    +        assertStatusCode(UNPROCESSABLE_ENTITY);
         }
     
         /**
    @@ -166,8 +163,7 @@ public class RecordFolderTests extends BaseRestTest
         public void checkTheRecordFolderProperties() throws Exception
         {
             String CATEGORY = CATEGORY_NAME + getRandomAlphanumeric();
    -        // Authenticate with admin user
    -        authenticateUser(dataUser.getAdminUser());
    +
             FilePlanComponentModel category = createCategory(FILE_PLAN_ALIAS, CATEGORY);
             FilePlanComponentModel folder = createFolder(category.getId(),FOLDER_NAME);
     
    @@ -202,9 +198,6 @@ public class RecordFolderTests extends BaseRestTest
         {
             String CATEGORY = CATEGORY_NAME + getRandomAlphanumeric();
     
    -        // Authenticate with admin user
    -        authenticateUser(dataUser.getAdminUser());
    -
             //Create a record category
             FilePlanComponentModel category = createCategory(FILE_PLAN_ALIAS, CATEGORY);
     
    @@ -233,7 +226,7 @@ public class RecordFolderTests extends BaseRestTest
             FilePlanComponentModel folderUpdated = getFilePlanComponentsAPI().updateFilePlanComponent(recordFolder, folder.getId());
     
             // Check the Response Status Code
    -        assertStatusCodeIs(OK);
    +        assertStatusCode(OK);
     
             // Verify the returned properties for the file plan component - record folder
             assertEquals(folderName, folderUpdated.getName());
    @@ -259,9 +252,6 @@ public class RecordFolderTests extends BaseRestTest
         {
             String CATEGORY = CATEGORY_NAME + getRandomAlphanumeric();
     
    -        // Authenticate with admin user
    -        authenticateUser(dataUser.getAdminUser());
    -
             // Create the record category
             FilePlanComponentModel category = createCategory(FILE_PLAN_ALIAS, CATEGORY);
     
    @@ -271,12 +261,12 @@ public class RecordFolderTests extends BaseRestTest
             // Delete the Record folder
             getFilePlanComponentsAPI().deleteFilePlanComponent(folder.getId());
             // Check the Response Status Code
    -        assertStatusCodeIs(NO_CONTENT);
    +        assertStatusCode(NO_CONTENT);
     
             // Check the File Plan Component is not found
             getFilePlanComponentsAPI().getFilePlanComponent(folder.getId());
             // Check the Response Status Code
    -        assertStatusCodeIs(NOT_FOUND);
    +        assertStatusCode(NOT_FOUND);
         }
     
         /**
    @@ -296,7 +286,6 @@ public class RecordFolderTests extends BaseRestTest
             String CATEGORY = CATEGORY_NAME + getRandomAlphanumeric();
     
             // Authenticate with admin user
    -        authenticateUser(dataUser.getAdminUser());
             FilePlanComponentModel category = createCategory(FILE_PLAN_ALIAS, CATEGORY);
     
             // Add child olders
    @@ -310,14 +299,11 @@ public class RecordFolderTests extends BaseRestTest
                 children.add(child);
             }
     
    -        // Authenticate with admin user
    -        authenticateUser(dataUser.getAdminUser());
    -
             // List children from API
             FilePlanComponentsCollection apiChildren = getFilePlanComponentsAPI().listChildComponents(category.getId());
     
             // Check status code
    -        assertStatusCodeIs(OK);
    +        assertStatusCode(OK);
     
             // Check listed children against created list
             apiChildren.getEntries().forEach(c ->
    @@ -373,21 +359,19 @@ public class RecordFolderTests extends BaseRestTest
         public void createFolderWithRelativePath() throws Exception
         {
             //RelativePath specify the container structure to create relative to the record folder to be created
    -        String RELATIVE_PATH = LocalDateTime.now().getYear()+"/"+ LocalDateTime.now().getMonth()+"/"+ LocalDateTime.now().getDayOfMonth();
    +        String relativePath = LocalDateTime.now().getYear() + "/" + LocalDateTime.now().getMonth() + "/" + LocalDateTime.now().getDayOfMonth();
     
    -        // Authenticate with admin user
    -        authenticateUser(dataUser.getAdminUser());
             //The record folder to be created
             FilePlanComponentModel recordFolder = FilePlanComponentModel.builder()
                                                               .name(FOLDER_NAME)
                                                               .nodeType(RECORD_FOLDER_TYPE)
    -                                                          .relativePath(RELATIVE_PATH)
    +                                                          .relativePath(relativePath)
                                                               .build();
     
             // Create the record folder
             FilePlanComponentModel folder = getFilePlanComponentsAPI().createFilePlanComponent(recordFolder, FILE_PLAN_ALIAS, "include=" + PATH);
             //Check the API response code
    -        assertStatusCodeIs(CREATED);
    +        assertStatusCode(CREATED);
     
             // Verify the returned properties for the file plan component - record folder
             assertFalse(folder.getIsCategory());
    @@ -395,24 +379,24 @@ public class RecordFolderTests extends BaseRestTest
             assertTrue(folder.getIsRecordFolder());
     
             //Check the path return contains the RELATIVE_PATH
    -        assertTrue(folder.getPath().getName().contains(RELATIVE_PATH));
    +        assertTrue(folder.getPath().getName().contains(relativePath));
             //check the parent is a category
             assertTrue(getFilePlanComponentsAPI().getFilePlanComponent(folder.getParentId()).getIsCategory());
     
             //check the created folder from the server
             folder = getFilePlanComponentsAPI().getFilePlanComponent(folder.getId(), "include=" + PATH);
             //Check the API response code
    -        assertStatusCodeIs(OK);
    +        assertStatusCode(OK);
             // Verify the returned properties for the file plan component - record folder
             assertFalse(folder.getIsCategory());
             assertFalse(folder.getIsFile());
             assertTrue(folder.getIsRecordFolder());
     
             //Check the path return contains the RELATIVE_PATH
    -        assertTrue(folder.getPath().getName().contains(RELATIVE_PATH));
    +        assertTrue(folder.getPath().getName().contains(relativePath));
     
             //New Relative Path only a part of containers need to be created before the record folder
    -        String NEW_RELATIVE_PATH = LocalDateTime.now().getYear() + "/" + LocalDateTime.now().getMonth() + "/" +( LocalDateTime.now().getDayOfMonth()+1);
    +        String NEW_RELATIVE_PATH = LocalDateTime.now().getYear() + "/" + LocalDateTime.now().getMonth() + "/" + (LocalDateTime.now().getDayOfMonth() + 1);
             //The record folder to be created
             FilePlanComponentModel recordFolder2 = FilePlanComponentModel.builder()
                                                               .name(FOLDER_NAME)
    @@ -423,7 +407,7 @@ public class RecordFolderTests extends BaseRestTest
             // Create the record folder
             FilePlanComponentModel folder2 = getFilePlanComponentsAPI().createFilePlanComponent(recordFolder2, FILE_PLAN_ALIAS, "include=" + PATH);
             //Check the API response code
    -        assertStatusCodeIs(CREATED);
    +        assertStatusCode(CREATED);
     
             // Verify the returned properties for the file plan component - record folder
             assertFalse(folder2.getIsCategory());
    @@ -438,7 +422,7 @@ public class RecordFolderTests extends BaseRestTest
             // Check the folder created on the server
             folder2 = getFilePlanComponentsAPI().getFilePlanComponent(folder2.getId(), "include=" + PATH);
             //Check the API response code
    -        assertStatusCodeIs(OK);
    +        assertStatusCode(OK);
     
             // Verify the returned properties for the file plan component - record folder
             assertFalse(folder2.getIsCategory());
    @@ -451,7 +435,6 @@ public class RecordFolderTests extends BaseRestTest
         @AfterClass (alwaysRun = true)
         public void tearDown() throws Exception
         {
    -        authenticateUser(dataUser.getAdminUser());
             getFilePlanComponentsAPI().listChildComponents(FILE_PLAN_ALIAS).getEntries().forEach(filePlanComponentEntry ->
             {
                 try
    diff --git a/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/fileplancomponents/UnfiledRecordsFolderTests.java b/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/fileplancomponents/UnfiledRecordsFolderTests.java
    index 53fa557042..dc514f59b4 100644
    --- a/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/fileplancomponents/UnfiledRecordsFolderTests.java
    +++ b/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/fileplancomponents/UnfiledRecordsFolderTests.java
    @@ -93,9 +93,6 @@ public class UnfiledRecordsFolderTests extends BaseRestTest
         @Test(description = "Create root unfiled records folder")
         public void createRootUnfiledRecordsFolder() throws Exception
         {
    -        // Authenticate with admin user
    -        authenticateUser(dataUser.getAdminUser());
    -
             String folderName = "Folder " + getRandomAlphanumeric();
             String folderTitle = folderName + " Title";
             String folderDescription = folderName + " Description";
    @@ -113,7 +110,7 @@ public class UnfiledRecordsFolderTests extends BaseRestTest
             FilePlanComponentModel filePlanComponent = getFilePlanComponentsAPI().createFilePlanComponent(unfiledFolder, UNFILED_RECORDS_CONTAINER_ALIAS);
     
             // Verify the status code
    -        assertStatusCodeIs(CREATED);
    +        assertStatusCode(CREATED);
     
             // Verify the returned file plan component
             assertFalse(filePlanComponent.getIsCategory());
    @@ -141,8 +138,6 @@ public class UnfiledRecordsFolderTests extends BaseRestTest
         )
         public void onlyRecordFoldersCanBeCreatedAtUnfiledRecordsRoot(String filePlanComponentType)
         {
    -        authenticateUser(dataUser.getAdminUser());
    -
             String folderName = "Folder " + getRandomAlphanumeric();
             String folderTitle = folderName + " Title";
             String folderDescription = folderName + " Description";
    @@ -168,7 +163,7 @@ public class UnfiledRecordsFolderTests extends BaseRestTest
             }
     
             // Verify the status code
    -        assertStatusCodeIs(UNPROCESSABLE_ENTITY);
    +        assertStatusCode(UNPROCESSABLE_ENTITY);
         }
     
         /**
    @@ -181,8 +176,6 @@ public class UnfiledRecordsFolderTests extends BaseRestTest
         @Test(description = "Child unfiled records folder can be created in a parent unfiled records folder")
         public void childUnfiledRecordsFolderCanBeCreated() throws Exception
         {
    -        authenticateUser(dataUser.getAdminUser());
    -
             String parentFolderName = "Parent Folder " + getRandomAlphanumeric();
             String childFolderName = "Child Folder " + getRandomAlphanumeric();
             String childFolderTitle = childFolderName + " Title";
    @@ -206,7 +199,7 @@ public class UnfiledRecordsFolderTests extends BaseRestTest
             FilePlanComponentModel childFolder = getFilePlanComponentsAPI().createFilePlanComponent(unfiledFolder, parentFolder.getId());
     
             // Verify the status code
    -        assertStatusCodeIs(CREATED);
    +        assertStatusCode(CREATED);
     
             // Verify the returned file plan component
             assertFalse(childFolder.getIsCategory());
    @@ -228,7 +221,7 @@ public class UnfiledRecordsFolderTests extends BaseRestTest
             // Does child's parent point to it?
             // Perform another call as our parentFolder had been executed before childFolder existed
             FilePlanComponentsCollection parentsChildren = getFilePlanComponentsAPI().listChildComponents(parentFolder.getId());
    -        assertStatusCodeIs(OK);
    +        assertStatusCode(OK);
             List childIds = parentsChildren.getEntries()
                 .stream()
                 .map(c -> c.getFilePlanComponentModel().getId())
    @@ -251,7 +244,6 @@ public class UnfiledRecordsFolderTests extends BaseRestTest
         @Test(description = "Unfiled record folder")
         public void editUnfiledRecordsFolder() throws Exception
         {
    -        authenticateUser(dataUser.getAdminUser());
             String modified = "Modified ";
             String folderName = "Folder To Modify" + getRandomAlphanumeric();
     
    @@ -271,7 +263,7 @@ public class UnfiledRecordsFolderTests extends BaseRestTest
             // Update the unfiled records folder
             getFilePlanComponentsAPI().updateFilePlanComponent(folderToUpdate, folderToModify.getId());
             // Verify the status code
    -        assertStatusCodeIs(OK);
    +        assertStatusCode(OK);
     
             // This is to ensure the change was actually applied, rather than simply trusting the object returned by PUT
             FilePlanComponentModel renamedFolder = getFilePlanComponentsAPI().getFilePlanComponent(folderToModify.getId());
    @@ -292,7 +284,6 @@ public class UnfiledRecordsFolderTests extends BaseRestTest
         @Test(description = "Delete unfiled record folder")
         public void deleteUnfiledRecordsFolder() throws Exception
         {
    -        authenticateUser(dataUser.getAdminUser());
             String folderName = "Folder To Delete" + getRandomAlphanumeric();
     
             // Create folderToDelete
    @@ -303,10 +294,10 @@ public class UnfiledRecordsFolderTests extends BaseRestTest
             getFilePlanComponentsAPI().deleteFilePlanComponent(folderToDelete.getId());
     
             // Verify the status code
    -        assertStatusCodeIs(NO_CONTENT);
    +        assertStatusCode(NO_CONTENT);
     
             // Deleted component should no longer be retrievable
             getFilePlanComponentsAPI().getFilePlanComponent(folderToDelete.getId());
    -        assertStatusCodeIs(NOT_FOUND);
    +        assertStatusCode(NOT_FOUND);
         }
     }
    diff --git a/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/site/RMSiteTests.java b/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/site/RMSiteTests.java
    index 8b46820486..9c5f336447 100644
    --- a/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/site/RMSiteTests.java
    +++ b/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/site/RMSiteTests.java
    @@ -27,10 +27,15 @@
     package org.alfresco.rest.rm.community.site;
     
     import static org.alfresco.rest.rm.community.base.TestData.ANOTHER_ADMIN;
    -import static org.alfresco.rest.rm.community.base.TestData.DEFAULT_EMAIL;
     import static org.alfresco.rest.rm.community.base.TestData.DEFAULT_PASSWORD;
     import static org.alfresco.rest.rm.community.model.site.RMSiteCompliance.DOD5015;
     import static org.alfresco.rest.rm.community.model.site.RMSiteCompliance.STANDARD;
    +import static org.alfresco.rest.rm.community.utils.RMSiteUtil.RM_DESCRIPTION;
    +import static org.alfresco.rest.rm.community.utils.RMSiteUtil.RM_ID;
    +import static org.alfresco.rest.rm.community.utils.RMSiteUtil.RM_TITLE;
    +import static org.alfresco.rest.rm.community.utils.RMSiteUtil.createDOD5015RMSiteModel;
    +import static org.alfresco.rest.rm.community.utils.RMSiteUtil.createStandardRMSiteModel;
    +import static org.alfresco.utility.constants.UserRole.SiteManager;
     import static org.springframework.http.HttpStatus.BAD_REQUEST;
     import static org.springframework.http.HttpStatus.CONFLICT;
     import static org.springframework.http.HttpStatus.CREATED;
    @@ -42,10 +47,9 @@ import static org.springframework.social.alfresco.api.entities.Site.Visibility.P
     import static org.testng.Assert.assertEquals;
     import static org.testng.Assert.assertNotNull;
     
    -import org.alfresco.dataprep.UserService;
     import org.alfresco.rest.rm.community.base.BaseRestTest;
     import org.alfresco.rest.rm.community.model.site.RMSiteModel;
    -import org.alfresco.utility.constants.UserRole;
    +import org.alfresco.rest.rm.community.requests.RMUserAPI;
     import org.alfresco.utility.data.DataUser;
     import org.alfresco.utility.data.RandomData;
     import org.alfresco.utility.model.UserModel;
    @@ -63,10 +67,10 @@ import org.testng.annotations.Test;
     public class RMSiteTests extends BaseRestTest
     {
         @Autowired
    -    private UserService userService;
    +    private DataUser dataUser;
     
         @Autowired
    -    private DataUser dataUser;
    +    private RMUserAPI rmUserAPI;
     
         /**
          * Given that RM module is installed
    @@ -79,9 +83,6 @@ public class RMSiteTests extends BaseRestTest
         )
         public void createRMSiteAsAdminUser() throws Exception
         {
    -        // Authenticate with admin user
    -        authenticateUser(dataUser.getAdminUser());
    -
             // Check if the RM site exists
             if (getRMSiteAPI().existsRMSite())
             {
    @@ -90,14 +91,10 @@ public class RMSiteTests extends BaseRestTest
             }
     
             // Create the RM site
    -        RMSiteModel rmSiteModel = RMSiteModel.builder().compliance(STANDARD).build();
    -        rmSiteModel.setTitle(RM_TITLE);
    -        rmSiteModel.setDescription(RM_DESCRIPTION);
    -
    -        RMSiteModel rmSiteResponse = getRMSiteAPI().createRMSite(rmSiteModel);
    +        RMSiteModel rmSiteResponse = getRMSiteAPI().createRMSite(createStandardRMSiteModel());
     
             // Verify the status code
    -        assertStatusCodeIs(CREATED);
    +        assertStatusCode(CREATED);
     
             // Verify the returned file plan component
             assertEquals(rmSiteResponse.getId(), RM_ID);
    @@ -105,7 +102,7 @@ public class RMSiteTests extends BaseRestTest
             assertEquals(rmSiteResponse.getDescription(), RM_DESCRIPTION);
             assertEquals(rmSiteResponse.getCompliance(), STANDARD);
             assertEquals(rmSiteResponse.getVisibility(), PUBLIC);
    -        assertEquals(rmSiteResponse.getRole(), UserRole.SiteManager.toString());
    +        assertEquals(rmSiteResponse.getRole(), SiteManager.toString());
         }
     
         /**
    @@ -122,9 +119,6 @@ public class RMSiteTests extends BaseRestTest
             // Create the RM site if it does not exist
             createRMSiteIfNotExists();
     
    -        // Authenticate with admin user
    -        authenticateUser(dataUser.getAdminUser());
    -
             // Construct new properties
             String newTitle = RM_TITLE + "createRMSiteWhenSiteExists";
             String newDescription = RM_DESCRIPTION + "createRMSiteWhenSiteExists";
    @@ -137,7 +131,7 @@ public class RMSiteTests extends BaseRestTest
             getRMSiteAPI().createRMSite(rmSiteModel);
     
             // Verify the status code
    -        assertStatusCodeIs(CONFLICT);
    +        assertStatusCode(CONFLICT);
         }
     
         /**
    @@ -151,14 +145,11 @@ public class RMSiteTests extends BaseRestTest
         )
         public void deleteRMSite() throws Exception
         {
    -        // Authenticate with admin user
    -        authenticateUser(dataUser.getAdminUser());
    -
             // Delete the RM site
             getRMSiteAPI().deleteRMSite();
     
             // Verify the status code
    -        assertStatusCodeIs(NO_CONTENT);
    +        assertStatusCode(NO_CONTENT);
         }
     
         /**
    @@ -172,14 +163,11 @@ public class RMSiteTests extends BaseRestTest
         )
         public void getRMSite() throws Exception
         {
    -        // Authenticate with admin user
    -        authenticateUser(dataUser.getAdminUser());
    -
             // Check if RM site exists
             if (!getRMSiteAPI().existsRMSite())
             {
                 // Verify the status code when RM site  doesn't exist
    -            assertStatusCodeIs(NOT_FOUND);
    +            assertStatusCode(NOT_FOUND);
                 createRMSiteIfNotExists();
             }
             else
    @@ -188,7 +176,7 @@ public class RMSiteTests extends BaseRestTest
                 RMSiteModel rmSiteModel = getRMSiteAPI().getSite();
     
                 // Verify the status code
    -            assertStatusCodeIs(OK);
    +            assertStatusCode(OK);
                 assertEquals(rmSiteModel.getId(), RM_ID);
                 assertEquals(rmSiteModel.getDescription(), RM_DESCRIPTION);
                 assertEquals(rmSiteModel.getCompliance(), STANDARD);
    @@ -208,9 +196,6 @@ public class RMSiteTests extends BaseRestTest
         @Bug (id="RM-4289")
         public void createRMSiteAsAnotherAdminUser() throws Exception
         {
    -        // Authenticate with admin user
    -        authenticateUser(dataUser.getAdminUser());
    -
             // Check if the RM site exists
             if (getRMSiteAPI().existsRMSite())
             {
    @@ -218,32 +203,14 @@ public class RMSiteTests extends BaseRestTest
                 getRMSiteAPI().deleteRMSite();
             }
     
    -        // Disconnect the current user from the API session
    -        disconnect();
    -
             // Create user
    -        userService.create(dataUser.getAdminUser().getUsername(),
    -                dataUser.getAdminUser().getPassword(),
    -                ANOTHER_ADMIN,
    -                DEFAULT_PASSWORD,
    -                DEFAULT_EMAIL,
    -                ANOTHER_ADMIN,
    -                ANOTHER_ADMIN);
    -
    -        // Build the user model
    -        UserModel userModel = new UserModel(ANOTHER_ADMIN,DEFAULT_PASSWORD);
    -
    -        // Authenticate as that new user
    -        authenticateUser(userModel);
    +        rmUserAPI.createUser(ANOTHER_ADMIN);
     
             // Create the RM site
    -        RMSiteModel rmSiteModel = RMSiteModel.builder().compliance(DOD5015).build();
    -        rmSiteModel.setTitle(RM_TITLE);
    -        rmSiteModel.setDescription(RM_DESCRIPTION);
    -        rmSiteModel = getRMSiteAPI().createRMSite(rmSiteModel);
    +        RMSiteModel rmSiteModel = getRMSiteAPI(new UserModel(ANOTHER_ADMIN, DEFAULT_PASSWORD)).createRMSite(createDOD5015RMSiteModel());
     
             // Verify the status code
    -        assertStatusCodeIs(CREATED);
    +        assertStatusCode(CREATED);
     
             // Verify the returned file plan component
             assertEquals(rmSiteModel.getId(), RM_ID);
    @@ -251,7 +218,7 @@ public class RMSiteTests extends BaseRestTest
             assertEquals(rmSiteModel.getDescription(), RM_DESCRIPTION);
             assertEquals(rmSiteModel.getCompliance(), DOD5015);
             assertEquals(rmSiteModel.getVisibility(), PUBLIC);
    -        assertEquals(rmSiteModel.getRole(), UserRole.SiteManager.toString());
    +        assertEquals(rmSiteModel.getRole(), SiteManager.toString());
         }
     
         /**
    @@ -262,14 +229,11 @@ public class RMSiteTests extends BaseRestTest
          * Then RM site details are updated
          */
         @Test
    -    public void updateRMSiteDetails()throws Exception
    +    public void updateRMSiteDetails() throws Exception
         {
             String NEW_TITLE = RM_TITLE + RandomData.getRandomAlphanumeric();
             String NEW_DESCRIPTION = RM_DESCRIPTION + RandomData.getRandomAlphanumeric();
     
    -        // Authenticate with admin user
    -        authenticateUser(dataUser.getAdminUser());
    -
             // Create the site if it does not exist
             createRMSiteIfNotExists();
     
    @@ -278,32 +242,17 @@ public class RMSiteTests extends BaseRestTest
             rmSiteToUpdate.setTitle(NEW_TITLE);
             rmSiteToUpdate.setDescription(NEW_DESCRIPTION);
     
    -        // Disconnect the user from the API session
    -        disconnect();
    -
    -        // Create a random user
    -        UserModel nonRMuser = dataUser.createRandomTestUser("testUser");
    -
    -        // Authenticate as that random user
    -        authenticateUser(nonRMuser);
    -
             // Create the RM site
    -        getRMSiteAPI().updateRMSite(rmSiteToUpdate);
    +        getRMSiteAPI(dataUser.createRandomTestUser("testUser")).updateRMSite(rmSiteToUpdate);
     
             // Verify the status code
    -        assertStatusCodeIs(FORBIDDEN);
    -
    -        // Disconnect the user from the API session
    -        disconnect();
    -
    -        // Authenticate with admin user
    -        authenticateUser(dataUser.getAdminUser());
    +        assertStatusCode(FORBIDDEN);
     
             // Update the RM Site
             RMSiteModel rmSiteModel = getRMSiteAPI().updateRMSite(rmSiteToUpdate);
     
             // Verify the response status code
    -        assertStatusCodeIs(OK);
    +        assertStatusCode(OK);
     
             // Verify the returned file plan component
             assertEquals(rmSiteModel.getId(), RM_ID);
    @@ -321,19 +270,16 @@ public class RMSiteTests extends BaseRestTest
         @Test
         public void updateRMSiteComplianceAsAdmin() throws Exception
         {
    -        // Authenticate with admin user
    -        authenticateUser(dataUser.getAdminUser());
    -
             // Create the RM site if it does not exist
             createRMSiteIfNotExists();
     
             // Build the RM site properties
    -        RMSiteModel rmSiteToUpdate =  RMSiteModel.builder().compliance(DOD5015).build();
    +        RMSiteModel rmSiteToUpdate = RMSiteModel.builder().compliance(DOD5015).build();
     
             // Update the RM site
             getRMSiteAPI().updateRMSite(rmSiteToUpdate);
     
             // Verify the response status code
    -        assertStatusCodeIs(BAD_REQUEST);
    +        assertStatusCode(BAD_REQUEST);
         }
     }
    diff --git a/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/utils/FilePlanComponentsUtil.java b/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/utils/FilePlanComponentsUtil.java
    new file mode 100644
    index 0000000000..4a623e0611
    --- /dev/null
    +++ b/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/utils/FilePlanComponentsUtil.java
    @@ -0,0 +1,101 @@
    +/*
    + * #%L
    + * Alfresco Records Management Module
    + * %%
    + * Copyright (C) 2005 - 2016 Alfresco Software Limited
    + * %%
    + * This file is part of the Alfresco software.
    + * -
    + * If the software was purchased under a paid Alfresco license, the terms of
    + * the paid license agreement will prevail.  Otherwise, the software is
    + * provided under the following open source license terms:
    + * -
    + * Alfresco is free software: you can redistribute it and/or modify
    + * it under the terms of the GNU Lesser General Public License as published by
    + * the Free Software Foundation, either version 3 of the License, or
    + * (at your option) any later version.
    + * -
    + * Alfresco is distributed in the hope that it will be useful,
    + * but WITHOUT ANY WARRANTY; without even the implied warranty of
    + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    + * GNU Lesser General Public License for more details.
    + * -
    + * You should have received a copy of the GNU Lesser General Public License
    + * along with Alfresco. If not, see .
    + * #L%
    + */
    +package org.alfresco.rest.rm.community.utils;
    +
    +import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentType.CONTENT_TYPE;
    +import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentType.NON_ELECTRONIC_RECORD_TYPE;
    +import static org.alfresco.utility.data.RandomData.getRandomAlphanumeric;
    +
    +import org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentModel;
    +import org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentProperties;
    +
    +/**
    + * FIXME!!!
    + *
    + * @author Tuna Aksoy
    + * @since 2.6
    + */
    +public class FilePlanComponentsUtil
    +{
    +    private FilePlanComponentsUtil()
    +    {
    +        // Intentionally blank
    +    }
    +
    +    /**
    +     *  FIXME!!!
    +     *
    +     * @param nodeType FIXME!!!
    +     * @return FIXME!!!
    +     */
    +    private static FilePlanComponentModel createRecordModel(String nodeType)
    +    {
    +        return FilePlanComponentModel.builder()
    +                .name("Record " + getRandomAlphanumeric())
    +                .nodeType(nodeType)
    +                .build();
    +    }
    +
    +    /**
    +     * FIXME!!!
    +     *
    +     * @return FIXME!!!
    +     */
    +    public static FilePlanComponentModel createElectronicRecordModel()
    +    {
    +        return createRecordModel(CONTENT_TYPE);
    +    }
    +
    +    /**
    +     * FIXME!!!
    +     *
    +     * @return FIXME!!!
    +     */
    +    public static FilePlanComponentModel createNonElectronicRecordModel()
    +    {
    +        return createRecordModel(NON_ELECTRONIC_RECORD_TYPE);
    +    }
    +
    +    /**
    +     * FIXME!!!
    +     *
    +     * @param name FIXME!!!
    +     * @param type FIXME!!!
    +     * @param title FIXME!!!
    +     * @return
    +     */
    +    public static FilePlanComponentModel createFilePlanComponentModel(String name, String type, String title)
    +    {
    +        return FilePlanComponentModel.builder()
    +                .name(name)
    +                .nodeType(type)
    +                .properties(FilePlanComponentProperties.builder()
    +                                .title(title)
    +                                .build())
    +                .build();
    +    }
    +}
    diff --git a/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/utils/RMSiteUtil.java b/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/utils/RMSiteUtil.java
    new file mode 100644
    index 0000000000..3864aed940
    --- /dev/null
    +++ b/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/utils/RMSiteUtil.java
    @@ -0,0 +1,87 @@
    +/*
    + * #%L
    + * Alfresco Records Management Module
    + * %%
    + * Copyright (C) 2005 - 2016 Alfresco Software Limited
    + * %%
    + * This file is part of the Alfresco software.
    + * -
    + * If the software was purchased under a paid Alfresco license, the terms of
    + * the paid license agreement will prevail.  Otherwise, the software is
    + * provided under the following open source license terms:
    + * -
    + * Alfresco is free software: you can redistribute it and/or modify
    + * it under the terms of the GNU Lesser General Public License as published by
    + * the Free Software Foundation, either version 3 of the License, or
    + * (at your option) any later version.
    + * -
    + * Alfresco is distributed in the hope that it will be useful,
    + * but WITHOUT ANY WARRANTY; without even the implied warranty of
    + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    + * GNU Lesser General Public License for more details.
    + * -
    + * You should have received a copy of the GNU Lesser General Public License
    + * along with Alfresco. If not, see .
    + * #L%
    + */
    +package org.alfresco.rest.rm.community.utils;
    +
    +import static org.alfresco.rest.rm.community.model.site.RMSiteCompliance.DOD5015;
    +import static org.alfresco.rest.rm.community.model.site.RMSiteCompliance.STANDARD;
    +
    +import org.alfresco.rest.rm.community.model.site.RMSiteCompliance;
    +import org.alfresco.rest.rm.community.model.site.RMSiteModel;
    +
    +/**
    + * FIXME!!!
    + *
    + * @author Tuna Aksoy
    + * @since 2.6
    + */
    +public class RMSiteUtil
    +{
    +    private RMSiteUtil()
    +    {
    +        // Intentionally blank
    +    }
    +
    +    /** Constants */
    +    public static final String RM_ID = "rm";
    +    public static final String RM_TITLE = "Records Management";
    +    public static final String RM_DESCRIPTION = "Records Management Site";
    +
    +    /**
    +     * FIXME!!!
    +     *
    +     * @param compliance FIXME!!!
    +     * @return FIXME!!!
    +     */
    +    private static RMSiteModel createRMSiteModel(RMSiteCompliance compliance)
    +    {
    +        RMSiteModel rmSiteModel =  RMSiteModel.builder().compliance(compliance).build();
    +        rmSiteModel.setTitle(RM_TITLE);
    +        rmSiteModel.setDescription(RM_DESCRIPTION);
    +        return rmSiteModel;
    +    }
    +
    +    /**
    +     * FIXME!!!
    +     *
    +     * @return FIXME!!!
    +     */
    +    public static RMSiteModel createStandardRMSiteModel()
    +    {
    +        return createRMSiteModel(STANDARD);
    +    }
    +
    +    /**
    +     * FIXME!!!
    +     *
    +     * @return FIXME!!!
    +     */
    +    public static RMSiteModel createDOD5015RMSiteModel()
    +    {
    +        return createRMSiteModel(DOD5015);
    +    }
    +
    +}
    
    From 2be7e42f93697cfccda712719d287e0782af5d1d Mon Sep 17 00:00:00 2001
    From: Tuna Aksoy 
    Date: Sun, 25 Dec 2016 01:57:23 +0000
    Subject: [PATCH 4/9] RM-4488 (Refactor REST API Automation test code according
     to the latest changes)
    
    ---
     .../org/alfresco/rest/core/RMRestWrapper.java |  6 +++++
     .../requests/FilePlanComponents.java          |  2 +-
     .../rm/community/requests/RMModelRequest.java |  1 +
     .../fileplancomponents/DeleteRecordTests.java |  4 +---
     .../ElectronicRecordTests.java                |  6 ++---
     .../rest/rm/community/site/RMSiteTests.java   |  9 ++++----
     .../utils/FilePlanComponentsUtil.java         |  3 +++
     .../rest/rm/community/utils/RMSiteUtil.java   | 22 ++++++++++++++-----
     8 files changed, 36 insertions(+), 17 deletions(-)
    
    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 1956a6cbf6..d8d469ca26 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
    @@ -28,6 +28,9 @@ package org.alfresco.rest.core;
     
     import org.alfresco.rest.rm.community.requests.igCoreAPI.RestIGCoreAPI;
     import org.springframework.beans.factory.annotation.Autowired;
    +import org.springframework.context.annotation.Primary;
    +import org.springframework.context.annotation.Scope;
    +import org.springframework.stereotype.Service;
     
     /**
      * FIXME!!!
    @@ -35,6 +38,9 @@ import org.springframework.beans.factory.annotation.Autowired;
      * @author Tuna Aksoy
      * @since 2.6
      */
    +@Primary
    +@Service
    +@Scope(value = "prototype")
     public class RMRestWrapper extends RestWrapper
     {
         @Autowired
    diff --git a/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/requests/FilePlanComponents.java b/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/requests/FilePlanComponents.java
    index e5345c868f..1016b0727c 100644
    --- a/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/requests/FilePlanComponents.java
    +++ b/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/requests/FilePlanComponents.java
    @@ -205,7 +205,7 @@ public class FilePlanComponents extends RMModelRequest
          */
         public FilePlanComponentModel createElectronicRecord(FilePlanComponentModel electronicRecordModel, File recordContent, String parentId) throws Exception
         {
    -        mandatoryObject("filePlanComponentProperties", electronicRecordModel);
    +        mandatoryObject("electronicRecordModel", electronicRecordModel);
             mandatoryString("parentId", parentId);
             if (!electronicRecordModel.getNodeType().equals(CONTENT_TYPE))
             {
    diff --git a/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/requests/RMModelRequest.java b/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/requests/RMModelRequest.java
    index 6edebd710a..c171e72e49 100644
    --- a/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/requests/RMModelRequest.java
    +++ b/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/requests/RMModelRequest.java
    @@ -53,5 +53,6 @@ public abstract class RMModelRequest extends ModelRequest
         public RMModelRequest(RMRestWrapper rmRestWrapper)
         {
             super(rmRestWrapper);
    +        this.rmRestWrapper = rmRestWrapper;
         }
     }
    diff --git a/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/fileplancomponents/DeleteRecordTests.java b/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/fileplancomponents/DeleteRecordTests.java
    index 2328a6a0a3..7fd8526f46 100644
    --- a/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/fileplancomponents/DeleteRecordTests.java
    +++ b/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/fileplancomponents/DeleteRecordTests.java
    @@ -27,6 +27,7 @@
     package org.alfresco.rest.rm.community.fileplancomponents;
     
     import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentAlias.UNFILED_RECORDS_CONTAINER_ALIAS;
    +import static org.alfresco.rest.rm.community.utils.FilePlanComponentsUtil.IMAGE_FILE;
     import static org.alfresco.rest.rm.community.utils.FilePlanComponentsUtil.createElectronicRecordModel;
     import static org.alfresco.rest.rm.community.utils.FilePlanComponentsUtil.createNonElectronicRecordModel;
     import static org.springframework.http.HttpStatus.CREATED;
    @@ -65,9 +66,6 @@ public class DeleteRecordTests extends BaseRestTest
         @Autowired
         private DataUser dataUser;
     
    -    /** image resource file to be used for records body */
    -    private static final String IMAGE_FILE = "money.JPG";
    -
         /**
          * 
          * Given a record
    diff --git a/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/fileplancomponents/ElectronicRecordTests.java b/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/fileplancomponents/ElectronicRecordTests.java
    index 29094c8f3e..dbc32e38c5 100644
    --- a/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/fileplancomponents/ElectronicRecordTests.java
    +++ b/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/fileplancomponents/ElectronicRecordTests.java
    @@ -32,6 +32,7 @@ import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanCo
     import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentType.CONTENT_TYPE;
     import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentType.RECORD_FOLDER_TYPE;
     import static org.alfresco.rest.rm.community.util.PojoUtility.toJson;
    +import static org.alfresco.rest.rm.community.utils.FilePlanComponentsUtil.IMAGE_FILE;
     import static org.alfresco.rest.rm.community.utils.FilePlanComponentsUtil.createElectronicRecordModel;
     import static org.springframework.http.HttpStatus.BAD_REQUEST;
     import static org.springframework.http.HttpStatus.CREATED;
    @@ -55,9 +56,6 @@ import org.testng.annotations.Test;
      */
     public class ElectronicRecordTests extends BaseRestTest
     {
    -    /** image resource file to be used for records body */
    -    private static final String IMAGE_FILE = "money.JPG";
    -
         /** Valid root containers where electronic records can be created */
         @DataProvider(name = "invalidParentContainers")
         public Object[][] invalidContainers() throws Exception
    @@ -199,7 +197,7 @@ public class ElectronicRecordTests extends BaseRestTest
         public void canCreateElectronicRecordsInValidContainers(FilePlanComponentModel container) throws Exception
         {
             FilePlanComponentModel record = createElectronicRecordModel();
    -        String newRecordId = getFilePlanComponentsAPI().createElectronicRecord(createElectronicRecordModel(), IMAGE_FILE, container.getId()).getId();
    +        String newRecordId = getFilePlanComponentsAPI().createElectronicRecord(record, IMAGE_FILE, container.getId()).getId();
     
             // verify the create request status code
             assertStatusCode(CREATED);
    diff --git a/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/site/RMSiteTests.java b/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/site/RMSiteTests.java
    index 9c5f336447..89e46f1445 100644
    --- a/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/site/RMSiteTests.java
    +++ b/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/site/RMSiteTests.java
    @@ -34,6 +34,7 @@ import static org.alfresco.rest.rm.community.utils.RMSiteUtil.RM_DESCRIPTION;
     import static org.alfresco.rest.rm.community.utils.RMSiteUtil.RM_ID;
     import static org.alfresco.rest.rm.community.utils.RMSiteUtil.RM_TITLE;
     import static org.alfresco.rest.rm.community.utils.RMSiteUtil.createDOD5015RMSiteModel;
    +import static org.alfresco.rest.rm.community.utils.RMSiteUtil.createRMSiteModel;
     import static org.alfresco.rest.rm.community.utils.RMSiteUtil.createStandardRMSiteModel;
     import static org.alfresco.utility.constants.UserRole.SiteManager;
     import static org.springframework.http.HttpStatus.BAD_REQUEST;
    @@ -124,10 +125,7 @@ public class RMSiteTests extends BaseRestTest
             String newDescription = RM_DESCRIPTION + "createRMSiteWhenSiteExists";
     
             // Create the RM site
    -        RMSiteModel rmSiteModel = RMSiteModel.builder().compliance(STANDARD).build();
    -        rmSiteModel.setTitle(newTitle);
    -        rmSiteModel.setDescription(newDescription);
    -
    +        RMSiteModel rmSiteModel = createRMSiteModel(STANDARD, newTitle, newDescription);
             getRMSiteAPI().createRMSite(rmSiteModel);
     
             // Verify the status code
    @@ -145,6 +143,9 @@ public class RMSiteTests extends BaseRestTest
         )
         public void deleteRMSite() throws Exception
         {
    +        // Create the RM site if it does not exist
    +        createRMSiteIfNotExists();
    +
             // Delete the RM site
             getRMSiteAPI().deleteRMSite();
     
    diff --git a/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/utils/FilePlanComponentsUtil.java b/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/utils/FilePlanComponentsUtil.java
    index 4a623e0611..99eb79aa78 100644
    --- a/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/utils/FilePlanComponentsUtil.java
    +++ b/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/utils/FilePlanComponentsUtil.java
    @@ -46,6 +46,9 @@ public class FilePlanComponentsUtil
             // Intentionally blank
         }
     
    +    /** image resource file to be used for records body */
    +    public static final String IMAGE_FILE = "money.JPG";
    +
         /**
          *  FIXME!!!
          *
    diff --git a/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/utils/RMSiteUtil.java b/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/utils/RMSiteUtil.java
    index 3864aed940..f13912684d 100644
    --- a/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/utils/RMSiteUtil.java
    +++ b/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/utils/RMSiteUtil.java
    @@ -50,6 +50,22 @@ public class RMSiteUtil
         public static final String RM_TITLE = "Records Management";
         public static final String RM_DESCRIPTION = "Records Management Site";
     
    +    /**
    +     * FIXME!!!
    +     *
    +     * @param compliance FIXME!!!
    +     * @param title FIXME!!!
    +     * @param description FIXME!!!
    +     * @return FIXME!!!
    +     */
    +    public static RMSiteModel createRMSiteModel(RMSiteCompliance compliance, String title, String description)
    +    {
    +        RMSiteModel rmSiteModel = RMSiteModel.builder().compliance(compliance).build();
    +        rmSiteModel.setTitle(title);
    +        rmSiteModel.setDescription(description);
    +        return rmSiteModel;
    +    }
    +
         /**
          * FIXME!!!
          *
    @@ -58,10 +74,7 @@ public class RMSiteUtil
          */
         private static RMSiteModel createRMSiteModel(RMSiteCompliance compliance)
         {
    -        RMSiteModel rmSiteModel =  RMSiteModel.builder().compliance(compliance).build();
    -        rmSiteModel.setTitle(RM_TITLE);
    -        rmSiteModel.setDescription(RM_DESCRIPTION);
    -        return rmSiteModel;
    +        return createRMSiteModel(compliance, RM_TITLE, RM_DESCRIPTION);
         }
     
         /**
    @@ -83,5 +96,4 @@ public class RMSiteUtil
         {
             return createRMSiteModel(DOD5015);
         }
    -
     }
    
    From 8876f48c1e41c1b03df92f6422a2afcea812e65a Mon Sep 17 00:00:00 2001
    From: Tuna Aksoy 
    Date: Mon, 26 Dec 2016 23:19:14 +0000
    Subject: [PATCH 5/9] RM-4488 (Refactor REST API Automation test code according
     to the latest changes)
    
    ---
     .../alfresco/rest/core/RMRestProperties.java  |   2 +-
     .../org/alfresco/rest/core/RMRestWrapper.java |   2 +-
     ...onentModel.java => FilePlanComponent.java} |   2 +-
     .../FilePlanComponentEntry.java               |   4 +-
     .../FilePlanComponentProperties.java          |   2 +-
     ...ava => FilePlanComponentReviewPeriod.java} |   4 +-
     .../site/{RMSiteModel.java => RMSite.java}    |   2 +-
     .../rm/community/requests/RMModelRequest.java |   2 +-
     .../FilePlanComponentAPI.java}                |  97 ++++++----
     .../{RMSite.java => igCoreAPI/RMSiteAPI.java} |  33 ++--
     .../requests/{ => igCoreAPI}/RMUserAPI.java   |  12 +-
     .../requests/igCoreAPI/RestIGCoreAPI.java     |  22 +--
     .../util/ReviewPeriodSerializer.java          |   6 +-
     .../rest/rm/community/base/BaseRESTAPI.java   | 135 ++++++++++++++
     .../{BaseRestTest.java => BaseRESTTest.java}  | 173 ++++++------------
     .../fileplancomponents/DeleteRecordTests.java |  24 +--
     .../ElectronicRecordTests.java                |  26 +--
     .../fileplancomponents/FilePlanTests.java     |  16 +-
     .../NonElectronicRecordTests.java             |  32 ++--
     .../RecordCategoryTest.java                   |  59 +++---
     .../fileplancomponents/RecordFolderTests.java |  67 ++++---
     .../UnfiledRecordsFolderTests.java            |  59 +++---
     .../rest/rm/community/site/RMSiteTests.java   |  22 +--
     .../utils/FilePlanComponentsUtil.java         |  40 ++--
     .../rest/rm/community/utils/RMSiteUtil.java   |  38 ++--
     25 files changed, 493 insertions(+), 388 deletions(-)
     rename rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/model/fileplancomponents/{FilePlanComponentModel.java => FilePlanComponent.java} (98%)
     rename rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/model/fileplancomponents/{ReviewPeriod.java => FilePlanComponentReviewPeriod.java} (93%)
     rename rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/model/site/{RMSiteModel.java => RMSite.java} (97%)
     rename rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/requests/{FilePlanComponents.java => igCoreAPI/FilePlanComponentAPI.java} (73%)
     rename rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/requests/{RMSite.java => igCoreAPI/RMSiteAPI.java} (84%)
     rename rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/requests/{ => igCoreAPI}/RMUserAPI.java (93%)
     create mode 100644 rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/base/BaseRESTAPI.java
     rename rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/base/{BaseRestTest.java => BaseRESTTest.java} (56%)
    
    diff --git a/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/core/RMRestProperties.java b/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/core/RMRestProperties.java
    index 7afa2cb8cb..76bf64ef60 100644
    --- a/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/core/RMRestProperties.java
    +++ b/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/core/RMRestProperties.java
    @@ -31,7 +31,7 @@ import org.springframework.context.annotation.Configuration;
     import org.springframework.context.annotation.PropertySource;
     
     /**
    - * FIXME!!!
    + * Extends {@link RestProperties} to be able to change/add properties
      *
      * @author Tuna Aksoy
      * @since 2.6
    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 d8d469ca26..fd6f3aa96f 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
    @@ -33,7 +33,7 @@ import org.springframework.context.annotation.Scope;
     import org.springframework.stereotype.Service;
     
     /**
    - * FIXME!!!
    + * Extends {@link RestWrapper} in order to call IG APIs with our own properties
      *
      * @author Tuna Aksoy
      * @since 2.6
    diff --git a/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/model/fileplancomponents/FilePlanComponentModel.java b/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/model/fileplancomponents/FilePlanComponent.java
    similarity index 98%
    rename from rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/model/fileplancomponents/FilePlanComponentModel.java
    rename to rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/model/fileplancomponents/FilePlanComponent.java
    index 4d22bc232c..59890df3d7 100644
    --- a/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/model/fileplancomponents/FilePlanComponentModel.java
    +++ b/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/model/fileplancomponents/FilePlanComponent.java
    @@ -56,7 +56,7 @@ import lombok.NoArgsConstructor;
     @EqualsAndHashCode(callSuper = true)
     @NoArgsConstructor
     @AllArgsConstructor
    -public class FilePlanComponentModel extends TestModel
    +public class FilePlanComponent extends TestModel
     {
         @JsonProperty (required = true)
         private String id;
    diff --git a/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/model/fileplancomponents/FilePlanComponentEntry.java b/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/model/fileplancomponents/FilePlanComponentEntry.java
    index 947610243a..5b1aece181 100644
    --- a/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/model/fileplancomponents/FilePlanComponentEntry.java
    +++ b/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/model/fileplancomponents/FilePlanComponentEntry.java
    @@ -49,8 +49,8 @@ import lombok.NoArgsConstructor;
     @EqualsAndHashCode(callSuper = true)
     @NoArgsConstructor
     @AllArgsConstructor
    -public class FilePlanComponentEntry extends RestModels
    +public class FilePlanComponentEntry extends RestModels
     {
         @JsonProperty(ENTRY)
    -    FilePlanComponentModel filePlanComponentModel;
    +    FilePlanComponent filePlanComponentModel;
     }
    diff --git a/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/model/fileplancomponents/FilePlanComponentProperties.java b/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/model/fileplancomponents/FilePlanComponentProperties.java
    index bd3d20045e..2bdb9359c2 100644
    --- a/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/model/fileplancomponents/FilePlanComponentProperties.java
    +++ b/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/model/fileplancomponents/FilePlanComponentProperties.java
    @@ -84,7 +84,7 @@ public class FilePlanComponentProperties
     
         @JsonProperty(PROPERTIES_REVIEW_PERIOD)
         @JsonSerialize (using = ReviewPeriodSerializer.class)
    -    private ReviewPeriod reviewPeriod;
    +    private FilePlanComponentReviewPeriod reviewPeriod;
     
         @JsonProperty(PROPERTIES_LOCATION)
         private String location;
    diff --git a/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/model/fileplancomponents/ReviewPeriod.java b/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/model/fileplancomponents/FilePlanComponentReviewPeriod.java
    similarity index 93%
    rename from rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/model/fileplancomponents/ReviewPeriod.java
    rename to rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/model/fileplancomponents/FilePlanComponentReviewPeriod.java
    index c8891acb65..73e00c105e 100644
    --- a/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/model/fileplancomponents/ReviewPeriod.java
    +++ b/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/model/fileplancomponents/FilePlanComponentReviewPeriod.java
    @@ -32,7 +32,7 @@ import lombok.Data;
     import lombok.NoArgsConstructor;
     
     /**
    - * POJO for the review period
    + * POJO for the file plan component review period
      *
      * @author Rodica Sutu
      * @since 2.6
    @@ -41,7 +41,7 @@ import lombok.NoArgsConstructor;
     @Data
     @NoArgsConstructor
     @AllArgsConstructor
    -public class ReviewPeriod
    +public class FilePlanComponentReviewPeriod
     {
         private String periodType;
         private String expression;
    diff --git a/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/model/site/RMSiteModel.java b/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/model/site/RMSite.java
    similarity index 97%
    rename from rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/model/site/RMSiteModel.java
    rename to rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/model/site/RMSite.java
    index 20d8aa2a5f..cee7dcf005 100644
    --- a/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/model/site/RMSiteModel.java
    +++ b/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/model/site/RMSite.java
    @@ -49,7 +49,7 @@ import lombok.NoArgsConstructor;
     @EqualsAndHashCode(callSuper = true)
     @NoArgsConstructor
     @AllArgsConstructor
    -public class RMSiteModel extends RestSiteModel
    +public class RMSite extends RestSiteModel
     {
         @JsonProperty (value = COMPLIANCE, required = true)
         private RMSiteCompliance compliance;
    diff --git a/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/requests/RMModelRequest.java b/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/requests/RMModelRequest.java
    index c171e72e49..5dc5424c79 100644
    --- a/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/requests/RMModelRequest.java
    +++ b/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/requests/RMModelRequest.java
    @@ -30,7 +30,7 @@ import org.alfresco.rest.core.RMRestWrapper;
     import org.alfresco.rest.requests.ModelRequest;
     
     /**
    - * FIXME!!!
    + * Extends {@link ModelRequest} to set {@link RMRestWrapper}
      *
      * @author Tuna Aksoy
      * @since 2.6
    diff --git a/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/requests/FilePlanComponents.java b/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/requests/igCoreAPI/FilePlanComponentAPI.java
    similarity index 73%
    rename from rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/requests/FilePlanComponents.java
    rename to rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/requests/igCoreAPI/FilePlanComponentAPI.java
    index 1016b0727c..11e4e978ac 100644
    --- a/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/requests/FilePlanComponents.java
    +++ b/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/requests/igCoreAPI/FilePlanComponentAPI.java
    @@ -24,7 +24,7 @@
      * along with Alfresco. If not, see .
      * #L%
      */
    -package org.alfresco.rest.rm.community.requests;
    +package org.alfresco.rest.rm.community.requests.igCoreAPI;
     
     import static com.jayway.restassured.RestAssured.basic;
     import static com.jayway.restassured.RestAssured.given;
    @@ -53,22 +53,25 @@ import com.jayway.restassured.http.ContentType;
     import com.jayway.restassured.response.Response;
     
     import org.alfresco.rest.core.RMRestWrapper;
    -import org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentModel;
    +import org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponent;
     import org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentsCollection;
    +import org.alfresco.rest.rm.community.requests.RMModelRequest;
     import org.alfresco.utility.model.UserModel;
     
     /**
    - * FIXME!!!
    + * File plan component REST API Wrapper
      *
      * @author Tuna Aksoy
      * @since 2.6
      */
    -public class FilePlanComponents extends RMModelRequest
    +public class FilePlanComponentAPI extends RMModelRequest
     {
         /**
    +     * Constructor
    +     *
          * @param restWrapper
          */
    -    public FilePlanComponents(RMRestWrapper rmRestWrapper)
    +    public FilePlanComponentAPI(RMRestWrapper rmRestWrapper)
         {
             super(rmRestWrapper);
         }
    @@ -77,7 +80,7 @@ public class FilePlanComponents extends RMModelRequest
          * Get a file plan component
          *
          * @param filePlanComponentId The id of the file plan component to get
    -     * @return The {@link FilePlanComponentModel} for the given file plan component id
    +     * @return The {@link FilePlanComponent} for the given file plan component id
          * @throws Exception for the following cases:
          * 
      *
    • {@code fileplanComponentId} is not a valid format
    • @@ -85,7 +88,7 @@ public class FilePlanComponents extends RMModelRequest *
    • {@code fileplanComponentId} does not exist
    • *
    */ - public FilePlanComponentModel getFilePlanComponent(String filePlanComponentId) throws Exception + public FilePlanComponent getFilePlanComponent(String filePlanComponentId) throws Exception { mandatoryString("filePlanComponentId", filePlanComponentId); @@ -93,18 +96,23 @@ public class FilePlanComponents extends RMModelRequest } /** - * FIXME!!! + * Get a file plan component * - * @param filePlanComponentId FIXME!!! - * @param parameters FIXME!!! - * @return FIXME!!! - * @throws Exception FIXME!!! + * @param filePlanComponentId The id of the file plan component to get + * @param parameters The URL parameters to add + * @return The {@link FilePlanComponent} for the given file plan component id + * @throws Exception for the following cases: + *
      + *
    • {@code fileplanComponentId} is not a valid format
    • + *
    • authentication fails
    • + *
    • {@code fileplanComponentId} does not exist
    • + *
    */ - public FilePlanComponentModel getFilePlanComponent(String filePlanComponentId, String parameters) throws Exception + public FilePlanComponent getFilePlanComponent(String filePlanComponentId, String parameters) throws Exception { mandatoryString("filePlanComponentId", filePlanComponentId); - return getRMRestWrapper().processModel(FilePlanComponentModel.class, simpleRequest( + return getRMRestWrapper().processModel(FilePlanComponent.class, simpleRequest( GET, "fileplan-components/{fileplanComponentId}?{parameters}", filePlanComponentId, @@ -140,7 +148,7 @@ public class FilePlanComponents extends RMModelRequest * * @param filePlanComponentModel The properties of the file plan component to be created * @param parentId The id of the parent where the new file plan component should be created - * @return The {@link FilePlanComponentModel} with the given properties + * @return The {@link FilePlanComponent} with the given properties * @throws Exception for the following cases: *
      *
    • {@code fileplanComponentId} is not a valid format
    • @@ -151,7 +159,7 @@ public class FilePlanComponents extends RMModelRequest *
    • model integrity exception, including node name with invalid characters
    • *
    */ - public FilePlanComponentModel createFilePlanComponent(FilePlanComponentModel filePlanComponentModel, String parentId) throws Exception + public FilePlanComponent createFilePlanComponent(FilePlanComponent filePlanComponentModel, String parentId) throws Exception { mandatoryObject("filePlanComponentProperties", filePlanComponentModel); mandatoryString("parentId", parentId); @@ -160,26 +168,34 @@ public class FilePlanComponents extends RMModelRequest } /** - * FIXME!!! + * Creates a file plan component with the given properties under the parent node with the given id * - * @param filePlanComponentModel FIXME!!! - * @param parentId FIXME!!! - * @param parameters FIXME!!! - * @return FIXME!!! - * @throws Exception FIXME!!! + * @param filePlanComponentModel The properties of the file plan component to be created + * @param parameters The URL parameters to add + * @param parentId The id of the parent where the new file plan component should be created + * @return The {@link FilePlanComponent} with the given properties + * @throws Exception for the following cases: + *
      + *
    • {@code fileplanComponentId} is not a valid format
    • + *
    • authentication fails
    • + *
    • current user does not have permission to add children to {@code fileplanComponentId}
    • + *
    • {@code fileplanComponentId} does not exist
    • + *
    • new name clashes with an existing node in the current parent container
    • + *
    • model integrity exception, including node name with invalid characters
    • + *
    */ - public FilePlanComponentModel createFilePlanComponent(FilePlanComponentModel filePlanComponentModel, String parentId, String parameters) throws Exception + public FilePlanComponent createFilePlanComponent(FilePlanComponent filePlanComponentModel, String parentId, String parameters) throws Exception { mandatoryObject("filePlanComponentProperties", filePlanComponentModel); mandatoryString("parentId", parentId); - return getRMRestWrapper().processModel(FilePlanComponentModel.class, requestWithBody( + return getRMRestWrapper().processModel(FilePlanComponent.class, requestWithBody( POST, toJson(filePlanComponentModel), "fileplan-components/{fileplanComponentId}/children?{parameters}", parentId, parameters - )); + )); } /** @@ -190,7 +206,7 @@ public class FilePlanComponents extends RMModelRequest * @return newly created {@link FilePlanComponent} * @throws Exception if operation failed */ - public FilePlanComponentModel createElectronicRecord(FilePlanComponentModel electronicRecordModel, String fileName, String parentId) throws Exception + public FilePlanComponent createElectronicRecord(FilePlanComponent electronicRecordModel, String fileName, String parentId) throws Exception { return createElectronicRecord(electronicRecordModel, new File(Resources.getResource(fileName).getFile()), parentId); } @@ -203,7 +219,7 @@ public class FilePlanComponents extends RMModelRequest * @return newly created {@link FilePlanComponent} * @throws Exception if operation failed */ - public FilePlanComponentModel createElectronicRecord(FilePlanComponentModel electronicRecordModel, File recordContent, String parentId) throws Exception + public FilePlanComponent createElectronicRecord(FilePlanComponent electronicRecordModel, File recordContent, String parentId) throws Exception { mandatoryObject("electronicRecordModel", electronicRecordModel); mandatoryString("parentId", parentId); @@ -245,7 +261,7 @@ public class FilePlanComponents extends RMModelRequest getRMRestWrapper().setStatusCode(Integer.toString(response.getStatusCode())); /* return a FilePlanComponent object representing Response */ - return response.jsonPath().getObject("entry", FilePlanComponentModel.class); + return response.jsonPath().getObject("entry", FilePlanComponent.class); } /** @@ -264,7 +280,7 @@ public class FilePlanComponents extends RMModelRequest *
  • model integrity exception, including node name with invalid characters
  • * */ - public FilePlanComponentModel updateFilePlanComponent(FilePlanComponentModel filePlanComponentModel, String filePlanComponentId) throws Exception + public FilePlanComponent updateFilePlanComponent(FilePlanComponent filePlanComponentModel, String filePlanComponentId) throws Exception { mandatoryObject("filePlanComponentProperties", filePlanComponentModel); mandatoryString("filePlanComponentId", filePlanComponentId); @@ -272,18 +288,35 @@ public class FilePlanComponents extends RMModelRequest return updateFilePlanComponent(filePlanComponentModel, filePlanComponentId, EMPTY); } - public FilePlanComponentModel updateFilePlanComponent(FilePlanComponentModel filePlanComponent, String filePlanComponentId, String parameters) throws Exception + /** + * Updates a file plan component + * + * @param filePlanComponentModel The properties to be updated + * @param parameters The URL parameters to add + * @param filePlanComponentId The id of the file plan component which will be updated + * @param returns The updated {@link FilePlanComponent} + * @throws Exception for the following cases: + *
      + *
    • the update request is invalid or {@code fileplanComponentId} is not a valid format or {@code filePlanComponentProperties} is invalid
    • + *
    • authentication fails
    • + *
    • current user does not have permission to update {@code fileplanComponentId}
    • + *
    • {@code fileplanComponentId} does not exist
    • + *
    • the updated name clashes with an existing node in the current parent folder
    • + *
    • model integrity exception, including node name with invalid characters
    • + *
    + */ + public FilePlanComponent updateFilePlanComponent(FilePlanComponent filePlanComponent, String filePlanComponentId, String parameters) throws Exception { mandatoryObject("filePlanComponentProperties", filePlanComponent); mandatoryString("filePlanComponentId", filePlanComponentId); - return getRMRestWrapper().processModel(FilePlanComponentModel.class, requestWithBody( + return getRMRestWrapper().processModel(FilePlanComponent.class, requestWithBody( PUT, toJson(filePlanComponent), "fileplan-components/{fileplanComponentId}?{parameters}", filePlanComponentId, parameters - )); + )); } /** diff --git a/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/requests/RMSite.java b/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/requests/igCoreAPI/RMSiteAPI.java similarity index 84% rename from rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/requests/RMSite.java rename to rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/requests/igCoreAPI/RMSiteAPI.java index adff114ef2..d4c5d18b26 100644 --- a/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/requests/RMSite.java +++ b/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/requests/igCoreAPI/RMSiteAPI.java @@ -24,7 +24,7 @@ * along with Alfresco. If not, see . * #L% */ -package org.alfresco.rest.rm.community.requests; +package org.alfresco.rest.rm.community.requests.igCoreAPI; import static org.alfresco.rest.core.RestRequest.requestWithBody; import static org.alfresco.rest.core.RestRequest.simpleRequest; @@ -37,20 +37,23 @@ import static org.springframework.http.HttpMethod.PUT; import static org.springframework.http.HttpStatus.OK; import org.alfresco.rest.core.RMRestWrapper; -import org.alfresco.rest.rm.community.model.site.RMSiteModel; +import org.alfresco.rest.rm.community.model.site.RMSite; +import org.alfresco.rest.rm.community.requests.RMModelRequest; /** - * FIXME!!! + * RM Site REST API Wrapper * * @author Tuna Aksoy * @since 2.6 */ -public class RMSite extends RMModelRequest +public class RMSiteAPI extends RMModelRequest { /** - * @param restWrapper + * Constructor + * + * @param rmRestWrapper RM REST Wrapper */ - public RMSite(RMRestWrapper rmRestWrapper) + public RMSiteAPI(RMRestWrapper rmRestWrapper) { super(rmRestWrapper); } @@ -58,7 +61,7 @@ public class RMSite extends RMModelRequest /** * Get the RM site * - * @return The {@link RMSiteModel} for the given file plan component id + * @return The {@link RMSite} for the given file plan component id * @throws Exception for the following cases: *
      *
    • Api Response code 400 Invalid parameter: GET request is supported only for the RM site
    • @@ -67,9 +70,9 @@ public class RMSite extends RMModelRequest *
    • Api Response code default Unexpected error
    • *
    */ - public RMSiteModel getSite() throws Exception + public RMSite getSite() throws Exception { - return getRMRestWrapper().processModel(RMSiteModel.class, simpleRequest( + return getRMRestWrapper().processModel(RMSite.class, simpleRequest( GET, "ig-sites/rm" )); @@ -79,7 +82,7 @@ public class RMSite extends RMModelRequest * Create the RM site * * @param rmSite The properties of the rm site to be created - * @return The {@link RMSiteModel} with the given properties + * @return The {@link RMSite} with the given properties * @throws Exception for the following cases: *
      *
    • Api Response code 400 Invalid parameter: title, or description exceed the maximum length; or siteBodyCreate invalid
    • @@ -88,11 +91,11 @@ public class RMSite extends RMModelRequest *
    • Api Response code default Unexpected error
    • *
    */ - public RMSiteModel createRMSite(RMSiteModel rmSiteModel) throws Exception + public RMSite createRMSite(RMSite rmSiteModel) throws Exception { mandatoryObject("rmSiteModel", rmSiteModel); - return getRMRestWrapper().processModel(RMSiteModel.class, requestWithBody( + return getRMRestWrapper().processModel(RMSite.class, requestWithBody( POST, toJson(rmSiteModel), "ig-sites" @@ -122,7 +125,7 @@ public class RMSite extends RMModelRequest * Update RM site * * @param rmSiteProperties The properties to be updated - * @return The updated {@link RMSiteModel} + * @return The updated {@link RMSite} * @throws Exception for the following cases: *
      *
    • Api Response code 400 the update request is invalid {@code rmSiteModel} is invalid
    • @@ -132,11 +135,11 @@ public class RMSite extends RMModelRequest *
    • Api Response code default Unexpected error,model integrity exception
    • *
    */ - public RMSiteModel updateRMSite(RMSiteModel rmSiteModel) throws Exception + public RMSite updateRMSite(RMSite rmSiteModel) throws Exception { mandatoryObject("rmSiteProperties", rmSiteModel); - return getRMRestWrapper().processModel(RMSiteModel.class, requestWithBody( + return getRMRestWrapper().processModel(RMSite.class, requestWithBody( PUT, toJson(rmSiteModel), "ig-sites/rm" diff --git a/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/requests/RMUserAPI.java b/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/requests/igCoreAPI/RMUserAPI.java similarity index 93% rename from rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/requests/RMUserAPI.java rename to rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/requests/igCoreAPI/RMUserAPI.java index 9a58f13f37..b7853877e3 100644 --- a/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/requests/RMUserAPI.java +++ b/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/requests/igCoreAPI/RMUserAPI.java @@ -24,7 +24,7 @@ * along with Alfresco. If not, see . * #L% */ -package org.alfresco.rest.rm.community.requests; +package org.alfresco.rest.rm.community.requests.igCoreAPI; import static com.jayway.restassured.RestAssured.given; @@ -40,7 +40,7 @@ import org.alfresco.dataprep.AlfrescoHttpClient; import org.alfresco.dataprep.AlfrescoHttpClientFactory; import org.alfresco.dataprep.UserService; import org.alfresco.rest.core.RestAPI; -import org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentModel; +import org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponent; import org.alfresco.utility.data.DataUser; import org.alfresco.utility.model.UserModel; import org.springframework.beans.factory.annotation.Autowired; @@ -100,7 +100,7 @@ public class RMUserAPI extends RestAPI * @param user {@link UserModel} for a user to be granted permission * @param permission {@link UserPermissions} to be granted */ - public void addUserPermission(FilePlanComponentModel component, UserModel user, String permission) + public void addUserPermission(FilePlanComponent component, UserModel user, String permission) { // get an "old-style" REST API client AlfrescoHttpClient client = alfrescoHttpClientFactory.getObject(); @@ -135,10 +135,10 @@ public class RMUserAPI extends RestAPI } /** - * FIXME!!! + * Creates a user with the given name using the old APIs * - * @param userName FIXME!!! - * @return FIXME!!! + * @param userName The user name + * @return true if the user was created successfully, false otherwise. */ public boolean createUser(String userName) { diff --git a/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/requests/igCoreAPI/RestIGCoreAPI.java b/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/requests/igCoreAPI/RestIGCoreAPI.java index 8a31dce555..6d20250d38 100644 --- a/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/requests/igCoreAPI/RestIGCoreAPI.java +++ b/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/requests/igCoreAPI/RestIGCoreAPI.java @@ -33,9 +33,7 @@ import com.jayway.restassured.RestAssured; import org.alfresco.rest.core.RMRestProperties; import org.alfresco.rest.core.RMRestWrapper; -import org.alfresco.rest.rm.community.requests.FilePlanComponents; import org.alfresco.rest.rm.community.requests.RMModelRequest; -import org.alfresco.rest.rm.community.requests.RMSite; /** * Defines the entire IG Core API @@ -50,10 +48,10 @@ public class RestIGCoreAPI extends RMModelRequest private RMRestProperties rmRestProperties; /** - * FIXME!!! + * Constructor * - * @param rmRestWrapper FIXME!!! - * @param rmRestProperties FIXME!!! + * @param rmRestWrapper RM REST Wrapper + * @param rmRestProperties RM REST Properties */ public RestIGCoreAPI(RMRestWrapper rmRestWrapper, RMRestProperties rmRestProperties) { @@ -67,20 +65,20 @@ public class RestIGCoreAPI extends RMModelRequest /** * Provides DSL on all REST calls under ig-sites/rm/... API path * - * @return {@link RMSite} + * @return {@link RMSiteAPI} */ - public RMSite usingRMSite() + public RMSiteAPI usingRMSite() { - return new RMSite(getRMRestWrapper()); + return new RMSiteAPI(getRMRestWrapper()); } /** - * FIXME!!! + * Provides DSL on all REST calls under fileplan-components/... API path * - * @return FIXME!!! + * @return {@link FilePlanComponentAPI} */ - public FilePlanComponents usingFilePlanComponents() + public FilePlanComponentAPI usingFilePlanComponents() { - return new FilePlanComponents(getRMRestWrapper()); + return new FilePlanComponentAPI(getRMRestWrapper()); } } diff --git a/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/util/ReviewPeriodSerializer.java b/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/util/ReviewPeriodSerializer.java index ab2ce28bbd..6056135bc3 100644 --- a/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/util/ReviewPeriodSerializer.java +++ b/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/util/ReviewPeriodSerializer.java @@ -33,7 +33,7 @@ import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.databind.JsonSerializer; import com.fasterxml.jackson.databind.SerializerProvider; -import org.alfresco.rest.rm.community.model.fileplancomponents.ReviewPeriod; +import org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentReviewPeriod; /** * Utility class for serializing the Review Period type @@ -41,7 +41,7 @@ import org.alfresco.rest.rm.community.model.fileplancomponents.ReviewPeriod; * @author Rodica Sutu * @since 2.6 */ -public class ReviewPeriodSerializer extends JsonSerializer +public class ReviewPeriodSerializer extends JsonSerializer { /** * @param value The Review Period value that is being serialized. @@ -51,7 +51,7 @@ public class ReviewPeriodSerializer extends JsonSerializer * @throws JsonProcessingException */ @Override - public void serialize(ReviewPeriod value, JsonGenerator gen, SerializerProvider serializers) throws IOException, JsonProcessingException + public void serialize(FilePlanComponentReviewPeriod value, JsonGenerator gen, SerializerProvider serializers) throws IOException, JsonProcessingException { //create the custom string value for the Review Period type gen.writeString(new StringBuilder().append(value.getPeriodType()).append("|").append(value.getExpression()).toString()); diff --git a/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/base/BaseRESTAPI.java b/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/base/BaseRESTAPI.java new file mode 100644 index 0000000000..91fee5e1ca --- /dev/null +++ b/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/base/BaseRESTAPI.java @@ -0,0 +1,135 @@ +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 Alfresco Software Limited + * %% + * This file is part of the Alfresco software. + * - + * If the software was purchased under a paid Alfresco license, the terms of + * the paid license agreement will prevail. Otherwise, the software is + * provided under the following open source license terms: + * - + * Alfresco is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * - + * Alfresco is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * - + * You should have received a copy of the GNU Lesser General Public License + * along with Alfresco. If not, see . + * #L% + */ +package org.alfresco.rest.rm.community.base; + +import org.alfresco.rest.RestTest; +import org.alfresco.rest.core.RMRestWrapper; +import org.alfresco.rest.rm.community.requests.igCoreAPI.FilePlanComponentAPI; +import org.alfresco.rest.rm.community.requests.igCoreAPI.RMSiteAPI; +import org.alfresco.utility.data.DataUser; +import org.alfresco.utility.model.UserModel; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.http.HttpStatus; + +/** + * Abstract class to hold the REST APIs + * + * @author Tuna Aksoy + * @since 2.6 + */ +public abstract class BaseRESTAPI extends RestTest +{ + @Autowired + private RMRestWrapper rmRestWrapper; + + @Autowired + private DataUser dataUser; + + /** + * The RM REST Wrapper + * + * @return the rmRestWrapper + */ + protected RMRestWrapper getRmRestWrapper() + { + return this.rmRestWrapper; + } + + /** + * The data user service + * + * @return the dataUser + */ + protected DataUser getDataUser() + { + return this.dataUser; + } + + /** + * Compares the given {@link HttpStatus} code with the response status code + * + * @param httpStatus The {@link HttpStatus} to assert + */ + protected void assertStatusCode(HttpStatus httpStatus) + { + getRmRestWrapper().assertStatusCodeIs(httpStatus); + } + + /** + * Gets the admin user + * + * @return The admin user + */ + protected UserModel getAdminUser() + { + return getDataUser().getAdminUser(); + } + + /** + * Gets the {@link RMSiteAPI} as the admin user + * + * @return {@link RMSiteAPI} with the admin credentials + */ + protected RMSiteAPI getRMSiteAPI() + { + return getRMSiteAPI(getAdminUser()); + } + + /** + * Gets the {@link RMSiteAPI} as the given user + * + * @param userModel The user model whose credentials will be used to get the API + * @return {@link RMSiteAPI} with user credentials + */ + protected RMSiteAPI getRMSiteAPI(UserModel userModel) + { + getRmRestWrapper().authenticateUser(userModel); + return getRmRestWrapper().withIGCoreAPI().usingRMSite(); + } + + /** + * Gets the {@link FilePlanComponentAPI} as the admin user + * + * @return {@link FilePlanComponentAPI} with the admin credentials + */ + protected FilePlanComponentAPI getFilePlanComponentsAPI() + { + return getFilePlanComponentsAPI(getAdminUser()); + } + + /** + * Get the {@link FilePlanComponentAPI} as the given user + * + * @param userModel The user model whose credentials will be used to get the API + * @return {@link FilePlanComponentAPI} with the user credentials + */ + protected FilePlanComponentAPI getFilePlanComponentsAPI(UserModel userModel) + { + getRmRestWrapper().authenticateUser(userModel); + return getRmRestWrapper().withIGCoreAPI().usingFilePlanComponents(); + } +} diff --git a/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/base/BaseRestTest.java b/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/base/BaseRESTTest.java similarity index 56% rename from rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/base/BaseRestTest.java rename to rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/base/BaseRESTTest.java index a7d5ccadf8..5bfb537003 100644 --- a/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/base/BaseRestTest.java +++ b/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/base/BaseRESTTest.java @@ -39,16 +39,9 @@ import static org.alfresco.utility.data.RandomData.getRandomAlphanumeric; import static org.springframework.http.HttpStatus.CREATED; import static org.springframework.http.HttpStatus.OK; -import org.alfresco.rest.RestTest; -import org.alfresco.rest.core.RMRestWrapper; -import org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentModel; +import org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponent; import org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentProperties; -import org.alfresco.rest.rm.community.requests.FilePlanComponents; -import org.alfresco.rest.rm.community.requests.RMSite; -import org.alfresco.utility.data.DataUser; import org.alfresco.utility.model.UserModel; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.http.HttpStatus; import org.testng.annotations.BeforeClass; import org.testng.annotations.DataProvider; @@ -59,44 +52,8 @@ import org.testng.annotations.DataProvider; * @author Tuna Aksoy * @since 2.6 */ -public class BaseRestTest extends RestTest +public class BaseRESTTest extends BaseRESTAPI { - @Autowired - private RMRestWrapper rmRestWrapper; - - @Autowired - private DataUser dataUser; - - protected RMSite getRMSiteAPI() - { - return getRMSiteAPI(dataUser.getAdminUser()); - } - - protected RMSite getRMSiteAPI(UserModel userModel) - { - getRmRestWrapper().authenticateUser(userModel); - return getRmRestWrapper().withIGCoreAPI().usingRMSite(); - } - - protected FilePlanComponents getFilePlanComponentsAPI() - { - return getFilePlanComponentsAPI(dataUser.getAdminUser()); - } - - protected FilePlanComponents getFilePlanComponentsAPI(UserModel userModel) - { - getRmRestWrapper().authenticateUser(userModel); - return getRmRestWrapper().withIGCoreAPI().usingFilePlanComponents(); - } - - /** - * @return the rmRestWrapper - */ - protected RMRestWrapper getRmRestWrapper() - { - return this.rmRestWrapper; - } - /** Valid root containers where electronic and non-electronic records can be created */ @DataProvider(name = "validRootContainers") public Object[][] getValidRootContainers() throws Exception @@ -123,16 +80,6 @@ public class BaseRestTest extends RestTest createRMSiteIfNotExists(); } - /** - * FIXME!!! - * - * @param httpStatus FIXME!!! - */ - protected void assertStatusCode(HttpStatus httpStatus) - { - getRmRestWrapper().assertStatusCodeIs(httpStatus); - } - /** * Helper method to create the RM Site via the POST request * if the site doesn't exist @@ -153,82 +100,82 @@ public class BaseRestTest extends RestTest /** * Helper method to create child category * - * @param user user under whose privileges this structure is going to be created + * @param user The user under whose privileges this structure is going to be created * @param parentCategoryId The id of the parent category - * @param categoryName The name of the category + * @param categoryName The name of the category * @return The created category * @throws Exception on unsuccessful component creation */ - public FilePlanComponentModel createCategory(UserModel user, String parentCategoryId, String categoryName) throws Exception + public FilePlanComponent createCategory(UserModel user, String parentCategoryId, String categoryName) throws Exception { return createComponent(user, parentCategoryId, categoryName, RECORD_CATEGORY_TYPE, CATEGORY_TITLE); } /** - * FIXME!!! + * Helper method to create child category as the admin user * - * @param parentCategoryId FIXME!!! - * @param categoryName FIXME!!! - * @return FIXME!!! - * @throws Exception FIXME!!! + * @param parentCategoryId The id of the parent category + * @param categoryName The name of the category + * @return The created category + * @throws Exception on unsuccessful component creation */ - public FilePlanComponentModel createCategory(String parentCategoryId, String categoryName) throws Exception + public FilePlanComponent createCategory(String parentCategoryId, String categoryName) throws Exception { - return createCategory(dataUser.getAdminUser(), parentCategoryId, categoryName); + return createCategory(getAdminUser(), parentCategoryId, categoryName); } /** * Helper method to create child folder * - * @param user user under whose privileges this structure is going to be created + * @param user The user under whose privileges this structure is going to be created * @param parentCategoryId The id of the parent category - * @param folderName The name of the category + * @param folderName The name of the category * @return The created category * @throws Exception on unsuccessful component creation */ - public FilePlanComponentModel createFolder(UserModel user, String parentCategoryId, String folderName) throws Exception + public FilePlanComponent createFolder(UserModel user, String parentCategoryId, String folderName) throws Exception { return createComponent(user, parentCategoryId, folderName, RECORD_FOLDER_TYPE, FOLDER_TITLE); } /** - * FIXME!!! + * Helper method to create child folder as the admin user * - * @param parentCategoryId FIXME!!! - * @param folderName FIXME!!! - * @return FIXME!!! - * @throws Exception FIXME!!! + * @param parentCategoryId The id of the parent category + * @param folderName The name of the category + * @return The created category + * @throws Exception on unsuccessful component creation */ - public FilePlanComponentModel createFolder(String parentCategoryId, String folderName) throws Exception + public FilePlanComponent createFolder(String parentCategoryId, String folderName) throws Exception { - return createFolder(dataUser.getAdminUser(), parentCategoryId, folderName); + return createFolder(getAdminUser(), parentCategoryId, folderName); } /** * Helper method to create child unfiled record folder * - * @param user user under whose privileges this structure is going to be created + * @param user The user under whose privileges this structure is going to be created * @param parentId The id of the parent folder - * @param folderName The name of the folder + * @param folderName The name of the folder * @return The created folder * @throws Exception on unsuccessful component creation */ - public FilePlanComponentModel createUnfiledRecordsFolder(UserModel user, String parentId, String folderName) throws Exception + public FilePlanComponent createUnfiledRecordsFolder(UserModel user, String parentId, String folderName) throws Exception { return createComponent(user, parentId, folderName, UNFILED_RECORD_FOLDER_TYPE, FOLDER_TITLE); } /** - * FIXME!!! + * Helper method to create child unfiled record folder as the admin user * - * @param parentId FIXME!!! - * @param folderName FIXME!!! - * @return FIXME!!! - * @throws Exception FIXME!!! + * @param parentId The id of the parent folder + * @param folderName The name of the folder + * @return The created folder + * @throws Exception on unsuccessful component creation */ - public FilePlanComponentModel createUnfiledRecordsFolder(String parentId, String folderName) throws Exception + public FilePlanComponent createUnfiledRecordsFolder(String parentId, String folderName) throws Exception { - return createUnfiledRecordsFolder(dataUser.getAdminUser(), parentId, folderName); + return createUnfiledRecordsFolder(getAdminUser(), parentId, folderName); } /** @@ -236,16 +183,16 @@ public class BaseRestTest extends RestTest * * @param user user under whose privileges this structure is going to be created * @param parentComponentId The id of the parent file plan component - * @param componentName The name of the file plan component - * @param componentType The type of the file plan component - * @param componentTitle The title of the file plan component + * @param componentName The name of the file plan component + * @param componentType The type of the file plan component + * @param componentTitle The title of the file plan component * @return The created file plan component * @throws Exception */ - private FilePlanComponentModel createComponent(UserModel user, String parentComponentId, String componentName, String componentType, String componentTitle) throws Exception + private FilePlanComponent createComponent(UserModel user, String parentComponentId, String componentName, String componentType, String componentTitle) throws Exception { - FilePlanComponentModel filePlanComponentModel = createFilePlanComponentModel(componentName, componentType, componentTitle); - FilePlanComponentModel filePlanComponent = getFilePlanComponentsAPI(user).createFilePlanComponent(filePlanComponentModel, parentComponentId); + FilePlanComponent filePlanComponentModel = createFilePlanComponentModel(componentName, componentType, componentTitle); + FilePlanComponent filePlanComponent = getFilePlanComponentsAPI(user).createFilePlanComponent(filePlanComponentModel, parentComponentId); assertStatusCode(CREATED); return filePlanComponent; @@ -253,19 +200,20 @@ public class BaseRestTest extends RestTest /** * Helper method to close folder - * @param folderId - * @return + * + * @param folderId The id of the folder + * @return The closed folder * @throws Exception */ - public FilePlanComponentModel closeFolder(String folderId) throws Exception + protected FilePlanComponent closeFolder(String folderId) throws Exception { // build file plan component + properties for update request FilePlanComponentProperties properties = new FilePlanComponentProperties(); properties.setIsClosed(true); - FilePlanComponentModel filePlanComponent = new FilePlanComponentModel(); + FilePlanComponent filePlanComponent = new FilePlanComponent(); filePlanComponent.setProperties(properties); - FilePlanComponentModel updatedComponent = getFilePlanComponentsAPI().updateFilePlanComponent(filePlanComponent, folderId); + FilePlanComponent updatedComponent = getFilePlanComponentsAPI().updateFilePlanComponent(filePlanComponent, folderId); assertStatusCode(OK); return updatedComponent; } @@ -273,53 +221,54 @@ public class BaseRestTest extends RestTest /** * Helper method to create a randomly-named / structure in file plan * - * @param user user under whose privileges this structure is going to be created + * @param user The user under whose privileges this structure is going to be created * @param parentId parent container id * @return record folder * @throws Exception on failed creation */ - public FilePlanComponentModel createCategoryFolderInFilePlan(UserModel user) throws Exception + public FilePlanComponent createCategoryFolderInFilePlan(UserModel user) throws Exception { // create root category - FilePlanComponentModel recordCategory = createCategory(user, FILE_PLAN_ALIAS, "Category " + getRandomAlphanumeric()); + FilePlanComponent recordCategory = createCategory(user, FILE_PLAN_ALIAS, "Category " + getRandomAlphanumeric()); // and return a folder underneath return createFolder(user, recordCategory.getId(), "Folder " + getRandomAlphanumeric()); } /** - * FIXME!!! + * Helper method to create a randomly-named / structure in file plan as the admin user * - * @param parentId FIXME!!! - * @return FIXME!!! - * @throws Exception FIXME!!! + * @param parentId parent container id + * @return record folder + * @throws Exception on failed creation */ - public FilePlanComponentModel createCategoryFolderInFilePlan() throws Exception + public FilePlanComponent createCategoryFolderInFilePlan() throws Exception { - return createCategoryFolderInFilePlan(dataUser.getAdminUser()); + return createCategoryFolderInFilePlan(getAdminUser()); } /** * Helper method to retrieve a file plan component with user's privilege + * * @param user user under whose privileges a component is to be read * @param componentId id of the component to read * @return {@link FilePlanComponent} for given componentId * @throws Exception if user doesn't have sufficient privileges */ - public FilePlanComponentModel getFilePlanComponentAsUser(UserModel user, String componentId) throws Exception + public FilePlanComponent getFilePlanComponentAsUser(UserModel user, String componentId) throws Exception { return getFilePlanComponentsAPI(user).getFilePlanComponent(componentId); } /** - * FIXME!!! + * Helper method to retrieve a file plan component with user's privilege as the admin user * - * @param componentId FIXME!!! - * @return FIXME!!! - * @throws Exception FIXME!!! + * @param componentId id of the component to read + * @return {@link FilePlanComponent} for given componentId + * @throws Exception if user doesn't have sufficient privileges */ - public FilePlanComponentModel getFilePlanComponent(String componentId) throws Exception + public FilePlanComponent getFilePlanComponent(String componentId) throws Exception { - return getFilePlanComponentAsUser(dataUser.getAdminUser(), componentId); + return getFilePlanComponentAsUser(getAdminUser(), componentId); } } \ No newline at end of file diff --git a/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/fileplancomponents/DeleteRecordTests.java b/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/fileplancomponents/DeleteRecordTests.java index 7fd8526f46..6115649153 100644 --- a/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/fileplancomponents/DeleteRecordTests.java +++ b/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/fileplancomponents/DeleteRecordTests.java @@ -36,11 +36,11 @@ import static org.springframework.http.HttpStatus.NOT_FOUND; import static org.springframework.http.HttpStatus.NO_CONTENT; import static org.springframework.http.HttpStatus.OK; -import org.alfresco.rest.rm.community.base.BaseRestTest; -import org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentModel; +import org.alfresco.rest.rm.community.base.BaseRESTTest; +import org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponent; import org.alfresco.rest.rm.community.model.user.UserPermissions; import org.alfresco.rest.rm.community.model.user.UserRoles; -import org.alfresco.rest.rm.community.requests.RMUserAPI; +import org.alfresco.rest.rm.community.requests.igCoreAPI.RMUserAPI; import org.alfresco.test.AlfrescoTest; import org.alfresco.utility.constants.UserRole; import org.alfresco.utility.data.DataUser; @@ -58,7 +58,7 @@ import org.testng.annotations.Test; * @author Kristijan Conkas * @since 2.6 */ -public class DeleteRecordTests extends BaseRestTest +public class DeleteRecordTests extends BaseRESTTest { @Autowired private RMUserAPI rmUserAPI; @@ -84,9 +84,9 @@ public class DeleteRecordTests extends BaseRestTest description = "Admin user can delete an electronic record" ) @AlfrescoTest(jira="RM-4363") - public void adminCanDeleteElectronicRecord(FilePlanComponentModel container) throws Exception + public void adminCanDeleteElectronicRecord(FilePlanComponent container) throws Exception { - FilePlanComponentModel newRecord = getFilePlanComponentsAPI().createElectronicRecord(createElectronicRecordModel(), IMAGE_FILE, container.getId()); + FilePlanComponent newRecord = getFilePlanComponentsAPI().createElectronicRecord(createElectronicRecordModel(), IMAGE_FILE, container.getId()); assertStatusCode(CREATED); @@ -111,10 +111,10 @@ public class DeleteRecordTests extends BaseRestTest description = "Admin user can delete a non-electronic record" ) @AlfrescoTest(jira="RM-4363") - public void adminCanDeleteNonElectronicRecord(FilePlanComponentModel container) throws Exception + public void adminCanDeleteNonElectronicRecord(FilePlanComponent container) throws Exception { // create a non-electronic record - FilePlanComponentModel newRecord = getFilePlanComponentsAPI().createFilePlanComponent(createNonElectronicRecordModel(), container.getId()); + FilePlanComponent newRecord = getFilePlanComponentsAPI().createFilePlanComponent(createNonElectronicRecordModel(), container.getId()); assertStatusCode(CREATED); @@ -141,7 +141,7 @@ public class DeleteRecordTests extends BaseRestTest public void userWithoutWritePermissionsCantDeleteRecord() throws Exception { // create a non-electronic record in unfiled records - FilePlanComponentModel newRecord = getFilePlanComponentsAPI().createFilePlanComponent(createNonElectronicRecordModel(), UNFILED_RECORDS_CONTAINER_ALIAS); + FilePlanComponent newRecord = getFilePlanComponentsAPI().createFilePlanComponent(createNonElectronicRecordModel(), UNFILED_RECORDS_CONTAINER_ALIAS); assertStatusCode(CREATED); @@ -190,7 +190,7 @@ public class DeleteRecordTests extends BaseRestTest rmUserAPI.usingRestWrapper().assertStatusCodeIs(OK); // create random folder - FilePlanComponentModel randomFolder = createCategoryFolderInFilePlan(); + FilePlanComponent randomFolder = createCategoryFolderInFilePlan(); logger.info("random folder:" + randomFolder.getName()); // grant deleteUser Filing privileges on randomFolder category, this will be @@ -200,7 +200,7 @@ public class DeleteRecordTests extends BaseRestTest rmUserAPI.usingRestWrapper().assertStatusCodeIs(OK); // create a non-electronic record in randomFolder - FilePlanComponentModel newRecord = getFilePlanComponentsAPI().createFilePlanComponent(createNonElectronicRecordModel(), randomFolder.getId()); + FilePlanComponent newRecord = getFilePlanComponentsAPI().createFilePlanComponent(createNonElectronicRecordModel(), randomFolder.getId()); assertStatusCode(CREATED); // verify the user can see the newRecord @@ -217,7 +217,7 @@ public class DeleteRecordTests extends BaseRestTest * @param record * @throws Exception */ - private void deleteAndVerify(FilePlanComponentModel record) throws Exception + private void deleteAndVerify(FilePlanComponent record) throws Exception { // delete it and verify status getFilePlanComponentsAPI().deleteFilePlanComponent(record.getId()); diff --git a/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/fileplancomponents/ElectronicRecordTests.java b/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/fileplancomponents/ElectronicRecordTests.java index dbc32e38c5..6dc04587b5 100644 --- a/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/fileplancomponents/ElectronicRecordTests.java +++ b/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/fileplancomponents/ElectronicRecordTests.java @@ -40,8 +40,8 @@ import static org.springframework.http.HttpStatus.UNPROCESSABLE_ENTITY; import static org.testng.Assert.assertFalse; import static org.testng.Assert.assertTrue; -import org.alfresco.rest.rm.community.base.BaseRestTest; -import org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentModel; +import org.alfresco.rest.rm.community.base.BaseRESTTest; +import org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponent; import org.testng.annotations.DataProvider; import org.testng.annotations.Test; @@ -54,7 +54,7 @@ import org.testng.annotations.Test; * @author Kristijan Conkas * @since 2.6 */ -public class ElectronicRecordTests extends BaseRestTest +public class ElectronicRecordTests extends BaseRESTTest { /** Valid root containers where electronic records can be created */ @DataProvider(name = "invalidParentContainers") @@ -88,7 +88,7 @@ public class ElectronicRecordTests extends BaseRestTest dataProvider = "invalidParentContainers", description = "Electronic records can't be created in invalid parent containers" ) - public void cantCreateElectronicRecordsInInvalidContainers(FilePlanComponentModel container) throws Exception + public void cantCreateElectronicRecordsInInvalidContainers(FilePlanComponent container) throws Exception { // Build object the filePlan getFilePlanComponentsAPI().createElectronicRecord(createElectronicRecordModel(), IMAGE_FILE, container.getId()); @@ -110,7 +110,7 @@ public class ElectronicRecordTests extends BaseRestTest @Test(description = "Electronic record can't be created in closed record folder") public void cantCreateElectronicRecordInClosedFolder() throws Exception { - FilePlanComponentModel recordFolder = createCategoryFolderInFilePlan(); + FilePlanComponent recordFolder = createCategoryFolderInFilePlan(); // the folder should be open assertFalse(recordFolder.getProperties().getIsClosed()); @@ -150,7 +150,7 @@ public class ElectronicRecordTests extends BaseRestTest dataProvider = "validRootContainers", description = "Electronic record can only be created if all mandatory properties are given" ) - public void canCreateElectronicRecordOnlyWithMandatoryProperties(FilePlanComponentModel container) throws Exception + public void canCreateElectronicRecordOnlyWithMandatoryProperties(FilePlanComponent container) throws Exception { logger.info("Root container:\n" + toJson(container)); @@ -161,7 +161,7 @@ public class ElectronicRecordTests extends BaseRestTest } // component without name - FilePlanComponentModel record = FilePlanComponentModel.builder() + FilePlanComponent record = FilePlanComponent.builder() .nodeType(CONTENT_TYPE) .build(); @@ -194,16 +194,16 @@ public class ElectronicRecordTests extends BaseRestTest dataProvider = "validRootContainers", description = "Electronic records can be created in unfiled record folder or unfiled record root" ) - public void canCreateElectronicRecordsInValidContainers(FilePlanComponentModel container) throws Exception + public void canCreateElectronicRecordsInValidContainers(FilePlanComponent container) throws Exception { - FilePlanComponentModel record = createElectronicRecordModel(); + FilePlanComponent record = createElectronicRecordModel(); String newRecordId = getFilePlanComponentsAPI().createElectronicRecord(record, IMAGE_FILE, container.getId()).getId(); // verify the create request status code assertStatusCode(CREATED); // get newly created electronic record and verify its properties - FilePlanComponentModel electronicRecord = getFilePlanComponentsAPI().getFilePlanComponent(newRecordId); + FilePlanComponent electronicRecord = getFilePlanComponentsAPI().getFilePlanComponent(newRecordId); // created record will have record identifier inserted in its name but will be prefixed with // the name it was created as assertTrue(electronicRecord.getName().startsWith(record.getName())); @@ -220,10 +220,10 @@ public class ElectronicRecordTests extends BaseRestTest dataProvider = "validRootContainers", description = "Electronic records can be created in unfiled record folder or unfiled record root" ) - public void recordNameDerivedFromFileName(FilePlanComponentModel container) throws Exception + public void recordNameDerivedFromFileName(FilePlanComponent container) throws Exception { // record object without name set - FilePlanComponentModel record = FilePlanComponentModel.builder() + FilePlanComponent record = FilePlanComponent.builder() .nodeType(CONTENT_TYPE) .build(); @@ -233,7 +233,7 @@ public class ElectronicRecordTests extends BaseRestTest assertStatusCode(CREATED); // get newly created electonic record and verify its properties - FilePlanComponentModel electronicRecord = getFilePlanComponentsAPI().getFilePlanComponent(newRecordId); + FilePlanComponent electronicRecord = getFilePlanComponentsAPI().getFilePlanComponent(newRecordId); // record will have record identifier inserted in its name but will for sure start with file name // and end with its extension assertTrue(electronicRecord.getName().startsWith(IMAGE_FILE.substring(0, IMAGE_FILE.indexOf(".")))); diff --git a/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/fileplancomponents/FilePlanTests.java b/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/fileplancomponents/FilePlanTests.java index aecb62c8a9..2705589e95 100644 --- a/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/fileplancomponents/FilePlanTests.java +++ b/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/fileplancomponents/FilePlanTests.java @@ -43,9 +43,9 @@ import static org.testng.Assert.assertEquals; import static org.testng.Assert.assertFalse; import static org.testng.Assert.assertTrue; -import org.alfresco.rest.rm.community.base.BaseRestTest; +import org.alfresco.rest.rm.community.base.BaseRESTTest; import org.alfresco.rest.rm.community.base.TestData; -import org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentModel; +import org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponent; import org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentProperties; import org.alfresco.utility.data.DataUser; import org.alfresco.utility.model.UserModel; @@ -60,7 +60,7 @@ import org.testng.annotations.Test; * @author Rodica Sutu * @since 2.6 */ -public class FilePlanTests extends BaseRestTest +public class FilePlanTests extends BaseRESTTest { @Autowired private DataUser dataUser; @@ -109,7 +109,7 @@ public class FilePlanTests extends BaseRestTest createRMSiteIfNotExists(); // Get the file plan special container - FilePlanComponentModel filePlanComponent = getFilePlanComponentsAPI().getFilePlanComponent(filePlanComponentAlias); + FilePlanComponent filePlanComponent = getFilePlanComponentsAPI().getFilePlanComponent(filePlanComponentAlias); // Check the response code assertStatusCode(OK); @@ -135,7 +135,7 @@ public class FilePlanTests extends BaseRestTest createRMSiteIfNotExists(); // Get the file plan special containers with the optional parameter allowableOperations - FilePlanComponentModel filePlanComponent = getFilePlanComponentsAPI().getFilePlanComponent(specialContainerAlias, "include=" + ALLOWABLE_OPERATIONS); + FilePlanComponent filePlanComponent = getFilePlanComponentsAPI().getFilePlanComponent(specialContainerAlias, "include=" + ALLOWABLE_OPERATIONS); // Check the list of allowableOperations returned if(specialContainerAlias.equals(TRANSFERS_ALIAS)) @@ -171,7 +171,7 @@ public class FilePlanTests extends BaseRestTest createRMSiteIfNotExists(); // Build object for updating the filePlan - FilePlanComponentModel filePlanComponent = FilePlanComponentModel.builder() + FilePlanComponent filePlanComponent = FilePlanComponent.builder() .properties(FilePlanComponentProperties.builder() .title(FILE_PLAN_TITLE) .description(FILE_PLAN_DESCRIPTION) @@ -179,7 +179,7 @@ public class FilePlanTests extends BaseRestTest .build(); // Update the record category - FilePlanComponentModel renamedFilePlanComponent = getFilePlanComponentsAPI().updateFilePlanComponent(filePlanComponent, FILE_PLAN_ALIAS); + FilePlanComponent renamedFilePlanComponent = getFilePlanComponentsAPI().updateFilePlanComponent(filePlanComponent, FILE_PLAN_ALIAS); // Verify the response status code assertStatusCode(OK); @@ -262,7 +262,7 @@ public class FilePlanTests extends BaseRestTest String name = filePlanComponentAlias + getRandomAlphanumeric(); // Build the file plan root properties - FilePlanComponentModel filePlanComponent = FilePlanComponentModel.builder() + FilePlanComponent filePlanComponent = FilePlanComponent.builder() .name(name) .nodeType(filePlanComponentType) .properties(FilePlanComponentProperties.builder() diff --git a/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/fileplancomponents/NonElectronicRecordTests.java b/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/fileplancomponents/NonElectronicRecordTests.java index fa3cb2c256..da890bbc6d 100644 --- a/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/fileplancomponents/NonElectronicRecordTests.java +++ b/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/fileplancomponents/NonElectronicRecordTests.java @@ -47,8 +47,8 @@ import static org.testng.Assert.assertFalse; import java.util.Random; -import org.alfresco.rest.rm.community.base.BaseRestTest; -import org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentModel; +import org.alfresco.rest.rm.community.base.BaseRESTTest; +import org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponent; import org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentProperties; import org.alfresco.utility.constants.UserRole; import org.alfresco.utility.data.DataUser; @@ -63,7 +63,7 @@ import org.testng.annotations.Test; * @author Kristijan Conkas * @since 2.6 */ -public class NonElectronicRecordTests extends BaseRestTest +public class NonElectronicRecordTests extends BaseRESTTest { @Autowired private DataUser dataUser; @@ -81,12 +81,12 @@ public class NonElectronicRecordTests extends BaseRestTest public void cantCreateForInvalidParentIds() throws Exception { // create record category, non-electronic records can't be its children - FilePlanComponentModel recordCategoryModel = FilePlanComponentModel.builder() + FilePlanComponent recordCategoryModel = FilePlanComponent.builder() .name("Category " + getRandomAlphanumeric()) .nodeType(RECORD_CATEGORY_TYPE) .build(); - FilePlanComponentModel recordCategory = getFilePlanComponentsAPI().createFilePlanComponent(recordCategoryModel, FILE_PLAN_ALIAS); + FilePlanComponent recordCategory = getFilePlanComponentsAPI().createFilePlanComponent(recordCategoryModel, FILE_PLAN_ALIAS); // iterate through all invalid parent containers and try to create/file an electronic record asList(FILE_PLAN_ALIAS, TRANSFERS_ALIAS, HOLDS_ALIAS, recordCategory.getId()) @@ -128,7 +128,7 @@ public class NonElectronicRecordTests extends BaseRestTest dataProvider = "validRootContainers", description = "Non-electronic records can be created in valid containers" ) - public void canCreateInValidContainers(FilePlanComponentModel container) throws Exception + public void canCreateInValidContainers(FilePlanComponent container) throws Exception { logger.info("Root container:\n" + toJson(container)); @@ -151,7 +151,7 @@ public class NonElectronicRecordTests extends BaseRestTest Integer size = random.nextInt(Integer.MAX_VALUE); // set values of all available properties for the non electronic records - FilePlanComponentModel filePlanComponent = FilePlanComponentModel.builder() + FilePlanComponent filePlanComponent = FilePlanComponent.builder() .name("Record " + getRandomAlphanumeric()) .nodeType(NON_ELECTRONIC_RECORD_TYPE) .properties(FilePlanComponentProperties.builder() @@ -175,7 +175,7 @@ public class NonElectronicRecordTests extends BaseRestTest assertStatusCode(CREATED); // get newly created non-electonic record and verify its properties - FilePlanComponentModel nonElectronicRecord = getFilePlanComponentsAPI().getFilePlanComponent(nonElectronicId); + FilePlanComponent nonElectronicRecord = getFilePlanComponentsAPI().getFilePlanComponent(nonElectronicId); assertEquals(title, nonElectronicRecord.getProperties().getTitle()); assertEquals(description, nonElectronicRecord.getProperties().getDescription()); @@ -200,7 +200,7 @@ public class NonElectronicRecordTests extends BaseRestTest @Test(description = "Non-electronic record can't be created in closed record folder") public void cantCreateInClosedFolder() throws Exception { - FilePlanComponentModel recordFolder = createCategoryFolderInFilePlan(); + FilePlanComponent recordFolder = createCategoryFolderInFilePlan(); // the folder should be open assertFalse(recordFolder.getProperties().getIsClosed()); @@ -239,7 +239,7 @@ public class NonElectronicRecordTests extends BaseRestTest dataProvider = "validRootContainers", description = "Non-electronic record can only be created if all mandatory properties are given" ) - public void allMandatoryPropertiesRequired(FilePlanComponentModel container) throws Exception + public void allMandatoryPropertiesRequired(FilePlanComponent container) throws Exception { logger.info("Root container:\n" + toJson(container)); if (container.getNodeType().equals(RECORD_FOLDER_TYPE)) @@ -249,10 +249,10 @@ public class NonElectronicRecordTests extends BaseRestTest } // component without name and title - FilePlanComponentModel noNameOrTitle = getDummyNonElectronicRecord(); + FilePlanComponent noNameOrTitle = getDummyNonElectronicRecord(); // component with title only - FilePlanComponentModel titleOnly = getDummyNonElectronicRecord(); + FilePlanComponent titleOnly = getDummyNonElectronicRecord(); FilePlanComponentProperties properties = FilePlanComponentProperties.builder() .title("Title " + getRandomAlphanumeric()) .build(); @@ -297,12 +297,12 @@ public class NonElectronicRecordTests extends BaseRestTest dataProvider = "validRootContainers", description = "Non-electronic record can't be created if user doesn't have RM privileges" ) - public void cantCreateIfNoRmPrivileges(FilePlanComponentModel container) throws Exception + public void cantCreateIfNoRmPrivileges(FilePlanComponent container) throws Exception { UserModel user = createUserWithRole("zzzuser", SiteManager); // try to create a fileplan component - FilePlanComponentModel record = FilePlanComponentModel.builder() + FilePlanComponent record = FilePlanComponent.builder() .properties(FilePlanComponentProperties.builder() .description("Description") .title("Title") @@ -329,9 +329,9 @@ public class NonElectronicRecordTests extends BaseRestTest * Helper function to return an empty FilePlanComponent for non-electronic record * @return */ - private FilePlanComponentModel getDummyNonElectronicRecord() + private FilePlanComponent getDummyNonElectronicRecord() { - FilePlanComponentModel component = FilePlanComponentModel.builder() + FilePlanComponent component = FilePlanComponent.builder() .nodeType(NON_ELECTRONIC_RECORD_TYPE) .build(); return component; diff --git a/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/fileplancomponents/RecordCategoryTest.java b/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/fileplancomponents/RecordCategoryTest.java index 92f620d693..21b01f92a3 100644 --- a/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/fileplancomponents/RecordCategoryTest.java +++ b/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/fileplancomponents/RecordCategoryTest.java @@ -44,14 +44,12 @@ import static org.testng.Assert.fail; import java.util.ArrayList; import java.util.NoSuchElementException; -import org.alfresco.rest.rm.community.base.BaseRestTest; +import org.alfresco.rest.rm.community.base.BaseRESTTest; import org.alfresco.rest.rm.community.base.TestData; -import org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentModel; +import org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponent; import org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentProperties; import org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentsCollection; -import org.alfresco.utility.data.DataUser; import org.alfresco.utility.report.Bug; -import org.springframework.beans.factory.annotation.Autowired; import org.testng.annotations.Test; /** @@ -61,11 +59,8 @@ import org.testng.annotations.Test; * @author Tuna Aksoy * @since 2.6 */ -public class RecordCategoryTest extends BaseRestTest +public class RecordCategoryTest extends BaseRESTTest { - @Autowired - private DataUser dataUser; - // Number of children (for children creation test) private static final int NUMBER_OF_CHILDREN = 10; @@ -85,7 +80,7 @@ public class RecordCategoryTest extends BaseRestTest String categoryTitle = "Category title " + getRandomAlphanumeric(); // Build the record category properties - FilePlanComponentModel recordCategory = FilePlanComponentModel.builder() + FilePlanComponent recordCategory = FilePlanComponent.builder() .name(categoryName) .nodeType(RECORD_CATEGORY_TYPE) .properties( @@ -95,7 +90,7 @@ public class RecordCategoryTest extends BaseRestTest .build(); // Create the record category - FilePlanComponentModel filePlanComponent = getFilePlanComponentsAPI().createFilePlanComponent(recordCategory, FILE_PLAN_ALIAS); + FilePlanComponent filePlanComponent = getFilePlanComponentsAPI().createFilePlanComponent(recordCategory, FILE_PLAN_ALIAS); // Verify the status code assertStatusCode(CREATED); @@ -108,7 +103,7 @@ public class RecordCategoryTest extends BaseRestTest assertEquals(filePlanComponent.getName(), categoryName); assertEquals(filePlanComponent.getNodeType(), RECORD_CATEGORY_TYPE); - assertEquals(filePlanComponent.getCreatedByUser().getId(), dataUser.getAdminUser().getUsername()); + assertEquals(filePlanComponent.getCreatedByUser().getId(), getAdminUser().getUsername()); // Verify the returned file plan component properties FilePlanComponentProperties filePlanComponentProperties = filePlanComponent.getProperties(); @@ -134,7 +129,7 @@ public class RecordCategoryTest extends BaseRestTest String categoryTitle = "Category title " + getRandomAlphanumeric(); // Build the record category properties - FilePlanComponentModel recordCategory = FilePlanComponentModel.builder() + FilePlanComponent recordCategory = FilePlanComponent.builder() .name(categoryName) .nodeType(RECORD_CATEGORY_TYPE) .properties( @@ -144,15 +139,15 @@ public class RecordCategoryTest extends BaseRestTest .build(); // Create the record category - FilePlanComponentModel filePlanComponent = getFilePlanComponentsAPI().createFilePlanComponent(recordCategory, FILE_PLAN_ALIAS); + FilePlanComponent filePlanComponent = getFilePlanComponentsAPI().createFilePlanComponent(recordCategory, FILE_PLAN_ALIAS); String newCategoryName = "Rename " + categoryName; // Build the properties which will be updated - FilePlanComponentModel recordCategoryUpdated = FilePlanComponentModel.builder().name(newCategoryName).build(); + FilePlanComponent recordCategoryUpdated = FilePlanComponent.builder().name(newCategoryName).build(); // Update the record category - FilePlanComponentModel renamedFilePlanComponent = getFilePlanComponentsAPI().updateFilePlanComponent(recordCategoryUpdated, filePlanComponent.getId()); + FilePlanComponent renamedFilePlanComponent = getFilePlanComponentsAPI().updateFilePlanComponent(recordCategoryUpdated, filePlanComponent.getId()); // Verify the status code assertStatusCode(OK); @@ -161,7 +156,7 @@ public class RecordCategoryTest extends BaseRestTest assertEquals(renamedFilePlanComponent.getName(), newCategoryName); // Get actual FILE_PLAN_ALIAS id - FilePlanComponentModel parentComponent = getFilePlanComponentsAPI().getFilePlanComponent(FILE_PLAN_ALIAS); + FilePlanComponent parentComponent = getFilePlanComponentsAPI().getFilePlanComponent(FILE_PLAN_ALIAS); // verify renamed component still has this parent assertEquals(renamedFilePlanComponent.getParentId(), parentComponent.getId()); @@ -184,7 +179,7 @@ public class RecordCategoryTest extends BaseRestTest String categoryTitle = "Category title " + getRandomAlphanumeric(); // Build the record category properties - FilePlanComponentModel recordCategory = FilePlanComponentModel.builder() + FilePlanComponent recordCategory = FilePlanComponent.builder() .name(categoryName) .nodeType(RECORD_CATEGORY_TYPE) .properties( @@ -194,7 +189,7 @@ public class RecordCategoryTest extends BaseRestTest .build(); // Create the record category - FilePlanComponentModel filePlanComponent = getFilePlanComponentsAPI().createFilePlanComponent(recordCategory, FILE_PLAN_ALIAS); + FilePlanComponent filePlanComponent = getFilePlanComponentsAPI().createFilePlanComponent(recordCategory, FILE_PLAN_ALIAS); // Delete the record category getFilePlanComponentsAPI().deleteFilePlanComponent(filePlanComponent.getId()); @@ -220,11 +215,11 @@ public class RecordCategoryTest extends BaseRestTest public void createSubcategory() throws Exception { // Create root level category - FilePlanComponentModel rootCategory = createCategory(FILE_PLAN_ALIAS, getRandomAlphanumeric()); + FilePlanComponent rootCategory = createCategory(FILE_PLAN_ALIAS, getRandomAlphanumeric()); assertNotNull(rootCategory.getId()); // Create subcategory as a child of rootCategory - FilePlanComponentModel childCategory = createCategory(rootCategory.getId(), getRandomAlphanumeric()); + FilePlanComponent childCategory = createCategory(rootCategory.getId(), getRandomAlphanumeric()); // Child category created? assertNotNull(childCategory.getId()); @@ -252,15 +247,15 @@ public class RecordCategoryTest extends BaseRestTest public void listChildren() throws Exception { // Create root level category - FilePlanComponentModel rootCategory = createCategory(FILE_PLAN_ALIAS, getRandomAlphanumeric()); + FilePlanComponent rootCategory = createCategory(FILE_PLAN_ALIAS, getRandomAlphanumeric()); assertNotNull(rootCategory.getId()); // Add child categories/folders - ArrayList children = new ArrayList(); + ArrayList children = new ArrayList(); for (int i=0; i < NUMBER_OF_CHILDREN; i++) { // Create a child - FilePlanComponentModel child = createComponent(rootCategory.getId(), + FilePlanComponent child = createComponent(rootCategory.getId(), getRandomAlphanumeric(), // half of the children should be subcategories, the other subfolders (i <= NUMBER_OF_CHILDREN / 2) ? RECORD_CATEGORY_TYPE : RECORD_FOLDER_TYPE); @@ -278,20 +273,20 @@ public class RecordCategoryTest extends BaseRestTest // Check listed children against created list apiChildren.getEntries().forEach(c -> { - FilePlanComponentModel filePlanComponent = c.getFilePlanComponentModel(); + FilePlanComponent filePlanComponent = c.getFilePlanComponentModel(); assertNotNull(filePlanComponent.getId()); logger.info("Checking child " + filePlanComponent.getId()); try { // Find this child in created children list - FilePlanComponentModel createdComponent = children.stream() + FilePlanComponent createdComponent = children.stream() .filter(child -> child.getId().equals(filePlanComponent.getId())) .findFirst() .get(); // Created by - assertEquals(filePlanComponent.getCreatedByUser().getId(), dataUser.getAdminUser().getUsername()); + assertEquals(filePlanComponent.getCreatedByUser().getId(), getAdminUser().getUsername()); // Is parent Id set correctly? assertEquals(filePlanComponent.getParentId(), rootCategory.getId()); @@ -344,10 +339,10 @@ public class RecordCategoryTest extends BaseRestTest String COMPONENT_NAME = "Component"+getRandomAlphanumeric(); //Create the category - FilePlanComponentModel category = createCategory(FILE_PLAN_ALIAS, COMPONENT_NAME); + FilePlanComponent category = createCategory(FILE_PLAN_ALIAS, COMPONENT_NAME); //Build node properties - FilePlanComponentModel recordCategory = FilePlanComponentModel.builder() + FilePlanComponent recordCategory = FilePlanComponent.builder() .name(COMPONENT_NAME) .nodeType(nodeType) .properties( @@ -370,7 +365,7 @@ public class RecordCategoryTest extends BaseRestTest * @return The created category * @throws Exception on unsuccessful component creation */ - public FilePlanComponentModel createCategory(String parentCategoryId, String categoryName) throws Exception + public FilePlanComponent createCategory(String parentCategoryId, String categoryName) throws Exception { return createComponent(parentCategoryId, categoryName, RECORD_CATEGORY_TYPE); } @@ -384,10 +379,10 @@ public class RecordCategoryTest extends BaseRestTest * @return The created file plan component * @throws Exception */ - private FilePlanComponentModel createComponent(String parentComponentId, String componentName, String componentType) throws Exception + private FilePlanComponent createComponent(String parentComponentId, String componentName, String componentType) throws Exception { // Build node properties - FilePlanComponentModel component = FilePlanComponentModel.builder() + FilePlanComponent component = FilePlanComponent.builder() .name(componentName) .nodeType(componentType) .properties(FilePlanComponentProperties.builder() @@ -395,7 +390,7 @@ public class RecordCategoryTest extends BaseRestTest .build()) .build(); - FilePlanComponentModel filePlanComponent = getFilePlanComponentsAPI().createFilePlanComponent(component, parentComponentId); + FilePlanComponent filePlanComponent = getFilePlanComponentsAPI().createFilePlanComponent(component, parentComponentId); assertStatusCode(CREATED); return filePlanComponent; diff --git a/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/fileplancomponents/RecordFolderTests.java b/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/fileplancomponents/RecordFolderTests.java index a51a5dbcfe..22c85a2054 100644 --- a/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/fileplancomponents/RecordFolderTests.java +++ b/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/fileplancomponents/RecordFolderTests.java @@ -49,15 +49,13 @@ import java.time.LocalDateTime; import java.util.ArrayList; import java.util.NoSuchElementException; -import org.alfresco.rest.rm.community.base.BaseRestTest; +import org.alfresco.rest.rm.community.base.BaseRESTTest; import org.alfresco.rest.rm.community.base.TestData; -import org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentModel; +import org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponent; import org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentProperties; +import org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentReviewPeriod; import org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentsCollection; -import org.alfresco.rest.rm.community.model.fileplancomponents.ReviewPeriod; -import org.alfresco.utility.data.DataUser; import org.alfresco.utility.report.Bug; -import org.springframework.beans.factory.annotation.Autowired; import org.testng.annotations.AfterClass; import org.testng.annotations.Test; @@ -68,11 +66,8 @@ import org.testng.annotations.Test; * @author Rodica Sutu * @since 2.6 */ -public class RecordFolderTests extends BaseRestTest +public class RecordFolderTests extends BaseRESTTest { - @Autowired - public DataUser dataUser; - private static final int NUMBER_OF_FOLDERS = 5; /** * Given that a record category exists @@ -88,9 +83,9 @@ public class RecordFolderTests extends BaseRestTest String CATEGORY = CATEGORY_NAME + getRandomAlphanumeric(); // Authenticate with admin user - FilePlanComponentModel filePlanComponent = createCategory(FILE_PLAN_ALIAS, CATEGORY); + FilePlanComponent filePlanComponent = createCategory(FILE_PLAN_ALIAS, CATEGORY); - FilePlanComponentModel recordFolder = FilePlanComponentModel.builder() + FilePlanComponent recordFolder = FilePlanComponent.builder() .name(FOLDER_NAME) .nodeType(RECORD_FOLDER_TYPE) .properties(FilePlanComponentProperties.builder() @@ -99,7 +94,7 @@ public class RecordFolderTests extends BaseRestTest .build(); // Create the record folder - FilePlanComponentModel folder = getFilePlanComponentsAPI().createFilePlanComponent(recordFolder, filePlanComponent.getId()); + FilePlanComponent folder = getFilePlanComponentsAPI().createFilePlanComponent(recordFolder, filePlanComponent.getId()); assertStatusCode(CREATED); @@ -112,7 +107,7 @@ public class RecordFolderTests extends BaseRestTest assertEquals(folder.getName(), FOLDER_NAME); assertEquals(folder.getNodeType(), RECORD_FOLDER_TYPE); - assertEquals(folder.getCreatedByUser().getId(), dataUser.getAdminUser().getUsername()); + assertEquals(folder.getCreatedByUser().getId(), getAdminUser().getUsername()); // Verify the returned file plan component properties FilePlanComponentProperties folderProperties = folder.getProperties(); @@ -136,7 +131,7 @@ public class RecordFolderTests extends BaseRestTest String componentID = getFilePlanComponentsAPI().getFilePlanComponent(filePlanComponent).getId(); // Build the record category properties - FilePlanComponentModel recordFolder = FilePlanComponentModel.builder() + FilePlanComponent recordFolder = FilePlanComponent.builder() .name(FOLDER_NAME) .nodeType(RECORD_FOLDER_TYPE) .properties(FilePlanComponentProperties.builder() @@ -164,10 +159,10 @@ public class RecordFolderTests extends BaseRestTest { String CATEGORY = CATEGORY_NAME + getRandomAlphanumeric(); - FilePlanComponentModel category = createCategory(FILE_PLAN_ALIAS, CATEGORY); - FilePlanComponentModel folder = createFolder(category.getId(),FOLDER_NAME); + FilePlanComponent category = createCategory(FILE_PLAN_ALIAS, CATEGORY); + FilePlanComponent folder = createFolder(category.getId(),FOLDER_NAME); - FilePlanComponentModel folderDetails = getFilePlanComponentsAPI().getFilePlanComponent(folder.getId(), "include=" + IS_CLOSED); + FilePlanComponent folderDetails = getFilePlanComponentsAPI().getFilePlanComponent(folder.getId(), "include=" + IS_CLOSED); // Verify the returned properties for the file plan component - record folder assertEquals(RECORD_FOLDER_TYPE, folderDetails.getNodeType()); @@ -177,8 +172,8 @@ public class RecordFolderTests extends BaseRestTest assertFalse(folderDetails.getIsClosed()); assertEquals(FOLDER_NAME,folderDetails.getName()); - assertEquals(dataUser.getAdminUser().getUsername(),folderDetails.getCreatedByUser().getId()); - assertEquals(dataUser.getAdminUser().getUsername(), folderDetails.getModifiedByUser().getId()); + assertEquals(getAdminUser().getUsername(),folderDetails.getCreatedByUser().getId()); + assertEquals(getAdminUser().getUsername(), folderDetails.getModifiedByUser().getId()); assertEquals(FOLDER_TITLE,folderDetails.getProperties().getTitle()); } @@ -199,10 +194,10 @@ public class RecordFolderTests extends BaseRestTest String CATEGORY = CATEGORY_NAME + getRandomAlphanumeric(); //Create a record category - FilePlanComponentModel category = createCategory(FILE_PLAN_ALIAS, CATEGORY); + FilePlanComponent category = createCategory(FILE_PLAN_ALIAS, CATEGORY); //Create a record folder - FilePlanComponentModel folder = createFolder(category.getId(), FOLDER_NAME); + FilePlanComponent folder = createFolder(category.getId(), FOLDER_NAME); // Create record category first String folderDescription = "The folder description is updated" + getRandomAlphanumeric(); @@ -211,19 +206,19 @@ public class RecordFolderTests extends BaseRestTest String location = "Location"+getRandomAlphanumeric(); //Create the file plan component properties to update - FilePlanComponentModel recordFolder = FilePlanComponentModel.builder() + FilePlanComponent recordFolder = FilePlanComponent.builder() .name(folderName) .properties(FilePlanComponentProperties.builder() .title(folderTitle) .description(folderDescription) .vitalRecord(true) - .reviewPeriod(new ReviewPeriod("month","1")) + .reviewPeriod(new FilePlanComponentReviewPeriod("month","1")) .location(location) .build()) .build(); // Update the record category - FilePlanComponentModel folderUpdated = getFilePlanComponentsAPI().updateFilePlanComponent(recordFolder, folder.getId()); + FilePlanComponent folderUpdated = getFilePlanComponentsAPI().updateFilePlanComponent(recordFolder, folder.getId()); // Check the Response Status Code assertStatusCode(OK); @@ -253,10 +248,10 @@ public class RecordFolderTests extends BaseRestTest String CATEGORY = CATEGORY_NAME + getRandomAlphanumeric(); // Create the record category - FilePlanComponentModel category = createCategory(FILE_PLAN_ALIAS, CATEGORY); + FilePlanComponent category = createCategory(FILE_PLAN_ALIAS, CATEGORY); // Create the record folder - FilePlanComponentModel folder = createFolder(category.getId(), FOLDER_NAME); + FilePlanComponent folder = createFolder(category.getId(), FOLDER_NAME); // Delete the Record folder getFilePlanComponentsAPI().deleteFilePlanComponent(folder.getId()); @@ -286,14 +281,14 @@ public class RecordFolderTests extends BaseRestTest String CATEGORY = CATEGORY_NAME + getRandomAlphanumeric(); // Authenticate with admin user - FilePlanComponentModel category = createCategory(FILE_PLAN_ALIAS, CATEGORY); + FilePlanComponent category = createCategory(FILE_PLAN_ALIAS, CATEGORY); // Add child olders - ArrayList children = new ArrayList(); + ArrayList children = new ArrayList(); for (int i = 0; i < NUMBER_OF_FOLDERS; i++) { // Create a child - FilePlanComponentModel child = createFolder(category.getId(), + FilePlanComponent child = createFolder(category.getId(), getRandomAlphanumeric()); assertNotNull(child.getId()); children.add(child); @@ -308,20 +303,20 @@ public class RecordFolderTests extends BaseRestTest // Check listed children against created list apiChildren.getEntries().forEach(c -> { - FilePlanComponentModel filePlanComponent = c.getFilePlanComponentModel(); + FilePlanComponent filePlanComponent = c.getFilePlanComponentModel(); assertNotNull(filePlanComponent.getId()); logger.info("Checking child " + filePlanComponent.getId()); try { // Find this child in created children list - FilePlanComponentModel createdComponent = children.stream() + FilePlanComponent createdComponent = children.stream() .filter(child -> child.getId().equals(filePlanComponent.getId())) .findFirst() .get(); // Created by - assertEquals(filePlanComponent.getCreatedByUser().getId(), dataUser.getAdminUser().getUsername()); + assertEquals(filePlanComponent.getCreatedByUser().getId(), getAdminUser().getUsername()); // Is parent Id set correctly assertEquals(filePlanComponent.getParentId(), category.getId()); @@ -362,14 +357,14 @@ public class RecordFolderTests extends BaseRestTest String relativePath = LocalDateTime.now().getYear() + "/" + LocalDateTime.now().getMonth() + "/" + LocalDateTime.now().getDayOfMonth(); //The record folder to be created - FilePlanComponentModel recordFolder = FilePlanComponentModel.builder() + FilePlanComponent recordFolder = FilePlanComponent.builder() .name(FOLDER_NAME) .nodeType(RECORD_FOLDER_TYPE) .relativePath(relativePath) .build(); // Create the record folder - FilePlanComponentModel folder = getFilePlanComponentsAPI().createFilePlanComponent(recordFolder, FILE_PLAN_ALIAS, "include=" + PATH); + FilePlanComponent folder = getFilePlanComponentsAPI().createFilePlanComponent(recordFolder, FILE_PLAN_ALIAS, "include=" + PATH); //Check the API response code assertStatusCode(CREATED); @@ -398,14 +393,14 @@ public class RecordFolderTests extends BaseRestTest //New Relative Path only a part of containers need to be created before the record folder String NEW_RELATIVE_PATH = LocalDateTime.now().getYear() + "/" + LocalDateTime.now().getMonth() + "/" + (LocalDateTime.now().getDayOfMonth() + 1); //The record folder to be created - FilePlanComponentModel recordFolder2 = FilePlanComponentModel.builder() + FilePlanComponent recordFolder2 = FilePlanComponent.builder() .name(FOLDER_NAME) .nodeType(RECORD_FOLDER_TYPE) .relativePath(NEW_RELATIVE_PATH) .build(); // Create the record folder - FilePlanComponentModel folder2 = getFilePlanComponentsAPI().createFilePlanComponent(recordFolder2, FILE_PLAN_ALIAS, "include=" + PATH); + FilePlanComponent folder2 = getFilePlanComponentsAPI().createFilePlanComponent(recordFolder2, FILE_PLAN_ALIAS, "include=" + PATH); //Check the API response code assertStatusCode(CREATED); diff --git a/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/fileplancomponents/UnfiledRecordsFolderTests.java b/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/fileplancomponents/UnfiledRecordsFolderTests.java index dc514f59b4..24728c01cc 100644 --- a/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/fileplancomponents/UnfiledRecordsFolderTests.java +++ b/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/fileplancomponents/UnfiledRecordsFolderTests.java @@ -48,12 +48,10 @@ import static org.testng.Assert.assertTrue; import java.util.List; import java.util.stream.Collectors; -import org.alfresco.rest.rm.community.base.BaseRestTest; -import org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentModel; +import org.alfresco.rest.rm.community.base.BaseRESTTest; +import org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponent; import org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentProperties; import org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentsCollection; -import org.alfresco.utility.data.DataUser; -import org.springframework.beans.factory.annotation.Autowired; import org.testng.annotations.DataProvider; import org.testng.annotations.Test; @@ -63,24 +61,23 @@ import org.testng.annotations.Test; * @author Kristijan Conkas * @since 2.6 */ -public class UnfiledRecordsFolderTests extends BaseRestTest +public class UnfiledRecordsFolderTests extends BaseRESTTest { - @Autowired - private DataUser dataUser; - /** invalid root level types, at unfiled records root level these shouldn't be possible to create */ -@DataProvider(name = "invalidRootTypes") - public Object[][] createData1() { - return new Object[][] { - { FILE_PLAN_TYPE }, - { RECORD_CATEGORY_TYPE }, - { RECORD_FOLDER_TYPE }, - { HOLD_TYPE }, - { HOLD_CONTAINER_TYPE }, - { TRANSFER_CONTAINER_TYPE }, - { UNFILED_CONTAINER_TYPE } - }; + @DataProvider(name = "invalidRootTypes") + public Object[][] createData1() + { + return new Object[][] + { + { FILE_PLAN_TYPE }, + { RECORD_CATEGORY_TYPE }, + { RECORD_FOLDER_TYPE }, + { HOLD_TYPE }, + { HOLD_CONTAINER_TYPE }, + { TRANSFER_CONTAINER_TYPE }, + { UNFILED_CONTAINER_TYPE } + }; } /** @@ -98,7 +95,7 @@ public class UnfiledRecordsFolderTests extends BaseRestTest String folderDescription = folderName + " Description"; // Build unfiled records folder properties - FilePlanComponentModel unfiledFolder = FilePlanComponentModel.builder() + FilePlanComponent unfiledFolder = FilePlanComponent.builder() .name(folderName) .nodeType(UNFILED_RECORD_FOLDER_TYPE) .properties(FilePlanComponentProperties.builder() @@ -107,7 +104,7 @@ public class UnfiledRecordsFolderTests extends BaseRestTest .build()) .build(); - FilePlanComponentModel filePlanComponent = getFilePlanComponentsAPI().createFilePlanComponent(unfiledFolder, UNFILED_RECORDS_CONTAINER_ALIAS); + FilePlanComponent filePlanComponent = getFilePlanComponentsAPI().createFilePlanComponent(unfiledFolder, UNFILED_RECORDS_CONTAINER_ALIAS); // Verify the status code assertStatusCode(CREATED); @@ -120,7 +117,7 @@ public class UnfiledRecordsFolderTests extends BaseRestTest assertEquals(filePlanComponent.getName(), folderName); assertEquals(filePlanComponent.getNodeType(), UNFILED_RECORD_FOLDER_TYPE); - assertEquals(filePlanComponent.getCreatedByUser().getId(), dataUser.getAdminUser().getUsername()); + assertEquals(filePlanComponent.getCreatedByUser().getId(), getAdminUser().getUsername()); // Verify the returned file plan component properties FilePlanComponentProperties filePlanComponentProperties = filePlanComponent.getProperties(); @@ -145,7 +142,7 @@ public class UnfiledRecordsFolderTests extends BaseRestTest logger.info("creating " + filePlanComponentType); // Build unfiled records folder properties - FilePlanComponentModel unfiledFolder = FilePlanComponentModel.builder() + FilePlanComponent unfiledFolder = FilePlanComponent.builder() .name(folderName) .nodeType(filePlanComponentType) .properties(FilePlanComponentProperties.builder() @@ -182,11 +179,11 @@ public class UnfiledRecordsFolderTests extends BaseRestTest String childFolderDescription = childFolderName + " Description"; // No need for fine control, create it using utility function - FilePlanComponentModel parentFolder = createUnfiledRecordsFolder(UNFILED_RECORDS_CONTAINER_ALIAS, parentFolderName); + FilePlanComponent parentFolder = createUnfiledRecordsFolder(UNFILED_RECORDS_CONTAINER_ALIAS, parentFolderName); assertEquals(parentFolderName, parentFolder.getName()); // Build the unfiled records folder properties - FilePlanComponentModel unfiledFolder = FilePlanComponentModel.builder() + FilePlanComponent unfiledFolder = FilePlanComponent.builder() .name(childFolderName) .nodeType(UNFILED_RECORD_FOLDER_TYPE) .properties(FilePlanComponentProperties.builder() @@ -196,7 +193,7 @@ public class UnfiledRecordsFolderTests extends BaseRestTest .build(); // Create it as a child of parentFolder - FilePlanComponentModel childFolder = getFilePlanComponentsAPI().createFilePlanComponent(unfiledFolder, parentFolder.getId()); + FilePlanComponent childFolder = getFilePlanComponentsAPI().createFilePlanComponent(unfiledFolder, parentFolder.getId()); // Verify the status code assertStatusCode(CREATED); @@ -208,7 +205,7 @@ public class UnfiledRecordsFolderTests extends BaseRestTest assertEquals(childFolder.getName(), childFolderName); assertEquals(childFolder.getNodeType(), UNFILED_RECORD_FOLDER_TYPE); - assertEquals(childFolder.getCreatedByUser().getId(), dataUser.getAdminUser().getUsername()); + assertEquals(childFolder.getCreatedByUser().getId(), getAdminUser().getUsername()); // Verify the returned file plan component properties FilePlanComponentProperties childProperties = childFolder.getProperties(); @@ -248,11 +245,11 @@ public class UnfiledRecordsFolderTests extends BaseRestTest String folderName = "Folder To Modify" + getRandomAlphanumeric(); // No need for fine control, create it using utility function - FilePlanComponentModel folderToModify = createUnfiledRecordsFolder(UNFILED_RECORDS_CONTAINER_ALIAS, folderName); + FilePlanComponent folderToModify = createUnfiledRecordsFolder(UNFILED_RECORDS_CONTAINER_ALIAS, folderName); assertEquals(folderName, folderToModify.getName()); // Build the properties which will be updated - FilePlanComponentModel folderToUpdate = FilePlanComponentModel.builder() + FilePlanComponent folderToUpdate = FilePlanComponent.builder() .name(modified + folderToModify.getName()) .properties(FilePlanComponentProperties.builder(). title(modified + folderToModify.getProperties().getTitle()). @@ -266,7 +263,7 @@ public class UnfiledRecordsFolderTests extends BaseRestTest assertStatusCode(OK); // This is to ensure the change was actually applied, rather than simply trusting the object returned by PUT - FilePlanComponentModel renamedFolder = getFilePlanComponentsAPI().getFilePlanComponent(folderToModify.getId()); + FilePlanComponent renamedFolder = getFilePlanComponentsAPI().getFilePlanComponent(folderToModify.getId()); // Verify the returned file plan component assertEquals(modified + folderToModify.getName(), renamedFolder.getName()); @@ -287,7 +284,7 @@ public class UnfiledRecordsFolderTests extends BaseRestTest String folderName = "Folder To Delete" + getRandomAlphanumeric(); // Create folderToDelete - FilePlanComponentModel folderToDelete = createUnfiledRecordsFolder(UNFILED_RECORDS_CONTAINER_ALIAS, folderName); + FilePlanComponent folderToDelete = createUnfiledRecordsFolder(UNFILED_RECORDS_CONTAINER_ALIAS, folderName); assertEquals(folderName, folderToDelete.getName()); // Delete folderToDelete diff --git a/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/site/RMSiteTests.java b/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/site/RMSiteTests.java index 89e46f1445..b3e7bbd365 100644 --- a/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/site/RMSiteTests.java +++ b/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/site/RMSiteTests.java @@ -48,9 +48,9 @@ import static org.springframework.social.alfresco.api.entities.Site.Visibility.P import static org.testng.Assert.assertEquals; import static org.testng.Assert.assertNotNull; -import org.alfresco.rest.rm.community.base.BaseRestTest; -import org.alfresco.rest.rm.community.model.site.RMSiteModel; -import org.alfresco.rest.rm.community.requests.RMUserAPI; +import org.alfresco.rest.rm.community.base.BaseRESTTest; +import org.alfresco.rest.rm.community.model.site.RMSite; +import org.alfresco.rest.rm.community.requests.igCoreAPI.RMUserAPI; import org.alfresco.utility.data.DataUser; import org.alfresco.utility.data.RandomData; import org.alfresco.utility.model.UserModel; @@ -65,7 +65,7 @@ import org.testng.annotations.Test; * @author Rodica Sutu * @since 2.6 */ -public class RMSiteTests extends BaseRestTest +public class RMSiteTests extends BaseRESTTest { @Autowired private DataUser dataUser; @@ -92,7 +92,7 @@ public class RMSiteTests extends BaseRestTest } // Create the RM site - RMSiteModel rmSiteResponse = getRMSiteAPI().createRMSite(createStandardRMSiteModel()); + RMSite rmSiteResponse = getRMSiteAPI().createRMSite(createStandardRMSiteModel()); // Verify the status code assertStatusCode(CREATED); @@ -125,7 +125,7 @@ public class RMSiteTests extends BaseRestTest String newDescription = RM_DESCRIPTION + "createRMSiteWhenSiteExists"; // Create the RM site - RMSiteModel rmSiteModel = createRMSiteModel(STANDARD, newTitle, newDescription); + RMSite rmSiteModel = createRMSiteModel(STANDARD, newTitle, newDescription); getRMSiteAPI().createRMSite(rmSiteModel); // Verify the status code @@ -174,7 +174,7 @@ public class RMSiteTests extends BaseRestTest else { // Get the RM site - RMSiteModel rmSiteModel = getRMSiteAPI().getSite(); + RMSite rmSiteModel = getRMSiteAPI().getSite(); // Verify the status code assertStatusCode(OK); @@ -208,7 +208,7 @@ public class RMSiteTests extends BaseRestTest rmUserAPI.createUser(ANOTHER_ADMIN); // Create the RM site - RMSiteModel rmSiteModel = getRMSiteAPI(new UserModel(ANOTHER_ADMIN, DEFAULT_PASSWORD)).createRMSite(createDOD5015RMSiteModel()); + RMSite rmSiteModel = getRMSiteAPI(new UserModel(ANOTHER_ADMIN, DEFAULT_PASSWORD)).createRMSite(createDOD5015RMSiteModel()); // Verify the status code assertStatusCode(CREATED); @@ -239,7 +239,7 @@ public class RMSiteTests extends BaseRestTest createRMSiteIfNotExists(); // Create RM site model - RMSiteModel rmSiteToUpdate = RMSiteModel.builder().build(); + RMSite rmSiteToUpdate = RMSite.builder().build(); rmSiteToUpdate.setTitle(NEW_TITLE); rmSiteToUpdate.setDescription(NEW_DESCRIPTION); @@ -250,7 +250,7 @@ public class RMSiteTests extends BaseRestTest assertStatusCode(FORBIDDEN); // Update the RM Site - RMSiteModel rmSiteModel = getRMSiteAPI().updateRMSite(rmSiteToUpdate); + RMSite rmSiteModel = getRMSiteAPI().updateRMSite(rmSiteToUpdate); // Verify the response status code assertStatusCode(OK); @@ -275,7 +275,7 @@ public class RMSiteTests extends BaseRestTest createRMSiteIfNotExists(); // Build the RM site properties - RMSiteModel rmSiteToUpdate = RMSiteModel.builder().compliance(DOD5015).build(); + RMSite rmSiteToUpdate = RMSite.builder().compliance(DOD5015).build(); // Update the RM site getRMSiteAPI().updateRMSite(rmSiteToUpdate); diff --git a/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/utils/FilePlanComponentsUtil.java b/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/utils/FilePlanComponentsUtil.java index 99eb79aa78..a4836c35ab 100644 --- a/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/utils/FilePlanComponentsUtil.java +++ b/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/utils/FilePlanComponentsUtil.java @@ -30,11 +30,11 @@ import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanCo import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentType.NON_ELECTRONIC_RECORD_TYPE; import static org.alfresco.utility.data.RandomData.getRandomAlphanumeric; -import org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentModel; +import org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponent; import org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentProperties; /** - * FIXME!!! + * Utility class for file plan component models * * @author Tuna Aksoy * @since 2.6 @@ -50,50 +50,50 @@ public class FilePlanComponentsUtil public static final String IMAGE_FILE = "money.JPG"; /** - * FIXME!!! + * Creates a record model with the given type and a random name (with "Record " prefix) * - * @param nodeType FIXME!!! - * @return FIXME!!! + * @param nodeType The node type + * @return The {@link FilePlanComponent} with for the given node type */ - private static FilePlanComponentModel createRecordModel(String nodeType) + private static FilePlanComponent createRecordModel(String nodeType) { - return FilePlanComponentModel.builder() + return FilePlanComponent.builder() .name("Record " + getRandomAlphanumeric()) .nodeType(nodeType) .build(); } /** - * FIXME!!! + * Creates an electronic record model with a random name (with "Record " prefix) * - * @return FIXME!!! + * @return The electronic record as {@link FilePlanComponent} */ - public static FilePlanComponentModel createElectronicRecordModel() + public static FilePlanComponent createElectronicRecordModel() { return createRecordModel(CONTENT_TYPE); } /** - * FIXME!!! + * Creates a non-electronic record model with a random name (with "Record " prefix) * - * @return FIXME!!! + * @return The non-electronic record as {@link FilePlanComponent} */ - public static FilePlanComponentModel createNonElectronicRecordModel() + public static FilePlanComponent createNonElectronicRecordModel() { return createRecordModel(NON_ELECTRONIC_RECORD_TYPE); } /** - * FIXME!!! + * Creates a file plan component with the given name, type and title * - * @param name FIXME!!! - * @param type FIXME!!! - * @param title FIXME!!! - * @return + * @param name The name of the file plan component + * @param type The type of the file plan component + * @param title The title of the file plan component + * @return The {@link FilePlanComponent} with the given details */ - public static FilePlanComponentModel createFilePlanComponentModel(String name, String type, String title) + public static FilePlanComponent createFilePlanComponentModel(String name, String type, String title) { - return FilePlanComponentModel.builder() + return FilePlanComponent.builder() .name(name) .nodeType(type) .properties(FilePlanComponentProperties.builder() diff --git a/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/utils/RMSiteUtil.java b/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/utils/RMSiteUtil.java index f13912684d..a0af49602f 100644 --- a/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/utils/RMSiteUtil.java +++ b/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/utils/RMSiteUtil.java @@ -30,10 +30,10 @@ import static org.alfresco.rest.rm.community.model.site.RMSiteCompliance.DOD5015 import static org.alfresco.rest.rm.community.model.site.RMSiteCompliance.STANDARD; import org.alfresco.rest.rm.community.model.site.RMSiteCompliance; -import org.alfresco.rest.rm.community.model.site.RMSiteModel; +import org.alfresco.rest.rm.community.model.site.RMSite; /** - * FIXME!!! + * Utility class for the RM Site * * @author Tuna Aksoy * @since 2.6 @@ -51,48 +51,48 @@ public class RMSiteUtil public static final String RM_DESCRIPTION = "Records Management Site"; /** - * FIXME!!! + * Creates an RM Site model for the given compliance, title and description * - * @param compliance FIXME!!! - * @param title FIXME!!! - * @param description FIXME!!! - * @return FIXME!!! + * @param compliance The RM site compliance + * @param title The site title + * @param description The site description + * @return The {@link RMSite} with the given details */ - public static RMSiteModel createRMSiteModel(RMSiteCompliance compliance, String title, String description) + public static RMSite createRMSiteModel(RMSiteCompliance compliance, String title, String description) { - RMSiteModel rmSiteModel = RMSiteModel.builder().compliance(compliance).build(); + RMSite rmSiteModel = RMSite.builder().compliance(compliance).build(); rmSiteModel.setTitle(title); rmSiteModel.setDescription(description); return rmSiteModel; } /** - * FIXME!!! + * Creates an RM Site for the given compliance and default title and description * - * @param compliance FIXME!!! - * @return FIXME!!! + * @param The RM site compliance + * @return The {@link RMSite} with the given details */ - private static RMSiteModel createRMSiteModel(RMSiteCompliance compliance) + private static RMSite createRMSiteModel(RMSiteCompliance compliance) { return createRMSiteModel(compliance, RM_TITLE, RM_DESCRIPTION); } /** - * FIXME!!! + * Creates a standard RM site with the default title and description * - * @return FIXME!!! + * @return The standard RM site */ - public static RMSiteModel createStandardRMSiteModel() + public static RMSite createStandardRMSiteModel() { return createRMSiteModel(STANDARD); } /** - * FIXME!!! + * Creates a DOD5015 compliance RM site with the default title and description * - * @return FIXME!!! + * @return The DOD5015 compliance RM site */ - public static RMSiteModel createDOD5015RMSiteModel() + public static RMSite createDOD5015RMSiteModel() { return createRMSiteModel(DOD5015); } From 8dcd78653a815bbc83a2585bf3bfaff8d1cf74df Mon Sep 17 00:00:00 2001 From: Tuna Aksoy Date: Tue, 27 Dec 2016 23:50:48 +0000 Subject: [PATCH 6/9] RM-4488 (Refactor REST API Automation test code according to the latest changes) --- .../alfresco/rest/core/RestAPIFactory.java | 87 +++++++++++ .../requests/igCoreAPI/RestIGCoreAPI.java | 4 - .../rest/rm/community/base/BaseRESTAPI.java | 135 ------------------ ...{BaseRESTTest.java => BaseRMRestTest.java} | 63 +++++++- .../fileplancomponents/DeleteRecordTests.java | 36 +++-- .../ElectronicRecordTests.java | 18 +-- .../fileplancomponents/FilePlanTests.java | 39 +++-- .../NonElectronicRecordTests.java | 31 ++-- .../RecordCategoryTest.java | 24 ++-- .../fileplancomponents/RecordFolderTests.java | 36 ++--- .../UnfiledRecordsFolderTests.java | 20 +-- .../rest/rm/community/site/RMSiteTests.java | 34 ++--- 12 files changed, 254 insertions(+), 273 deletions(-) create mode 100644 rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/core/RestAPIFactory.java delete mode 100644 rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/base/BaseRESTAPI.java rename rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/base/{BaseRESTTest.java => BaseRMRestTest.java} (86%) 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 new file mode 100644 index 0000000000..9c6f1ddd12 --- /dev/null +++ b/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/core/RestAPIFactory.java @@ -0,0 +1,87 @@ +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 Alfresco Software Limited + * %% + * This file is part of the Alfresco software. + * - + * If the software was purchased under a paid Alfresco license, the terms of + * the paid license agreement will prevail. Otherwise, the software is + * provided under the following open source license terms: + * - + * Alfresco is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * - + * Alfresco is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * - + * You should have received a copy of the GNU Lesser General Public License + * along with Alfresco. If not, see . + * #L% + */ +package org.alfresco.rest.core; + +import org.alfresco.rest.rm.community.requests.igCoreAPI.FilePlanComponentAPI; +import org.alfresco.rest.rm.community.requests.igCoreAPI.RMSiteAPI; +import org.alfresco.rest.rm.community.requests.igCoreAPI.RestIGCoreAPI; +import org.alfresco.utility.data.DataUser; +import org.alfresco.utility.model.UserModel; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.context.annotation.Scope; +import org.springframework.stereotype.Service; + +/** + * REST API Factory Implementation + * + * @author Tuna Aksoy + * @since 2.6 + */ +@Service +@Scope(value = "prototype") +public class RestAPIFactory +{ + @Autowired + private DataUser dataUser; + + @Autowired + private RMRestWrapper rmRestWrapper; + + /** + * @return the rmRestWrapper + */ + public RMRestWrapper getRmRestWrapper() + { + return this.rmRestWrapper; + } + + private RestIGCoreAPI getRestIGCoreAPI(UserModel userModel) + { + getRmRestWrapper().authenticateUser(userModel != null ? userModel : dataUser.getAdminUser()); + return getRmRestWrapper().withIGCoreAPI(); + } + + public RMSiteAPI getRMSiteAPI() + { + return getRestIGCoreAPI(null).usingRMSite(); + } + + public RMSiteAPI getRMSiteAPI(UserModel userModel) + { + return getRestIGCoreAPI(userModel).usingRMSite(); + } + + public FilePlanComponentAPI getFilePlanComponentsAPI() + { + return getRestIGCoreAPI(null).usingFilePlanComponents(); + } + + public FilePlanComponentAPI getFilePlanComponentsAPI(UserModel userModel) + { + return getRestIGCoreAPI(userModel).usingFilePlanComponents(); + } +} diff --git a/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/requests/igCoreAPI/RestIGCoreAPI.java b/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/requests/igCoreAPI/RestIGCoreAPI.java index 6d20250d38..c5d700874b 100644 --- a/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/requests/igCoreAPI/RestIGCoreAPI.java +++ b/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/requests/igCoreAPI/RestIGCoreAPI.java @@ -44,9 +44,6 @@ import org.alfresco.rest.rm.community.requests.RMModelRequest; */ public class RestIGCoreAPI extends RMModelRequest { - @SuppressWarnings("unused") - private RMRestProperties rmRestProperties; - /** * Constructor * @@ -56,7 +53,6 @@ public class RestIGCoreAPI extends RMModelRequest public RestIGCoreAPI(RMRestWrapper rmRestWrapper, RMRestProperties rmRestProperties) { super(rmRestWrapper); - this.rmRestProperties = rmRestProperties; RestAssured.baseURI = format("%s://%s", rmRestProperties.getScheme(), rmRestProperties.getServer()); RestAssured.port = parseInt(rmRestProperties.getPort()); RestAssured.basePath = rmRestProperties.getRestRmPath(); diff --git a/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/base/BaseRESTAPI.java b/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/base/BaseRESTAPI.java deleted file mode 100644 index 91fee5e1ca..0000000000 --- a/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/base/BaseRESTAPI.java +++ /dev/null @@ -1,135 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * - - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ -package org.alfresco.rest.rm.community.base; - -import org.alfresco.rest.RestTest; -import org.alfresco.rest.core.RMRestWrapper; -import org.alfresco.rest.rm.community.requests.igCoreAPI.FilePlanComponentAPI; -import org.alfresco.rest.rm.community.requests.igCoreAPI.RMSiteAPI; -import org.alfresco.utility.data.DataUser; -import org.alfresco.utility.model.UserModel; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.http.HttpStatus; - -/** - * Abstract class to hold the REST APIs - * - * @author Tuna Aksoy - * @since 2.6 - */ -public abstract class BaseRESTAPI extends RestTest -{ - @Autowired - private RMRestWrapper rmRestWrapper; - - @Autowired - private DataUser dataUser; - - /** - * The RM REST Wrapper - * - * @return the rmRestWrapper - */ - protected RMRestWrapper getRmRestWrapper() - { - return this.rmRestWrapper; - } - - /** - * The data user service - * - * @return the dataUser - */ - protected DataUser getDataUser() - { - return this.dataUser; - } - - /** - * Compares the given {@link HttpStatus} code with the response status code - * - * @param httpStatus The {@link HttpStatus} to assert - */ - protected void assertStatusCode(HttpStatus httpStatus) - { - getRmRestWrapper().assertStatusCodeIs(httpStatus); - } - - /** - * Gets the admin user - * - * @return The admin user - */ - protected UserModel getAdminUser() - { - return getDataUser().getAdminUser(); - } - - /** - * Gets the {@link RMSiteAPI} as the admin user - * - * @return {@link RMSiteAPI} with the admin credentials - */ - protected RMSiteAPI getRMSiteAPI() - { - return getRMSiteAPI(getAdminUser()); - } - - /** - * Gets the {@link RMSiteAPI} as the given user - * - * @param userModel The user model whose credentials will be used to get the API - * @return {@link RMSiteAPI} with user credentials - */ - protected RMSiteAPI getRMSiteAPI(UserModel userModel) - { - getRmRestWrapper().authenticateUser(userModel); - return getRmRestWrapper().withIGCoreAPI().usingRMSite(); - } - - /** - * Gets the {@link FilePlanComponentAPI} as the admin user - * - * @return {@link FilePlanComponentAPI} with the admin credentials - */ - protected FilePlanComponentAPI getFilePlanComponentsAPI() - { - return getFilePlanComponentsAPI(getAdminUser()); - } - - /** - * Get the {@link FilePlanComponentAPI} as the given user - * - * @param userModel The user model whose credentials will be used to get the API - * @return {@link FilePlanComponentAPI} with the user credentials - */ - protected FilePlanComponentAPI getFilePlanComponentsAPI(UserModel userModel) - { - getRmRestWrapper().authenticateUser(userModel); - return getRmRestWrapper().withIGCoreAPI().usingFilePlanComponents(); - } -} diff --git a/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/base/BaseRESTTest.java b/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/base/BaseRMRestTest.java similarity index 86% rename from rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/base/BaseRESTTest.java rename to rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/base/BaseRMRestTest.java index 5bfb537003..e912a8ec74 100644 --- a/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/base/BaseRESTTest.java +++ b/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/base/BaseRMRestTest.java @@ -39,9 +39,14 @@ import static org.alfresco.utility.data.RandomData.getRandomAlphanumeric; import static org.springframework.http.HttpStatus.CREATED; import static org.springframework.http.HttpStatus.OK; +import org.alfresco.rest.RestTest; +import org.alfresco.rest.core.RestAPIFactory; import org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponent; import org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentProperties; +import org.alfresco.utility.data.DataUser; import org.alfresco.utility.model.UserModel; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.http.HttpStatus; import org.testng.annotations.BeforeClass; import org.testng.annotations.DataProvider; @@ -52,8 +57,54 @@ import org.testng.annotations.DataProvider; * @author Tuna Aksoy * @since 2.6 */ -public class BaseRESTTest extends BaseRESTAPI +public class BaseRMRestTest extends RestTest { + @Autowired + private RestAPIFactory restAPIFactory; + + @Autowired + private DataUser dataUser; + + /** + * FIXME!!! + * + * @return the restAPIFactory FIXME!!! + */ + protected RestAPIFactory getRestAPIFactory() + { + return this.restAPIFactory; + } + + /** + * FIXME!!! + * + * @return the dataUser FIXME!!! + */ + protected DataUser getDataUser() + { + return this.dataUser; + } + + /** + * FIXME!!! + * + * @param created FIXME!!! + */ + protected void assertStatusCode(HttpStatus statusCode) + { + getRestAPIFactory().getRmRestWrapper().assertStatusCodeIs(statusCode); + } + + /** + * FIXME!!! + * + * @return FIXME!!! + */ + protected UserModel getAdminUser() + { + return getDataUser().getAdminUser(); + } + /** Valid root containers where electronic and non-electronic records can be created */ @DataProvider(name = "validRootContainers") public Object[][] getValidRootContainers() throws Exception @@ -87,10 +138,10 @@ public class BaseRESTTest extends BaseRESTAPI public void createRMSiteIfNotExists() throws Exception { // Check RM site doesn't exist - if (!getRMSiteAPI().existsRMSite()) + if (!getRestAPIFactory().getRMSiteAPI().existsRMSite()) { // Create the RM site - getRMSiteAPI().createRMSite(createStandardRMSiteModel()); + getRestAPIFactory().getRMSiteAPI().createRMSite(createStandardRMSiteModel()); // Verify the status code assertStatusCode(CREATED); @@ -192,7 +243,7 @@ public class BaseRESTTest extends BaseRESTAPI private FilePlanComponent createComponent(UserModel user, String parentComponentId, String componentName, String componentType, String componentTitle) throws Exception { FilePlanComponent filePlanComponentModel = createFilePlanComponentModel(componentName, componentType, componentTitle); - FilePlanComponent filePlanComponent = getFilePlanComponentsAPI(user).createFilePlanComponent(filePlanComponentModel, parentComponentId); + FilePlanComponent filePlanComponent = getRestAPIFactory().getFilePlanComponentsAPI(user).createFilePlanComponent(filePlanComponentModel, parentComponentId); assertStatusCode(CREATED); return filePlanComponent; @@ -213,7 +264,7 @@ public class BaseRESTTest extends BaseRESTAPI FilePlanComponent filePlanComponent = new FilePlanComponent(); filePlanComponent.setProperties(properties); - FilePlanComponent updatedComponent = getFilePlanComponentsAPI().updateFilePlanComponent(filePlanComponent, folderId); + FilePlanComponent updatedComponent = getRestAPIFactory().getFilePlanComponentsAPI().updateFilePlanComponent(filePlanComponent, folderId); assertStatusCode(OK); return updatedComponent; } @@ -257,7 +308,7 @@ public class BaseRESTTest extends BaseRESTAPI */ public FilePlanComponent getFilePlanComponentAsUser(UserModel user, String componentId) throws Exception { - return getFilePlanComponentsAPI(user).getFilePlanComponent(componentId); + return getRestAPIFactory().getFilePlanComponentsAPI(user).getFilePlanComponent(componentId); } /** diff --git a/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/fileplancomponents/DeleteRecordTests.java b/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/fileplancomponents/DeleteRecordTests.java index 6115649153..485b3fb3b5 100644 --- a/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/fileplancomponents/DeleteRecordTests.java +++ b/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/fileplancomponents/DeleteRecordTests.java @@ -36,14 +36,13 @@ import static org.springframework.http.HttpStatus.NOT_FOUND; import static org.springframework.http.HttpStatus.NO_CONTENT; import static org.springframework.http.HttpStatus.OK; -import org.alfresco.rest.rm.community.base.BaseRESTTest; +import org.alfresco.rest.rm.community.base.BaseRMRestTest; import org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponent; import org.alfresco.rest.rm.community.model.user.UserPermissions; import org.alfresco.rest.rm.community.model.user.UserRoles; import org.alfresco.rest.rm.community.requests.igCoreAPI.RMUserAPI; import org.alfresco.test.AlfrescoTest; import org.alfresco.utility.constants.UserRole; -import org.alfresco.utility.data.DataUser; import org.alfresco.utility.model.SiteModel; import org.alfresco.utility.model.UserModel; import org.springframework.beans.factory.annotation.Autowired; @@ -58,14 +57,11 @@ import org.testng.annotations.Test; * @author Kristijan Conkas * @since 2.6 */ -public class DeleteRecordTests extends BaseRESTTest +public class DeleteRecordTests extends BaseRMRestTest { @Autowired private RMUserAPI rmUserAPI; - @Autowired - private DataUser dataUser; - /** *
          * Given a record
    @@ -86,7 +82,7 @@ public class DeleteRecordTests extends BaseRESTTest
         @AlfrescoTest(jira="RM-4363")
         public void adminCanDeleteElectronicRecord(FilePlanComponent container) throws Exception
         {
    -        FilePlanComponent newRecord = getFilePlanComponentsAPI().createElectronicRecord(createElectronicRecordModel(), IMAGE_FILE, container.getId());
    +        FilePlanComponent newRecord = getRestAPIFactory().getFilePlanComponentsAPI().createElectronicRecord(createElectronicRecordModel(), IMAGE_FILE, container.getId());
     
             assertStatusCode(CREATED);
     
    @@ -114,7 +110,7 @@ public class DeleteRecordTests extends BaseRESTTest
         public void adminCanDeleteNonElectronicRecord(FilePlanComponent container) throws Exception
         {
             // create a non-electronic record
    -        FilePlanComponent newRecord = getFilePlanComponentsAPI().createFilePlanComponent(createNonElectronicRecordModel(), container.getId());
    +        FilePlanComponent newRecord = getRestAPIFactory().getFilePlanComponentsAPI().createFilePlanComponent(createNonElectronicRecordModel(), container.getId());
     
             assertStatusCode(CREATED);
     
    @@ -141,22 +137,22 @@ public class DeleteRecordTests extends BaseRESTTest
         public void userWithoutWritePermissionsCantDeleteRecord() throws Exception
         {
             // create a non-electronic record in unfiled records
    -        FilePlanComponent newRecord = getFilePlanComponentsAPI().createFilePlanComponent(createNonElectronicRecordModel(), UNFILED_RECORDS_CONTAINER_ALIAS);
    +        FilePlanComponent newRecord = getRestAPIFactory().getFilePlanComponentsAPI().createFilePlanComponent(createNonElectronicRecordModel(), UNFILED_RECORDS_CONTAINER_ALIAS);
     
             assertStatusCode(CREATED);
     
             // create test user and add it with collab. privileges
    -        UserModel deleteUser = dataUser.createRandomTestUser("delnoperm");
    +        UserModel deleteUser = getDataUser().createRandomTestUser("delnoperm");
             deleteUser.setUserRole(UserRole.SiteCollaborator);
             logger.info("test user: " + deleteUser.getUsername());
    -        dataUser.addUserToSite(deleteUser, new SiteModel(getRMSiteAPI().getSite().getId()), UserRole.SiteCollaborator);
    +        getDataUser().addUserToSite(deleteUser, new SiteModel(getRestAPIFactory().getRMSiteAPI().getSite().getId()), UserRole.SiteCollaborator);
     
             // add RM role to user
             rmUserAPI.assignRoleToUser(deleteUser.getUsername(), UserRoles.ROLE_RM_POWER_USER);
             rmUserAPI.usingRestWrapper().assertStatusCodeIs(OK);
     
             // try to delete newRecord
    -        getFilePlanComponentsAPI(deleteUser).deleteFilePlanComponent(newRecord.getId());
    +        getRestAPIFactory().getFilePlanComponentsAPI(deleteUser).deleteFilePlanComponent(newRecord.getId());
             assertStatusCode(FORBIDDEN);
         }
     
    @@ -180,9 +176,9 @@ public class DeleteRecordTests extends BaseRESTTest
         public void userWithoutDeleteRecordsCapabilityCantDeleteRecord() throws Exception
         {
             // create test user and add it with collab. privileges
    -        UserModel deleteUser = dataUser.createRandomTestUser("delnoperm");
    +        UserModel deleteUser = getDataUser().createRandomTestUser("delnoperm");
             deleteUser.setUserRole(UserRole.SiteCollaborator);
    -        dataUser.addUserToSite(deleteUser, new SiteModel(getRMSiteAPI().getSite().getId()), UserRole.SiteCollaborator);
    +        getDataUser().addUserToSite(deleteUser, new SiteModel(getRestAPIFactory().getRMSiteAPI().getSite().getId()), UserRole.SiteCollaborator);
             logger.info("test user: " + deleteUser.getUsername());
     
             // add RM role to user, RM Power User doesn't have the Delete Record capabilities
    @@ -195,20 +191,20 @@ public class DeleteRecordTests extends BaseRESTTest
     
             // grant deleteUser Filing privileges on randomFolder category, this will be
             // inherited to randomFolder
    -        rmUserAPI.addUserPermission(getFilePlanComponentsAPI().getFilePlanComponent(randomFolder.getParentId()),
    +        rmUserAPI.addUserPermission(getRestAPIFactory().getFilePlanComponentsAPI().getFilePlanComponent(randomFolder.getParentId()),
                 deleteUser, UserPermissions.PERMISSION_FILING);
             rmUserAPI.usingRestWrapper().assertStatusCodeIs(OK);
     
             // create a non-electronic record in randomFolder
    -        FilePlanComponent newRecord = getFilePlanComponentsAPI().createFilePlanComponent(createNonElectronicRecordModel(), randomFolder.getId());
    +        FilePlanComponent newRecord = getRestAPIFactory().getFilePlanComponentsAPI().createFilePlanComponent(createNonElectronicRecordModel(), randomFolder.getId());
             assertStatusCode(CREATED);
     
             // verify the user can see the newRecord
    -        getFilePlanComponentsAPI(deleteUser).getFilePlanComponent(newRecord.getId());
    +        getRestAPIFactory().getFilePlanComponentsAPI(deleteUser).getFilePlanComponent(newRecord.getId());
             assertStatusCode(OK);
     
             // try to delete newRecord
    -        getFilePlanComponentsAPI(deleteUser).deleteFilePlanComponent(newRecord.getId());
    +        getRestAPIFactory().getFilePlanComponentsAPI(deleteUser).deleteFilePlanComponent(newRecord.getId());
             assertStatusCode(FORBIDDEN);
         }
     
    @@ -220,11 +216,11 @@ public class DeleteRecordTests extends BaseRESTTest
         private void deleteAndVerify(FilePlanComponent record) throws Exception
         {
             // delete it and verify status
    -        getFilePlanComponentsAPI().deleteFilePlanComponent(record.getId());
    +        getRestAPIFactory().getFilePlanComponentsAPI().deleteFilePlanComponent(record.getId());
             assertStatusCode(NO_CONTENT);
     
             // try to get deleted file plan component
    -        getFilePlanComponentsAPI().getFilePlanComponent(record.getId());
    +        getRestAPIFactory().getFilePlanComponentsAPI().getFilePlanComponent(record.getId());
             assertStatusCode(NOT_FOUND);
         }
     }
    diff --git a/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/fileplancomponents/ElectronicRecordTests.java b/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/fileplancomponents/ElectronicRecordTests.java
    index 6dc04587b5..94381a217a 100644
    --- a/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/fileplancomponents/ElectronicRecordTests.java
    +++ b/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/fileplancomponents/ElectronicRecordTests.java
    @@ -40,7 +40,7 @@ import static org.springframework.http.HttpStatus.UNPROCESSABLE_ENTITY;
     import static org.testng.Assert.assertFalse;
     import static org.testng.Assert.assertTrue;
     
    -import org.alfresco.rest.rm.community.base.BaseRESTTest;
    +import org.alfresco.rest.rm.community.base.BaseRMRestTest;
     import org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponent;
     import org.testng.annotations.DataProvider;
     import org.testng.annotations.Test;
    @@ -54,7 +54,7 @@ import org.testng.annotations.Test;
      * @author Kristijan Conkas
      * @since 2.6
      */
    -public class ElectronicRecordTests extends BaseRESTTest
    +public class ElectronicRecordTests extends BaseRMRestTest
     {
         /** Valid root containers where electronic records can be created */
         @DataProvider(name = "invalidParentContainers")
    @@ -91,7 +91,7 @@ public class ElectronicRecordTests extends BaseRESTTest
         public void cantCreateElectronicRecordsInInvalidContainers(FilePlanComponent container) throws Exception
         {
             // Build object the filePlan
    -        getFilePlanComponentsAPI().createElectronicRecord(createElectronicRecordModel(), IMAGE_FILE, container.getId());
    +        getRestAPIFactory().getFilePlanComponentsAPI().createElectronicRecord(createElectronicRecordModel(), IMAGE_FILE, container.getId());
     
             // verify the create request status code
             assertStatusCode(UNPROCESSABLE_ENTITY);
    @@ -119,7 +119,7 @@ public class ElectronicRecordTests extends BaseRESTTest
             closeFolder(recordFolder.getId());
     
             // try to create it, this should fail
    -        getFilePlanComponentsAPI().createElectronicRecord(createElectronicRecordModel(), IMAGE_FILE, recordFolder.getId());
    +        getRestAPIFactory().getFilePlanComponentsAPI().createElectronicRecord(createElectronicRecordModel(), IMAGE_FILE, recordFolder.getId());
     
             // verify the status code
             assertStatusCode(UNPROCESSABLE_ENTITY);
    @@ -166,7 +166,7 @@ public class ElectronicRecordTests extends BaseRESTTest
                                                         .build();
     
             // try to create it
    -        getFilePlanComponentsAPI().createFilePlanComponent(record, container.getId());
    +        getRestAPIFactory().getFilePlanComponentsAPI().createFilePlanComponent(record, container.getId());
     
             // verify the status code is BAD_REQUEST
             assertStatusCode(BAD_REQUEST);
    @@ -197,13 +197,13 @@ public class ElectronicRecordTests extends BaseRESTTest
         public void canCreateElectronicRecordsInValidContainers(FilePlanComponent container) throws Exception
         {
             FilePlanComponent record = createElectronicRecordModel();
    -        String newRecordId = getFilePlanComponentsAPI().createElectronicRecord(record, IMAGE_FILE, container.getId()).getId();
    +        String newRecordId = getRestAPIFactory().getFilePlanComponentsAPI().createElectronicRecord(record, IMAGE_FILE, container.getId()).getId();
     
             // verify the create request status code
             assertStatusCode(CREATED);
     
             // get newly created electronic record and verify its properties
    -        FilePlanComponent electronicRecord = getFilePlanComponentsAPI().getFilePlanComponent(newRecordId);
    +        FilePlanComponent electronicRecord = getRestAPIFactory().getFilePlanComponentsAPI().getFilePlanComponent(newRecordId);
             // created record will have record identifier inserted in its name but will be prefixed with
             // the name it was created as
             assertTrue(electronicRecord.getName().startsWith(record.getName()));
    @@ -227,13 +227,13 @@ public class ElectronicRecordTests extends BaseRESTTest
                     .nodeType(CONTENT_TYPE)
                     .build();
     
    -        String newRecordId = getFilePlanComponentsAPI().createElectronicRecord(record, IMAGE_FILE, container.getId()).getId();
    +        String newRecordId = getRestAPIFactory().getFilePlanComponentsAPI().createElectronicRecord(record, IMAGE_FILE, container.getId()).getId();
     
             // verify the create request status code
             assertStatusCode(CREATED);
     
             // get newly created electonic record and verify its properties
    -        FilePlanComponent electronicRecord = getFilePlanComponentsAPI().getFilePlanComponent(newRecordId);
    +        FilePlanComponent electronicRecord = getRestAPIFactory().getFilePlanComponentsAPI().getFilePlanComponent(newRecordId);
             // record will have record identifier inserted in its name but will for sure start with file name
             // and end with its extension
             assertTrue(electronicRecord.getName().startsWith(IMAGE_FILE.substring(0, IMAGE_FILE.indexOf("."))));
    diff --git a/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/fileplancomponents/FilePlanTests.java b/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/fileplancomponents/FilePlanTests.java
    index 2705589e95..2ed2d3715a 100644
    --- a/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/fileplancomponents/FilePlanTests.java
    +++ b/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/fileplancomponents/FilePlanTests.java
    @@ -43,14 +43,12 @@ import static org.testng.Assert.assertEquals;
     import static org.testng.Assert.assertFalse;
     import static org.testng.Assert.assertTrue;
     
    -import org.alfresco.rest.rm.community.base.BaseRESTTest;
    +import org.alfresco.rest.rm.community.base.BaseRMRestTest;
     import org.alfresco.rest.rm.community.base.TestData;
     import org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponent;
     import org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentProperties;
    -import org.alfresco.utility.data.DataUser;
     import org.alfresco.utility.model.UserModel;
     import org.alfresco.utility.report.Bug;
    -import org.springframework.beans.factory.annotation.Autowired;
     import org.testng.annotations.Test;
     
     /**
    @@ -60,11 +58,8 @@ import org.testng.annotations.Test;
      * @author Rodica Sutu
      * @since 2.6
      */
    -public class FilePlanTests extends BaseRESTTest
    +public class FilePlanTests extends BaseRMRestTest
     {
    -    @Autowired
    -    private DataUser dataUser;
    -
         /**
          * Given that the RM site doesn't exist
          * When I use the API to get the File Plan/Holds/Unfiled Records Container/Transfers
    @@ -79,14 +74,14 @@ public class FilePlanTests extends BaseRESTTest
         public void getFilePlanComponentWhenRMIsNotCreated(String filePlanComponentAlias) throws Exception
         {
             // Check RM Site Exist
    -        if (getRMSiteAPI().existsRMSite())
    +        if (getRestAPIFactory().getRMSiteAPI().existsRMSite())
             {
                 // Delete RM Site
    -            getRMSiteAPI().deleteRMSite();
    +            getRestAPIFactory().getRMSiteAPI().deleteRMSite();
             }
     
             // Get the file plan component
    -        getFilePlanComponentsAPI().getFilePlanComponent(filePlanComponentAlias);
    +        getRestAPIFactory().getFilePlanComponentsAPI().getFilePlanComponent(filePlanComponentAlias);
     
             //check the response code is NOT_FOUND
             assertStatusCode(NOT_FOUND);
    @@ -109,7 +104,7 @@ public class FilePlanTests extends BaseRESTTest
             createRMSiteIfNotExists();
     
             // Get the file plan special container
    -        FilePlanComponent filePlanComponent = getFilePlanComponentsAPI().getFilePlanComponent(filePlanComponentAlias);
    +        FilePlanComponent filePlanComponent = getRestAPIFactory().getFilePlanComponentsAPI().getFilePlanComponent(filePlanComponentAlias);
     
             // Check the response code
             assertStatusCode(OK);
    @@ -135,7 +130,7 @@ public class FilePlanTests extends BaseRESTTest
             createRMSiteIfNotExists();
     
             // Get the file plan special containers with the optional parameter allowableOperations
    -        FilePlanComponent filePlanComponent = getFilePlanComponentsAPI().getFilePlanComponent(specialContainerAlias, "include=" + ALLOWABLE_OPERATIONS);
    +        FilePlanComponent filePlanComponent = getRestAPIFactory().getFilePlanComponentsAPI().getFilePlanComponent(specialContainerAlias, "include=" + ALLOWABLE_OPERATIONS);
     
             // Check the list of allowableOperations returned
             if(specialContainerAlias.equals(TRANSFERS_ALIAS))
    @@ -179,7 +174,7 @@ public class FilePlanTests extends BaseRESTTest
                 .build();
     
             // Update the record category
    -        FilePlanComponent renamedFilePlanComponent = getFilePlanComponentsAPI().updateFilePlanComponent(filePlanComponent, FILE_PLAN_ALIAS);
    +        FilePlanComponent renamedFilePlanComponent = getRestAPIFactory().getFilePlanComponentsAPI().updateFilePlanComponent(filePlanComponent, FILE_PLAN_ALIAS);
     
             // Verify the response status code
             assertStatusCode(OK);
    @@ -208,7 +203,7 @@ public class FilePlanTests extends BaseRESTTest
             createRMSiteIfNotExists();
     
             // Delete the file plan component
    -        getFilePlanComponentsAPI().deleteFilePlanComponent(filePlanComponentAlias);
    +        getRestAPIFactory().getFilePlanComponentsAPI().deleteFilePlanComponent(filePlanComponentAlias);
     
             // Check the DELETE response status code
             assertStatusCode(UNPROCESSABLE_ENTITY);
    @@ -231,10 +226,10 @@ public class FilePlanTests extends BaseRESTTest
             createRMSiteIfNotExists();
     
             // Create a random user
    -        UserModel nonRMuser = dataUser.createRandomTestUser("testUser");
    +        UserModel nonRMuser = getDataUser().createRandomTestUser("testUser");
     
             // Delete the file plan component
    -        getFilePlanComponentsAPI(nonRMuser).deleteFilePlanComponent(filePlanComponentAlias);
    +        getRestAPIFactory().getFilePlanComponentsAPI(nonRMuser).deleteFilePlanComponent(filePlanComponentAlias);
     
             // Check the DELETE response status code
             assertStatusCode(FORBIDDEN);
    @@ -258,7 +253,7 @@ public class FilePlanTests extends BaseRESTTest
             createRMSiteIfNotExists();
     
             // Get the RM site ID
    -        String rmSiteId = getRMSiteAPI().getSite().getGuid();
    +        String rmSiteId = getRestAPIFactory().getRMSiteAPI().getSite().getGuid();
             String name = filePlanComponentAlias + getRandomAlphanumeric();
     
             // Build the file plan root properties
    @@ -270,15 +265,15 @@ public class FilePlanTests extends BaseRESTTest
                     .build();
     
             // Create the special containers into RM site - parent folder
    -        getFilePlanComponentsAPI().createFilePlanComponent(filePlanComponent, rmSiteId);
    +        getRestAPIFactory().getFilePlanComponentsAPI().createFilePlanComponent(filePlanComponent, rmSiteId);
             assertStatusCode(UNPROCESSABLE_ENTITY);
     
             // Create the special containers into RM site - parent folder
    -        getFilePlanComponentsAPI().createFilePlanComponent(filePlanComponent, FILE_PLAN_ALIAS);
    +        getRestAPIFactory().getFilePlanComponentsAPI().createFilePlanComponent(filePlanComponent, FILE_PLAN_ALIAS);
             assertStatusCode(UNPROCESSABLE_ENTITY);
     
             // Create the special containers into the root of special containers containers
    -        getFilePlanComponentsAPI().createFilePlanComponent(filePlanComponent, filePlanComponentAlias);
    +        getRestAPIFactory().getFilePlanComponentsAPI().createFilePlanComponent(filePlanComponent, filePlanComponentAlias);
             assertStatusCode(UNPROCESSABLE_ENTITY);
         }
     
    @@ -299,10 +294,10 @@ public class FilePlanTests extends BaseRESTTest
             createRMSiteIfNotExists();
     
             // Create a random user
    -        UserModel nonRMuser = dataUser.createRandomTestUser("testUser");
    +        UserModel nonRMuser = getDataUser().createRandomTestUser("testUser");
     
             // Get the special file plan components
    -        getFilePlanComponentsAPI(nonRMuser).getFilePlanComponent(filePlanComponentAlias);
    +        getRestAPIFactory().getFilePlanComponentsAPI(nonRMuser).getFilePlanComponent(filePlanComponentAlias);
     
             // Check the response status code is FORBIDDEN
             assertStatusCode(FORBIDDEN);
    diff --git a/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/fileplancomponents/NonElectronicRecordTests.java b/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/fileplancomponents/NonElectronicRecordTests.java
    index da890bbc6d..70c55c8ab7 100644
    --- a/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/fileplancomponents/NonElectronicRecordTests.java
    +++ b/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/fileplancomponents/NonElectronicRecordTests.java
    @@ -47,14 +47,12 @@ import static org.testng.Assert.assertFalse;
     
     import java.util.Random;
     
    -import org.alfresco.rest.rm.community.base.BaseRESTTest;
    +import org.alfresco.rest.rm.community.base.BaseRMRestTest;
     import org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponent;
     import org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentProperties;
     import org.alfresco.utility.constants.UserRole;
    -import org.alfresco.utility.data.DataUser;
     import org.alfresco.utility.model.SiteModel;
     import org.alfresco.utility.model.UserModel;
    -import org.springframework.beans.factory.annotation.Autowired;
     import org.testng.annotations.Test;
     
     /**
    @@ -63,11 +61,8 @@ import org.testng.annotations.Test;
      * @author Kristijan Conkas
      * @since 2.6
      */
    -public class NonElectronicRecordTests extends BaseRESTTest
    +public class NonElectronicRecordTests extends BaseRMRestTest
     {
    -    @Autowired
    -    private DataUser dataUser;
    -
         /**
          * 
          * Given a parent container that is NOT a record folder or an unfiled record folder
    @@ -86,7 +81,7 @@ public class NonElectronicRecordTests extends BaseRESTTest
                                                              .nodeType(RECORD_CATEGORY_TYPE)
                                                              .build();
     
    -        FilePlanComponent recordCategory = getFilePlanComponentsAPI().createFilePlanComponent(recordCategoryModel, FILE_PLAN_ALIAS);
    +        FilePlanComponent recordCategory = getRestAPIFactory().getFilePlanComponentsAPI().createFilePlanComponent(recordCategoryModel, FILE_PLAN_ALIAS);
     
             // iterate through all invalid parent containers and try to create/file an electronic record
             asList(FILE_PLAN_ALIAS, TRANSFERS_ALIAS, HOLDS_ALIAS, recordCategory.getId())
    @@ -95,7 +90,7 @@ public class NonElectronicRecordTests extends BaseRESTTest
                 {
                     try
                     {
    -                    getFilePlanComponentsAPI().createFilePlanComponent(createNonElectronicRecordModel(), id);
    +                    getRestAPIFactory().getFilePlanComponentsAPI().createFilePlanComponent(createNonElectronicRecordModel(), id);
                     }
                     catch (Exception error)
                     {
    @@ -167,7 +162,7 @@ public class NonElectronicRecordTests extends BaseRESTTest
                                                                .build();
     
             // create non-electronic record
    -        String nonElectronicId = getFilePlanComponentsAPI().createFilePlanComponent(
    +        String nonElectronicId = getRestAPIFactory().getFilePlanComponentsAPI().createFilePlanComponent(
                 filePlanComponent,
                 container.getId()).getId();
     
    @@ -175,7 +170,7 @@ public class NonElectronicRecordTests extends BaseRESTTest
             assertStatusCode(CREATED);
     
             // get newly created non-electonic record and verify its properties
    -        FilePlanComponent nonElectronicRecord = getFilePlanComponentsAPI().getFilePlanComponent(nonElectronicId);
    +        FilePlanComponent nonElectronicRecord = getRestAPIFactory().getFilePlanComponentsAPI().getFilePlanComponent(nonElectronicId);
     
             assertEquals(title, nonElectronicRecord.getProperties().getTitle());
             assertEquals(description, nonElectronicRecord.getProperties().getDescription());
    @@ -209,7 +204,7 @@ public class NonElectronicRecordTests extends BaseRESTTest
             closeFolder(recordFolder.getId());
     
             // try to create it, this should fail and throw an exception
    -        getFilePlanComponentsAPI().createFilePlanComponent(createNonElectronicRecordModel(), recordFolder.getId());
    +        getRestAPIFactory().getFilePlanComponentsAPI().createFilePlanComponent(createNonElectronicRecordModel(), recordFolder.getId());
     
             // verify the status code
             assertStatusCode(UNPROCESSABLE_ENTITY);
    @@ -272,7 +267,7 @@ public class NonElectronicRecordTests extends BaseRESTTest
                 // this should fail and throw an exception
                 try
                 {
    -                getFilePlanComponentsAPI().createFilePlanComponent(c, container.getId());
    +                getRestAPIFactory().getFilePlanComponentsAPI().createFilePlanComponent(c, container.getId());
                 }
                 catch (Exception e)
                 {
    @@ -315,7 +310,7 @@ public class NonElectronicRecordTests extends BaseRESTTest
             // this should fail and throw an exception
             try
             {
    -            getFilePlanComponentsAPI(user).createFilePlanComponent(record, container.getId());
    +            getRestAPIFactory().getFilePlanComponentsAPI(user).createFilePlanComponent(record, container.getId());
             }
             catch (Exception e)
             {
    @@ -351,20 +346,20 @@ public class NonElectronicRecordTests extends BaseRESTTest
          */
         private UserModel createUserWithRole(String userName, UserRole userRole) throws Exception
         {
    -        String siteId = getRMSiteAPI().getSite().getId();
    +        String siteId = getRestAPIFactory().getRMSiteAPI().getSite().getId();
     
             // check if user exists
             UserModel user = new UserModel();
             user.setUsername(userName);
             user.setPassword(userName);
     
    -        if (!dataUser.isUserInRepo(userName))
    +        if (!getDataUser().isUserInRepo(userName))
             {
                 // user doesn't exist, create it
    -            user = dataUser.createUser(userName, userName);
    +            user = getDataUser().createUser(userName, userName);
                 user.setUserRole(userRole);
     
    -            dataUser.addUserToSite(user, new SiteModel(siteId), userRole);
    +            getDataUser().addUserToSite(user, new SiteModel(siteId), userRole);
             }
     
             return user;
    diff --git a/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/fileplancomponents/RecordCategoryTest.java b/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/fileplancomponents/RecordCategoryTest.java
    index 21b01f92a3..0b3722ddb2 100644
    --- a/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/fileplancomponents/RecordCategoryTest.java
    +++ b/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/fileplancomponents/RecordCategoryTest.java
    @@ -44,7 +44,7 @@ import static org.testng.Assert.fail;
     import java.util.ArrayList;
     import java.util.NoSuchElementException;
     
    -import org.alfresco.rest.rm.community.base.BaseRESTTest;
    +import org.alfresco.rest.rm.community.base.BaseRMRestTest;
     import org.alfresco.rest.rm.community.base.TestData;
     import org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponent;
     import org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentProperties;
    @@ -59,7 +59,7 @@ import org.testng.annotations.Test;
      * @author Tuna Aksoy
      * @since 2.6
      */
    -public class RecordCategoryTest extends BaseRESTTest
    +public class RecordCategoryTest extends BaseRMRestTest
     {
         // Number of children (for children creation test)
         private static final int NUMBER_OF_CHILDREN = 10;
    @@ -90,7 +90,7 @@ public class RecordCategoryTest extends BaseRESTTest
                 .build();
     
             // Create the record category
    -        FilePlanComponent filePlanComponent = getFilePlanComponentsAPI().createFilePlanComponent(recordCategory, FILE_PLAN_ALIAS);
    +        FilePlanComponent filePlanComponent = getRestAPIFactory().getFilePlanComponentsAPI().createFilePlanComponent(recordCategory, FILE_PLAN_ALIAS);
     
             // Verify the status code
             assertStatusCode(CREATED);
    @@ -139,7 +139,7 @@ public class RecordCategoryTest extends BaseRESTTest
                 .build();
     
             // Create the record category
    -        FilePlanComponent filePlanComponent = getFilePlanComponentsAPI().createFilePlanComponent(recordCategory, FILE_PLAN_ALIAS);
    +        FilePlanComponent filePlanComponent = getRestAPIFactory().getFilePlanComponentsAPI().createFilePlanComponent(recordCategory, FILE_PLAN_ALIAS);
     
             String newCategoryName = "Rename " + categoryName;
     
    @@ -147,7 +147,7 @@ public class RecordCategoryTest extends BaseRESTTest
             FilePlanComponent recordCategoryUpdated = FilePlanComponent.builder().name(newCategoryName).build();
     
             // Update the record category
    -        FilePlanComponent renamedFilePlanComponent = getFilePlanComponentsAPI().updateFilePlanComponent(recordCategoryUpdated, filePlanComponent.getId());
    +        FilePlanComponent renamedFilePlanComponent = getRestAPIFactory().getFilePlanComponentsAPI().updateFilePlanComponent(recordCategoryUpdated, filePlanComponent.getId());
     
             // Verify the status code
             assertStatusCode(OK);
    @@ -156,7 +156,7 @@ public class RecordCategoryTest extends BaseRESTTest
             assertEquals(renamedFilePlanComponent.getName(), newCategoryName);
     
             // Get actual FILE_PLAN_ALIAS id
    -        FilePlanComponent parentComponent = getFilePlanComponentsAPI().getFilePlanComponent(FILE_PLAN_ALIAS);
    +        FilePlanComponent parentComponent = getRestAPIFactory().getFilePlanComponentsAPI().getFilePlanComponent(FILE_PLAN_ALIAS);
     
             // verify renamed component still has this parent
             assertEquals(renamedFilePlanComponent.getParentId(), parentComponent.getId());
    @@ -189,16 +189,16 @@ public class RecordCategoryTest extends BaseRESTTest
                     .build();
     
             // Create the record category
    -        FilePlanComponent filePlanComponent = getFilePlanComponentsAPI().createFilePlanComponent(recordCategory, FILE_PLAN_ALIAS);
    +        FilePlanComponent filePlanComponent = getRestAPIFactory().getFilePlanComponentsAPI().createFilePlanComponent(recordCategory, FILE_PLAN_ALIAS);
     
             // Delete the record category
    -        getFilePlanComponentsAPI().deleteFilePlanComponent(filePlanComponent.getId());
    +        getRestAPIFactory().getFilePlanComponentsAPI().deleteFilePlanComponent(filePlanComponent.getId());
     
             // Verify the status code
             assertStatusCode(NO_CONTENT);
     
             // Deleted component should no longer be retrievable
    -        getFilePlanComponentsAPI().getFilePlanComponent(filePlanComponent.getId());
    +        getRestAPIFactory().getFilePlanComponentsAPI().getFilePlanComponent(filePlanComponent.getId());
             assertStatusCode(NOT_FOUND);
         }
     
    @@ -264,7 +264,7 @@ public class RecordCategoryTest extends BaseRESTTest
             }
     
             // List children from API
    -        FilePlanComponentsCollection apiChildren = getFilePlanComponentsAPI().listChildComponents(rootCategory.getId());
    +        FilePlanComponentsCollection apiChildren = getRestAPIFactory().getFilePlanComponentsAPI().listChildComponents(rootCategory.getId());
     
             // Check status code
             assertStatusCode(OK);
    @@ -352,7 +352,7 @@ public class RecordCategoryTest extends BaseRESTTest
                     .build();
     
             //create the invalid node type
    -        getFilePlanComponentsAPI().createFilePlanComponent(recordCategory, category.getId());
    +        getRestAPIFactory().getFilePlanComponentsAPI().createFilePlanComponent(recordCategory, category.getId());
             assertStatusCode(UNPROCESSABLE_ENTITY);
         }
     
    @@ -390,7 +390,7 @@ public class RecordCategoryTest extends BaseRESTTest
                             .build())
                     .build();
     
    -        FilePlanComponent filePlanComponent = getFilePlanComponentsAPI().createFilePlanComponent(component, parentComponentId);
    +        FilePlanComponent filePlanComponent = getRestAPIFactory().getFilePlanComponentsAPI().createFilePlanComponent(component, parentComponentId);
             assertStatusCode(CREATED);
     
             return filePlanComponent;
    diff --git a/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/fileplancomponents/RecordFolderTests.java b/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/fileplancomponents/RecordFolderTests.java
    index 22c85a2054..c154222ede 100644
    --- a/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/fileplancomponents/RecordFolderTests.java
    +++ b/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/fileplancomponents/RecordFolderTests.java
    @@ -49,7 +49,7 @@ import java.time.LocalDateTime;
     import java.util.ArrayList;
     import java.util.NoSuchElementException;
     
    -import org.alfresco.rest.rm.community.base.BaseRESTTest;
    +import org.alfresco.rest.rm.community.base.BaseRMRestTest;
     import org.alfresco.rest.rm.community.base.TestData;
     import org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponent;
     import org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentProperties;
    @@ -66,7 +66,7 @@ import org.testng.annotations.Test;
      * @author Rodica Sutu
      * @since 2.6
      */
    -public class RecordFolderTests extends BaseRESTTest
    +public class RecordFolderTests extends BaseRMRestTest
     {
         private static final int NUMBER_OF_FOLDERS = 5;
         /**
    @@ -94,7 +94,7 @@ public class RecordFolderTests extends BaseRESTTest
                     .build();
     
             // Create the record folder
    -        FilePlanComponent folder = getFilePlanComponentsAPI().createFilePlanComponent(recordFolder, filePlanComponent.getId());
    +        FilePlanComponent folder = getRestAPIFactory().getFilePlanComponentsAPI().createFilePlanComponent(recordFolder, filePlanComponent.getId());
     
             assertStatusCode(CREATED);
     
    @@ -128,7 +128,7 @@ public class RecordFolderTests extends BaseRESTTest
         @Bug(id="RM-4327")
         public void createFolderIntoSpecialContainers(String filePlanComponent) throws Exception
         {
    -        String componentID = getFilePlanComponentsAPI().getFilePlanComponent(filePlanComponent).getId();
    +        String componentID = getRestAPIFactory().getFilePlanComponentsAPI().getFilePlanComponent(filePlanComponent).getId();
     
             // Build the record category properties
             FilePlanComponent recordFolder = FilePlanComponent.builder()
    @@ -140,7 +140,7 @@ public class RecordFolderTests extends BaseRESTTest
                     .build();
     
             // Create a record folder
    -        getFilePlanComponentsAPI().createFilePlanComponent(recordFolder, componentID);
    +        getRestAPIFactory().getFilePlanComponentsAPI().createFilePlanComponent(recordFolder, componentID);
     
             // Check the API Response code
             assertStatusCode(UNPROCESSABLE_ENTITY);
    @@ -162,7 +162,7 @@ public class RecordFolderTests extends BaseRESTTest
             FilePlanComponent category = createCategory(FILE_PLAN_ALIAS, CATEGORY);
             FilePlanComponent folder = createFolder(category.getId(),FOLDER_NAME);
     
    -        FilePlanComponent folderDetails = getFilePlanComponentsAPI().getFilePlanComponent(folder.getId(), "include=" + IS_CLOSED);
    +        FilePlanComponent folderDetails = getRestAPIFactory().getFilePlanComponentsAPI().getFilePlanComponent(folder.getId(), "include=" + IS_CLOSED);
     
             // Verify the returned properties for the file plan component - record folder
             assertEquals(RECORD_FOLDER_TYPE, folderDetails.getNodeType());
    @@ -218,7 +218,7 @@ public class RecordFolderTests extends BaseRESTTest
                     .build();
     
             // Update the record category
    -        FilePlanComponent folderUpdated = getFilePlanComponentsAPI().updateFilePlanComponent(recordFolder, folder.getId());
    +        FilePlanComponent folderUpdated = getRestAPIFactory().getFilePlanComponentsAPI().updateFilePlanComponent(recordFolder, folder.getId());
     
             // Check the Response Status Code
             assertStatusCode(OK);
    @@ -254,12 +254,12 @@ public class RecordFolderTests extends BaseRESTTest
             FilePlanComponent folder = createFolder(category.getId(), FOLDER_NAME);
     
             // Delete the Record folder
    -        getFilePlanComponentsAPI().deleteFilePlanComponent(folder.getId());
    +        getRestAPIFactory().getFilePlanComponentsAPI().deleteFilePlanComponent(folder.getId());
             // Check the Response Status Code
             assertStatusCode(NO_CONTENT);
     
             // Check the File Plan Component is not found
    -        getFilePlanComponentsAPI().getFilePlanComponent(folder.getId());
    +        getRestAPIFactory().getFilePlanComponentsAPI().getFilePlanComponent(folder.getId());
             // Check the Response Status Code
             assertStatusCode(NOT_FOUND);
         }
    @@ -295,7 +295,7 @@ public class RecordFolderTests extends BaseRESTTest
             }
     
             // List children from API
    -        FilePlanComponentsCollection apiChildren = getFilePlanComponentsAPI().listChildComponents(category.getId());
    +        FilePlanComponentsCollection apiChildren = getRestAPIFactory().getFilePlanComponentsAPI().listChildComponents(category.getId());
     
             // Check status code
             assertStatusCode(OK);
    @@ -364,7 +364,7 @@ public class RecordFolderTests extends BaseRESTTest
                                                               .build();
     
             // Create the record folder
    -        FilePlanComponent folder = getFilePlanComponentsAPI().createFilePlanComponent(recordFolder, FILE_PLAN_ALIAS, "include=" + PATH);
    +        FilePlanComponent folder = getRestAPIFactory().getFilePlanComponentsAPI().createFilePlanComponent(recordFolder, FILE_PLAN_ALIAS, "include=" + PATH);
             //Check the API response code
             assertStatusCode(CREATED);
     
    @@ -376,10 +376,10 @@ public class RecordFolderTests extends BaseRESTTest
             //Check the path return contains the RELATIVE_PATH
             assertTrue(folder.getPath().getName().contains(relativePath));
             //check the parent is a category
    -        assertTrue(getFilePlanComponentsAPI().getFilePlanComponent(folder.getParentId()).getIsCategory());
    +        assertTrue(getRestAPIFactory().getFilePlanComponentsAPI().getFilePlanComponent(folder.getParentId()).getIsCategory());
     
             //check the created folder from the server
    -        folder = getFilePlanComponentsAPI().getFilePlanComponent(folder.getId(), "include=" + PATH);
    +        folder = getRestAPIFactory().getFilePlanComponentsAPI().getFilePlanComponent(folder.getId(), "include=" + PATH);
             //Check the API response code
             assertStatusCode(OK);
             // Verify the returned properties for the file plan component - record folder
    @@ -400,7 +400,7 @@ public class RecordFolderTests extends BaseRESTTest
                                                               .build();
     
             // Create the record folder
    -        FilePlanComponent folder2 = getFilePlanComponentsAPI().createFilePlanComponent(recordFolder2, FILE_PLAN_ALIAS, "include=" + PATH);
    +        FilePlanComponent folder2 = getRestAPIFactory().getFilePlanComponentsAPI().createFilePlanComponent(recordFolder2, FILE_PLAN_ALIAS, "include=" + PATH);
             //Check the API response code
             assertStatusCode(CREATED);
     
    @@ -412,10 +412,10 @@ public class RecordFolderTests extends BaseRESTTest
             assertTrue(folder2.getPath().getName().contains(NEW_RELATIVE_PATH));
     
             //check the parent is a category
    -        assertTrue(getFilePlanComponentsAPI().getFilePlanComponent(folder.getParentId()).getIsCategory());
    +        assertTrue(getRestAPIFactory().getFilePlanComponentsAPI().getFilePlanComponent(folder.getParentId()).getIsCategory());
     
             // Check the folder created on the server
    -        folder2 = getFilePlanComponentsAPI().getFilePlanComponent(folder2.getId(), "include=" + PATH);
    +        folder2 = getRestAPIFactory().getFilePlanComponentsAPI().getFilePlanComponent(folder2.getId(), "include=" + PATH);
             //Check the API response code
             assertStatusCode(OK);
     
    @@ -430,11 +430,11 @@ public class RecordFolderTests extends BaseRESTTest
         @AfterClass (alwaysRun = true)
         public void tearDown() throws Exception
         {
    -        getFilePlanComponentsAPI().listChildComponents(FILE_PLAN_ALIAS).getEntries().forEach(filePlanComponentEntry ->
    +        getRestAPIFactory().getFilePlanComponentsAPI().listChildComponents(FILE_PLAN_ALIAS).getEntries().forEach(filePlanComponentEntry ->
             {
                 try
                 {
    -                getFilePlanComponentsAPI().deleteFilePlanComponent(filePlanComponentEntry.getFilePlanComponentModel().getId());
    +                getRestAPIFactory().getFilePlanComponentsAPI().deleteFilePlanComponent(filePlanComponentEntry.getFilePlanComponentModel().getId());
                 }
                 catch (Exception e)
                 {
    diff --git a/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/fileplancomponents/UnfiledRecordsFolderTests.java b/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/fileplancomponents/UnfiledRecordsFolderTests.java
    index 24728c01cc..cb7f88ec48 100644
    --- a/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/fileplancomponents/UnfiledRecordsFolderTests.java
    +++ b/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/fileplancomponents/UnfiledRecordsFolderTests.java
    @@ -48,7 +48,7 @@ import static org.testng.Assert.assertTrue;
     import java.util.List;
     import java.util.stream.Collectors;
     
    -import org.alfresco.rest.rm.community.base.BaseRESTTest;
    +import org.alfresco.rest.rm.community.base.BaseRMRestTest;
     import org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponent;
     import org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentProperties;
     import org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentsCollection;
    @@ -61,7 +61,7 @@ import org.testng.annotations.Test;
      * @author Kristijan Conkas
      * @since 2.6
      */
    -public class UnfiledRecordsFolderTests extends BaseRESTTest
    +public class UnfiledRecordsFolderTests extends BaseRMRestTest
     {
         /** invalid root level types, at unfiled records root level these shouldn't be possible to create */
     
    @@ -104,7 +104,7 @@ public class UnfiledRecordsFolderTests extends BaseRESTTest
                                     .build())
                     .build();
     
    -        FilePlanComponent filePlanComponent = getFilePlanComponentsAPI().createFilePlanComponent(unfiledFolder, UNFILED_RECORDS_CONTAINER_ALIAS);
    +        FilePlanComponent filePlanComponent = getRestAPIFactory().getFilePlanComponentsAPI().createFilePlanComponent(unfiledFolder, UNFILED_RECORDS_CONTAINER_ALIAS);
     
             // Verify the status code
             assertStatusCode(CREATED);
    @@ -153,7 +153,7 @@ public class UnfiledRecordsFolderTests extends BaseRESTTest
     
             try
             {
    -            getFilePlanComponentsAPI().createFilePlanComponent(unfiledFolder, UNFILED_RECORDS_CONTAINER_ALIAS);
    +            getRestAPIFactory().getFilePlanComponentsAPI().createFilePlanComponent(unfiledFolder, UNFILED_RECORDS_CONTAINER_ALIAS);
             }
             catch (Exception error)
             {
    @@ -193,7 +193,7 @@ public class UnfiledRecordsFolderTests extends BaseRESTTest
                     .build();
     
             // Create it as a child of parentFolder
    -        FilePlanComponent childFolder = getFilePlanComponentsAPI().createFilePlanComponent(unfiledFolder, parentFolder.getId());
    +        FilePlanComponent childFolder = getRestAPIFactory().getFilePlanComponentsAPI().createFilePlanComponent(unfiledFolder, parentFolder.getId());
     
             // Verify the status code
             assertStatusCode(CREATED);
    @@ -217,7 +217,7 @@ public class UnfiledRecordsFolderTests extends BaseRESTTest
     
             // Does child's parent point to it?
             // Perform another call as our parentFolder had been executed before childFolder existed
    -        FilePlanComponentsCollection parentsChildren = getFilePlanComponentsAPI().listChildComponents(parentFolder.getId());
    +        FilePlanComponentsCollection parentsChildren = getRestAPIFactory().getFilePlanComponentsAPI().listChildComponents(parentFolder.getId());
             assertStatusCode(OK);
             List childIds = parentsChildren.getEntries()
                 .stream()
    @@ -258,12 +258,12 @@ public class UnfiledRecordsFolderTests extends BaseRESTTest
                 .build();
     
             // Update the unfiled records folder
    -        getFilePlanComponentsAPI().updateFilePlanComponent(folderToUpdate, folderToModify.getId());
    +        getRestAPIFactory().getFilePlanComponentsAPI().updateFilePlanComponent(folderToUpdate, folderToModify.getId());
             // Verify the status code
             assertStatusCode(OK);
     
             // This is to ensure the change was actually applied, rather than simply trusting the object returned by PUT
    -        FilePlanComponent renamedFolder = getFilePlanComponentsAPI().getFilePlanComponent(folderToModify.getId());
    +        FilePlanComponent renamedFolder = getRestAPIFactory().getFilePlanComponentsAPI().getFilePlanComponent(folderToModify.getId());
     
             // Verify the returned file plan component
             assertEquals(modified + folderToModify.getName(), renamedFolder.getName());
    @@ -288,13 +288,13 @@ public class UnfiledRecordsFolderTests extends BaseRESTTest
             assertEquals(folderName, folderToDelete.getName());
     
             // Delete folderToDelete
    -        getFilePlanComponentsAPI().deleteFilePlanComponent(folderToDelete.getId());
    +        getRestAPIFactory().getFilePlanComponentsAPI().deleteFilePlanComponent(folderToDelete.getId());
     
             // Verify the status code
             assertStatusCode(NO_CONTENT);
     
             // Deleted component should no longer be retrievable
    -        getFilePlanComponentsAPI().getFilePlanComponent(folderToDelete.getId());
    +        getRestAPIFactory().getFilePlanComponentsAPI().getFilePlanComponent(folderToDelete.getId());
             assertStatusCode(NOT_FOUND);
         }
     }
    diff --git a/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/site/RMSiteTests.java b/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/site/RMSiteTests.java
    index b3e7bbd365..fe0d63b0d6 100644
    --- a/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/site/RMSiteTests.java
    +++ b/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/site/RMSiteTests.java
    @@ -48,10 +48,9 @@ import static org.springframework.social.alfresco.api.entities.Site.Visibility.P
     import static org.testng.Assert.assertEquals;
     import static org.testng.Assert.assertNotNull;
     
    -import org.alfresco.rest.rm.community.base.BaseRESTTest;
    +import org.alfresco.rest.rm.community.base.BaseRMRestTest;
     import org.alfresco.rest.rm.community.model.site.RMSite;
     import org.alfresco.rest.rm.community.requests.igCoreAPI.RMUserAPI;
    -import org.alfresco.utility.data.DataUser;
     import org.alfresco.utility.data.RandomData;
     import org.alfresco.utility.model.UserModel;
     import org.alfresco.utility.report.Bug;
    @@ -65,11 +64,8 @@ import org.testng.annotations.Test;
      * @author Rodica Sutu
      * @since 2.6
      */
    -public class RMSiteTests extends BaseRESTTest
    +public class RMSiteTests extends BaseRMRestTest
     {
    -    @Autowired
    -    private DataUser dataUser;
    -
         @Autowired
         private RMUserAPI rmUserAPI;
     
    @@ -85,14 +81,14 @@ public class RMSiteTests extends BaseRESTTest
         public void createRMSiteAsAdminUser() throws Exception
         {
             // Check if the RM site exists
    -        if (getRMSiteAPI().existsRMSite())
    +        if (getRestAPIFactory().getRMSiteAPI().existsRMSite())
             {
                 // Delete the RM site
    -            getRMSiteAPI().deleteRMSite();
    +            getRestAPIFactory().getRMSiteAPI().deleteRMSite();
             }
     
             // Create the RM site
    -        RMSite rmSiteResponse = getRMSiteAPI().createRMSite(createStandardRMSiteModel());
    +        RMSite rmSiteResponse = getRestAPIFactory().getRMSiteAPI().createRMSite(createStandardRMSiteModel());
     
             // Verify the status code
             assertStatusCode(CREATED);
    @@ -126,7 +122,7 @@ public class RMSiteTests extends BaseRESTTest
     
             // Create the RM site
             RMSite rmSiteModel = createRMSiteModel(STANDARD, newTitle, newDescription);
    -        getRMSiteAPI().createRMSite(rmSiteModel);
    +        getRestAPIFactory().getRMSiteAPI().createRMSite(rmSiteModel);
     
             // Verify the status code
             assertStatusCode(CONFLICT);
    @@ -147,7 +143,7 @@ public class RMSiteTests extends BaseRESTTest
             createRMSiteIfNotExists();
     
             // Delete the RM site
    -        getRMSiteAPI().deleteRMSite();
    +        getRestAPIFactory().getRMSiteAPI().deleteRMSite();
     
             // Verify the status code
             assertStatusCode(NO_CONTENT);
    @@ -165,7 +161,7 @@ public class RMSiteTests extends BaseRESTTest
         public void getRMSite() throws Exception
         {
             // Check if RM site exists
    -        if (!getRMSiteAPI().existsRMSite())
    +        if (!getRestAPIFactory().getRMSiteAPI().existsRMSite())
             {
                 // Verify the status code when RM site  doesn't exist
                 assertStatusCode(NOT_FOUND);
    @@ -174,7 +170,7 @@ public class RMSiteTests extends BaseRESTTest
             else
             {
                 // Get the RM site
    -            RMSite rmSiteModel = getRMSiteAPI().getSite();
    +            RMSite rmSiteModel = getRestAPIFactory().getRMSiteAPI().getSite();
     
                 // Verify the status code
                 assertStatusCode(OK);
    @@ -198,17 +194,17 @@ public class RMSiteTests extends BaseRESTTest
         public void createRMSiteAsAnotherAdminUser() throws Exception
         {
             // Check if the RM site exists
    -        if (getRMSiteAPI().existsRMSite())
    +        if (getRestAPIFactory().getRMSiteAPI().existsRMSite())
             {
                 // Delete the RM site
    -            getRMSiteAPI().deleteRMSite();
    +            getRestAPIFactory().getRMSiteAPI().deleteRMSite();
             }
     
             // Create user
             rmUserAPI.createUser(ANOTHER_ADMIN);
     
             // Create the RM site
    -        RMSite rmSiteModel = getRMSiteAPI(new UserModel(ANOTHER_ADMIN, DEFAULT_PASSWORD)).createRMSite(createDOD5015RMSiteModel());
    +        RMSite rmSiteModel = getRestAPIFactory().getRMSiteAPI(new UserModel(ANOTHER_ADMIN, DEFAULT_PASSWORD)).createRMSite(createDOD5015RMSiteModel());
     
             // Verify the status code
             assertStatusCode(CREATED);
    @@ -244,13 +240,13 @@ public class RMSiteTests extends BaseRESTTest
             rmSiteToUpdate.setDescription(NEW_DESCRIPTION);
     
             // Create the RM site
    -        getRMSiteAPI(dataUser.createRandomTestUser("testUser")).updateRMSite(rmSiteToUpdate);
    +        getRestAPIFactory().getRMSiteAPI(getDataUser().createRandomTestUser("testUser")).updateRMSite(rmSiteToUpdate);
     
             // Verify the status code
             assertStatusCode(FORBIDDEN);
     
             // Update the RM Site
    -        RMSite rmSiteModel = getRMSiteAPI().updateRMSite(rmSiteToUpdate);
    +        RMSite rmSiteModel = getRestAPIFactory().getRMSiteAPI().updateRMSite(rmSiteToUpdate);
     
             // Verify the response status code
             assertStatusCode(OK);
    @@ -278,7 +274,7 @@ public class RMSiteTests extends BaseRESTTest
             RMSite rmSiteToUpdate = RMSite.builder().compliance(DOD5015).build();
     
             // Update the RM site
    -        getRMSiteAPI().updateRMSite(rmSiteToUpdate);
    +        getRestAPIFactory().getRMSiteAPI().updateRMSite(rmSiteToUpdate);
     
             // Verify the response status code
             assertStatusCode(BAD_REQUEST);
    
    From 62c9127455bd1e1b1ec7738d042681132118fea9 Mon Sep 17 00:00:00 2001
    From: Tuna Aksoy 
    Date: Wed, 28 Dec 2016 00:04:11 +0000
    Subject: [PATCH 7/9] RM-4488 (Refactor REST API Automation test code according
     to the latest changes)
    
    ---
     .../rm/community/base/BaseRMRestTest.java     |  7 +++--
     .../fileplancomponents/DeleteRecordTests.java | 17 +++++++----
     .../ElectronicRecordTests.java                | 11 ++++---
     .../fileplancomponents/FilePlanTests.java     | 16 ++++++----
     .../NonElectronicRecordTests.java             | 11 ++++---
     .../RecordCategoryTest.java                   | 15 ++++++----
     .../fileplancomponents/RecordFolderTests.java | 29 +++++++++++--------
     .../UnfiledRecordsFolderTests.java            | 16 ++++++----
     .../rest/rm/community/site/RMSiteTests.java   | 21 +++++++++-----
     9 files changed, 91 insertions(+), 52 deletions(-)
    
    diff --git a/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/base/BaseRMRestTest.java b/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/base/BaseRMRestTest.java
    index e912a8ec74..76b1876769 100644
    --- a/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/base/BaseRMRestTest.java
    +++ b/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/base/BaseRMRestTest.java
    @@ -43,6 +43,7 @@ import org.alfresco.rest.RestTest;
     import org.alfresco.rest.core.RestAPIFactory;
     import org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponent;
     import org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentProperties;
    +import org.alfresco.rest.rm.community.requests.igCoreAPI.RMSiteAPI;
     import org.alfresco.utility.data.DataUser;
     import org.alfresco.utility.model.UserModel;
     import org.springframework.beans.factory.annotation.Autowired;
    @@ -137,11 +138,13 @@ public class BaseRMRestTest extends RestTest
          */
         public void createRMSiteIfNotExists() throws Exception
         {
    +        RMSiteAPI rmSiteAPI = getRestAPIFactory().getRMSiteAPI();
    +
             // Check RM site doesn't exist
    -        if (!getRestAPIFactory().getRMSiteAPI().existsRMSite())
    +        if (!rmSiteAPI.existsRMSite())
             {
                 // Create the RM site
    -            getRestAPIFactory().getRMSiteAPI().createRMSite(createStandardRMSiteModel());
    +            rmSiteAPI.createRMSite(createStandardRMSiteModel());
     
                 // Verify the status code
                 assertStatusCode(CREATED);
    diff --git a/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/fileplancomponents/DeleteRecordTests.java b/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/fileplancomponents/DeleteRecordTests.java
    index 485b3fb3b5..a34e5862f1 100644
    --- a/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/fileplancomponents/DeleteRecordTests.java
    +++ b/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/fileplancomponents/DeleteRecordTests.java
    @@ -40,6 +40,7 @@ import org.alfresco.rest.rm.community.base.BaseRMRestTest;
     import org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponent;
     import org.alfresco.rest.rm.community.model.user.UserPermissions;
     import org.alfresco.rest.rm.community.model.user.UserRoles;
    +import org.alfresco.rest.rm.community.requests.igCoreAPI.FilePlanComponentAPI;
     import org.alfresco.rest.rm.community.requests.igCoreAPI.RMUserAPI;
     import org.alfresco.test.AlfrescoTest;
     import org.alfresco.utility.constants.UserRole;
    @@ -191,20 +192,22 @@ public class DeleteRecordTests extends BaseRMRestTest
     
             // grant deleteUser Filing privileges on randomFolder category, this will be
             // inherited to randomFolder
    -        rmUserAPI.addUserPermission(getRestAPIFactory().getFilePlanComponentsAPI().getFilePlanComponent(randomFolder.getParentId()),
    +        FilePlanComponentAPI filePlanComponentsAPIAsAdmin = getRestAPIFactory().getFilePlanComponentsAPI();
    +        rmUserAPI.addUserPermission(filePlanComponentsAPIAsAdmin.getFilePlanComponent(randomFolder.getParentId()),
                 deleteUser, UserPermissions.PERMISSION_FILING);
             rmUserAPI.usingRestWrapper().assertStatusCodeIs(OK);
     
             // create a non-electronic record in randomFolder
    -        FilePlanComponent newRecord = getRestAPIFactory().getFilePlanComponentsAPI().createFilePlanComponent(createNonElectronicRecordModel(), randomFolder.getId());
    +        FilePlanComponent newRecord = filePlanComponentsAPIAsAdmin.createFilePlanComponent(createNonElectronicRecordModel(), randomFolder.getId());
             assertStatusCode(CREATED);
     
             // verify the user can see the newRecord
    -        getRestAPIFactory().getFilePlanComponentsAPI(deleteUser).getFilePlanComponent(newRecord.getId());
    +        FilePlanComponentAPI filePlanComponentsAPIAsUser = getRestAPIFactory().getFilePlanComponentsAPI(deleteUser);
    +        filePlanComponentsAPIAsUser.getFilePlanComponent(newRecord.getId());
             assertStatusCode(OK);
     
             // try to delete newRecord
    -        getRestAPIFactory().getFilePlanComponentsAPI(deleteUser).deleteFilePlanComponent(newRecord.getId());
    +        filePlanComponentsAPIAsUser.deleteFilePlanComponent(newRecord.getId());
             assertStatusCode(FORBIDDEN);
         }
     
    @@ -215,12 +218,14 @@ public class DeleteRecordTests extends BaseRMRestTest
          */
         private void deleteAndVerify(FilePlanComponent record) throws Exception
         {
    +        FilePlanComponentAPI filePlanComponentsAPI = getRestAPIFactory().getFilePlanComponentsAPI();
    +
             // delete it and verify status
    -        getRestAPIFactory().getFilePlanComponentsAPI().deleteFilePlanComponent(record.getId());
    +        filePlanComponentsAPI.deleteFilePlanComponent(record.getId());
             assertStatusCode(NO_CONTENT);
     
             // try to get deleted file plan component
    -        getRestAPIFactory().getFilePlanComponentsAPI().getFilePlanComponent(record.getId());
    +        filePlanComponentsAPI.getFilePlanComponent(record.getId());
             assertStatusCode(NOT_FOUND);
         }
     }
    diff --git a/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/fileplancomponents/ElectronicRecordTests.java b/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/fileplancomponents/ElectronicRecordTests.java
    index 94381a217a..0c821589bc 100644
    --- a/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/fileplancomponents/ElectronicRecordTests.java
    +++ b/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/fileplancomponents/ElectronicRecordTests.java
    @@ -42,6 +42,7 @@ import static org.testng.Assert.assertTrue;
     
     import org.alfresco.rest.rm.community.base.BaseRMRestTest;
     import org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponent;
    +import org.alfresco.rest.rm.community.requests.igCoreAPI.FilePlanComponentAPI;
     import org.testng.annotations.DataProvider;
     import org.testng.annotations.Test;
     
    @@ -197,13 +198,14 @@ public class ElectronicRecordTests extends BaseRMRestTest
         public void canCreateElectronicRecordsInValidContainers(FilePlanComponent container) throws Exception
         {
             FilePlanComponent record = createElectronicRecordModel();
    -        String newRecordId = getRestAPIFactory().getFilePlanComponentsAPI().createElectronicRecord(record, IMAGE_FILE, container.getId()).getId();
    +        FilePlanComponentAPI filePlanComponentsAPI = getRestAPIFactory().getFilePlanComponentsAPI();
    +        String newRecordId = filePlanComponentsAPI.createElectronicRecord(record, IMAGE_FILE, container.getId()).getId();
     
             // verify the create request status code
             assertStatusCode(CREATED);
     
             // get newly created electronic record and verify its properties
    -        FilePlanComponent electronicRecord = getRestAPIFactory().getFilePlanComponentsAPI().getFilePlanComponent(newRecordId);
    +        FilePlanComponent electronicRecord = filePlanComponentsAPI.getFilePlanComponent(newRecordId);
             // created record will have record identifier inserted in its name but will be prefixed with
             // the name it was created as
             assertTrue(electronicRecord.getName().startsWith(record.getName()));
    @@ -227,13 +229,14 @@ public class ElectronicRecordTests extends BaseRMRestTest
                     .nodeType(CONTENT_TYPE)
                     .build();
     
    -        String newRecordId = getRestAPIFactory().getFilePlanComponentsAPI().createElectronicRecord(record, IMAGE_FILE, container.getId()).getId();
    +        FilePlanComponentAPI filePlanComponentsAPI = getRestAPIFactory().getFilePlanComponentsAPI();
    +        String newRecordId = filePlanComponentsAPI.createElectronicRecord(record, IMAGE_FILE, container.getId()).getId();
     
             // verify the create request status code
             assertStatusCode(CREATED);
     
             // get newly created electonic record and verify its properties
    -        FilePlanComponent electronicRecord = getRestAPIFactory().getFilePlanComponentsAPI().getFilePlanComponent(newRecordId);
    +        FilePlanComponent electronicRecord = filePlanComponentsAPI.getFilePlanComponent(newRecordId);
             // record will have record identifier inserted in its name but will for sure start with file name
             // and end with its extension
             assertTrue(electronicRecord.getName().startsWith(IMAGE_FILE.substring(0, IMAGE_FILE.indexOf("."))));
    diff --git a/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/fileplancomponents/FilePlanTests.java b/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/fileplancomponents/FilePlanTests.java
    index 2ed2d3715a..b2ed607bf7 100644
    --- a/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/fileplancomponents/FilePlanTests.java
    +++ b/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/fileplancomponents/FilePlanTests.java
    @@ -47,6 +47,8 @@ import org.alfresco.rest.rm.community.base.BaseRMRestTest;
     import org.alfresco.rest.rm.community.base.TestData;
     import org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponent;
     import org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentProperties;
    +import org.alfresco.rest.rm.community.requests.igCoreAPI.FilePlanComponentAPI;
    +import org.alfresco.rest.rm.community.requests.igCoreAPI.RMSiteAPI;
     import org.alfresco.utility.model.UserModel;
     import org.alfresco.utility.report.Bug;
     import org.testng.annotations.Test;
    @@ -73,11 +75,13 @@ public class FilePlanTests extends BaseRMRestTest
         )
         public void getFilePlanComponentWhenRMIsNotCreated(String filePlanComponentAlias) throws Exception
         {
    +        RMSiteAPI rmSiteAPI = getRestAPIFactory().getRMSiteAPI();
    +
             // Check RM Site Exist
    -        if (getRestAPIFactory().getRMSiteAPI().existsRMSite())
    +        if (rmSiteAPI.existsRMSite())
             {
                 // Delete RM Site
    -            getRestAPIFactory().getRMSiteAPI().deleteRMSite();
    +            rmSiteAPI.deleteRMSite();
             }
     
             // Get the file plan component
    @@ -264,16 +268,18 @@ public class FilePlanTests extends BaseRMRestTest
                                     .build())
                     .build();
     
    +        FilePlanComponentAPI filePlanComponentsAPI = getRestAPIFactory().getFilePlanComponentsAPI();
    +
             // Create the special containers into RM site - parent folder
    -        getRestAPIFactory().getFilePlanComponentsAPI().createFilePlanComponent(filePlanComponent, rmSiteId);
    +        filePlanComponentsAPI.createFilePlanComponent(filePlanComponent, rmSiteId);
             assertStatusCode(UNPROCESSABLE_ENTITY);
     
             // Create the special containers into RM site - parent folder
    -        getRestAPIFactory().getFilePlanComponentsAPI().createFilePlanComponent(filePlanComponent, FILE_PLAN_ALIAS);
    +        filePlanComponentsAPI.createFilePlanComponent(filePlanComponent, FILE_PLAN_ALIAS);
             assertStatusCode(UNPROCESSABLE_ENTITY);
     
             // Create the special containers into the root of special containers containers
    -        getRestAPIFactory().getFilePlanComponentsAPI().createFilePlanComponent(filePlanComponent, filePlanComponentAlias);
    +        filePlanComponentsAPI.createFilePlanComponent(filePlanComponent, filePlanComponentAlias);
             assertStatusCode(UNPROCESSABLE_ENTITY);
         }
     
    diff --git a/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/fileplancomponents/NonElectronicRecordTests.java b/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/fileplancomponents/NonElectronicRecordTests.java
    index 70c55c8ab7..0102e54eb9 100644
    --- a/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/fileplancomponents/NonElectronicRecordTests.java
    +++ b/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/fileplancomponents/NonElectronicRecordTests.java
    @@ -50,6 +50,7 @@ import java.util.Random;
     import org.alfresco.rest.rm.community.base.BaseRMRestTest;
     import org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponent;
     import org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentProperties;
    +import org.alfresco.rest.rm.community.requests.igCoreAPI.FilePlanComponentAPI;
     import org.alfresco.utility.constants.UserRole;
     import org.alfresco.utility.model.SiteModel;
     import org.alfresco.utility.model.UserModel;
    @@ -81,7 +82,8 @@ public class NonElectronicRecordTests extends BaseRMRestTest
                                                              .nodeType(RECORD_CATEGORY_TYPE)
                                                              .build();
     
    -        FilePlanComponent recordCategory = getRestAPIFactory().getFilePlanComponentsAPI().createFilePlanComponent(recordCategoryModel, FILE_PLAN_ALIAS);
    +        FilePlanComponentAPI filePlanComponentsAPI = getRestAPIFactory().getFilePlanComponentsAPI();
    +        FilePlanComponent recordCategory = filePlanComponentsAPI.createFilePlanComponent(recordCategoryModel, FILE_PLAN_ALIAS);
     
             // iterate through all invalid parent containers and try to create/file an electronic record
             asList(FILE_PLAN_ALIAS, TRANSFERS_ALIAS, HOLDS_ALIAS, recordCategory.getId())
    @@ -90,7 +92,7 @@ public class NonElectronicRecordTests extends BaseRMRestTest
                 {
                     try
                     {
    -                    getRestAPIFactory().getFilePlanComponentsAPI().createFilePlanComponent(createNonElectronicRecordModel(), id);
    +                    filePlanComponentsAPI.createFilePlanComponent(createNonElectronicRecordModel(), id);
                     }
                     catch (Exception error)
                     {
    @@ -162,7 +164,8 @@ public class NonElectronicRecordTests extends BaseRMRestTest
                                                                .build();
     
             // create non-electronic record
    -        String nonElectronicId = getRestAPIFactory().getFilePlanComponentsAPI().createFilePlanComponent(
    +        FilePlanComponentAPI filePlanComponentsAPI = getRestAPIFactory().getFilePlanComponentsAPI();
    +        String nonElectronicId = filePlanComponentsAPI.createFilePlanComponent(
                 filePlanComponent,
                 container.getId()).getId();
     
    @@ -170,7 +173,7 @@ public class NonElectronicRecordTests extends BaseRMRestTest
             assertStatusCode(CREATED);
     
             // get newly created non-electonic record and verify its properties
    -        FilePlanComponent nonElectronicRecord = getRestAPIFactory().getFilePlanComponentsAPI().getFilePlanComponent(nonElectronicId);
    +        FilePlanComponent nonElectronicRecord = filePlanComponentsAPI.getFilePlanComponent(nonElectronicId);
     
             assertEquals(title, nonElectronicRecord.getProperties().getTitle());
             assertEquals(description, nonElectronicRecord.getProperties().getDescription());
    diff --git a/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/fileplancomponents/RecordCategoryTest.java b/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/fileplancomponents/RecordCategoryTest.java
    index 0b3722ddb2..a92848a54c 100644
    --- a/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/fileplancomponents/RecordCategoryTest.java
    +++ b/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/fileplancomponents/RecordCategoryTest.java
    @@ -49,6 +49,7 @@ import org.alfresco.rest.rm.community.base.TestData;
     import org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponent;
     import org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentProperties;
     import org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentsCollection;
    +import org.alfresco.rest.rm.community.requests.igCoreAPI.FilePlanComponentAPI;
     import org.alfresco.utility.report.Bug;
     import org.testng.annotations.Test;
     
    @@ -139,7 +140,8 @@ public class RecordCategoryTest extends BaseRMRestTest
                 .build();
     
             // Create the record category
    -        FilePlanComponent filePlanComponent = getRestAPIFactory().getFilePlanComponentsAPI().createFilePlanComponent(recordCategory, FILE_PLAN_ALIAS);
    +        FilePlanComponentAPI filePlanComponentsAPI = getRestAPIFactory().getFilePlanComponentsAPI();
    +        FilePlanComponent filePlanComponent = filePlanComponentsAPI.createFilePlanComponent(recordCategory, FILE_PLAN_ALIAS);
     
             String newCategoryName = "Rename " + categoryName;
     
    @@ -147,7 +149,7 @@ public class RecordCategoryTest extends BaseRMRestTest
             FilePlanComponent recordCategoryUpdated = FilePlanComponent.builder().name(newCategoryName).build();
     
             // Update the record category
    -        FilePlanComponent renamedFilePlanComponent = getRestAPIFactory().getFilePlanComponentsAPI().updateFilePlanComponent(recordCategoryUpdated, filePlanComponent.getId());
    +        FilePlanComponent renamedFilePlanComponent = filePlanComponentsAPI.updateFilePlanComponent(recordCategoryUpdated, filePlanComponent.getId());
     
             // Verify the status code
             assertStatusCode(OK);
    @@ -156,7 +158,7 @@ public class RecordCategoryTest extends BaseRMRestTest
             assertEquals(renamedFilePlanComponent.getName(), newCategoryName);
     
             // Get actual FILE_PLAN_ALIAS id
    -        FilePlanComponent parentComponent = getRestAPIFactory().getFilePlanComponentsAPI().getFilePlanComponent(FILE_PLAN_ALIAS);
    +        FilePlanComponent parentComponent = filePlanComponentsAPI.getFilePlanComponent(FILE_PLAN_ALIAS);
     
             // verify renamed component still has this parent
             assertEquals(renamedFilePlanComponent.getParentId(), parentComponent.getId());
    @@ -189,16 +191,17 @@ public class RecordCategoryTest extends BaseRMRestTest
                     .build();
     
             // Create the record category
    -        FilePlanComponent filePlanComponent = getRestAPIFactory().getFilePlanComponentsAPI().createFilePlanComponent(recordCategory, FILE_PLAN_ALIAS);
    +        FilePlanComponentAPI filePlanComponentsAPI = getRestAPIFactory().getFilePlanComponentsAPI();
    +        FilePlanComponent filePlanComponent = filePlanComponentsAPI.createFilePlanComponent(recordCategory, FILE_PLAN_ALIAS);
     
             // Delete the record category
    -        getRestAPIFactory().getFilePlanComponentsAPI().deleteFilePlanComponent(filePlanComponent.getId());
    +        filePlanComponentsAPI.deleteFilePlanComponent(filePlanComponent.getId());
     
             // Verify the status code
             assertStatusCode(NO_CONTENT);
     
             // Deleted component should no longer be retrievable
    -        getRestAPIFactory().getFilePlanComponentsAPI().getFilePlanComponent(filePlanComponent.getId());
    +        filePlanComponentsAPI.getFilePlanComponent(filePlanComponent.getId());
             assertStatusCode(NOT_FOUND);
         }
     
    diff --git a/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/fileplancomponents/RecordFolderTests.java b/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/fileplancomponents/RecordFolderTests.java
    index c154222ede..9582c107d0 100644
    --- a/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/fileplancomponents/RecordFolderTests.java
    +++ b/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/fileplancomponents/RecordFolderTests.java
    @@ -55,6 +55,7 @@ import org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponent
     import org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentProperties;
     import org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentReviewPeriod;
     import org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentsCollection;
    +import org.alfresco.rest.rm.community.requests.igCoreAPI.FilePlanComponentAPI;
     import org.alfresco.utility.report.Bug;
     import org.testng.annotations.AfterClass;
     import org.testng.annotations.Test;
    @@ -128,7 +129,8 @@ public class RecordFolderTests extends BaseRMRestTest
         @Bug(id="RM-4327")
         public void createFolderIntoSpecialContainers(String filePlanComponent) throws Exception
         {
    -        String componentID = getRestAPIFactory().getFilePlanComponentsAPI().getFilePlanComponent(filePlanComponent).getId();
    +        FilePlanComponentAPI filePlanComponentsAPI = getRestAPIFactory().getFilePlanComponentsAPI();
    +        String componentID = filePlanComponentsAPI.getFilePlanComponent(filePlanComponent).getId();
     
             // Build the record category properties
             FilePlanComponent recordFolder = FilePlanComponent.builder()
    @@ -140,7 +142,7 @@ public class RecordFolderTests extends BaseRMRestTest
                     .build();
     
             // Create a record folder
    -        getRestAPIFactory().getFilePlanComponentsAPI().createFilePlanComponent(recordFolder, componentID);
    +        filePlanComponentsAPI.createFilePlanComponent(recordFolder, componentID);
     
             // Check the API Response code
             assertStatusCode(UNPROCESSABLE_ENTITY);
    @@ -254,12 +256,13 @@ public class RecordFolderTests extends BaseRMRestTest
             FilePlanComponent folder = createFolder(category.getId(), FOLDER_NAME);
     
             // Delete the Record folder
    -        getRestAPIFactory().getFilePlanComponentsAPI().deleteFilePlanComponent(folder.getId());
    +        FilePlanComponentAPI filePlanComponentsAPI = getRestAPIFactory().getFilePlanComponentsAPI();
    +        filePlanComponentsAPI.deleteFilePlanComponent(folder.getId());
             // Check the Response Status Code
             assertStatusCode(NO_CONTENT);
     
             // Check the File Plan Component is not found
    -        getRestAPIFactory().getFilePlanComponentsAPI().getFilePlanComponent(folder.getId());
    +        filePlanComponentsAPI.getFilePlanComponent(folder.getId());
             // Check the Response Status Code
             assertStatusCode(NOT_FOUND);
         }
    @@ -364,7 +367,8 @@ public class RecordFolderTests extends BaseRMRestTest
                                                               .build();
     
             // Create the record folder
    -        FilePlanComponent folder = getRestAPIFactory().getFilePlanComponentsAPI().createFilePlanComponent(recordFolder, FILE_PLAN_ALIAS, "include=" + PATH);
    +        FilePlanComponentAPI filePlanComponentsAPI = getRestAPIFactory().getFilePlanComponentsAPI();
    +        FilePlanComponent folder = filePlanComponentsAPI.createFilePlanComponent(recordFolder, FILE_PLAN_ALIAS, "include=" + PATH);
             //Check the API response code
             assertStatusCode(CREATED);
     
    @@ -376,10 +380,10 @@ public class RecordFolderTests extends BaseRMRestTest
             //Check the path return contains the RELATIVE_PATH
             assertTrue(folder.getPath().getName().contains(relativePath));
             //check the parent is a category
    -        assertTrue(getRestAPIFactory().getFilePlanComponentsAPI().getFilePlanComponent(folder.getParentId()).getIsCategory());
    +        assertTrue(filePlanComponentsAPI.getFilePlanComponent(folder.getParentId()).getIsCategory());
     
             //check the created folder from the server
    -        folder = getRestAPIFactory().getFilePlanComponentsAPI().getFilePlanComponent(folder.getId(), "include=" + PATH);
    +        folder = filePlanComponentsAPI.getFilePlanComponent(folder.getId(), "include=" + PATH);
             //Check the API response code
             assertStatusCode(OK);
             // Verify the returned properties for the file plan component - record folder
    @@ -400,7 +404,7 @@ public class RecordFolderTests extends BaseRMRestTest
                                                               .build();
     
             // Create the record folder
    -        FilePlanComponent folder2 = getRestAPIFactory().getFilePlanComponentsAPI().createFilePlanComponent(recordFolder2, FILE_PLAN_ALIAS, "include=" + PATH);
    +        FilePlanComponent folder2 = filePlanComponentsAPI.createFilePlanComponent(recordFolder2, FILE_PLAN_ALIAS, "include=" + PATH);
             //Check the API response code
             assertStatusCode(CREATED);
     
    @@ -412,10 +416,10 @@ public class RecordFolderTests extends BaseRMRestTest
             assertTrue(folder2.getPath().getName().contains(NEW_RELATIVE_PATH));
     
             //check the parent is a category
    -        assertTrue(getRestAPIFactory().getFilePlanComponentsAPI().getFilePlanComponent(folder.getParentId()).getIsCategory());
    +        assertTrue(filePlanComponentsAPI.getFilePlanComponent(folder.getParentId()).getIsCategory());
     
             // Check the folder created on the server
    -        folder2 = getRestAPIFactory().getFilePlanComponentsAPI().getFilePlanComponent(folder2.getId(), "include=" + PATH);
    +        folder2 = filePlanComponentsAPI.getFilePlanComponent(folder2.getId(), "include=" + PATH);
             //Check the API response code
             assertStatusCode(OK);
     
    @@ -430,11 +434,12 @@ public class RecordFolderTests extends BaseRMRestTest
         @AfterClass (alwaysRun = true)
         public void tearDown() throws Exception
         {
    -        getRestAPIFactory().getFilePlanComponentsAPI().listChildComponents(FILE_PLAN_ALIAS).getEntries().forEach(filePlanComponentEntry ->
    +        FilePlanComponentAPI filePlanComponentsAPI = getRestAPIFactory().getFilePlanComponentsAPI();
    +        filePlanComponentsAPI.listChildComponents(FILE_PLAN_ALIAS).getEntries().forEach(filePlanComponentEntry ->
             {
                 try
                 {
    -                getRestAPIFactory().getFilePlanComponentsAPI().deleteFilePlanComponent(filePlanComponentEntry.getFilePlanComponentModel().getId());
    +                filePlanComponentsAPI.deleteFilePlanComponent(filePlanComponentEntry.getFilePlanComponentModel().getId());
                 }
                 catch (Exception e)
                 {
    diff --git a/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/fileplancomponents/UnfiledRecordsFolderTests.java b/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/fileplancomponents/UnfiledRecordsFolderTests.java
    index cb7f88ec48..8add76b6da 100644
    --- a/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/fileplancomponents/UnfiledRecordsFolderTests.java
    +++ b/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/fileplancomponents/UnfiledRecordsFolderTests.java
    @@ -52,6 +52,7 @@ import org.alfresco.rest.rm.community.base.BaseRMRestTest;
     import org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponent;
     import org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentProperties;
     import org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentsCollection;
    +import org.alfresco.rest.rm.community.requests.igCoreAPI.FilePlanComponentAPI;
     import org.testng.annotations.DataProvider;
     import org.testng.annotations.Test;
     
    @@ -193,7 +194,8 @@ public class UnfiledRecordsFolderTests extends BaseRMRestTest
                     .build();
     
             // Create it as a child of parentFolder
    -        FilePlanComponent childFolder = getRestAPIFactory().getFilePlanComponentsAPI().createFilePlanComponent(unfiledFolder, parentFolder.getId());
    +        FilePlanComponentAPI filePlanComponentsAPI = getRestAPIFactory().getFilePlanComponentsAPI();
    +        FilePlanComponent childFolder = filePlanComponentsAPI.createFilePlanComponent(unfiledFolder, parentFolder.getId());
     
             // Verify the status code
             assertStatusCode(CREATED);
    @@ -217,7 +219,7 @@ public class UnfiledRecordsFolderTests extends BaseRMRestTest
     
             // Does child's parent point to it?
             // Perform another call as our parentFolder had been executed before childFolder existed
    -        FilePlanComponentsCollection parentsChildren = getRestAPIFactory().getFilePlanComponentsAPI().listChildComponents(parentFolder.getId());
    +        FilePlanComponentsCollection parentsChildren = filePlanComponentsAPI.listChildComponents(parentFolder.getId());
             assertStatusCode(OK);
             List childIds = parentsChildren.getEntries()
                 .stream()
    @@ -258,12 +260,13 @@ public class UnfiledRecordsFolderTests extends BaseRMRestTest
                 .build();
     
             // Update the unfiled records folder
    -        getRestAPIFactory().getFilePlanComponentsAPI().updateFilePlanComponent(folderToUpdate, folderToModify.getId());
    +        FilePlanComponentAPI filePlanComponentsAPI = getRestAPIFactory().getFilePlanComponentsAPI();
    +        filePlanComponentsAPI.updateFilePlanComponent(folderToUpdate, folderToModify.getId());
             // Verify the status code
             assertStatusCode(OK);
     
             // This is to ensure the change was actually applied, rather than simply trusting the object returned by PUT
    -        FilePlanComponent renamedFolder = getRestAPIFactory().getFilePlanComponentsAPI().getFilePlanComponent(folderToModify.getId());
    +        FilePlanComponent renamedFolder = filePlanComponentsAPI.getFilePlanComponent(folderToModify.getId());
     
             // Verify the returned file plan component
             assertEquals(modified + folderToModify.getName(), renamedFolder.getName());
    @@ -288,13 +291,14 @@ public class UnfiledRecordsFolderTests extends BaseRMRestTest
             assertEquals(folderName, folderToDelete.getName());
     
             // Delete folderToDelete
    -        getRestAPIFactory().getFilePlanComponentsAPI().deleteFilePlanComponent(folderToDelete.getId());
    +        FilePlanComponentAPI filePlanComponentsAPI = getRestAPIFactory().getFilePlanComponentsAPI();
    +        filePlanComponentsAPI.deleteFilePlanComponent(folderToDelete.getId());
     
             // Verify the status code
             assertStatusCode(NO_CONTENT);
     
             // Deleted component should no longer be retrievable
    -        getRestAPIFactory().getFilePlanComponentsAPI().getFilePlanComponent(folderToDelete.getId());
    +        filePlanComponentsAPI.getFilePlanComponent(folderToDelete.getId());
             assertStatusCode(NOT_FOUND);
         }
     }
    diff --git a/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/site/RMSiteTests.java b/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/site/RMSiteTests.java
    index fe0d63b0d6..efb63805ec 100644
    --- a/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/site/RMSiteTests.java
    +++ b/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/site/RMSiteTests.java
    @@ -50,6 +50,7 @@ import static org.testng.Assert.assertNotNull;
     
     import org.alfresco.rest.rm.community.base.BaseRMRestTest;
     import org.alfresco.rest.rm.community.model.site.RMSite;
    +import org.alfresco.rest.rm.community.requests.igCoreAPI.RMSiteAPI;
     import org.alfresco.rest.rm.community.requests.igCoreAPI.RMUserAPI;
     import org.alfresco.utility.data.RandomData;
     import org.alfresco.utility.model.UserModel;
    @@ -80,15 +81,17 @@ public class RMSiteTests extends BaseRMRestTest
         )
         public void createRMSiteAsAdminUser() throws Exception
         {
    +        RMSiteAPI rmSiteAPI = getRestAPIFactory().getRMSiteAPI();
    +
             // Check if the RM site exists
    -        if (getRestAPIFactory().getRMSiteAPI().existsRMSite())
    +        if (rmSiteAPI.existsRMSite())
             {
                 // Delete the RM site
    -            getRestAPIFactory().getRMSiteAPI().deleteRMSite();
    +            rmSiteAPI.deleteRMSite();
             }
     
             // Create the RM site
    -        RMSite rmSiteResponse = getRestAPIFactory().getRMSiteAPI().createRMSite(createStandardRMSiteModel());
    +        RMSite rmSiteResponse = rmSiteAPI.createRMSite(createStandardRMSiteModel());
     
             // Verify the status code
             assertStatusCode(CREATED);
    @@ -160,8 +163,10 @@ public class RMSiteTests extends BaseRMRestTest
         )
         public void getRMSite() throws Exception
         {
    +        RMSiteAPI rmSiteAPI = getRestAPIFactory().getRMSiteAPI();
    +
             // Check if RM site exists
    -        if (!getRestAPIFactory().getRMSiteAPI().existsRMSite())
    +        if (!rmSiteAPI.existsRMSite())
             {
                 // Verify the status code when RM site  doesn't exist
                 assertStatusCode(NOT_FOUND);
    @@ -170,7 +175,7 @@ public class RMSiteTests extends BaseRMRestTest
             else
             {
                 // Get the RM site
    -            RMSite rmSiteModel = getRestAPIFactory().getRMSiteAPI().getSite();
    +            RMSite rmSiteModel = rmSiteAPI.getSite();
     
                 // Verify the status code
                 assertStatusCode(OK);
    @@ -193,11 +198,13 @@ public class RMSiteTests extends BaseRMRestTest
         @Bug (id="RM-4289")
         public void createRMSiteAsAnotherAdminUser() throws Exception
         {
    +        RMSiteAPI rmSiteAPI = getRestAPIFactory().getRMSiteAPI();
    +
             // Check if the RM site exists
    -        if (getRestAPIFactory().getRMSiteAPI().existsRMSite())
    +        if (rmSiteAPI.existsRMSite())
             {
                 // Delete the RM site
    -            getRestAPIFactory().getRMSiteAPI().deleteRMSite();
    +            rmSiteAPI.deleteRMSite();
             }
     
             // Create user
    
    From 065bc48356978eafbb45dba3fd2eb1f6c1b06b3d Mon Sep 17 00:00:00 2001
    From: Tuna Aksoy 
    Date: Sun, 1 Jan 2017 13:49:08 +0000
    Subject: [PATCH 8/9] RM-4488 (Refactor REST API Automation test code according
     to the latest changes)
    
    ---
     .../main/java/org/alfresco/rest/core/RMRestProperties.java    | 2 +-
     .../src/main/java/org/alfresco/rest/core/RMRestWrapper.java   | 2 +-
     .../src/main/java/org/alfresco/rest/core/RestAPIFactory.java  | 2 +-
     .../fileplancomponents/FilePlanComponentReviewPeriod.java     | 2 +-
     .../alfresco/rest/rm/community/requests/RMModelRequest.java   | 2 +-
     .../rm/community/requests/igCoreAPI/FilePlanComponentAPI.java | 2 +-
     .../rest/rm/community/requests/igCoreAPI/RMSiteAPI.java       | 2 +-
     .../rest/rm/community/requests/igCoreAPI/RMUserAPI.java       | 2 +-
     .../rest/rm/community/requests/igCoreAPI/RestIGCoreAPI.java   | 2 +-
     .../org/alfresco/rest/rm/community/base/BaseRMRestTest.java   | 4 ++--
     .../rest/rm/community/utils/FilePlanComponentsUtil.java       | 2 +-
     .../java/org/alfresco/rest/rm/community/utils/RMSiteUtil.java | 2 +-
     12 files changed, 13 insertions(+), 13 deletions(-)
    
    diff --git a/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/core/RMRestProperties.java b/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/core/RMRestProperties.java
    index 76bf64ef60..b76699e7c0 100644
    --- a/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/core/RMRestProperties.java
    +++ b/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/core/RMRestProperties.java
    @@ -2,7 +2,7 @@
      * #%L
      * Alfresco Records Management Module
      * %%
    - * Copyright (C) 2005 - 2016 Alfresco Software Limited
    + * Copyright (C) 2005 - 2017 Alfresco Software Limited
      * %%
      * This file is part of the Alfresco software.
      * -
    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 fd6f3aa96f..706efef8d7 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
    @@ -2,7 +2,7 @@
      * #%L
      * Alfresco Records Management Module
      * %%
    - * Copyright (C) 2005 - 2016 Alfresco Software Limited
    + * Copyright (C) 2005 - 2017 Alfresco Software Limited
      * %%
      * This file is part of the Alfresco software.
      * -
    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 9c6f1ddd12..99ff7b30ab 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
    @@ -2,7 +2,7 @@
      * #%L
      * Alfresco Records Management Module
      * %%
    - * Copyright (C) 2005 - 2016 Alfresco Software Limited
    + * Copyright (C) 2005 - 2017 Alfresco Software Limited
      * %%
      * This file is part of the Alfresco software.
      * -
    diff --git a/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/model/fileplancomponents/FilePlanComponentReviewPeriod.java b/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/model/fileplancomponents/FilePlanComponentReviewPeriod.java
    index 73e00c105e..1b466cf071 100644
    --- a/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/model/fileplancomponents/FilePlanComponentReviewPeriod.java
    +++ b/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/model/fileplancomponents/FilePlanComponentReviewPeriod.java
    @@ -2,7 +2,7 @@
      * #%L
      * Alfresco Records Management Module
      * %%
    - * Copyright (C) 2005 - 2016 Alfresco Software Limited
    + * Copyright (C) 2005 - 2017 Alfresco Software Limited
      * %%
      * This file is part of the Alfresco software.
      * -
    diff --git a/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/requests/RMModelRequest.java b/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/requests/RMModelRequest.java
    index 5dc5424c79..5f05822e3e 100644
    --- a/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/requests/RMModelRequest.java
    +++ b/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/requests/RMModelRequest.java
    @@ -2,7 +2,7 @@
      * #%L
      * Alfresco Records Management Module
      * %%
    - * Copyright (C) 2005 - 2016 Alfresco Software Limited
    + * Copyright (C) 2005 - 2017 Alfresco Software Limited
      * %%
      * This file is part of the Alfresco software.
      * -
    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 11e4e978ac..362a9a2c14 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
    @@ -2,7 +2,7 @@
      * #%L
      * Alfresco Records Management Module
      * %%
    - * Copyright (C) 2005 - 2016 Alfresco Software Limited
    + * Copyright (C) 2005 - 2017 Alfresco Software Limited
      * %%
      * This file is part of the Alfresco software.
      * -
    diff --git a/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/requests/igCoreAPI/RMSiteAPI.java b/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/requests/igCoreAPI/RMSiteAPI.java
    index d4c5d18b26..0b7ef5e80d 100644
    --- a/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/requests/igCoreAPI/RMSiteAPI.java
    +++ b/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/requests/igCoreAPI/RMSiteAPI.java
    @@ -2,7 +2,7 @@
      * #%L
      * Alfresco Records Management Module
      * %%
    - * Copyright (C) 2005 - 2016 Alfresco Software Limited
    + * Copyright (C) 2005 - 2017 Alfresco Software Limited
      * %%
      * This file is part of the Alfresco software.
      * -
    diff --git a/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/requests/igCoreAPI/RMUserAPI.java b/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/requests/igCoreAPI/RMUserAPI.java
    index b7853877e3..c03639c4ef 100644
    --- a/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/requests/igCoreAPI/RMUserAPI.java
    +++ b/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/requests/igCoreAPI/RMUserAPI.java
    @@ -2,7 +2,7 @@
      * #%L
      * Alfresco Records Management Module
      * %%
    - * Copyright (C) 2005 - 2016 Alfresco Software Limited
    + * Copyright (C) 2005 - 2017 Alfresco Software Limited
      * %%
      * This file is part of the Alfresco software.
      * -
    diff --git a/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/requests/igCoreAPI/RestIGCoreAPI.java b/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/requests/igCoreAPI/RestIGCoreAPI.java
    index c5d700874b..336933e39a 100644
    --- a/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/requests/igCoreAPI/RestIGCoreAPI.java
    +++ b/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/requests/igCoreAPI/RestIGCoreAPI.java
    @@ -2,7 +2,7 @@
      * #%L
      * Alfresco Records Management Module
      * %%
    - * Copyright (C) 2005 - 2016 Alfresco Software Limited
    + * Copyright (C) 2005 - 2017 Alfresco Software Limited
      * %%
      * This file is part of the Alfresco software.
      * -
    diff --git a/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/base/BaseRMRestTest.java b/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/base/BaseRMRestTest.java
    index 76b1876769..236becb388 100644
    --- a/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/base/BaseRMRestTest.java
    +++ b/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/base/BaseRMRestTest.java
    @@ -2,7 +2,7 @@
      * #%L
      * Alfresco Records Management Module
      * %%
    - * Copyright (C) 2005 - 2016 Alfresco Software Limited
    + * Copyright (C) 2005 - 2017 Alfresco Software Limited
      * %%
      * This file is part of the Alfresco software.
      * -
    @@ -325,4 +325,4 @@ public class BaseRMRestTest extends RestTest
         {
             return getFilePlanComponentAsUser(getAdminUser(), componentId);
         }
    -}
    \ No newline at end of file
    +}
    diff --git a/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/utils/FilePlanComponentsUtil.java b/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/utils/FilePlanComponentsUtil.java
    index a4836c35ab..7f34a2d42e 100644
    --- a/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/utils/FilePlanComponentsUtil.java
    +++ b/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/utils/FilePlanComponentsUtil.java
    @@ -2,7 +2,7 @@
      * #%L
      * Alfresco Records Management Module
      * %%
    - * Copyright (C) 2005 - 2016 Alfresco Software Limited
    + * Copyright (C) 2005 - 2017 Alfresco Software Limited
      * %%
      * This file is part of the Alfresco software.
      * -
    diff --git a/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/utils/RMSiteUtil.java b/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/utils/RMSiteUtil.java
    index a0af49602f..b484748d7f 100644
    --- a/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/utils/RMSiteUtil.java
    +++ b/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/utils/RMSiteUtil.java
    @@ -2,7 +2,7 @@
      * #%L
      * Alfresco Records Management Module
      * %%
    - * Copyright (C) 2005 - 2016 Alfresco Software Limited
    + * Copyright (C) 2005 - 2017 Alfresco Software Limited
      * %%
      * This file is part of the Alfresco software.
      * -
    
    From 55761a5e16e0b3f130b800d0b31e5dcfd1700635 Mon Sep 17 00:00:00 2001
    From: Tuna Aksoy 
    Date: Sun, 1 Jan 2017 23:15:26 +0000
    Subject: [PATCH 9/9] Java doc updated
    
    ---
     .../rest/rm/community/base/BaseRMRestTest.java   | 16 ++++++++--------
     1 file changed, 8 insertions(+), 8 deletions(-)
    
    diff --git a/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/base/BaseRMRestTest.java b/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/base/BaseRMRestTest.java
    index 236becb388..61c0be5025 100644
    --- a/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/base/BaseRMRestTest.java
    +++ b/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/base/BaseRMRestTest.java
    @@ -67,9 +67,9 @@ public class BaseRMRestTest extends RestTest
         private DataUser dataUser;
     
         /**
    -     * FIXME!!!
    +     * Gets the REST API Factory
          *
    -     * @return the restAPIFactory FIXME!!!
    +     * @return the restAPIFactory The REST API Factory
          */
         protected RestAPIFactory getRestAPIFactory()
         {
    @@ -77,9 +77,9 @@ public class BaseRMRestTest extends RestTest
         }
     
         /**
    -     * FIXME!!!
    +     * Gets the data user
          *
    -     * @return the dataUser FIXME!!!
    +     * @return the dataUser The data user
          */
         protected DataUser getDataUser()
         {
    @@ -87,9 +87,9 @@ public class BaseRMRestTest extends RestTest
         }
     
         /**
    -     * FIXME!!!
    +     * Asserts the given status code
          *
    -     * @param created FIXME!!!
    +     * @param statusCode The status code to assert
          */
         protected void assertStatusCode(HttpStatus statusCode)
         {
    @@ -97,9 +97,9 @@ public class BaseRMRestTest extends RestTest
         }
     
         /**
    -     * FIXME!!!
    +     * Gets the admin user
          *
    -     * @return FIXME!!!
    +     * @return The admin user
          */
         protected UserModel getAdminUser()
         {