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); }