properties, String categoryName, String folderName)
- {
- String recordName = properties.get(RMProperty.NAME);
- if (getRecord(username, password, folderName, recordName) != null)
- {
- return null;
- }
- String recordPath = "/" + categoryName;
- if (!folderName.equals(""))
- {
- recordPath = recordPath + "/" + folderName;
- }
- // if the record already exists don't try to create it again
- CmisObject record = getObjectByPath(username, password, getFilePlanPath() + recordPath + "/" + recordName);
-
- if (record != null)
- {
- return null;
- }
- // non-electronic properties
- String recordTitle = getPropertyValue(properties, RMProperty.TITLE);
- String description = getPropertyValue(properties, RMProperty.DESCRIPTION);
- String physicalSize = getPropertyValue(properties, RMProperty.PHYSICAL_SIZE);
- String numberOfCopies = getPropertyValue(properties, RMProperty.NUMBER_OF_COPIES);
- String shelf = getPropertyValue(properties, RMProperty.SHELF);
- String storage = getPropertyValue(properties, RMProperty.STORAGE_LOCATION);
- String box = getPropertyValue(properties, RMProperty.BOX);
- String file = getPropertyValue(properties, RMProperty.FILE);
-
- // retrieve the container nodeRef
- String parentNodeRef = getItemNodeRef(username, password, recordPath);
-
- JSONObject requestParams = new JSONObject();
- requestParams.put("alf_destination", getNodeRefSpacesStore() + parentNodeRef);
- requestParams.put("prop_cm_name", recordName);
- requestParams.put("prop_cm_title", recordTitle);
- requestParams.put("prop_cm_description", description);
- requestParams.put("prop_rma_physicalSize", physicalSize);
- requestParams.put("prop_rma_numberOfCopies", numberOfCopies);
- requestParams.put("prop_rma_storageLocation", storage);
- requestParams.put("prop_rma_shelf", shelf);
- requestParams.put("prop_rma_box", box);
- requestParams.put("prop_rma_file", file);
-
- return doPostJsonRequest(username, password, SC_OK, requestParams, CREATE_NON_ELECTRONIC_RECORD_API);
- }
-
- /**
- * Uploads an electronic record
- *
- * eg. of usage for creating record directly in Unfiled Records : uploadElectronicRecord(getAdminName(), getAdminPassword(), recordPropertiesStringMap, UNFILED_RECORDS_BREADCRUMB, DocumentType.HTML)
- * @param username the username
- * @param password the password
- * @param properties a map of record properties and their values
- * @param folderName the folder inside which the record will be created, it needs to have a unique name, as this method doesn't check other containers than the folder name
- * @throws AssertionError if the upload was unsuccessful.
- */
- public void uploadElectronicRecord(String username, String password, Map properties, String folderName, DocumentType documentType)
- {
- String recordName = getPropertyValue(properties, RMProperty.NAME);
- String recordContent = getPropertyValue(properties, RMProperty.CONTENT);
- boolean success = (getRecord(username, password, folderName, recordName) != null) || (contentService.createDocumentInFolder(username, password, RM_SITE_ID, folderName, documentType, recordName, recordContent) != null);
- assertTrue("Failed to upload electronic record to " + folderName, success);
- }
-
- /**
- * Delete a record from the given path
- *
- * eg. of usage in the case in which the record is inside a folder in Unfiled Records : deleteRecord(getAdminName(), getAdminPassword(), "f1 (2016-1472716888713)", UNFILED_RECORDS_BREADCRUMB, "unfiled records folder");
- * eg. of usage in the case in which the record is created directly in Unfiled Records : deleteRecord(getAdminName(), getAdminPassword(), "f1 (2016-1472716888713)", UNFILED_RECORDS_BREADCRUMB, "");
- *
- * @param username user's username
- * @param password its password
- * @param recordName the record name
- * @param categoryName the name of the category in which the folder is, in case of unfiled record, this will have UNFILED_RECORDS_BREADCRUMB as container
- * @param folderName folder name, in case in which trying to delete a record in Unfiled records directly, this will be ""
- * @throws AssertionError If the record could not be deleted.
- */
- public void deleteRecord(String username, String password, String recordName, String categoryName, String folderName)
- {
- String recordPath = "/" + categoryName;
- if (!folderName.equals(""))
- {
- recordPath = recordPath + "/" + folderName;
- }
- deleteItem(username, password, recordPath + "/" + recordName);
- }
-
- /**
- * Retrieves the record object in case it exists
- *
- * @param username the user's username
- * @param password its password
- * @param folderName the folder in which the record is supposed to exist
- * @param recordName the String with which the record name starts
- * @return the record object in case it exists, null otherwise
- */
- private CmisObject getRecord(String username, String password, String folderName, String recordName)
- {
- for (CmisObject record : contentService.getFolderObject(contentService.getCMISSession(username, password), RM_SITE_ID, folderName).getChildren())
- {
- if (record.getName().startsWith(recordName))
- {
- return record;
- }
- }
- return null;
- }
-
- /**
- * Retrieves record full name for given partial name
- *
- * @param username the user's username
- * @param password its password
- * @param folderName the folder in which the record is supposed to exist
- * @param recordPartialName the String with which the record name starts
- * @return the record name in case it exists, empty String otherwise
- */
- public String getRecordFullName(String username, String password, String folderName, String recordPartialName)
- {
- CmisObject record = getRecord(username, password, folderName, recordPartialName);
- if (record != null)
- {
- return record.getName();
- }
- return "";
- }
-
-
- /**
- * Share a document
- *
- * @param user the user sharing the file
- * @param password the user's password
- * @param nodeId the node id of the file
- * @return {@link Pair}. on success will be true and the shareId.
- * on failure will be false and the response status code.
- */
- public Pair shareDocument(String user, String password, String nodeId) throws JSONException
- {
- JSONObject response = doPostRequest(user, password, null,
- MessageFormat.format(SHARE_ACTION_API, "{0}", nodeId));
- try
- {
- if (response.has("sharedId"))
- {
- return Pair.of(true, response.getString("sharedId"));
- }
- } catch (JSONException e)
- {
- LOGGER.info("Unable to extract response parameter", e);
- }
- return Pair.of(false, String.valueOf(response.getJSONObject("status").getInt("code")));
- }
-
- /**
- * Hide in place record
- *
- * @param user the user
- * @param password the user's password
- * @param nodeId the in place record node id
- * @return The HTTP Response.
- */
- public HttpResponse hideRecord(String user, String password, String nodeId)
- {
- String docNodeRef = getNodeRefSpacesStore() + nodeId;
-
- JSONObject requestParams = new JSONObject();
- requestParams.put("actionedUponNode", docNodeRef);
- requestParams.put("actionDefinitionName", "hide-record");
-
- return doPostJsonRequest(user, password, SC_OK, requestParams, ACTIONS_API);
- }
-
- /**
- * Retrieves the record's nodeRef
- *
- * @param username the user's username
- * @param password its password
- * @param recordName the record full name
- * @param recordPath the String with which the record name starts
- * @return the record nodeRef in case it exists, empty string otherwise
- */
- public String getRecordNodeRef(String username, String password, String recordName, String recordPath)
- {
- return getNodeRefSpacesStore() + getItemNodeRef(username, password, recordPath + "/" + recordName);
- }
-}
diff --git a/amps/ags/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/v0/RulesAPI.java b/amps/ags/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/v0/RulesAPI.java
deleted file mode 100644
index 3474c9febc..0000000000
--- a/amps/ags/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/v0/RulesAPI.java
+++ /dev/null
@@ -1,353 +0,0 @@
-/*
- * #%L
- * Alfresco Records Management Module
- * %%
- * Copyright (C) 2005 - 2021 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.v0;
-
-import static java.util.Arrays.asList;
-
-import static org.apache.http.HttpStatus.SC_OK;
-import static org.testng.AssertJUnit.assertTrue;
-
-import java.text.MessageFormat;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.stream.Collectors;
-
-import org.alfresco.rest.core.v0.BaseAPI;
-import org.alfresco.rest.rm.community.model.rules.RuleDefinition;
-import org.apache.http.HttpResponse;
-import org.json.JSONArray;
-import org.json.JSONException;
-import org.json.JSONObject;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.stereotype.Component;
-
-/**
- * Covers CRUD API operations on rules
- */
-@Component
-public class RulesAPI extends BaseAPI
-{
-
- public static final String RULES_API = "{0}node/{1}/ruleset/rules";
- public static final String RULE_API = "{0}node/{1}/ruleset/rules/{2}";
- public static final String INHERIT_RULES_API = "{0}node/{1}/ruleset/inheritrules/toggle";
- public static final String INHERIT_RULES_STATE_API = "{0}node/{1}/ruleset/inheritrules/state";
- // logger
- public static final Logger LOGGER = LoggerFactory.getLogger(RulesAPI.class);
-
- /**
- * Creates a rule for the specified container with given rule properties
- *
- * @param containerNodeRef the container to have the rule created on
- * @param ruleProperties the rule properties
- * @return The HTTP Response (or null if the response could not be understood).
- */
- public HttpResponse createRule(String username, String password, String containerNodeRef, RuleDefinition ruleProperties)
- {
- try
- {
- return doPostJsonRequest(username, password, SC_OK, getRuleRequest(ruleProperties), MessageFormat.format(RULES_API, "{0}", containerNodeRef));
- }
- catch (JSONException error)
- {
- LOGGER.error("Unable to extract response parameter.", error);
- }
- return null;
- }
-
- /**
- * Updates a rule for the specified container with given rule properties
- *
- * @param containerNodeRef the container to have the rule created on
- * @param ruleProperties the rule properties
- * @return true if the rule has been updated successfully, false otherwise
- */
- public JSONObject updateRule(String username, String password, String containerNodeRef, RuleDefinition ruleProperties)
- {
- String ruleId = ruleProperties.getId();
- if (ruleId == null || ruleId.isEmpty())
- {
- throw new RuntimeException("Can not update a rule without id.");
- }
- try
- {
- return doPutRequest(username, password, getRuleRequest(ruleProperties), MessageFormat.format(RULE_API, "{0}", containerNodeRef, ruleId));
- }
- catch (JSONException error)
- {
- LOGGER.error("Unable to extract response parameter.", error);
- }
- return null;
- }
-
- /**
- * Deletes a rule on a container and checks it doesn't exist anymore
- *
- * @param username the user performing the request
- * @param password the password
- * @param containerNodeRef the container on which the rule has been created
- * @param ruleId the rule id
- * @throws AssertionError if the rule could not be deleted.
- */
- public void deleteRule(String username, String password, String containerNodeRef, String ruleId)
- {
- doDeleteRequest(username, password, MessageFormat.format(RULE_API, "{0}", containerNodeRef, ruleId));
- boolean success = !getRulesIdsSetOnContainer(username, password, containerNodeRef).contains(ruleId);
- assertTrue("Rule " + ruleId + " was not deleted successfully from " + containerNodeRef, success);
- }
-
- /**
- * Deletes all the rules on a container and checks they don't exist anymore
- *
- * @param username the user performing the request
- * @param password the password
- * @param containerNodeRef the container on which the rules have been created
- * @throws AssertionError if at least one of the rules could not be deleted.
- */
- public void deleteAllRulesOnContainer(String username, String password, String containerNodeRef)
- {
- List ruleIds = getRulesIdsSetOnContainer(username, password, containerNodeRef);
- for (String ruleId : ruleIds)
- {
- deleteRule(username, password, containerNodeRef, ruleId);
- }
- }
-
- /**
- * Gets all the rules for the specified container with given rule properties
- *
- * @param username the user performing the request
- * @param password the password
- * @param containerNodeRef the container to get the rules from
- *
- * @return list of rules on container
- */
-
- public List getRulesSetOnContainer(String username, String password, String containerNodeRef)
- {
- List rulesDefinitions = new ArrayList<>();
-
- // get the rules set on the container
- JSONObject rulesJson = doGetRequest(username, password, MessageFormat.format(RULES_API, "{0}", containerNodeRef));
- if (rulesJson != null)
- {
- try
- {
- JSONArray rules = rulesJson.getJSONArray("data");
- for (int i = 0; i < rules.length(); i++)
- {
- RuleDefinition ruleDefinition = new RuleDefinition();
- JSONObject rule = rules.getJSONObject(i);
- ruleDefinition.id(rule.getString("id"));
- ruleDefinition.title(rule.getString("title"));
- ruleDefinition.description(rule.getString("description"));
- ruleDefinition.ruleType(rule.getJSONArray("ruleType").get(0).toString());
- ruleDefinition.disabled(rule.getBoolean("disabled"));
- rulesDefinitions.add(ruleDefinition);
- }
- }
- catch (JSONException error)
- {
- LOGGER.error("Unable to parse rules.", error);
- }
- }
- return rulesDefinitions;
- }
-
- /**
- * Retrieves all the ids of the rules set on the container
- *
- * @param username the user performing the request
- * @param password the password
- * @param containerNodeRef the container's noderef to get set rules for
- * @return the list of rules ids that the container has
- */
- public List getRulesIdsSetOnContainer(String username, String password, String containerNodeRef)
- {
- return getRulesSetOnContainer(username, password, containerNodeRef).stream().map(RuleDefinition::getId).collect(Collectors.toList());
- }
-
- /**
- * Prepares a request object for rules with given properties
- *
- * @param ruleProperties the rule properties
- * @return a object containing the rule properties for the request
- *
- * @throws JSONException
- */
- private JSONObject getRuleRequest(RuleDefinition ruleProperties) throws JSONException
- {
- JSONObject requestParams = new JSONObject();
-
- // the id has to be sent as empty string no matter the request
- requestParams.put("id", "");
- requestParams.put("action", addRulesActions(ruleProperties));
- requestParams.put("title", ruleProperties.getTitle());
- requestParams.put("description", ruleProperties.getDescription());
- requestParams.put("disabled", ruleProperties.isDisabled());
- requestParams.put("applyToChildren", ruleProperties.isApplyToChildren());
- requestParams.put("executeAsynchronously", ruleProperties.getRunInBackground());
- requestParams.put("ruleType", asList(ruleProperties.getRuleType()));
-
- return requestParams;
- }
-
- /**
- * Adds rules actions to the request
- *
- * @param ruleProperties the rules properties to extract actions from
- *
- * @return the object with actions set
- *
- * @throws JSONException
- */
- private JSONObject addRulesActions(RuleDefinition ruleProperties) throws JSONException
- {
- JSONObject action = new JSONObject();
- action.put("actionDefinitionName", "composite-action");
- JSONObject conditions = new JSONObject();
- conditions.put("conditionDefinitionName", "no-condition");
- conditions.put("parameterValues", new JSONObject());
- action.put("conditions", asList(conditions));
- action.put("actions", getRuleActionsList(ruleProperties));
- return action;
- }
-
- /**
- * Creates the actions list for request
- *
- * @param ruleProperties given rule properties
- *
- * @return the list of rule actions objects
- */
- private List getRuleActionsList(RuleDefinition ruleProperties) throws JSONException
- {
- List ruleActionsList = new ArrayList<>();
-
- for (String ruleAction : ruleProperties.getActions())
- {
- JSONObject ruleActionObj = new JSONObject();
- ruleActionObj.put("actionDefinitionName", ruleAction);
- JSONObject parameters = new JSONObject();
- if (ruleProperties.getPath() != null)
- {
- if(ruleProperties.getCreateRecordPath() != null)
- {
- parameters.put("createRecordPath", ruleProperties.getCreateRecordPath());
- }
- parameters.put("path", ruleProperties.getPath());
- }
- if (ruleProperties.getContentTitle() != null)
- {
- parameters.put("property", "cm:title");
- parameters.put("value", ruleProperties.getContentTitle());
- parameters.put("prop_type", "d:mltext");
- }
- if (ruleProperties.getContentDescription() != null)
- {
- parameters.put("property", "cm:description");
- parameters.put("value", ruleProperties.getContentDescription());
- parameters.put("prop_type", "d:mltext");
- }
- if (ruleProperties.getRejectReason() != null)
- {
- parameters.put("reason", ruleProperties.getRejectReason());
- }
- ruleActionObj.put("parameterValues", parameters);
- ruleActionsList.add(ruleActionObj);
- }
- return ruleActionsList;
- }
-
- /**
- * Returns the rule id for the give rule title set on a container
- *
- * @param username the user performing the request
- * @param password the password
- * @param containerNodeRef container nodeRef
- *
- * @return the rule id
- */
- public String getRuleIdWithTitle(String username, String password, String containerNodeRef, String title)
- {
- return getRulesSetOnContainer(username, password, containerNodeRef).stream().filter(
- rule -> rule.getTitle().equals(title)).findAny().get().getId();
- }
-
- /**
- * Disable inheritance on specific container
- *
- * @param username the username
- * @param password the password
- * @param containerNodeRef the container nodeRef
- *
- * @return The HTTP Response (or null if the current state is disabled).
- */
- public HttpResponse disableRulesInheritance(String username, String password, String containerNodeRef)
- {
- if(containerInheritsRulesFromParent(username, password, containerNodeRef))
- {
- return doPostJsonRequest(username, password, SC_OK, new JSONObject(), MessageFormat.format(INHERIT_RULES_API, "{0}", containerNodeRef));
- }
- return null;
- }
-
- /**
- * Enable inheritance on specific container
- *
- * @param username the username
- * @param password the password
- * @param containerNodeRef the container nodeRef
- * @return The HTTP Response (or null if the current state is disabled).
- */
- public HttpResponse enableRulesInheritance(String username, String password, String containerNodeRef)
- {
- if (!containerInheritsRulesFromParent(username, password, containerNodeRef))
- {
- return doPostJsonRequest(username, password, SC_OK, new JSONObject(), MessageFormat.format(INHERIT_RULES_API, "{0}", containerNodeRef));
- }
- return null;
- }
-
- /**
- * Returns the rules inheritance state of the container
- *
- * @param username the username
- * @param password the password
- * @param containerNodeRef the container nodeRef
- *
- * @return a boolean specifying if the container inherits rules from parent
- * @throws JSONException
- */
- public boolean containerInheritsRulesFromParent(String username, String password, String containerNodeRef) throws JSONException
- {
- JSONObject rulesInheritanceInfo = doGetRequest(username, password, MessageFormat.format(INHERIT_RULES_STATE_API, "{0}", containerNodeRef));
- return rulesInheritanceInfo.getJSONObject("data").getBoolean("inheritRules");
- }
-}
diff --git a/amps/ags/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/v0/SearchAPI.java b/amps/ags/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/v0/SearchAPI.java
deleted file mode 100644
index 01844820f5..0000000000
--- a/amps/ags/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/v0/SearchAPI.java
+++ /dev/null
@@ -1,263 +0,0 @@
-/*
- * #%L
- * Alfresco Records Management Module
- * %%
- * Copyright (C) 2005 - 2021 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.v0;
-
-import java.text.MessageFormat;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
-
-import org.alfresco.dataprep.AlfrescoHttpClientFactory;
-import org.alfresco.rest.core.v0.BaseAPI;
-import org.apache.http.NameValuePair;
-import org.apache.http.client.utils.URLEncodedUtils;
-import org.apache.http.message.BasicNameValuePair;
-import org.json.JSONException;
-import org.json.JSONObject;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Component;
-
-/**
- * Helper methods for performing search using various Alfresco search APIs.
- *
- * @author Kristijan Conkas
- * @since 2.5
- */
-@Component
-public class SearchAPI extends BaseAPI
-{
- /** http client factory */
- @Autowired
- private AlfrescoHttpClientFactory alfrescoHttpClientFactory;
-
- /** faceted search API endpoint */
- private static final String FACETED_SEARCH_ENDPOINT = "{0}alfresco/s/slingshot/rmsearch/faceted/rmsearch?{1}";
-
- /** share live search API endpoint */
- private static final String SHARE_LIVE_SEARCH_DOCS_ENDPOINT = "{0}alfresco/s/slingshot/live-search-docs?{1}";
-
- /** RM search URL template */
- private static final String RM_SEARCH_ENDPOINT = "{0}alfresco/s/slingshot/rmsearch/{1}?{2}";
-
- /** RM all nodes search filters */
- private static final String RM_DEFAULT_NODES_FILTERS =
- "records/true,undeclared/true,vital/false,folders/{0},categories/{1},frozen/false,cutoff/false";
-
- /**
- * Perform search request on search endpoint as a user.
- *
- * This method is applicable only to endpoints that support HTTP GET requests and return JSON body as response.
- * @param searchEndpoint
- * @param searchUser
- * @param searchPassword
- * @return search results as a {@link JSONObject}, please refer to API documentation for details
- */
- private JSONObject doSearch(
- String searchEndpoint,
- String searchUser,
- String searchPassword)
- {
- return facetedRequest(searchUser, searchPassword, null, searchEndpoint);
- }
-
- /**
- * Generic rm search.
- * @param username
- * @param password
- * @param site
- * @param query
- * @param filters
- * @param sortby
- * @return search results (see API reference for more details), null for any errors
- */
- public JSONObject rmSearch(
- String username,
- String password,
- String site,
- String query,
- String filters,
- String sortby)
- {
- List searchParameters = new ArrayList<>();
- searchParameters.add(new BasicNameValuePair("query", query));
- searchParameters.add(new BasicNameValuePair("filters", filters));
- if (sortby != null)
- {
- searchParameters.add(new BasicNameValuePair("sortby", sortby));
- }
-
- String requestURL = MessageFormat.format(
- RM_SEARCH_ENDPOINT,
- alfrescoHttpClientFactory.getObject().getAlfrescoUrl(),
- (site != null) ? site : RM_SITE_ID,
- URLEncodedUtils.format(searchParameters, "UTF-8"));
-
- return doSearch(requestURL, username, password);
- }
-
- /**
- * Search as a user for nodes on site "rm" matching query, using SearchAPI.RM_DEFAULT_RECORD_FILTERS and sorted
- * by sortby
- *
- *
- * @param username
- * @param password
- * @param query
- * @param sortby
- * @return list of node names
- */
-
- public List searchForNodeNamesAsUser(String username, String password, String query, String sortby,
- boolean includeCategories, boolean includeFolders)
- {
- String searchFilterParamaters = MessageFormat.format(RM_DEFAULT_NODES_FILTERS, Boolean.toString(includeFolders),
- Boolean.toString(includeCategories));
-
- return getItemNames(rmSearch(username, password, "rm", query, searchFilterParamaters, sortby));
- }
-
- /**
- * Search as a user for nodes on site "rm" matching query, using SearchAPI.RM_DEFAULT_RECORD_FILTERS and sorted
- * by sortby and returns the property value for the given nodeRef and property name
- *
- * @param username
- * @param password
- * @param query
- * @param sortby
- * @param includeCategories
- * @param includeFolders
- * @return list of node properties
- */
- public String searchForNodePropertyAsUser(String username, String password, String nodeRef, String propertyName, String query, String sortby,
- boolean includeCategories, boolean includeFolders)
- {
- String searchFilterParamaters = MessageFormat.format(RM_DEFAULT_NODES_FILTERS, Boolean.toString(includeFolders),
- Boolean.toString(includeCategories));
- return getItemProperty(rmSearch(username, password, "rm", query, searchFilterParamaters, sortby), nodeRef, propertyName);
- }
-
- /**
- * Generic faceted search.
- * @param username
- * @param password
- * @param parameters
- * @return search results (see API reference for more details), null for any errors
- */
- public JSONObject facetedSearch(String username, String password, List parameters)
- {
- return facetedRequest(username, password, parameters, FACETED_SEARCH_ENDPOINT);
- }
-
- /**
- * Execute share live search for documents.
- *
- * @param searchUser
- * @param searchPassword
- * @param searchTerm
- * @return search results (see API reference for more details)
- */
- public JSONObject liveSearchForDocuments(String searchUser, String searchPassword, String searchTerm)
- {
- return facetedRequest(searchUser, searchPassword, Arrays.asList(new BasicNameValuePair("t", searchTerm)),
- SHARE_LIVE_SEARCH_DOCS_ENDPOINT);
- }
-
- /**
- * Execute faceted search for term.
- * @param searchUser
- * @param searchPassword
- * @param searchTerm
- * @return search results (see API reference for more details)
- */
- public JSONObject facetedSearchForTerm(String searchUser, String searchPassword, String searchTerm)
- {
- return facetedSearch(
- searchUser,
- searchPassword,
- Arrays.asList(new BasicNameValuePair("term", searchTerm)));
- }
-
- /**
- * Helper method to search for documents as a user using faceted search.
- * @param username to search as
- * @param password for username
- * @param term search term
- * @return list of document names found
- */
- public List searchForDocumentsAsUser(String username, String password, String term)
- {
- return getItemNames(facetedSearchForTerm(username, password, term));
- }
-
- /**
- * Helper method to search for documents as a user using share live search.
- * @param username to search as
- * @param password for username
- * @param term search term
- * @return list of document names found
- */
- public List liveSearchForDocumentsAsUser(String username, String password, String term) throws JSONException
- {
- JSONObject searchResult = liveSearchForDocuments(username, password, term);
- LOGGER.info(searchResult.toString(3));
- return getItemNames(searchResult);
- }
-
- /**
- * Helper method to extract list of names from search result.
- *
- * @param searchResult
- * @return list of document or record names in search result
- * @throws FileNotFoundException
- * @throws JsonSyntaxException
- * @throws JsonIOException
- * @throws RuntimeException for malformed search response
- */
- /**
- * Helper method to extract list of names from search result.
- *
- * @param searchResult
- * @return
- */
- private List getItemNames(JSONObject searchResult)
- {
- return getPropertyValues(searchResult, "name");
- }
-
- /**
- * Helper method to extract list of property values from search result for the given nodeRef.
- *
- * @param searchResult
- * @param nodeRef
- * @param propertyName
- * @return
- */
- private String getItemProperty(JSONObject searchResult, String nodeRef, String propertyName)
- {
- return getPropertyValue(searchResult, nodeRef, propertyName);
- }
-}
diff --git a/amps/ags/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/v0/UserTrashcanAPI.java b/amps/ags/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/v0/UserTrashcanAPI.java
deleted file mode 100644
index 5bb286e98f..0000000000
--- a/amps/ags/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/v0/UserTrashcanAPI.java
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- * #%L
- * Alfresco Records Management Module
- * %%
- * Copyright (C) 2005 - 2021 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.v0;
-
-import static org.testng.AssertJUnit.assertNotNull;
-
-import org.alfresco.rest.core.v0.BaseAPI;
-import org.springframework.stereotype.Component;
-
-/**
- * Helper methods for performing actions on user trashcan
- *
- * @author Oana Nechiforescu
- * @since 2.6
- */
-@Component
-public class UserTrashcanAPI extends BaseAPI
-{
- private static final String EMPTY_TRASHCAN = "{0}archive/workspace/SpacesStore";
-
- /**
- * Clears the trashcan for the current user
- *
- * @param username the username
- * @param password the password
- * @throws AssertionError if emptying the trashcan fails.
- */
- public void emptyTrashcan(String username, String password)
- {
- assertNotNull("Emptying trashcan failed for user " + username,
- doDeleteRequest(username, password, EMPTY_TRASHCAN));
- }
-
-}
diff --git a/amps/ags/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/v0/service/DispositionScheduleService.java b/amps/ags/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/v0/service/DispositionScheduleService.java
deleted file mode 100644
index 9fa6db0860..0000000000
--- a/amps/ags/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/v0/service/DispositionScheduleService.java
+++ /dev/null
@@ -1,170 +0,0 @@
-/*
- * #%L
- * Alfresco Records Management Module
- * %%
- * Copyright (C) 2005 - 2021 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.v0.service;
-
-
-import java.util.HashMap;
-
-import org.alfresco.rest.core.v0.BaseAPI;
-import org.alfresco.rest.v0.RecordCategoriesAPI;
-import org.alfresco.utility.data.DataUserAIS;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Service;
-
-/**
- * Service for different disposition schedule actions
- *
- * @author jcule, cagache
- * @since 2.6.2
- */
-@Service
-public class DispositionScheduleService extends BaseAPI
-{
- @Autowired
- private RecordCategoriesAPI recordCategoriesAPI;
-
- @Autowired
- private DataUserAIS dataUser;
-
- /**
- * Helper method for adding a retain after period step
- *
- * @param categoryName the category in whose schedule the step will be added
- * @param period
- */
- public void addRetainAfterPeriodStep(String categoryName, String period)
- {
- HashMap retainStep = new HashMap<>();
- retainStep.put(RETENTION_SCHEDULE.NAME, "retain");
- retainStep.put(RETENTION_SCHEDULE.RETENTION_PERIOD, period);
- retainStep.put(RETENTION_SCHEDULE.DESCRIPTION, "Retain after a period step");
- recordCategoriesAPI.addDispositionScheduleSteps(dataUser.getAdminUser().getUsername(),
- dataUser.getAdminUser().getPassword(), categoryName, retainStep);
- }
-
- /**
- * Helper method for adding a cut off after period step
- *
- * @param categoryName the category in whose schedule the step will be added
- * @param period
- */
- public void addCutOffAfterPeriodStep(String categoryName, String period)
- {
- HashMap cutOffStep = new HashMap<>();
- cutOffStep.put(RETENTION_SCHEDULE.NAME, "cutoff");
- cutOffStep.put(RETENTION_SCHEDULE.RETENTION_PERIOD, period);
- cutOffStep.put(RETENTION_SCHEDULE.DESCRIPTION, "Cut off after a period step");
- recordCategoriesAPI.addDispositionScheduleSteps(dataUser.getAdminUser().getUsername(),
- dataUser.getAdminUser().getPassword(), categoryName, cutOffStep);
- }
-
- /**
- * Helper method for adding a destroy with ghosting after period
- *
- * @param categoryName the category in whose schedule the step will be added
- * @param period
- */
- public void addDestroyWithGhostingAfterPeriodStep(String categoryName, String period)
- {
- HashMap destroyStep = new HashMap<>();
- destroyStep.put(RETENTION_SCHEDULE.NAME, "destroy");
- destroyStep.put(RETENTION_SCHEDULE.RETENTION_PERIOD, period);
- destroyStep.put(RETENTION_SCHEDULE.DESCRIPTION, "Destroy after a period step");
- destroyStep.put(RETENTION_SCHEDULE.RETENTION_GHOST, "on");
- recordCategoriesAPI.addDispositionScheduleSteps(dataUser.getAdminUser().getUsername(),
- dataUser.getAdminUser().getPassword(), categoryName, destroyStep);
- }
-
- /**
- * Helper method for adding a cut off after an event occurs step
- *
- * @param categoryName the category in whose schedule the step will be added
- * @param events
- */
- public void addCutOffAfterEventStep(String categoryName, String events)
- {
- HashMap cutOffStep = new HashMap<>();
- cutOffStep.put(RETENTION_SCHEDULE.NAME, "cutoff");
- cutOffStep.put(RETENTION_SCHEDULE.RETENTION_EVENTS, events);
- cutOffStep.put(RETENTION_SCHEDULE.DESCRIPTION, "Cut off after event step");
-
- recordCategoriesAPI.addDispositionScheduleSteps(dataUser.getAdminUser().getUsername(),
- dataUser.getAdminUser().getPassword(), categoryName, cutOffStep);
- }
-
- /**
- * Helper method for adding an accession step
- *
- * @param timeOrEvent
- * @param events
- * @param period
- * @param periodProperty
- * @param combineConditions
- * @return
- */
- public void addAccessionStep(String categoryName, Boolean timeOrEvent, String events, String period, String
- periodProperty, Boolean combineConditions)
- {
- HashMap accessionStep = new HashMap<>();
- accessionStep.put(RETENTION_SCHEDULE.NAME, "accession");
- accessionStep.put(RETENTION_SCHEDULE.COMBINE_DISPOSITION_STEP_CONDITIONS, Boolean.toString(combineConditions));
- accessionStep.put(RETENTION_SCHEDULE.RETENTION_PERIOD, period);
- accessionStep.put(RETENTION_SCHEDULE.RETENTION_PERIOD_PROPERTY, periodProperty);
- if (!timeOrEvent)
- {
- accessionStep.put(RETENTION_SCHEDULE.RETENTION_ELIGIBLE_FIRST_EVENT, Boolean.toString(timeOrEvent));
- }
- accessionStep.put(RETENTION_SCHEDULE.RETENTION_EVENTS, events);
- accessionStep.put(RETENTION_SCHEDULE.DESCRIPTION,
- "Accession step with time and event conditions.");
- recordCategoriesAPI.addDispositionScheduleSteps(dataUser.getAdminUser().getUsername(),
- dataUser.getAdminUser().getPassword(), categoryName, accessionStep);
- }
-
- /**
- * Helper method to create retention schedule with general fields for the given category as admin
- * and apply it to the records
- *
- * @param categoryName
- * @param appliedToRecords
- */
- public void createCategoryRetentionSchedule(String categoryName, Boolean appliedToRecords)
- {
- recordCategoriesAPI.createRetentionSchedule(dataUser.getAdminUser().getUsername(),
- dataUser.getAdminUser().getPassword(), categoryName);
- String retentionScheduleNodeRef = recordCategoriesAPI.getDispositionScheduleNodeRef(
- dataUser.getAdminUser().getUsername(), dataUser.getAdminUser().getPassword(), categoryName);
-
- HashMap retentionScheduleGeneralFields = new HashMap<>();
- retentionScheduleGeneralFields.put(RETENTION_SCHEDULE.RETENTION_AUTHORITY, "Authority");
- retentionScheduleGeneralFields.put(RETENTION_SCHEDULE.RETENTION_INSTRUCTIONS, "Instructions");
- recordCategoriesAPI.setRetentionScheduleGeneralFields(dataUser.getAdminUser().getUsername(),
- dataUser.getAdminUser().getPassword(), retentionScheduleNodeRef, retentionScheduleGeneralFields,
- appliedToRecords);
-
- }
-}
diff --git a/amps/ags/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/v0/service/RMAuditService.java b/amps/ags/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/v0/service/RMAuditService.java
deleted file mode 100644
index 32b5b2072f..0000000000
--- a/amps/ags/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/v0/service/RMAuditService.java
+++ /dev/null
@@ -1,141 +0,0 @@
-/*
- * #%L
- * Alfresco Records Management Module
- * %%
- * Copyright (C) 2005 - 2021 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.v0.service;
-
-import static java.time.temporal.ChronoUnit.MINUTES;
-
-import static org.alfresco.utility.report.log.Step.STEP;
-import static org.testng.AssertJUnit.assertTrue;
-
-import java.time.Instant;
-import java.time.LocalDateTime;
-import java.time.ZoneId;
-import java.util.List;
-
-import org.alfresco.rest.rm.community.model.audit.AuditEntry;
-import org.alfresco.rest.rm.community.model.audit.AuditEvents;
-import org.alfresco.rest.v0.RMAuditAPI;
-import org.alfresco.utility.data.DataUserAIS;
-import org.alfresco.utility.model.UserModel;
-import org.apache.commons.collections4.CollectionUtils;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Service;
-
-/**
- * Produces processed results from RM Audit REST API calls
- *
- * @author Claudia Agache
- * @since 3.3
- */
-@Service
-public class RMAuditService
-{
- @Autowired
- private RMAuditAPI rmAuditAPI;
-
- @Autowired
- private DataUserAIS dataUser;
-
- /**
- * Clear the list of audit entries as admin user.
- */
- public void clearAuditLog()
- {
- STEP("Clean audit logs.");
- rmAuditAPI.clearAuditLog(dataUser.getAdminUser().getUsername(), dataUser.getAdminUser().getPassword());
- }
-
- /**
- * Returns a list of rm audit entries filtered by given event
- *
- * @param user the user who requests the list of rm audit entries
- * @param auditEvent the event
- * @return the list of audit entries matching the event
- */
- public List getAuditEntriesFilteredByEvent(UserModel user, AuditEvents auditEvent)
- {
- STEP("Get the list of audit entries for the " + auditEvent.eventDisplayName + " event.");
- return rmAuditAPI.getRMAuditLog(user.getUsername(), user.getPassword(), 100, auditEvent.event);
- }
-
- /**
- * Checks the rm audit log contains the entry for the given event.
- *
- * @param user the user who checks the audit log
- * @param auditEvent the audited event
- * @param auditUser the user who did the audited event
- * @param nodeName the audited node name if exists or empty string
- * @param changedValues the values changed by event if exist or empty list
- */
- public void checkAuditLogForEvent(UserModel user, AuditEvents auditEvent, UserModel auditUser,
- String nodeName, List changedValues)
- {
-
- List auditEntries = getAuditEntriesFilteredByEvent(user, auditEvent);
- assertTrue("The list of events is not filtered by " + auditEvent.event,
- auditEntries.stream().allMatch(auditEntry -> auditEntry.getEvent().equals(auditEvent.eventDisplayName)));
- final LocalDateTime eventTimestamp =
- LocalDateTime.ofInstant(Instant.now(), ZoneId.systemDefault()).truncatedTo(MINUTES);
- assertTrue("The event details are not audited",
- auditEntries.stream().anyMatch(auditEntry -> auditEntry.getNodeName().equals(nodeName) &&
- auditEntry.getUserName().equals(auditUser.getUsername()) &&
- CollectionUtils.isEqualCollection(auditEntry.getChangedValues(), changedValues) &&
- !auditEntry.getTimestamp().isEmpty() &&
- (LocalDateTime.ofInstant(Instant.parse(auditEntry.getTimestamp()), ZoneId.systemDefault()).truncatedTo(MINUTES)
- .compareTo(eventTimestamp) <= 0))
- );
- }
-
- /**
- * Checks the rm audit log contains the entry for the given event.
- *
- * @param user the user who checks the audit log
- * @param auditEvent the audited event
- * @param auditUser the user who did the audited event
- * @param nodeName the audited node name if exists or empty string
- * @param nodePath the path of the audited node if exists or empty string
- * @param changedValues the values changed by event if exist or empty list
- */
- public void checkAuditLogForEvent(UserModel user, AuditEvents auditEvent, UserModel auditUser,
- String nodeName, String nodePath, List changedValues)
- {
- List auditEntries = getAuditEntriesFilteredByEvent(user, auditEvent);
- assertTrue("The list of events is not filtered by " + auditEvent.event,
- auditEntries.stream().allMatch(auditEntry -> auditEntry.getEvent().equals(auditEvent.eventDisplayName)));
- final LocalDateTime eventTimestamp =
- LocalDateTime.ofInstant(Instant.now(), ZoneId.systemDefault()).truncatedTo(MINUTES);
- assertTrue("The event details are not audited",
- auditEntries.stream().anyMatch(auditEntry -> auditEntry.getNodeName().equals(nodeName) &&
- auditEntry.getUserName().equals(auditUser.getUsername()) &&
- auditEntry.getPath().equals(nodePath) &&
- CollectionUtils.isEqualCollection(auditEntry.getChangedValues(), changedValues) &&
- !auditEntry.getTimestamp().isEmpty() &&
- (LocalDateTime.ofInstant(Instant.parse(auditEntry.getTimestamp()), ZoneId.systemDefault()).truncatedTo(MINUTES)
- .compareTo(eventTimestamp) <= 0))
- );
- }
-}
diff --git a/amps/ags/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/v0/service/RoleService.java b/amps/ags/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/v0/service/RoleService.java
deleted file mode 100644
index afecd9c92b..0000000000
--- a/amps/ags/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/v0/service/RoleService.java
+++ /dev/null
@@ -1,209 +0,0 @@
-/*
- * #%L
- * Alfresco Records Management Module
- * %%
- * Copyright (C) 2005 - 2021 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.v0.service;
-
-import static lombok.AccessLevel.PROTECTED;
-import static org.springframework.http.HttpStatus.OK;
-
-import java.util.HashSet;
-import java.util.Set;
-
-import lombok.Getter;
-import org.alfresco.rest.core.RestAPIFactory;
-import org.alfresco.rest.rm.community.model.recordcategory.RecordCategory;
-import org.alfresco.rest.rm.community.model.user.UserPermissions;
-import org.alfresco.rest.rm.community.model.user.UserRoles;
-import org.alfresco.rest.v0.RMRolesAndActionsAPI;
-import org.alfresco.utility.constants.UserRole;
-import org.alfresco.utility.data.DataUser;
-import org.alfresco.utility.data.DataUserAIS;
-import org.alfresco.utility.model.SiteModel;
-import org.alfresco.utility.model.UserModel;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Service;
-
-/**
- * Produces processed results from roles API calls
- *
- * @author Rodica Sutu
- * @since 2.6
- */
-@Service
-public class RoleService
-{
- @Autowired
- @Getter (value = PROTECTED)
- private RMRolesAndActionsAPI rmRolesAndActionsAPI;
-
- @Autowired
- @Getter (value = PROTECTED)
- private DataUserAIS dataUser;
-
- @Autowired
- @Getter (value = PROTECTED)
- private RestAPIFactory restAPIFactory;
-
- /**
- * Get the capabilities for a role
- *
- * @param roleName the role name
- * @return the list of capabilities
- */
- public Set getRoleCapabilities(String roleName)
- {
- return getRmRolesAndActionsAPI().getCapabilitiesForRole(getDataUser().getAdminUser().getUsername(),
- getDataUser().getAdminUser().getPassword(), roleName);
- }
-
- /**
- * Add capabilities to a role
- *
- * @param role role to be updated
- * @param capabilities list of capabilities to be added
- */
- public void addCapabilitiesToRole(UserRoles role, Set capabilities)
- {
- final Set roleCapabilities = new HashSet<>(getRoleCapabilities(role.roleId));
- roleCapabilities.addAll(capabilities);
-
- getRmRolesAndActionsAPI().updateRole(getDataUser().getAdminUser().getUsername(), getDataUser().getAdminUser().getPassword(),
- role.roleId, role.displayName, roleCapabilities);
- }
-
- /**
- * Remove capabilities from a role
- *
- * @param role role to be updated
- * @param capabilities list of capabilities to be removed
- */
- public void removeCapabilitiesFromRole(UserRoles role, Set capabilities)
- {
- final Set roleCapabilities = getRoleCapabilities(role.roleId);
- roleCapabilities.removeAll(capabilities);
- getRmRolesAndActionsAPI().updateRole(getDataUser().getAdminUser().getUsername(), getDataUser().getAdminUser().getPassword(),
- role.roleId, role.displayName, roleCapabilities);
- }
-
- /**
- * Assign permission on a record category and give the user RM role
- *
- * @param user the user to assign rm role and permissions
- * @param categoryId the id of the category to assign permissions for
- * @param userPermission the permissions to be assigned to the user
- * @param userRole the rm role to be assigned to the user
- */
- public void assignUserPermissionsOnCategoryAndRMRole(UserModel user, String categoryId, UserPermissions userPermission,
- String userRole)
- {
- getRestAPIFactory().getRMUserAPI().addUserPermission(categoryId, user, userPermission);
- getRmRolesAndActionsAPI().assignRoleToUser(getDataUser().getAdminUser().getUsername(), getDataUser().getAdminUser().getPassword(),
- user.getUsername(), userRole);
- }
-
- /**
- * Helper method to create a test user with rm role
- *
- * @param userRole the rm role
- * @return the created user model
- */
- public UserModel createUserWithRMRole(String userRole)
- {
- final UserModel rmUser = getDataUser().createRandomTestUser();
- getRestAPIFactory().getRMUserAPI().assignRoleToUser(rmUser.getUsername(), userRole);
- getRestAPIFactory().getRmRestWrapper().assertStatusCodeIs(OK);
- return rmUser;
- }
-
- /**
- * Helper method to create a test user with rm role and permissions over the record category
- *
- * @param userRole the rm role
- * @param userPermission the permissions over the record category
- * @param recordCategory the category on which user has permissions
- * @return the created user model
- */
- public UserModel createUserWithRMRoleAndCategoryPermission(String userRole, RecordCategory recordCategory,
- UserPermissions userPermission)
- {
- return createUserWithRMRoleAndRMNodePermission(userRole, recordCategory.getId(), userPermission);
- }
-
- /**
- * Helper method to create a user with rm role and permissions on the node ref
- *
- * @param userRole the rm role
- * @param userPermission the permissions over the rm node
- * @param componentId the node id to grant rm permission
- * @return the created user model
- */
- public UserModel createUserWithRMRoleAndRMNodePermission(String userRole, String componentId,
- UserPermissions userPermission)
- {
- final UserModel rmUser = createUserWithRMRole(userRole);
- getRestAPIFactory().getRMUserAPI().addUserPermission(componentId, rmUser, userPermission);
- getRestAPIFactory().getRmRestWrapper().assertStatusCodeIs(OK);
- return rmUser;
- }
-
- /**
- * Helper method to create a user with rm role and permissions over the recordCategory and collaborator role
- * in collaboration site
- *
- * @param siteModel collaboration site
- * @param recordCategory the category on which permission should be given
- * @param userRole the rm role
- * @param userPermission the permissions over the recordCategory
- * @return the created user model
- */
- public UserModel createCollaboratorWithRMRoleAndPermission(SiteModel siteModel, RecordCategory recordCategory,
- UserRoles userRole, UserPermissions userPermission)
- {
- return createUserWithSiteRoleRMRoleAndPermission(siteModel, UserRole.SiteCollaborator, recordCategory.getId(),
- userRole, userPermission);
- }
-
- /**
- * Helper method to create a test user with a rm role and permissions over a rm component and a role
- * in collaboration site
- *
- * @param siteModel collaboration site
- * @param userSiteRole user role in the collaboration site
- * @param rmNodeId rm node id to grant rm permission
- * @param userRole the rm role
- * @param userPermission the permissions over the rmNodeId
- * @return the created user model
- */
- public UserModel createUserWithSiteRoleRMRoleAndPermission(SiteModel siteModel, UserRole userSiteRole,
- String rmNodeId, UserRoles userRole,
- UserPermissions userPermission)
- {
- final UserModel rmUser = createUserWithRMRoleAndRMNodePermission(userRole.roleId, rmNodeId,
- userPermission);
- getDataUser().addUserToSite(rmUser, siteModel, userSiteRole);
- return rmUser;
- }
-}
diff --git a/amps/ags/rm-automation/rm-automation-community-rest-api/src/main/resources/META-INF/services/javax.ws.rs.client.ClientBuilder b/amps/ags/rm-automation/rm-automation-community-rest-api/src/main/resources/META-INF/services/javax.ws.rs.client.ClientBuilder
deleted file mode 100644
index 48b9fa5717..0000000000
--- a/amps/ags/rm-automation/rm-automation-community-rest-api/src/main/resources/META-INF/services/javax.ws.rs.client.ClientBuilder
+++ /dev/null
@@ -1 +0,0 @@
-org.glassfish.jersey.client.JerseyClientBuilder
\ No newline at end of file
diff --git a/amps/ags/rm-automation/rm-automation-community-rest-api/src/main/resources/config.properties b/amps/ags/rm-automation/rm-automation-community-rest-api/src/main/resources/config.properties
deleted file mode 100644
index 5d54d6c02d..0000000000
--- a/amps/ags/rm-automation/rm-automation-community-rest-api/src/main/resources/config.properties
+++ /dev/null
@@ -1,6 +0,0 @@
-alfresco.server=localhost
-alfresco.port=8080
-rest.rmPath=alfresco/api/-default-/public/gs/versions/1
-
-# Docker properties values
-docker.host=tcp://127.0.0.1:2375
\ No newline at end of file
diff --git a/amps/ags/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/audit/AuditAddToHoldTests.java b/amps/ags/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/audit/AuditAddToHoldTests.java
deleted file mode 100644
index ae7fd03b9e..0000000000
--- a/amps/ags/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/audit/AuditAddToHoldTests.java
+++ /dev/null
@@ -1,312 +0,0 @@
-/*
- * #%L
- * Alfresco Records Management Module
- * %%
- * Copyright (C) 2005 - 2021 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.audit;
-
-import static java.util.Arrays.asList;
-
-import static org.alfresco.rest.rm.community.base.TestData.HOLD_DESCRIPTION;
-import static org.alfresco.rest.rm.community.base.TestData.HOLD_REASON;
-import static org.alfresco.rest.rm.community.model.audit.AuditEvents.ADD_TO_HOLD;
-import static org.alfresco.rest.rm.community.util.CommonTestUtils.generateTestPrefix;
-import static org.alfresco.rest.rm.community.utils.RMSiteUtil.FILE_PLAN_PATH;
-import static org.alfresco.utility.Utility.buildPath;
-import static org.alfresco.utility.Utility.removeLastSlash;
-import static org.alfresco.utility.data.RandomData.getRandomName;
-import static org.alfresco.utility.report.log.Step.STEP;
-import static org.apache.commons.httpclient.HttpStatus.SC_INTERNAL_SERVER_ERROR;
-import static org.testng.AssertJUnit.assertEquals;
-import static org.testng.AssertJUnit.assertTrue;
-
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-
-import com.google.common.collect.ImmutableMap;
-
-import org.alfresco.dataprep.CMISUtil;
-import org.alfresco.rest.rm.community.base.BaseRMRestTest;
-import org.alfresco.rest.rm.community.model.audit.AuditEntry;
-import org.alfresco.rest.rm.community.model.record.Record;
-import org.alfresco.rest.rm.community.model.recordcategory.RecordCategory;
-import org.alfresco.rest.rm.community.model.recordcategory.RecordCategoryChild;
-import org.alfresco.rest.rm.community.model.user.UserPermissions;
-import org.alfresco.rest.rm.community.model.user.UserRoles;
-import org.alfresco.rest.v0.HoldsAPI;
-import org.alfresco.rest.v0.service.RMAuditService;
-import org.alfresco.rest.v0.service.RoleService;
-import org.alfresco.test.AlfrescoTest;
-import org.alfresco.utility.constants.UserRole;
-import org.alfresco.utility.model.FileModel;
-import org.alfresco.utility.model.SiteModel;
-import org.alfresco.utility.model.UserModel;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.testng.annotations.AfterClass;
-import org.testng.annotations.BeforeClass;
-import org.testng.annotations.DataProvider;
-import org.testng.annotations.Test;
-
-/**
- * This class contains the tests that check the add to hold event is audited
- *
- * @author Claudia Agache
- * @since 3.3
- */
-@AlfrescoTest (jira = "RM-6859")
-public class AuditAddToHoldTests extends BaseRMRestTest
-{
- private final String PREFIX = generateTestPrefix(AuditAddToHoldTests.class);
- private final String HOLD1 = PREFIX + "hold1";
- private final String HOLD2 = PREFIX + "hold2";
-
- @Autowired
- private RMAuditService rmAuditService;
- @Autowired
- private HoldsAPI holdsAPI;
- @Autowired
- private RoleService roleService;
-
- private UserModel rmAdmin, rmManagerNoReadOnHold, rmManagerNoReadOnNode;
- private SiteModel privateSite;
- private RecordCategory recordCategory;
- private RecordCategoryChild recordFolder;
- private List auditEntries;
- private final List holdsList = asList(HOLD1, HOLD2);
- private List holdsListRef = new ArrayList<>();
- private String hold1NodeRef;
-
- @BeforeClass (alwaysRun = true)
- public void preconditionForAuditAddToHoldTests()
- {
- STEP("Create 2 holds.");
- hold1NodeRef = holdsAPI.createHoldAndGetNodeRef(getAdminUser().getUsername(),
- getAdminUser().getPassword(), HOLD1, HOLD_REASON, HOLD_DESCRIPTION);
- String hold2NodeRef = holdsAPI.createHoldAndGetNodeRef(getAdminUser().getUsername(), getAdminUser().getPassword(), HOLD2, HOLD_REASON, HOLD_DESCRIPTION);
- holdsListRef = asList(hold1NodeRef, hold2NodeRef);
-
- STEP("Create a new record category with a record folder.");
- recordCategory = createRootCategory(getRandomName("recordCategory"));
- recordFolder = createRecordFolder(recordCategory.getId(), PREFIX + "recFolder");
-
- STEP("Create an user with full rights to add content to a hold.");
- rmAdmin = roleService.createUserWithRMRole(UserRoles.ROLE_RM_ADMIN.roleId);
-
- STEP("Create a collaboration site.");
- privateSite = dataSite.usingUser(rmAdmin).createPrivateRandomSite();
-
- STEP("Create users without rights to add content to a hold.");
- rmManagerNoReadOnHold = roleService.createUserWithSiteRoleRMRoleAndPermission(privateSite,
- UserRole.SiteManager, recordCategory.getId(), UserRoles.ROLE_RM_MANAGER, UserPermissions.PERMISSION_FILING);
- rmManagerNoReadOnNode = roleService.createUserWithRMRoleAndRMNodePermission(UserRoles.ROLE_RM_MANAGER.roleId,
- hold1NodeRef, UserPermissions.PERMISSION_FILING);
- }
-
- /**
- * Data provider with valid nodes that can be added to a hold
- *
- * @return the node id, the node name and the node path
- */
- @DataProvider (name = "validNodesForAddToHold")
- public Object[][] getValidNodesForAddToHold()
- {
- FileModel contentToBeAdded = dataContent.usingAdmin().usingSite(privateSite)
- .createContent(CMISUtil.DocumentType.TEXT_PLAIN);
- RecordCategoryChild recordFolderToBeAdded = createRecordFolder(recordCategory.getId(), PREFIX + "recFolderToBeAdded");
- Record recordToBeAdded = createElectronicRecord(recordFolder.getId(), PREFIX + "record");
- String recordFolderPath = removeLastSlash(buildPath(FILE_PLAN_PATH, recordCategory.getName(),
- recordFolderToBeAdded.getName()));
- String recordPath = removeLastSlash(buildPath(FILE_PLAN_PATH, recordCategory.getName(),
- recordFolder.getName(), recordToBeAdded.getName()));
- String contentPath = "/Company Home" + contentToBeAdded.getCmisLocation();
-
- return new String[][]
- {
- // a record folder
- { recordFolderToBeAdded.getId(), recordFolderToBeAdded.getName(), recordFolderPath },
- // a record
- { recordToBeAdded.getId(), recordToBeAdded.getName(), recordPath },
- //an active content,
- { contentToBeAdded.getNodeRefWithoutVersion(), contentToBeAdded.getName(), contentPath }
- };
- }
-
- /**
- * Given a document/record/record folder is added to a hold
- * When I view the audit log
- * Then an entry has been created in the audit log that contains the following:
- * name of the hold
- * name of the document/record/record folder added
- * user who added the content
- * date the content was added
- * path of the node
- */
- @Test (dataProvider = "validNodesForAddToHold")
- public void addToHoldEventIsAudited(String nodeId, String nodeName, String nodePath)
- {
- rmAuditService.clearAuditLog();
-
- STEP("Add node to hold.");
- holdsAPI.addItemToHold(rmAdmin.getUsername(), rmAdmin.getPassword(), nodeId, HOLD1);
-
- STEP("Check the audit log contains the entry for the add to hold event.");
- rmAuditService.checkAuditLogForEvent(getAdminUser(), ADD_TO_HOLD, rmAdmin, nodeName, nodePath,
- asList(ImmutableMap.of("new", nodeName, "previous", "", "name", "Name"),
- ImmutableMap.of("new", HOLD1, "previous", "", "name", "Hold Name")));
- }
-
- /**
- * Given an unsuccessful add to hold action
- * When I view the audit log
- * Then the add to hold event isn't audited
- */
- @Test
- public void unsuccessfulAddToHoldIsNotAudited()
- {
- STEP("Create a new record");
- Record recordToBeAdded = createElectronicRecord(recordFolder.getId(), PREFIX + "record");
-
- rmAuditService.clearAuditLog();
-
- STEP("Try to add the record to a hold by an user with no rights.");
- holdsAPI.addItemsToHolds(rmManagerNoReadOnHold.getUsername(), rmManagerNoReadOnHold.getPassword(),
- SC_INTERNAL_SERVER_ERROR, Collections.singletonList(recordToBeAdded.getId()),
- Collections.singletonList(hold1NodeRef));
-
- STEP("Check the audit log doesn't contain the entry for the unsuccessful add to hold.");
- assertTrue("The list of events should not contain Add to Hold entry ",
- rmAuditService.getAuditEntriesFilteredByEvent(getAdminUser(), ADD_TO_HOLD).isEmpty());
- }
-
- /**
- * Given a not empty record folder is added to a hold
- * When I view the audit log
- * Then only an entry has been created in the audit log for the record folder added
- */
- @Test
- public void addToHoldIsNotAuditedForRecordFolderChildren()
- {
- STEP("Create a new record folder with a record inside");
- RecordCategoryChild notEmptyRecFolder = createRecordFolder(recordCategory.getId(), PREFIX + "notEmptyRecFolder");
- Record record = createElectronicRecord(notEmptyRecFolder.getId(), PREFIX + "record");
-
- rmAuditService.clearAuditLog();
-
- STEP("Add record folder to hold.");
- holdsAPI.addItemToHold(rmAdmin.getUsername(), rmAdmin.getPassword(), notEmptyRecFolder.getId(), HOLD1);
-
- auditEntries = rmAuditService.getAuditEntriesFilteredByEvent(getAdminUser(), ADD_TO_HOLD);
-
- STEP("Check the audit log contains only an entry for add to hold.");
- assertEquals("The list of events should contain only an entry", 1, auditEntries.size());
- assertTrue("The list of events should not contain Add to Hold entry for the record",
- auditEntries.stream().noneMatch(entry -> entry.getNodeName().equals(record.getName())));
- }
-
- /**
- * Given a record is added to multiple holds
- * When I view the audit log
- * Then multiple entries have been created in the audit log for each add to hold event
- */
- @Test
- public void addToHoldIsAuditedInBulkAddition()
- {
- STEP("Create a new record");
- Record recordToBeAdded = createElectronicRecord(recordFolder.getId(), PREFIX + "record");
-
- rmAuditService.clearAuditLog();
-
- STEP("Add record to multiple holds.");
- holdsAPI.addItemsToHolds(rmAdmin.getUsername(), rmAdmin.getPassword(),
- Collections.singletonList(recordToBeAdded.getId()), holdsList);
-
- auditEntries = rmAuditService.getAuditEntriesFilteredByEvent(getAdminUser(), ADD_TO_HOLD);
-
- STEP("Check the audit log contains entries for both additions.");
- assertEquals("The list of events should contain Add to Hold entries for both holds", 2, auditEntries.size());
- assertTrue("The hold name value for the first add to hold is not audited.",
- auditEntries.stream().anyMatch(entry -> entry.getChangedValues().contains(
- ImmutableMap.of("new", HOLD1, "previous", "", "name", "Hold Name"))));
- assertTrue("The hold name value for the second add to hold is not audited.",
- auditEntries.stream().anyMatch(entry -> entry.getChangedValues().contains(
- ImmutableMap.of("new", HOLD2, "previous", "", "name", "Hold Name"))));
- }
-
- /**
- * Given a document is added to a hold
- * When I view the audit log as an user with no Read permissions over the document
- * Then the add to hold entry isn't visible
- */
- @Test
- public void addToHoldAuditEntryNotVisible()
- {
- STEP("Create a new file");
- FileModel contentToBeAdded = dataContent.usingAdmin().usingSite(privateSite)
- .createContent(CMISUtil.DocumentType.TEXT_PLAIN);
- rmAuditService.clearAuditLog();
-
- STEP("Add file to hold.");
- holdsAPI.addItemToHold(rmAdmin.getUsername(), rmAdmin.getPassword(), contentToBeAdded.getNodeRefWithoutVersion(), HOLD1);
-
- STEP("Check that an user with no Read permissions can't see the entry for the add to hold event.");
- assertTrue("The list of events should not contain Add to Hold entry ",
- rmAuditService.getAuditEntriesFilteredByEvent(rmManagerNoReadOnNode, ADD_TO_HOLD).isEmpty());
- }
-
- /**
- * Given a document is added to a hold
- * When I view the audit log as an user with no Read permissions over the hold
- * Then the the hold name is replaced in the add to hold entry
- */
- @Test
- public void addToHoldAuditEntryHoldNameNotVisible()
- {
- STEP("Create a new file");
- FileModel contentToBeAdded = dataContent.usingAdmin().usingSite(privateSite)
- .createContent(CMISUtil.DocumentType.TEXT_PLAIN);
- rmAuditService.clearAuditLog();
-
- STEP("Add file to hold.");
- holdsAPI.addItemToHold(rmAdmin.getUsername(), rmAdmin.getPassword(), contentToBeAdded.getNodeRefWithoutVersion(), HOLD1);
-
- auditEntries = rmAuditService.getAuditEntriesFilteredByEvent(rmManagerNoReadOnHold, ADD_TO_HOLD);
-
- STEP("Check that an user with no Read permissions can't see the hold name in the add to hold event.");
- String replacementHoldName = "You don't have permission to view this hold.";
- assertEquals("The list of events should contain the Add to Hold entry", 1, auditEntries.size());
- assertTrue("The hold name should not be visible in the Add to Hold entry ",
- auditEntries.stream().anyMatch(entry -> entry.getChangedValues().contains(
- ImmutableMap.of("new", replacementHoldName, "previous", "", "name", "Hold Name"))));
- }
-
- @AfterClass (alwaysRun = true)
- public void cleanUpAuditAddToHoldTests()
- {
- holdsListRef.forEach(holdRef -> holdsAPI.deleteHold(getAdminUser(), holdRef));
- dataSite.usingAdmin().deleteSite(privateSite);
- asList(rmAdmin, rmManagerNoReadOnHold, rmManagerNoReadOnNode).forEach(user -> getDataUser().usingAdmin().deleteUser(user));
- deleteRecordCategory(recordCategory.getId());
- }
-}
diff --git a/amps/ags/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/audit/AuditCreateHoldTests.java b/amps/ags/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/audit/AuditCreateHoldTests.java
deleted file mode 100644
index ea5df99e55..0000000000
--- a/amps/ags/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/audit/AuditCreateHoldTests.java
+++ /dev/null
@@ -1,189 +0,0 @@
-/*
- * #%L
- * Alfresco Records Management Module
- * %%
- * Copyright (C) 2005 - 2021 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.audit;
-
-import static java.util.Arrays.asList;
-
-import static org.alfresco.rest.rm.community.base.TestData.HOLD_DESCRIPTION;
-import static org.alfresco.rest.rm.community.base.TestData.HOLD_REASON;
-import static org.alfresco.rest.rm.community.model.audit.AuditEvents.CREATE_HOLD;
-import static org.alfresco.rest.rm.community.util.CommonTestUtils.generateTestPrefix;
-import static org.alfresco.utility.report.log.Step.STEP;
-import static org.apache.commons.httpclient.HttpStatus.SC_INTERNAL_SERVER_ERROR;
-import static org.testng.AssertJUnit.assertEquals;
-import static org.testng.AssertJUnit.assertTrue;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import com.google.common.collect.ImmutableMap;
-
-import org.alfresco.rest.rm.community.base.BaseRMRestTest;
-import org.alfresco.rest.rm.community.model.audit.AuditEntry;
-import org.alfresco.rest.rm.community.model.user.UserRoles;
-import org.alfresco.rest.v0.HoldsAPI;
-import org.alfresco.rest.v0.service.RMAuditService;
-import org.alfresco.rest.v0.service.RoleService;
-import org.alfresco.test.AlfrescoTest;
-import org.alfresco.utility.model.UserModel;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.testng.annotations.AfterClass;
-import org.testng.annotations.BeforeClass;
-import org.testng.annotations.Test;
-
-/**
- * This class contains the tests that check the create hold event is audited
- *
- * @author Claudia Agache
- * @since 3.3
- */
-@AlfrescoTest (jira = "RM-6859")
-public class AuditCreateHoldTests extends BaseRMRestTest
-{
- private final String PREFIX = generateTestPrefix(AuditCreateHoldTests.class);
- private final String HOLD1 = PREFIX + "createHold";
- private final String HOLD2 = PREFIX + "createHold2";
- private final String HOLD3 = PREFIX + "createHold3";
- private final List holdsListRef = new ArrayList<>();
-
- @Autowired
- private RMAuditService rmAuditService;
- @Autowired
- private HoldsAPI holdsAPI;
- @Autowired
- private RoleService roleService;
-
- private UserModel rmAdmin, rmManager;
-
- @BeforeClass (alwaysRun = true)
- public void preconditionForAuditCreateHoldTests()
- {
- STEP("Create test users.");
- rmAdmin = roleService.createUserWithRMRole(UserRoles.ROLE_RM_ADMIN.roleId);
- rmManager = roleService.createUserWithRMRole(UserRoles.ROLE_RM_MANAGER.roleId);
- }
-
- /**
- * Given a new hold is created
- * When I view the audit log
- * Then an entry has been created in the audit log which contains the following:
- * name of the hold
- * reason for hold
- * user who created the hold
- * date the creation occurred
- */
- @Test
- public void createHoldEventIsAuditedForNewHold()
- {
- rmAuditService.clearAuditLog();
-
- STEP("Create a new hold.");
- String hold1NodeRef = holdsAPI.createHoldAndGetNodeRef(rmAdmin.getUsername(), rmAdmin.getPassword(), HOLD1,
- HOLD_REASON, HOLD_DESCRIPTION);
- holdsListRef.add(hold1NodeRef);
- STEP("Check the audit log contains the entry for the created hold with the hold details.");
- rmAuditService.checkAuditLogForEvent(getAdminUser(), CREATE_HOLD, rmAdmin, HOLD1,
- asList(ImmutableMap.of("new", HOLD_REASON, "previous", "", "name", "Hold Reason"),
- ImmutableMap.of("new", HOLD1, "previous", "", "name", "Hold Name")));
- }
-
- /**
- * Given an unsuccessful create hold action
- * When I view the audit log
- * Then the create hold event isn't audited
- */
- @Test
- public void createHoldEventIsNotAuditedForExistingHold()
- {
- STEP("Create a new hold.");
- String hold2NodeRef = holdsAPI.createHoldAndGetNodeRef(rmAdmin.getUsername(), rmAdmin.getPassword(), HOLD2, HOLD_REASON, HOLD_DESCRIPTION);
- holdsListRef.add(hold2NodeRef);
- rmAuditService.clearAuditLog();
-
- STEP("Try to create again the same hold and expect action to fail.");
- holdsAPI.createHold(rmAdmin.getUsername(), rmAdmin.getPassword(), HOLD2, HOLD_REASON, HOLD_DESCRIPTION,
- SC_INTERNAL_SERVER_ERROR);
-
- STEP("Check the audit log doesn't contain the entry for the second create hold event.");
- assertTrue("The list of events should not contain Create Hold entry ",
- rmAuditService.getAuditEntriesFilteredByEvent(getAdminUser(), CREATE_HOLD).isEmpty());
- }
-
- /**
- * Given a new hold is created and then deleted
- * When I view the audit log
- * Then the create hold entry still contains the initial details
- */
- @Test
- public void createHoldAuditEntryIsNotLost()
- {
- final String holdName = PREFIX + "holdToBeDeleted";
- rmAuditService.clearAuditLog();
-
- STEP("Create a new hold.");
- holdsAPI.createHold(rmAdmin.getUsername(), rmAdmin.getPassword(), holdName, HOLD_REASON, HOLD_DESCRIPTION);
-
- STEP("Get the list of audit entries for the create hold event.");
- List auditEntries = rmAuditService.getAuditEntriesFilteredByEvent(getAdminUser(), CREATE_HOLD);
-
- STEP("Delete the created hold.");
- holdsAPI.deleteHold(rmAdmin.getUsername(), rmAdmin.getPassword(), holdName);
-
- STEP("Get again the list of audit entries for the create hold event.");
- List auditEntriesAfterDelete = rmAuditService.getAuditEntriesFilteredByEvent(getAdminUser(), CREATE_HOLD);
-
- STEP("Check that the audit entry for the created hold didn't change after hold deletion.");
- assertEquals("The audit entry for Create Hold has been changed", auditEntries, auditEntriesAfterDelete);
- }
-
- /**
- * Given a new hold is created
- * When I view the audit log as an user with no Read permissions over the created hold
- * Then the create hold entry isn't visible
- */
- @Test
- public void createHoldAuditEntryNotVisible()
- {
- rmAuditService.clearAuditLog();
-
- STEP("Create a new hold.");
- String hold3NodeRef = holdsAPI.createHoldAndGetNodeRef(rmAdmin.getUsername(), rmAdmin.getPassword(), HOLD3,
- HOLD_REASON, HOLD_DESCRIPTION);
- holdsListRef.add(hold3NodeRef);
-
- STEP("Check that an user with no Read permissions over the hold can't see the entry for the create hold event");
- assertTrue("The list of events should not contain Create Hold entry ",
- rmAuditService.getAuditEntriesFilteredByEvent(rmManager, CREATE_HOLD).isEmpty());
- }
-
- @AfterClass (alwaysRun = true)
- public void cleanUpAuditCreateHoldTests()
- {
- holdsListRef.forEach(holdRef -> holdsAPI.deleteHold(getAdminUser(), holdRef));
- asList(rmAdmin, rmManager).forEach(user -> getDataUser().usingAdmin().deleteUser(user));
- }
-}
diff --git a/amps/ags/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/audit/AuditDeleteHoldTests.java b/amps/ags/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/audit/AuditDeleteHoldTests.java
deleted file mode 100644
index c5723bcd6e..0000000000
--- a/amps/ags/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/audit/AuditDeleteHoldTests.java
+++ /dev/null
@@ -1,139 +0,0 @@
-/*
- * #%L
- * Alfresco Records Management Module
- * %%
- * Copyright (C) 2005 - 2021 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.audit;
-
-import static java.util.Arrays.asList;
-
-import static org.alfresco.rest.rm.community.base.TestData.HOLD_DESCRIPTION;
-import static org.alfresco.rest.rm.community.base.TestData.HOLD_REASON;
-import static org.alfresco.rest.rm.community.model.audit.AuditEvents.DELETE_HOLD;
-import static org.alfresco.rest.rm.community.util.CommonTestUtils.generateTestPrefix;
-import static org.alfresco.utility.report.log.Step.STEP;
-import static org.apache.commons.httpclient.HttpStatus.SC_INTERNAL_SERVER_ERROR;
-import static org.testng.AssertJUnit.assertTrue;
-
-import java.util.Collections;
-
-import com.google.common.collect.ImmutableMap;
-
-import org.alfresco.rest.rm.community.base.BaseRMRestTest;
-import org.alfresco.rest.rm.community.model.user.UserRoles;
-import org.alfresco.rest.v0.HoldsAPI;
-import org.alfresco.rest.v0.service.RMAuditService;
-import org.alfresco.rest.v0.service.RoleService;
-import org.alfresco.test.AlfrescoTest;
-import org.alfresco.utility.model.UserModel;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.testng.annotations.AfterClass;
-import org.testng.annotations.BeforeClass;
-import org.testng.annotations.Test;
-
-/**
- * This class contains the tests that check the delete hold event is audited
- *
- * @author Claudia Agache
- * @since 3.3
- */
-@AlfrescoTest (jira = "RM-6859")
-public class AuditDeleteHoldTests extends BaseRMRestTest
-{
- private final String PREFIX = generateTestPrefix(AuditDeleteHoldTests.class);
- private final String HOLD = PREFIX + "holdToBeDeleted";
- private final String HOLD2 = PREFIX + "deleteHold";
-
- @Autowired
- private RMAuditService rmAuditService;
- @Autowired
- private HoldsAPI holdsAPI;
- @Autowired
- private RoleService roleService;
-
- private UserModel rmAdmin, rmManager;
- private String holdNodeRef;
-
- @BeforeClass (alwaysRun = true)
- public void preconditionForAuditDeleteHoldTests()
- {
- STEP("Create a new hold.");
- holdNodeRef = holdsAPI.createHoldAndGetNodeRef(getAdminUser().getUsername(), getAdminUser().getPassword(), HOLD,
- HOLD_REASON, HOLD_DESCRIPTION);
-
- STEP("Create 2 users with different permissions for the created hold.");
- rmAdmin = roleService.createUserWithRMRole(UserRoles.ROLE_RM_ADMIN.roleId);
- rmManager = roleService.createUserWithRMRole(UserRoles.ROLE_RM_MANAGER.roleId);
- }
-
- /**
- * Given a hold is deleted
- * When I view the audit log
- * Then an entry has been created in the audit log which contains the following:
- * name of the hold
- * user who deleted the hold
- * date the delete occurred
- */
- @Test
- public void deleteHoldEventIsAudited()
- {
- STEP("Create a new hold.");
- String holdRef = holdsAPI.createHoldAndGetNodeRef(rmAdmin.getUsername(), rmAdmin.getPassword(), HOLD2,
- HOLD_REASON, HOLD_DESCRIPTION);
-
- rmAuditService.clearAuditLog();
-
- STEP("Delete the created hold.");
- holdsAPI.deleteHold(rmAdmin, holdRef);
-
- STEP("Check the audit log contains the entry for the deleted hold with the hold details.");
- rmAuditService.checkAuditLogForEvent(getAdminUser(), DELETE_HOLD, rmAdmin, HOLD2,
- Collections.singletonList(ImmutableMap.of("new", "", "previous", HOLD2, "name", "Hold Name")));
- }
-
- /**
- * Given an unsuccessful delete hold action
- * When I view the audit log
- * Then the delete hold event isn't audited
- */
- @Test
- public void unsuccessfulDeleteHoldIsNotAudited()
- {
- rmAuditService.clearAuditLog();
-
- STEP("Try to delete a hold by an user with no Read permissions over the hold.");
- holdsAPI.deleteHold(rmManager.getUsername(), rmManager.getPassword(), holdNodeRef, SC_INTERNAL_SERVER_ERROR);
-
- STEP("Check the audit log doesn't contain the entry for the unsuccessful delete hold.");
- assertTrue("The list of events should not contain Delete Hold entry ",
- rmAuditService.getAuditEntriesFilteredByEvent(getAdminUser(), DELETE_HOLD).isEmpty());
- }
-
- @AfterClass (alwaysRun = true)
- public void cleanUpAuditDeleteHoldTests()
- {
- holdsAPI.deleteHold(getAdminUser(), holdNodeRef);
- asList(rmAdmin, rmManager).forEach(user -> getDataUser().usingAdmin().deleteUser(user));
- }
-}
diff --git a/amps/ags/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/audit/AuditGroupEventsTests.java b/amps/ags/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/audit/AuditGroupEventsTests.java
deleted file mode 100644
index d7344360e6..0000000000
--- a/amps/ags/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/audit/AuditGroupEventsTests.java
+++ /dev/null
@@ -1,139 +0,0 @@
-/*
- * #%L
- * Alfresco Records Management Module
- * %%
- * Copyright (C) 2005 - 2021 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.audit;
-
-import static java.util.Arrays.asList;
-
-import static org.alfresco.rest.rm.community.model.audit.AuditEvents.ADD_TO_USER_GROUP;
-import static org.alfresco.rest.rm.community.model.audit.AuditEvents.CREATE_USER_GROUP;
-import static org.alfresco.rest.rm.community.model.audit.AuditEvents.DELETE_USER_GROUP;
-import static org.alfresco.rest.rm.community.model.audit.AuditEvents.REMOVE_FROM_USER_GROUP;
-import static org.alfresco.utility.report.log.Step.STEP;
-
-import java.util.Collections;
-
-import com.google.common.collect.ImmutableMap;
-
-import org.alfresco.rest.rm.community.base.BaseRMRestTest;
-import org.alfresco.rest.v0.service.RMAuditService;
-import org.alfresco.test.AlfrescoTest;
-import org.alfresco.utility.model.GroupModel;
-import org.alfresco.utility.model.UserModel;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.testng.annotations.BeforeClass;
-import org.testng.annotations.Test;
-
-/**
- * This class contains the tests that check the group events are audited
- *
- * @author Claudia Agache
- * @since 2.7
- */
-@AlfrescoTest (jira = "RM-5236")
-public class AuditGroupEventsTests extends BaseRMRestTest
-{
- @Autowired
- private RMAuditService rmAuditService;
- private GroupModel testGroup;
- private UserModel testUser;
-
- @BeforeClass (alwaysRun = true)
- public void cleanAuditLogs()
- {
- rmAuditService.clearAuditLog();
- }
-
- /**
- * Given I have created a new group
- * When I view the RM audit
- * Then there is an entry showing that I created a group
- */
- @Test
- public void createGroupEventIsAudited()
- {
- testGroup = dataGroup.createRandomGroup();
-
- STEP("Check the audit log contains the entry for the created group.");
- rmAuditService.checkAuditLogForEvent(getAdminUser(), CREATE_USER_GROUP, getAdminUser(), testGroup.getGroupIdentifier(),
- Collections.singletonList(ImmutableMap.of("new", testGroup.getGroupIdentifier(), "previous", "",
- "name", "authorityDisplayName")));
- }
-
- /**
- * Given I have added a user to a group
- * When I view the RM audit
- * Then there is an entry showing that I have added a user to a group
- */
- @Test
- public void addUserToGroupEventIsAudited()
- {
- testGroup = dataGroup.createRandomGroup();
- testUser = getDataUser().createRandomTestUser();
- dataGroup.usingUser(testUser).addUserToGroup(testGroup);
-
- STEP("Check the audit log contains the entry for the add user to group event.");
- rmAuditService.checkAuditLogForEvent(getAdminUser(), ADD_TO_USER_GROUP, getAdminUser(), testGroup.getGroupIdentifier(),
- asList(ImmutableMap.of("new", testUser.getUsername(), "previous", "", "name", "User Name"),
- ImmutableMap.of("new", testGroup.getGroupIdentifier(), "previous", "", "name", "Parent Group")));
- }
-
- /**
- * Given I have removed a user from a group
- * When I view the RM audit
- * Then there is an entry showing that I have removed a user from a group
- */
- @Test
- public void removeUserFromGroupEventIsAudited()
- {
- testGroup = dataGroup.createRandomGroup();
- testUser = getDataUser().createRandomTestUser();
- dataGroup.usingUser(testUser).addUserToGroup(testGroup);
- dataGroup.removeUserFromGroup(testGroup, testUser);
-
- STEP("Check the audit log contains the entry for the remove user from group event.");
- rmAuditService.checkAuditLogForEvent(getAdminUser(), REMOVE_FROM_USER_GROUP, getAdminUser(), testGroup.getGroupIdentifier(),
- asList(ImmutableMap.of("new", "", "previous", testUser.getUsername(), "name", "User Name"),
- ImmutableMap.of("new", "","previous", testGroup.getGroupIdentifier(), "name", "Parent Group")));
- }
-
- /**
- * Given I have deleted a group
- * When I view the RM audit
- * Then there is an entry showing that I have deleted a group
- */
- @Test
- public void deleteGroupEventIsAudited()
- {
- testGroup = dataGroup.createRandomGroup();
- dataGroup.deleteGroup(testGroup);
-
- STEP("Check the audit log contains the entry for the delete group event.");
- rmAuditService.checkAuditLogForEvent(getAdminUser(), DELETE_USER_GROUP, getAdminUser(), testGroup.getGroupIdentifier(),
- Collections.singletonList(ImmutableMap.of("new", "", "previous", testGroup.getGroupIdentifier(),
- "name", "authorityDisplayName")));
- }
-}
diff --git a/amps/ags/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/audit/AuditLoginEventsTests.java b/amps/ags/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/audit/AuditLoginEventsTests.java
deleted file mode 100644
index 02f40b5c2e..0000000000
--- a/amps/ags/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/audit/AuditLoginEventsTests.java
+++ /dev/null
@@ -1,96 +0,0 @@
-/*
- * #%L
- * Alfresco Records Management Module
- * %%
- * Copyright (C) 2005 - 2021 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.audit;
-
-import static org.alfresco.rest.rm.community.model.audit.AuditEvents.LOGIN_SUCCESSFUL;
-import static org.alfresco.rest.rm.community.model.audit.AuditEvents.LOGIN_UNSUCCESSFUL;
-import static org.alfresco.utility.report.log.Step.STEP;
-import static org.testng.AssertJUnit.assertTrue;
-
-import java.util.List;
-
-import org.alfresco.rest.rm.community.base.BaseRMRestTest;
-import org.alfresco.rest.rm.community.model.audit.AuditEntry;
-import org.alfresco.rest.v0.service.RMAuditService;
-import org.alfresco.test.AlfrescoTest;
-import org.alfresco.utility.model.UserModel;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.testng.annotations.Test;
-
-/**
- * This class contains the tests that check the login events are audited
- *
- * @author Claudia Agache
- * @since 2.7
- */
-@AlfrescoTest (jira = "RM-5234")
-public class AuditLoginEventsTests extends BaseRMRestTest
-{
- @Autowired
- private RMAuditService rmAuditService;
-
- /**
- * Given I have tried to login using invalid credentials
- * When I view the RM audit filtered by Login unsuccessful event
- * Then the audit log contains only the entries for the Login unsuccessful event
- */
- @Test
- public void filterByLoginUnsuccessful() throws Exception
- {
- rmAuditService.clearAuditLog();
- restClient.authenticateUser(new UserModel(getAdminUser().getUsername(), "InvalidPassword"));
- restClient.withCoreAPI().getSites();
-
- STEP("Get the list of audit entries for the login unsuccessful event.");
- List auditEntries = rmAuditService.getAuditEntriesFilteredByEvent(getAdminUser(),
- LOGIN_UNSUCCESSFUL);
-
- STEP("Check the audit log contains only the entries for the login unsuccessful event.");
- assertTrue("The list of events is not filtered by " + LOGIN_UNSUCCESSFUL.event,
- auditEntries.stream().allMatch(auditEntry -> auditEntry.getEvent().equals(LOGIN_UNSUCCESSFUL.eventDisplayName)));
- }
-
- /**
- * Given I have tried to login using valid credentials
- * When I view the RM audit filtered by Login successful event
- * Then the audit log contains only the entries for the Login successful event
- */
- @Test
- public void filterByLoginSuccessful() throws Exception
- {
- restClient.authenticateUser(getAdminUser());
- restClient.withCoreAPI().getSites();
-
- STEP("Get the list of audit entries for the login successful event.");
- List auditEntries = rmAuditService.getAuditEntriesFilteredByEvent(getAdminUser(),
- LOGIN_SUCCESSFUL);
-
- STEP("Check the audit log contains only the entries for the login successful event.");
- assertTrue("The list of events is not filtered by " + LOGIN_SUCCESSFUL.event,
- auditEntries.stream().allMatch(auditEntry -> auditEntry.getEvent().equals(LOGIN_SUCCESSFUL.eventDisplayName)));
- }
-}
diff --git a/amps/ags/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/audit/AuditRemoveFromHoldTests.java b/amps/ags/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/audit/AuditRemoveFromHoldTests.java
deleted file mode 100644
index 374818e816..0000000000
--- a/amps/ags/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/audit/AuditRemoveFromHoldTests.java
+++ /dev/null
@@ -1,326 +0,0 @@
-/*
- * #%L
- * Alfresco Records Management Module
- * %%
- * Copyright (C) 2005 - 2021 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.audit;
-
-import static java.util.Arrays.asList;
-
-import static org.alfresco.rest.rm.community.base.TestData.HOLD_DESCRIPTION;
-import static org.alfresco.rest.rm.community.base.TestData.HOLD_REASON;
-import static org.alfresco.rest.rm.community.model.audit.AuditEvents.REMOVE_FROM_HOLD;
-import static org.alfresco.rest.rm.community.util.CommonTestUtils.generateTestPrefix;
-import static org.alfresco.rest.rm.community.utils.RMSiteUtil.FILE_PLAN_PATH;
-import static org.alfresco.utility.Utility.buildPath;
-import static org.alfresco.utility.Utility.removeLastSlash;
-import static org.alfresco.utility.data.RandomData.getRandomName;
-import static org.alfresco.utility.report.log.Step.STEP;
-import static org.apache.commons.httpclient.HttpStatus.SC_INTERNAL_SERVER_ERROR;
-import static org.testng.AssertJUnit.assertEquals;
-import static org.testng.AssertJUnit.assertTrue;
-
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-
-import com.google.common.collect.ImmutableMap;
-
-import org.alfresco.dataprep.CMISUtil;
-import org.alfresco.rest.rm.community.base.BaseRMRestTest;
-import org.alfresco.rest.rm.community.model.audit.AuditEntry;
-import org.alfresco.rest.rm.community.model.record.Record;
-import org.alfresco.rest.rm.community.model.recordcategory.RecordCategory;
-import org.alfresco.rest.rm.community.model.recordcategory.RecordCategoryChild;
-import org.alfresco.rest.rm.community.model.user.UserPermissions;
-import org.alfresco.rest.rm.community.model.user.UserRoles;
-import org.alfresco.rest.v0.HoldsAPI;
-import org.alfresco.rest.v0.service.RMAuditService;
-import org.alfresco.rest.v0.service.RoleService;
-import org.alfresco.test.AlfrescoTest;
-import org.alfresco.utility.constants.UserRole;
-import org.alfresco.utility.model.FileModel;
-import org.alfresco.utility.model.SiteModel;
-import org.alfresco.utility.model.UserModel;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.testng.annotations.AfterClass;
-import org.testng.annotations.BeforeClass;
-import org.testng.annotations.DataProvider;
-import org.testng.annotations.Test;
-
-/**
- * This class contains the tests that check the remove from hold event is audited
- *
- * @author Claudia Agache
- * @since 3.3
- */
-@AlfrescoTest (jira = "RM-6859")
-public class AuditRemoveFromHoldTests extends BaseRMRestTest
-{
- private final String PREFIX = generateTestPrefix(AuditRemoveFromHoldTests.class);
- private final String HOLD1 = PREFIX + "hold1";
- private final String HOLD2 = PREFIX + "hold2";
- private final String HOLD3 = PREFIX + "hold3";
-
- @Autowired
- private RMAuditService rmAuditService;
- @Autowired
- private HoldsAPI holdsAPI;
- @Autowired
- private RoleService roleService;
-
- private UserModel rmAdmin, rmManagerNoReadOnHold, rmManagerNoReadOnNode;
- private SiteModel privateSite;
- private RecordCategory recordCategory;
- private RecordCategoryChild recordFolder, heldRecordFolder;
- private Record heldRecord;
- private List auditEntries;
- private final List holdsList = asList(HOLD1, HOLD2, HOLD3);
- private List holdsListRef = new ArrayList<>();
- private FileModel heldContent;
- private String hold1NodeRef;
-
- @BeforeClass (alwaysRun = true)
- public void preconditionForAuditRemoveFromHoldTests()
- {
- STEP("Create an user with full rights to remove content from a hold.");
- rmAdmin = roleService.createUserWithRMRole(UserRoles.ROLE_RM_ADMIN.roleId);
-
- STEP("Create a collaboration site.");
- privateSite = dataSite.usingUser(rmAdmin).createPrivateRandomSite();
-
- STEP("Create new holds.");
- hold1NodeRef = holdsAPI.createHoldAndGetNodeRef(getAdminUser().getUsername(), getAdminUser().getPassword(),
- HOLD1, HOLD_REASON, HOLD_DESCRIPTION);
- String hold2NodeRef = holdsAPI.createHoldAndGetNodeRef(getAdminUser().getUsername(), getAdminUser().getPassword(), HOLD2, HOLD_REASON, HOLD_DESCRIPTION);
- String hold3NodeRef = holdsAPI.createHoldAndGetNodeRef(getAdminUser().getUsername(), getAdminUser().getPassword(), HOLD3, HOLD_REASON, HOLD_DESCRIPTION);
- holdsListRef = asList(hold1NodeRef, hold2NodeRef, hold3NodeRef);
-
- STEP("Create a new record category with a record folder.");
- recordCategory = createRootCategory(getRandomName("recordCategory"));
- recordFolder = createRecordFolder(recordCategory.getId(), getRandomName("recFolder"));
-
- STEP("Create some held items");
- heldContent = dataContent.usingAdmin().usingSite(privateSite)
- .createContent(CMISUtil.DocumentType.TEXT_PLAIN);
- heldRecordFolder = createRecordFolder(recordCategory.getId(), PREFIX + "heldRecFolder");
- heldRecord = createElectronicRecord(recordFolder.getId(), PREFIX + "record");
-
- holdsAPI.addItemsToHolds(getAdminUser().getUsername(), getAdminUser().getPassword(),
- asList(heldContent.getNodeRefWithoutVersion(), heldRecordFolder.getId(), heldRecord.getId()),
- holdsList);
-
- STEP("Create users without rights to remove content from a hold.");
- rmManagerNoReadOnHold = roleService.createUserWithSiteRoleRMRoleAndPermission(privateSite,
- UserRole.SiteManager, recordCategory.getId(), UserRoles.ROLE_RM_MANAGER, UserPermissions.PERMISSION_FILING);
- rmManagerNoReadOnNode = roleService.createUserWithRMRoleAndRMNodePermission(UserRoles.ROLE_RM_MANAGER.roleId,
- hold1NodeRef, UserPermissions.PERMISSION_FILING);
- }
-
- /**
- * Data provider with valid nodes that can be removed from a hold
- *
- * @return the node id, the node name and the node path
- */
- @DataProvider (name = "validNodesForRemoveFromHold")
- public Object[][] getValidNodesForRemoveFromHold()
- {
- String recordFolderPath = removeLastSlash(buildPath(FILE_PLAN_PATH, recordCategory.getName(),
- heldRecordFolder.getName()));
- String recordPath = removeLastSlash(buildPath(FILE_PLAN_PATH, recordCategory.getName(),
- recordFolder.getName(), heldRecord.getName()));
- String contentPath = "/Company Home" + heldContent.getCmisLocation();
-
- return new String[][]
- {
- // a record folder
- { heldRecordFolder.getId(), heldRecordFolder.getName(), recordFolderPath },
- // a record
- { heldRecord.getId(), heldRecord.getName(), recordPath },
- //an active content,
- { heldContent.getNodeRefWithoutVersion(), heldContent.getName(), contentPath }
- };
- }
-
- /**
- * Given a document/record/record folder is removed from a hold
- * When I view the audit log
- * Then an entry has been created in the audit log that contains the following:
- * name of the hold
- * name of the document/record/record folder removed
- * user who removed the content
- * date the content was removed
- * path of the node
- */
- @Test (dataProvider = "validNodesForRemoveFromHold")
- public void removeFromHoldEventIsAudited(String nodeId, String nodeName, String nodePath)
- {
- rmAuditService.clearAuditLog();
-
- STEP("Remove node from hold.");
- holdsAPI.removeItemFromHold(rmAdmin.getUsername(), rmAdmin.getPassword(), nodeId, HOLD3);
-
- STEP("Check the audit log contains the entry for the remove from hold event.");
- rmAuditService.checkAuditLogForEvent(getAdminUser(), REMOVE_FROM_HOLD, rmAdmin, nodeName, nodePath,
- asList(ImmutableMap.of("new", "", "previous", nodeName, "name", "Name"),
- ImmutableMap.of("new", "", "previous", HOLD3, "name", "Hold Name")));
- }
-
- /**
- * Given an unsuccessful remove from hold action
- * When I view the audit log
- * Then the remove from hold event isn't audited
- */
- @Test
- public void unsuccessfulRemoveFromHoldIsNotAudited()
- {
- rmAuditService.clearAuditLog();
-
- STEP("Try to remove the record from a hold by an user with no rights.");
- holdsAPI.removeItemsFromHolds(rmManagerNoReadOnHold.getUsername(), rmManagerNoReadOnHold.getPassword(),
- SC_INTERNAL_SERVER_ERROR, Collections.singletonList(heldRecord.getId()),
- Collections.singletonList(hold1NodeRef));
-
- STEP("Check the audit log doesn't contain the entry for the unsuccessful remove from hold.");
- assertTrue("The list of events should not contain remove from hold entry ",
- rmAuditService.getAuditEntriesFilteredByEvent(getAdminUser(), REMOVE_FROM_HOLD).isEmpty());
- }
-
- /**
- * Given a not empty record folder is removed from a hold
- * When I view the audit log
- * Then only an entry has been created in the audit log for the record folder removed
- */
- @Test
- public void removeFromHoldNotAuditedForRecordFolderChildren()
- {
- STEP("Create a new record folder with a record inside");
- RecordCategoryChild notEmptyRecFolder = createRecordFolder(recordCategory.getId(), PREFIX + "notEmptyRecFolder");
- Record record = createElectronicRecord(notEmptyRecFolder.getId(), PREFIX + "record");
-
- STEP("Add the record folder to a hold.");
- holdsAPI.addItemToHold(rmAdmin.getUsername(), rmAdmin.getPassword(), notEmptyRecFolder.getId(), HOLD1);
-
- rmAuditService.clearAuditLog();
-
- STEP("Remove record folder from hold.");
- holdsAPI.removeItemFromHold(rmAdmin.getUsername(), rmAdmin.getPassword(), notEmptyRecFolder.getId(), HOLD1);
-
- STEP("Get the list of audit entries for the remove from hold event.");
- auditEntries = rmAuditService.getAuditEntriesFilteredByEvent(getAdminUser(), REMOVE_FROM_HOLD);
-
- STEP("Check the audit log contains only an entry for remove from hold.");
- assertEquals("The list of events should contain only an entry", 1, auditEntries.size());
- assertTrue("The list of events should not contain Remove from Hold entry for the record",
- auditEntries.stream().noneMatch(entry -> entry.getNodeName().equals(record.getName())));
- }
-
- /**
- * Given a record folder is removed from multiple holds
- * When I view the audit log
- * Then multiple entries have been created in the audit log for each remove from hold event
- */
- @Test
- public void removeFromHoldIsAuditedInBulkRemoval()
- {
- rmAuditService.clearAuditLog();
-
- STEP("Remove record folder from multiple holds.");
- holdsAPI.removeItemsFromHolds(rmAdmin.getUsername(), rmAdmin.getPassword(),
- Collections.singletonList(heldRecordFolder.getId()), asList(HOLD1, HOLD2));
-
- STEP("Get the list of audit entries for the remove from hold event.");
- auditEntries = rmAuditService.getAuditEntriesFilteredByEvent(getAdminUser(), REMOVE_FROM_HOLD);
-
- STEP("Check the audit log contains entries for both removal.");
- assertEquals("The list of events should contain remove from Hold entries for both holds", 2,
- auditEntries.size());
- assertTrue("The hold name value for the first remove from hold is not audited.",
- auditEntries.stream().anyMatch(entry -> entry.getChangedValues().contains(
- ImmutableMap.of("new", "", "previous", HOLD1, "name", "Hold Name"))));
- assertTrue("The hold name value for the second remove from hold is not audited.",
- auditEntries.stream().anyMatch(entry -> entry.getChangedValues().contains(
- ImmutableMap.of("new", "", "previous", HOLD2, "name", "Hold Name"))));
- }
-
- /**
- * Given a document/record/record folder is removed from a hold
- * When I view the audit log as an user with no Read permissions over the node
- * Then the remove from hold entry isn't visible
- */
- @Test
- public void removeFromHoldAuditEntryNotVisible()
- {
- STEP("Add content to a hold.");
- FileModel heldFile = dataContent.usingAdmin().usingSite(privateSite)
- .createContent(CMISUtil.DocumentType.TEXT_PLAIN);
- holdsAPI.addItemToHold(rmAdmin.getUsername(), rmAdmin.getPassword(), heldFile.getNodeRefWithoutVersion(), HOLD1);
-
- rmAuditService.clearAuditLog();
-
- STEP("Remove held content from the hold.");
- holdsAPI.removeItemFromHold(rmAdmin.getUsername(), rmAdmin.getPassword(), heldFile.getNodeRefWithoutVersion(), HOLD1);
-
- STEP("Check that an user with no Read permissions can't see the entry for the remove from hold event.");
- assertTrue("The list of events should not contain Remove from Hold entry ",
- rmAuditService.getAuditEntriesFilteredByEvent(rmManagerNoReadOnNode, REMOVE_FROM_HOLD).isEmpty());
- }
-
- /**
- * Given a document/record/record folder is removed from a hold
- * When I view the audit log as an user with no Read permissions over the hold
- * Then the the hold name is replaced in the remove from hold entry
- */
- @Test
- public void removeFromHoldAuditEntryHoldNameNotVisible()
- {
- STEP("Add content to a hold.");
- FileModel heldFile = dataContent.usingAdmin().usingSite(privateSite)
- .createContent(CMISUtil.DocumentType.TEXT_PLAIN);
- holdsAPI.addItemToHold(rmAdmin.getUsername(), rmAdmin.getPassword(), heldFile.getNodeRefWithoutVersion(), HOLD1);
-
- rmAuditService.clearAuditLog();
-
- STEP("Remove held content from the hold.");
- holdsAPI.removeItemFromHold(rmAdmin.getUsername(), rmAdmin.getPassword(), heldFile.getNodeRefWithoutVersion(), HOLD1);
-
- auditEntries = rmAuditService.getAuditEntriesFilteredByEvent(rmManagerNoReadOnHold, REMOVE_FROM_HOLD);
-
- STEP("Check that an user with no Read permissions can't see the hold name in the remove from hold event.");
- String replacementHoldName = "You don't have permission to view this hold.";
- assertEquals("The list of events should contain the Remove from Hold entry", 1, auditEntries.size());
- assertTrue("The hold name should not be visible in the Remove from Hold entry ",
- auditEntries.stream().anyMatch(entry -> entry.getChangedValues().contains(
- ImmutableMap.of("new", "", "previous", replacementHoldName, "name", "Hold Name"))));
- }
-
- @AfterClass (alwaysRun = true)
- public void cleanUpAuditRemoveFromHoldTests()
- {
- holdsListRef.forEach(holdRef -> holdsAPI.deleteHold(getAdminUser(), holdRef));
- dataSite.usingAdmin().deleteSite(privateSite);
- asList(rmAdmin, rmManagerNoReadOnHold, rmManagerNoReadOnNode).forEach(user -> getDataUser().usingAdmin().deleteUser(user));
- deleteRecordCategory(recordCategory.getId());
- }
-}
diff --git a/amps/ags/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/audit/AuditUserEventsTests.java b/amps/ags/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/audit/AuditUserEventsTests.java
deleted file mode 100644
index ed7d5a1005..0000000000
--- a/amps/ags/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/audit/AuditUserEventsTests.java
+++ /dev/null
@@ -1,83 +0,0 @@
-/*
- * #%L
- * Alfresco Records Management Module
- * %%
- * Copyright (C) 2005 - 2021 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.audit;
-
-import static org.alfresco.rest.rm.community.model.audit.AuditEvents.CREATE_PERSON;
-import static org.alfresco.rest.rm.community.util.CommonTestUtils.generateTestPrefix;
-import static org.alfresco.utility.report.log.Step.STEP;
-
-import java.util.Collections;
-
-import com.google.common.collect.ImmutableMap;
-
-import org.alfresco.rest.rm.community.base.BaseRMRestTest;
-import org.alfresco.rest.v0.service.RMAuditService;
-import org.alfresco.test.AlfrescoTest;
-import org.alfresco.utility.model.UserModel;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.testng.annotations.AfterClass;
-import org.testng.annotations.Test;
-
-/**
- * This class contains the tests that check the user events are audited
- *
- * @author Rodica Sutu
- * @since 2.7
- */
-public class AuditUserEventsTests extends BaseRMRestTest
-{
- private final String PREFIX = generateTestPrefix(AuditUserEventsTests.class);
- private UserModel createUser;
- @Autowired
- private RMAuditService rmAuditService;
-
- /**
- * Given I have created a new user
- * When I view the RM audit
- * Then there is an entry showing that I created a user
- */
- @Test
- @AlfrescoTest(jira = "RM-6223")
- public void createUserEventIsAudited()
- {
- rmAuditService.clearAuditLog();
- STEP("Create a new user.");
- String userName = "auditCreateUser" + PREFIX;
- createUser = getDataUser().createUser(userName);
-
- STEP("Check the audit log contains the entry for the created user event.");
- rmAuditService.checkAuditLogForEvent(getAdminUser(), CREATE_PERSON, getAdminUser(), userName,
- Collections.singletonList(ImmutableMap.of("new", userName, "previous", "", "name", "User Name")));
- }
-
- @AfterClass (alwaysRun = true)
- public void cleanUp()
- {
- //delete the created user
- getDataUser().deleteUser(createUser);
- }
-}
diff --git a/amps/ags/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/base/AllowableOperations.java b/amps/ags/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/base/AllowableOperations.java
deleted file mode 100644
index 1d8806732d..0000000000
--- a/amps/ags/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/base/AllowableOperations.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * #%L
- * Alfresco Records Management Module
- * %%
- * Copyright (C) 2005 - 2021 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;
-
-/**
- * List of allowable operations
- *
- * @author Tuna Aksoy
- * @since 2.6
- */
-public class AllowableOperations
-{
- public static final String CREATE = "create";
- public static final String UPDATE = "update";
- public static final String DELETE = "delete";
-}
diff --git a/amps/ags/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/base/BaseRMRestTest.java b/amps/ags/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/base/BaseRMRestTest.java
deleted file mode 100644
index 31ffe7a5ee..0000000000
--- a/amps/ags/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/base/BaseRMRestTest.java
+++ /dev/null
@@ -1,944 +0,0 @@
-/*
- * #%L
- * Alfresco Records Management Module
- * %%
- * Copyright (C) 2005 - 2021 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 static lombok.AccessLevel.PROTECTED;
-import static org.alfresco.rest.rm.community.base.TestData.ELECTRONIC_RECORD_NAME;
-import static org.alfresco.rest.rm.community.base.TestData.RECORD_CATEGORY_TITLE;
-import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentAlias.FILE_PLAN_ALIAS;
-import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentAlias.UNFILED_RECORDS_CONTAINER_ALIAS;
-import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentAspects.ASPECTS_COMPLETED_RECORD;
-import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentAspects.VERSION_AS_RECORD;
-import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentType.CONTENT_TYPE;
-import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentType.NON_ELECTRONIC_RECORD_TYPE;
-import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentType.RECORD_CATEGORY_TYPE;
-import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentType.RECORD_FOLDER_TYPE;
-import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentType.RECORD_TYPE;
-import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentType.UNFILED_CONTAINER_TYPE;
-import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentType.UNFILED_RECORD_FOLDER_TYPE;
-import static org.alfresco.rest.rm.community.utils.CoreUtil.toFileModel;
-import static org.alfresco.rest.rm.community.utils.FilePlanComponentsUtil.createRecordCategoryChildModel;
-import static org.alfresco.rest.rm.community.utils.FilePlanComponentsUtil.createRecordCategoryModel;
-import static org.alfresco.rest.rm.community.utils.FilePlanComponentsUtil.createTempFile;
-import static org.alfresco.rest.rm.community.utils.FilePlanComponentsUtil.createUnfiledContainerChildModel;
-import static org.alfresco.rest.rm.community.utils.RMSiteUtil.createStandardRMSiteModel;
-import static org.alfresco.utility.data.RandomData.getRandomAlphanumeric;
-import static org.springframework.http.HttpStatus.CREATED;
-import static org.springframework.http.HttpStatus.NO_CONTENT;
-import static org.springframework.http.HttpStatus.OK;
-import static org.testng.Assert.assertFalse;
-import static org.testng.Assert.assertTrue;
-
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Optional;
-import java.util.stream.Collectors;
-
-import lombok.Getter;
-import org.alfresco.dataprep.ContentService;
-import org.alfresco.rest.RestTest;
-import org.alfresco.rest.core.RestAPIFactory;
-import org.alfresco.rest.model.RestNodeModel;
-import org.alfresco.rest.rm.community.model.fileplan.FilePlan;
-import org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentType;
-import org.alfresco.rest.rm.community.model.record.Record;
-import org.alfresco.rest.rm.community.model.recordcategory.RecordCategory;
-import org.alfresco.rest.rm.community.model.recordcategory.RecordCategoryChild;
-import org.alfresco.rest.rm.community.model.recordfolder.RecordFolder;
-import org.alfresco.rest.rm.community.model.recordfolder.RecordFolderEntry;
-import org.alfresco.rest.rm.community.model.recordfolder.RecordFolderProperties;
-import org.alfresco.rest.rm.community.model.site.RMSite;
-import org.alfresco.rest.rm.community.model.transfercontainer.TransferContainer;
-import org.alfresco.rest.rm.community.model.unfiledcontainer.UnfiledContainer;
-import org.alfresco.rest.rm.community.model.unfiledcontainer.UnfiledContainerChild;
-import org.alfresco.rest.rm.community.model.unfiledcontainer.UnfiledContainerChildEntry;
-import org.alfresco.rest.rm.community.requests.gscore.api.RMSiteAPI;
-import org.alfresco.rest.rm.community.requests.gscore.api.RecordCategoryAPI;
-import org.alfresco.rest.rm.community.requests.gscore.api.RecordFolderAPI;
-import org.alfresco.rest.rm.community.requests.gscore.api.RecordsAPI;
-import org.alfresco.rest.search.RestRequestQueryModel;
-import org.alfresco.rest.search.SearchNodeModel;
-import org.alfresco.rest.search.SearchRequest;
-import org.alfresco.rest.v0.SearchAPI;
-import org.alfresco.utility.Utility;
-import org.alfresco.utility.data.DataUserAIS;
-import org.alfresco.utility.model.ContentModel;
-import org.alfresco.utility.model.FileModel;
-import org.alfresco.utility.model.FolderModel;
-import org.alfresco.utility.model.SiteModel;
-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;
-
-/**
- * Base class for all GS REST API Tests
- *
- * @author Kristijan Conkas
- * @author Tuna Aksoy
- * @since 2.6
- */
-public class BaseRMRestTest extends RestTest
-{
- @Autowired
- @Getter (value = PROTECTED)
- private RestAPIFactory restAPIFactory;
-
- @Autowired
- @Getter (value = PROTECTED)
- protected DataUserAIS dataUser;
-
- @Autowired
- @Getter(value = PROTECTED)
- private ContentService contentService;
-
- @Autowired
- @Getter(value = PROTECTED)
- private SearchAPI searchApi;
-
- /**
- * Asserts the given status code
- *
- * @param statusCode The status code to assert
- */
- protected void assertStatusCode(HttpStatus statusCode)
- {
- getRestAPIFactory().getRmRestWrapper().assertStatusCodeIs(statusCode);
- }
-
- /**
- * Gets the admin user
- *
- * @return The admin user
- */
- protected UserModel getAdminUser()
- {
- return getDataUser().getAdminUser();
- }
-
- /** Valid root containers where electronic and non-electronic records can be created */
- @DataProvider(name = "validRootContainers")
- public Object[][] getValidRootContainers()
- {
- return new String[][]
- {
- // an arbitrary record folder
- { createCategoryFolderInFilePlan().getId(), RECORD_FOLDER_TYPE},
- // unfiled records root
- { UNFILED_RECORDS_CONTAINER_ALIAS, UNFILED_CONTAINER_TYPE},
- // an arbitrary unfiled records folder
- { createUnfiledContainerChild(UNFILED_RECORDS_CONTAINER_ALIAS, "Unfiled Folder " + getRandomAlphanumeric(), UNFILED_RECORD_FOLDER_TYPE).getId(), UNFILED_RECORD_FOLDER_TYPE }
- };
- }
-
- /**
- * @see org.alfresco.rest.RestTest#checkServerHealth()
- */
- @Override
- @BeforeClass (alwaysRun = true)
- public void checkServerHealth() throws Exception
- {
- // Create RM Site if not exist
- createRMSiteIfNotExists();
- }
-
- /**
- * Helper method to create the RM Site via the POST request
- * if the site doesn't exist
- */
- public void createRMSiteIfNotExists()
- {
- RMSiteAPI rmSiteAPI = getRestAPIFactory().getRMSiteAPI();
-
- // Check RM site doesn't exist
- if (!rmSiteAPI.existsRMSite())
- {
- // Create the RM site
- rmSiteAPI.createRMSite(createStandardRMSiteModel());
-
- // Verify the status code
- assertStatusCode(CREATED);
- }
- }
-
- /**
- * Helper method to delete the RM site if exists and to create a new one
- */
- public void createRMSite(RMSite rmSiteModel)
- {
- RMSiteAPI rmSiteAPI = getRestAPIFactory().getRMSiteAPI();
- if (rmSiteAPI.existsRMSite())
- {
- rmSiteAPI.deleteRMSite();
- assertStatusCode(NO_CONTENT);
- }
-
- rmSiteAPI.createRMSite(rmSiteModel);
- assertStatusCode(CREATED);
- }
-
- /**
- * Helper method to create root category as the admin user
- *
- * @param categoryName The name of the category
- * @return The created category
- * @throws RuntimeException on unsuccessful component creation
- */
- public RecordCategory createRootCategory(String categoryName)
- {
- return createRootCategory(getAdminUser(), categoryName, RECORD_CATEGORY_TITLE);
- }
-
- /**
- * Helper method to create root category
- *
- * @param userModel The user under whose privileges this structure is going to be created
- * @param categoryName The name of the category
- * @return The created category
- * @throws RuntimeException on unsuccessful component creation
- */
- public RecordCategory createRootCategory(UserModel userModel, String categoryName)
- {
- return createRootCategory(userModel, categoryName, RECORD_CATEGORY_TITLE);
- }
-
- /**
- * Helper method to create root category as the admin user
- *
- * @param categoryName The name of the category
- * @param categoryTitle The title of the category
- * @return The created category
- * @throws RuntimeException on unsuccessful component creation
- */
- public RecordCategory createRootCategory(String categoryName, String categoryTitle)
- {
- return createRootCategory(getAdminUser(), categoryName, categoryTitle);
- }
-
- /**
- * Helper method to create root category
- *
- * @param userModel The user under whose privileges this structure is going to be created
- * @param categoryName The name of the category
- * @param categoryTitle The title of the category
- * @return The created category
- * @throws RuntimeException on unsuccessful component creation
- */
- public RecordCategory createRootCategory(UserModel userModel, String categoryName, String categoryTitle)
- {
- RecordCategory recordCategoryModel = createRecordCategoryModel(categoryName, categoryTitle);
- return getRestAPIFactory().getFilePlansAPI(userModel).createRootRecordCategory(recordCategoryModel, FILE_PLAN_ALIAS);
- }
-
- /**
- * Helper method to create a record category child
- *
- * @param user The user under whose privileges the node is going to be created
- * @param recordCategoryId The id of the record category
- * @param name The name of the record category child
- * @param type The type of the record category child
- * @return The created {@link RecordCategoryChild}
- * @throws RuntimeException on unsuccessful component creation
- */
- public RecordCategoryChild createRecordCategoryChild(UserModel user, String recordCategoryId, String name, String type)
- {
- RecordCategoryChild recordCategoryChildModel = createRecordCategoryChildModel(name, type);
- return getRestAPIFactory().getRecordCategoryAPI(user).createRecordCategoryChild(recordCategoryChildModel, recordCategoryId);
- }
-
- /**
- * Helper method to create a record category child as the admin user
- *
- * @param recordCategoryId The id of the record category
- * @param name The name of the record category child
- * @param type The type of the record category child
- * @return The created {@link RecordCategoryChild}
- * @throws RuntimeException on unsuccessful component creation
- */
- public RecordCategoryChild createRecordCategoryChild(String recordCategoryId, String name, String type)
- {
- return createRecordCategoryChild(getAdminUser(), recordCategoryId, name, type);
- }
-
- /**
- * Helper method to create a record category as the admin user
- *
- * @param recordCategoryId The id of the record category
- * @param name The name of the record category child
- * @return The created {@link RecordCategoryChild}
- * @throws RuntimeException on unsuccessful component creation
- */
- public RecordCategoryChild createRecordCategory(String recordCategoryId, String name)
- {
- return createRecordCategoryChild(getAdminUser(), recordCategoryId, name, RECORD_CATEGORY_TYPE);
- }
-
- /**
- * Helper method to create a record folder as the admin user
- *
- * @param recordCategoryId The id of the record category
- * @param name The name of the record category child
- * @return The created {@link RecordCategoryChild}
- * @throws RuntimeException on unsuccessful component creation
- */
- public RecordCategoryChild createRecordFolder(String recordCategoryId, String name)
- {
- return createRecordCategoryChild(getAdminUser(), recordCategoryId, name, RECORD_FOLDER_TYPE);
- }
-
- /**
- * Helper method to create record folder
- *
- * @param user The user under whose privileges this structure is going to be created
- * @param recordCategoryId The id of the record category
- * @param name The name of the folder
- * @return The created folder
- * @throws RuntimeException on unsuccessful component creation
- */
- public RecordCategoryChild createFolder(UserModel user, String recordCategoryId, String name)
- {
- RecordCategoryChild recordFolderModel = createRecordCategoryChildModel(name, RECORD_FOLDER_TYPE);
- return getRestAPIFactory().getRecordCategoryAPI(user).createRecordCategoryChild(recordFolderModel, recordCategoryId);
- }
-
- /**
- * Helper method to create record folder as the admin user
- *
- * @param recordCategoryId The id of the record category
- * @param name The name of the folder
- * @return The created folder
- * @throws RuntimeException on unsuccessful component creation
- */
- public RecordCategoryChild createFolder(String recordCategoryId, String name)
- {
- return createFolder(getAdminUser(), recordCategoryId, name);
- }
-
- /**
- * Helper method to create child unfiled record folder
- *
- *@param user The user under whose privileges this structure is going to be created
- * @param parentId The id of the parent folder
- * @param nodeType The child type
- * @return The created folder
- * @throws RuntimeException on unsuccessful component creation
- */
- public UnfiledContainerChild createUnfiledRecordsFolderChild(UserModel user, String parentId, String childName, String nodeType)
- {
- UnfiledContainerChild childModel = createUnfiledContainerChildModel(childName, nodeType);
- UnfiledContainerChild child = getRestAPIFactory().getUnfiledRecordFoldersAPI(user).createUnfiledRecordFolderChild(childModel, parentId);
- assertStatusCode(CREATED);
-
- return child;
- }
-
- /**
- * Helper method to create child unfiled record folder as the admin user
- *
- * @param parentId The id of the parent folder
- * @param nodeType The child type
- * @return The created folder
- * @throws RuntimeException on unsuccessful component creation
- */
- public UnfiledContainerChild createUnfiledRecordsFolderChild(String parentId, String childName, String nodeType)
- {
- return createUnfiledRecordsFolderChild(getAdminUser(), parentId, childName, nodeType);
- }
-
- /**
- * Helper method to create a child to an unfiled record container
- *
- * @param user The user under whose privileges this structure is going to be created
- * @param parentId The id of the parent container
- * @param childName The name of the child
- * @param nodeType the child type
- * @return The created chid
- * @throws RuntimeException on unsuccessful child creation
- */
- public UnfiledContainerChild createUnfiledContainerChild(UserModel user, String parentId, String childName, String nodeType)
- {
- UnfiledContainerChild child = null;
- UnfiledContainerChild childModel = createUnfiledContainerChildModel(childName, nodeType);
-
- if (FilePlanComponentType.CONTENT_TYPE.equals(nodeType))
- {
- child = getRestAPIFactory().getUnfiledContainersAPI(user).uploadRecord(childModel, parentId, createTempFile(ELECTRONIC_RECORD_NAME, ELECTRONIC_RECORD_NAME));
- }
- else
- {
- child = getRestAPIFactory().getUnfiledContainersAPI(user).createUnfiledContainerChild(childModel, parentId);
- }
- assertStatusCode(CREATED);
-
- return child;
- }
-
- /**
- * Helper method to create a child to an unfiled record container as the admin user
- *
- * @param parentId The id of the parent container
- * @param childName The name of the child
- * @param nodeType the child type
- * @return The created chid
- * @throws RuntimeException on unsuccessful child creation
- */
- public UnfiledContainerChild createUnfiledContainerChild(String parentId, String childName, String nodeType)
- {
- return createUnfiledContainerChild(getAdminUser(), parentId, childName, nodeType);
- }
-
- /**
- * Helper method to close folder
- *
- * @param folderId The id of the folder
- * @return The closed folder
- */
- protected RecordFolder closeFolder(String folderId)
- {
- RecordFolder recordFolderModel = RecordFolder.builder()
- .properties(RecordFolderProperties.builder()
- .isClosed(true)
- .build())
- .build();
- RecordFolder updateRecordFolder = getRestAPIFactory().getRecordFolderAPI().updateRecordFolder(recordFolderModel, folderId);
- assertStatusCode(OK);
-
- return updateRecordFolder;
- }
-
- /**
- * Helper method to complete record
- *
- * @param recordId The id of the record to complete
- * @return The completed record
- */
- public Record completeRecord(String recordId)
- {
- RecordsAPI recordsAPI = getRestAPIFactory().getRecordsAPI();
- List aspects = recordsAPI.getRecord(recordId).getAspectNames();
-
- // this operation is only valid for records
- assertTrue(aspects.contains(RECORD_TYPE));
- // a record mustn't be completed
- assertFalse(aspects.contains(ASPECTS_COMPLETED_RECORD));
- // add completed record aspect
- aspects.add(ASPECTS_COMPLETED_RECORD);
-
- Record updateRecord = recordsAPI.updateRecord(Record.builder().aspectNames(aspects).build(), recordId);
- assertStatusCode(OK);
-
- return updateRecord;
- }
-
- /**
- * Helper method to create a randomly-named [category]/[folder] structure in file plan
- *
- * @param user The user under whose privileges this structure is going to be created
- * @return {@link RecordCategoryChild} which represents the record folder
- * @throws RuntimeException on failed creation
- */
- public RecordCategoryChild createCategoryFolderInFilePlan(UserModel user)
- {
- // create root category
- RecordCategory recordCategory = createRootCategory(user, "Category " + getRandomAlphanumeric());
-
- // and return a folder underneath
- return createFolder(user, recordCategory.getId(), "Folder " + getRandomAlphanumeric());
- }
-
- /**
- * Helper method to create a randomly-named [category]/[folder] structure in file plan as the admin user
- *
- * @return {@link RecordCategoryChild} which represents the record folder
- * @throws RuntimeException on failed creation
- */
- public RecordCategoryChild createCategoryFolderInFilePlan()
- {
- return createCategoryFolderInFilePlan(getAdminUser());
- }
-
- public UnfiledContainer getUnfiledContainerAsUser(UserModel user, String componentId)
- {
- return getRestAPIFactory().getUnfiledContainersAPI(user).getUnfiledContainer(componentId);
- }
-
- public UnfiledContainer getUnfiledContainer(String componentId)
- {
- return getUnfiledContainerAsUser(getAdminUser(), componentId);
- }
-
- public TransferContainer getTransferContainerAsUser(UserModel user, String componentId)
- {
- return getRestAPIFactory().getTransferContainerAPI(user).getTransferContainer(componentId);
- }
-
- public TransferContainer getTransferContainer(String componentId)
- {
- return getTransferContainerAsUser(getAdminUser(), componentId);
- }
-
- public FilePlan getFilePlanAsUser(UserModel user, String componentId)
- {
- return getRestAPIFactory().getFilePlansAPI(user).getFilePlan(componentId);
- }
-
- public FilePlan getFilePlan(String componentId)
- {
- return getFilePlanAsUser(getAdminUser(), componentId);
- }
-
- /**
- * Recursively delete a folder
- *
- * @param siteModel
- * @param folder
- */
- public void deleteFolder(SiteModel siteModel, FolderModel folder)
- {
- contentService.deleteTree(getAdminUser().getUsername(), getAdminUser().getPassword(), siteModel.getId(),
- folder.getName());
- }
-
- /**
- * Create an electronic record
- *
- * @param parentId the id of the parent
- * @param name the name of the record
- * @return the created record
- */
- public Record createElectronicRecord(String parentId, String name)
- {
- return createElectronicRecord(parentId, name ,null);
- }
-
-
- /**
- * Create an electronic record
- *
- * @param parentId the id of the parent
- * @param name the name of the record
- * @return the created record
- */
- public Record createElectronicRecord(String parentId, String name, UserModel user)
- {
- RecordFolderAPI recordFolderAPI = restAPIFactory.getRecordFolderAPI(user);
- Record recordModel = Record.builder().name(name).nodeType(CONTENT_TYPE).build();
- return recordFolderAPI.createRecord(recordModel, parentId);
- }
-
- /**
- * Create a non-electronic record
- *
- * @param parentId the id of the parent
- * @param name the name of the record
- * @return the created record
- */
- public Record createNonElectronicRecord(String parentId, String name)
- {
- return createNonElectronicRecord(parentId, name, null);
- }
-
- /**
- * Create a non-electronic record
- *
- * @param parentId the id of the parent
- * @param name the name of the record
- * @param user the user who creates the non-electronic record
- * @return the created record
- */
- public Record createNonElectronicRecord(String parentId, String name, UserModel user)
- {
- RecordFolderAPI recordFolderAPI = restAPIFactory.getRecordFolderAPI(user);
- Record recordModel = Record.builder().name(name).nodeType(NON_ELECTRONIC_RECORD_TYPE).build();
- return recordFolderAPI.createRecord(recordModel, parentId);
- }
-
- /**
- * Delete a record folder
- *
- * @param recordFolderId the id of the record folder to delete
- */
- public void deleteRecordFolder(String recordFolderId)
- {
- RecordFolderAPI recordFolderAPI = restAPIFactory.getRecordFolderAPI();
- recordFolderAPI.deleteRecordFolder(recordFolderId);
- }
-
- /**
- * Delete a record
- *
- * @param recordId the id of the record to delete
- */
- public void deleteRecord(String recordId)
- {
- RecordsAPI recordsAPI = restAPIFactory.getRecordsAPI();
- recordsAPI.deleteRecord(recordId);
- }
-
- /**
- * Delete a record category
- *
- * @param recordCategoryId the id of the record category to delete
- */
- public void deleteRecordCategory(String recordCategoryId)
- {
- RecordCategoryAPI recordCategoryAPI = restAPIFactory.getRecordCategoryAPI();
- recordCategoryAPI.deleteRecordCategory(recordCategoryId);
- }
-
- /**
- * Returns search results for the given search term
- *
- * @param user
- * @param term
- * @return
- */
- public List searchForContentAsUser(UserModel user, String term)
- {
- getRestAPIFactory().getRmRestWrapper().authenticateUser(user);
- RestRequestQueryModel queryReq = new RestRequestQueryModel();
- SearchRequest query = new SearchRequest(queryReq);
- queryReq.setQuery("cm:name:*" + term + "*");
-
- List names = new ArrayList<>();
- // wait for solr indexing
- int counter = 0;
- int waitInMilliSeconds = 7000;
- while (counter < 4)
- {
- synchronized (this)
- {
- try
- {
- this.wait(waitInMilliSeconds);
- }
- catch (InterruptedException e)
- {
- // Restore interrupted state...
- Thread.currentThread().interrupt();
- }
- }
-
- List searchResults = getRestAPIFactory().getRmRestWrapper().withSearchAPI().search(query)
- .getEntries();
- if (searchResults != null && !searchResults.isEmpty())
- {
- searchResults.forEach(childNode -> names.add(childNode.onModel().getName()));
- break;
- }
- else
- {
- counter++;
- }
- // double wait time to not overdo solr search
- waitInMilliSeconds = waitInMilliSeconds * 2;
- }
- return names;
- }
-
- /**
- * Returns the list of node names returned by search results for the given search term
- *
- * @param user
- * @param term
- * @param sortby
- * @param includeFolders
- * @param includeCategories
- * @param expectedResults
- * @return List
- */
- public List searchForRMContentAsUser(UserModel user, String term, String sortby, boolean includeFolders,
- boolean includeCategories, List expectedResults)
- {
- List results = new ArrayList<>();
- // wait for solr indexing
- int counter = 0;
- int waitInMilliSeconds = 7000;
- while (counter < 4)
- {
- synchronized (this)
- {
- try
- {
- this.wait(waitInMilliSeconds);
- }
- catch (InterruptedException e)
- {
- // Restore interrupted state...
- Thread.currentThread().interrupt();
- }
- }
-
- results = searchApi.searchForNodeNamesAsUser(user.getUsername(), user.getPassword(), term, sortby,
- includeFolders, includeCategories);
- if (!results.isEmpty() && results.containsAll(expectedResults))
- {
- break;
- }
- else
- {
- counter++;
- }
- // double wait time to not overdo solr search
- waitInMilliSeconds = waitInMilliSeconds * 2;
- }
- return results;
- }
-
- /**
- * Returns the property value for the given property name and nodeRef of the search results
- *
- * @param user
- * @param term
- * @param nodeRef
- * @param propertyName
- * @param sortby
- * @param includeFolders
- * @param includeCategories
- * @param expectedResults
- * @return String
- */
- public String searchForRMContentAsUser(UserModel user, String term, String nodeRef, String propertyName,
- String sortby, boolean includeFolders, boolean includeCategories, String expectedResults)
- {
- String result = "";
- // wait for solr indexing
- int counter = 0;
- int waitInMilliSeconds = 5000;
- while (counter < 4)
- {
- synchronized (this)
- {
- try
- {
- this.wait(waitInMilliSeconds);
- }
- catch (InterruptedException e)
- {
- // Restore interrupted state...
- Thread.currentThread().interrupt();
- }
- }
- result = searchApi.searchForNodePropertyAsUser(user.getUsername(), user.getPassword(), nodeRef,
- propertyName, term, sortby, includeFolders, includeCategories);
- if (!result.isEmpty() && result.contains(expectedResults))
- {
- break;
- }
- else
- {
- counter++;
- }
- // double wait time to not overdo solr search
- waitInMilliSeconds = (waitInMilliSeconds * 2);
- }
- return result;
- }
-
- /**
- * Helper method to return site document library content model
- *
- * @return ContentModel
- * @throws Exception
- */
- public ContentModel getDocumentLibrary(UserModel usermodel, SiteModel testSite) throws Exception
- {
- ContentModel siteModel = new ContentModel();
- siteModel.setNodeRef(testSite.getGuid());
-
- restClient.authenticateUser(usermodel);
-
- List nodes = restClient.withCoreAPI().usingNode(siteModel)
- .listChildren().getEntries().stream().collect(Collectors.toList());
- ContentModel documentLibrary = new ContentModel();
- documentLibrary.setName(nodes.get(0).onModel().getName());
- documentLibrary.setNodeRef(nodes.get(0).onModel().getId());
- return documentLibrary;
- }
- /**
- * Checks if the given file has record aspect
- *
- * @param testFile the file to be checked
- * @return true if the file has the aspect, false otherwise
- */
- protected boolean hasRecordAspect(FileModel testFile) throws Exception
- {
- return hasAspect(testFile, RECORD_TYPE);
- }
-
- /**
- * Checks if the given file has the given aspect
- *
- * @param testFile the file to be checked
- * @param aspectName the matching aspect
- * @return true if the file has the aspect, false otherwise
- */
- private boolean hasAspect(FileModel testFile, String aspectName) throws Exception
- {
- return getRestAPIFactory().getNodeAPI(testFile).getNode()
- .getAspectNames().contains(aspectName);
- }
-
- /**
- * Checks if the given node has the given aspect
- *
- * @param nodeId the node to be checked
- * @param aspectName the matching aspect
- * @return true if the file has the aspect, false otherwise
- */
- protected boolean hasAspect(String nodeId, String aspectName) throws Exception
- {
- return hasAspect(toFileModel(nodeId), aspectName);
- }
-
- /**
- * Helper method to verify if the declared record is in Unfiled Records location
- *
- * @param testFile the file declared as record
- * @return true if the matching record is found in Unfiled Records, false otherwise
- */
- protected boolean isMatchingRecordInUnfiledRecords(FileModel testFile)
- {
- try
- {
- Utility.sleep(1000, 10000,
- () -> {
- Optional matchingRecord = getRestAPIFactory().getUnfiledContainersAPI()
- .getUnfiledContainerChildren(UNFILED_RECORDS_CONTAINER_ALIAS)
- .getEntries()
- .stream()
- .filter(e -> e.getEntry().getId()
- .equals(testFile.getNodeRefWithoutVersion()))
- .findAny();
- assertTrue(matchingRecord.isPresent());
- });
- return true;
- }
- catch (AssertionError | Exception e)
- {
- return false;
- }
- }
-
- /**
- * Helper method to verify if the declared record is filed to the record folder location
- *
- * @param testFile the file declared as record
- * @param recFolder the record folder where the declared record has been filed
- * @return true if matching record is found in record folder, null otherwise
- */
- protected boolean isMatchingRecordInRecordFolder(FileModel testFile, RecordCategoryChild recFolder)
- {
- try
- {
- Utility.sleep(1000, 10000,
- () -> {
- Optional matchingRecord = getRestAPIFactory().getRecordFolderAPI()
- .getRecordFolderChildren(recFolder.getId())
- .getEntries()
- .stream()
- .filter(e -> e.getEntry().getId()
- .equals(testFile.getNodeRefWithoutVersion()))
- .findAny();
- assertTrue(matchingRecord.isPresent());
- });
- return true;
- }
- catch (AssertionError | Exception e)
- {
- return false;
- }
- }
- /**
- * Helper method to verify if the document version is declared as record version in unfiled container
- *
- * @param testFile the file declared as record version
- * @param version the document version
- * @return true if matching record version is found in unfiled record container, false otherwise
- */
- protected boolean isRecordVersionInUnfiledRecords(FileModel testFile, String version)
- {
- try
- {
- Utility.sleep(1000, 10000,
- () -> {
- UnfiledContainerChildEntry matchingRecord = getRestAPIFactory().getUnfiledContainersAPI()
- .getUnfiledContainerChildren(UNFILED_RECORDS_CONTAINER_ALIAS, "include=properties,aspectNames")
- .getEntries()
- .stream()
- .filter(e -> e.getEntry().getName().contains(testFile.getName().replace(".txt", ""))
- && e.getEntry().getProperties().getVersionedNodeRef().equals(testFile.getNodeRefWithoutVersion())
- && e.getEntry().getProperties().getRecordVersionLabel().equalsIgnoreCase(version)
- )
- .findFirst().get();
-
- assertTrue(hasAspect(matchingRecord.getEntry().getId(), VERSION_AS_RECORD));
- });
- return true;
- }
- catch (AssertionError | Exception e)
- {
- return false;
- }
- }
- /**
- * Helper method to verify if the document version is declared as record version in a specific record folder
- *
- * @param testFile the file declared as record version
- * @param recordFolder the record folder where the versioned record is filled
- * @param version the document version
- * @return true if matching record version is found in record folder, false otherwise
- */
- protected boolean isRecordVersionInRecordFolder(FileModel testFile, RecordCategoryChild recordFolder,
- String version)
- {
- try
- {
- Utility.sleep(1000, 10000,
- () -> {
- RecordFolderEntry matchingRecord = getRestAPIFactory().getRecordFolderAPI()
- .getRecordFolderChildren(recordFolder.getId(),"include=properties,aspectNames")
- .getEntries()
- .stream()
- .filter(e -> e.getEntry().getName().contains(testFile.getName().replace(".txt", ""))
- && e.getEntry().getProperties().getVersionedNodeRef().equals(testFile.getNodeRefWithoutVersion())
- && e.getEntry().getProperties().getRecordVersionLabel().equalsIgnoreCase(version)
- )
- .findFirst().get();
-
- assertTrue(hasAspect(matchingRecord.getEntry().getId(), VERSION_AS_RECORD));
- });
- return true;
- }
- catch (AssertionError | Exception e)
- {
- return false;
- }
- }
-
-}
diff --git a/amps/ags/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/base/DataProviderClass.java b/amps/ags/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/base/DataProviderClass.java
deleted file mode 100644
index 28cd24ee04..0000000000
--- a/amps/ags/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/base/DataProviderClass.java
+++ /dev/null
@@ -1,148 +0,0 @@
-/*
- * #%L
- * Alfresco Records Management Module
- * %%
- * Copyright (C) 2005 - 2021 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 static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentAlias.FILE_PLAN_ALIAS;
-import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentAlias.TRANSFERS_ALIAS;
-import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentAlias.UNFILED_RECORDS_CONTAINER_ALIAS;
-import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentType.CONTENT_TYPE;
-import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentType.FILE_PLAN_TYPE;
-import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentType.FOLDER_TYPE;
-import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentType.RECORD_CATEGORY_TYPE;
-import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentType.RECORD_FOLDER_TYPE;
-import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentType.TRANSFER_CONTAINER_TYPE;
-import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentType.TRANSFER_TYPE;
-import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentType.UNFILED_CONTAINER_TYPE;
-import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentType.UNFILED_RECORD_FOLDER_TYPE;
-
-import org.testng.annotations.DataProvider;
-
-/**
- * Data Provider class used in tests
- *
- * @author Rodica Sutu
- * @since 2.6
- */
-public class DataProviderClass
-{
- /**
- * Data Provider with the special file plan components alias
- * @return file plan component alias
- */
- @DataProvider
- public static Object[][] getContainers()
- {
- return new String[][] {
- { FILE_PLAN_ALIAS },
- { TRANSFERS_ALIAS },
- { UNFILED_RECORDS_CONTAINER_ALIAS },
- };
- }
-
- /**
- * Data Provider with:
- * with the object types not allowed as children for a record category
- *
- * @return file plan component alias
- */
- @DataProvider
- public static Object[][] childrenNotAllowedForCategory()
- {
- return new String[][] {
- { FILE_PLAN_TYPE },
- { TRANSFER_CONTAINER_TYPE },
- { UNFILED_CONTAINER_TYPE },
- { UNFILED_RECORD_FOLDER_TYPE },
- { TRANSFER_TYPE },
- { CONTENT_TYPE }
- };
- }
-
- /**
- * Data Provider with:
- * with the object types for creating a Record Folder
- *
- * @return file plan component alias
- */
- @DataProvider
- public static Object[][] folderTypes()
- {
- return new String[][] {
- { RECORD_FOLDER_TYPE },
- { FOLDER_TYPE }
- };
- }
-
- /**
- * Data Provider with:
- * with the object types for creating a Record Category
- *
- * @return file plan component alias
- */
- @DataProvider
- public static Object[][] categoryTypes()
- {
- return new String[][] {
- { FOLDER_TYPE },
- { RECORD_CATEGORY_TYPE }
- };
- }
-
- /**
- * Data Provider with:
- * with the object types for creating a Record Category Child
- *
- * @return record category child type
- */
- @DataProvider
- public static Object[][] categoryChild()
- {
- return new String[][] {
- { RECORD_FOLDER_TYPE },
- { FOLDER_TYPE },
- { RECORD_CATEGORY_TYPE }
- };
- }
-
- /**
- * Invalid root level types, at unfiled record folder/unfiled containers container level that shouldn't be possible to create
- */
- @DataProvider (name = "invalidRootTypes")
- public static Object[][] getInvalidRootTypes()
- {
- return new String[][]
- {
- { FILE_PLAN_TYPE },
- { RECORD_CATEGORY_TYPE },
- { RECORD_FOLDER_TYPE },
- { TRANSFER_CONTAINER_TYPE },
- { TRANSFER_TYPE },
- { UNFILED_CONTAINER_TYPE },
-
- };
- }
-}
diff --git a/amps/ags/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/base/TestData.java b/amps/ags/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/base/TestData.java
deleted file mode 100644
index ead1ee816e..0000000000
--- a/amps/ags/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/base/TestData.java
+++ /dev/null
@@ -1,110 +0,0 @@
-/*
- * #%L
- * Alfresco Records Management Module
- * %%
- * Copyright (C) 2005 - 2021 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 static com.google.common.collect.Sets.newHashSet;
-
-import static org.alfresco.rest.rm.community.model.user.UserRoles.ROLE_RM_ADMIN;
-import static org.alfresco.rest.rm.community.model.user.UserRoles.ROLE_RM_MANAGER;
-import static org.alfresco.rest.rm.community.model.user.UserRoles.ROLE_RM_POWER_USER;
-import static org.alfresco.rest.rm.community.model.user.UserRoles.ROLE_RM_SECURITY_OFFICER;
-import static org.alfresco.rest.rm.community.model.user.UserRoles.ROLE_RM_USER;
-import static org.alfresco.utility.data.RandomData.getRandomAlphanumeric;
-
-import java.util.Set;
-
-/**
- * Test data used in tests
- *
- * @author Rodica Sutu
- * @since 2.6
- */
-public interface TestData
-{
- /**
- * A user with ALFRESCO_ADMINISTRATORS role.
- * "GROUP_ANOTHER_ADMIN_EXISTS" The ANOTHER_ADMIN user has been created.
- */
- public static final String ANOTHER_ADMIN = "another_admin";
-
- /**
- * The default password used when creating test users.
- */
- public static final String DEFAULT_PASSWORD = "password";
-
- /**
- * The default email address used when creating test users.
- */
- public static final String DEFAULT_EMAIL = "default@alfresco.com";
-
- /**
- * The default record category name used when creating categories
- */
- public static String RECORD_CATEGORY_NAME = "CATEGORY NAME" + getRandomAlphanumeric();
-
- /**
- * The default record category title used when creating categories
- */
- public static String RECORD_CATEGORY_TITLE = "CATEGORY TITLE" + getRandomAlphanumeric();
-
- /**
- * The default record folder name used when creating folders
- */
- public static String RECORD_FOLDER_NAME = "FOLDER NAME" + getRandomAlphanumeric();
-
- /**
- * The default record folder title used when creating folders
- */
- public static String RECORD_FOLDER_TITLE = "FOLDER TITLE" + getRandomAlphanumeric();
-
- /**
- * The default electronic record name used when creating electronic records
- */
- public static String ELECTRONIC_RECORD_NAME = "Record electronic" + getRandomAlphanumeric();
-
- /**
- * The default non-electronic record name used when creating non-electronic records
- */
- public static String NONELECTRONIC_RECORD_NAME = "Record nonelectronic" + getRandomAlphanumeric();
-
- public static final String ALFRESCO_ADMINISTRATORS = "ALFRESCO_ADMINISTRATORS";
- /**
- * The ids of the default RM roles.
- */
- public static final Set RM_ROLES = newHashSet(ROLE_RM_ADMIN.roleId, ROLE_RM_MANAGER.roleId,
- ROLE_RM_POWER_USER.roleId, ROLE_RM_SECURITY_OFFICER.roleId, ROLE_RM_USER.roleId);
-
- /**
- * The default hold description
- */
- String HOLD_DESCRIPTION = "Generalized hold case for tests";
-
- /**
- * The default hold reason
- */
- String HOLD_REASON = "Active content to be reviewed for the CASE McDermott, FINRA ";
-}
diff --git a/amps/ags/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/fileplans/FilePlanTests.java b/amps/ags/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/fileplans/FilePlanTests.java
deleted file mode 100644
index b24c59d86f..0000000000
--- a/amps/ags/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/fileplans/FilePlanTests.java
+++ /dev/null
@@ -1,518 +0,0 @@
-/*
- * #%L
- * Alfresco Records Management Module
- * %%
- * Copyright (C) 2005 - 2021 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.fileplans;
-
-import static java.util.Arrays.asList;
-
-import static org.alfresco.rest.rm.community.base.AllowableOperations.CREATE;
-import static org.alfresco.rest.rm.community.base.AllowableOperations.DELETE;
-import static org.alfresco.rest.rm.community.base.AllowableOperations.UPDATE;
-import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentAlias.FILE_PLAN_ALIAS;
-import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.ALLOWABLE_OPERATIONS;
-import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentType.CONTENT_TYPE;
-import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentType.FILE_PLAN_TYPE;
-import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentType.NON_ELECTRONIC_RECORD_TYPE;
-import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentType.RECORD_CATEGORY_TYPE;
-import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentType.RECORD_FOLDER_TYPE;
-import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentType.TRANSFER_CONTAINER_TYPE;
-import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentType.TRANSFER_TYPE;
-import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentType.UNFILED_CONTAINER_TYPE;
-import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentType.UNFILED_RECORD_FOLDER_TYPE;
-import static org.alfresco.rest.rm.community.model.user.UserPermissions.PERMISSION_FILING;
-import static org.alfresco.rest.rm.community.model.user.UserRoles.ROLE_RM_MANAGER;
-import static org.alfresco.utility.data.RandomData.getRandomAlphanumeric;
-import static org.alfresco.utility.data.RandomData.getRandomName;
-import static org.springframework.http.HttpStatus.CONFLICT;
-import static org.springframework.http.HttpStatus.CREATED;
-import static org.springframework.http.HttpStatus.FORBIDDEN;
-import static org.springframework.http.HttpStatus.NOT_FOUND;
-import static org.springframework.http.HttpStatus.OK;
-import static org.springframework.http.HttpStatus.UNPROCESSABLE_ENTITY;
-import static org.testng.Assert.assertFalse;
-import static org.testng.Assert.assertNotEquals;
-import static org.testng.Assert.assertNotNull;
-import static org.testng.Assert.assertTrue;
-import static org.testng.Assert.fail;
-import static org.testng.AssertJUnit.assertEquals;
-
-import java.util.ArrayList;
-import java.util.NoSuchElementException;
-
-import org.alfresco.rest.rm.community.base.BaseRMRestTest;
-import org.alfresco.rest.rm.community.base.DataProviderClass;
-import org.alfresco.rest.rm.community.model.fileplan.FilePlan;
-import org.alfresco.rest.rm.community.model.fileplan.FilePlanProperties;
-import org.alfresco.rest.rm.community.model.recordcategory.RecordCategory;
-import org.alfresco.rest.rm.community.model.recordcategory.RecordCategoryCollection;
-import org.alfresco.rest.rm.community.model.recordcategory.RecordCategoryProperties;
-import org.alfresco.rest.rm.community.requests.gscore.api.RMSiteAPI;
-import org.alfresco.utility.constants.ContainerName;
-import org.alfresco.utility.model.UserModel;
-import org.alfresco.utility.report.Bug;
-import org.testng.annotations.DataProvider;
-import org.testng.annotations.Test;
-
-/**
- * This class contains the tests for the File Plan CRUD API
- *
- * @author Rodica Sutu
- * @since 2.6
- */
-public class FilePlanTests extends BaseRMRestTest
-{
- //** Number of children (for children creation test) */
- private static final int NUMBER_OF_CHILDREN = 10;
-
- /**
- * Data Provider with:
- * with the object types not allowed as children for a record category
- *
- * @return file plan component alias
- */
- @DataProvider
- public static Object[][] childrenNotAllowedForFilePlan()
- {
- return new String[][] {
- { FILE_PLAN_TYPE },
- { TRANSFER_CONTAINER_TYPE },
- { UNFILED_CONTAINER_TYPE },
- { UNFILED_RECORD_FOLDER_TYPE },
- { TRANSFER_TYPE },
- { CONTENT_TYPE },
- { NON_ELECTRONIC_RECORD_TYPE},
- { RECORD_FOLDER_TYPE}
- };
- }
-
- /**
- *
- * Given that the RM site doesn't exist
- * When I use the API to get the File Plan
- * Then I get the 404 response code
- *
- */
- @Test (priority = 1)
- // Set priority to 1 in order for this test to run last one in this class. The rm site is created only once at the
- // beginning of the class and because this test deletes the rm site, the other tests might be affected
- public void getFilePlanWhenRMIsNotCreated()
- {
- RMSiteAPI rmSiteAPI = getRestAPIFactory().getRMSiteAPI();
-
- // Check RM Site Exist
- if (rmSiteAPI.existsRMSite())
- {
- // Delete RM Site
- rmSiteAPI.deleteRMSite();
- }
- //get file plan
- getRestAPIFactory().getFilePlansAPI().getFilePlan(FILE_PLAN_ALIAS);
-
- // Check the response code is NOT_FOUND
- assertStatusCode(NOT_FOUND);
- }
-
- /**
- *
- * Given that a file plan exists
- * When I ask the API for the details of the file plan
- * Then I am given the details of the file plan
- *
- */
- @Test
- public void getFilePlanWhenRMIsCreated()
- {
- // Create RM Site if doesn't exist
- createRMSiteIfNotExists();
-
- FilePlan filePlan = getRestAPIFactory().getFilePlansAPI().getFilePlan(FILE_PLAN_ALIAS);
-
- // Check the response code
- assertStatusCode(OK);
- //check file plan details
- assertEquals(FILE_PLAN_TYPE, filePlan.getNodeType());
- assertEquals(ContainerName.documentLibrary.toString(), filePlan.getName());
- }
-
- /**
- *
- * Given that a file plan exists
- * When I ask the API for the details of the file plan to include the allowableOperations property
- * Then I am given the allowableOperations property with the update and create operations.
- *
- */
- @Test
- public void includeAllowableOperations()
- {
- // Check the list of allowableOperations returned
- FilePlan filePlan = getRestAPIFactory().getFilePlansAPI().getFilePlan(FILE_PLAN_ALIAS, "include=" + ALLOWABLE_OPERATIONS);
-
- assertTrue(filePlan.getAllowableOperations().containsAll(asList(UPDATE, CREATE)),
- "Wrong list of the allowable operations is return" + filePlan.getAllowableOperations().toString());
-
- // Check the list of allowableOperations doesn't contain DELETE operation
- assertFalse(filePlan.getAllowableOperations().contains(DELETE),
- "The list of allowable operations contains delete option" + filePlan.getAllowableOperations().toString());
- }
-
- /**
- *
- * Given that RM site exists
- * When a non-RM user asks the API for the details of the file plan
- * Then the status code 403 (Permission denied) is return
- *
- */
- @Test
- public void getFilePlanWithNonRMuser()
- {
- // Create a random user
- UserModel nonRMuser = getDataUser().createRandomTestUser("testUser");
-
- // Get the special file plan components
- getRestAPIFactory().getFilePlansAPI(nonRMuser).getFilePlan(FILE_PLAN_ALIAS);
-
- // Check the response status code is FORBIDDEN
- assertStatusCode(FORBIDDEN);
- }
-
- /**
- * Given that a file plan exists
- * When I ask the API to modify the details of the file plan
- * Then the details of the file are modified
- * Note: the details of the file plan are limited to title and description.
- */
- @Test
- @Bug (id = "RM-4295")
- public void updateFilePlan()
- {
- String FILE_PLAN_DESCRIPTION = "Description updated " + getRandomAlphanumeric();
- String FILE_PLAN_TITLE = "Title updated " + getRandomAlphanumeric();
-
- // Build object for updating the filePlan
- FilePlan filePlanComponent = FilePlan.builder()
- .properties(FilePlanProperties.builder()
- .title(FILE_PLAN_TITLE)
- .description(FILE_PLAN_DESCRIPTION)
- .build())
- .build();
- // Create a random user
- UserModel nonRMuser = getDataUser().createRandomTestUser("testUser");
-
- // Update the file plan
- getRestAPIFactory().getFilePlansAPI(nonRMuser).updateFilePlan(filePlanComponent, FILE_PLAN_ALIAS);
-
- //Check the response status code is FORBIDDEN
- assertStatusCode(FORBIDDEN);
-
- // Update the file plan
- FilePlan renamedFilePlan = getRestAPIFactory().getFilePlansAPI().updateFilePlan(filePlanComponent, FILE_PLAN_ALIAS);
-
- // Verify the response status code
- assertStatusCode(OK);
-
- // Verify the returned description field for the file plan component
- assertEquals(FILE_PLAN_DESCRIPTION, renamedFilePlan.getProperties().getDescription());
-
- // Verify the returned title field for the file plan component
- assertEquals(FILE_PLAN_TITLE, renamedFilePlan.getProperties().getTitle());
- }
-
- /**
- * Given that a file plan exists
- * When I ask the API to modify the name of the file plan
- * Then a error is returned (422 response code)
- */
- @Test
- @Bug (id = "RM-4295")
- public void updateFilePlanName()
- {
- // Build object for updating the filePlan
- FilePlan filePlanComponent = FilePlan.builder()
- .name(getRandomName("File Plan name updated "))
- .build();
-
- // Update the file plan
- getRestAPIFactory().getFilePlansAPI().updateFilePlan(filePlanComponent, FILE_PLAN_ALIAS);
-
- // Verify the response status code
- assertStatusCode(UNPROCESSABLE_ENTITY);
- }
-
- /**
- *
- * Given that a file plan exists
- * When I ask the API to create a root record category
- * Then it is created as a root record category
- *
- *
- * Given that a file plan exists
- * When I use the API to create a folder (cm:folder type) into the fileplan
- * Then the folder is converted to rma:recordCategory
- * (see RM-4572 comments)
- *
- */
- @Test
- (
- description = "Create root category",
- dataProviderClass = DataProviderClass.class,
- dataProvider = "categoryTypes"
- )
- public void createFilePlanChildren(String nodeType)
- {
- String categoryName = "Category name " + getRandomAlphanumeric();
- String categoryTitle = "Category title " + getRandomAlphanumeric();
-
- // Create the root record category
- RecordCategory recordCategory = RecordCategory.builder()
- .name(categoryName)
- .properties(RecordCategoryProperties.builder()
- .title(categoryTitle)
- .build())
- .nodeType(nodeType)
- .build();
- RecordCategory rootRecordCategory = getRestAPIFactory().getFilePlansAPI()
- .createRootRecordCategory(recordCategory,FILE_PLAN_ALIAS);
-
- // Verify the status code
- assertStatusCode(CREATED);
-
- assertEquals(rootRecordCategory.getName(), categoryName);
- assertEquals(rootRecordCategory.getNodeType(), RECORD_CATEGORY_TYPE);
-
- assertEquals(rootRecordCategory.getCreatedByUser().getId(), getAdminUser().getUsername());
-
- // Verify the returned root record category properties
- RecordCategoryProperties rootRecordCategoryProperties = rootRecordCategory.getProperties();
- assertEquals(rootRecordCategoryProperties.getTitle(), categoryTitle);
- assertNotNull(rootRecordCategoryProperties.getIdentifier());
- }
-
- /**
- *
- * Given a root category
- * When I ask the API to create a root category having the same name
- * Then the response code received is 409 - name clashes with an existing node
- *
- *
- * Given a root category
- * When I ask the API to create a root category having the same name with autoRename parameter on true
- * Then the record category is created the record category has a unique name by adding an integer suffix
- *
- */
- @Test
- @Bug(id = "RM-5116")
- public void createDuplicateCategories()
- {
- String categoryName = "Category name " + getRandomAlphanumeric();
- String categoryTitle = "Category title " + getRandomAlphanumeric();
-
-
- // Create the root record category
- RecordCategory recordCategory = RecordCategory.builder()
- .name(categoryName)
- .properties(RecordCategoryProperties.builder()
- .title(categoryTitle)
- .build())
- .build();
- // Create the root record category
- RecordCategory rootRecordCategory = getRestAPIFactory().getFilePlansAPI().createRootRecordCategory(recordCategory,FILE_PLAN_ALIAS);
-
- // Verify the status code
- assertStatusCode(CREATED);
- assertEquals(rootRecordCategory.getName(), categoryName);
-
- // Create the same root record category
- getRestAPIFactory().getFilePlansAPI().createRootRecordCategory(recordCategory, FILE_PLAN_ALIAS);
-
- // Verify the status code
- assertStatusCode(CONFLICT);
-
- //create the same category with autoRename parameter on true
- RecordCategory rootRecordCategoryAutoRename = getRestAPIFactory().getFilePlansAPI()
- .createRootRecordCategory(recordCategory, FILE_PLAN_ALIAS,"autoRename=true");
-
- // Verify the status code
- assertStatusCode(CREATED);
- assertNotEquals(rootRecordCategoryAutoRename.getName(), categoryName);
- assertTrue(rootRecordCategoryAutoRename.getName().startsWith(categoryName));
- }
-
- @Test
- public void listFilePlanChildren()
- {
- //delete all the root categories
- getRestAPIFactory().getFilePlansAPI().getRootRecordCategories(FILE_PLAN_ALIAS).getEntries().forEach(recordCategoryEntry ->
- deleteRecordCategory(recordCategoryEntry.getEntry().getId()));
- // Add child folders
- ArrayList children = new ArrayList<>();
- for (int i = 0; i < NUMBER_OF_CHILDREN; i++)
- {
- String categoryName = "Category name " + getRandomAlphanumeric();
- String categoryTitle = "Category title " + getRandomAlphanumeric();
- // Create a record folder
- RecordCategory recordCategory = createRootCategory(categoryName, categoryTitle);
- assertNotNull(recordCategory.getId());
- children.add(recordCategory);
- }
-
- // Get record category children from API
- RecordCategoryCollection recordCategoryChildren = getRestAPIFactory().getFilePlansAPI()
- .getRootRecordCategories(FILE_PLAN_ALIAS, "include=aspects,properties");
-
- // Check status code
- assertStatusCode(OK);
-
- // Check children against created list
- recordCategoryChildren.getEntries().forEach(c ->
- {
- RecordCategory recordCategoryChild = c.getEntry();
- String recordCategoryChildId = recordCategoryChild.getId();
- assertNotNull(recordCategoryChildId);
- logger.info("Checking child " + recordCategoryChildId);
-
- try
- {
- // Find this child in created children list
- RecordCategory createdComponent = children.stream()
- .filter(child -> child.getId().equals(recordCategoryChildId))
- .findFirst()
- .orElseThrow();
-
- // Created by
- assertEquals(recordCategoryChild.getCreatedByUser().getId(), getAdminUser().getUsername());
-
- assertEquals(createdComponent.getName(), recordCategoryChild.getName());
- assertEquals(createdComponent.getNodeType(), recordCategoryChild.getNodeType());
-
- }
- catch (NoSuchElementException e)
- {
- fail("No child element for " + recordCategoryChildId);
- }
- }
- );
- }
-
- /**
- *
- * Given that RM site is created
- * When I use the API to create invalid types inside a file plan
- * Then the node type provided is converted to a record category
- *
- */
- @Test
- (
- description = "Create a record folder/unfiled container/unfiled folder/record/file plan container",
- dataProvider = "childrenNotAllowedForFilePlan"
- )
- public void createChildrenNotAllowedInFilePlan(String nodeType)
- {
- String componentName = "Component" + getRandomAlphanumeric();
-
- // Create the root record category
- RecordCategory component = RecordCategory.builder()
- .name(componentName)
- .nodeType(nodeType)
- .build();
- // Create the invalid node type
- RecordCategory rootRecordCategory = getRestAPIFactory().getFilePlansAPI()
- .createRootRecordCategory(component, FILE_PLAN_ALIAS);
- //check the response status code
- assertStatusCode(CREATED);
- assertEquals(rootRecordCategory.getName(), componentName);
- assertEquals(rootRecordCategory.getNodeType(), RECORD_CATEGORY_TYPE);
-
- assertEquals(rootRecordCategory.getCreatedByUser().getId(), getAdminUser().getUsername());
-
- // Verify the returned root record category properties
- assertNotNull(rootRecordCategory.getProperties().getIdentifier());
- }
-
- @Test
- public void listChildrenUserPermission()
- {
- // Create a random user
- UserModel managerUser = getDataUser().createRandomTestUser("managerUser");
-
- // Add child folders
- ArrayList children = new ArrayList<>();
- for (int i = 0; i < NUMBER_OF_CHILDREN/2; i++)
- {
- String categoryName = "Category name " + getRandomAlphanumeric();
- String categoryTitle = "Category title " + getRandomAlphanumeric();
- // Create a record folder
- RecordCategory recordCategory = createRootCategory(categoryName, categoryTitle);
- assertNotNull(recordCategory.getId());
- children.add(recordCategory);
- }
-
- getRestAPIFactory().getRMUserAPI().assignRoleToUser(managerUser.getUsername(), ROLE_RM_MANAGER.roleId);
- // Get record category children from API
- getRestAPIFactory().getFilePlansAPI(managerUser).getRootRecordCategories(FILE_PLAN_ALIAS)
- .assertThat().entriesListIsEmpty().assertThat().paginationExist();
-
- ArrayList childrenManager = new ArrayList<>();
- for (int i = 0; i < NUMBER_OF_CHILDREN / 2; i++)
- {
- String categoryName = "Category for manager " + getRandomAlphanumeric();
- String categoryTitle = "Category for manager " + getRandomAlphanumeric();
- // Create a record folder
- RecordCategory recordCategory = createRootCategory(categoryName, categoryTitle);
- assertNotNull(recordCategory.getId());
- getRestAPIFactory().getRMUserAPI().addUserPermission(recordCategory.getId(), managerUser, PERMISSION_FILING);
- childrenManager.add(recordCategory);
- }
- // Get record category children from API
- RecordCategoryCollection recordCategoryChildren = getRestAPIFactory().getFilePlansAPI(managerUser).getRootRecordCategories(FILE_PLAN_ALIAS);
-
- //Check children against created list
- recordCategoryChildren.getEntries().forEach(c ->
- {
- RecordCategory recordCategoryChild = c.getEntry();
- String recordCategoryChildId = recordCategoryChild.getId();
- assertNotNull(recordCategoryChildId);
- logger.info("Checking child " + recordCategoryChildId);
-
- try
- {
- // Find this child in created children list
- assertTrue(childrenManager.stream()
- .anyMatch(child -> child.getId().equals(recordCategoryChildId))
- );
- assertFalse(children.stream()
- .anyMatch(child -> child.getId().equals(recordCategoryChildId))
-
- );
- } catch (NoSuchElementException e)
- {
- fail("No child element for " + recordCategoryChildId);
- }
- }
- );
- }
-
-
-}
diff --git a/amps/ags/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/files/DeclareAndFileDocumentAsRecordTests.java b/amps/ags/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/files/DeclareAndFileDocumentAsRecordTests.java
deleted file mode 100644
index 383dff7c68..0000000000
--- a/amps/ags/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/files/DeclareAndFileDocumentAsRecordTests.java
+++ /dev/null
@@ -1,472 +0,0 @@
-/*
- * #%L
- * Alfresco Records Management Module
- * %%
- * Copyright (C) 2005 - 2021 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.files;
-
-import static org.alfresco.rest.rm.community.base.TestData.HOLD_DESCRIPTION;
-import static org.alfresco.rest.rm.community.base.TestData.HOLD_REASON;
-import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentAlias.FILE_PLAN_ALIAS;
-import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentAlias.TRANSFERS_ALIAS;
-import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentAlias.UNFILED_RECORDS_CONTAINER_ALIAS;
-import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentType.UNFILED_RECORD_FOLDER_TYPE;
-import static org.alfresco.rest.rm.community.model.user.UserPermissions.PERMISSION_FILING;
-import static org.alfresco.rest.rm.community.model.user.UserPermissions.PERMISSION_READ_RECORDS;
-import static org.alfresco.rest.rm.community.model.user.UserRoles.ROLE_RM_POWER_USER;
-import static org.alfresco.rest.rm.community.requests.gscore.api.FilesAPI.PARENT_ID_PARAM;
-import static org.alfresco.rest.v0.HoldsAPI.HOLDS_CONTAINER;
-import static org.alfresco.utility.data.RandomData.getRandomAlphanumeric;
-import static org.alfresco.utility.data.RandomData.getRandomName;
-import static org.alfresco.utility.report.log.Step.STEP;
-import static org.springframework.http.HttpStatus.ACCEPTED;
-import static org.springframework.http.HttpStatus.BAD_REQUEST;
-import static org.springframework.http.HttpStatus.CREATED;
-import static org.springframework.http.HttpStatus.FORBIDDEN;
-import static org.springframework.http.HttpStatus.NOT_FOUND;
-import static org.springframework.http.HttpStatus.UNPROCESSABLE_ENTITY;
-import static org.testng.Assert.assertEquals;
-import static org.testng.Assert.assertFalse;
-import static org.testng.Assert.assertTrue;
-
-import org.alfresco.dataprep.CMISUtil;
-import org.alfresco.rest.rm.community.base.BaseRMRestTest;
-import org.alfresco.rest.rm.community.model.record.Record;
-import org.alfresco.rest.rm.community.model.recordcategory.RecordCategory;
-import org.alfresco.rest.rm.community.model.recordcategory.RecordCategoryChild;
-import org.alfresco.rest.rm.community.model.unfiledcontainer.UnfiledContainerChild;
-import org.alfresco.rest.rm.community.util.DockerHelper;
-import org.alfresco.rest.v0.HoldsAPI;
-import org.alfresco.rest.v0.RMRolesAndActionsAPI;
-import org.alfresco.rest.v0.service.RoleService;
-import org.alfresco.test.AlfrescoTest;
-import org.alfresco.utility.Utility;
-import org.alfresco.utility.constants.UserRole;
-import org.alfresco.utility.model.FileModel;
-import org.alfresco.utility.model.FolderModel;
-import org.alfresco.utility.model.SiteModel;
-import org.alfresco.utility.model.UserModel;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.testng.annotations.AfterClass;
-import org.testng.annotations.BeforeClass;
-import org.testng.annotations.BeforeMethod;
-import org.testng.annotations.DataProvider;
-import org.testng.annotations.Test;
-
-/**
- * API tests for declaring document as record and filing it immediately to a record folder location within the file plan
- *
- * @author Claudia Agache
- * @since 3.1
- */
-@AlfrescoTest (jira = "RM-6779")
-public class DeclareAndFileDocumentAsRecordTests extends BaseRMRestTest
-{
- private final static String DESTINATION_PATH_NOT_FOUND_EXC = "Unable to execute create-record action, because the destination path could not be found.";
- private final static String INVALID_DESTINATION_PATH_EXC = "Unable to execute create-record action, because the destination path is invalid.";
- private final static String DESTINATION_PATH_NOT_RECORD_FOLDER_EXC = "Unable to execute create-record action, because the destination path is not a record folder.";
- private final static String CLOSED_RECORD_FOLDER_EXC = "You can't add new items to a closed record folder.";
- private final static String HOLD_NAME = getRandomName("holdName");
- private final static String RECORD_FOLDER_NAME_WITH_SPACE = "Folder With Spaces In Name";
-
- private UserModel userFillingPermission, userReadOnlyPermission;
- private SiteModel publicSite;
- private FolderModel testFolder;
- private FileModel testFile;
- private RecordCategory recordCategory;
- private RecordCategoryChild recordFolder, subcategoryRecordFolder, closedRecordFolder, recordFolderWithSpacesInName;
- private UnfiledContainerChild unfiledContainerFolder;
- private String holdNodeRef;
-
- @Autowired
- private DockerHelper dockerHelper;
-
- @Autowired
- private RoleService roleService;
-
- @Autowired
- private RMRolesAndActionsAPI rmRolesAndActionsAPI;
-
- @Autowired
- private HoldsAPI holdsAPI;
-
- /**
- * Invalid destination paths where in-place records can't be filed
- */
- @DataProvider (name = "invalidDestinationPaths")
- public Object[][] getInvalidDestinationPaths()
- {
- return new String[][]
- {
- { "/", DESTINATION_PATH_NOT_FOUND_EXC },
- { "Unfiled Records", INVALID_DESTINATION_PATH_EXC },
- { "Transfers", INVALID_DESTINATION_PATH_EXC },
- { "Holds", INVALID_DESTINATION_PATH_EXC },
- { "rm/documentlibrary", DESTINATION_PATH_NOT_FOUND_EXC },
- { recordCategory.getName(), DESTINATION_PATH_NOT_RECORD_FOLDER_EXC },
- // a closed record folder
- { Utility.buildPath(recordCategory.getName(), closedRecordFolder.getName()), CLOSED_RECORD_FOLDER_EXC},
- // an arbitrary unfiled records folder
- { "Unfiled Records/" + unfiledContainerFolder.getName(), INVALID_DESTINATION_PATH_EXC },
- // a collaboration site folder
- { testFolder.getCmisLocation(), DESTINATION_PATH_NOT_FOUND_EXC }
- };
- }
-
- /**
- * Invalid destination ids where in-place records can't be filed
- */
- @DataProvider (name = "invalidDestinationIds")
- public Object[][] getInvalidDestinationIds()
- {
- return new String[][]
- {
- { getFilePlan(FILE_PLAN_ALIAS).getId() },
- { getUnfiledContainer(UNFILED_RECORDS_CONTAINER_ALIAS).getId() },
- { getTransferContainer(TRANSFERS_ALIAS).getId() },
- { rmRolesAndActionsAPI.getItemNodeRef(getAdminUser().getUsername(), getAdminUser().getPassword(),
- "/" + HOLDS_CONTAINER) },
- { recordCategory.getId() },
- { unfiledContainerFolder.getId() },
- { testFolder.getNodeRef() }
- };
- }
-
- @BeforeClass (alwaysRun = true)
- public void declareAndFileDocumentAsRecordSetup()
- {
- STEP("Create test collaboration site to store documents in.");
- publicSite = dataSite.usingAdmin().createPublicRandomSite();
-
- STEP("Create a test folder within the collaboration site");
- testFolder = dataContent.usingAdmin().usingSite(publicSite).createFolder();
-
- STEP("Create record categories and record folders");
- recordCategory = createRootCategory(getRandomName("recordCategory"));
- RecordCategoryChild subCategory = createRecordCategory(recordCategory.getId(), getRandomName("subCategory"));
- recordFolder = createFolder(recordCategory.getId(), getRandomName("recordFolder"));
- subcategoryRecordFolder = createFolder(subCategory.getId(), getRandomName("recordFolder"));
- unfiledContainerFolder = createUnfiledContainerChild(UNFILED_RECORDS_CONTAINER_ALIAS,
- "Unfiled Folder " + getRandomAlphanumeric(), UNFILED_RECORD_FOLDER_TYPE);
- closedRecordFolder = createFolder(recordCategory.getId(), getRandomName("closedRecordFolder"));
- closeFolder(closedRecordFolder.getId());
- recordFolderWithSpacesInName = createFolder(recordCategory.getId(), RECORD_FOLDER_NAME_WITH_SPACE);
-
- STEP("Create rm users with different permissions on the record category");
- userFillingPermission = roleService.createCollaboratorWithRMRoleAndPermission(publicSite, recordCategory, ROLE_RM_POWER_USER, PERMISSION_FILING);
- userReadOnlyPermission = roleService.createCollaboratorWithRMRoleAndPermission(publicSite, recordCategory,
- ROLE_RM_POWER_USER, PERMISSION_READ_RECORDS);
- }
-
- @BeforeMethod(alwaysRun = true)
- public void createDocument()
- {
- STEP("Create a document in the collaboration site");
- testFile = dataContent.usingSite(publicSite)
- .usingAdmin()
- .createContent(CMISUtil.DocumentType.TEXT_PLAIN);
- }
-
- /**
- * Given I am calling the "declare as record" action
- * And I am not providing a location parameter value
- * When I execute the action
- * Then the document is declared as a record
- * And is placed in the Unfiled Records location
- */
- @Test
- public void declareAndFileNoLocationUsingActionsAPI() throws Exception
- {
- STEP("Declare document as record without providing a location parameter value using v1 actions api");
- getRestAPIFactory().getActionsAPI(userReadOnlyPermission).declareAsRecord(testFile);
-
- STEP("Verify the declared record is placed in the Unfiled Records folder");
- assertTrue(isMatchingRecordInUnfiledRecords(testFile), "Record should be filed to Unfiled Records folder");
-
- STEP("Verify the document in collaboration site is now a record");
- assertTrue(hasRecordAspect(testFile), "File should have record aspect");
- }
-
- /**
- * Given I am calling the "declare as record" action
- * And I provide a valid record folder in the location parameter
- * When I execute the action
- * Then the document is declared as a record
- * And is filed to the record folder specified
- */
- @Test
- public void declareAndFileToValidLocationUsingActionsAPI() throws Exception
- {
- STEP("Declare document as record with a location parameter value");
- getRestAPIFactory().getActionsAPI(userFillingPermission).declareAndFile(testFile,
- Utility.buildPath(recordCategory.getName(), recordFolder.getName()));
-
- STEP("Verify the declared record is placed in the record folder");
- assertTrue(isMatchingRecordInRecordFolder(testFile, recordFolder), "Record should be filed to record folder");
-
- STEP("Verify the document in collaboration site is now a record");
- assertTrue(hasRecordAspect(testFile), "File should have record aspect");
- }
-
- /**
- * Given I am calling the "declare as record" action
- * And I provide a valid record folder name in the location parameter
- * When I execute the action
- * Then the document is declared as a record
- * And is filed to the record folder specified
- */
- @Test
- public void declareAndFileToValidLocationWithSpacesUsingActionsAPI() throws Exception
- {
- STEP("Declare document as record with an encoded location parameter value");
- getRestAPIFactory().getActionsAPI(userFillingPermission).declareAndFile(testFile,
- Utility.buildPath(recordCategory.getName(), RECORD_FOLDER_NAME_WITH_SPACE));
-
- STEP("Verify the declared record is placed in the record folder");
- assertTrue(isMatchingRecordInRecordFolder(testFile, recordFolderWithSpacesInName), "Record should be filed to record folder");
-
- STEP("Verify the document in collaboration site is now a record");
- assertTrue(hasRecordAspect(testFile), "File should have record aspect");
- }
-
- /**
- * Given I am calling the "declare as record" action
- * And I provide an invalid record folder in the location parameter
- * When I execute the action
- * Then I receive an error indicating that I have attempted to declare and file a document into an invalid record folder
- * And the document is not declared as a record
- */
- @Test (dataProvider = "invalidDestinationPaths")
- public void declareAndFileToInvalidLocationUsingActionsAPI(String containerPath, String expectedException) throws Exception
- {
- STEP("Declare document as record with an invalid location parameter value");
- getRestAPIFactory().getActionsAPI().declareAndFile(testFile, containerPath);
- assertStatusCode(ACCEPTED);
-
- STEP("Check the exception thrown in alfresco logs");
- dockerHelper.checkExceptionIsInAlfrescoLogs(expectedException);
-
- STEP("Check that the file is not a record");
- assertFalse(hasRecordAspect(testFile), "File should not have record aspect");
- }
-
- /**
- * Given I declare a record using the v1 API
- * When I provide a location parameter
- * Then the record is declared in the correct location
- */
- @Test
- public void declareAndFileToValidLocationUsingFilesAPI() throws Exception
- {
- STEP("Declare document as record with a location parameter value");
- Record record = getRestAPIFactory().getFilesAPI(userFillingPermission)
- .usingParams(String.format("%s=%s", PARENT_ID_PARAM, recordFolder.getId()))
- .declareAsRecord(testFile.getNodeRefWithoutVersion());
- assertStatusCode(CREATED);
-
- STEP("Verify the declared record is placed in the record folder");
- assertEquals(record.getParentId(), recordFolder.getId(), "Record should be filed to record folder");
-
- STEP("Verify the document in collaboration site is now a record");
- assertTrue(hasRecordAspect(testFile), "File should have record aspect");
- }
-
- /**
- * Given I declare a record using the v1 API
- * When I provide an invalid record folder in the location parameter
- * Then I receive an error indicating that I have attempted to declare and file a document into an invalid record folder
- * And the document is not declared as a record
- */
- @Test (dataProvider = "invalidDestinationIds")
- public void declareAndFileToInvalidLocationUsingFilesAPI(String containerID) throws Exception
- {
- STEP("Declare document as record with an invalid location parameter value");
- getRestAPIFactory().getFilesAPI()
- .usingParams(String.format("%s=%s", PARENT_ID_PARAM, containerID))
- .declareAsRecord(testFile.getNodeRefWithoutVersion());
- assertStatusCode(BAD_REQUEST);
- getRestAPIFactory().getRmRestWrapper()
- .assertLastError()
- .containsSummary("is not valid for this endpoint. Expected nodeType is:{http://www.alfresco.org/model/recordsmanagement/1.0}recordFolder");
-
- STEP("Check that the file is not a record");
- assertFalse(hasRecordAspect(testFile), "File should not have record aspect");
- }
-
- /**
- * Given I am an user with read only permissions on a record folder
- * When I declare and file a record to the record folder
- * Then I receive an error indicating that the access is denied
- * And the document is not declared as a record
- */
- @Test
- public void declareAndFileByUserWithReadOnlyPermission() throws Exception
- {
- STEP("Declare document as record with a record folder as location parameter");
- getRestAPIFactory().getFilesAPI(userReadOnlyPermission)
- .usingParams(String.format("%s=%s", PARENT_ID_PARAM, recordFolder.getId()))
- .declareAsRecord(testFile.getNodeRefWithoutVersion());
- assertStatusCode(FORBIDDEN);
-
- STEP("Check that the file is not a record");
- assertFalse(hasRecordAspect(testFile), "File should not have record aspect");
- }
-
- /**
- * Given I am a non RM user
- * When I declare and file a record to the record folder
- * Then I receive an error indicating that the access is denied
- * And the document is not declared as a record
- */
- @Test
- public void declareAndFileByNonRMUser() throws Exception
- {
- STEP("Create an user with no rm rights");
- UserModel nonRMUser = getDataUser().createRandomTestUser();
- getDataUser().addUserToSite(nonRMUser, publicSite, UserRole.SiteCollaborator);
-
- STEP("Declare document as record with a record folder as location parameter");
- getRestAPIFactory().getFilesAPI(nonRMUser)
- .usingParams(String.format("%s=%s", PARENT_ID_PARAM, recordFolder.getId()))
- .declareAsRecord(testFile.getNodeRefWithoutVersion());
- assertStatusCode(FORBIDDEN);
-
- STEP("Check that the file is not a record");
- assertFalse(hasRecordAspect(testFile), "File should not have record aspect");
- }
-
- /**
- * Given I declare a record using the v1 API
- * When I provide a nonexistent record folder in the location parameter
- * Then I receive an error indicating that the record folder does not exist
- * And the document is not declared as a record
- */
- @Test
- public void declareAndFileToNonexistentRecordFolderUsingFilesAPI() throws Exception
- {
- STEP("Declare document as record with a nonexistent location parameter value");
- getRestAPIFactory().getFilesAPI()
- .usingParams(String.format("%s=%s", PARENT_ID_PARAM, "nonexistent"))
- .declareAsRecord(testFile.getNodeRefWithoutVersion());
- assertStatusCode(NOT_FOUND);
-
- STEP("Check that the file is not a record");
- assertFalse(hasRecordAspect(testFile), "File should not have record aspect");
- }
-
- /**
- * Given I declare a record using the v1 API
- * When I provide a closed record folder in the location parameter
- * Then I receive an error indicating that the record folder is closed
- * And the document is not declared as a record
- */
- @Test
- public void declareAndFileToClosedRecordFolderUsingFilesAPI() throws Exception
- {
- STEP("Declare document as record with a closed location parameter value");
- getRestAPIFactory().getFilesAPI()
- .usingParams(String.format("%s=%s", PARENT_ID_PARAM, closedRecordFolder.getId()))
- .declareAsRecord(testFile.getNodeRefWithoutVersion());
- assertStatusCode(UNPROCESSABLE_ENTITY);
- getRestAPIFactory().getRmRestWrapper()
- .assertLastError()
- .containsSummary(CLOSED_RECORD_FOLDER_EXC);
-
- STEP("Check that the file is not a record");
- assertFalse(hasRecordAspect(testFile), "File should not have record aspect");
- }
-
- /**
- * Given I declare a record using the v1 API
- * When I provide a held record folder in the location parameter
- * Then I receive an error indicating that the record folder is held
- * And the document is not declared as a record
- */
- @Test
- public void declareAndFileToHeldRecordFolderUsingFilesAPI() throws Exception
- {
- RecordCategoryChild heldRecordFolder = createFolder(recordCategory.getId(), getRandomName("heldRecordFolder"));
- holdNodeRef = holdsAPI.createHoldAndGetNodeRef(getAdminUser().getUsername(), getAdminUser().getPassword(), HOLD_NAME, HOLD_REASON, HOLD_DESCRIPTION);
- holdsAPI.addItemToHold(getAdminUser().getUsername(), getAdminUser().getPassword(), heldRecordFolder.getId(),
- HOLD_NAME);
-
- STEP("Declare document as record with a frozen location parameter value");
- getRestAPIFactory().getFilesAPI()
- .usingParams(String.format("%s=%s", PARENT_ID_PARAM, heldRecordFolder.getId()))
- .declareAsRecord(testFile.getNodeRefWithoutVersion());
- assertStatusCode(UNPROCESSABLE_ENTITY);
-
- STEP("Check that the file is not a record");
- assertFalse(hasRecordAspect(testFile), "File should not have record aspect");
- }
-
- /**
- * Given I declare a record using the v1 API
- * When I provide a location parameter
- * Then the record is declared in the correct location
- * And when I declare it again using a different location
- * Then I get an invalid operation exception
- */
- @Test
- public void declareAndFileTwiceDifferentLocations()
- {
- STEP("Create a document in the collaboration site");
- FileModel testFile = dataContent.usingSite(publicSite).usingAdmin()
- .createContent(CMISUtil.DocumentType.TEXT_PLAIN);
-
- STEP("Declare document as record with a record folder as location parameter");
- getRestAPIFactory().getFilesAPI(userFillingPermission)
- .usingParams(String.format("%s=%s", PARENT_ID_PARAM, subcategoryRecordFolder.getId()))
- .declareAsRecord(testFile.getNodeRefWithoutVersion());
- assertStatusCode(CREATED);
-
- STEP("Declare it again using a different record folder as location parameter");
- getRestAPIFactory().getFilesAPI(userFillingPermission)
- .usingParams(String.format("%s=%s", PARENT_ID_PARAM, recordFolder.getId()))
- .declareAsRecord(testFile.getNodeRefWithoutVersion());
- assertStatusCode(UNPROCESSABLE_ENTITY);
-
- STEP("Verify the declared record is placed in the first record folder");
- assertTrue(isMatchingRecordInRecordFolder(testFile, subcategoryRecordFolder),
- "Record should be filed to recordFolder");
- assertFalse(isMatchingRecordInRecordFolder(testFile, recordFolder),
- "Record should not be filed to subcategoryRecordFolder");
- }
-
- @AfterClass(alwaysRun = true)
- public void declareAndFileDocumentAsRecordCleanup()
- {
- //delete rm items
- holdsAPI.deleteHold(getAdminUser(), holdNodeRef);
- deleteRecordCategory(recordCategory.getId());
- getRestAPIFactory().getUnfiledRecordFoldersAPI().deleteUnfiledRecordFolder(unfiledContainerFolder.getId());
-
- //delete created collaboration site
- dataSite.deleteSite(publicSite);
-
- //delete users
- getDataUser().deleteUser(userFillingPermission);
- getDataUser().deleteUser(userReadOnlyPermission);
- }
-}
diff --git a/amps/ags/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/files/DeclareDocumentAsRecordTests.java b/amps/ags/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/files/DeclareDocumentAsRecordTests.java
deleted file mode 100644
index 6f812729e2..0000000000
--- a/amps/ags/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/files/DeclareDocumentAsRecordTests.java
+++ /dev/null
@@ -1,370 +0,0 @@
-/*
- * #%L
- * Alfresco Records Management Module
- * %%
- * Copyright (C) 2005 - 2021 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.files;
-
-import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentAlias.UNFILED_RECORDS_CONTAINER_ALIAS;
-import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentType.NON_ELECTRONIC_RECORD_TYPE;
-import static org.alfresco.utility.report.log.Step.STEP;
-import static org.springframework.http.HttpStatus.CREATED;
-import static org.springframework.http.HttpStatus.FORBIDDEN;
-import static org.springframework.http.HttpStatus.UNPROCESSABLE_ENTITY;
-import static org.testng.Assert.assertEquals;
-import static org.testng.Assert.assertFalse;
-
-import java.io.InputStream;
-import java.util.List;
-import java.util.stream.Collectors;
-
-import org.alfresco.dataprep.CMISUtil;
-import org.alfresco.rest.model.RestNodeModel;
-import org.alfresco.rest.rm.community.base.BaseRMRestTest;
-import org.alfresco.rest.rm.community.model.record.Record;
-import org.alfresco.rest.rm.community.model.record.RecordProperties;
-import org.alfresco.rest.rm.community.model.unfiledcontainer.UnfiledContainerChildEntry;
-import org.alfresco.rest.rm.community.requests.gscore.api.UnfiledContainerAPI;
-import org.alfresco.rest.v0.RecordsAPI;
-import org.alfresco.test.AlfrescoTest;
-import org.alfresco.utility.constants.UserRole;
-import org.alfresco.utility.model.FileModel;
-import org.alfresco.utility.model.FolderModel;
-import org.alfresco.utility.model.SiteModel;
-import org.alfresco.utility.model.UserModel;
-import org.apache.chemistry.opencmis.client.api.Document;
-import org.apache.chemistry.opencmis.client.api.SecondaryType;
-import org.apache.commons.codec.digest.DigestUtils;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.testng.annotations.BeforeClass;
-import org.testng.annotations.Test;
-
-/**
- * Tests for Declare Documents as Records Action API
- *
- * @author Kristijan Conkas
- * @since 2.6
- */
-public class DeclareDocumentAsRecordTests extends BaseRMRestTest
-{
- private UserModel testUser, testUserReadOnly;
- private SiteModel testSite;
- private FolderModel testFolder;
-
- @Autowired
- RecordsAPI recordsAPI;
-
- @BeforeClass(alwaysRun=true)
- public void declareDocumentAsRecordSetup()
- {
- // create test user and test collaboration site to store documents in
- testUser = getDataUser().createRandomTestUser();
- testUserReadOnly = getDataUser().createRandomTestUser();
-
- testSite = dataSite.usingAdmin().createPublicRandomSite();
-
- getDataUser().addUserToSite(testUser, testSite, UserRole.SiteContributor);
- getDataUser().addUserToSite(testUserReadOnly, testSite, UserRole.SiteConsumer);
-
- testFolder = dataContent.usingSite(testSite).usingUser(testUser).createFolder();
- }
-
- /**
- *
- * Given a document that is not a record
- * And I have write permissions on the document
- * When I declare the document as a record
- * Then it is successfully moved into the unfiled record container
- * And it is renamed to reflect the record identifier
- * And it is now a record
- * And it remains a secondary child of the starting location where I can still view it
- *
- *
- * RM-6779
- * Given I declare a record using the v1 API
- * When I do not provide a location parameter
- * Then the record is declared in the unfiled folder
- *
- * @throws Exception for malformed JSON API response
- */
- @Test(description = "User with correct permissions can declare document as a record")
- @AlfrescoTest(jira = "RM-4429, RM-6779")
- public void userWithPrivilegesCanDeclareDocumentAsRecord() throws Exception
- {
- // create document in a folder in a collaboration site
- FileModel document = dataContent.usingSite(testSite)
- .usingUser(testUser)
- .usingResource(testFolder)
- .createContent(CMISUtil.DocumentType.TEXT_PLAIN);
-
- // declare document as record
- Record record = getRestAPIFactory().getFilesAPI(testUser).declareAsRecord(document.getNodeRefWithoutVersion());
- assertStatusCode(CREATED);
-
- // verify the declared record is in Unfiled Records folder
- UnfiledContainerAPI unfiledContainersAPI = getRestAPIFactory().getUnfiledContainersAPI();
- List matchingRecords = unfiledContainersAPI.getUnfiledContainerChildren(UNFILED_RECORDS_CONTAINER_ALIAS)
- .getEntries()
- .stream()
- .filter(e -> e.getEntry().getId().equals(document.getNodeRefWithoutVersion()))
- .collect(Collectors.toList());
- // there should be only one matching record corresponding this document
- assertEquals(matchingRecords.size(), 1, "More than one record matching document name");
-
- // verify the original file in collaboration site has been renamed to reflect the record identifier
- List filesAfterRename = getRestAPIFactory().getNodeAPI(testFolder)
- .listChildren()
- .getEntries()
- .stream()
- .filter(f -> f.onModel().getId().equals(document.getNodeRefWithoutVersion()))
- .collect(Collectors.toList());
- assertEquals(filesAfterRename.size(), 1, "There should be only one file in folder " + testFolder.getName());
-
- // verify the new name has the form of " ()."
- String recordName = filesAfterRename.get(0).onModel().getName();
- assertEquals(recordName, document.getName().replace(".", String.format(" (%s).", record.getProperties().getIdentifier())));
-
- // verify the document in collaboration site is now a record, note the file is now renamed hence folder + doc. name concatenation
- // this also verifies the document is still in the initial folder
- Document documentPostFiling = dataContent.usingSite(testSite)
- .usingUser(testUser)
- .getCMISDocument(testFolder.getCmisLocation() + "/" + recordName);
-
- // a document is a record if "Record" is one of its secondary types
- List documentSecondary = documentPostFiling.getSecondaryTypes()
- .stream()
- .filter(t -> t.getDisplayName().equals("Record"))
- .collect(Collectors.toList());
- assertFalse(documentSecondary.isEmpty(), "Document is not a record");
-
- // verify the document is readable and has same content as corresponding record
- try
- (
- InputStream recordInputStream = getRestAPIFactory().getRecordsAPI().getRecordContent(record.getId()).asInputStream();
- InputStream documentInputStream = documentPostFiling.getContentStream().getStream()
- )
- {
- assertEquals(DigestUtils.sha1(recordInputStream), DigestUtils.sha1(documentInputStream));
- }
- }
-
- /**
- *
- * Given a document that is not a record
- * And I have read permissions on the document
- * When I declare the document as a record
- * Then I get a permission denied exception
- *
- * @throws Exception for malformed JSON API response
- */
- @Test(description = "User with read-only permissions can't declare document a record")
- @AlfrescoTest(jira = "RM-4429")
- public void userWithReadPermissionsCantDeclare() throws Exception
- {
- // create document in a folder in a collaboration site
- FileModel document = dataContent.usingSite(testSite)
- .usingUser(testUser)
- .usingResource(testFolder)
- .createContent(CMISUtil.DocumentType.TEXT_PLAIN);
-
- // declare document as record as testUserReadOnly
- getRestAPIFactory().getFilesAPI(testUserReadOnly).declareAsRecord(document.getNodeRefWithoutVersion());
- assertStatusCode(FORBIDDEN);
-
- // verify the document is still in the original folder
- List filesAfterRename = getRestAPIFactory().getNodeAPI(testFolder)
- .listChildren()
- .getEntries()
- .stream()
- .filter(f -> f.onModel().getId().equals(document.getNodeRefWithoutVersion()))
- .collect(Collectors.toList());
- assertEquals(filesAfterRename.size(), 1, "Declare as record failed but original document is missing");
- }
-
- /**
- *
- * Given a record
- * When I declare the record as a record
- * Then I get a invalid operation exception
- *
- */
- @Test(description = "Record can't be declared a record")
- @AlfrescoTest(jira = "RM-4429")
- public void recordCantBeDeclaredARecord()
- {
- // create a non-electronic record in a random folder
- Record nonelectronicRecord = Record.builder()
- .properties(RecordProperties.builder()
- .description("Description")
- .title("Title")
- .build())
- .name("Non-Electronic Record")
- .nodeType(NON_ELECTRONIC_RECORD_TYPE)
- .build();
- Record record = getRestAPIFactory().getRecordFolderAPI()
- .createRecord(nonelectronicRecord, createCategoryFolderInFilePlan().getId());
- assertStatusCode(CREATED);
-
- // try to declare it as a record
- getRestAPIFactory().getFilesAPI().declareAsRecord(record.getId());
- assertStatusCode(UNPROCESSABLE_ENTITY);
- }
-
- /**
- *
- * Given a node that is NOT a document
- * When I declare the node as a record
- * Then I get a invalid operation exception
- *
- */
- @Test(description = "Node that is not a document can't be declared a record")
- @AlfrescoTest(jira = "RM-4429")
- public void nonDocumentCantBeDeclaredARecord()
- {
- FolderModel otherTestFolder = dataContent.usingSite(testSite).usingUser(testUser).createFolder();
-
- // try to declare otherTestFolder as a record
- getRestAPIFactory().getFilesAPI().declareAsRecord(otherTestFolder.getNodeRefWithoutVersion());
- assertStatusCode(UNPROCESSABLE_ENTITY);
- }
-
- /**
- * Given a file that has version declared as record
- * When the file is declared as record
- * Then the action is successful
- */
- @Test (description = "Declaring as record a file that already has its version declared as record is successful")
- @AlfrescoTest (jira = "RM-6786")
- public void declareAsRecordAFileWithARecordVersion()
- {
- STEP("Create a file.");
- FileModel testFile = dataContent.usingAdmin().usingSite(testSite).createContent(CMISUtil.DocumentType.TEXT_PLAIN);
-
- STEP("Declare file version as record and check that record is successfully created.");
- recordsAPI.declareDocumentVersionAsRecord(getAdminUser().getUsername(), getAdminUser().getPassword(), testSite.getId(),
- testFile.getName());
-
- STEP("Declare file as record and check that record is successfully created.");
- getRestAPIFactory().getFilesAPI().declareAsRecord(testFile.getNodeRefWithoutVersion());
- assertStatusCode(CREATED);
- }
-
-// @Test(description = "Create 500 documents and declare them ass records concurently.")
-// public void declare500DocumentsAsRecordsConcurrently() throws Exception
-// {
-// FolderModel testFolder1 = dataContent.usingSite(testSite).usingUser(testUser).createFolder();
-// // create 500 documents in a folder in a collaboration site
-// List listOfDocuments = new ArrayList();
-// for(int i = 0; i < 500; i++)
-// {
-// FileModel document = dataContent.usingSite(testSite)
-// .usingUser(testUser)
-// .usingResource(testFolder1)
-// .createContent(CMISUtil.DocumentType.TEXT_PLAIN);
-// listOfDocuments.add(document);
-// }
-//
-// UnfiledContainerAPI unfiledContainersAPI = getRestAPIFactory().getUnfiledContainersAPI();
-// String unfiledContainerId = unfiledContainersAPI.getUnfiledContainer(UNFILED_RECORDS_CONTAINER_ALIAS).getId();
-// Counter.initSuccessCount(0);
-// Counter.initFailCount(0);
-// ExecutorService pool = Executors.newFixedThreadPool(16);
-// for (FileModel document : listOfDocuments)
-// {
-// pool.submit(new Task(document, unfiledContainerId));
-// }
-// pool.shutdown();
-// pool.awaitTermination(120L, TimeUnit.SECONDS);
-//
-// assertEquals(Counter.getSuccessCount(), 500 - Counter.getFailCount());
-// }
-//
-// class Task implements Runnable
-// {
-// private FileModel document;
-// private String unfiledContainerId;
-// public Task(FileModel document, String unfiledContainerId)
-// {
-// this.document = document;
-// this.unfiledContainerId = unfiledContainerId;
-// }
-//
-// @Override
-// public void run()
-// {
-// String parentId = "";
-// try
-// {
-// Record record = getRestAPIFactory().getFilesAPI(testUser).declareAsRecord(document.getNodeRefWithoutVersion());
-// assertStatusCode(CREATED);
-//
-// parentId = record.getParentId();
-// }
-// catch (Exception e)
-// {
-// Counter.incrementFailCount();
-// fail("Should not be here");
-// }
-//
-// assertEquals(parentId, unfiledContainerId, "Declare as record was unsuccessful.");
-// Counter.incrementSuccessCount();
-// }
-// }
-//
-// static class Counter
-// {
-// private static int successCount;
-// private static int failCount;
-//
-// public static void initSuccessCount(int initialCount)
-// {
-// successCount = initialCount;
-// }
-//
-// public static void initFailCount(int initialCount)
-// {
-// failCount = initialCount;
-// }
-//
-// public static synchronized void incrementSuccessCount()
-// {
-// successCount++;
-// }
-//
-// public static int getSuccessCount()
-// {
-// return successCount;
-// }
-//
-// public static synchronized void incrementFailCount()
-// {
-// failCount++;
-// }
-//
-// public static int getFailCount()
-// {
-// return failCount;
-// }
-// }
-}
diff --git a/amps/ags/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/files/FileVersionAsRecordTests.java b/amps/ags/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/files/FileVersionAsRecordTests.java
deleted file mode 100644
index ac104015f1..0000000000
--- a/amps/ags/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/files/FileVersionAsRecordTests.java
+++ /dev/null
@@ -1,298 +0,0 @@
-/*-
- * #%L
- * Alfresco Records Management Module
- * %%
- * Copyright (C) 2005 - 2021 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.files;
-
-import static org.alfresco.rest.rm.community.base.TestData.HOLD_DESCRIPTION;
-import static org.alfresco.rest.rm.community.base.TestData.HOLD_REASON;
-import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentAlias.UNFILED_RECORDS_CONTAINER_ALIAS;
-import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentType.UNFILED_RECORD_FOLDER_TYPE;
-import static org.alfresco.rest.rm.community.model.user.UserPermissions.PERMISSION_FILING;
-import static org.alfresco.rest.rm.community.model.user.UserPermissions.PERMISSION_READ_RECORDS;
-import static org.alfresco.rest.rm.community.model.user.UserRoles.ROLE_RM_POWER_USER;
-import static org.alfresco.utility.data.RandomData.getRandomAlphanumeric;
-import static org.alfresco.utility.data.RandomData.getRandomName;
-import static org.alfresco.utility.report.log.Step.STEP;
-import static org.springframework.http.HttpStatus.ACCEPTED;
-import static org.testng.Assert.assertFalse;
-import static org.testng.Assert.assertTrue;
-
-import java.io.File;
-
-import org.alfresco.dataprep.CMISUtil;
-import org.alfresco.rest.rm.community.base.BaseRMRestTest;
-import org.alfresco.rest.rm.community.model.recordcategory.RecordCategory;
-import org.alfresco.rest.rm.community.model.recordcategory.RecordCategoryChild;
-import org.alfresco.rest.rm.community.model.unfiledcontainer.UnfiledContainerChild;
-import org.alfresco.rest.rm.community.util.DockerHelper;
-import org.alfresco.rest.v0.HoldsAPI;
-import org.alfresco.rest.v0.service.RoleService;
-import org.alfresco.test.AlfrescoTest;
-import org.alfresco.utility.Utility;
-import org.alfresco.utility.model.FileModel;
-import org.alfresco.utility.model.FolderModel;
-import org.alfresco.utility.model.SiteModel;
-import org.alfresco.utility.model.UserModel;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.testng.annotations.AfterClass;
-import org.testng.annotations.BeforeClass;
-import org.testng.annotations.BeforeMethod;
-import org.testng.annotations.DataProvider;
-import org.testng.annotations.Test;
-
-/**
- * API tests for declaring a document version as record and filing to a record folder location within the file plan
- *
- * @author Rodica Sutu
- * @since 3.4
- */
-@AlfrescoTest (jira = "APPS-35")
-public class FileVersionAsRecordTests extends BaseRMRestTest
-{
- private final static String DESTINATION_PATH_NOT_FOUND_EXC = "Unable to execute declare-version-record action, " +
- "because the destination path could not be found.";
- private final static String INVALID_DESTINATION_PATH_EXC = "Unable to execute declare-version-record action, " +
- "because the destination path is invalid.";
- private final static String DESTINATION_PATH_NOT_RECORD_FOLDER_EXC = "Unable to execute declare-version-record " +
- "action, because the destination path is not a record folder.";
- private final static String ACCESS_DENIED_EXC = "Access Denied. You do not have the appropriate " +
- "permissions to perform this operation.";
- private final static String HOLD_NAME = getRandomName("holdName");
-
- private UserModel userFillingPermission, userReadOnlyPermission;
- private SiteModel publicSite;
- private FileModel testFile;
- private FolderModel testFolder;
- private RecordCategory recordCategory;
- private RecordCategoryChild recordFolder, closedRecordFolder, heldRecordFolder;
- private UnfiledContainerChild unfiledContainerFolder;
- private String holdNodeRef;
-
- @Autowired
- private RoleService roleService;
- @Autowired
- private DockerHelper dockerHelper;
- @Autowired
- private HoldsAPI holdsAPI;
-
- @BeforeClass (alwaysRun = true)
- public void declareAndFileVersionAsRecordSetup()
- {
- STEP("Create test collaboration site to store documents in.");
- publicSite = dataSite.usingAdmin().createPublicRandomSite();
-
- STEP("Create a test folder within the collaboration site");
- testFolder = dataContent.usingAdmin().usingSite(publicSite).createFolder();
-
- STEP("Create record categories and record folders");
- recordCategory = createRootCategory(getRandomName("recordCategory"));
- recordFolder = createFolder(recordCategory.getId(), getRandomName("recordFolder"));
- closedRecordFolder = createFolder(recordCategory.getId(), getRandomName("closedRecordFolder"));
- closeFolder(closedRecordFolder.getId());
- unfiledContainerFolder = createUnfiledContainerChild(UNFILED_RECORDS_CONTAINER_ALIAS,
- "Unfiled Folder " + getRandomAlphanumeric(), UNFILED_RECORD_FOLDER_TYPE);
- heldRecordFolder = createFolder(recordCategory.getId(), getRandomName("heldRecordFolder"));
- holdNodeRef = holdsAPI.createHoldAndGetNodeRef(getAdminUser().getUsername(), getAdminUser().getPassword(), HOLD_NAME, HOLD_REASON, HOLD_DESCRIPTION);
- holdsAPI.addItemToHold(getAdminUser().getUsername(), getAdminUser().getPassword(), heldRecordFolder.getId(),
- HOLD_NAME);
-
- STEP("Create rm users with different permissions on the record category");
- userFillingPermission = roleService.createCollaboratorWithRMRoleAndPermission(publicSite, recordCategory,
- ROLE_RM_POWER_USER, PERMISSION_FILING);
- userReadOnlyPermission = roleService.createCollaboratorWithRMRoleAndPermission(publicSite, recordCategory,
- ROLE_RM_POWER_USER, PERMISSION_READ_RECORDS);
- }
-
- @BeforeMethod (alwaysRun = true)
- public void createDocument()
- {
- STEP("Create a document in the collaboration site");
- testFile = dataContent.usingSite(publicSite)
- .usingAdmin()
- .createContent(CMISUtil.DocumentType.TEXT_PLAIN);
- }
-
- /**
- * Given I am calling the "declare version as record" action
- * And I am not providing a location parameter value
- * When I execute the action
- * Then the document is declared as a version record
- * And is placed in the Unfiled Records location
- */
- @Test
- public void declareVersionAndFileNoLocationUsingActionsAPI() throws Exception
- {
- STEP("Declare document version as record without providing a location parameter value using v1 actions api");
- getRestAPIFactory().getActionsAPI(userReadOnlyPermission).declareVersionAsRecord(testFile);
-
- STEP("Verify the declared version record is placed in the Unfiled Records folder and is a record version");
- assertTrue(isRecordVersionInUnfiledRecords(testFile, "1.0"), "Version record should be filed to Unfiled " +
- "Records folder");
- }
-
- /**
- * Given I am calling the "declare version as record" action
- * And I provide a valid record folder in the location parameter
- * When I execute the action
- * Then the document is declared as a version record
- * And is filed to the record folder specified
- */
- @Test
- public void fileVersionAsRecordToValidLocationUsingActionsAPI() throws Exception
- {
- STEP("Declare document version as record with a location parameter value");
- getRestAPIFactory().getActionsAPI(userFillingPermission).declareAndFileVersionAsRecord(testFile,
- Utility.buildPath(recordCategory.getName(), recordFolder.getName()));
-
- STEP("Verify the declared version record is placed in the record folder");
- assertTrue(isRecordVersionInRecordFolder(testFile, recordFolder, "1.0"), "Record version should be filed to " +
- "record folder");
- }
-
- /**
- * Invalid destination paths where version records can't be filed
- */
- @DataProvider (name = "invalidDestinationPaths")
- public Object[][] getInvalidDestinationPaths()
- {
- return new String[][]
- {
- { "/", DESTINATION_PATH_NOT_FOUND_EXC },
- { "Unfiled Records", INVALID_DESTINATION_PATH_EXC },
- { "Transfers", INVALID_DESTINATION_PATH_EXC },
- { "Holds", INVALID_DESTINATION_PATH_EXC },
- { "rm/documentlibrary", DESTINATION_PATH_NOT_FOUND_EXC },
- { recordCategory.getName(), DESTINATION_PATH_NOT_RECORD_FOLDER_EXC },
- // a closed record folder
- { Utility.buildPath(recordCategory.getName(), closedRecordFolder.getName()),
- ACCESS_DENIED_EXC },
- // a frozen record folder
- { Utility.buildPath(recordCategory.getName(), heldRecordFolder.getName()),
- ACCESS_DENIED_EXC },
- // an arbitrary unfiled records folder
- { "Unfiled Records/" + unfiledContainerFolder.getName(), INVALID_DESTINATION_PATH_EXC },
- // a collaboration site folder
- { testFolder.getCmisLocation(), DESTINATION_PATH_NOT_FOUND_EXC }
- };
- }
-
- /**
- * Given I am calling the "declare version as record" action
- * And I provide an invalid record folder in the path parameter
- * When I execute the action
- * Then I receive an error indicating that I have attempted to file version as record a document into an invalid
- * record folder
- * And the document is not declared as a version record
- */
- @Test (dataProvider = "invalidDestinationPaths")
- public void declareVersionAndFileToInvalidLocationUsingActionsAPI(String containerPath, String expectedException) throws Exception
- {
- STEP("Declare document as record version with an invalid location parameter value");
- getRestAPIFactory().getActionsAPI().declareAndFileVersionAsRecord(testFile, containerPath);
- assertStatusCode(ACCEPTED);
-
- STEP("Check the exception thrown in alfresco logs");
- dockerHelper.checkExceptionIsInAlfrescoLogs(expectedException);
- }
-
- /**
- * Given I am an user with read only permissions on a record folder
- * When I declare and file a version record to the record folder
- * Then I receive an error indicating that the access is denied
- * And the document is not declared as a record
- */
- @Test
- public void declareAndFileByUserWithReadOnlyPermission() throws Exception
- {
- STEP("Declare document as record with a record folder as location parameter");
- getRestAPIFactory().getActionsAPI(userReadOnlyPermission).declareAndFileVersionAsRecord(testFile,
- Utility.buildPath(recordCategory.getName(), recordFolder.getName()));
-
- STEP("Check that the record version is not added to the record folder");
- assertFalse(isRecordVersionInRecordFolder(testFile, recordFolder, "1.0"), "Record version is filed to " +
- "record folder where the user doesn't have filling permission");
- }
-
- /**
- * Given I am calling the "declare version as record" action for a minor document version
- * And I am not providing a path parameter value
- * When I execute the action
- * Then the document version is declared as a version record
- * And is placed in the Unfiled Records location
- */
- @Test
- public void declareVersionAsRecordMinorVersionUsingActionsAPI() throws Exception
- {
- STEP("Update document in the collaboration site");
- dataContent.usingSite(publicSite).usingAdmin().usingResource(testFile).updateContent("This is the new content" +
- "for " + testFile.getName());
-
- STEP("Declare document version as record with providing a location parameter value using v1 actions api");
- getRestAPIFactory().getActionsAPI(userFillingPermission).declareAndFileVersionAsRecord(testFile,
- Utility.buildPath(recordCategory.getName(), recordFolder.getName()));
-
- STEP("Verify the declared version record is placed in the record folder and is a record version");
- assertTrue(isRecordVersionInRecordFolder(testFile, recordFolder, "1.1"), "Record should be filed to fileplan " +
- "location");
- }
-
- /**
- * Given I am calling the "declare version as record" action for a major document version
- * And I am not providing a path parameter value
- * When I execute the action
- * Then the document version is declared as a version record version
- * And is placed in the Unfiled Records location
- */
- @Test
- public void declareVersionAsRecordMajorVersionUsingActionsAPI() throws Exception
- {
- STEP("Update document in the collaboration site");
- File sampleFile = Utility.getResourceTestDataFile("SampleTextFile_10kb.txt");
- restClient.authenticateUser(getAdminUser()).withCoreAPI().usingParams("majorVersion=true").usingNode(testFile).updateNodeContent(sampleFile);
-
- STEP("Declare document version as record with providing a location parameter value using v1 actions api");
- getRestAPIFactory().getActionsAPI(userFillingPermission).declareAndFileVersionAsRecord(testFile,
- Utility.buildPath(recordCategory.getName(), recordFolder.getName()));
-
- STEP("Verify the declared version record is placed in the record folder and is a record version");
- assertTrue(isRecordVersionInRecordFolder(testFile, recordFolder, "2.0"), "Version record should be filed to " +
- "the record folder");
- }
-
- @AfterClass (alwaysRun = true)
- public void declareAndFileVersionAsRecordCleanUp()
- {
- holdsAPI.deleteHold(getAdminUser(), holdNodeRef);
- deleteRecordCategory(recordCategory.getId());
-
- //delete created collaboration site
- dataSite.deleteSite(publicSite);
-
- //delete users
- getDataUser().deleteUser(userFillingPermission);
- getDataUser().deleteUser(userReadOnlyPermission);
- }
-}
diff --git a/amps/ags/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/hold/AddToHoldsTests.java b/amps/ags/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/hold/AddToHoldsTests.java
deleted file mode 100644
index c7a16e577d..0000000000
--- a/amps/ags/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/hold/AddToHoldsTests.java
+++ /dev/null
@@ -1,365 +0,0 @@
-/*-
- * #%L
- * Alfresco Records Management Module
- * %%
- * Copyright (C) 2005 - 2021 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.hold;
-
-
-import static org.alfresco.rest.rm.community.base.TestData.HOLD_DESCRIPTION;
-import static org.alfresco.rest.rm.community.base.TestData.HOLD_REASON;
-import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentAlias.FILE_PLAN_ALIAS;
-import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentAlias.TRANSFERS_ALIAS;
-import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentAlias.UNFILED_RECORDS_CONTAINER_ALIAS;
-import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentAspects.FROZEN_ASPECT;
-import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentType.UNFILED_RECORD_FOLDER_TYPE;
-import static org.alfresco.rest.rm.community.model.user.UserPermissions.PERMISSION_FILING;
-import static org.alfresco.rest.rm.community.model.user.UserPermissions.PERMISSION_READ_RECORDS;
-import static org.alfresco.rest.rm.community.model.user.UserRoles.ROLE_RM_MANAGER;
-import static org.alfresco.rest.rm.community.util.CommonTestUtils.generateTestPrefix;
-import static org.alfresco.rest.rm.community.utils.CoreUtil.toContentModel;
-import static org.alfresco.rest.rm.community.utils.FilePlanComponentsUtil.IMAGE_FILE;
-import static org.alfresco.rest.rm.community.utils.FilePlanComponentsUtil.createElectronicRecordModel;
-import static org.alfresco.rest.rm.community.utils.FilePlanComponentsUtil.createNonElectronicRecordModel;
-import static org.alfresco.rest.rm.community.utils.FilePlanComponentsUtil.getFile;
-import static org.alfresco.utility.data.RandomData.getRandomAlphanumeric;
-import static org.alfresco.utility.report.log.Step.STEP;
-import static org.apache.commons.httpclient.HttpStatus.SC_BAD_REQUEST;
-import static org.apache.commons.httpclient.HttpStatus.SC_INTERNAL_SERVER_ERROR;
-import static org.springframework.http.HttpStatus.CREATED;
-import static org.testng.Assert.assertEquals;
-import static org.testng.Assert.assertTrue;
-import static org.testng.AssertJUnit.assertFalse;
-
-import java.util.ArrayList;
-import java.util.List;
-import java.util.stream.Collectors;
-
-import org.alfresco.dataprep.CMISUtil;
-import org.alfresco.dataprep.ContentActions;
-import org.alfresco.rest.model.RestNodeModel;
-import org.alfresco.rest.rm.community.base.BaseRMRestTest;
-import org.alfresco.rest.rm.community.model.hold.HoldEntry;
-import org.alfresco.rest.rm.community.model.record.Record;
-import org.alfresco.rest.rm.community.model.recordcategory.RecordCategory;
-import org.alfresco.rest.rm.community.model.recordcategory.RecordCategoryChild;
-import org.alfresco.rest.rm.community.model.user.UserRoles;
-import org.alfresco.rest.rm.community.requests.gscore.api.RecordFolderAPI;
-import org.alfresco.rest.v0.HoldsAPI;
-import org.alfresco.rest.v0.service.RoleService;
-import org.alfresco.test.AlfrescoTest;
-import org.alfresco.utility.constants.UserRole;
-import org.alfresco.utility.model.FileModel;
-import org.alfresco.utility.model.SiteModel;
-import org.alfresco.utility.model.UserModel;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.testng.annotations.AfterClass;
-import org.testng.annotations.BeforeClass;
-import org.testng.annotations.DataProvider;
-import org.testng.annotations.Test;
-
-/**
- * API tests for adding content/record folder/records to holds
- *
- * @author Rodica Sutu
- * @since 3.2
- */
-@AlfrescoTest (jira = "RM-6874")
-public class AddToHoldsTests extends BaseRMRestTest
-{
- private static final String HOLD = "HOLD" + generateTestPrefix(AddToHoldsTests.class);
- private static final String ACCESS_DENIED_ERROR_MESSAGE = "Access Denied. You do not have the appropriate " +
- "permissions to perform this operation.";
- private static final String INVALID_TYPE_ERROR_MESSAGE = "Items added to a hold must be either a record, a " +
- "record folder or active content.";
- private static final String LOCKED_FILE_ERROR_MESSAGE = "Locked content can't be added to a hold.";
- private SiteModel testSite;
- private String holdNodeRef;
- private FileModel documentHeld, contentToAddToHold, contentAddToHoldNoPermission;
- private UserModel userAddHoldPermission;
- private final List users = new ArrayList<>();
- private final List nodesToBeClean = new ArrayList<>();
-
- @Autowired
- private HoldsAPI holdsAPI;
- @Autowired
- private RoleService roleService;
- @Autowired
- private ContentActions contentActions;
-
- @BeforeClass (alwaysRun = true)
- public void preconditionForAddContentToHold()
- {
- STEP("Create a hold.");
- holdNodeRef = holdsAPI.createHoldAndGetNodeRef(getAdminUser().getUsername(), getAdminUser().getUsername(),
- HOLD, HOLD_REASON, HOLD_DESCRIPTION);
-
- STEP("Create test files.");
- testSite = dataSite.usingAdmin().createPublicRandomSite();
- documentHeld = dataContent.usingAdmin().usingSite(testSite)
- .createContent(CMISUtil.DocumentType.TEXT_PLAIN);
- contentToAddToHold = dataContent.usingAdmin().usingSite(testSite)
- .createContent(CMISUtil.DocumentType.TEXT_PLAIN);
- contentAddToHoldNoPermission = dataContent.usingAdmin().usingSite(testSite)
- .createContent(CMISUtil.DocumentType.TEXT_PLAIN);
-
- STEP("Add the content to the hold.");
- holdsAPI.addItemToHold(getAdminUser().getUsername(), getAdminUser().getPassword(), documentHeld
- .getNodeRefWithoutVersion(), HOLD);
-
- STEP("Create users");
- userAddHoldPermission = roleService.createUserWithSiteRoleRMRoleAndPermission(testSite,
- UserRole.SiteCollaborator, holdNodeRef, UserRoles.ROLE_RM_MANAGER, PERMISSION_FILING);
- users.add(userAddHoldPermission);
-
- }
-
- /**
- * Given a hold that contains at least one active content
- * When I use the existing REST API to retrieve the contents of the hold
- * Then I should see all the active content on hold
- */
- @Test
- public void retrieveTheContentOfTheHoldUsingV1API() throws Exception
- {
- STEP("Retrieve the list of children from the hold and collect the entries that have the name of the active " +
- "content held");
- List documentsHeld = restClient.authenticateUser(getAdminUser()).withCoreAPI()
- .usingNode(toContentModel(holdNodeRef))
- .listChildren().getEntries().stream()
- .filter(child -> child.onModel().getName().contains(documentHeld
- .getName()))
- .collect(Collectors.toList());
- STEP("Check the list of active content");
- assertEquals(documentsHeld.size(), 1, "The active content is not retrieve when getting the children from the " +
- "hold folder");
- assertEquals(documentsHeld.get(0).onModel().getName(), documentHeld.getName());
- }
-
- /**
- * Given a hold that contains at least one active content
- * When I use the existing REST API to retrieve the holds the content is added
- * Then the hold where the content held is returned
- */
- @Test
- public void retrieveTheHoldWhereTheContentIsAdded()
- {
- List holdEntries = holdsAPI.getHolds(getAdminUser().getUsername(), getAdminUser().getPassword(),
- documentHeld.getNodeRefWithoutVersion(), true, null);
- assertTrue(holdEntries.stream().anyMatch(holdEntry -> holdEntry.getName().contains(HOLD)), "Could not find " +
- "hold with name " + HOLD);
- }
-
- /**
- * Valid nodes to be added to hold
- */
- @DataProvider (name = "validNodesForAddToHold")
- public Object[][] getValidNodesForAddToHold()
- {
- //create electronic and nonElectronic record in record folder
- RecordCategoryChild recordFolder = createCategoryFolderInFilePlan();
- RecordFolderAPI recordFolderAPI = getRestAPIFactory().getRecordFolderAPI();
- nodesToBeClean.add(recordFolder.getParentId());
- Record electronicRecord = recordFolderAPI.createRecord(createElectronicRecordModel(), recordFolder.getId(), getFile
- (IMAGE_FILE));
- assertStatusCode(CREATED);
-
- Record nonElectronicRecord = recordFolderAPI.createRecord(createNonElectronicRecordModel(), recordFolder.getId());
- assertStatusCode(CREATED);
- getRestAPIFactory().getRMUserAPI().addUserPermission(recordFolder.getId(), userAddHoldPermission,
- PERMISSION_FILING);
-
- RecordCategoryChild folderToHold = createCategoryFolderInFilePlan();
- getRestAPIFactory().getRMUserAPI().addUserPermission(folderToHold.getId(), userAddHoldPermission,
- PERMISSION_FILING);
- nodesToBeClean.add(folderToHold.getParentId());
-
- return new String[][]
- { // record folder
- { folderToHold.getId() },
- //electronic record
- { electronicRecord.getId() },
- // non electronic record
- { nonElectronicRecord.getId() },
- // document from collaboration site
- { contentToAddToHold.getNodeRefWithoutVersion() },
- };
- }
-
- /**
- * Given record folder/record/document not on hold
- * And a hold
- * And file permission on the hold
- * And the appropriate capability to add to hold
- * When I use the existing REST API to add the node to the hold
- * Then the record folder/record/document is added to the hold
- * And the item is frozen
- *
- * @throws Exception
- */
- @Test (dataProvider = "validNodesForAddToHold")
- public void addValidNodesToHoldWithAllowedUser(String nodeId) throws Exception
- {
- STEP("Add node to hold with user with permission.");
- holdsAPI.addItemToHold(userAddHoldPermission.getUsername(), userAddHoldPermission.getPassword(), nodeId, HOLD);
-
- STEP("Check the node is frozen.");
- assertTrue(hasAspect(nodeId, FROZEN_ASPECT));
- }
-
- /**
- * Data provider with user without correct permission to add to hold and the node ref to be added to hold
- * @return object with user model and the node ref to be added to hold
- */
- @DataProvider (name = "userWithoutPermissionForAddToHold")
- public Object[][] getUserWithoutPermissionForAddToHold()
- {
- //create record folder
- RecordCategoryChild recordFolder = createCategoryFolderInFilePlan();
- //create a rm manager and grant read permission over the record folder created
- UserModel user = roleService.createUserWithRMRoleAndRMNodePermission(ROLE_RM_MANAGER.roleId, recordFolder.getId(),
- PERMISSION_READ_RECORDS);
- getRestAPIFactory().getRMUserAPI().addUserPermission(holdNodeRef, user, PERMISSION_FILING);
- nodesToBeClean.add(recordFolder.getParentId());
- return new Object[][]
- { // user without write permission on the content
- {
- roleService.createUserWithSiteRoleRMRoleAndPermission(testSite, UserRole.SiteConsumer,
- holdNodeRef, UserRoles.ROLE_RM_MANAGER, PERMISSION_FILING),
- contentAddToHoldNoPermission.getNodeRefWithoutVersion()
- },
- // user with write permission on the content and without filling permission on a hold
- {
- roleService.createUserWithSiteRoleRMRoleAndPermission(testSite, UserRole
- .SiteCollaborator,
- holdNodeRef, UserRoles.ROLE_RM_MANAGER, PERMISSION_READ_RECORDS),
- contentAddToHoldNoPermission.getNodeRefWithoutVersion()
- },
- // user with write permission on the content, filling permission on a hold without add to
- // hold capability
- {
- roleService.createUserWithSiteRoleRMRoleAndPermission(testSite, UserRole
- .SiteCollaborator,
- holdNodeRef, UserRoles.ROLE_RM_POWER_USER, PERMISSION_READ_RECORDS),
- contentAddToHoldNoPermission.getNodeRefWithoutVersion()
- },
- //user without write permission on RM record folder
- {
- user, recordFolder.getId()
- },
-
- };
- }
-
- /**
- * Given a node not on hold
- * And a hold
- * And user without right permission to add to hold
- * When I use the existing REST API to add the node to the hold
- * Then the node is not added to the hold
- * And the node is not frozen
- *
- * @throws Exception
- */
- @Test (dataProvider = "userWithoutPermissionForAddToHold")
- public void addContentToHoldWithUserWithoutHoldPermission(UserModel userModel, String nodeToBeAddedToHold) throws Exception
- {
- users.add(userModel);
- STEP("Add the node to the hold with user without permission.");
- String response = holdsAPI.addToHoldAndGetMessage(userModel.getUsername(), userModel.getPassword(),
- SC_INTERNAL_SERVER_ERROR, nodeToBeAddedToHold, holdNodeRef);
- assertTrue(response.contains(ACCESS_DENIED_ERROR_MESSAGE));
-
- STEP("Check the node is not frozen.");
- assertFalse(hasAspect(nodeToBeAddedToHold,FROZEN_ASPECT));
- }
-
- /**
- * Data provider with invalid node types that can be added to a hold
- */
- @DataProvider (name = "invalidNodesForAddToHold")
- public Object[][] getInvalidNodesForAddToHold()
- {
- //create locked file
- FileModel contentLocked = dataContent.usingAdmin().usingSite(testSite)
- .createContent(CMISUtil.DocumentType.TEXT_PLAIN);
-
- contentActions.checkOut(getAdminUser().getUsername(), getAdminUser().getPassword(),
- testSite.getId(), contentLocked.getName());
- RecordCategory category = createRootCategory(getRandomAlphanumeric());
- nodesToBeClean.add(category.getId());
- return new Object[][]
- { // file plan node id
- { getFilePlan(FILE_PLAN_ALIAS).getId(), SC_BAD_REQUEST, INVALID_TYPE_ERROR_MESSAGE },
- //transfer container
- { getTransferContainer(TRANSFERS_ALIAS).getId(), SC_BAD_REQUEST, INVALID_TYPE_ERROR_MESSAGE },
- // a record category
- { category.getId(), SC_BAD_REQUEST, INVALID_TYPE_ERROR_MESSAGE },
- // unfiled records root
- { getUnfiledContainer(UNFILED_RECORDS_CONTAINER_ALIAS).getId(), SC_BAD_REQUEST,
- INVALID_TYPE_ERROR_MESSAGE },
- // an arbitrary unfiled records folder
- { createUnfiledContainerChild(UNFILED_RECORDS_CONTAINER_ALIAS, "Unfiled Folder " +
- getRandomAlphanumeric(), UNFILED_RECORD_FOLDER_TYPE).getId(), SC_BAD_REQUEST,
- INVALID_TYPE_ERROR_MESSAGE },
- //folder,
- { dataContent.usingAdmin().usingSite(testSite).createFolder().getNodeRef(), SC_BAD_REQUEST,
- INVALID_TYPE_ERROR_MESSAGE },
- //document locked
- { contentLocked.getNodeRefWithoutVersion(), SC_INTERNAL_SERVER_ERROR, LOCKED_FILE_ERROR_MESSAGE }
- };
- }
-
- /**
- * Given a node that is not a document/record/ record folder ( a valid node type to be added to hold)
- * And a hold
- * And user without right permission to add to hold
- * When I use the existing REST API to add the node to the hold
- * Then the node is not added to the hold
- * And the node is not frozen
- *
- * @throws Exception
- */
- @Test (dataProvider = "invalidNodesForAddToHold")
- public void addInvalidNodesToHold(String itemNodeRef, int responseCode, String errorMessage) throws Exception
- {
- STEP("Add the node to the hold ");
- String responseErrorMessage = holdsAPI.addToHoldAndGetMessage(getAdminUser().getUsername(),
- getAdminUser().getPassword(), responseCode, itemNodeRef, holdNodeRef);
- assertTrue(responseErrorMessage.contains(errorMessage),
- "Actual error message " + responseErrorMessage + " expected " + errorMessage);
-
- STEP("Check node is not frozen.");
- assertFalse(hasAspect(itemNodeRef, FROZEN_ASPECT));
- }
-
- @AfterClass (alwaysRun = true)
- public void cleanUpAddContentToHold()
- {
- holdsAPI.deleteHold(getAdminUser(), holdNodeRef);
- dataSite.usingAdmin().deleteSite(testSite);
- users.forEach(user -> getDataUser().usingAdmin().deleteUser(user));
- nodesToBeClean.forEach( category -> deleteRecordCategory(category));
- }
-}
diff --git a/amps/ags/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/hold/PreventActionsOnFrozenContentTests.java b/amps/ags/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/hold/PreventActionsOnFrozenContentTests.java
deleted file mode 100644
index c41f38c335..0000000000
--- a/amps/ags/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/hold/PreventActionsOnFrozenContentTests.java
+++ /dev/null
@@ -1,329 +0,0 @@
-/*-
- * #%L
- * Alfresco Records Management Module
- * %%
- * Copyright (C) 2005 - 2021 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.hold;
-
-import static org.alfresco.rest.rm.community.base.TestData.HOLD_DESCRIPTION;
-import static org.alfresco.rest.rm.community.base.TestData.HOLD_REASON;
-import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentAspects.ASPECTS_VITAL_RECORD;
-import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentAspects.ASPECTS_VITAL_RECORD_DEFINITION;
-import static org.alfresco.rest.rm.community.util.CommonTestUtils.generateTestPrefix;
-import static org.alfresco.rest.rm.community.utils.CoreUtil.createBodyForMoveCopy;
-import static org.alfresco.utility.data.RandomData.getRandomName;
-import static org.alfresco.utility.report.log.Step.STEP;
-import static org.springframework.http.HttpStatus.CREATED;
-import static org.springframework.http.HttpStatus.FORBIDDEN;
-import static org.springframework.http.HttpStatus.INTERNAL_SERVER_ERROR;
-import static org.springframework.http.HttpStatus.OK;
-import static org.testng.Assert.assertNotNull;
-import static org.testng.Assert.assertTrue;
-import static org.testng.AssertJUnit.assertFalse;
-
-import javax.json.Json;
-import javax.json.JsonObject;
-import java.io.File;
-
-import org.alfresco.dataprep.CMISUtil;
-import org.alfresco.rest.core.JsonBodyGenerator;
-import org.alfresco.rest.core.v0.BaseAPI.RM_ACTIONS;
-import org.alfresco.rest.rm.community.base.BaseRMRestTest;
-import org.alfresco.rest.rm.community.model.common.ReviewPeriod;
-import org.alfresco.rest.rm.community.model.record.Record;
-import org.alfresco.rest.rm.community.model.recordcategory.RecordCategory;
-import org.alfresco.rest.rm.community.model.recordcategory.RecordCategoryChild;
-import org.alfresco.rest.rm.community.model.recordfolder.RecordFolder;
-import org.alfresco.rest.rm.community.model.recordfolder.RecordFolderProperties;
-import org.alfresco.rest.v0.HoldsAPI;
-import org.alfresco.rest.v0.RMRolesAndActionsAPI;
-import org.alfresco.rest.v0.service.DispositionScheduleService;
-import org.alfresco.test.AlfrescoTest;
-import org.alfresco.utility.Utility;
-import org.alfresco.utility.model.FileModel;
-import org.alfresco.utility.model.FolderModel;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.testng.annotations.AfterClass;
-import org.testng.annotations.BeforeClass;
-import org.testng.annotations.Test;
-
-/**
- * API tests to check actions on frozen content
- *
- * @author Rodica Sutu
- * @since 3.2
- */
-@AlfrescoTest (jira = "RM-6903")
-public class PreventActionsOnFrozenContentTests extends BaseRMRestTest
-{
- private static final String HOLD_ONE = "HOLD" + generateTestPrefix(PreventActionsOnFrozenContentTests.class);
- private static String holdNodeRef;
- private static FileModel contentHeld;
- private static File updatedFile;
- private static FolderModel folderModel;
- private static RecordCategoryChild recordFolder;
- private static Record recordFrozen, recordNotHeld;
- private static RecordCategory categoryWithRS;
-
- @Autowired
- private HoldsAPI holdsAPI;
-
- @Autowired
- private DispositionScheduleService dispositionScheduleService;
-
- @Autowired
- private RMRolesAndActionsAPI rmRolesAndActionsAPI;
-
- @BeforeClass (alwaysRun = true)
- public void preconditionForPreventActionsOnFrozenContent()
- {
- STEP("Create a hold.");
- holdNodeRef = holdsAPI.createHoldAndGetNodeRef(getAdminUser().getUsername(), getAdminUser().getUsername(),
- HOLD_ONE, HOLD_REASON, HOLD_DESCRIPTION);
-
- STEP("Create a test file.");
- testSite = dataSite.usingAdmin().createPublicRandomSite();
- contentHeld = dataContent.usingAdmin().usingSite(testSite)
- .createContent(CMISUtil.DocumentType.TEXT_PLAIN);
-
- STEP("Add the file to the hold.");
- holdsAPI.addItemToHold(getAdminUser().getUsername(), getAdminUser().getPassword(), contentHeld
- .getNodeRefWithoutVersion(), HOLD_ONE);
-
- STEP("Get a file resource.");
- updatedFile = Utility.getResourceTestDataFile("SampleTextFile_10kb.txt");
-
- STEP("Create a folder withing the test site .");
- folderModel = dataContent.usingAdmin().usingSite(testSite)
- .createFolder();
-
- STEP("Create a record folder with some records");
- recordFolder = createCategoryFolderInFilePlan();
- recordFrozen = createElectronicRecord(recordFolder.getId(), getRandomName("elRecordFrozen"));
- recordNotHeld = createElectronicRecord(recordFolder.getId(), getRandomName("elRecordNotHeld"));
- assertStatusCode(CREATED);
-
- STEP("Add the record to the hold.");
- holdsAPI.addItemToHold(getAdminUser().getUsername(), getAdminUser().getPassword(), recordFrozen.getId(), HOLD_ONE);
- }
-
- /**
- * Given active content on hold
- * When I try to edit the properties
- * Or perform an action that edits the properties
- * Then I am not successful
- *
- */
- @Test
- public void editPropertiesForContentHeld() throws Exception
- {
- STEP("Update name property of the held content");
- JsonObject nameUpdated = Json.createObjectBuilder().add("name", "HeldNameUpdated").build();
- restClient.authenticateUser(getAdminUser()).withCoreAPI().usingNode(contentHeld).updateNode(nameUpdated.toString());
-
- STEP("Check the request failed.");
- restClient.assertStatusCodeIs(FORBIDDEN);
- restClient.assertLastError().containsSummary("Frozen content can't be updated.");
- }
-
- /*
- * Given active content on hold
- * When I try to update the content
- * Then I am not successful
- */
- @Test
- @AlfrescoTest (jira = "RM-6925")
- public void updateContentForFrozenFile() throws Exception
- {
- STEP("Update content of the held file");
- restClient.authenticateUser(getAdminUser()).withCoreAPI().usingNode(contentHeld).updateNodeContent(updatedFile);
-
- STEP("Check the request failed.");
- //TODO change this to FORBIDDEN when REPO-4632 is fixed
- restClient.assertStatusCodeIs(INTERNAL_SERVER_ERROR);
- restClient.assertLastError().containsSummary("Frozen content can't be updated.");
- }
-
- /*
- * Given active content on hold
- * When I try to delete the content
- * Then I am not successful
- */
- @Test
- public void deleteFrozenFile() throws Exception
- {
- STEP("Delete frozen file");
- restClient.authenticateUser(getAdminUser()).withCoreAPI().usingNode(contentHeld).deleteNode(contentHeld.getNodeRefWithoutVersion());
-
- STEP("Check the request failed.");
- restClient.assertStatusCodeIs(FORBIDDEN);
- restClient.assertLastError().containsSummary("Frozen content can't be deleted.");
- }
-
- /**
- * Given active content on hold
- * When I try to copy the content
- * Then I am not successful
- */
- @Test
- @AlfrescoTest(jira = "RM-6924")
- public void copyFrozenFile()
- {
- STEP("Copy frozen file");
- String postBody = JsonBodyGenerator.keyValueJson("targetParentId",folderModel.getNodeRef());
- getRestAPIFactory().getNodeAPI(contentHeld).copyNode(postBody);
-
- STEP("Check the request failed.");
- assertStatusCode(FORBIDDEN);
- getRestAPIFactory().getRmRestWrapper().assertLastError().containsSummary("Permission was denied");
- }
-
- /**
- * Given active content on hold
- * When I try to move the content
- * Then I am not successful
- *
- */
- @Test
- public void moveFrozenFile() throws Exception
- {
- STEP("Move frozen file");
- getRestAPIFactory().getNodeAPI(contentHeld).move(createBodyForMoveCopy(folderModel.getNodeRef()));
-
- STEP("Check the request failed.");
- assertStatusCode(FORBIDDEN);
- getRestAPIFactory().getRmRestWrapper().assertLastError().containsSummary("Frozen content can't be moved.");
- }
-
- /**
- * Given a record folder with a frozen record and another record not held
- * When I update the record folder and make the records as vital
- * Then I am successful and the records not held are marked as vital
- * And the frozen nodes have the vital record search properties updated
- */
- @Test
- @AlfrescoTest (jira = "RM-6929")
- public void updateRecordFolderVitalProperties()
- {
- STEP("Update the vital record properties for the record folder");
- // Create the record folder properties to update
- RecordFolder recordFolderToUpdate = RecordFolder.builder()
- .properties(RecordFolderProperties.builder()
- .vitalRecordIndicator(true)
- .reviewPeriod(new ReviewPeriod("month", "1"))
- .build())
- .build();
-
- // Update the record folder
- RecordFolder updatedRecordFolder = getRestAPIFactory().getRecordFolderAPI().updateRecordFolder
- (recordFolderToUpdate,
- recordFolder.getId());
- assertStatusCode(OK);
- assertTrue(updatedRecordFolder.getAspectNames().contains(ASPECTS_VITAL_RECORD_DEFINITION));
-
-
- STEP("Check the frozen record was not marked as vital");
- recordFrozen = getRestAPIFactory().getRecordsAPI().getRecord(recordFrozen.getId());
- assertFalse(recordFrozen.getAspectNames().contains(ASPECTS_VITAL_RECORD));
- assertTrue(recordFrozen.getProperties().getRecordSearchVitalRecordReviewPeriod().contains("month"));
- assertTrue(recordFrozen.getProperties().getRecordSearchVitalRecordReviewPeriodExpression().contains("1"));
-
- STEP("Check the record not held was marked as vital");
- recordNotHeld = getRestAPIFactory().getRecordsAPI().getRecord(recordNotHeld.getId());
- assertTrue(recordNotHeld.getAspectNames().contains(ASPECTS_VITAL_RECORD));
- assertNotNull(recordNotHeld.getProperties().getReviewAsOf());
- assertTrue(recordNotHeld.getProperties().getRecordSearchVitalRecordReviewPeriod().contains("month"));
- assertTrue(recordNotHeld.getProperties().getRecordSearchVitalRecordReviewPeriodExpression().contains("1"));
- }
-
- /**
- * Given a record folder with a frozen record and another record not held
- * When I add a disposition schedule
- * Then I am successful
- * And the record search disposition schedule properties are updated
- */
- @Test
- @AlfrescoTest (jira = "RM-6929")
- public void createDispositionScheduleOnCategoryWithHeldChildren()
- {
- STEP("Create a retention schedule on the category with frozen children");
- RecordCategory categoryWithRS = getRestAPIFactory().getRecordCategoryAPI()
- .getRecordCategory(recordFolder.getParentId());
- dispositionScheduleService.createCategoryRetentionSchedule(categoryWithRS.getName(), false);
- dispositionScheduleService.addCutOffAfterPeriodStep(categoryWithRS.getName(), "immediately");
- dispositionScheduleService.addDestroyWithGhostingAfterPeriodStep(categoryWithRS.getName(), "immediately");
-
- STEP("Check the record folder has a disposition schedule");
- RecordFolder folderWithRS = getRestAPIFactory().getRecordFolderAPI().getRecordFolder(recordFolder.getId());
- assertNotNull(folderWithRS.getProperties().getRecordSearchDispositionAuthority());
- assertNotNull(folderWithRS.getProperties().getRecordSearchDispositionInstructions());
-
- }
-
- /**
- * Given a record category with a disposition schedule applied to records
- * And the disposition schedule has a retain step immediately and destroy step immediately
- * And a complete record added to one hold
- * When I execute the retain action
- * Then the action is executed
- * And the record search disposition schedule properties are updated
- */
- @Test
- @AlfrescoTest (jira = "RM-6931")
- public void retainActionOnFrozenHeldRecords()
- {
- STEP("Add a category with a disposition schedule.");
- categoryWithRS = createRootCategory(getRandomName("CategoryWithRS"));
- dispositionScheduleService.createCategoryRetentionSchedule(categoryWithRS.getName(), true);
- dispositionScheduleService.addRetainAfterPeriodStep(categoryWithRS.getName(), "immediately");
- dispositionScheduleService.addDestroyWithGhostingAfterPeriodStep(categoryWithRS.getName(), "immediately");
-
- STEP("Create record folder with a record.");
- RecordCategoryChild folder = createFolder(categoryWithRS.getId(), getRandomName("RecFolder"));
- Record record = createElectronicRecord(folder.getId(), getRandomName("elRecord"));
- completeRecord(record.getId());
-
- STEP("Add the record to the hold");
- holdsAPI.addItemToHold(getAdminUser().getUsername(), getAdminUser().getPassword(), record.getId(), HOLD_ONE);
-
- STEP("Execute the retain action");
- rmRolesAndActionsAPI.executeAction(getAdminUser().getUsername(), getAdminUser().getPassword(), record.getName(),
- RM_ACTIONS.END_RETENTION);
-
- STEP("Check the record search disposition properties");
- Record recordUpdated = getRestAPIFactory().getRecordsAPI().getRecord(record.getId());
- assertTrue(recordUpdated.getProperties().getRecordSearchDispositionActionName().contains(RM_ACTIONS.DESTROY.getAction()));
- assertTrue(recordUpdated.getProperties().getRecordSearchDispositionPeriod().contains("immediately"));
- }
-
- @AfterClass (alwaysRun = true)
- public void cleanUpPreventActionsOnFrozenContent()
- {
- holdsAPI.deleteHold(getAdminUser(), holdNodeRef);
- dataSite.usingAdmin().deleteSite(testSite);
- deleteRecordCategory(recordFolder.getParentId());
- deleteRecordCategory(categoryWithRS.getId());
- }
-
-}
diff --git a/amps/ags/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/hold/RemoveFromHoldsTests.java b/amps/ags/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/hold/RemoveFromHoldsTests.java
deleted file mode 100644
index d0f576d747..0000000000
--- a/amps/ags/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/hold/RemoveFromHoldsTests.java
+++ /dev/null
@@ -1,336 +0,0 @@
-/*-
- * #%L
- * Alfresco Records Management Module
- * %%
- * Copyright (C) 2005 - 2021 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.hold;
-
-import static java.util.Arrays.asList;
-
-import static org.alfresco.rest.rm.community.base.TestData.HOLD_DESCRIPTION;
-import static org.alfresco.rest.rm.community.base.TestData.HOLD_REASON;
-import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentAspects.FROZEN_ASPECT;
-import static org.alfresco.rest.rm.community.model.user.UserPermissions.PERMISSION_FILING;
-import static org.alfresco.rest.rm.community.model.user.UserPermissions.PERMISSION_READ_RECORDS;
-import static org.alfresco.rest.rm.community.model.user.UserRoles.ROLE_RM_MANAGER;
-import static org.alfresco.rest.rm.community.util.CommonTestUtils.generateTestPrefix;
-import static org.alfresco.rest.rm.community.utils.FilePlanComponentsUtil.IMAGE_FILE;
-import static org.alfresco.rest.rm.community.utils.FilePlanComponentsUtil.createElectronicRecordModel;
-import static org.alfresco.rest.rm.community.utils.FilePlanComponentsUtil.createNonElectronicRecordModel;
-import static org.alfresco.rest.rm.community.utils.FilePlanComponentsUtil.getFile;
-import static org.alfresco.utility.report.log.Step.STEP;
-import static org.apache.commons.httpclient.HttpStatus.SC_INTERNAL_SERVER_ERROR;
-import static org.springframework.http.HttpStatus.CREATED;
-import static org.testng.Assert.assertFalse;
-import static org.testng.Assert.assertTrue;
-
-import java.util.Collections;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
-
-import org.alfresco.dataprep.CMISUtil;
-import org.alfresco.rest.rm.community.base.BaseRMRestTest;
-import org.alfresco.rest.rm.community.model.hold.HoldEntry;
-import org.alfresco.rest.rm.community.model.record.Record;
-import org.alfresco.rest.rm.community.model.recordcategory.RecordCategoryChild;
-import org.alfresco.rest.rm.community.model.user.UserRoles;
-import org.alfresco.rest.rm.community.requests.gscore.api.RecordFolderAPI;
-import org.alfresco.rest.v0.HoldsAPI;
-import org.alfresco.rest.v0.service.RoleService;
-import org.alfresco.test.AlfrescoTest;
-import org.alfresco.utility.constants.UserRole;
-import org.alfresco.utility.model.FileModel;
-import org.alfresco.utility.model.SiteModel;
-import org.alfresco.utility.model.UserModel;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.testng.annotations.AfterClass;
-import org.testng.annotations.BeforeClass;
-import org.testng.annotations.DataProvider;
-import org.testng.annotations.Test;
-
-/**
- * API tests for removing content/record folder/record from holds
- *
- * @author Rodica Sutu
- * @since 3.2
- */
-@AlfrescoTest (jira = "RM-6874, RM-6873")
-public class RemoveFromHoldsTests extends BaseRMRestTest
-{
- private static final String HOLD_ONE = "HOLD_ONE" + generateTestPrefix(RemoveFromHoldsTests.class);
- private static final String HOLD_TWO = "HOLD_TWO" + generateTestPrefix(RemoveFromHoldsTests.class);
- private static final String ACCESS_DENIED_ERROR_MESSAGE = "Access Denied. You do not have the appropriate " +
- "permissions to perform this operation.";
-
- private SiteModel testSite, privateSite;
- private String holdNodeRefOne;
- private String holdNodeRefTwo;
- private FileModel contentHeld, contentAddToManyHolds;
- private final Set usersToBeClean = new HashSet<>();
- private final Set nodesToBeClean = new HashSet<>();
- @Autowired
- private HoldsAPI holdsAPI;
- @Autowired
- private RoleService roleService;
-
- @BeforeClass (alwaysRun = true)
- public void preconditionForRemoveContentFromHold()
- {
- STEP("Create two holds.");
- holdNodeRefOne = holdsAPI.createHoldAndGetNodeRef(getAdminUser().getUsername(), getAdminUser().getUsername(),
- HOLD_ONE, HOLD_REASON, HOLD_DESCRIPTION);
- holdNodeRefTwo = holdsAPI.createHoldAndGetNodeRef(getAdminUser().getUsername(), getAdminUser()
- .getUsername(), HOLD_TWO, HOLD_REASON, HOLD_DESCRIPTION);
-
- STEP("Create test files.");
- testSite = dataSite.usingAdmin().createPublicRandomSite();
- privateSite = dataSite.usingAdmin().createPrivateRandomSite();
- contentHeld = dataContent.usingAdmin().usingSite(testSite)
- .createContent(CMISUtil.DocumentType.TEXT_PLAIN);
- contentAddToManyHolds = dataContent.usingSite(testSite)
- .createContent(CMISUtil.DocumentType.TEXT_PLAIN);
-
- STEP("Add content to the holds.");
- holdsAPI.addItemToHold(getAdminUser().getUsername(), getAdminUser().getPassword(), contentHeld
- .getNodeRefWithoutVersion(), HOLD_ONE);
- holdsAPI.addItemsToHolds(getAdminUser().getUsername(), getAdminUser().getPassword(),
- Collections.singletonList(contentAddToManyHolds.getNodeRefWithoutVersion()), asList(HOLD_ONE, HOLD_TWO));
- }
-
- /**
- * Valid nodes to be removed from hold
- */
- @DataProvider (name = "validNodesToRemoveFromHold")
- public Object[][] getValidNodesToRemoveFromHold()
- {
- //create electronic and nonElectronic record in record folder
- RecordCategoryChild recordFolder = createCategoryFolderInFilePlan();
- RecordFolderAPI recordFolderAPI = getRestAPIFactory().getRecordFolderAPI();
- nodesToBeClean.add(recordFolder.getParentId());
- Record electronicRecord = recordFolderAPI.createRecord(createElectronicRecordModel(), recordFolder.getId(), getFile
- (IMAGE_FILE));
- assertStatusCode(CREATED);
- Record nonElectronicRecord = recordFolderAPI.createRecord(createNonElectronicRecordModel(), recordFolder.getId());
- assertStatusCode(CREATED);
-
- RecordCategoryChild folderToHeld = createCategoryFolderInFilePlan();
- nodesToBeClean.add(folderToHeld.getParentId());
- holdsAPI.addItemsToHolds(getAdminUser().getUsername(), getAdminUser().getPassword(),
- asList(electronicRecord.getId(), nonElectronicRecord.getId(), folderToHeld.getId()), Collections.singletonList(HOLD_ONE));
-
- return new String[][]
- { // record folder
- { folderToHeld.getId() },
- //electronic record
- { electronicRecord.getId() },
- // non electronic record
- { nonElectronicRecord.getId() },
- // document from collaboration site
- { contentHeld.getNodeRefWithoutVersion() },
- };
- }
-
- /**
- * Given content/record folder/record that is held
- * And the corresponding hold
- * When I use the existing REST API to remove the node from the hold
- * Then the node is removed from the hold
- * And is no longer frozen
- */
- @Test(dataProvider = "validNodesToRemoveFromHold")
- public void removeContentFromHold(String nodeId) throws Exception
- {
- STEP("Remove node from hold");
- holdsAPI.removeItemFromHold(getAdminUser().getUsername(), getAdminUser().getPassword(), nodeId, HOLD_ONE);
-
- STEP("Check the node is not held");
- assertFalse(hasAspect(nodeId, FROZEN_ASPECT));
-
- STEP("Check node is not in any hold");
- List holdEntries = holdsAPI.getHolds(getAdminUser().getUsername(), getAdminUser().getPassword(),
- nodeId, true, null);
- assertTrue(holdEntries.isEmpty(), "Content held is still added to a hold.");
- }
-
- /**
- * Given active content that is held on many holds
- * When I use the existing REST API to remove the active content from one hold
- * Then the active content is removed from the specific hold
- * And is frozen
- * And in the other holds
- */
- @Test
- public void removeContentAddedToManyHolds() throws Exception
- {
- STEP("Remove content from hold. ");
- holdsAPI.removeItemFromHold(getAdminUser().getUsername(), getAdminUser().getPassword(), contentAddToManyHolds
- .getNodeRefWithoutVersion(), HOLD_ONE);
-
- STEP("Check the content is held. ");
- assertTrue(hasAspect(contentAddToManyHolds.getNodeRefWithoutVersion(), FROZEN_ASPECT));
-
- STEP("Check node is in hold HOLD_TWO. ");
- List holdEntries = holdsAPI.getHolds(getAdminUser().getUsername(), getAdminUser().getPassword(),
- contentAddToManyHolds.getNodeRefWithoutVersion(), true, null);
- assertFalse(holdEntries.isEmpty(), "Content held is not held after removing from one hold.");
- assertTrue(holdEntries.stream().anyMatch(holdEntry -> holdEntry.getName().contains(HOLD_TWO)), "Content held is " +
- "not held after removing from one hold.");
- }
-
- /**
- * Data provider with user without right permission or capability to remove from hold a specific node
- * @return user model and the node ref to be removed from hold
- */
- @DataProvider (name = "userWithoutPermissionForRemoveFromHold")
- public Object[][] getUserWithoutPermissionForAddToHold()
- {
- //create record folder
- RecordCategoryChild recordFolder = createCategoryFolderInFilePlan();
- nodesToBeClean.add(recordFolder.getParentId());
- UserModel user = roleService.createUserWithRMRole(ROLE_RM_MANAGER.roleId);
- getRestAPIFactory().getRMUserAPI().addUserPermission(holdNodeRefOne, user, PERMISSION_FILING);
- //create files that will be removed from hold
- FileModel contentNoHoldPerm = dataContent.usingAdmin().usingSite(testSite).createContent(CMISUtil.DocumentType.TEXT_PLAIN);
- FileModel contentNoHoldCap = dataContent.usingAdmin().usingSite(testSite).createContent(CMISUtil.DocumentType.TEXT_PLAIN);
- FileModel privateFile = dataContent.usingAdmin().usingSite(privateSite).createContent(CMISUtil.DocumentType.TEXT_PLAIN);
- //add files to hold
- holdsAPI.addItemsToHolds(getAdminUser().getUsername(), getAdminUser().getPassword(),
- asList(recordFolder.getId(), contentNoHoldCap.getNodeRefWithoutVersion(),
- contentNoHoldPerm.getNodeRefWithoutVersion(), privateFile.getNodeRefWithoutVersion()),
- Collections.singletonList(HOLD_ONE));
-
- return new Object[][]
- {
- // user with read permission on the content, with remove from hold capability and without
- // filling permission on a hold
- {
- roleService.createUserWithSiteRoleRMRoleAndPermission(testSite, UserRole.SiteCollaborator,
- holdNodeRefOne, UserRoles.ROLE_RM_MANAGER, PERMISSION_READ_RECORDS),
- contentNoHoldPerm.getNodeRefWithoutVersion()
- },
- // user with write permission on the content, filling permission on a hold without remove from
- // hold capability
- {
- roleService.createUserWithSiteRoleRMRoleAndPermission(testSite, UserRole
- .SiteCollaborator,
- holdNodeRefOne, UserRoles.ROLE_RM_POWER_USER, PERMISSION_FILING),
- contentNoHoldCap.getNodeRefWithoutVersion()
- },
- //user without read permission on RM record folder
- {
- user, recordFolder.getId()
- },
- //user without read permission over the content from the private site
- {
- user, privateFile.getNodeRefWithoutVersion()
- }
-
-
- };
- }
- /**
- * Given node on hold in a single hold location
- * And the user does not have sufficient permissions or capabilities to remove the node from the hold
- * When the user tries to remove the node from the hold
- * Then it's unsuccessful
- * @throws Exception
- */
- @Test (dataProvider = "userWithoutPermissionForRemoveFromHold")
- public void removeFromHoldWithUserWithoutPermission(UserModel userModel, String nodeIdToBeRemoved) throws Exception
- {
- STEP("Update the list of users to be deleted after running the tests");
- usersToBeClean.add(userModel);
-
- STEP("Remove node from hold with user without right permission or capability");
- String responseNoHoldPermission = holdsAPI.removeFromHoldAndGetMessage(userModel.getUsername(),
- userModel.getPassword(), SC_INTERNAL_SERVER_ERROR, nodeIdToBeRemoved, holdNodeRefOne);
- assertTrue(responseNoHoldPermission.contains(ACCESS_DENIED_ERROR_MESSAGE));
-
- STEP("Check node is frozen.");
- assertTrue(hasAspect(nodeIdToBeRemoved, FROZEN_ASPECT));
- }
-
- /**
- * Data provider with user with right permission or capability to remove from hold a specific node
- *
- * @return user model and the node ref to be removed from hold
- */
- @DataProvider (name = "userWithPermissionForRemoveFromHold")
- public Object[][] getUserWithPermissionForAddToHold()
- {
- //create record folder
- RecordCategoryChild recordFolder = createCategoryFolderInFilePlan();
- nodesToBeClean.add(recordFolder.getParentId());
- UserModel user = roleService.createUserWithRMRoleAndRMNodePermission(ROLE_RM_MANAGER.roleId, recordFolder.getId(),
- PERMISSION_READ_RECORDS);
- getRestAPIFactory().getRMUserAPI().addUserPermission(holdNodeRefOne, user, PERMISSION_FILING);
- //create file that will be removed from hold
- FileModel contentPermission = dataContent.usingAdmin().usingSite(testSite).createContent(CMISUtil.DocumentType.TEXT_PLAIN);
-
- //add files to hold
- holdsAPI.addItemsToHolds(getAdminUser().getUsername(), getAdminUser().getPassword(),
- asList(recordFolder.getId(), contentPermission.getNodeRefWithoutVersion()), Collections.singletonList(HOLD_ONE));
-
- return new Object[][]
- {
- // user with write permission on the content
- {
- roleService.createUserWithSiteRoleRMRoleAndPermission(testSite, UserRole.SiteConsumer,
- holdNodeRefOne, UserRoles.ROLE_RM_MANAGER, PERMISSION_FILING),
- contentPermission.getNodeRefWithoutVersion()
- },
- //user with read permission on RM record folder
- {
- user, recordFolder.getId()
- },
-
- };
- }
- @Test (dataProvider = "userWithPermissionForRemoveFromHold")
- public void removeFromHoldWithUserWithPermission(UserModel userModel, String nodeIdToBeRemoved) throws Exception
- {
- STEP("Update the list of users to be deleted after running the tests");
- usersToBeClean.add(userModel);
-
- STEP("Remove node from hold with user with right permission and capability");
- holdsAPI.removeItemFromHold(userModel.getUsername(),
- userModel.getPassword(), nodeIdToBeRemoved, HOLD_ONE);
-
- STEP("Check node is not frozen.");
- assertFalse(hasAspect(nodeIdToBeRemoved, FROZEN_ASPECT));
- }
-
- @AfterClass (alwaysRun = true)
- public void cleanUpRemoveContentFromHold()
- {
- holdsAPI.deleteHold(getAdminUser(), holdNodeRefOne);
- holdsAPI.deleteHold(getAdminUser(), holdNodeRefTwo);
- dataSite.usingAdmin().deleteSite(testSite);
- dataSite.usingAdmin().deleteSite(privateSite);
- usersToBeClean.forEach(user -> getDataUser().usingAdmin().deleteUser(user));
- nodesToBeClean.forEach(category -> deleteRecordCategory(category));
-
- }
-}
diff --git a/amps/ags/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/recordcategories/AutomaticDispositionTest.java b/amps/ags/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/recordcategories/AutomaticDispositionTest.java
deleted file mode 100644
index 789723da36..0000000000
--- a/amps/ags/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/recordcategories/AutomaticDispositionTest.java
+++ /dev/null
@@ -1,95 +0,0 @@
-/*
- * #%L
- * Alfresco Records Management Module
- * %%
- * Copyright (C) 2005 - 2021 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.recordcategories;
-
-import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentAspects.CUT_OFF_ASPECT;
-import static org.alfresco.utility.data.RandomData.getRandomName;
-import static org.alfresco.utility.report.log.Step.STEP;
-import static org.testng.Assert.assertTrue;
-
-import java.util.List;
-
-import org.alfresco.rest.rm.community.base.BaseRMRestTest;
-import org.alfresco.rest.rm.community.model.record.Record;
-import org.alfresco.rest.rm.community.model.recordcategory.RecordCategory;
-import org.alfresco.rest.rm.community.model.recordcategory.RecordCategoryChild;
-
-import org.alfresco.rest.rm.community.requests.gscore.api.RecordsAPI;
-import org.alfresco.rest.v0.service.DispositionScheduleService;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.testng.annotations.AfterClass;
-import org.testng.annotations.Test;
-
-public class AutomaticDispositionTest extends BaseRMRestTest
-{
- @Autowired
- private DispositionScheduleService dispositionScheduleService;
-
- private RecordCategory categoryWithRSOnRecords;
-
- /**
- * Given there is a complete record eligible for cut off
- * When the correct duration of time passes
- * Then the record will be automatically cut off
- */
- @Test(enabled = false)
- public void testAutomaticCutOff() throws Exception
- {
- STEP("Create record category with retention schedule and apply it to records.");
- categoryWithRSOnRecords = createRootCategory(getRandomName("categoryWithRSOnRecords"));
- dispositionScheduleService.createCategoryRetentionSchedule(categoryWithRSOnRecords.getName(), true);
-
- STEP("Add retention schedule cut off step with immediate period.");
- dispositionScheduleService.addCutOffAfterPeriodStep(categoryWithRSOnRecords.getName(), "immediately");
-
- STEP("Create a record folder with a record");
- RecordCategoryChild recordFolder = createRecordFolder(categoryWithRSOnRecords.getId(), getRandomName
- ("recordFolder"));
- Record record = createElectronicRecord(recordFolder.getId(), getRandomName("elRecord"));
-
- STEP("Complete the record and wait upon to 5 minutes for automatic job to execute");
- completeRecord(record.getId());
-
- RecordsAPI recordsAPI = getRestAPIFactory().getRecordsAPI();
- List aspects = recordsAPI.getRecord(record.getId()).getAspectNames();
- int count = 0;
- while (!aspects.contains(CUT_OFF_ASPECT) && count < 30)
- {
- // sleep .. allowing the job time to execute
- Thread.sleep(10000);
- count++;
- aspects = recordsAPI.getRecord(record.getId()).getAspectNames();
- }
- assertTrue(aspects.contains(CUT_OFF_ASPECT), "Record should now be cut off");
- }
-
- @AfterClass (alwaysRun = true)
- public void deleteCategory()
- {
- deleteRecordCategory(categoryWithRSOnRecords.getId());
- }
-}
diff --git a/amps/ags/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/recordcategories/DispositionScheduleInheritanceTests.java b/amps/ags/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/recordcategories/DispositionScheduleInheritanceTests.java
deleted file mode 100644
index 2278196995..0000000000
--- a/amps/ags/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/recordcategories/DispositionScheduleInheritanceTests.java
+++ /dev/null
@@ -1,299 +0,0 @@
-/*
- * #%L
- * Alfresco Records Management Module
- * %%
- * Copyright (C) 2005 - 2021 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.recordcategories;
-
-import static org.alfresco.utility.data.RandomData.getRandomName;
-import static org.alfresco.utility.report.log.Step.STEP;
-
-import org.alfresco.rest.rm.community.base.BaseRMRestTest;
-import org.alfresco.rest.rm.community.model.record.Record;
-import org.alfresco.rest.rm.community.model.recordcategory.RecordCategory;
-import org.alfresco.rest.rm.community.model.recordcategory.RecordCategoryChild;
-import org.alfresco.rest.v0.service.DispositionScheduleService;
-import org.alfresco.test.AlfrescoTest;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.testng.Assert;
-import org.testng.annotations.Test;
-
-public class DispositionScheduleInheritanceTests extends BaseRMRestTest
-{
- private static final String RETAIN_STEP = "retain";
- private static final String CUTOFF_STEP = "cutoff";
-
- @Autowired
- private DispositionScheduleService dispositionScheduleService;
-
- /**
- * Given following structure is created:
- * rootCategory with RS applied on records level
- * - subCategory without RS
- * - recFolder
- * - incomplete electronic record
- * - complete non-electronic record
- * Then both records should inherit the RS from rootCategory
- */
- @AlfrescoTest (jira = "MNT-19967")
- @Test
- public void testRSInheritanceOnRecordsWhenOnlyACategoryHasRS()
- {
- STEP("Create record category with retention schedule and apply it to records.");
- RecordCategory rootCategory = createRootCategory(getRandomName("rootCategory"));
- dispositionScheduleService.createCategoryRetentionSchedule(rootCategory.getName(), true);
-
- STEP("Add retention schedule cut off step with immediate period.");
- dispositionScheduleService.addCutOffAfterPeriodStep(rootCategory.getName(), "immediately");
-
- STEP("Add retention schedule retain step with immediate period.");
- dispositionScheduleService.addRetainAfterPeriodStep(rootCategory.getName(), "immediately");
-
- STEP("Create a subcategory with a record folder");
- RecordCategoryChild subCategory = createRecordCategory(rootCategory.getId(), getRandomName("subCategory"));
- RecordCategoryChild recFolder = createFolder(subCategory.getId(), getRandomName("recFolder"));
-
- STEP("Create 2 records in the record folder. Complete one of them.");
- Record elRecord = createElectronicRecord(recFolder.getId(), getRandomName("elRecord"));
- Record nonElRecord = createNonElectronicRecord(recFolder.getId(), getRandomName("nonElRecord"));
- getRestAPIFactory().getRecordsAPI().completeRecord(nonElRecord.getId());
-
- STEP("Check that both records inherit root category retention schedule");
- Assert.assertTrue(elRecord.getProperties().getRecordSearchHasDispositionSchedule(),
- "rma:recordSearchHasDispositionSchedule property should be true");
- Assert.assertTrue(nonElRecord.getProperties().getRecordSearchHasDispositionSchedule(),
- "rma:recordSearchHasDispositionSchedule property should be true");
- }
-
- /**
- * Given following structure is created:
- * rootCategory with RS applied on records folder level
- * - subCategory without RS
- * - recFolder
- * Then recFolder should inherit the RS from rootCategory
- */
- @Test
- public void testRSInheritanceOnRecordFoldersWhenOnlyACategoryHasRS()
- {
- STEP("Create record category with retention schedule and apply it to record folders.");
- RecordCategory rootCategory = createRootCategory(getRandomName("rootCategory"));
- dispositionScheduleService.createCategoryRetentionSchedule(rootCategory.getName(), false);
-
- STEP("Add retention schedule cut off step with immediate period.");
- dispositionScheduleService.addCutOffAfterPeriodStep(rootCategory.getName(), "immediately");
-
- STEP("Add retention schedule retain step with immediate period.");
- dispositionScheduleService.addRetainAfterPeriodStep(rootCategory.getName(), "immediately");
-
- STEP("Create a subcategory with a record folder");
- RecordCategoryChild subCategory = createRecordCategory(rootCategory.getId(), getRandomName("subCategory"));
- RecordCategoryChild recFolder = createFolder(subCategory.getId(), getRandomName("recFolder"));
-
- STEP("Check that recFolder inherits root category retention schedule");
- Assert.assertTrue(recFolder.getProperties().getRecordSearchHasDispositionSchedule(),
- "rma:recordSearchHasDispositionSchedule property should be true");
- }
-
- /**
- * Given following structure is created:
- * rootCategory with RS applied on records level
- * - subCategory1 with another RS applied on records level
- * - subCategory2 without RS
- * - recFolder
- * - incomplete electronic record
- * - complete non-electronic record
- * Then both records should inherit the RS from subCategory1
- */
- @Test
- public void testRSInheritanceOnRecordsWhen2CategoriesHaveRS()
- {
- STEP("Create record category with retention schedule and apply it to records.");
- RecordCategory rootCategory = createRootCategory(getRandomName("rootCategory"));
- dispositionScheduleService.createCategoryRetentionSchedule(rootCategory.getName(), true);
-
- STEP("Add retention schedule cut off step with immediate period.");
- dispositionScheduleService.addCutOffAfterPeriodStep(rootCategory.getName(), "immediately");
-
- STEP("Create a subcategory with retention schedule and apply it to records.");
- RecordCategoryChild subCategory1 = createRecordCategory(rootCategory.getId(), getRandomName("subCategory"));
- String subcategory1Path = rootCategory.getName() + "/" + subCategory1.getName();
- dispositionScheduleService.createCategoryRetentionSchedule(subcategory1Path, true);
-
- STEP("Add retention schedule retain step with 1 day after created date.");
- dispositionScheduleService.addRetainAfterPeriodStep(subcategory1Path, "day|1");
-
- STEP("Create a subcategory2 in subcategory1");
- RecordCategoryChild subCategory2 = createRecordCategory(subCategory1.getId(), getRandomName("subCategory"));
-
- STEP("Create a record folder with 2 records. Complete one of them.");
- RecordCategoryChild recFolder = createFolder(subCategory2.getId(), getRandomName("recFolder"));
- Record elRecord = createElectronicRecord(recFolder.getId(), getRandomName("elRecord"));
- Record nonElRecord = createNonElectronicRecord(recFolder.getId(), getRandomName("nonElRecord"));
- getRestAPIFactory().getRecordsAPI().completeRecord(nonElRecord.getId());
-
- STEP("Check that both records inherit subCategory1 retention schedule");
- Assert.assertTrue(elRecord.getProperties().getRecordSearchHasDispositionSchedule(),
- "rma:recordSearchHasDispositionSchedule property should be true for incomplete record");
- Assert.assertTrue(nonElRecord.getProperties().getRecordSearchHasDispositionSchedule(),
- "rma:recordSearchHasDispositionSchedule property should be true for complete record");
- Assert.assertEquals(elRecord.getProperties().getRecordSearchDispositionActionName(),
- RETAIN_STEP,
- "Disposition action should be retain and not cutoff for incomplete record");
- Assert.assertEquals(nonElRecord.getProperties().getRecordSearchDispositionActionName(),
- RETAIN_STEP,
- "Disposition action should be retain and not cutoff for complete record");
- }
-
- /**
- * Given following structure is created:
- * rootCategory with RS applied on records folder level
- * - subCategory1 with another RS applied on records folder level
- * - subCategory2 without RS
- * - recFolder
- * Then recFolder should inherit the RS from subCategory1
- */
- @Test
- public void testRSInheritanceOnRecordFoldersWhen2CategoriesHaveRS()
- {
- STEP("Create record category with retention schedule and apply it to record folders.");
- RecordCategory rootCategory = createRootCategory(getRandomName("rootCategory"));
- dispositionScheduleService.createCategoryRetentionSchedule(rootCategory.getName(), false);
-
- STEP("Add retention schedule retain step with 2 days after created date.");
- dispositionScheduleService.addRetainAfterPeriodStep(rootCategory.getName(), "day|2");
-
- STEP("Create a subcategory with retention schedule and apply it to record folders.");
- RecordCategoryChild subCategory1 = createRecordCategory(rootCategory.getId(), getRandomName("subCategory"));
- String subcategory1Path = rootCategory.getName() + "/" + subCategory1.getName();
- dispositionScheduleService.createCategoryRetentionSchedule(subcategory1Path, false);
-
- STEP("Add retention schedule cut off step with immediate period.");
- dispositionScheduleService.addCutOffAfterPeriodStep(subcategory1Path, "immediately");
-
- STEP("Create a subcategory2 with a record folder in subcategory1");
- RecordCategoryChild subCategory2 = createRecordCategory(subCategory1.getId(), getRandomName("subCategory"));
- RecordCategoryChild recFolder = createFolder(subCategory2.getId(), getRandomName("recFolder"));
-
- STEP("Check that recFolder inherits subCategory1 retention schedule");
- Assert.assertTrue(recFolder.getProperties().getRecordSearchHasDispositionSchedule(),
- "rma:recordSearchHasDispositionSchedule property should be true");
- Assert.assertEquals(recFolder.getProperties().getRecordSearchDispositionActionName(),
- CUTOFF_STEP,
- "Disposition action should be cutoff and not retain for the record folder");
- }
-
- /**
- * Given following structure is created:
- * rootCategory with RS applied on folder records level
- * - subCategory with another RS applied on records level
- * - recFolder
- * - incomplete electronic record
- * - complete non-electronic record
- * Then both records should inherit the RS from subCategory
- */
- @Test
- public void testMixedRSInheritanceWhenFirstParentHasRSOnRecords()
- {
- STEP("Create record category with retention schedule and apply it to folder records.");
- RecordCategory rootCategory = createRootCategory(getRandomName("rootCategory"));
- dispositionScheduleService.createCategoryRetentionSchedule(rootCategory.getName(), false);
-
- STEP("Add retention schedule cut off step with immediate period.");
- dispositionScheduleService.addCutOffAfterPeriodStep(rootCategory.getName(), "immediately");
-
- STEP("Create a subcategory with retention schedule and apply it to records.");
- RecordCategoryChild subCategory = createRecordCategory(rootCategory.getId(), getRandomName("subCategory"));
- String subcategoryPath = rootCategory.getName() + "/" + subCategory.getName();
- dispositionScheduleService.createCategoryRetentionSchedule(subcategoryPath, true);
-
- STEP("Add retention schedule retain step with 1 day after created date.");
- dispositionScheduleService.addRetainAfterPeriodStep(subcategoryPath, "day|1");
-
- STEP("Create a record folder with 2 records. Complete one of them.");
- RecordCategoryChild recFolder = createFolder(subCategory.getId(), getRandomName("recFolder"));
- Record elRecord = createElectronicRecord(recFolder.getId(), getRandomName("elRecord"));
- Record nonElRecord = createNonElectronicRecord(recFolder.getId(), getRandomName("nonElRecord"));
- getRestAPIFactory().getRecordsAPI().completeRecord(nonElRecord.getId());
-
- STEP("Check that both records inherit subCategory retention schedule");
- Assert.assertTrue(elRecord.getProperties().getRecordSearchHasDispositionSchedule(),
- "rma:recordSearchHasDispositionSchedule property should be true for incomplete record");
- Assert.assertTrue(nonElRecord.getProperties().getRecordSearchHasDispositionSchedule(),
- "rma:recordSearchHasDispositionSchedule property should be true for complete record");
- Assert.assertEquals(elRecord.getProperties().getRecordSearchDispositionActionName(),
- RETAIN_STEP,
- "Disposition action should be retain and not cutoff for incomplete record");
- Assert.assertEquals(nonElRecord.getProperties().getRecordSearchDispositionActionName(),
- RETAIN_STEP,
- "Disposition action should be retain and not cutoff for complete record");
- }
-
- /**
- * Given following structure is created:
- * rootCategory with RS applied on records level
- * - subCategory with another RS applied on folder records level
- * - recFolder
- * - incomplete electronic record
- * - complete non-electronic record
- * Then both records should not have RS (rma:recordSearchHasDispositionSchedule property is set to false)
- * and record folder inherits the RS from subCategory
- */
- @Test
- public void testMixedRSInheritanceWhenFirstParentHasRSOnFolders()
- {
- STEP("Create record category with retention schedule and apply it to records.");
- RecordCategory rootCategory = createRootCategory(getRandomName("rootCategory"));
- dispositionScheduleService.createCategoryRetentionSchedule(rootCategory.getName(), true);
-
- STEP("Add retention schedule cut off step with immediate period.");
- dispositionScheduleService.addCutOffAfterPeriodStep(rootCategory.getName(), "immediately");
-
- STEP("Create a subcategory with retention schedule and apply it to record folders.");
- RecordCategoryChild subCategory = createRecordCategory(rootCategory.getId(), getRandomName("subCategory"));
- String subcategoryPath = rootCategory.getName() + "/" + subCategory.getName();
- dispositionScheduleService.createCategoryRetentionSchedule(subcategoryPath, false);
-
- STEP("Add retention schedule retain step with 1 day after created date.");
- dispositionScheduleService.addRetainAfterPeriodStep(subcategoryPath, "day|1");
-
- STEP("Create a record folder with 2 records. Complete one of them.");
- RecordCategoryChild recFolder = createFolder(subCategory.getId(), getRandomName("recFolder"));
- Record elRecord = createElectronicRecord(recFolder.getId(), getRandomName("elRecord"));
- Record nonElRecord = createNonElectronicRecord(recFolder.getId(), getRandomName("nonElRecord"));
- getRestAPIFactory().getRecordsAPI().completeRecord(nonElRecord.getId());
-
- STEP("Check that the records don't have retention schedule");
- Assert.assertFalse(elRecord.getProperties().getRecordSearchHasDispositionSchedule(),
- "rma:recordSearchHasDispositionSchedule property should be false for incomplete record");
- Assert.assertFalse(nonElRecord.getProperties().getRecordSearchHasDispositionSchedule(),
- "rma:recordSearchHasDispositionSchedule property should be false for complete record");
-
- STEP("Check that recFolder inherits subCategory retention schedule");
- Assert.assertTrue(recFolder.getProperties().getRecordSearchHasDispositionSchedule(),
- "rma:recordSearchHasDispositionSchedule property should be true");
- Assert.assertEquals(recFolder.getProperties().getRecordSearchDispositionActionName(),
- RETAIN_STEP,
- "Disposition action should be retain and not cutoff for the record folder");
- }
-}
diff --git a/amps/ags/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/recordcategories/RecordCategoryTests.java b/amps/ags/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/recordcategories/RecordCategoryTests.java
deleted file mode 100644
index fd10c605ab..0000000000
--- a/amps/ags/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/recordcategories/RecordCategoryTests.java
+++ /dev/null
@@ -1,786 +0,0 @@
-/*
- * #%L
- * Alfresco Records Management Module
- * %%
- * Copyright (C) 2005 - 2021 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.recordcategories;
-
-import static java.time.LocalDateTime.now;
-
-import static org.alfresco.rest.rm.community.base.TestData.RECORD_FOLDER_NAME;
-import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentAlias.FILE_PLAN_ALIAS;
-import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentAlias.TRANSFERS_ALIAS;
-import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentAlias.UNFILED_RECORDS_CONTAINER_ALIAS;
-import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PATH;
-import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentType.RECORD_CATEGORY_TYPE;
-import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentType.RECORD_FOLDER_TYPE;
-import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentType.UNFILED_RECORD_FOLDER_TYPE;
-import static org.alfresco.rest.rm.community.utils.FilePlanComponentsUtil.TITLE_PREFIX;
-import static org.alfresco.rest.rm.community.utils.FilePlanComponentsUtil.createRecordCategoryChildModel;
-import static org.alfresco.utility.data.RandomData.getRandomAlphanumeric;
-import static org.springframework.http.HttpStatus.BAD_REQUEST;
-import static org.springframework.http.HttpStatus.CONFLICT;
-import static org.springframework.http.HttpStatus.CREATED;
-import static org.springframework.http.HttpStatus.NOT_FOUND;
-import static org.springframework.http.HttpStatus.NO_CONTENT;
-import static org.springframework.http.HttpStatus.OK;
-import static org.springframework.http.HttpStatus.UNPROCESSABLE_ENTITY;
-import static org.testng.Assert.assertEquals;
-import static org.testng.Assert.assertFalse;
-import static org.testng.Assert.assertNotEquals;
-import static org.testng.Assert.assertNotNull;
-import static org.testng.Assert.assertTrue;
-import static org.testng.Assert.fail;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.NoSuchElementException;
-
-import org.alfresco.rest.core.v0.BaseAPI.RETENTION_SCHEDULE;
-import org.alfresco.rest.rm.community.base.BaseRMRestTest;
-import org.alfresco.rest.rm.community.base.DataProviderClass;
-import org.alfresco.rest.rm.community.model.fileplan.FilePlan;
-import org.alfresco.rest.rm.community.model.recordcategory.RecordCategory;
-import org.alfresco.rest.rm.community.model.recordcategory.RecordCategoryChild;
-import org.alfresco.rest.rm.community.model.recordcategory.RecordCategoryChildCollection;
-import org.alfresco.rest.rm.community.model.recordcategory.RecordCategoryChildProperties;
-import org.alfresco.rest.rm.community.model.recordfolder.RecordFolder;
-import org.alfresco.rest.rm.community.requests.gscore.api.FilePlanAPI;
-import org.alfresco.rest.rm.community.requests.gscore.api.RecordCategoryAPI;
-import org.alfresco.rest.rm.community.requests.gscore.api.RecordFolderAPI;
-import org.alfresco.rest.v0.RecordCategoriesAPI;
-import org.alfresco.utility.report.Bug;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.testng.annotations.DataProvider;
-import org.testng.annotations.Test;
-
-/**
- * Record category related API tests
- *
- * @author Kristijan Conkas
- * @author Tuna Aksoy
- * @since 2.6
- */
-public class RecordCategoryTests extends BaseRMRestTest
-{
- public static final String RECORD_CATEGORY_NAME = "CATEGORY NAME" + getRandomAlphanumeric();
-
- /** Number of children (for children creation test) */
- private static final int NUMBER_OF_CHILDREN = 10;
- private static final int NUMBER_OF_FOLDERS = 5;
-
- @Autowired
- private RecordCategoriesAPI recordCategoriesAPI;
-
- /**
- * Invalid containers that cannot be deleted with record category end-point
- */
- @DataProvider (name = "invalidContainersToDelete")
- public Object[][] getNodesToDelete()
- {
- return new String[][] {
- { FILE_PLAN_ALIAS },
- { UNFILED_RECORDS_CONTAINER_ALIAS },
- { TRANSFERS_ALIAS },
- // an arbitrary record category
- { createCategoryFolderInFilePlan(getAdminUser()).getId() },
- // an arbitrary unfiled records folder
- { createUnfiledContainerChild(UNFILED_RECORDS_CONTAINER_ALIAS, "Unfiled Folder " + getRandomAlphanumeric(), UNFILED_RECORD_FOLDER_TYPE).getId() }
- };
- }
-
- /**
- *
- * Given that a record category exists
- * When I ask the API to update the details of the record category
- * Then the details of the record category are updated
- *
- */
- @Test
- (
- description = "Rename root category"
- )
- public void renameCategory()
- {
- // Create record category first
- String categoryName = "Category name " + getRandomAlphanumeric();
- String categoryTitle = "Category title " + getRandomAlphanumeric();
-
- // Create the root record category
- RecordCategory rootRecordCategory = createRootCategory(categoryName, categoryTitle);
-
- String newCategoryName = "Rename " + categoryName;
-
- // Build the properties which will be updated
- RecordCategory recordCategoryUpdated = RecordCategory.builder().name(newCategoryName).build();
-
- // Update the record category
- RecordCategory renamedRecordCategory = getRestAPIFactory().getRecordCategoryAPI().updateRecordCategory(recordCategoryUpdated, rootRecordCategory.getId());
-
- // Verify the status code
- assertStatusCode(OK);
-
- // Verify the returned file plan component
- assertEquals(renamedRecordCategory.getName(), newCategoryName);
-
- // Get actual FILE_PLAN_ALIAS id
- FilePlan filePlan = getRestAPIFactory().getFilePlansAPI().getFilePlan(FILE_PLAN_ALIAS);
-
- // verify renamed component still has this parent
- assertEquals(renamedRecordCategory.getParentId(), filePlan.getId());
- }
-
- /**
- *
- * Given that a record category exists
- * When I ask the API to delete the record category
- * Then the record category and all its contents are deleted
- *
- */
- @Test
- (
- description = "Delete category"
- )
- public void deleteCategory()
- {
- // Create record category first
- String categoryName = "Category name " + getRandomAlphanumeric();
- String categoryTitle = "Category title " + getRandomAlphanumeric();
-
- // Create the root record category
- RecordCategory rootRecordCategory = createRootCategory(categoryName, categoryTitle);
-
- int totalEntries= getRestAPIFactory().getFilePlansAPI().getRootRecordCategories(FILE_PLAN_ALIAS).getPagination().getTotalItems();
- // Delete the record category
- RecordCategoryAPI recordCategoryAPI = getRestAPIFactory().getRecordCategoryAPI();
- String recordCategoryId = rootRecordCategory.getId();
- recordCategoryAPI.deleteRecordCategory(recordCategoryId);
-
- // Verify the status code
- assertStatusCode(NO_CONTENT);
-
- // Deleted component should no longer be retrievable
- recordCategoryAPI.getRecordCategory(recordCategoryId);
- assertStatusCode(NOT_FOUND);
- //check the number of entries after delete
- int totalEntriesAfterDelete = getRestAPIFactory().getFilePlansAPI().getRootRecordCategories(FILE_PLAN_ALIAS).getPagination().getTotalItems();
- assertEquals(totalEntriesAfterDelete,(totalEntries-1));
- }
-
- /**
- *
- * Given that nodes that are not record category
- * When I ask to delete the nodes with the delete request from the record-categories endpoint
- * Then the request fails
- *
- */
- @Test
- (
- description = "Delete invalid nodes with delete category endpoint",
- dataProvider = "invalidContainersToDelete"
- )
- public void deleteInvalidNodes(String nodeId)
- {
-
- // Delete the record category
- RecordCategoryAPI recordCategoryAPI = getRestAPIFactory().getRecordCategoryAPI();
- recordCategoryAPI.deleteRecordCategory(nodeId);
-
- // Verify the status code
- assertStatusCode(BAD_REQUEST);
-
- }
-
- /**
- *
- * Given that a record category exists
- * When I ask the API to create a record category
- * Then it is created within the record category
- *
- */
- @Test
- (
- description = "Create child category"
- )
- public void createSubcategory()
- {
- // Create root level category
- RecordCategory rootCategory = createRootCategory(getRandomAlphanumeric());
- assertNotNull(rootCategory.getId());
-
- // Create sub-category as a child of rootCategory
- RecordCategoryChild recordCategory = createRecordCategoryChild(rootCategory.getId(), RECORD_CATEGORY_NAME, RECORD_CATEGORY_TYPE);
-
- // Child category created?
- assertNotNull(recordCategory.getId());
-
- // Verify child category
- assertEquals(recordCategory.getParentId(), rootCategory.getId());
- assertTrue(recordCategory.getIsRecordCategory());
- assertFalse(recordCategory.getIsRecordFolder());
- assertEquals(recordCategory.getNodeType(), RECORD_CATEGORY_TYPE);
-
-
- //get the sub-category
- RecordCategory subCategory = getRestAPIFactory().getRecordCategoryAPI().getRecordCategory(recordCategory.getId(),"include=isRecordCategory,isRecordFolder");
- // Verify child category
- assertEquals(subCategory.getParentId(), rootCategory.getId());
- assertEquals(subCategory.getNodeType(), RECORD_CATEGORY_TYPE);
- assertFalse(subCategory.getAspectNames().isEmpty());
- assertNotNull(subCategory.getProperties().getIdentifier());
- }
-
- /**
- *
- * Given that a record category exists
- * When I use the API to create children of type record folder
- * Then a record folder it is created within the record category
- *
- *
- * Given that a record category exists
- * When I use the API to create children of type folder (cm:folder type)
- * Then the folder is converted to rma:recordFolder within the record category
- * (see RM-4572 comments)
- *
- */
- @Test
- (
- description = "Create a record folder into a record category.",
- dataProviderClass = DataProviderClass.class,
- dataProvider = "folderTypes"
- )
- @Bug (id = "RM-4572")
- public void createFolderTest(String folderType)
- {
- // Authenticate with admin user
- RecordCategory rootRecordCategory = createRootCategory(RECORD_CATEGORY_NAME + getRandomAlphanumeric());
-
- // Create the record folder
- RecordCategoryChild recordFolder = createRecordCategoryChild(rootRecordCategory.getId(), RECORD_FOLDER_NAME, folderType);
-
- // Assert status code
- assertStatusCode(CREATED);
-
- // Check record folder has been created within the record category
- assertEquals(rootRecordCategory.getId(), recordFolder.getParentId());
-
- // Verify the returned values for the record folder
- assertFalse(recordFolder.getIsRecordCategory());
- assertTrue(recordFolder.getIsRecordFolder());
- assertEquals(recordFolder.getName(), RECORD_FOLDER_NAME);
- assertEquals(recordFolder.getNodeType(), RECORD_FOLDER_TYPE);
- assertEquals(recordFolder.getCreatedByUser().getId(), getAdminUser().getUsername());
-
- // Verify the returned record folder properties
- RecordCategoryChildProperties folderProperties = recordFolder.getProperties();
- assertEquals(folderProperties.getTitle(), TITLE_PREFIX + RECORD_FOLDER_NAME);
- assertNotNull(folderProperties.getIdentifier());
- }
- @Test
- (
- dataProviderClass = DataProviderClass.class,
- dataProvider = "categoryChild"
- )
- @Bug(id = "RM-5116")
- public void createdDuplicateChild(String childType)
- {
- // create a root category
- String rootRecordCategory = createRootCategory(RECORD_CATEGORY_NAME + getRandomAlphanumeric()).getId();
-
- // Create the record category child
- RecordCategoryChild recordFolder = createRecordCategoryChild(rootRecordCategory, RECORD_FOLDER_NAME, childType);
-
- // check the response code
- assertStatusCode(CREATED);
- assertEquals(recordFolder.getName(), RECORD_FOLDER_NAME);
-
- // Create a record category child with the same name as the exiting one
-
- RecordCategoryChild recordFolderDuplicate = getRestAPIFactory().getRecordCategoryAPI().createRecordCategoryChild(
- createRecordCategoryChildModel(RECORD_FOLDER_NAME, childType), rootRecordCategory);
-
- // check the response code
- assertStatusCode(CONFLICT);
-
- // Create a record folder with the same name as the exiting one and with the autoRename parameter on true
- recordFolderDuplicate = getRestAPIFactory().getRecordCategoryAPI()
- .createRecordCategoryChild(createRecordCategoryChildModel(RECORD_FOLDER_NAME,
- childType),
- rootRecordCategory, "autoRename=true");
- // check the response code
- assertStatusCode(CREATED);
- assertNotEquals(recordFolderDuplicate.getName(), RECORD_FOLDER_NAME);
- assertTrue(recordFolderDuplicate.getName().contains(RECORD_FOLDER_NAME));
- }
-
- /**
- *
- * Given that a record category exists
- * And contains a number of record categories and record folders
- * When I ask the API to get me the children of the record category
- * Then I am returned the contained record categories and record folders and their details
- *
- *
- * Given that a record category with a disposition schedule exists
- * And contains a number of record categories and record folders
- * When I ask the API to get me the children of the record category
- * Then I am returned the contained record categories and record folders but not the disposition schedule
- *
- */
- @Test
- (
- description = "Get children of a record category excluding the disposition schedule"
- )
- @Bug (id="RM-5115")
- public void getRecordCategoryChildren()
- {
- // Create root level category
- RecordCategory rootRecordCategory = createRootCategory(getRandomAlphanumeric());
- assertNotNull(rootRecordCategory.getId());
-
- // Create disposition schedule
- String userName = getAdminUser().getUsername();
- String userPassword = getAdminUser().getPassword();
- String categoryName = rootRecordCategory.getName();
- recordCategoriesAPI.createRetentionSchedule(userName, userPassword, categoryName);
-
- // Add disposition schedule cut off step
- HashMap cutOffStep = new HashMap<>();
- cutOffStep.put(RETENTION_SCHEDULE.NAME, "cutoff");
- cutOffStep.put(RETENTION_SCHEDULE.RETENTION_PERIOD, "day|2");
- cutOffStep.put(RETENTION_SCHEDULE.DESCRIPTION, "Cut off after 2 days");
- recordCategoriesAPI.addDispositionScheduleSteps(userName, userPassword, categoryName, cutOffStep);
-
- // Add record category children
- List children = new ArrayList<>();
- for (int i=0; i < NUMBER_OF_CHILDREN; i++)
- {
- // Create a record category child
- RecordCategoryChild child = createRecordCategoryChild(rootRecordCategory.getId(),
- getRandomAlphanumeric(),
- // half of the children should be sub-categories, the other sub-folders
- (i <= NUMBER_OF_CHILDREN / 2) ? RECORD_CATEGORY_TYPE : RECORD_FOLDER_TYPE);
- assertNotNull(child.getId());
- children.add(child);
- }
-
- // Get children from API
- RecordCategoryChildCollection recordCategoryChildren = getRestAPIFactory().getRecordCategoryAPI().getRecordCategoryChildren(rootRecordCategory.getId(),"include=isRecordCategory,isRecordFolder");
-
- // Check status code
- assertStatusCode(OK);
- logger.info("Parent: " + rootRecordCategory.getId());
-
- // Check listed children against created list
- recordCategoryChildren.getEntries().forEach(c ->
- {
- RecordCategoryChild recordCategoryChild = c.getEntry();
- String recordCategoryChildId = recordCategoryChild.getId();
-
- assertNotNull(recordCategoryChildId);
- logger.info("Checking child " + recordCategoryChildId);
-
- try
- {
- // Find this child in created children list
- RecordCategoryChild createdComponent = children.stream()
- .filter(child -> child.getId().equals(recordCategoryChildId))
- .findFirst()
- .orElseThrow();
-
- // Created by
- assertEquals(recordCategoryChild.getCreatedByUser().getId(), getAdminUser().getUsername());
-
- // Is parent id set correctly?
- assertEquals(recordCategoryChild.getParentId(), rootRecordCategory.getId());
-
- // Boolean properties related to node type
- // Only RECORD_CATEGORY_TYPE and RECORD_FOLDER_TYPE have been created
- if (recordCategoryChild.getNodeType().equals(RECORD_CATEGORY_TYPE))
- {
- assertTrue(recordCategoryChild.getIsRecordCategory());
- assertFalse(recordCategoryChild.getIsRecordFolder());
- }
- else
- {
- assertTrue(recordCategoryChild.getIsRecordFolder());
- assertFalse(recordCategoryChild.getIsRecordCategory());
- }
-
- // Does returned object have the same contents as the created one?
- assertEquals(createdComponent.getName(), recordCategoryChild.getName());
- assertEquals(createdComponent.getNodeType(), recordCategoryChild.getNodeType());
-
- // verify the record categories children identifier
- assertNotNull(createdComponent.getProperties().getIdentifier());
- }
- catch (NoSuchElementException e)
- {
- fail("No child element for " + recordCategoryChildId);
- }
- });
- }
-
- /**
- *
- * Given that a record category exists
- * When I ask to create an object type which is not a record category or a record folder as a child
- * Then the children are not created and the 422 response code is returned
- *
- */
- @Test
- (
- description = "Create node types not allowed inside a category",
- dataProviderClass = DataProviderClass.class,
- dataProvider = "childrenNotAllowedForCategory"
- )
- @Bug (id="RM-4367, RM-4572")
- public void createTypesNotAllowedInCategory(String nodeType)
- {
- String componentName = "Component" + getRandomAlphanumeric();
-
- // Create the category
- RecordCategory rootRecordCategory = createRootCategory(componentName);
-
- // Create the invalid node type
- createRecordCategoryChild(rootRecordCategory.getId(), componentName, nodeType);
- assertStatusCode(UNPROCESSABLE_ENTITY);
- }
-
- /**
- *
- * Given that a record category exists
- * And contains several record folders
- * When I use the API to get the record category children for an existing record category
- * Then I am provided with a list of the contained record category children and their details
- *
- */
- @Test
- (
- description = "Get children of a record category"
- )
- public void getFolders()
- {
- // Authenticate with admin user
- RecordCategory rootRecordCategory = createRootCategory(RECORD_CATEGORY_NAME + getRandomAlphanumeric());
-
- // Add child folders
- ArrayList children = new ArrayList<>();
- for (int i = 0; i < NUMBER_OF_FOLDERS; i++)
- {
- // Create a record folder
- RecordCategoryChild recordCategoryChild = createRecordFolder(rootRecordCategory.getId(), getRandomAlphanumeric());
- assertNotNull(recordCategoryChild.getId());
- children.add(recordCategoryChild);
- }
-
- // Get record category children from API
- RecordCategoryChildCollection recordCategoryChildren = getRestAPIFactory().getRecordCategoryAPI().getRecordCategoryChildren(rootRecordCategory.getId(), "include=isRecordCategory,isRecordFolder");
-
- // Check status code
- assertStatusCode(OK);
-
- // Check children against created list
- recordCategoryChildren.getEntries().forEach(c ->
- {
- RecordCategoryChild recordCategoryChild = c.getEntry();
- String recordCategoryChildId = recordCategoryChild.getId();
- assertNotNull(recordCategoryChildId);
- logger.info("Checking child " + recordCategoryChildId);
-
- try
- {
- // Find this child in created children list
- RecordCategoryChild createdComponent = children.stream()
- .filter(child -> child.getId().equals(recordCategoryChildId))
- .findFirst()
- .orElseThrow();
-
- // Created by
- assertEquals(recordCategoryChild.getCreatedByUser().getId(), getAdminUser().getUsername());
-
- // Is parent id set correctly
- assertEquals(recordCategoryChild.getParentId(), rootRecordCategory.getId());
-
- // Boolean properties related to node type
- assertTrue(recordCategoryChild.getIsRecordFolder());
- assertFalse(recordCategoryChild.getIsRecordCategory());
-
- assertEquals(createdComponent.getName(), recordCategoryChild.getName());
- assertEquals(createdComponent.getNodeType(), recordCategoryChild.getNodeType());
-
- } catch (NoSuchElementException e)
- {
- fail("No child element for " + recordCategoryChildId);
- }
- }
- );
-
- }
-
- /**
- *
- * Given that I want to create a record folder
- * When I use the API with the relativePath
- * Then the categories specified in the relativePath that don't exist are created
- *
- */
- @Test
- (
- description = "Create a folder using record-categories endpoint, based on the relativePath. " +
- "Containers in the relativePath that do not exist are created before the node is created"
- )
- public void createRecordFolderWithRelativePath()
- {
- // The record category to be created
- RecordCategory recordCategoryModel = RecordCategory.builder()
- .name(RECORD_CATEGORY_NAME + getRandomAlphanumeric())
- .nodeType(RECORD_CATEGORY_TYPE)
- .build();
- FilePlanAPI filePlansAPI = getRestAPIFactory().getFilePlansAPI();
- RecordCategory createRootRecordCategory = filePlansAPI.createRootRecordCategory(recordCategoryModel, FILE_PLAN_ALIAS, "include=" + PATH);
- // Check the API response code
- assertStatusCode(CREATED);
- String recordCategoryId = createRootRecordCategory.getId();
-
- // relativePath specify the container structure to create relative to the record folder to be created
- String relativePath = now().getYear() + "/" + now().getMonth() + "/" + now().getDayOfMonth();
-
- // The record folder to be created
- RecordCategoryChild recordFolderModel = RecordCategoryChild.builder()
- .name(RECORD_FOLDER_NAME)
- .nodeType(RECORD_FOLDER_TYPE)
- .relativePath(relativePath)
- .build();
-
- // Create the record folder
- RecordCategoryAPI recordCategoryAPI = getRestAPIFactory().getRecordCategoryAPI();
- RecordCategoryChild recordCategoryChild = recordCategoryAPI.createRecordCategoryChild(recordFolderModel, recordCategoryId, "include=" + PATH);
-
- // Check the API response code
- assertStatusCode(CREATED);
-
- // Verify the returned details for the record folder
- assertFalse(recordCategoryChild.getIsRecordCategory());
- assertTrue(recordCategoryChild.getIsRecordFolder());
-
- // Check the path return contains the relativePath
- assertTrue(recordCategoryChild.getPath().getName().contains(relativePath));
-
- // Check the parent is a category
- assertNotNull(recordCategoryAPI.getRecordCategory(recordCategoryChild.getParentId()).getId());
-
- // Check the created folder from the server
- RecordFolderAPI recordFolderAPI = getRestAPIFactory().getRecordFolderAPI();
- RecordFolder recordFolder = recordFolderAPI.getRecordFolder(recordCategoryChild.getId(), "include=" + PATH);
-
- // Check the API response code
- assertStatusCode(OK);
-
- // Verify the returned details for the record folder
- assertEquals(recordFolder.getNodeType(), RECORD_FOLDER_TYPE);
-
- // Check the path return contains the relativePath
- assertTrue(recordFolder.getPath().getName().contains(relativePath));
-
- // New relative path only a part of containers need to be created before the record folder
- String newRelativePath = now().getYear() + "/" + now().getMonth() + "/" + (now().getDayOfMonth() + 1);
-
- // The record folder to be created
- RecordCategoryChild newRecordFolderModel = RecordCategoryChild.builder()
- .name(RECORD_FOLDER_NAME)
- .nodeType(RECORD_FOLDER_TYPE)
- .relativePath(newRelativePath)
- .build();
-
- // Create the record folder
- RecordCategoryChild newRecordCategoryChild = recordCategoryAPI.createRecordCategoryChild(newRecordFolderModel, recordCategoryId, "include=" + PATH);
-
- // Check the API response code
- assertStatusCode(CREATED);
-
- // Verify the returned properties for the file plan component - record folder
- assertFalse(newRecordCategoryChild.getIsRecordCategory());
- assertTrue(newRecordCategoryChild.getIsRecordFolder());
-
- // Check the path return contains the newRelativePath
- assertTrue(newRecordCategoryChild.getPath().getName().contains(newRelativePath));
-
- // Check the parent is a category
- assertNotNull(recordCategoryAPI.getRecordCategory(newRecordCategoryChild.getParentId()).getId());
-
- // Check the folder created on the server
- RecordFolder newRecordFolder = recordFolderAPI.getRecordFolder(newRecordCategoryChild.getId(), "include=" + PATH);
-
- // Check the API response code
- assertStatusCode(OK);
-
- // Verify the returned details for the record folder
- assertEquals(recordFolder.getNodeType(), RECORD_FOLDER_TYPE);
-
- // Check the path return contains the newRelativePath
- assertTrue(newRecordFolder.getPath().getName().contains(newRelativePath));
- }
-
-
- /**
- *
- * Given that I want to create a record sub-category
- * When I use the API with the relativePath
- * Then the categories specified in the relativePath that don't exist are created
- *
- */
- @Test
- (
- description = "Create a sub-category using record-categories endpoint, based on the relativePath. " +
- "Containers in the relativePath that do not exist are created before the node is created"
- )
- public void createRecordSubCategoryWithRelativePath()
- {
- // The record category to be created
- RecordCategory recordCategoryModel = RecordCategory.builder()
- .name(RECORD_CATEGORY_NAME + getRandomAlphanumeric())
- .nodeType(RECORD_CATEGORY_TYPE)
- .build();
- FilePlanAPI filePlansAPI = getRestAPIFactory().getFilePlansAPI();
- RecordCategory createRootRecordCategory = filePlansAPI.createRootRecordCategory(recordCategoryModel, FILE_PLAN_ALIAS, "include=" + PATH);
- // Check the API response code
- assertStatusCode(CREATED);
- String recordCategoryId = createRootRecordCategory.getId();
-
- // relativePath specify the container structure to create relative to the record folder to be created
- String relativePath = now().getYear() + "/" + now().getMonth() + "/" + now().getDayOfMonth()+ "/"+getRandomAlphanumeric();
-
- // The record folder to be created
- RecordCategoryChild recordFolderModel = RecordCategoryChild.builder()
- .name(RECORD_CATEGORY_NAME)
- .nodeType(RECORD_CATEGORY_TYPE)
- .relativePath(relativePath)
- .build();
-
- // Create the record folder
- RecordCategoryAPI recordCategoryAPI = getRestAPIFactory().getRecordCategoryAPI();
- RecordCategoryChild recordCategoryChild = recordCategoryAPI.createRecordCategoryChild(recordFolderModel, recordCategoryId, "include=" + PATH);
-
- // Check the API response code
- assertStatusCode(CREATED);
-
- // Verify the returned details for the record sub-category
- assertTrue(recordCategoryChild.getIsRecordCategory());
- assertFalse(recordCategoryChild.getIsRecordFolder());
-
- // Check the path return contains the relativePath
- assertTrue(recordCategoryChild.getPath().getName().contains(relativePath));
-
- // Check the parent is a category
- assertNotNull(recordCategoryAPI.getRecordCategory(recordCategoryChild.getParentId()).getId());
-
- // Check the created folder from the server
- RecordCategory recordSubCategory = recordCategoryAPI.getRecordCategory(recordCategoryChild.getId(), "include=" + PATH);
-
- // Check the API response code
- assertStatusCode(OK);
-
- // Verify the returned details for the record folder
- assertEquals(recordSubCategory.getNodeType(), RECORD_CATEGORY_TYPE);
-
- // Check the path return contains the relativePath
- assertTrue(recordSubCategory.getPath().getName().contains(relativePath));
-
- // New relative path only a part of containers need to be created before the record folder
- String newRelativePath = now().getYear() + "/" + now().getMonth() + "/" + (now().getDayOfMonth() + 1) +"/"+getRandomAlphanumeric();
-
- // The record folder to be created
- RecordCategoryChild newRecordFolderModel = RecordCategoryChild.builder()
- .name(RECORD_CATEGORY_NAME)
- .nodeType(RECORD_CATEGORY_TYPE)
- .relativePath(newRelativePath)
- .build();
-
- // Create the record folder
- RecordCategoryChild newRecordCategoryChild = recordCategoryAPI.createRecordCategoryChild(newRecordFolderModel, recordCategoryId, "include=" + PATH);
-
- // Check the API response code
- assertStatusCode(CREATED);
-
- // Verify the returned properties for the file plan component - record folder
- assertTrue(newRecordCategoryChild.getIsRecordCategory());
- assertFalse(newRecordCategoryChild.getIsRecordFolder());
-
- // Check the path return contains the newRelativePath
- assertTrue(newRecordCategoryChild.getPath().getName().contains(newRelativePath));
-
- // Check the parent is a category
- assertNotNull(recordCategoryAPI.getRecordCategory(newRecordCategoryChild.getParentId()).getId());
-
- // Check the folder created on the server
- RecordCategory newRecordFolder = recordCategoryAPI.getRecordCategory(newRecordCategoryChild.getId(), "include=" + PATH);
-
- // Check the API response code
- assertStatusCode(OK);
-
- // Verify the returned details for the record folder
- assertEquals(recordSubCategory.getNodeType(), RECORD_CATEGORY_TYPE);
-
- // Check the path return contains the newRelativePath
- assertTrue(newRecordFolder.getPath().getName().contains(newRelativePath));
- }
-
- /**
- *
- * Given that RM site is created
- * When I use the API to create a new record folder into transfers/holds/unfiled containers
- * Then the operation fails
- *
- */
- @Test
- (
- description = "Create a record folder into transfers/unfiled/file plan container",
- dataProviderClass = DataProviderClass.class,
- dataProvider = "getContainers"
- )
- @Bug (id = "RM-4327")
- public void createRecordFolderIntoSpecialContainers(String containerAlias)
- {
- String containerId;
- if (FILE_PLAN_ALIAS.equalsIgnoreCase(containerAlias))
- {
- containerId = getRestAPIFactory().getFilePlansAPI().getFilePlan(containerAlias).getId();
- } else if (TRANSFERS_ALIAS.equalsIgnoreCase(containerAlias))
- {
- containerId = getRestAPIFactory().getTransferContainerAPI().getTransferContainer(containerAlias).getId();
- } else
- {
- //is unfiled container
- containerId = getRestAPIFactory().getUnfiledContainersAPI().getUnfiledContainer(containerAlias).getId();
- }
-
- // Create a record folder
- createRecordFolder(containerId, RECORD_FOLDER_NAME);
-
- // Check the API Response code
- assertStatusCode(BAD_REQUEST);
- }
-}
diff --git a/amps/ags/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/recordfolders/ElectronicRecordTests.java b/amps/ags/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/recordfolders/ElectronicRecordTests.java
deleted file mode 100644
index 98c63b78a7..0000000000
--- a/amps/ags/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/recordfolders/ElectronicRecordTests.java
+++ /dev/null
@@ -1,418 +0,0 @@
-/*
- * #%L
- * Alfresco Records Management Module
- * %%
- * Copyright (C) 2005 - 2021 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.recordfolders;
-
-import static org.alfresco.rest.rm.community.base.TestData.ELECTRONIC_RECORD_NAME;
-import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentAlias.FILE_PLAN_ALIAS;
-import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentAlias.TRANSFERS_ALIAS;
-import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentAlias.UNFILED_RECORDS_CONTAINER_ALIAS;
-import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentType.CONTENT_TYPE;
-import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentType.RECORD_FOLDER_TYPE;
-import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentType.UNFILED_CONTAINER_TYPE;
-import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentType.UNFILED_RECORD_FOLDER_TYPE;
-import static org.alfresco.rest.rm.community.util.PojoUtility.toJson;
-import static org.alfresco.rest.rm.community.utils.FilePlanComponentsUtil.IMAGE_FILE;
-import static org.alfresco.rest.rm.community.utils.FilePlanComponentsUtil.createElectronicRecordModel;
-import static org.alfresco.rest.rm.community.utils.FilePlanComponentsUtil.createElectronicUnfiledContainerChildModel;
-import static org.alfresco.rest.rm.community.utils.FilePlanComponentsUtil.createTempFile;
-import static org.alfresco.rest.rm.community.utils.FilePlanComponentsUtil.getFile;
-import static org.alfresco.utility.data.RandomData.getRandomAlphanumeric;
-import static org.springframework.http.HttpStatus.BAD_REQUEST;
-import static org.springframework.http.HttpStatus.CREATED;
-import static org.springframework.http.HttpStatus.UNPROCESSABLE_ENTITY;
-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.BaseRMRestTest;
-import org.alfresco.rest.rm.community.model.record.Record;
-import org.alfresco.rest.rm.community.model.recordcategory.RecordCategoryChild;
-import org.alfresco.rest.rm.community.model.unfiledcontainer.UnfiledContainerChild;
-import org.alfresco.rest.rm.community.requests.gscore.api.RecordFolderAPI;
-import org.alfresco.rest.rm.community.requests.gscore.api.RecordsAPI;
-import org.alfresco.rest.rm.community.requests.gscore.api.UnfiledContainerAPI;
-import org.alfresco.rest.rm.community.requests.gscore.api.UnfiledRecordFolderAPI;
-import org.alfresco.utility.report.Bug;
-import org.testng.annotations.DataProvider;
-import org.testng.annotations.Test;
-
-/**
- * Create/File electronic records tests
- *
- * @author Kristijan Conkas
- * @since 2.6
- */
-public class ElectronicRecordTests extends BaseRMRestTest
-{
- /** Invalid parent containers where electronic records can't be created */
- @DataProvider(name = "invalidParentContainers")
- public Object[][] invalidParentContainers()
- {
- return new String[][]
- {
- // record category
- { createCategoryFolderInFilePlan().getParentId() },
- // file plan root
- { FILE_PLAN_ALIAS },
- // transfers
- { TRANSFERS_ALIAS }
- };
- }
-
- /**
- *
- * Given a parent container that is NOT a record folder or an unfiled record folder
- * When I try to create an electronic record within the parent container
- * Then nothing happens
- * And an error is reported
- *
- * @param container The parent container
- */
- @Test
- (
- dataProvider = "invalidParentContainers",
- description = "Electronic records can't be created in invalid parent containers"
- )
- public void cantCreateElectronicRecordsInInvalidContainers(String container)
- {
- // Create an electronic record in the given container, this should throw an IllegalArgumentException
- getRestAPIFactory().getRecordFolderAPI().createRecord(createElectronicRecordModel(), container, getFile(IMAGE_FILE));
-
- // Verify the create request status code
- assertStatusCode(BAD_REQUEST);
- }
-
- /**
- *
- * Given a parent container that is a record folder
- * And the record folder is closed
- * When I try to create an electronic record within the parent container
- * Then nothing happens
- * And an error is reported
- *
- */
- @Test
- (
- description = "Electronic record can't be created in closed record folder"
- )
- public void cantCreateElectronicRecordInClosedFolder()
- {
- RecordCategoryChild recordFolder = createCategoryFolderInFilePlan();
-
- // The folder should be open
- assertFalse(recordFolder.getProperties().getIsClosed());
-
- // Close the folder
- closeFolder(recordFolder.getId());
-
- // Try to create an electronic record, this should throw IllegalArgumentException
- getRestAPIFactory().getRecordFolderAPI().createRecord(createElectronicRecordModel(), recordFolder.getId(), getFile(IMAGE_FILE));
-
- // Verify the status code
- assertStatusCode(UNPROCESSABLE_ENTITY);
- }
-
- /**
- *
- * Given a parent container that is a record folder
- * And the record folder is open
- * When I try to create an electronic record within the parent container
- * And I do not provide all the required mandatory property values
- * Then nothing happens
- * And an error is reported
- *
- * and
- *
- *
- *
- * Given a parent container that is an unfiled record folder or the root unfiled record container
- * When I try to create an electronic record within the parent container
- * And I do not provide all the required mandatory property values
- * Then nothing happens
- * And an error is reported
- *
- * @param folderId The folder, which the record will be created in
- * @param type The type of the record folder, which the record will be created in
- * @throws Exception if record can't be created
- */
- @Test
- (
- dataProvider = "validRootContainers",
- description = "Electronic record can only be created if all mandatory properties are given"
- )
- public void canCreateElectronicRecordOnlyWithMandatoryProperties(String folderId, String type) throws Exception
- {
- logger.info("Root container:\n" + toJson(folderId));
-
- if (RECORD_FOLDER_TYPE.equalsIgnoreCase(type))
- {
- // Only record folders can be opened or closed
- RecordFolderAPI recordFolderAPI = getRestAPIFactory().getRecordFolderAPI();
- assertFalse(recordFolderAPI.getRecordFolder(folderId).getProperties().getIsClosed());
-
- // Record without name
- Record recordModel = Record.builder().nodeType(CONTENT_TYPE).build();
-
- // Try to create it
- recordFolderAPI.createRecord(recordModel, folderId);
- }
- else if(UNFILED_CONTAINER_TYPE.equalsIgnoreCase(type))
- {
- UnfiledContainerAPI unfiledContainersAPI = getRestAPIFactory().getUnfiledContainersAPI();
- UnfiledContainerChild recordModel = UnfiledContainerChild.builder().nodeType(CONTENT_TYPE).build();
- unfiledContainersAPI.createUnfiledContainerChild(recordModel, folderId);
- }
- else if(UNFILED_RECORD_FOLDER_TYPE.equalsIgnoreCase(type))
- {
- UnfiledRecordFolderAPI unfiledRecordFoldersAPI = getRestAPIFactory().getUnfiledRecordFoldersAPI();
- UnfiledContainerChild recordModel = UnfiledContainerChild.builder().nodeType(CONTENT_TYPE).build();
- unfiledRecordFoldersAPI.createUnfiledRecordFolderChild(recordModel, folderId);
- }
- else
- {
- throw new Exception("Unsuported type = " + type);
- }
-
- // Verify the status code is BAD_REQUEST
- assertStatusCode(BAD_REQUEST);
- }
-
- /**
- *
- * Given a parent container that is a record folder
- * And the record folder is open
- * When I try to create an electronic record within the parent container
- * Then the electronic record is created
- * And the details of the new record are returned
- *
- * and
- *
- *
- * Given a parent container that is an unfiled record folder or the root unfiled record container
- * When I try to create an electronic record within the parent container
- * Then the electronic record is created
- * And the details of the new record are returned
- *
- * @param folderId The folder, which the record will be created in
- * @param type The type of the folder, which the record will be created in
- * @throws Exception if record can't be created
- */
- @Test
- (
- dataProvider = "validRootContainers",
- description = "Electronic records can be created in record folders, unfiled record folders or unfiled record folder root"
- )
- public void canCreateElectronicRecordsInValidContainers(String folderId, String type) throws Exception
- {
- String newRecordId;
- String expectedName;
- if (RECORD_FOLDER_TYPE.equalsIgnoreCase(type))
- {
- RecordFolderAPI recordFolderAPI = getRestAPIFactory().getRecordFolderAPI();
- Record recordModel = createElectronicRecordModel();
- newRecordId = recordFolderAPI.createRecord(recordModel, folderId, getFile(IMAGE_FILE)).getId();
- expectedName = recordModel.getName();
- }
- else if(UNFILED_CONTAINER_TYPE.equalsIgnoreCase(type))
- {
- UnfiledContainerAPI unfiledContainersAPI = getRestAPIFactory().getUnfiledContainersAPI();
- UnfiledContainerChild recordModel = createElectronicUnfiledContainerChildModel();
- newRecordId = unfiledContainersAPI.uploadRecord(recordModel, folderId, getFile(IMAGE_FILE)).getId();
- expectedName = recordModel.getName();
- }
- else if(UNFILED_RECORD_FOLDER_TYPE.equalsIgnoreCase(type))
- {
- UnfiledRecordFolderAPI unfiledRecordFoldersAPI = getRestAPIFactory().getUnfiledRecordFoldersAPI();
- UnfiledContainerChild recordModel = createElectronicUnfiledContainerChildModel();
- newRecordId = unfiledRecordFoldersAPI.uploadRecord(recordModel, folderId, getFile(IMAGE_FILE)).getId();
- expectedName = recordModel.getName();
- }
- else
- {
- throw new Exception("Unsuported type = " + type);
- }
- // Verify the create request status code
- assertStatusCode(CREATED);
-
- // Get newly created electronic record and verify its properties
- RecordsAPI recordsAPI = getRestAPIFactory().getRecordsAPI();
- Record record = recordsAPI.getRecord(newRecordId);
- String recordName = record.getName();
-
- // Created record will have record identifier inserted in its name but will be prefixed with the name it was created as
- assertTrue(recordName.startsWith(expectedName));
- assertTrue(recordName.contains(record.getProperties().getIdentifier()));
- }
-
- /**
- *
- * Given that a record name isn't specified
- * When I create an electronic record
- * Then the record name defaults to filed file name.
- *
- * @param folderId The folder, which the record will be created in
- * @param type The type of the folder, which the record will be created in
- * @throws Exception if record can't be created
- */
- @Test
- (
- dataProvider = "validRootContainers",
- description = "Electronic records can be created in unfiled record folder or unfiled record root"
- )
- public void recordNameDerivedFromFileName(String folderId, String type) throws Exception
- {
- String newRecordId;
- if (RECORD_FOLDER_TYPE.equalsIgnoreCase(type))
- {
- // Create a record model without a name
- Record recordModel = Record.builder().nodeType(CONTENT_TYPE).build();
-
- // Create an electronic record
- RecordFolderAPI recordFolderAPI = getRestAPIFactory().getRecordFolderAPI();
- newRecordId = recordFolderAPI.createRecord(recordModel, folderId, getFile(IMAGE_FILE)).getId();
- }
- else if(UNFILED_CONTAINER_TYPE.equalsIgnoreCase(type))
- {
- UnfiledContainerAPI unfiledContainersAPI = getRestAPIFactory().getUnfiledContainersAPI();
- UnfiledContainerChild recordModel = UnfiledContainerChild.builder().nodeType(CONTENT_TYPE).build();
- newRecordId = unfiledContainersAPI.uploadRecord(recordModel, folderId, getFile(IMAGE_FILE)).getId();
- }
- else if(UNFILED_RECORD_FOLDER_TYPE.equalsIgnoreCase(type))
- {
- UnfiledRecordFolderAPI unfiledRecordFoldersAPI = getRestAPIFactory().getUnfiledRecordFoldersAPI();
- UnfiledContainerChild recordModel = UnfiledContainerChild.builder().nodeType(CONTENT_TYPE).build();
- newRecordId = unfiledRecordFoldersAPI.uploadRecord(recordModel, folderId, getFile(IMAGE_FILE)).getId();
- }
- else
- {
- throw new Exception("Unsuported type = " + type);
- }
- // Verify the create request status code
- assertStatusCode(CREATED);
-
- // Get newly created electronic record and verify its properties
- Record electronicRecord = getRestAPIFactory().getRecordsAPI().getRecord(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("."))));
- assertTrue(electronicRecord.getName().contains(electronicRecord.getProperties().getIdentifier()));
- }
-
- /**
- *
- * Given that I want to create an electronic record in one unfiled record folder
- * When I use the path relative to the one unfiled record folder
- * Then the containers in the relativePath that don't exist are created before creating the electronic record
- *
- */
- @Test
- @Bug (id = "RM-4568")
- public void createElectronicRecordWithRelativePath()
- {
- // The containers specified on the relativePath parameter don't exist on server
- String parentUbnfiledRecordFolderName = "ParentUnfiledRecordFolder" + getRandomAlphanumeric();
- String unfiledRecordFolderPathEl1 = "UnfiledRecordFolderPathEl1" + getRandomAlphanumeric();
- String unfiledRecordFolderPathEl2 = "UnfiledRecordFolderPathEl2" + getRandomAlphanumeric();
- String unfiledRecordFolderPathEl3 = "UnfiledRecordFolderPathEl3" + getRandomAlphanumeric();
-
- String parentUnfiledRecordFolderId = createUnfiledContainerChild(UNFILED_RECORDS_CONTAINER_ALIAS, parentUbnfiledRecordFolderName, UNFILED_RECORD_FOLDER_TYPE).getId();
-
- String relativePath = unfiledRecordFolderPathEl1 + "/" + unfiledRecordFolderPathEl2 + "/" + unfiledRecordFolderPathEl3;
- UnfiledContainerChild unfiledContainerChildModel= UnfiledContainerChild.builder()
- .name(ELECTRONIC_RECORD_NAME)
- .nodeType(CONTENT_TYPE)
- .relativePath(relativePath)
- .build();
-
-
-
- UnfiledRecordFolderAPI unfiledRecordFoldersAPI = getRestAPIFactory().getUnfiledRecordFoldersAPI();
- UnfiledContainerChild recordCreated = unfiledRecordFoldersAPI.uploadRecord(unfiledContainerChildModel, parentUnfiledRecordFolderId, createTempFile(ELECTRONIC_RECORD_NAME, ELECTRONIC_RECORD_NAME));
-
- // Verify the create request status code
- assertStatusCode(CREATED);
-
- // Get newly created electronic record and verify its properties
- RecordsAPI recordsAPI = getRestAPIFactory().getRecordsAPI();
- Record record = recordsAPI.getRecord(recordCreated.getId());
-
- assertTrue(record.getName().startsWith(ELECTRONIC_RECORD_NAME));
- assertEquals(unfiledRecordFoldersAPI.getUnfiledRecordFolder(record.getParentId()).getName(), unfiledRecordFolderPathEl3);
-
- // The first relative path element exists and the second one does not exist
- String unfiledRecordFolderPathEl4 = "UnfiledRecordFolderPathEl4" + getRandomAlphanumeric();
- relativePath = unfiledRecordFolderPathEl1 + "/" + unfiledRecordFolderPathEl4;
- unfiledContainerChildModel.setRelativePath(relativePath);
- recordCreated = unfiledRecordFoldersAPI.uploadRecord(unfiledContainerChildModel, parentUnfiledRecordFolderId, createTempFile(ELECTRONIC_RECORD_NAME, ELECTRONIC_RECORD_NAME));
- // verify the create request status code
- assertStatusCode(CREATED);
-
- // get newly created electronic record and verify its properties
- record = recordsAPI.getRecord(recordCreated.getId());
-
- assertTrue(record.getName().startsWith(ELECTRONIC_RECORD_NAME));
- assertTrue(unfiledRecordFoldersAPI.getUnfiledRecordFolder(record.getParentId()).getName().equals(unfiledRecordFolderPathEl4));
-
- //the containers from the RELATIVE PATH exists
- unfiledContainerChildModel.setName(ELECTRONIC_RECORD_NAME + getRandomAlphanumeric());
- recordCreated = unfiledRecordFoldersAPI.uploadRecord(unfiledContainerChildModel, parentUnfiledRecordFolderId, createTempFile(ELECTRONIC_RECORD_NAME, ELECTRONIC_RECORD_NAME));
- // verify the create request status code
- assertStatusCode(CREATED);
- // get newly created electronic record and verify its properties
- record = recordsAPI.getRecord(recordCreated.getId());
-
- assertTrue(record.getName().startsWith(ELECTRONIC_RECORD_NAME));
-
- assertTrue(unfiledRecordFoldersAPI.getUnfiledRecordFolder(record.getParentId()).getName().equals(unfiledRecordFolderPathEl4));
- }
-
- /**
- *
- * Given a parent container that is a record folder
- * When I try to create a record with name1 and create another one with the same given name
- * Then the second record is created with success
- *
- */
- @Test(description = "Electronic records can be created in record folder with duplicate name")
- @Bug(id ="RM-5116, RM-5012")
- public void canCreateElectronicRecordsWithDuplicateName()
- {
- RecordCategoryChild recordFolder = createCategoryFolderInFilePlan();
-
- // Create an electronic record with the name "Record 1"
- Record recordModel = Record.builder().name("Record 1").nodeType(CONTENT_TYPE).build();
- getRestAPIFactory().getRecordFolderAPI().createRecord(recordModel, recordFolder.getId());
- // Verify the status code
- assertStatusCode(CREATED);
-
- // Try to create another electronic record with the same name
- getRestAPIFactory().getRecordFolderAPI().createRecord(recordModel, recordFolder.getId());
-
- // Verify the status code
- assertStatusCode(CREATED);
- }
-}
diff --git a/amps/ags/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/recordfolders/NonElectronicRecordTests.java b/amps/ags/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/recordfolders/NonElectronicRecordTests.java
deleted file mode 100644
index 4ff6976bbf..0000000000
--- a/amps/ags/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/recordfolders/NonElectronicRecordTests.java
+++ /dev/null
@@ -1,381 +0,0 @@
-/*
- * #%L
- * Alfresco Records Management Module
- * %%
- * Copyright (C) 2005 - 2021 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.recordfolders;
-
-import static java.lang.Integer.MAX_VALUE;
-import static java.util.Arrays.asList;
-
-import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentType.NON_ELECTRONIC_RECORD_TYPE;
-import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentType.RECORD_FOLDER_TYPE;
-import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentType.UNFILED_CONTAINER_TYPE;
-import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentType.UNFILED_RECORD_FOLDER_TYPE;
-import static org.alfresco.rest.rm.community.util.PojoUtility.toJson;
-import static org.alfresco.rest.rm.community.utils.FilePlanComponentsUtil.createFullNonElectronicRecordModel;
-import static org.alfresco.rest.rm.community.utils.FilePlanComponentsUtil.createFullNonElectronicUnfiledContainerChildRecordModel;
-import static org.alfresco.rest.rm.community.utils.FilePlanComponentsUtil.createNonElectronicRecordModel;
-import static org.alfresco.rest.rm.community.utils.FilePlanComponentsUtil.verifyFullNonElectronicRecord;
-import static org.alfresco.utility.constants.UserRole.SiteManager;
-import static org.alfresco.utility.data.RandomData.getRandomAlphanumeric;
-import static org.springframework.http.HttpStatus.BAD_REQUEST;
-import static org.springframework.http.HttpStatus.CREATED;
-import static org.springframework.http.HttpStatus.FORBIDDEN;
-import static org.springframework.http.HttpStatus.UNPROCESSABLE_ENTITY;
-import static org.testng.Assert.assertFalse;
-
-import java.util.Random;
-
-import org.alfresco.rest.rm.community.base.BaseRMRestTest;
-import org.alfresco.rest.rm.community.model.record.Record;
-import org.alfresco.rest.rm.community.model.record.RecordProperties;
-import org.alfresco.rest.rm.community.model.recordcategory.RecordCategoryChild;
-import org.alfresco.rest.rm.community.model.unfiledcontainer.UnfiledContainerChild;
-import org.alfresco.rest.rm.community.model.unfiledcontainer.UnfiledContainerChildProperties;
-import org.alfresco.rest.rm.community.requests.gscore.api.RecordFolderAPI;
-import org.alfresco.rest.rm.community.requests.gscore.api.RecordsAPI;
-import org.alfresco.rest.rm.community.requests.gscore.api.UnfiledContainerAPI;
-import org.alfresco.rest.rm.community.requests.gscore.api.UnfiledRecordFolderAPI;
-import org.alfresco.utility.model.SiteModel;
-import org.alfresco.utility.model.UserModel;
-import org.testng.annotations.Test;
-
-/**
- * Create/File Non-Electronic Record into Unfiled Record Container/Record Folder ReST API tests
- *
- * @author Kristijan Conkas
- * @since 2.6
- */
-public class NonElectronicRecordTests extends BaseRMRestTest
-{
- /**
- *
- * Given a parent container that is a record folder
- * And the record folder is open
- * When I try to create a non-electronic record within the parent container
- * Then the non-electronic record is created
- * And the details of the new record are returned
- *
- * and
- *
- *
- *
- * Given a parent container that is an unfiled record folder or the root unfiled record container
- * When I try to create a non-electronic record within the parent container
- * Then the non-electronic record is created
- * And the details of the new record are returned
- *
- * @throws Exception if record can't be created
- */
- @Test
- (
- dataProvider = "validRootContainers",
- description = "Non-electronic records can be created in valid containers"
- )
- public void canCreateInValidContainers(String folderId, String type) throws Exception
- {
- logger.info("Root container:\n" + toJson(folderId));
-
- // Use these properties for non-electronic record to be created
- String title = "Title " + getRandomAlphanumeric();
- String description = "Description " + getRandomAlphanumeric();
- String box = "Box "+ getRandomAlphanumeric();
- String file = "File " + getRandomAlphanumeric();
- String shelf = "Shelf " + getRandomAlphanumeric();
- String storageLocation = "Storage Location " + getRandomAlphanumeric();
- String name = "Record " + getRandomAlphanumeric();
-
- Random random = new Random();
- Integer numberOfCopies = random.nextInt(MAX_VALUE);
- Integer physicalSize = random.nextInt(MAX_VALUE);
-
- String nonElectronicId;
- if (RECORD_FOLDER_TYPE.equalsIgnoreCase(type))
- {
- // Only record folders can be opened or closed
- RecordFolderAPI recordFolderAPI = getRestAPIFactory().getRecordFolderAPI();
- assertFalse(recordFolderAPI.getRecordFolder(folderId).getProperties().getIsClosed());
-
- // Set values of all available properties for the non electronic records
- Record nonElectrinicRecordModel = createFullNonElectronicRecordModel(name, title, description, box, file, shelf, storageLocation, numberOfCopies, physicalSize);
-
- // Create non-electronic record
- nonElectronicId = recordFolderAPI.createRecord(nonElectrinicRecordModel, folderId).getId();
- }
- else if(UNFILED_CONTAINER_TYPE.equalsIgnoreCase(type))
- {
- // Set values of all available properties for the non electronic records
- UnfiledContainerChild nonElectrinicRecordModel = createFullNonElectronicUnfiledContainerChildRecordModel(name, title, description, box, file, shelf,
- storageLocation, numberOfCopies, physicalSize);
-
- // Create non-electronic record
- UnfiledContainerAPI unfiledContainersAPI = getRestAPIFactory().getUnfiledContainersAPI();
- nonElectronicId = unfiledContainersAPI.createUnfiledContainerChild(nonElectrinicRecordModel, folderId).getId();
- }
- else if(UNFILED_RECORD_FOLDER_TYPE.equalsIgnoreCase(type))
- {
- // Set values of all available properties for the non electronic records
- UnfiledContainerChild nonElectrinicRecordModel = createFullNonElectronicUnfiledContainerChildRecordModel(name, title, description, box, file, shelf,
- storageLocation, numberOfCopies, physicalSize);
-
- // Create non-electronic record
- UnfiledRecordFolderAPI unfiledRecordFoldersAPI = getRestAPIFactory().getUnfiledRecordFoldersAPI();
- nonElectronicId = unfiledRecordFoldersAPI.createUnfiledRecordFolderChild(nonElectrinicRecordModel, folderId).getId();
- }
- else
- {
- throw new Exception("Unsuported type = " + type);
- }
-
- // Verify the create request status code
- assertStatusCode(CREATED);
-
- // Get newly created non-electronic record and verify its properties
- RecordsAPI recordsAPI = getRestAPIFactory().getRecordsAPI();
- Record nonElectronicRecord = recordsAPI.getRecord(nonElectronicId);
- verifyFullNonElectronicRecord(nonElectronicRecord, name, title, description, box, file, shelf, storageLocation, numberOfCopies, physicalSize);
- }
-
- /**
- *
- * Given a parent container that is a record folder
- * And the record folder is closed
- * When I try to create a non-electronic record within the parent container
- * Then nothing happens
- * And an error is reported
- *
- */
- @Test(description = "Non-electronic record can't be created in closed record folder")
- public void cantCreateInClosedFolder()
- {
- RecordCategoryChild recordFolder = createCategoryFolderInFilePlan();
-
- // The folder should be open
- assertFalse(recordFolder.getProperties().getIsClosed());
-
- // Close the folder
- closeFolder(recordFolder.getId());
-
- // Try to create it, this should fail and throw an exception
- getRestAPIFactory().getRecordFolderAPI().createRecord(createNonElectronicRecordModel(), recordFolder.getId());
-
- // Verify the status code
- assertStatusCode(UNPROCESSABLE_ENTITY);
- }
-
- /**
- *
- * Given a parent container that is a record folder
- * And the record folder is open
- * When I try to create a non-electronic record within the parent container
- * And I do not provide all the required mandatory property values
- * Then nothing happens
- * And an error is reported
- *
- * and
- *
- *
- * Given a parent container that is an unfiled record folder or the root unfiled record container
- * When I try to create a non-electronic record within the parent container
- * And I do not provide all the required mandatory property values
- * Then nothing happens
- * And an error is reported
- *
- */
- @Test
- (
- dataProvider = "validRootContainers",
- description = "Non-electronic record can only be created if all mandatory properties are given"
- )
- public void allMandatoryPropertiesRequired(String folderId, String type)
- {
- logger.info("Root container:\n" + toJson(folderId));
-
- if (type.equals(RECORD_FOLDER_TYPE))
- {
- // Only record folders can be opened or closed
- RecordFolderAPI recordFolderAPI = getRestAPIFactory().getRecordFolderAPI();
- assertFalse(recordFolderAPI.getRecordFolder(folderId).getProperties().getIsClosed());
- // Component without name and title
- Record noNameOrTitle = Record.builder().nodeType(NON_ELECTRONIC_RECORD_TYPE).build();
-
- // Component with title only
- Record titleOnly = Record.builder()
- .nodeType(NON_ELECTRONIC_RECORD_TYPE)
- .properties(RecordProperties.builder()
- .title("Title " + getRandomAlphanumeric())
- .build())
- .build();
-
- // Try to create invalid components
- asList(noNameOrTitle, titleOnly).forEach(c ->
- {
- logger.info("Creating non-electronic record with body:\n" + toJson(c));
-
- getRestAPIFactory().getRecordFolderAPI().createRecord(c, folderId);
- // Verify the status code is BAD_REQUEST
- assertStatusCode(BAD_REQUEST);
- });
- }
- else if(UNFILED_CONTAINER_TYPE.equalsIgnoreCase(type))
- {
- // Component without name and title
- UnfiledContainerChild noNameOrTitle = UnfiledContainerChild.builder().nodeType(NON_ELECTRONIC_RECORD_TYPE).build();
-
- // Component with title only
- UnfiledContainerChild titleOnly = UnfiledContainerChild.builder()
- .nodeType(NON_ELECTRONIC_RECORD_TYPE)
- .properties(UnfiledContainerChildProperties.builder()
- .title("Title " + getRandomAlphanumeric())
- .build())
- .build();
-
- // Try to create invalid components
- asList(noNameOrTitle, titleOnly).forEach(c ->
- {
- logger.info("Creating non-electronic record with body:\n" + toJson(c));
-
- getRestAPIFactory().getUnfiledContainersAPI().createUnfiledContainerChild(c, folderId);
- // Verify the status code is BAD_REQUEST
- assertStatusCode(BAD_REQUEST);
- });
- }
- else
- {
- //we have unfiled record folder type
- // Component without name and title
- UnfiledContainerChild noNameOrTitle = UnfiledContainerChild.builder().nodeType(NON_ELECTRONIC_RECORD_TYPE).build();
-
- // Component with title only
- UnfiledContainerChild titleOnly = UnfiledContainerChild.builder()
- .nodeType(NON_ELECTRONIC_RECORD_TYPE)
- .properties(UnfiledContainerChildProperties.builder()
- .title("Title " + getRandomAlphanumeric())
- .build())
- .build();
-
- // Try to create invalid components
- asList(noNameOrTitle, titleOnly).forEach(c ->
- {
- logger.info("Creating non-electronic record with body:\n" + toJson(c));
-
- getRestAPIFactory().getUnfiledRecordFoldersAPI().createUnfiledRecordFolderChild(c, folderId);
-
- // Verify the status code is BAD_REQUEST
- assertStatusCode(BAD_REQUEST);
- });
- }
- }
-
- /**
- *
- * Given that I am a user without RM privileges
- * When I try to create a non-electronic record
- * Then nothing happens
- * And an error is reported
- *
- */
- @Test
- (
- dataProvider = "validRootContainers",
- description = "Non-electronic record can't be created if user doesn't have RM privileges"
- )
- public void cantCreateIfNoRmPrivileges(String folderId, String type)
- {
- UserModel user = createSiteManager("zzzuser");
-
- if (type.equals(RECORD_FOLDER_TYPE))
- {
- // Try to create a record model
- Record recordModel = Record.builder()
- .properties(RecordProperties.builder()
- .description("Description")
- .title("Title")
- .build())
- .name("Record Name")
- .nodeType(NON_ELECTRONIC_RECORD_TYPE)
- .build();
-
- getRestAPIFactory().getRecordFolderAPI(user).createRecord(recordModel, folderId);
- }
- else if(UNFILED_CONTAINER_TYPE.equalsIgnoreCase(type))
- {
- // Try to create a record model
- UnfiledContainerChild recordModel = UnfiledContainerChild.builder()
- .properties(UnfiledContainerChildProperties.builder()
- .description("Description")
- .title("Title")
- .build())
- .name("Record Name")
- .nodeType(NON_ELECTRONIC_RECORD_TYPE)
- .build();
-
- getRestAPIFactory().getUnfiledContainersAPI(user).createUnfiledContainerChild(recordModel, folderId);
- }
- else
- {
- // Try to create a record model
- UnfiledContainerChild recordModel = UnfiledContainerChild.builder()
- .properties(UnfiledContainerChildProperties.builder()
- .description("Description")
- .title("Title")
- .build())
- .name("Record Name")
- .nodeType(NON_ELECTRONIC_RECORD_TYPE)
- .build();
-
- getRestAPIFactory().getUnfiledRecordFoldersAPI(user).createUnfiledRecordFolderChild(recordModel, folderId);
- }
- // User who isn't an RM site member can't access the container path
- assertStatusCode(FORBIDDEN);
- }
-
- /**
- * Create user with site manager role and add it to RM site
- *
- * Checks whether the user exists in RM site and creates it if required, with password identical
- * to user name. Note the role is a Core API role, not an RM role.
- *
- * For already existing users, no site membership or role verification is performed.
- *
- * @param userName user name to add
- */
- private UserModel createSiteManager(String userName)
- {
- String siteId = getRestAPIFactory().getRMSiteAPI().getSite().getId();
-
- // Check if user exists
- UserModel user = new UserModel(userName, userName);
-
- if (!getDataUser().isUserInRepo(userName))
- {
- // User doesn't exist, create it
- user = getDataUser().createUser(userName, userName);
- getDataUser().addUserToSite(user, new SiteModel(siteId), SiteManager);
- }
-
- return user;
- }
-}
diff --git a/amps/ags/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/recordfolders/RecordFolderTests.java b/amps/ags/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/recordfolders/RecordFolderTests.java
deleted file mode 100644
index f4f6d26852..0000000000
--- a/amps/ags/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/recordfolders/RecordFolderTests.java
+++ /dev/null
@@ -1,476 +0,0 @@
-/*
- * #%L
- * Alfresco Records Management Module
- * %%
- * Copyright (C) 2005 - 2021 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.recordfolders;
-
-import static org.alfresco.rest.rm.community.base.TestData.RECORD_FOLDER_NAME;
-import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentAlias.FILE_PLAN_ALIAS;
-import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentAlias.TRANSFERS_ALIAS;
-import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentAlias.UNFILED_RECORDS_CONTAINER_ALIAS;
-import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.IS_CLOSED;
-import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentType.CONTENT_TYPE;
-import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentType.FILE_PLAN_TYPE;
-import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentType.FOLDER_TYPE;
-import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentType.NON_ELECTRONIC_RECORD_TYPE;
-import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentType.RECORD_CATEGORY_TYPE;
-import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentType.RECORD_FOLDER_TYPE;
-import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentType.TRANSFER_CONTAINER_TYPE;
-import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentType.TRANSFER_TYPE;
-import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentType.UNFILED_CONTAINER_TYPE;
-import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentType.UNFILED_RECORD_FOLDER_TYPE;
-import static org.alfresco.rest.rm.community.utils.FilePlanComponentsUtil.TITLE_PREFIX;
-import static org.alfresco.rest.rm.community.utils.FilePlanComponentsUtil.createTempFile;
-import static org.alfresco.utility.data.RandomData.getRandomAlphanumeric;
-import static org.alfresco.utility.data.RandomData.getRandomName;
-import static org.springframework.http.HttpStatus.BAD_REQUEST;
-import static org.springframework.http.HttpStatus.NOT_FOUND;
-import static org.springframework.http.HttpStatus.NO_CONTENT;
-import static org.springframework.http.HttpStatus.OK;
-import static org.springframework.http.HttpStatus.UNPROCESSABLE_ENTITY;
-import static org.testng.Assert.assertEquals;
-import static org.testng.Assert.assertFalse;
-import static org.testng.Assert.assertNotNull;
-import static org.testng.Assert.assertTrue;
-import static org.testng.Assert.fail;
-
-import java.util.ArrayList;
-import java.util.NoSuchElementException;
-
-import org.alfresco.rest.rm.community.base.BaseRMRestTest;
-import org.alfresco.rest.rm.community.model.common.ReviewPeriod;
-import org.alfresco.rest.rm.community.model.record.Record;
-import org.alfresco.rest.rm.community.model.record.RecordProperties;
-import org.alfresco.rest.rm.community.model.recordcategory.RecordCategory;
-import org.alfresco.rest.rm.community.model.recordcategory.RecordCategoryChild;
-import org.alfresco.rest.rm.community.model.recordfolder.RecordFolder;
-import org.alfresco.rest.rm.community.model.recordfolder.RecordFolderCollection;
-import org.alfresco.rest.rm.community.model.recordfolder.RecordFolderProperties;
-import org.alfresco.rest.rm.community.requests.gscore.api.RecordFolderAPI;
-import org.alfresco.utility.report.Bug;
-import org.testng.AssertJUnit;
-import org.testng.annotations.AfterClass;
-import org.testng.annotations.BeforeClass;
-import org.testng.annotations.DataProvider;
-import org.testng.annotations.Test;
-
-/**
- * This class contains the tests for the Record Folder CRUD API
- *
- * @author Rodica Sutu
- * @since 2.6
- */
-public class RecordFolderTests extends BaseRMRestTest
-{
- public static final String ELECTRONIC_RECORD_NAME = "Record electronic" + getRandomAlphanumeric();
- public static final String NONELECTRONIC_RECORD_NAME = "Record nonelectronic" + getRandomAlphanumeric();
- public static final String RECORD_CATEGORY_NAME = "CATEGORY NAME" + getRandomAlphanumeric();
- private RecordCategory rootCategory;
-
- @BeforeClass (alwaysRun = true)
- public void preconditionRecordFolderTests()
- {
- rootCategory = createRootCategory(RECORD_CATEGORY_NAME);
- }
-
- /**
- * Data Provider with:
- * with the object types not allowed as children for a record folder
- *
- * @return node type to be created
- */
- @DataProvider
- public static Object[][] childrenNotAllowedForFolder()
- {
- return new String[][] {
- { FILE_PLAN_TYPE },
- { TRANSFER_CONTAINER_TYPE },
- { UNFILED_CONTAINER_TYPE },
- { UNFILED_RECORD_FOLDER_TYPE },
- { TRANSFER_TYPE },
- { RECORD_CATEGORY_TYPE },
- { FOLDER_TYPE }
- };
- }
-
- /**
- * Invalid containers that cannot be updated/deleted with record folder endpoint
- */
- @DataProvider
- public Object[][] getInvalidNodesForRecordFolders()
- {
- return new String[][] {
- { getRestAPIFactory().getFilePlansAPI().getFilePlan(FILE_PLAN_ALIAS).getId()},
- { getRestAPIFactory().getUnfiledContainersAPI().getUnfiledContainer(UNFILED_RECORDS_CONTAINER_ALIAS).getId() },
- { getRestAPIFactory().getTransferContainerAPI().getTransferContainer(TRANSFERS_ALIAS).getId() },
- // an arbitrary record category
- { rootCategory.getId()},
- // an arbitrary unfiled records folder
- { createUnfiledContainerChild(UNFILED_RECORDS_CONTAINER_ALIAS, "Unfiled Folder " + getRandomAlphanumeric(), UNFILED_RECORD_FOLDER_TYPE).getId() },
- { createUnfiledContainerChild(UNFILED_RECORDS_CONTAINER_ALIAS, "Unfiled Record " + getRandomAlphanumeric(), CONTENT_TYPE).getId()}
- };
- }
-
-
- /**
- *
- * Given that RM site is created
- * When I use the API to create a children of wrong type inside a record folder
- * Then the operation fails
- *
- */
- //TODO enable this test when REPO-2454 is fixed
- @Test
- (
- enabled = false,
- description = "Create invalid types as children for a record folder",
- dataProvider = "childrenNotAllowedForFolder"
- )
- public void createInvalidChildrenForFolder(String nodeType)
- {
- //create a record folder
- RecordCategoryChild folder = createRecordFolder(rootCategory.getId(), getRandomName("recFolder"));
- Record record = Record.builder()
- .name(ELECTRONIC_RECORD_NAME)
- .nodeType(nodeType)
- .build();
- //create invalid child type for the record folder
- getRestAPIFactory().getRecordFolderAPI().createRecord(record,folder.getId());
- // Check the API Response code
- assertStatusCode(UNPROCESSABLE_ENTITY);
- }
-
- /**
- *
- * Given that a record folder exists
- * When I ask for the details of a record folder
- * Then I am given the details of a record folder
- *
- */
- @Test
- (
- description = "Check the details of a record folder"
- )
- public void checkRecordFolderDetails()
- {
- // Create a folder
- RecordCategoryChild recordCategoryChild = createRecordFolder(rootCategory.getId(), RECORD_FOLDER_NAME);
-
- // Get the folder including extra information
- RecordFolder recordFolder = getRestAPIFactory().getRecordFolderAPI().getRecordFolder(recordCategoryChild.getId(), "include=" + IS_CLOSED);
-
- // Verify the returned record folder details
- assertEquals(recordFolder.getNodeType(), RECORD_FOLDER_TYPE);
- assertEquals(recordFolder.getName(), RECORD_FOLDER_NAME);
- assertEquals(recordFolder.getCreatedByUser().getId(), getAdminUser().getUsername());
- assertEquals(recordFolder.getModifiedByUser().getId(), getAdminUser().getUsername());
- assertEquals(recordFolder.getProperties().getTitle(), TITLE_PREFIX + RECORD_FOLDER_NAME);
- assertNotNull(recordFolder.getProperties().getIdentifier(),"The record folder doesn't have a identifier");
- assertFalse(recordFolder.getProperties().getVitalRecordIndicator(), "The record folder has the vital record identifier");
- assertFalse(recordFolder.getProperties().getIsClosed(), "The record folder is closed");
- }
-
- /**
- *
- * Given that a record folder exists
- * When I use the API to update its details
- * Then the details of the record folder are updated
- * The above test does treat any custom metadata
- * Note: The details of the record folder includes any custom meta-data
- *
- */
- @Test
- (
- description = "Update the details of a record folder"
- )
- public void updateRecordFolderDetails()
- {
- // Create a record folder
- RecordCategoryChild recordCategoryChild = createRecordFolder(rootCategory.getId(), getRandomName("recFolder"));
-
- // Create record category first
- String folderDescription = "The folder description is updated" + getRandomAlphanumeric();
- String folderName = "The folder name is updated" + getRandomAlphanumeric();
- String folderTitle = "Update title " + getRandomAlphanumeric();
- String location = "Location "+ getRandomAlphanumeric();
-
- // Create the record folder properties to update
- RecordFolder recordFolder = RecordFolder.builder()
- .name(folderName)
- .properties(RecordFolderProperties.builder()
- .title(folderTitle)
- .description(folderDescription)
- .vitalRecordIndicator(true)
- .reviewPeriod(new ReviewPeriod("month","1"))
- .location(location)
- .build())
- .build();
-
- // Update the record folder
- RecordFolder updatedRecordFolder = getRestAPIFactory().getRecordFolderAPI().updateRecordFolder(recordFolder, recordCategoryChild.getId());
-
- // Check the Response Status Code
- assertStatusCode(OK);
-
- // Verify the returned details for the record folder
- AssertJUnit.assertEquals(updatedRecordFolder.getName(), folderName);
- RecordFolderProperties recordFolderProperties = updatedRecordFolder.getProperties();
- AssertJUnit.assertEquals(recordFolderProperties.getDescription(), folderDescription);
- AssertJUnit.assertEquals(recordFolderProperties.getTitle(), folderTitle);
- assertTrue(recordFolderProperties.getVitalRecordIndicator());
- AssertJUnit.assertEquals(recordFolderProperties.getLocation(), location);
- assertNotNull(recordFolderProperties.getReviewPeriod().getPeriodType());
- assertNotNull(recordFolderProperties.getReviewPeriod().getExpression());
- }
-
- /**
- *
- * Given other nodes type than record folders exists
- * When I use the API to update its details
- * Then the request fails
- *
- */
- @Test
- (
- description = "Update the details for other nodes than record folder with the request used for record-folders ",
- dataProvider = "getInvalidNodesForRecordFolders"
- )
- public void updateOtherNodeTypesDetails(String nodeId)
- {
- // Create record category first
- String nodeDescription = "The folder description is updated" + getRandomAlphanumeric();
- String nodeName = "The folder name is updated" + getRandomAlphanumeric();
- String nodeTitle = "Update title " + getRandomAlphanumeric();
-
-
- // Create the record folder properties to update
- RecordFolder recordFolder = RecordFolder.builder()
- .name(nodeName)
- .properties(RecordFolderProperties.builder()
- .title(nodeTitle)
- .description(nodeDescription)
- .vitalRecordIndicator(true)
- .reviewPeriod(new ReviewPeriod("month", "1"))
- .build())
- .build();
-
- // Update the record folder
- getRestAPIFactory().getRecordFolderAPI().updateRecordFolder(recordFolder, nodeId);
-
- // Check the Response Status Code
- assertStatusCode(BAD_REQUEST);
- }
-
- /**
- *
- * Given other nodes type than record folders exists
- * When I use the API from record-folders to delete the nodes
- * Then the request fails
- *
- */
- @Test
- (
- description = "Delete invalid nodes type with the DELETE record folders request",
- dataProvider = "getInvalidNodesForRecordFolders"
- )
- public void deleteInvalidNodesRecordFolder(String nodeId)
- {
- // Delete the nodes with record-folders end-point
- RecordFolderAPI recordFolderAPI = getRestAPIFactory().getRecordFolderAPI();
- recordFolderAPI.deleteRecordFolder(nodeId);
-
- // Check the response status code
- assertStatusCode(BAD_REQUEST);
- }
-
- /**
- *
- * Given that a record folder exists
- * When I use the API to delete the record folder
- * Then it is deleted according to the normal rules governing the deletion of record folders
- *
- */
- @Test
- (
- description = "Delete record folder"
- )
- public void deleteRecordFolder()
- {
- // Create the record folder
- RecordCategoryChild recordFolder = createRecordFolder(rootCategory.getId(), getRandomName("recFolder"));
-
- // Delete the record folder
- RecordFolderAPI recordFolderAPI = getRestAPIFactory().getRecordFolderAPI();
- String recordFolderId = recordFolder.getId();
- recordFolderAPI.deleteRecordFolder(recordFolderId);
-
- // Check the response status code
- assertStatusCode(NO_CONTENT);
-
- // Check the record folder is not found
- recordFolderAPI.getRecordFolder(recordFolderId);
-
- // Check the response status code
- assertStatusCode(NOT_FOUND);
- }
-
- /**
- * Given that a record folder exists
- * When the record folder is closed
- * Then a request can be made to reopen it
- */
- @Test
- (
- description = "A closed record folder can be reopened"
- )
- @Bug(id="RM-4808")
- public void openClosedRecordFolder()
- {
- // Create a record folder
- RecordCategoryChild recordFolder = createRecordFolder(rootCategory.getId(), getRandomName("recFolder"));
-
- // Assert that the record folder is not closed
- assertFalse(recordFolder.getProperties().getIsClosed());
-
- // Get the record folder API
- RecordFolderAPI recordFolderAPI = getRestAPIFactory().getRecordFolderAPI();
-
- // Create a record folder model to close it
- RecordFolder recordFolderModel = RecordFolder.builder()
- .properties(RecordFolderProperties.builder()
- .isClosed(true)
- .build())
- .build();
-
- // Make a request to close the record folder
- RecordFolder updatedRecordFolder = recordFolderAPI.updateRecordFolder(recordFolderModel, recordFolder.getId());
-
- // Verify that the record folder is closed now
- assertTrue(updatedRecordFolder.getProperties().getIsClosed());
-
- // Create a record folder model to reopen it
- recordFolderModel = RecordFolder.builder()
- .properties(RecordFolderProperties.builder()
- .isClosed(false)
- .build())
- .build();
-
- // Make a request to reopen the record folder
- updatedRecordFolder = recordFolderAPI.updateRecordFolder(recordFolderModel, recordFolder.getId());
-
- // Verify that the record folder is open now
- assertFalse(updatedRecordFolder.getProperties().getIsClosed());
- }
-
- /**
- * Given a container that is a record folder
- * When I try to list the records from the record folder
- * Then I receive a list of all the records contained within the record folder
- */
- @Test
- public void listRecordsFromRecordFolder()
- {
- final int NUMBER_OF_RECORDS = 5;
- String containerId = createRecordFolder(rootCategory.getId(), getRandomName("recFolder")).getId();
- RecordFolderAPI recordFolderAPI = getRestAPIFactory().getRecordFolderAPI();
- // Create Electronic Records
- ArrayList children = new ArrayList<>();
- for (int i = 0; i < NUMBER_OF_RECORDS; i++)
- {
- //build the electronic record
- Record record = Record.builder()
- .name(ELECTRONIC_RECORD_NAME + i)
- .nodeType(CONTENT_TYPE)
- .build();
- //create a child
- Record child = recordFolderAPI.createRecord(record, containerId, createTempFile(ELECTRONIC_RECORD_NAME + i, ELECTRONIC_RECORD_NAME + i));
-
- children.add(child);
- }
- //Create NonElectronicRecords
- for (int i = 0; i < NUMBER_OF_RECORDS; i++)
- {
- Record nonelectronicRecord = Record.builder()
- .properties(RecordProperties.builder()
- .description("Description")
- .title("Title")
- .build())
- .name(NONELECTRONIC_RECORD_NAME + i)
- .nodeType(NON_ELECTRONIC_RECORD_TYPE)
- .build();
- //create records
- Record child = recordFolderAPI.createRecord(nonelectronicRecord, containerId);
-
- children.add(child);
- }
-
- // List children from API
- RecordFolderCollection apiChildren = (RecordFolderCollection) recordFolderAPI.getRecordFolderChildren(containerId,"include=properties").assertThat().entriesListIsNotEmpty();
-
- // Check status code
- assertStatusCode(OK);
-
-
- // Check listed children against created list
- apiChildren.getEntries().forEach(c ->
- {
- Record record = c.getEntry();
- assertNotNull(record.getId());
- logger.info("Checking child " + record.getId());
-
- try
- {
- // Find this child in created children list
- Record createdComponent = children.stream()
- .filter(child -> child.getId().equals(record.getId()))
- .findFirst()
- .orElseThrow();
-
- // Created by
- assertEquals(record.getCreatedByUser().getId(), getAdminUser().getUsername());
-
- // Is parent Id set correctly
- assertEquals(record.getParentId(), containerId);
-
- //check the record name
- assertEquals(createdComponent.getName(), record.getName(),
- "Record Name" + record.getName() + " doesn't match the one returned on create");
- assertTrue(createdComponent.getName().contains(createdComponent.getProperties().getIdentifier()),
- "Record Name"+ createdComponent.getName()+" doesn't contain the record identifier in response when creating");
- assertEquals(createdComponent.getNodeType(), record.getNodeType());
-
- } catch (NoSuchElementException e)
- {
- fail("No child element for " + record.getId());
- }
- });
- }
-
- @AfterClass (alwaysRun = true)
- public void tearDown()
- {
- deleteRecordCategory(rootCategory.getId());
- }
-}
diff --git a/amps/ags/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/records/CompleteRecordTests.java b/amps/ags/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/records/CompleteRecordTests.java
deleted file mode 100644
index 7429fb5b1e..0000000000
--- a/amps/ags/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/records/CompleteRecordTests.java
+++ /dev/null
@@ -1,223 +0,0 @@
-/*
- * #%L
- * Alfresco Records Management Module
- * %%
- * Copyright (C) 2005 - 2021 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.records;
-
-import static org.alfresco.rest.rm.community.utils.FilePlanComponentsUtil.IMAGE_FILE;
-import static org.alfresco.rest.rm.community.utils.FilePlanComponentsUtil.createElectronicRecordModel;
-import static org.alfresco.rest.rm.community.utils.FilePlanComponentsUtil.createNonElectronicRecordModel;
-import static org.alfresco.rest.rm.community.utils.FilePlanComponentsUtil.getFile;
-import static org.alfresco.rest.rm.community.utils.RMSiteUtil.createDOD5015RMSiteModel;
-import static org.springframework.http.HttpStatus.BAD_REQUEST;
-import static org.springframework.http.HttpStatus.CREATED;
-import static org.springframework.http.HttpStatus.UNPROCESSABLE_ENTITY;
-import static org.testng.Assert.assertEquals;
-
-import org.alfresco.rest.rm.community.base.BaseRMRestTest;
-import org.alfresco.rest.rm.community.model.record.Record;
-import org.alfresco.rest.rm.community.requests.gscore.api.RecordFolderAPI;
-import org.alfresco.rest.rm.community.requests.gscore.api.RecordsAPI;
-import org.alfresco.test.AlfrescoTest;
-import org.testng.annotations.DataProvider;
-import org.testng.annotations.Test;
-
-/**
- * This class contains the tests for
- * Complete Record Action REST API
- *
- * @author Sara Aspery
- * @since 2.6
- */
-public class CompleteRecordTests extends BaseRMRestTest
-{
- private static final Boolean COMPLETE = true;
- private static final Boolean INCOMPLETE = false;
- private static final String PARAMETERS = "include=isCompleted";
-
- /**
- * Incomplete records with mandatory meta-data missing
- */
- @DataProvider (name = "IncompleteRecordsMandatoryMetadataMissing")
- public Object[][] getIncompleteRecordsMandatoryMetadataMissing()
- {
- //create RM site
- createRMSite(createDOD5015RMSiteModel());
-
- // create electronic and non-electronic records
- return createAndVerifyRecordsInFolder();
- }
-
- /**
- * Incomplete records with mandatory meta-data present
- */
- @DataProvider (name = "IncompleteRecordsMandatoryMetadataPresent")
- public Object[][] getIncompleteRecordsMandatoryMetadataPresent()
- {
- // create electronic and non-electronic records
- return createAndVerifyRecordsInFolder();
- }
-
- /**
- *
- * Given the repository is configured to check mandatory data before completing a record
- * And an incomplete record with its mandatory meta-data missing
- * When I complete the record
- * Then I receive an error indicating that I can't complete the operation,
- * because some of the mandatory meta-data of the record is missing
- *
- */
- @Test
- (
- dataProvider = "IncompleteRecordsMandatoryMetadataMissing",
- description = "Cannot complete electronic and non-electronic records with mandatory metadata missing",
- priority = 1
- )
- @AlfrescoTest (jira = "RM-4431")
- public void completeRecordWithMandatoryMetadataMissing(Record record)
- {
- verifyRecordCompletionStatus(record, INCOMPLETE);
-
- // Complete record
- completeRecord(record);
- assertStatusCode(UNPROCESSABLE_ENTITY);
-
- verifyRecordCompletionStatus(record, INCOMPLETE);
- }
-
- /**
- *
- * Given the repository is configured to check mandatory data before completing a record
- * And an incomplete record with all mandatory meta-data present
- * When I complete the record
- * Then the record is successfully completed
- *
- */
- @Test
- (
- dataProvider = "IncompleteRecordsMandatoryMetadataPresent",
- description = "Can complete electronic and non-electronic records with mandatory metadata present"
- )
- @AlfrescoTest (jira = "RM-4431")
- public void completeRecordWithMandatoryMetadataPresent(Record record)
- {
- verifyRecordCompletionStatus(record, INCOMPLETE);
-
- // Complete record
- completeRecord(record);
- assertStatusCode(CREATED);
-
- verifyRecordCompletionStatus(record, COMPLETE);
- }
-
- /**
- *
- * Given a document that is not a record or any non-document node
- * When I complete the item
- * Then I receive an unsupported operation error
- *
- */
- @Test (description = "Cannot complete a document that is not a record")
- @AlfrescoTest (jira = "RM-4431")
- public void completeNonRecord()
- {
- // Get the recordsAPI
- getRestAPIFactory().getRecordsAPI()
- .completeRecord(createCategoryFolderInFilePlan().getId(), PARAMETERS);
- assertStatusCode(BAD_REQUEST);
- }
-
- /**
- *
- * Given a record that is already completed
- * When I complete the record
- * Then I receive an error indicating that I can't complete the operation, because the record is already complete
- *
- */
- @Test
- (
- dataProvider = "IncompleteRecordsMandatoryMetadataPresent",
- description = "Cannot complete a record that is already completed"
- )
- @AlfrescoTest (jira = "RM-4431")
- public void completeAlreadyCompletedRecord(Record record)
- {
- verifyRecordCompletionStatus(record, INCOMPLETE);
-
- // Complete record
- completeRecord(record);
- assertStatusCode(CREATED);
-
- verifyRecordCompletionStatus(record, COMPLETE);
-
- // Complete record
- completeRecord(record);
- assertStatusCode(UNPROCESSABLE_ENTITY);
- }
-
- /**
- * Helper method to create records and and assert successful creation
- */
- private Record[][] createAndVerifyRecordsInFolder()
- {
- RecordFolderAPI recordFolderAPI = getRestAPIFactory().getRecordFolderAPI();
-
- // create record folder
- String recordFolderId = createCategoryFolderInFilePlan().getId();
-
- // create electronic record in record folder
- Record electronicRecord = recordFolderAPI.createRecord(createElectronicRecordModel(), recordFolderId, getFile(IMAGE_FILE));
- assertStatusCode(CREATED);
-
- // create non-electronic record in record folder
- Record nonElectronicRecord = recordFolderAPI.createRecord(createNonElectronicRecordModel(), recordFolderId);
- assertStatusCode(CREATED);
-
- return new Record[][]
- {
- { electronicRecord },
- { nonElectronicRecord }
- };
- }
-
- /**
- * Helper method to verify record is complete or incomplete
- */
- private void verifyRecordCompletionStatus(Record record, Boolean completionStatus)
- {
- RecordsAPI recordsAPI = getRestAPIFactory().getRecordsAPI();
- Record recordModel = recordsAPI.getRecord(record.getId(), PARAMETERS);
- assertEquals(recordModel.getIsCompleted(), completionStatus);
- }
-
- /**
- * Helper method to complete a record
- */
- private void completeRecord(Record record)
- {
- RecordsAPI recordsAPI = getRestAPIFactory().getRecordsAPI();
- recordsAPI.completeRecord(record.getId(), PARAMETERS);
- }
-}
diff --git a/amps/ags/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/records/DeleteRecordTests.java b/amps/ags/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/records/DeleteRecordTests.java
deleted file mode 100644
index 9662943dae..0000000000
--- a/amps/ags/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/records/DeleteRecordTests.java
+++ /dev/null
@@ -1,463 +0,0 @@
-/*
- * #%L
- * Alfresco Records Management Module
- * %%
- * Copyright (C) 2005 - 2021 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.records;
-
-import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentAlias.UNFILED_RECORDS_CONTAINER_ALIAS;
-import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentType.NON_ELECTRONIC_RECORD_TYPE;
-import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentType.UNFILED_RECORD_FOLDER_TYPE;
-import static org.alfresco.rest.rm.community.model.user.UserPermissions.PERMISSION_FILING;
-import static org.alfresco.rest.rm.community.model.user.UserRoles.ROLE_RM_MANAGER;
-import static org.alfresco.rest.rm.community.model.user.UserRoles.ROLE_RM_POWER_USER;
-import static org.alfresco.rest.rm.community.utils.FilePlanComponentsUtil.IMAGE_FILE;
-import static org.alfresco.rest.rm.community.utils.FilePlanComponentsUtil.createElectronicRecordModel;
-import static org.alfresco.rest.rm.community.utils.FilePlanComponentsUtil.createElectronicUnfiledContainerChildModel;
-import static org.alfresco.rest.rm.community.utils.FilePlanComponentsUtil.createNonElectronicRecordModel;
-import static org.alfresco.rest.rm.community.utils.FilePlanComponentsUtil.createNonElectronicUnfiledContainerChildModel;
-import static org.alfresco.rest.rm.community.utils.FilePlanComponentsUtil.getFile;
-import static org.alfresco.utility.data.RandomData.getRandomName;
-import static org.alfresco.utility.report.log.Step.STEP;
-import static org.springframework.http.HttpStatus.CREATED;
-import static org.springframework.http.HttpStatus.FORBIDDEN;
-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.dataprep.CMISUtil;
-import org.alfresco.rest.core.RestResponse;
-import org.alfresco.rest.core.v0.BaseAPI.RM_ACTIONS;
-import org.alfresco.rest.model.RestNodeBodyMoveCopyModel;
-import org.alfresco.rest.model.RestNodeModel;
-import org.alfresco.rest.requests.Node;
-import org.alfresco.rest.rm.community.base.BaseRMRestTest;
-import org.alfresco.rest.rm.community.model.record.Record;
-import org.alfresco.rest.rm.community.model.record.RecordBodyFile;
-import org.alfresco.rest.rm.community.model.recordcategory.RecordCategory;
-import org.alfresco.rest.rm.community.model.recordcategory.RecordCategoryChild;
-import org.alfresco.rest.rm.community.model.unfiledcontainer.UnfiledContainerChild;
-import org.alfresco.rest.rm.community.requests.gscore.api.RecordCategoryAPI;
-import org.alfresco.rest.rm.community.requests.gscore.api.RecordFolderAPI;
-import org.alfresco.rest.rm.community.requests.gscore.api.RecordsAPI;
-import org.alfresco.rest.v0.RMRolesAndActionsAPI;
-import org.alfresco.rest.v0.service.DispositionScheduleService;
-import org.alfresco.rest.v0.service.RoleService;
-import org.alfresco.test.AlfrescoTest;
-import org.alfresco.utility.data.RandomData;
-import org.alfresco.utility.model.FileModel;
-import org.alfresco.utility.model.FolderModel;
-import org.alfresco.utility.model.RepoTestModel;
-import org.alfresco.utility.model.UserModel;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.testng.annotations.AfterClass;
-import org.testng.annotations.BeforeClass;
-import org.testng.annotations.DataProvider;
-import org.testng.annotations.Test;
-
-/**
- * Delete records tests
- *
- * @author Kristijan Conkas
- * @since 2.6
- */
-public class DeleteRecordTests extends BaseRMRestTest
-{
- @Autowired
- private DispositionScheduleService dispositionScheduleService;
- @Autowired
- private RMRolesAndActionsAPI rmRolesAndActionsAPI;
- @Autowired
- private org.alfresco.rest.v0.RecordsAPI recordsAPI;
- @Autowired
- private RoleService roleService;
- private RecordCategoryChild recordFolder;
- private UnfiledContainerChild unfiledRecordFolder;
-
- @BeforeClass (alwaysRun = true)
- public void setupDeleteRecordTests()
- {
- testSite = dataSite.usingAdmin().createPublicRandomSite();
- recordFolder = createCategoryFolderInFilePlan();
- unfiledRecordFolder = createUnfiledContainerChild(UNFILED_RECORDS_CONTAINER_ALIAS, getRandomName("Unfiled Folder "),
- UNFILED_RECORD_FOLDER_TYPE);
- }
-
- /** Data provider with electronic and non-electronic records to be deleted */
- @DataProvider (name = "recordsToBeDeleted")
- public Object[][] getRecordsToBeDeleted()
- {
- return new String[][]
- {
- // records created in an arbitrary record folder
- {getRestAPIFactory().getRecordFolderAPI().createRecord(createElectronicRecordModel(), recordFolder.getId(), getFile(IMAGE_FILE)).getId()},
- {getRestAPIFactory().getRecordFolderAPI().createRecord(createNonElectronicRecordModel(), recordFolder.getId()).getId()},
- // records created in unfiled records root
- {getRestAPIFactory().getUnfiledContainersAPI().uploadRecord(createElectronicUnfiledContainerChildModel(), UNFILED_RECORDS_CONTAINER_ALIAS, getFile(IMAGE_FILE)).getId()},
- {getRestAPIFactory().getUnfiledContainersAPI().createUnfiledContainerChild(createNonElectronicUnfiledContainerChildModel(), UNFILED_RECORDS_CONTAINER_ALIAS).getId()},
- // records created in an arbitrary unfiled records folder
- {getRestAPIFactory().getUnfiledRecordFoldersAPI().uploadRecord(createElectronicUnfiledContainerChildModel(), unfiledRecordFolder.getId(), getFile(IMAGE_FILE)).getId()},
- {getRestAPIFactory().getUnfiledRecordFoldersAPI().createUnfiledRecordFolderChild(createNonElectronicUnfiledContainerChildModel(), unfiledRecordFolder.getId()).getId()}
- };
- }
-
- /**
- *
- * Given an electronic record
- * And that I have the "Delete Record" capability
- * And write permissions
- * When I delete the record
- * Then it is deleted from the file plan
- *
- */
- @Test
- (
- dataProvider = "recordsToBeDeleted",
- description = "Admin user can delete records"
- )
- @AlfrescoTest(jira="RM-4363")
- public void adminCanDeleteRecords(String recordId)
- {
- // Delete record and verify successful deletion
- deleteAndVerify(recordId);
- }
-
- /**
- *
- * Given a non-electronic record
- * And that I don't have write permissions
- * When I try to delete the record
- * Then nothing happens
- * And error gets reported
- *
- */
- @Test
- (
- description = "User without write permissions can't delete a record"
- )
- @AlfrescoTest(jira="RM-4363")
- public void userWithoutWritePermissionsCantDeleteRecord()
- {
- // Create a non-electronic record in unfiled records
- UnfiledContainerChild nonElectronicRecord = UnfiledContainerChild.builder()
- .name("Record " + RandomData.getRandomAlphanumeric())
- .nodeType(NON_ELECTRONIC_RECORD_TYPE)
- .build();
- UnfiledContainerChild newRecord = getRestAPIFactory().getUnfiledContainersAPI().createUnfiledContainerChild(nonElectronicRecord, UNFILED_RECORDS_CONTAINER_ALIAS);
-
- assertStatusCode(CREATED);
-
- // Create test user with RM Manager role
- UserModel deleteUser = roleService.createUserWithRMRole(ROLE_RM_MANAGER.roleId);
-
- // Try to delete newRecord
- getRestAPIFactory().getRecordsAPI(deleteUser).deleteRecord(newRecord.getId());
- assertStatusCode(FORBIDDEN);
- }
-
- /**
- *
- * Given a record
- * And that I don't have the "Delete Record" capability
- * When I try to delete the record
- * Then nothing happens
- * And error gets reported
- *
- */
- @Test
- (
- description = "User without delete records capability can't delete a record"
- )
- @AlfrescoTest(jira="RM-4363")
- public void userWithoutDeleteRecordsCapabilityCantDeleteRecord()
- {
- // Create test user and add it with collaboration privileges
- // Add RM role to user, RM Power User doesn't have the "Delete Record" capabilities
- UserModel deleteUser = roleService.createUserWithRMRole(ROLE_RM_POWER_USER.roleId);
-
- // Grant "deleteUser" filing permissions on "randomFolder" parent, this will be inherited to randomFolder
- RecordCategoryAPI recordCategoryAPI = getRestAPIFactory().getRecordCategoryAPI();
- getRestAPIFactory().getRMUserAPI().addUserPermission(recordCategoryAPI.getRecordCategory(recordFolder.getParentId()).getId(), deleteUser, PERMISSION_FILING);
- assertStatusCode(OK);
-
- // Create a non-electronic record in "randomFolder"
- RecordFolderAPI recordFolderAPI = getRestAPIFactory().getRecordFolderAPI();
- Record newRecord = recordFolderAPI.createRecord(createNonElectronicRecordModel(), recordFolder.getId());
- assertStatusCode(CREATED);
-
- // Verify the user can see "newRecord"
- RecordsAPI recordsAPI = getRestAPIFactory().getRecordsAPI(deleteUser);
- recordsAPI.getRecord(newRecord.getId());
- assertStatusCode(OK);
-
- // Try to delete "newRecord"
- recordsAPI.deleteRecord(newRecord.getId());
- assertStatusCode(FORBIDDEN);
- }
-
- /**
- *
- * Given a record
- * And a copy of that record
- * When I delete the copy
- * Then it is still possible to view the content of the original record
- *
- */
- @Test(description = "Deleting copy of record doesn't delete original content")
- @AlfrescoTest(jira="MNT-18806")
- public void deleteCopyOfRecord()
- {
- STEP("Create another record category with a folder.");
- RecordCategoryChild recordFolderB = createCategoryFolderInFilePlan();
-
- STEP("Create a record in first folder and copy it into second folder.");
- String recordId = getRestAPIFactory().getRecordFolderAPI()
- .createRecord(createElectronicRecordModel(), recordFolder.getId(), getFile(IMAGE_FILE)).getId();
- String copyId = copyNode(recordId, recordFolderB.getId()).getId();
- assertStatusCode(CREATED);
-
- STEP("Check that it's possible to load the original content.");
- getNodeContent(recordId);
- assertStatusCode(OK);
-
- STEP("Delete the copy.");
- deleteAndVerify(copyId);
-
- STEP("Check that the original record node and content still exist.");
- checkNodeExists(recordId);
- getNodeContent(recordId);
- }
-
-
- /**
- *
- * Given a file that has a copy
- * And the original file is declared as record
- * When I delete the original
- * Then it is still possible to view the content of the copy
- *
- */
- @Test (description = "Deleting record doesn't delete the content for the copies")
- @AlfrescoTest (jira = "MNT-20145")
- public void deleteOriginOfRecord()
- {
- STEP("Create a file.");
- FileModel testFile = dataContent.usingAdmin().usingSite(testSite).createContent(CMISUtil.DocumentType.TEXT_PLAIN);
-
- STEP("Create a copy of the file.");
- RestNodeModel copyOfTestFile = copyNode(testFile.getNodeRefWithoutVersion(), testSite.getGuid());
-
- STEP("Declare original file as record");
- getRestAPIFactory().getFilesAPI().declareAsRecord(testFile.getNodeRefWithoutVersion());
- assertStatusCode(CREATED);
-
- STEP("Delete the record.");
- deleteAndVerify(testFile.getNodeRefWithoutVersion());
-
- STEP("Check that it's possible to load the copy content.");
- getNodeContent(copyOfTestFile.getId());
- assertStatusCode(OK);
- }
-
- /**
- *
- * Given a file that has a copy
- * And the original file is declared as record
- * And the record becomes part of a disposition schedule with a destroy step
- * When the record is destroyed
- * Then it is still possible to view the content of the copy
- *
- */
- @Test (description = "Destroying record doesn't delete the content for the associated copy")
- @AlfrescoTest (jira = "MNT-20145")
- public void destroyOfRecord()
- {
- STEP("Create a file.");
- FileModel testFile = dataContent.usingAdmin().usingSite(testSite).createContent(CMISUtil.DocumentType.TEXT_PLAIN);
- FolderModel folderModel = dataContent.usingAdmin().usingSite(testSite).createFolder();
-
- STEP("Create a copy of the file.");
- RestNodeModel copy = copyNode(testFile.getNodeRefWithoutVersion(), folderModel.getNodeRefWithoutVersion());
- assertStatusCode(CREATED);
-
- STEP("Declare the file as record.");
- getRestAPIFactory().getFilesAPI().declareAsRecord(testFile.getNodeRefWithoutVersion());
- assertStatusCode(CREATED);
-
- STEP("Create a record category with a disposition schedule.");
- RecordCategory recordCategory = createRootCategory(getRandomName("Category with disposition"));
- dispositionScheduleService.createCategoryRetentionSchedule(recordCategory.getName(), true);
-
- STEP("Add retention schedule cut off and destroy step with immediate period.");
- dispositionScheduleService.addCutOffAfterPeriodStep(recordCategory.getName(), "immediately");
- dispositionScheduleService.addDestroyWithGhostingAfterPeriodStep(recordCategory.getName(), "immediately");
-
- STEP("Create a record folder and file the record");
- RecordCategoryChild recFolder = createFolder(recordCategory.getId(), getRandomName("recFolder"));
- RecordBodyFile recordBodyFile = RecordBodyFile.builder().targetParentId(recFolder.getId()).build();
- Record recordFiled = getRestAPIFactory().getRecordsAPI().fileRecord(recordBodyFile, testFile.getNodeRefWithoutVersion());
- getRestAPIFactory().getRecordsAPI().completeRecord(recordFiled.getId());
- assertStatusCode(CREATED);
-
- STEP("Execute the disposition schedule steps.");
- rmRolesAndActionsAPI.executeAction(getAdminUser().getUsername(), getAdminUser().getUsername(), recordFiled.getName(),
- RM_ACTIONS.CUT_OFF);
- rmRolesAndActionsAPI.executeAction(getAdminUser().getUsername(), getAdminUser().getUsername(), recordFiled.getName(),
- RM_ACTIONS.DESTROY);
-
- STEP("Check that it's possible to load the copy content.");
- getNodeContent(copy.getId());
- assertStatusCode(OK);
- }
-
- /**
- *
- * Given a file that has version declared as record
- * When the record is deleted
- * Then it is still possible to view the content of the file
- *
- */
- @Test (description = "Deleting record made from version doesn't delete the content for the file")
- @AlfrescoTest (jira = "MNT-20145")
- public void deleteVersionDeclaredAsRecord()
- {
- STEP("Create a file.");
- FileModel testFile = dataContent.usingAdmin().usingSite(testSite).createContent(CMISUtil.DocumentType.TEXT_PLAIN);
-
- STEP("Declare file version as record.");
- recordsAPI.declareDocumentVersionAsRecord(getAdminUser().getUsername(), getAdminUser().getPassword(), testSite.getId(),
- testFile.getName());
- UnfiledContainerChild unfiledContainerChild = getRestAPIFactory().getUnfiledContainersAPI()
- .getUnfiledContainerChildren(UNFILED_RECORDS_CONTAINER_ALIAS)
- .getEntries().stream()
- .filter(child -> child.getEntry().getName()
- .startsWith(testFile.getName().substring(0, testFile.getName().indexOf("."))))
- .findFirst()
- .get().getEntry();
-
- STEP("Delete the record.");
- deleteAndVerify(unfiledContainerChild.getId());
-
- STEP("Check that it's possible to load the file declared version as record.");
- getNodeContent(testFile.getNodeRefWithoutVersion());
- assertStatusCode(OK);
- }
-
-
- /**
- * Utility method to delete a record and verify successful deletion
- *
- * @param recordId The id of the record
- */
- private void deleteAndVerify(String recordId)
- {
- RecordsAPI recordsAPI = getRestAPIFactory().getRecordsAPI();
-
- // Delete record and verify status
- recordsAPI.deleteRecord(recordId);
- assertStatusCode(NO_CONTENT);
-
- // Try to get deleted record
- recordsAPI.getRecord(recordId);
- assertStatusCode(NOT_FOUND);
- }
-
- /**
- * Copy a node to a folder.
- *
- * @param nodeId The id of the node to copy.
- * @param destinationFolder The id of the folder to copy it to.
- * @return The model returned by the copy API.
- */
- private RestNodeModel copyNode(String nodeId, String destinationFolder)
- {
- Node node = getNode(nodeId);
- RestNodeBodyMoveCopyModel copyBody = new RestNodeBodyMoveCopyModel();
- copyBody.setTargetParentId(destinationFolder);
- try
- {
- return node.copy(copyBody);
- }
- catch (Exception e)
- {
- throw new RuntimeException("Problem copying record.", e);
- }
- }
-
- /**
- * Get the content from a node.
- *
- * @param nodeId
- * @return The response containing the node content.
- */
- private RestResponse getNodeContent(String nodeId)
- {
- try
- {
- return getNode(nodeId).getNodeContent();
- }
- catch (Exception e)
- {
- throw new RuntimeException("Failed to load content for node.", e);
- }
- }
-
- /**
- * Check that the given node exists.
- *
- * @param nodeId The node to check.
- */
- private void checkNodeExists(String nodeId)
- {
- try
- {
- getNode(nodeId).getNode();
- }
- catch (Exception e)
- {
- throw new RuntimeException("Node does not exist.", e);
- }
- }
-
- /**
- * Get the node from a record id.
- *
- * @param recordId The record to get.
- * @return The node object.
- */
- private Node getNode(String recordId)
- {
- RepoTestModel repoTestModel = new RepoTestModel() {};
- repoTestModel.setNodeRef(recordId);
- return getRestAPIFactory().getNodeAPI(repoTestModel);
- }
-
- @AfterClass(alwaysRun = true)
- public void cleanupDeleteRecordTests()
- {
- dataSite.deleteSite(testSite);
- deleteRecordCategory(recordFolder.getParentId());
- getRestAPIFactory().getUnfiledRecordFoldersAPI().deleteUnfiledRecordFolder(unfiledRecordFolder.getId());
- }
-}
diff --git a/amps/ags/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/records/FileRecordsTests.java b/amps/ags/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/records/FileRecordsTests.java
deleted file mode 100644
index 72911908a6..0000000000
--- a/amps/ags/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/records/FileRecordsTests.java
+++ /dev/null
@@ -1,364 +0,0 @@
-/*
- * #%L
- * Alfresco Records Management Module
- * %%
- * Copyright (C) 2005 - 2021 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.records;
-
-import static org.alfresco.rest.rm.community.base.TestData.ELECTRONIC_RECORD_NAME;
-import static org.alfresco.rest.rm.community.base.TestData.NONELECTRONIC_RECORD_NAME;
-import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentAlias.FILE_PLAN_ALIAS;
-import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentAlias.TRANSFERS_ALIAS;
-import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentAlias.UNFILED_RECORDS_CONTAINER_ALIAS;
-import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentAspects.RECORD_SEARCH_ASPECT;
-import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentType.CONTENT_TYPE;
-import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentType.NON_ELECTRONIC_RECORD_TYPE;
-import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentType.UNFILED_RECORD_FOLDER_TYPE;
-import static org.alfresco.rest.rm.community.utils.FilePlanComponentsUtil.createTempFile;
-import static org.alfresco.utility.data.RandomData.getRandomAlphanumeric;
-import static org.springframework.http.HttpStatus.BAD_REQUEST;
-import static org.springframework.http.HttpStatus.CREATED;
-import static org.springframework.http.HttpStatus.FORBIDDEN;
-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.BaseRMRestTest;
-import org.alfresco.rest.rm.community.model.record.Record;
-import org.alfresco.rest.rm.community.model.record.RecordBodyFile;
-import org.alfresco.rest.rm.community.model.record.RecordContent;
-import org.alfresco.rest.rm.community.model.unfiledcontainer.UnfiledContainerChild;
-import org.alfresco.rest.rm.community.model.unfiledcontainer.UnfiledContainerChildProperties;
-import org.alfresco.rest.rm.community.requests.gscore.api.RecordFolderAPI;
-import org.alfresco.rest.rm.community.requests.gscore.api.UnfiledContainerAPI;
-import org.alfresco.rest.rm.community.requests.gscore.api.UnfiledRecordFolderAPI;
-import org.alfresco.test.AlfrescoTest;
-import org.alfresco.utility.report.Bug;
-import org.testng.annotations.BeforeClass;
-import org.testng.annotations.DataProvider;
-import org.testng.annotations.Test;
-
-/**
- * This class contains the tests for
- * File Unfiled Record Action REST API
- *
- * @author Rodica Sutu
- * @since 2.6
- */
-public class FileRecordsTests extends BaseRMRestTest
-{
- private UnfiledContainerChild electronicRecord = UnfiledContainerChild.builder()
- .name(ELECTRONIC_RECORD_NAME)
- .nodeType(CONTENT_TYPE)
- .content(RecordContent.builder().mimeType("text/plain").build())
- .build();
-
- private UnfiledContainerChild nonelectronicRecord = UnfiledContainerChild.builder()
- .properties(UnfiledContainerChildProperties.builder()
- .description(NONELECTRONIC_RECORD_NAME)
- .title("Title")
- .build())
- .name(NONELECTRONIC_RECORD_NAME)
- .nodeType(NON_ELECTRONIC_RECORD_TYPE)
- .build();
-
- private String targetFolderId, folderToLink, closedFolderId, unfiledRecordFolderId;
-
- @BeforeClass (alwaysRun = true)
- public void setupFileRecordsTests()
- {
- // create 3 record folders and close one of them
- targetFolderId = createCategoryFolderInFilePlan().getId();
- folderToLink = createCategoryFolderInFilePlan().getId();
- closedFolderId = createCategoryFolderInFilePlan().getId();
- closeFolder(closedFolderId);
-
- // create one unfiled record folder
- unfiledRecordFolderId = createUnfiledContainerChild(UNFILED_RECORDS_CONTAINER_ALIAS,
- "Unfiled Folder " + getRandomAlphanumeric(), UNFILED_RECORD_FOLDER_TYPE).getId();
- }
-
- /**
- * Invalid containers where electronic and non-electronic records can be filed
- */
- @DataProvider (name = "invalidContainersToFile")
- public Object[][] getFolderContainers()
- {
- return new String[][] {
- { FILE_PLAN_ALIAS},
- { UNFILED_RECORDS_CONTAINER_ALIAS},
- { TRANSFERS_ALIAS },
- // an arbitrary record category
- { createRootCategory(getAdminUser(), "Category " + getRandomAlphanumeric()).getId()},
- // an arbitrary unfiled records folder
- { createUnfiledContainerChild(UNFILED_RECORDS_CONTAINER_ALIAS, "Unfiled Folder " + getRandomAlphanumeric(), UNFILED_RECORD_FOLDER_TYPE).getId() }
- };
- }
-
- /**
- * Returns the ids of unfiled electronic and non-electronic records from Unfiled Records container
- */
- @DataProvider (name = "unfiledRecordsFromUnfiledRecordsContainer")
- public Object[][] getRecordsFromUnfiledRecordsContainer()
- {
- UnfiledContainerAPI unfiledContainersAPI = getRestAPIFactory().getUnfiledContainersAPI();
- return new String[][] {
- { unfiledContainersAPI.uploadRecord(electronicRecord, UNFILED_RECORDS_CONTAINER_ALIAS,
- createTempFile(ELECTRONIC_RECORD_NAME, ELECTRONIC_RECORD_NAME)).getId()},
- { unfiledContainersAPI.createUnfiledContainerChild(nonelectronicRecord, UNFILED_RECORDS_CONTAINER_ALIAS).getId()}
- };
- }
-
- /**
- * Returns the ids of unfiled electronic and non-electronic records from an Unfiled Record Folder
- */
- @DataProvider (name = "unfiledRecordsFromUnfiledRecordFolder")
- public Object[][] getRecordsFromUnfiledRecordFolder()
- {
- UnfiledRecordFolderAPI unfiledRecordFoldersAPI = getRestAPIFactory().getUnfiledRecordFoldersAPI();
-
- return new String[][] {
- { unfiledRecordFoldersAPI.uploadRecord(electronicRecord, unfiledRecordFolderId,
- createTempFile(ELECTRONIC_RECORD_NAME, ELECTRONIC_RECORD_NAME)).getId()},
- { unfiledRecordFoldersAPI.createUnfiledRecordFolderChild(nonelectronicRecord, unfiledRecordFolderId).getId()}
- };
- }
-
- /**
- * Given an unfiled record in the root unfiled record container
- * And an open record folder
- * When I file the unfiled record into the record folder
- * Then the record is filed
- */
- @Test (dataProvider = "unfiledRecordsFromUnfiledRecordsContainer")
- @AlfrescoTest (jira = "RM-7060")
- public void fileRecordFromUnfiledContainerToOpenFolder(String unfiledRecordId) throws Exception
- {
- // file the record to the folder created
- Record recordFiled = fileRecordToFolder(unfiledRecordId, targetFolderId);
- // check the response status
- assertStatusCode(CREATED);
- // check the parent id for the record returned
- assertEquals(recordFiled.getParentId(), targetFolderId);
-
- // check the record is filed to the record folder
- assertTrue(isRecordChildOfRecordFolder(unfiledRecordId, targetFolderId), unfiledRecordId + " is not filed to " + targetFolderId);
-
- // check the record doesn't exist into unfiled record container
- assertFalse(isRecordChildOfUnfiledContainer(unfiledRecordId), unfiledRecordId + " exists in Unfiled Records");
- assertTrue(hasAspect(unfiledRecordId, RECORD_SEARCH_ASPECT), "recordSearch aspect is lost after filing!");
- }
-
- /**
- * Given an unfiled record in a unfiled record folder
- * And an open record folder
- * When I file the unfiled record into the record folder
- * Then the record is filed
- */
- @Test (dataProvider = "unfiledRecordsFromUnfiledRecordFolder")
- @AlfrescoTest (jira = "RM-7060")
- public void fileRecordFromUnfiledRecordFolderToOpenFolder(String unfiledRecordId) throws Exception
- {
- // file the record to the folder created
- Record recordFiled = fileRecordToFolder(unfiledRecordId, targetFolderId);
- // check the response status
- assertStatusCode(CREATED);
- // check the parent id for the record returned
- assertEquals(recordFiled.getParentId(), targetFolderId);
-
- // check the record is filed to the record folder
- assertTrue(isRecordChildOfRecordFolder(unfiledRecordId, targetFolderId), unfiledRecordId + " is not filed to " + targetFolderId);
-
- // check the record doesn't exist into unfiled record folder
- assertFalse(isRecordChildOfUnfiledRecordFolder(unfiledRecordId),
- unfiledRecordId + " exists in " + unfiledRecordFolderId);
- assertTrue(hasAspect(unfiledRecordId, RECORD_SEARCH_ASPECT), "recordSearch aspect is lost after filing!");
- }
-
- /**
- * Given an unfiled record in the root unfiled record container
- * And a closed record folder
- * When I file the unfiled record into the record folder
- * Then I get an unsupported operation exception
- *
- */
- @Test (dataProvider = "unfiledRecordsFromUnfiledRecordsContainer")
- public void fileRecordFromUnfiledContainerToClosedFolder(String unfiledRecordId)
- {
- // file the record to the closed record folder
- fileRecordToFolder(unfiledRecordId, closedFolderId);
- // check the response status
- assertStatusCode(FORBIDDEN);
-
- // check the record is not filed to the record folder
- assertFalse(isRecordChildOfRecordFolder(unfiledRecordId, closedFolderId), unfiledRecordId + " is filed to " + closedFolderId);
-
- // check the record exist into unfiled record container
- assertTrue(isRecordChildOfUnfiledContainer(unfiledRecordId), unfiledRecordId + " doesn't exist in Unfiled Records");
- }
-
- /**
- * Given an unfiled record in a unfiled record folder
- * And a closed record folder
- * When I file the unfiled record into the record folder
- * Then I get an unsupported operation exception
- *
- */
- @Test(dataProvider = "unfiledRecordsFromUnfiledRecordFolder")
- public void fileRecordFromUnfiledRecordFolderToClosedFolder(String unfiledRecordId)
- {
- // file the record into the closed folder created
- fileRecordToFolder(unfiledRecordId, closedFolderId);
- // check the response status
- assertStatusCode(FORBIDDEN);
-
- // check the record is not filed into the record folder
- assertFalse(isRecordChildOfRecordFolder(unfiledRecordId, closedFolderId), unfiledRecordId + " is filed to " + closedFolderId);
-
- // check the record exist into unfiled record folder
- assertTrue(isRecordChildOfUnfiledRecordFolder(unfiledRecordId),
- unfiledRecordId + " doesn't exist in " + unfiledRecordFolderId);
- }
-
- /**
- * Given a filed record in a record folder
- * And an open record folder
- * When I file the filed record into the record folder
- * Then the record is filed in both locations
- */
- @Test (dataProvider = "unfiledRecordsFromUnfiledRecordsContainer")
- @Bug (id = "RM-4578")
- public void linkRecordInto(String unfiledRecordId)
- {
- // file the record to the open folder created
- Record recordFiled = fileRecordToFolder(unfiledRecordId, targetFolderId);
- // check the response status
- assertStatusCode(CREATED);
-
- // link the record to the second folder
- Record recordLink = fileRecordToFolder(unfiledRecordId, folderToLink);
- assertStatusCode(CREATED);
- assertEquals(recordLink.getParentId(), targetFolderId);
-
- // check the record is added into the record folder
- RecordFolderAPI recordFolderAPI = getRestAPIFactory().getRecordFolderAPI();
- assertTrue(recordFolderAPI.getRecordFolderChildren(targetFolderId)
- .getEntries()
- .stream()
- .anyMatch(c -> c.getEntry().getId().equals(recordFiled.getId()) &&
- c.getEntry().getParentId().equals(targetFolderId)));
-
- // check the record has a link in the second folder
- assertTrue(recordFolderAPI.getRecordFolderChildren(folderToLink)
- .getEntries().stream()
- .anyMatch(c -> c.getEntry().getId().equals(recordFiled.getId()) &&
- c.getEntry().getParentId().equals(targetFolderId) &&
- !c.getEntry().getParentId().equals(folderToLink)));
- }
-
- /**
- * Given an unfiled container or filed record
- * And a container that is NOT a record folder
- * When I file the unfiled container or filed record to the container
- * Then I get an unsupported operation exception
- */
- @Test
- (
- dataProvider = "invalidContainersToFile",
- description = "File the unfiled record to the container that is not a record folder"
- )
- public void invalidContainerToFile(String containerId)
- {
- // create records
- UnfiledContainerAPI unfiledContainersAPI = getRestAPIFactory().getUnfiledContainersAPI();
-
- UnfiledContainerChild recordElectronic = unfiledContainersAPI.uploadRecord(electronicRecord, UNFILED_RECORDS_CONTAINER_ALIAS, createTempFile(ELECTRONIC_RECORD_NAME, ELECTRONIC_RECORD_NAME));
- UnfiledContainerChild recordNonElect = unfiledContainersAPI.createUnfiledContainerChild(nonelectronicRecord, UNFILED_RECORDS_CONTAINER_ALIAS);
-
- // file the records to a container that is not a record folder
- fileRecordToFolder(recordElectronic.getId(), containerId);
- assertStatusCode(BAD_REQUEST);
-
- fileRecordToFolder(recordNonElect.getId(), containerId);
- assertStatusCode(BAD_REQUEST);
- }
-
- /**
- * Files the given record in the target record folder.
- *
- * @param recordId the id of the record to be filed
- * @param targetFolderId the id of the target record folder
- */
- private Record fileRecordToFolder(String recordId, String targetFolderId)
- {
- RecordBodyFile recordBodyFile = RecordBodyFile.builder().targetParentId(targetFolderId).build();
- return getRestAPIFactory().getRecordsAPI().fileRecord(recordBodyFile, recordId);
- }
-
- /**
- * Returns whether any child of the record folder match the provided record
- *
- * @param recordId the record id
- * @param recordFolderId the record folder id
- * @return true if any child of the record folder match the provided record, false otherwise
- */
- private boolean isRecordChildOfRecordFolder(String recordId, String recordFolderId)
- {
- return getRestAPIFactory().getRecordFolderAPI()
- .getRecordFolderChildren(recordFolderId)
- .getEntries()
- .stream()
- .anyMatch(c -> c.getEntry().getId().equals(recordId));
- }
-
- /**
- * Returns whether any child of the unfiled record folder match the provided record
- *
- * @param recordId the record id
- * @return true if any child of the unfiled record folder match the provided record, false otherwise
- */
- private boolean isRecordChildOfUnfiledRecordFolder(String recordId)
- {
- return getRestAPIFactory().getUnfiledRecordFoldersAPI()
- .getUnfiledRecordFolderChildren(unfiledRecordFolderId)
- .getEntries()
- .stream()
- .anyMatch(c -> c.getEntry().getId().equals(recordId));
- }
-
- /**
- * Returns whether any child of the unfiled container match the provided record
- *
- * @param recordId the record id
- * @return true if any child of the unfiled container match the provided record, false otherwise
- */
- private boolean isRecordChildOfUnfiledContainer(String recordId)
- {
- return getRestAPIFactory().getUnfiledContainersAPI()
- .getUnfiledContainerChildren(UNFILED_RECORDS_CONTAINER_ALIAS)
- .getEntries()
- .stream()
- .anyMatch(c -> c.getEntry().getId().equals(recordId));
- }
-}
diff --git a/amps/ags/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/records/MoveRecordsTests.java b/amps/ags/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/records/MoveRecordsTests.java
deleted file mode 100644
index 38525a71ac..0000000000
--- a/amps/ags/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/records/MoveRecordsTests.java
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
- * #%L
- * Alfresco Records Management Module
- * %%
- * Copyright (C) 2005 - 2021 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.records;
-
-import static org.alfresco.rest.rm.community.base.TestData.ELECTRONIC_RECORD_NAME;
-import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentAspects.RECORD_SEARCH_ASPECT;
-import static org.alfresco.rest.rm.community.utils.CoreUtil.createBodyForMoveCopy;
-import static org.alfresco.rest.rm.community.utils.CoreUtil.toContentModel;
-import static org.alfresco.utility.report.log.Step.STEP;
-import static org.springframework.http.HttpStatus.OK;
-import static org.testng.Assert.assertTrue;
-
-import org.alfresco.rest.rm.community.base.BaseRMRestTest;
-import org.alfresco.test.AlfrescoTest;
-import org.testng.annotations.Test;
-
-/**
- * Move records tests
- *
- * @author Claudia Agache
- * @since 3.3
- */
-public class MoveRecordsTests extends BaseRMRestTest
-{
- @Test (description = "rma:recordSearch aspect is reapplied after record move")
- @AlfrescoTest (jira = "RM-7060")
- public void moveRecord() throws Exception
- {
- String parentFolderId = createCategoryFolderInFilePlan().getId();
- String targetFolderId = createCategoryFolderInFilePlan().getId();
- String electronicRecordId = createElectronicRecord(parentFolderId, ELECTRONIC_RECORD_NAME).getId();
- STEP("Move record from one folder to the other");
- getRestAPIFactory().getNodeAPI(toContentModel(electronicRecordId)).move(createBodyForMoveCopy(targetFolderId));
- assertStatusCode(OK);
-
- STEP("Check the record still has rma:recordSearch aspect.");
- assertTrue(hasAspect(electronicRecordId, RECORD_SEARCH_ASPECT), "recordSearch aspect is lost after move!");
- }
-}
diff --git a/amps/ags/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/records/ReadRecordTests.java b/amps/ags/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/records/ReadRecordTests.java
deleted file mode 100644
index 0de24378f5..0000000000
--- a/amps/ags/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/records/ReadRecordTests.java
+++ /dev/null
@@ -1,352 +0,0 @@
-/*
- * #%L
- * Alfresco Records Management Module
- * %%
- * Copyright (C) 2005 - 2021 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.records;
-
-import static org.alfresco.rest.rm.community.base.TestData.RECORD_FOLDER_NAME;
-import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentAlias.FILE_PLAN_ALIAS;
-import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentAlias.TRANSFERS_ALIAS;
-import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.CONTENT;
-import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.IS_COMPLETED;
-import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PATH;
-import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentType.CONTENT_TYPE;
-import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentType.NON_ELECTRONIC_RECORD_TYPE;
-import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentType.RECORD_FOLDER_TYPE;
-import static org.alfresco.rest.rm.community.utils.FilePlanComponentsUtil.IMAGE_FILE;
-import static org.alfresco.rest.rm.community.utils.FilePlanComponentsUtil.createRecordCategoryModel;
-import static org.alfresco.rest.rm.community.utils.FilePlanComponentsUtil.createTempFile;
-import static org.alfresco.rest.rm.community.utils.FilePlanComponentsUtil.getFile;
-import static org.alfresco.utility.data.RandomData.getRandomAlphanumeric;
-import static org.alfresco.utility.data.RandomData.getRandomName;
-import static org.springframework.http.HttpStatus.BAD_REQUEST;
-import static org.springframework.http.HttpStatus.OK;
-import static org.testng.Assert.assertEquals;
-import static org.testng.Assert.assertNotEquals;
-import static org.testng.Assert.assertNotNull;
-import static org.testng.Assert.assertNull;
-import static org.testng.AssertJUnit.assertTrue;
-
-import java.io.FileInputStream;
-import java.io.InputStream;
-
-import org.alfresco.rest.rm.community.base.BaseRMRestTest;
-import org.alfresco.rest.rm.community.base.TestData;
-import org.alfresco.rest.rm.community.model.record.Record;
-import org.alfresco.rest.rm.community.model.record.RecordContent;
-import org.alfresco.rest.rm.community.model.record.RecordProperties;
-import org.alfresco.rest.rm.community.model.recordcategory.RecordCategory;
-import org.alfresco.rest.rm.community.model.recordcategory.RecordCategoryChild;
-import org.alfresco.rest.rm.community.model.recordcategory.RecordCategoryChildCollection;
-import org.alfresco.rest.rm.community.requests.gscore.api.RecordCategoryAPI;
-import org.alfresco.rest.rm.community.requests.gscore.api.RecordFolderAPI;
-import org.alfresco.rest.rm.community.requests.gscore.api.RecordsAPI;
-import org.alfresco.test.AlfrescoTest;
-import org.apache.commons.codec.digest.DigestUtils;
-import org.testng.annotations.AfterClass;
-import org.testng.annotations.BeforeClass;
-import org.testng.annotations.DataProvider;
-import org.testng.annotations.Test;
-
-/**
- * This class contains the tests for Read Records API
- *
- * @author Rodica Sutu
- * @since 2.6
- */
-public class ReadRecordTests extends BaseRMRestTest
-{
- public static final String CATEGORY_NAME = TestData.RECORD_CATEGORY_NAME + getRandomAlphanumeric();
-
- public static final String ELECTRONIC_RECORD_NAME = "Record electronic" + getRandomAlphanumeric();
- public static final String NONELECTRONIC_RECORD_NAME = "Record nonelectronic" + getRandomAlphanumeric();
-
- private Record electronicRecord = Record.builder()
- .name(ELECTRONIC_RECORD_NAME)
- .nodeType(CONTENT_TYPE)
- .build();
-
- private Record nonelectronicRecord = Record.builder()
- .properties(RecordProperties.builder()
- .description(NONELECTRONIC_RECORD_NAME)
- .title("Title")
- .build())
- .name(NONELECTRONIC_RECORD_NAME)
- .nodeType(NON_ELECTRONIC_RECORD_TYPE)
- .build();
-
- private RecordCategory rootCategory, rootCategory2;
- private RecordCategoryChild recordFolder;
-
- @BeforeClass(alwaysRun = true)
- public void setupReadRecordTests()
- {
- rootCategory = createRootCategory(getRandomName("rootCategory"));
- rootCategory2 = createRootCategory(getRandomName("rootCategory2"));
- recordFolder = createRecordFolder(rootCategory.getId(), getRandomName("recFolder"));
- }
- /**
- * Given a record category or a container which can't contain records
- * When I try to read the children filtering the results to records
- * Then I receive an empty list
- */
- @DataProvider (name = "invalidContainersForRecords")
- public Object[][] getInvalidContainersForRecords()
- {
- return new String[][] {
- { FILE_PLAN_ALIAS },
- { TRANSFERS_ALIAS },
- { rootCategory.getId()}
- };
- }
- @Test
- (
- dataProvider = "invalidContainersForRecords",
- description = "Reading records from invalid containers"
- )
- @AlfrescoTest(jira="RM-4361")
- public void readRecordsFromInvalidContainers(String container)
- {
- Record electronicRecord = Record.builder()
- .name(ELECTRONIC_RECORD_NAME)
- .nodeType(CONTENT_TYPE)
- .content(RecordContent.builder().mimeType("text/plain").build())
- .build();
- Record nonelectronicRecord = Record.builder()
- .properties(RecordProperties.builder()
- .description("Description")
- .title("Title")
- .build())
- .name(NONELECTRONIC_RECORD_NAME)
- .nodeType(NON_ELECTRONIC_RECORD_TYPE)
- .build();
- //create records
- RecordFolderAPI recordFolderAPI = getRestAPIFactory().getRecordFolderAPI();
- recordFolderAPI.createRecord(electronicRecord, container);
- assertStatusCode(BAD_REQUEST);
- recordFolderAPI.createRecord(nonelectronicRecord, container);
- assertStatusCode(BAD_REQUEST);
-
- if(FILE_PLAN_ALIAS.equals(container))
- {
- getRestAPIFactory().getFilePlansAPI().getRootRecordCategories(container, "")
- .assertThat()//check the list returned is not empty
- .entriesListIsNotEmpty().assertThat().paginationExist();
- //check response status code
- assertStatusCode(OK);
- }
- else if(TRANSFERS_ALIAS.equals(container))
- {
- getRestAPIFactory().getTransferContainerAPI().getTransfers(container, "where=(isRecord=true)")
- .assertThat()//check the list returned is empty
- .entriesListIsEmpty().assertThat().paginationExist();
- //check response status code
- assertStatusCode(OK);
- }
- else
- {
- RecordCategoryChildCollection children = getRestAPIFactory().getRecordCategoryAPI().getRecordCategoryChildren(container);
- //check response status code
- assertStatusCode(OK);
- children.assertThat() //check the list returned is not empty because there is a record folder created inside
- .entriesListCountIs(1).assertThat().paginationExist();
- assertEquals(children.getEntries().get(0).getEntry().getNodeType(), RECORD_FOLDER_TYPE);
- }
- }
-
- /**
- * Given a record
- * When I try to read the meta-data
- * Then I successfully receive the meta-data values for that record
- */
- @Test
- @AlfrescoTest (jira = "RM-4361")
- public void readRecordMetadata()
- {
- String RELATIVE_PATH = "/" + CATEGORY_NAME + getRandomAlphanumeric() + "/folder";
-
- RecordCategory recordCategoryModel = createRecordCategoryModel(CATEGORY_NAME, CATEGORY_NAME);
- String recordCategoryId = getRestAPIFactory().getFilePlansAPI().createRootRecordCategory(recordCategoryModel, FILE_PLAN_ALIAS).getId();
-
- //create the containers from the relativePath
- RecordCategoryChild recordFolderModel = RecordCategoryChild.builder()
- .name(RECORD_FOLDER_NAME)
- .nodeType(RECORD_FOLDER_TYPE)
- .relativePath(RELATIVE_PATH)
- .build();
-
- String recordFolderId = getRestAPIFactory().getRecordCategoryAPI().createRecordCategoryChild(recordFolderModel, recordCategoryId, "include=" + PATH).getId();
-
- //create electronic record
- String recordWithContentId = getRestAPIFactory().getRecordFolderAPI().createRecord(electronicRecord, recordFolderId, getFile(IMAGE_FILE)).getId();
-
- //Get the record created
- Record recordWithContent= getRestAPIFactory().getRecordsAPI().getRecord(recordWithContentId, "include="+IS_COMPLETED +"," + CONTENT);
-
- //Check the metadata returned
- assertTrue(recordWithContent.getName().startsWith(ELECTRONIC_RECORD_NAME));
- assertNotNull(recordWithContent.getContent().getEncoding());
- assertEquals(recordWithContent.getNodeType(),CONTENT_TYPE);
- assertNotNull(recordWithContent.getContent().getEncoding());
- assertNotNull(recordWithContent.getContent().getMimeType());
- assertNotNull(recordWithContent.getAspectNames());
- assertNotEquals(ELECTRONIC_RECORD_NAME, recordWithContent.getName());
- assertTrue(recordWithContent.getName().contains(recordWithContent.getProperties().getIdentifier()));
- assertStatusCode(OK);
-
- //create non-electronic record
- String nonElectronicRecordId = getRestAPIFactory().getRecordFolderAPI().createRecord(nonelectronicRecord, recordFolderId).getId();
- //Get the record created
- Record nonElectronicRecord = getRestAPIFactory().getRecordsAPI().getRecord(nonElectronicRecordId, "include=" + IS_COMPLETED +"," + CONTENT);
-
- //Check the metadata returned
- assertTrue(nonElectronicRecord.getName().startsWith(NONELECTRONIC_RECORD_NAME));
- assertNull(nonElectronicRecord.getContent());
- assertEquals(nonElectronicRecord.getNodeType(), NON_ELECTRONIC_RECORD_TYPE);
- assertNotNull(nonElectronicRecord.getAspectNames());
- assertEquals(nonElectronicRecord.getProperties().getDescription(), NONELECTRONIC_RECORD_NAME);
- assertNotEquals(NONELECTRONIC_RECORD_NAME, nonElectronicRecord.getName());
- assertTrue(nonElectronicRecord.getName().contains(nonElectronicRecord.getProperties().getIdentifier()));
- assertStatusCode(OK);
- }
-
- /**
- * Given an electronic record
- * When I try to read the content
- * Then I successfully receive the content of the record
- */
- @Test
- @AlfrescoTest (jira = "RM-4361")
- public void readRecordContent() throws Exception
- {
- RecordsAPI recordsAPI = getRestAPIFactory().getRecordsAPI();
-
- String RECORD_ELECTRONIC = "Record " + getRandomAlphanumeric();
- String RECORD_ELECTRONIC_BINARY = "Binary Record" + getRandomAlphanumeric();
-
- String RELATIVE_PATH = "/" + CATEGORY_NAME + getRandomAlphanumeric() + "/folder";
-
- // create the containers from the relativePath
- RecordCategoryChild recordFolder = RecordCategoryChild.builder()
- .name(RECORD_FOLDER_NAME)
- .nodeType(RECORD_FOLDER_TYPE)
- .relativePath(RELATIVE_PATH)
- .build();
- RecordCategoryAPI recordCategoryAPI = getRestAPIFactory().getRecordCategoryAPI();
- String folderId = recordCategoryAPI.createRecordCategoryChild(recordFolder, rootCategory2.getId()).getId();
-
- // text file as an electronic record
- Record recordText = Record.builder()
- .name(RECORD_ELECTRONIC)
- .nodeType(CONTENT_TYPE)
- .build();
- RecordFolderAPI recordFolderAPI = getRestAPIFactory().getRecordFolderAPI();
- String recordId = recordFolderAPI.createRecord(recordText, folderId, createTempFile(RECORD_ELECTRONIC, RECORD_ELECTRONIC)).getId();
- assertEquals(recordsAPI.getRecordContent(recordId).asString(), RECORD_ELECTRONIC);
- // Check status code
- assertStatusCode(OK);
-
- // binary file as an electronic record
- Record recordBinary = Record.builder()
- .name(RECORD_ELECTRONIC_BINARY)
- .nodeType(CONTENT_TYPE)
- .build();
-
- String binaryRecordId = recordFolderAPI.createRecord(recordBinary, folderId, getFile(IMAGE_FILE)).getId();
- // binary content, therefore compare respective SHA1 checksums in order to verify this is identical content
- try
- (
- InputStream recordContentStream = recordsAPI.getRecordContent(binaryRecordId).asInputStream();
- FileInputStream localFileStream = new FileInputStream(getFile(IMAGE_FILE))
- )
- {
- assertEquals(DigestUtils.sha1(recordContentStream), DigestUtils.sha1(localFileStream));
- }
- assertStatusCode(OK);
-
- // electronic record with no content
- Record recordNoContent = Record.builder()
- .name(RECORD_ELECTRONIC)
- .nodeType(CONTENT_TYPE)
- .build();
- String recordNoContentId = recordFolderAPI.createRecord(recordNoContent,folderId).getId();
- assertTrue(recordsAPI.getRecordContent(recordNoContentId).asString().isEmpty());
- assertStatusCode(OK);
- }
- /**
- * Given a non-electronic record
- * When I try to read the content
- * Then I am informed that the record has no content
- */
- @Test
- @AlfrescoTest (jira = "RM-4361")
- public void readNonElectronicRecordContent()
- {
- Record record = Record.builder()
- .name(getRandomName("Record nonelectronic"))
- .nodeType(NON_ELECTRONIC_RECORD_TYPE)
- .build();
-
- RecordFolderAPI recordFolderAPI = getRestAPIFactory().getRecordFolderAPI();
- String nonElectronicRecord = recordFolderAPI.createRecord(record, recordFolder.getId()).getId();
-
- getRestAPIFactory().getRecordsAPI().getRecordContent(nonElectronicRecord);
- assertStatusCode(BAD_REQUEST);
- }
-
- /**
- * Given a container (eg record folder, record category, etc)
- * When I try to read the content
- * Then I receive an error
- */
- @DataProvider(name="noContentNodes")
- public Object[][] getNonRecordTypes()
- {
- return new String[][] {
- { getFilePlan(FILE_PLAN_ALIAS).getId() },
- { getTransferContainer(TRANSFERS_ALIAS).getId() },
- { rootCategory.getId()}
- };
- }
- @Test
- (
- dataProvider = "noContentNodes",
- description = "Reading records from invalid containers"
- )
- @AlfrescoTest (jira = "RM-4361")
- public void readContentFromInvalidContainers(String container)
- {
- getRestAPIFactory().getRecordsAPI().getRecordContent(container).asString();
- assertStatusCode(BAD_REQUEST);
- }
-
- @AfterClass(alwaysRun = true)
- public void cleanupReadRecordTests()
- {
- deleteRecordCategory(rootCategory.getId());
- deleteRecordCategory(rootCategory2.getId());
- }
-
-}
diff --git a/amps/ags/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/records/RejectRecordTests.java b/amps/ags/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/records/RejectRecordTests.java
deleted file mode 100644
index 1a64e89a34..0000000000
--- a/amps/ags/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/records/RejectRecordTests.java
+++ /dev/null
@@ -1,163 +0,0 @@
-/*
- * #%L
- * Alfresco Records Management Module
- * %%
- * Copyright (C) 2005 - 2021 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.records;
-
-import static org.alfresco.rest.core.v0.BaseAPI.NODE_PREFIX;
-import static org.alfresco.rest.rm.community.requests.gscore.api.FilesAPI.PARENT_ID_PARAM;
-import static org.alfresco.utility.data.RandomData.getRandomName;
-import static org.alfresco.utility.report.log.Step.STEP;
-import static org.apache.http.HttpStatus.SC_INTERNAL_SERVER_ERROR;
-import static org.springframework.http.HttpStatus.CREATED;
-import static org.testng.Assert.assertFalse;
-import static org.testng.Assert.assertTrue;
-
-import java.util.Collections;
-
-import org.alfresco.dataprep.CMISUtil;
-import org.alfresco.rest.rm.community.base.BaseRMRestTest;
-import org.alfresco.rest.rm.community.model.record.Record;
-import org.alfresco.rest.rm.community.model.record.RecordBodyFile;
-import org.alfresco.rest.rm.community.model.recordcategory.RecordCategory;
-import org.alfresco.rest.rm.community.model.recordcategory.RecordCategoryChild;
-import org.alfresco.rest.rm.community.model.rules.ActionsOnRule;
-import org.alfresco.rest.rm.community.model.rules.RuleDefinition;
-import org.alfresco.rest.v0.RecordsAPI;
-import org.alfresco.rest.v0.RulesAPI;
-import org.alfresco.test.AlfrescoTest;
-import org.alfresco.utility.model.FileModel;
-import org.alfresco.utility.model.SiteModel;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.testng.annotations.AfterClass;
-import org.testng.annotations.BeforeClass;
-import org.testng.annotations.Test;
-
-/**
- * API tests for rejecting records
- * @author Ross Gale
- * @since 3.1
- */
-public class RejectRecordTests extends BaseRMRestTest
-{
- private final static String REJECT_REASON = "Just because";
- private SiteModel publicSite;
- private RecordCategory recordCategory;
- private RecordCategoryChild recordFolder, linkRecordFolder;
-
- @Autowired
- private RecordsAPI recordsAPI;
- @Autowired
- private RulesAPI rulesAPI;
-
- @BeforeClass (alwaysRun = true)
- public void setUp()
- {
- publicSite = dataSite.usingAdmin().createPublicRandomSite();
- recordCategory = createRootCategory(getRandomName("recordCategory"));
- recordFolder = createFolder(recordCategory.getId(), getRandomName("recordFolder"));
- linkRecordFolder = createFolder(recordCategory.getId(), getRandomName("linkRecordFolder"));
- }
-
- /**
- * Test that when rejecting a linked record that the link is also removed
- */
- @Test
- @AlfrescoTest(jira = "RM-6869")
- public void rejectLinkedRecord()
- {
- STEP("Create a document in the collaboration site");
- FileModel testFile = dataContent.usingSite(publicSite)
- .usingAdmin()
- .createContent(CMISUtil.DocumentType.TEXT_PLAIN);
-
- STEP("Declare document as record with a location parameter value");
- Record record = getRestAPIFactory().getFilesAPI()
- .usingParams(String.format("%s=%s", PARENT_ID_PARAM, recordFolder.getId()))
- .declareAsRecord(testFile.getNodeRefWithoutVersion());
- assertStatusCode(CREATED);
-
- STEP("Link record to new folder");
- RecordBodyFile linkRecordBody = RecordBodyFile.builder().targetParentId(linkRecordFolder.getId()).build();
- getRestAPIFactory().getRecordsAPI().fileRecord(linkRecordBody, record.getId());
-
- STEP("Verify the linked record has been added");
- assertTrue(isMatchingRecordInRecordFolder(testFile, linkRecordFolder), "Linked record not created");
-
- STEP("Reject record");
- recordsAPI.rejectRecord(getAdminUser().getUsername(), getAdminUser().getPassword(), record.getName(), REJECT_REASON);
-
- STEP("Check record has been rejected");
- assertFalse(isMatchingRecordInRecordFolder(testFile, recordFolder), "Record rejection failure");
-
- STEP("Verify the linked record has been removed");
- assertFalse(isMatchingRecordInRecordFolder(testFile, linkRecordFolder), "Record link not removed");
- }
-
- /**
- * Test that rejecting a completed record is not possible
- */
- @Test
- @AlfrescoTest(jira = "RM-6881")
- public void rejectCompletedRecord()
- {
- STEP("Create a document in the collaboration site");
- FileModel testFile = dataContent.usingSite(publicSite)
- .usingAdmin()
- .createContent(CMISUtil.DocumentType.TEXT_PLAIN);
-
- STEP("Create a record folder with a reject rule");
- RecordCategoryChild folderWithRule = createFolder(recordCategory.getId(), getRandomName("recordFolder"));
- RuleDefinition ruleDefinition = RuleDefinition.createNewRule().title("name").description("description")
- .applyToChildren(true).rejectReason(REJECT_REASON)
- .actions(Collections.singletonList(ActionsOnRule.REJECT.getActionValue()));
- rulesAPI.createRule(getAdminUser().getUsername(), getAdminUser().getPassword(), NODE_PREFIX + folderWithRule.getId(), ruleDefinition);
-
-
- STEP("Declare document as record to Unfiled Records folder");
- Record record = getRestAPIFactory().getFilesAPI().declareAsRecord(testFile.getNodeRefWithoutVersion());
- assertStatusCode(CREATED);
-
- STEP("Complete, then file the record to the folder with rule");
- completeRecord(record.getId());
- RecordBodyFile recordBodyFile = RecordBodyFile.builder().targetParentId(folderWithRule.getId()).build();
- getRestAPIFactory().getRecordsAPI().fileRecord(recordBodyFile, record.getId());
- assertStatusCode(CREATED);
-
- STEP("Check record hasn't been rejected through rule");
- assertTrue(isMatchingRecordInRecordFolder(testFile, folderWithRule), "Record rejection succeeded!");
-
- STEP("Reject record directly through api");
- recordsAPI.rejectRecord(getAdminUser().getUsername(), getAdminUser().getPassword(), SC_INTERNAL_SERVER_ERROR,
- record.getName(), REJECT_REASON);
- }
-
- @AfterClass (alwaysRun = true)
- public void cleanUp()
- {
- deleteRecordCategory(recordCategory.getId());
- dataSite.deleteSite(publicSite);
- }
-}
diff --git a/amps/ags/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/records/UpdateRecordsTests.java b/amps/ags/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/records/UpdateRecordsTests.java
deleted file mode 100644
index 4af4bd0c38..0000000000
--- a/amps/ags/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/records/UpdateRecordsTests.java
+++ /dev/null
@@ -1,387 +0,0 @@
-/*
- * #%L
- * Alfresco Records Management Module
- * %%
- * Copyright (C) 2005 - 2021 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.records;
-
-import static java.util.Arrays.asList;
-
-import static org.alfresco.rest.rm.community.base.TestData.NONELECTRONIC_RECORD_NAME;
-import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentAlias.UNFILED_RECORDS_CONTAINER_ALIAS;
-import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentType.NON_ELECTRONIC_RECORD_TYPE;
-import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentType.UNFILED_RECORD_FOLDER_TYPE;
-import static org.alfresco.rest.rm.community.model.user.UserRoles.ROLE_RM_SECURITY_OFFICER;
-import static org.alfresco.rest.rm.community.utils.FilePlanComponentsUtil.IMAGE_FILE;
-import static org.alfresco.rest.rm.community.utils.FilePlanComponentsUtil.createElectronicRecordModel;
-import static org.alfresco.rest.rm.community.utils.FilePlanComponentsUtil.createElectronicUnfiledContainerChildModel;
-import static org.alfresco.rest.rm.community.utils.FilePlanComponentsUtil.createNonElectronicRecordModel;
-import static org.alfresco.rest.rm.community.utils.FilePlanComponentsUtil.createNonElectronicUnfiledContainerChildModel;
-import static org.alfresco.rest.rm.community.utils.FilePlanComponentsUtil.createRecordModel;
-import static org.alfresco.rest.rm.community.utils.FilePlanComponentsUtil.getFile;
-import static org.alfresco.utility.data.RandomData.getRandomName;
-import static org.springframework.http.HttpStatus.CREATED;
-import static org.springframework.http.HttpStatus.FORBIDDEN;
-import static org.springframework.http.HttpStatus.OK;
-import static org.springframework.http.HttpStatus.UNPROCESSABLE_ENTITY;
-import static org.testng.Assert.assertEquals;
-import static org.testng.Assert.assertTrue;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.alfresco.rest.rm.community.base.BaseRMRestTest;
-import org.alfresco.rest.rm.community.model.record.Record;
-import org.alfresco.rest.rm.community.model.recordcategory.RecordCategory;
-import org.alfresco.rest.rm.community.model.recordcategory.RecordCategoryChild;
-import org.alfresco.rest.rm.community.model.unfiledcontainer.UnfiledContainerChild;
-import org.alfresco.rest.rm.community.model.unfiledcontainer.UnfiledContainerChildProperties;
-import org.alfresco.rest.rm.community.model.user.UserPermissions;
-import org.alfresco.rest.rm.community.requests.gscore.api.RecordFolderAPI;
-import org.alfresco.rest.rm.community.requests.gscore.api.RecordsAPI;
-import org.alfresco.rest.rm.community.requests.gscore.api.UnfiledContainerAPI;
-import org.alfresco.rest.rm.community.requests.gscore.api.UnfiledRecordFolderAPI;
-import org.alfresco.rest.v0.service.RoleService;
-import org.alfresco.test.AlfrescoTest;
-import org.alfresco.utility.model.UserModel;
-import org.alfresco.utility.report.Bug;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.testng.annotations.AfterClass;
-import org.testng.annotations.BeforeClass;
-import org.testng.annotations.DataProvider;
-import org.testng.annotations.Test;
-
-/**
- * Update records tests
- *
- * These tests only test the update of electronic and non-electronic tests
- *
- * @author Kristijan Conkas
- * @since 2.6
- */
-public class UpdateRecordsTests extends BaseRMRestTest
-{
- @Autowired
- private RoleService roleService;
-
- private RecordCategory rootCategory;
- private UnfiledContainerChild unfiledRecordFolder;
- private final List unfiledRecords = new ArrayList<>();
- private UserModel updateUser;
-
- @BeforeClass (alwaysRun = true)
- public void preconditionUpdateRecordsTests()
- {
- rootCategory = createRootCategory(getRandomName("CATEGORY NAME"));
- unfiledRecordFolder = createUnfiledContainerChild(UNFILED_RECORDS_CONTAINER_ALIAS,
- getRandomName("UnfiledRecordFolder"), UNFILED_RECORD_FOLDER_TYPE);
- // RM Security Officer is the lowest role with Edit Record Metadata capabilities
- // Grant updateUser Filing privileges on root category, this will be inherited to record folders
- updateUser = roleService.createUserWithRMRoleAndCategoryPermission(ROLE_RM_SECURITY_OFFICER.roleId,
- rootCategory, UserPermissions.PERMISSION_FILING);
- }
-
- /** Incomplete electronic and non electronic records created in one record folder, unfiled records container and one unfiled record folder */
- @DataProvider(name = "incompleteRecords")
- public Object[][] getIncompleteRecords()
- {
- //create electronic and nonElectronic record in record folder
- String recordFolderId = createRecordFolder(rootCategory.getId(), getRandomName("recFolder1")).getId();
- RecordFolderAPI recordFolderAPI = getRestAPIFactory().getRecordFolderAPI();
-
- Record electronicRecord = recordFolderAPI.createRecord(createElectronicRecordModel(), recordFolderId, getFile(IMAGE_FILE));
- assertStatusCode(CREATED);
-
- Record nonElectronicRecord = recordFolderAPI.createRecord(createNonElectronicRecordModel(), recordFolderId);
- assertStatusCode(CREATED);
-
- //create electronic record and nonElectronic record in unfiled records container
- UnfiledContainerAPI unfiledContainersAPI = getRestAPIFactory().getUnfiledContainersAPI();
- UnfiledContainerChild electronicRecord1 = unfiledContainersAPI.uploadRecord(createElectronicUnfiledContainerChildModel(), UNFILED_RECORDS_CONTAINER_ALIAS, getFile(IMAGE_FILE));
- assertStatusCode(CREATED);
- unfiledRecords.add(electronicRecord1);
-
- UnfiledContainerChild nonElectronicRecord1 = unfiledContainersAPI.createUnfiledContainerChild(createNonElectronicUnfiledContainerChildModel(), UNFILED_RECORDS_CONTAINER_ALIAS);
- assertStatusCode(CREATED);
- unfiledRecords.add(nonElectronicRecord1);
-
- //create electronic record and nonElectronic record in unfiled record folder
- UnfiledRecordFolderAPI unfiledRecordFoldersAPI = getRestAPIFactory().getUnfiledRecordFoldersAPI();
- UnfiledContainerChild electronicRecord2 = unfiledRecordFoldersAPI.uploadRecord(createElectronicUnfiledContainerChildModel(), unfiledRecordFolder.getId(), getFile(IMAGE_FILE));
- assertStatusCode(CREATED);
-
- UnfiledContainerChild nonElectronicRecord2 = unfiledRecordFoldersAPI.createUnfiledRecordFolderChild(createNonElectronicUnfiledContainerChildModel(), unfiledRecordFolder.getId());
- assertStatusCode(CREATED);
-
- return new String[][]
- {
- // an arbitrary record folder
- { electronicRecord.getId() },
- { nonElectronicRecord.getId() },
- // unfiled records root
- { electronicRecord1.getId() },
- { nonElectronicRecord1.getId() },
- // an arbitrary unfiled records folder
- { electronicRecord2.getId() },
- { nonElectronicRecord2.getId() }
- };
- }
-
- /** Complete electronic and non electronic records created in one record folder, unfiled records container and one unfiled record folder */
- @DataProvider(name = "completeRecords")
- public Object[][] getCompleteRecords()
- {
- //create electronic and nonElectronic record in record folder
- String recordFolderId = createRecordFolder(rootCategory.getId(), getRandomName("recFolder2")).getId();
- RecordFolderAPI recordFolderAPI = getRestAPIFactory().getRecordFolderAPI();
-
- Record electronicRecord = recordFolderAPI.createRecord(createElectronicRecordModel(), recordFolderId, getFile(IMAGE_FILE));
- assertStatusCode(CREATED);
- completeRecord(electronicRecord.getId());
-
- Record nonElectronicRecord = recordFolderAPI.createRecord(createNonElectronicRecordModel(), recordFolderId);
- assertStatusCode(CREATED);
- completeRecord(nonElectronicRecord.getId());
-
- //create electronic record and nonElectronic record in unfiled records container
- UnfiledContainerAPI unfiledContainersAPI = getRestAPIFactory().getUnfiledContainersAPI();
- UnfiledContainerChild electronicRecord1 = unfiledContainersAPI.uploadRecord(createElectronicUnfiledContainerChildModel(), UNFILED_RECORDS_CONTAINER_ALIAS, getFile(IMAGE_FILE));
- assertStatusCode(CREATED);
- completeRecord(electronicRecord1.getId());
- unfiledRecords.add(electronicRecord1);
-
- UnfiledContainerChild nonElectronicRecord1 = unfiledContainersAPI.createUnfiledContainerChild(createNonElectronicUnfiledContainerChildModel(), UNFILED_RECORDS_CONTAINER_ALIAS);
- assertStatusCode(CREATED);
- completeRecord(nonElectronicRecord1.getId());
- unfiledRecords.add(nonElectronicRecord1);
-
- //create electronic record and nonElectronic record in unfiled record folder
- UnfiledRecordFolderAPI unfiledRecordFoldersAPI = getRestAPIFactory().getUnfiledRecordFoldersAPI();
- UnfiledContainerChild electronicRecord2 = unfiledRecordFoldersAPI.uploadRecord(createElectronicUnfiledContainerChildModel(), unfiledRecordFolder.getId(), getFile(IMAGE_FILE));
- assertStatusCode(CREATED);
- completeRecord(electronicRecord2.getId());
-
- UnfiledContainerChild nonElectronicRecord2 = unfiledRecordFoldersAPI.createUnfiledRecordFolderChild(createNonElectronicUnfiledContainerChildModel(), unfiledRecordFolder.getId());
- assertStatusCode(CREATED);
- completeRecord(nonElectronicRecord2.getId());
-
- return new String[][]
- {
- // an arbitrary record folder
- { electronicRecord.getId(), nonElectronicRecord.getId()},
- // unfiled records root
- { electronicRecord1.getId(), nonElectronicRecord1.getId()},
- // an arbitrary unfiled records folder
- { electronicRecord2.getId(), nonElectronicRecord2.getId()}
- };
- }
-
- /**
- *
- * Given an incomplete record
- * When I try to update the records meta-data
- * Then the record is successfully updated
- *
- */
- @Test
- (
- dataProvider = "incompleteRecords",
- description = "Incomplete records can be updated"
- )
- @AlfrescoTest(jira="RM-4362")
- public void incompleteRecordsCanBeUpdated(String recordId)
- {
- // Get the recordsAPI
- RecordsAPI recordsAPI = getRestAPIFactory().getRecordsAPI();
- Record record = recordsAPI.getRecord(recordId);
-
- // Generate update metadata
- String newName = getModifiedPropertyValue(record.getName());
- String newTitle = getModifiedPropertyValue(record.getProperties().getTitle());
- String newDescription = getModifiedPropertyValue(record.getProperties().getDescription());
-
- // Update record
- recordsAPI.updateRecord(createRecordModel(newName, newDescription, newTitle), record.getId());
- assertStatusCode(OK);
-
- // Verify the original record meta data has been retained
- Record updatedRecord = recordsAPI.getRecord(record.getId());
- assertEquals(updatedRecord.getName(), newName);
- assertEquals(updatedRecord.getProperties().getTitle(), newTitle);
- assertEquals(updatedRecord.getProperties().getDescription(), newDescription);
- }
-
- /**
- *
- * Given an incomplete record
- * And that I am a non-admin user with metadata update capabilities
- * When I try to update the records meta-data
- * Then the record is successfully updated
- *
- */
- @Test (description = "User with Edit Metadata capabilities can update incomplete record's metadata")
- @AlfrescoTest(jira="RM-4362")
- public void userWithEditMetadataCapsCanUpdateMetadata()
- {
- // Create random folder
- RecordCategoryChild recFolder = createRecordFolder(rootCategory.getId(), getRandomName("recFolder"));
-
- // Create electronic and non-electronic records in a folder
- RecordFolderAPI recordFolderAPI = getRestAPIFactory().getRecordFolderAPI();
- Record electronicRecord = recordFolderAPI.createRecord(createElectronicRecordModel(), recFolder.getId(), getFile(IMAGE_FILE));
- assertStatusCode(CREATED);
- Record nonElectronicRecord = recordFolderAPI.createRecord(createNonElectronicRecordModel(), recFolder.getId());
- assertStatusCode(CREATED);
-
- // Get recordsAPI instance initialised to updateUser
- RecordsAPI recordsAPI = getRestAPIFactory().getRecordsAPI(updateUser);
-
- for (Record record: asList(electronicRecord, nonElectronicRecord))
- {
- recordsAPI.getRecord(record.getId());
- assertStatusCode(OK);
-
- // Generate update metadata
- String newName = getModifiedPropertyValue(record.getName());
- String newTitle = getModifiedPropertyValue(record.getProperties().getTitle());
- String newDescription = getModifiedPropertyValue(record.getProperties().getDescription());
-
- // Update record
- recordsAPI.updateRecord(createRecordModel(newName, newDescription, newTitle), record.getId());
- assertStatusCode(OK);
-
- // Verify the update got applied
- Record updatedRecord = recordsAPI.getRecord(record.getId());
- assertEquals(updatedRecord.getName(), newName);
- assertEquals(updatedRecord.getProperties().getTitle(), newTitle);
- assertEquals(updatedRecord.getProperties().getDescription(), newDescription);
- assertEquals(updatedRecord.getModifiedByUser().getId(), updateUser.getUsername());
- }
- }
-
- /**
- *
- * Given a complete record
- * When I try to update the records meta-data
- * Then it fails
- * And the records meta-data is unchanged
- *
- */
- @Test
- (
- dataProvider = "completeRecords",
- description = "Complete records can't be updated"
- )
- @AlfrescoTest(jira="RM-4362")
- @Bug (id = "APPS-132")
- public void completeRecordsCantBeUpdated(String electronicRecordId, String nonElectronicRecordId)
- {
- // Get the recordsAPI
- RecordsAPI recordsAPI = getRestAPIFactory().getRecordsAPI();
- Record electronicRecord = recordsAPI.getRecord(electronicRecordId);
- Record nonElectronicRecord = recordsAPI.getRecord(nonElectronicRecordId);
-
- for (Record record: asList(electronicRecord, nonElectronicRecord))
- {
- // Generate update metadata
- String newName = getModifiedPropertyValue(record.getName());
- String newTitle = getModifiedPropertyValue(record.getProperties().getTitle());
- String newDescription = getModifiedPropertyValue(record.getProperties().getDescription());
- Record recordModel = createRecordModel(newName, newDescription, newTitle);
-
- // Update record
- recordsAPI.updateRecord(recordModel, record.getId());
- assertStatusCode(FORBIDDEN);
-
- // Verify the original record meta data has been retained
- Record updatedRecord = recordsAPI.getRecord(record.getId());
- assertEquals(updatedRecord.getName(), record.getName());
- assertEquals(updatedRecord.getProperties().getTitle(), record.getProperties().getTitle());
- assertEquals(updatedRecord.getProperties().getDescription(), record.getProperties().getDescription());
- }
- }
-
- /**
- * Helper method to generate modified property value based on original value
- * @param originalValue original value
- * @return modified value
- */
- private String getModifiedPropertyValue(String originalValue)
- {
- /* to be used to append to modifications */
- String MODIFIED_PREFIX = "modified_";
- return MODIFIED_PREFIX + originalValue;
- }
- /**
- *
- * Given a created record
- * When I try to update the record aspects with an empty list
- * Then it fails
- *
- */
- @Test(description = "Cannot remove mandatory aspects from record")
- @AlfrescoTest(jira = "RM-4926")
- public void electronicRecordMandatoryAspectsCannotBeRemoved()
- {
- final List expectedAspects = asList("rma:record", "rma:filePlanComponent",
- "rma:recordComponentIdentifier", "rma:commonRecordDetails");
- final List emptyAspectList = new ArrayList<>();
- Record recordModelToUpdate = Record.builder().aspectNames(emptyAspectList).build();
- // Get the recordsAPI
- RecordsAPI recordsAPI = getRestAPIFactory().getRecordsAPI();
-
- // Create random folder
- String recordFolderId = createRecordFolder(rootCategory.getId(), getRandomName("recordFolder")).getId();
-
- // Create an electronic record and check it has all the records aspects
- Record electronicRecord = getRestAPIFactory().getRecordFolderAPI()
- .createRecord(createElectronicRecordModel(), recordFolderId, getFile(IMAGE_FILE));
- assertTrue( electronicRecord.getAspectNames().containsAll(expectedAspects));
-
- // Update record
- recordsAPI.updateRecord(recordModelToUpdate, electronicRecord.getId());
- assertStatusCode(UNPROCESSABLE_ENTITY);
-
- // Create an electronic record in the unfiled record folder and check it has all the records aspects
- UnfiledContainerChild unfiledRecordModel = UnfiledContainerChild.builder()
- .properties(UnfiledContainerChildProperties.builder().description(NONELECTRONIC_RECORD_NAME).title("Title").build())
- .name(NONELECTRONIC_RECORD_NAME).nodeType(NON_ELECTRONIC_RECORD_TYPE).build();
- UnfiledContainerChild unfiledRecord = getRestAPIFactory().getUnfiledRecordFoldersAPI()
- .createUnfiledRecordFolderChild(unfiledRecordModel, unfiledRecordFolder.getId());
- assertTrue(unfiledRecord.getAspectNames().containsAll(expectedAspects));
-
- // Update record
- recordsAPI.updateRecord(recordModelToUpdate, unfiledRecord.getId());
- assertStatusCode(UNPROCESSABLE_ENTITY);
- }
-
- @AfterClass (alwaysRun = true)
- public void tearDown()
- {
- deleteRecordCategory(rootCategory.getId());
- getRestAPIFactory().getUnfiledRecordFoldersAPI().deleteUnfiledRecordFolder(unfiledRecordFolder.getId());
- unfiledRecords.forEach(unfiledRecord -> getRestAPIFactory().getRecordsAPI().deleteRecord(unfiledRecord.getId()));
- getDataUser().deleteUser(updateUser);
- }
-}
diff --git a/amps/ags/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/rmroles/RMRolesTests.java b/amps/ags/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/rmroles/RMRolesTests.java
deleted file mode 100644
index b2dec1cd1f..0000000000
--- a/amps/ags/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/rmroles/RMRolesTests.java
+++ /dev/null
@@ -1,112 +0,0 @@
-/*
- * #%L
- * Alfresco Records Management Module
- * %%
- * Copyright (C) 2005 - 2021 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.rmroles;
-
-import static java.util.Collections.singleton;
-
-import static com.google.common.collect.Sets.newHashSet;
-
-import static org.alfresco.rest.rm.community.base.TestData.RM_ROLES;
-import static org.alfresco.rest.rm.community.model.user.UserRoles.ROLE_RM_USER;
-import static org.alfresco.rest.rm.community.util.CommonTestUtils.generateTestPrefix;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
-
-import java.util.Set;
-
-import org.alfresco.rest.rm.community.base.BaseRMRestTest;
-import org.alfresco.rest.rm.community.model.user.UserCapabilities;
-import org.alfresco.rest.v0.RMRolesAndActionsAPI;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.testng.annotations.Test;
-
-/**
- * API tests of RM roles.
- *
- * @author Tom Page
- * @since 2.7
- */
-public class RMRolesTests extends BaseRMRestTest
-{
- /** A list of capabilities. */
- private static final java.util.HashSet CAPABILITIES = newHashSet(UserCapabilities.VIEW_RECORDS_CAP, UserCapabilities.DECLARE_RECORDS_CAP);
- /** The API for managing RM roles and capabilities. */
- @Autowired
- private RMRolesAndActionsAPI rmRolesAndActionsAPI;
-
- /** Check that the roles API returns the default RM roles. */
- @Test(description = "Check the default RM roles exist.")
- public void checkRMRolesExist()
- {
- Set configuredRoles = rmRolesAndActionsAPI
- .getConfiguredRoles(getAdminUser().getUsername(), getAdminUser().getPassword());
- RM_ROLES.forEach(role -> assertTrue("Could not found role " + role, configuredRoles.contains(role)));
- }
-
- /** Check that the RM user has the capability to view and declare records. */
- @Test(description = "Check the capabilities for the RM user.")
- public void checkCapabilitiesForUser()
- {
- Set capabilities = rmRolesAndActionsAPI
- .getCapabilitiesForRole(getAdminUser().getUsername(), getAdminUser().getPassword(), ROLE_RM_USER
- .roleId);
- assertEquals("Unexpected capabilities found for RM User.", capabilities, CAPABILITIES);
- }
-
- /** Check that a new role can be created and retrieved. */
- @Test(description = "Create a new role.")
- public void createNewRole()
- {
- String roleName = generateTestPrefix(RMRolesTests.class) + "newName";
-
- // Call the endpoint under test.
- rmRolesAndActionsAPI.createRole(getAdminUser().getUsername(), getAdminUser().getPassword(), roleName,
- "New Role Label", CAPABILITIES);
-
- Set actualCapabilities = rmRolesAndActionsAPI
- .getCapabilitiesForRole(getAdminUser().getUsername(), getAdminUser().getPassword(), roleName);
- assertEquals("Unexpected capabilities found for RM User.", actualCapabilities, CAPABILITIES);
- }
-
- /** Check that a role can be edited. */
- @Test(description = "Update a role.")
- public void updateRole()
- {
- String roleName = generateTestPrefix(RMRolesTests.class) + "Name";
- rmRolesAndActionsAPI.createRole(getAdminUser().getUsername(), getAdminUser().getPassword(), roleName, "Label",
- singleton(UserCapabilities.VIEW_RECORDS_CAP));
-
- // Call the endpoint under test.
- rmRolesAndActionsAPI.updateRole(getAdminUser().getUsername(), getAdminUser().getPassword(), roleName,
- "Updated Label", singleton(UserCapabilities.DECLARE_RECORDS_CAP));
-
- Set actualCapabilities = rmRolesAndActionsAPI
- .getCapabilitiesForRole(getAdminUser().getUsername(), getAdminUser().getPassword(), roleName);
- assertEquals("Unexpected capabilities for edited RM User.", actualCapabilities, singleton(UserCapabilities.DECLARE_RECORDS_CAP));
- }
-}
diff --git a/amps/ags/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/search/CmisQueryTests.java b/amps/ags/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/search/CmisQueryTests.java
deleted file mode 100644
index cd834c69fe..0000000000
--- a/amps/ags/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/search/CmisQueryTests.java
+++ /dev/null
@@ -1,222 +0,0 @@
-/*
- * #%L
- * Alfresco Records Management Module
- * %%
- * Copyright (C) 2005 - 2021 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.search;
-
-import static org.alfresco.rest.rm.community.model.user.UserRoles.ROLE_RM_MANAGER;
-import static org.alfresco.rest.rm.community.util.CommonTestUtils.generateTestPrefix;
-import static org.alfresco.utility.report.log.Step.STEP;
-import static org.testng.AssertJUnit.assertEquals;
-import static org.testng.AssertJUnit.assertFalse;
-import static org.testng.AssertJUnit.assertTrue;
-
-
-import org.alfresco.dataprep.ContentActions;
-import org.alfresco.rest.rm.community.base.BaseRMRestTest;
-import org.alfresco.rest.rm.community.model.recordcategory.RecordCategoryChild;
-import org.alfresco.rest.rm.community.model.user.UserPermissions;
-import org.alfresco.rest.v0.service.RoleService;
-import org.alfresco.test.AlfrescoTest;
-import org.alfresco.utility.Utility;
-import org.alfresco.utility.constants.UserRole;
-import org.alfresco.utility.model.FileModel;
-import org.alfresco.utility.model.FileType;
-import org.alfresco.utility.model.SiteModel;
-import org.alfresco.utility.model.UserModel;
-import org.apache.chemistry.opencmis.client.api.ItemIterable;
-import org.apache.chemistry.opencmis.client.api.OperationContext;
-import org.apache.chemistry.opencmis.client.api.QueryResult;
-import org.apache.chemistry.opencmis.client.runtime.OperationContextImpl;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.testng.annotations.AfterClass;
-import org.testng.annotations.BeforeClass;
-import org.testng.annotations.Test;
-
-/**
- * Test to check that RM doesn't break CMIS query
- *
- * @author jcule, Rodica Sutu
- * @since 2.5.4
- * @since 3.3
- */
-public class CmisQueryTests extends BaseRMRestTest
-{
- private static final String SEARCH_TERM = generateTestPrefix(CmisQueryTests.class);
- private static final String sqlWithName =
- "SELECT cmis:name FROM cmis:document where CONTAINS('cmis:name:*" + SEARCH_TERM + "*')";
-
- private SiteModel collaborationSite;
- private UserModel nonRMUser, rmUser;
- private RecordCategoryChild recordFolder;
-
- @Autowired
- private ContentActions contentActions;
- @Autowired
- private RoleService roleService;
-
- /**
- * Create some test data:
- *
- * - a collaboration site with documents
- * - in place records
- * - category with folder and records
- * - a user with no rm rights (no rights to see the record from file plan)
- * - a user with rights to see the records and the other documents created
- *
- */
- @BeforeClass (alwaysRun = true)
- public void setupCmisQuery() throws Exception
- {
- STEP("Create a collaboration site");
- collaborationSite = dataSite.usingAdmin().createPrivateRandomSite();
-
- STEP("Create 10 documents ending with SEARCH_TERM");
- for (int i = 0; ++i <= 10; )
- {
- FileModel fileModel = new FileModel(String.format("%s%s%s.%s", "Doc", i, SEARCH_TERM,
- FileType.TEXT_PLAIN.extension));
- dataContent.usingAdmin().usingSite(collaborationSite).createContent(fileModel);
- }
-
- STEP("Create a collaborator user for the collaboration site");
- nonRMUser = getDataUser().createRandomTestUser();
- getDataUser().addUserToSite(nonRMUser, collaborationSite, UserRole.SiteCollaborator);
-
- STEP("Create 10 documents and declare as records");
- for (int i = 0; ++i <= 10; )
- {
- FileModel fileModel = new FileModel(String.format("%s%s%s.%s", "InPlace ", SEARCH_TERM, i,
- FileType.TEXT_PLAIN.extension));
- fileModel = dataContent.usingUser(nonRMUser).usingSite(collaborationSite).createContent(fileModel);
- getRestAPIFactory().getFilesAPI(nonRMUser).declareAsRecord(fileModel.getNodeRefWithoutVersion());
- }
-
- STEP("Create record folder and some records ");
- recordFolder = createCategoryFolderInFilePlan();
- for (int i = 0; ++i <= 10; )
- {
- createElectronicRecord(recordFolder.getId(), String.format("%s%s%s.%s", "Record ", SEARCH_TERM, i,
- FileType.TEXT_PLAIN.extension));
- }
- STEP("Create an rm user with read permission over the category created and contributor role within the " +
- "collaboration site");
- rmUser = roleService.createUserWithSiteRoleRMRoleAndPermission(collaborationSite, UserRole.SiteContributor,
- recordFolder.getParentId(), ROLE_RM_MANAGER, UserPermissions.PERMISSION_READ_RECORDS);
-
- //do a cmis query to wait for solr indexing
- Utility.sleep(5000, 80000, () ->
- {
- ItemIterable results =
- contentActions.getCMISSession(getAdminUser().getUsername(), getAdminUser().getPassword()).query(sqlWithName,
- false);
- assertEquals("Total number of items is not 30, got " + results.getTotalNumItems() + " total items",
- 30, results.getTotalNumItems());
- });
- }
-
- /**
- *
- * Given the RM site created
- * When I execute a cmis query to get all the documents names
- * Then I get all documents names 100 per page
- *
- */
- @Test
- @AlfrescoTest (jira = "MNT-19442")
- public void getAllDocumentsNamesCmisQuery()
- {
- // execute the cmis query
- String cq = "SELECT cmis:name FROM cmis:document";
- ItemIterable results =
- contentActions.getCMISSession(getAdminUser().getUsername(), getAdminUser().getPassword()).query(cq,
- false);
-
- // check the total number of items is greater than 100 and has more items is true
- assertTrue("Has more items not true.", results.getHasMoreItems());
- assertTrue("Total number of items is not greater than 100. Total number of items received" + results.getTotalNumItems(),
- results.getTotalNumItems() > 100);
- assertEquals("Expected 100 items per page and got " + results.getPageNumItems() + " per page.", 100,
- results.getPageNumItems());
- }
-
- /**
- *
- * Given the RM site created
- * When I execute a cmis query to get all the documents names with a particular name
- * Then I get all documents names user has permission
- *
- */
- @Test
- @AlfrescoTest (jira = "MNT-19442")
- public void getDocumentsWithSpecificNamesCmisQuery()
- {
- // execute the cmis query
- ItemIterable results =
- contentActions.getCMISSession(nonRMUser.getUsername(), nonRMUser.getPassword()).query(sqlWithName,
- false);
- assertEquals("Total number of items is not 20, got " + results.getTotalNumItems() + " total items",
- 20, results.getTotalNumItems());
- // check the has more items is false
- assertFalse("Has more items not false.", results.getHasMoreItems());
- assertEquals("Expected 20 items per page and got " + results.getPageNumItems() + " per page.", 20,
- results.getPageNumItems());
- }
-
- /**
- *
- * Given the RM site created
- * When I execute a cmis query to get all the documents names with a specific number per page
- * Then I get all documents names paged as requested that the user has permission
- *
- */
- @Test
- @AlfrescoTest (jira = "MNT-19442")
- public void getDocumentsCmisQueryWithPagination()
- {
- OperationContext oc = new OperationContextImpl();
- oc.setMaxItemsPerPage(10);
- ItemIterable results =
- contentActions.getCMISSession(rmUser.getUsername(), rmUser.getPassword()).query(sqlWithName,
- false, oc);
-
- // check the total number of items and has more items is true
- assertTrue("Has more items not true. ", results.getHasMoreItems());
- assertEquals("Total number of items is not 30, got " + results.getTotalNumItems(), 30,
- results.getTotalNumItems());
- assertEquals("Expected 10 items per page and got " + results.getPageNumItems() + " per page.",
- 10, results.getPageNumItems());
- }
-
- @AfterClass
- private void clearCmisQueryTests()
- {
- dataSite.usingAdmin().deleteSite(collaborationSite);
- deleteRecordCategory(recordFolder.getParentId());
- getDataUser().usingAdmin().deleteUser(rmUser);
- getDataUser().usingAdmin().deleteUser(nonRMUser);
- }
-}
diff --git a/amps/ags/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/search/SearchDocumentsV1Test.java b/amps/ags/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/search/SearchDocumentsV1Test.java
deleted file mode 100644
index 3ea8b5b62f..0000000000
--- a/amps/ags/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/search/SearchDocumentsV1Test.java
+++ /dev/null
@@ -1,190 +0,0 @@
-/*
- * #%L
- * Alfresco Records Management Module
- * %%
- * Copyright (C) 2005 - 2021 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.search;
-
-import static java.util.Arrays.asList;
-
-import static org.alfresco.rest.rm.community.util.CommonTestUtils.generateTestPrefix;
-import static org.alfresco.utility.report.log.Step.STEP;
-import static org.testng.Assert.assertEquals;
-import static org.testng.Assert.assertFalse;
-import static org.testng.Assert.assertTrue;
-
-import org.alfresco.rest.core.search.SearchRequestBuilder;
-import org.alfresco.rest.rm.community.base.BaseRMRestTest;
-import org.alfresco.rest.search.RestRequestQueryModel;
-import org.alfresco.rest.search.SearchResponse;
-import org.alfresco.rest.v0.UserTrashcanAPI;
-import org.alfresco.utility.Utility;
-import org.alfresco.utility.model.FileModel;
-import org.alfresco.utility.model.FileType;
-import org.alfresco.utility.model.SiteModel;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.testng.annotations.AfterClass;
-import org.testng.annotations.BeforeClass;
-import org.testng.annotations.DataProvider;
-import org.testng.annotations.Test;
-
-/**
- * This class contains the tests for v1 Search API with documents with CMIS and AFTS queries
- */
-public class SearchDocumentsV1Test extends BaseRMRestTest
-{
- private static final String SEARCH_TERM = generateTestPrefix(SearchDocumentsV1Test.class);
- private SiteModel collaborationSite;
- private FileModel fileModel;
-
- @Autowired
- private UserTrashcanAPI userTrashcanAPI;
-
- /**
- * Data Provider with: queries using CMIS and AFTS languages
- */
- @DataProvider
- public static Object[][] queryTypes()
- {
- RestRequestQueryModel cmisQueryModel = new RestRequestQueryModel();
- cmisQueryModel.setQuery("select * from cmis:document WHERE cmis:name LIKE '%" + SEARCH_TERM + ".txt'");
- cmisQueryModel.setLanguage("cmis");
-
- RestRequestQueryModel aftsQueryModel = new RestRequestQueryModel();
- aftsQueryModel.setQuery("cm:name:*" + SEARCH_TERM);
- aftsQueryModel.setLanguage("afts");
-
- return new RestRequestQueryModel[][] {
- { cmisQueryModel },
- { aftsQueryModel }
- };
- }
-
- /**
- * Create a collaboration site and some documents.
- */
- @BeforeClass (alwaysRun = true)
- public void setupSearchDocumentsV1Test() throws Exception
- {
- STEP("Create a collaboration site");
- collaborationSite = dataSite.usingAdmin().createPrivateRandomSite();
-
- STEP("Create 10 documents ending with SEARCH_TERM");
- for (int i = 0; ++i <= 10; )
- {
- fileModel = new FileModel(String.format("%s.%s", "Doc" + i + SEARCH_TERM, FileType.TEXT_PLAIN.extension));
- dataContent.usingAdmin().usingSite(collaborationSite).createContent(fileModel);
- }
- waitIndexing();
- }
-
- /**
- * Do the query to wait for solr indexing
- *
- * @throws Exception when maximum retry period is reached
- */
- private void waitIndexing() throws Exception
- {
- RestRequestQueryModel queryType = new RestRequestQueryModel();
- queryType.setQuery("cm:name:*" + SEARCH_TERM);
- queryType.setLanguage("afts");
- Utility.sleep(1000, 80000, () ->
- {
- SearchRequestBuilder sqlRequest = new SearchRequestBuilder().setQueryBuilder(queryType)
- .setPagingBuilder(new SearchRequestBuilder().setPagination(100, 0))
- .setFieldsBuilder(asList("id", "name"));
- SearchResponse searchResponse = getRestAPIFactory().getSearchAPI(null).search(sqlRequest);
- assertEquals(searchResponse.getPagination().getTotalItems().intValue(), 10,
- "Total number of items is not retrieved yet");
- });
- }
-
- /**
- * Given some documents ending with a particular text
- * When executing the search query with paging
- * And setting the skipCount and maxItems to reach the number of total items
- * Then hasMoreItems will be set to false
- */
- @Test(dataProvider = "queryTypes")
- public void searchWhenMaxItemsReach(RestRequestQueryModel queryType)
- {
- final SearchRequestBuilder sqlRequest = new SearchRequestBuilder().setQueryBuilder(queryType)
- .setPagingBuilder(new SearchRequestBuilder().setPagination(5, 5))
- .setFieldsBuilder(asList("id", "name"));
-
- SearchResponse searchResponse = getRestAPIFactory().getSearchAPI().search(sqlRequest);
- assertEquals(searchResponse.getPagination().getCount(), 5, "Expected maxItems to be five");
- assertEquals(searchResponse.getPagination().getSkipCount(), 5, "Expected skip count to be five");
- assertFalse(searchResponse.getPagination().isHasMoreItems(), "Expected hasMoreItems to be false");
- assertEquals(searchResponse.getEntries().size(), 5, "Expected total entries to be five");
- }
-
- /**
- * Given some documents ending with a particular text
- * When executing the search query with paging
- * And setting skipCount and maxItems to exceed the number of total items
- * Then hasMoreItems will be set to false
- */
- @Test(dataProvider = "queryTypes")
- public void searchWhenTotalItemsExceed(RestRequestQueryModel queryType)
- {
- final SearchRequestBuilder sqlRequest = new SearchRequestBuilder().setQueryBuilder(queryType)
- .setPagingBuilder(new SearchRequestBuilder().setPagination(5, 6))
- .setFieldsBuilder(asList("id", "name"));
-
- SearchResponse searchResponse = getRestAPIFactory().getSearchAPI().search(sqlRequest);
- assertEquals(searchResponse.getPagination().getCount(), 4, "Expected maxItems to be four");
- assertEquals(searchResponse.getPagination().getSkipCount(), 6, "Expected skip count to be six");
- assertFalse(searchResponse.getPagination().isHasMoreItems(), "Expected hasMoreItems to be false");
- assertEquals(searchResponse.getEntries().size(), 4, "Expected total entries to be four");
- }
-
- /**
- * Given some documents ending with a particular text
- * When executing the search query with paging
- * And setting skipCount and maxItems under the number of total items
- * Then hasMoreItems will be set to true
- */
- @Test(dataProvider = "queryTypes")
- public void searchResultsUnderTotalItems(RestRequestQueryModel queryType)
- {
- final SearchRequestBuilder sqlRequest = new SearchRequestBuilder().setQueryBuilder(queryType)
- .setPagingBuilder(new SearchRequestBuilder().setPagination(4, 5))
- .setFieldsBuilder(asList("id", "name"));
-
- SearchResponse searchResponse = getRestAPIFactory().getSearchAPI().search(sqlRequest);
- assertEquals(searchResponse.getPagination().getCount(), 4, "Expected maxItems to be four");
- assertEquals(searchResponse.getPagination().getSkipCount(), 5, "Expected skip count to be five");
- assertTrue(searchResponse.getPagination().isHasMoreItems(), "Expected hasMoreItems to be true");
- assertEquals(searchResponse.getEntries().size(), 4, "Expected total entries to be four");
- }
-
- @AfterClass (alwaysRun = true)
- public void tearDown()
- {
- dataSite.usingAdmin().deleteSite(collaborationSite);
- userTrashcanAPI.emptyTrashcan(getAdminUser().getUsername(), getAdminUser().getPassword());
- }
-
-}
diff --git a/amps/ags/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/search/SearchRecordsV1CmisTests.java b/amps/ags/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/search/SearchRecordsV1CmisTests.java
deleted file mode 100644
index 9720b2b847..0000000000
--- a/amps/ags/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/search/SearchRecordsV1CmisTests.java
+++ /dev/null
@@ -1,234 +0,0 @@
-/*
- * #%L
- * Alfresco Records Management Module
- * %%
- * Copyright (C) 2005 - 2021 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.search;
-
-import static java.util.Arrays.asList;
-
-import static org.alfresco.rest.rm.community.model.user.UserRoles.ROLE_RM_MANAGER;
-import static org.alfresco.rest.rm.community.util.CommonTestUtils.generateTestPrefix;
-import static org.alfresco.utility.report.log.Step.STEP;
-import static org.testng.Assert.assertEquals;
-import static org.testng.Assert.assertFalse;
-import static org.testng.Assert.assertTrue;
-
-import org.alfresco.rest.core.search.SearchRequestBuilder;
-import org.alfresco.rest.rm.community.base.BaseRMRestTest;
-import org.alfresco.rest.rm.community.model.recordcategory.RecordCategoryChild;
-import org.alfresco.rest.rm.community.model.user.UserPermissions;
-import org.alfresco.rest.search.RestRequestQueryModel;
-import org.alfresco.rest.search.SearchResponse;
-import org.alfresco.rest.v0.UserTrashcanAPI;
-import org.alfresco.rest.v0.service.RoleService;
-import org.alfresco.utility.Utility;
-import org.alfresco.utility.constants.UserRole;
-import org.alfresco.utility.model.FileModel;
-import org.alfresco.utility.model.FileType;
-import org.alfresco.utility.model.SiteModel;
-import org.alfresco.utility.model.UserModel;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.testng.annotations.AfterClass;
-import org.testng.annotations.BeforeClass;
-import org.testng.annotations.Test;
-
-/**
- * This class contains the tests for v1 Search API with records with CMIS query
- */
-public class SearchRecordsV1CmisTests extends BaseRMRestTest
-{
- private static final String SEARCH_TERM = generateTestPrefix(SearchRecordsV1CmisTests.class);
- private SiteModel collaborationSite;
- private UserModel nonRMUser, rmUser;
- private FileModel fileModel;
- private RestRequestQueryModel queryModel;
-
- @Autowired
- private UserTrashcanAPI userTrashcanAPI;
-
- @Autowired
- private RoleService roleService;
-
- /**
- * Create a collaboration site and some in place records.
- */
- @BeforeClass (alwaysRun = true)
- public void setupSearchRecordsV1Cmis() throws Exception
- {
- STEP("Create a collaboration site");
- collaborationSite = dataSite.usingAdmin().createPrivateRandomSite();
-
- STEP("Create a site manager user for the collaboration site");
- nonRMUser = getDataUser().createRandomTestUser();
- getDataUser().addUserToSite(nonRMUser, collaborationSite, UserRole.SiteManager);
-
- STEP("Create an rm user");
- rmUser = getDataUser().createRandomTestUser();
-
- STEP("Create 10 documents and declare as records");
- for (int i = 0; ++i <= 10; )
- {
- fileModel = new FileModel(String.format("%s.%s", "Record" + SEARCH_TERM + i, FileType.TEXT_PLAIN.extension));
- fileModel = dataContent.usingUser(nonRMUser).usingSite(collaborationSite).createContent(fileModel);
- getRestAPIFactory().getFilesAPI(nonRMUser).declareAsRecord(fileModel.getNodeRefWithoutVersion());
- }
- STEP("Create record folder and some records ");
- RecordCategoryChild recordFolder = createCategoryFolderInFilePlan();
- roleService.assignUserPermissionsOnCategoryAndRMRole(rmUser, recordFolder.getId(),
- UserPermissions.PERMISSION_READ_RECORDS, ROLE_RM_MANAGER.roleId);
- for (int i = 0; ++i <= 10; )
- {
- createElectronicRecord(recordFolder.getId(), "Record" + SEARCH_TERM + i);
- }
-
- queryModel = new RestRequestQueryModel();
- queryModel.setQuery("select * from cmis:document WHERE cmis:name LIKE 'Record" + SEARCH_TERM + "%'");
- queryModel.setLanguage("cmis");
-
- //wait for solr indexing
- Utility.sleep(1000, 80000, () ->
- {
- SearchRequestBuilder sqlRequest = new SearchRequestBuilder().setQueryBuilder(queryModel)
- .setPagingBuilder(new SearchRequestBuilder().setPagination(100, 0))
- .setFieldsBuilder(asList("id", "name"));
- SearchResponse searchResponse = getRestAPIFactory().getSearchAPI(null).search(sqlRequest);
- assertEquals(searchResponse.getPagination().getTotalItems().intValue(), 20,
- "Total number of items is not retrieved yet");
- });
- }
-
- /**
- * Given some documents with names starting with a particular test
- * When executing the search query with paging
- * And setting the skipCount and maxItems to reach the number of total items
- * Then hasMoreItems will be set to false
- */
- @Test
- public void searchWhenTotalItemsReach()
- {
- final SearchRequestBuilder sqlRequest = new SearchRequestBuilder().setQueryBuilder(queryModel)
- .setPagingBuilder(new SearchRequestBuilder().setPagination(5, 15))
- .setFieldsBuilder(asList("id", "name"));
-
- SearchResponse searchResponse = getRestAPIFactory().getSearchAPI(rmUser).search(sqlRequest);
- assertEquals(searchResponse.getPagination().getCount(), 5, "Expected maxItems to be five");
- assertEquals(searchResponse.getPagination().getSkipCount(), 15, "Expected skip count to be fifteen");
- assertFalse(searchResponse.getPagination().isHasMoreItems(), "Expected hasMoreItems to be false");
- assertEquals(searchResponse.getEntries().size(), 5, "Expected total entries to be five");
- }
-
- // TODO enable the test when APPS-46 is fixed
- @Test (enabled = false)
- public void searchWhenTotalItemsReachWithNonRM()
- {
- final SearchRequestBuilder sqlRequest = new SearchRequestBuilder().setQueryBuilder(queryModel)
- .setPagingBuilder(new SearchRequestBuilder().setPagination(5, 0))
- .setFieldsBuilder(asList("id", "name"));
-
- SearchResponse searchResponse = getRestAPIFactory().getSearchAPI(nonRMUser).search(sqlRequest);
- assertEquals(searchResponse.getPagination().getCount(), 5, "Expected maxItems to be five");
- assertEquals(searchResponse.getPagination().getSkipCount(), 5, "Expected skip count to be five");
- assertFalse(searchResponse.getPagination().isHasMoreItems(), "Expected hasMoreItems to be false");
- assertEquals(searchResponse.getEntries().size(), 5, "Expected total entries to be five");
- }
-
- /**
- * Given some documents with names starting with a particular text
- * When executing the search query with paging
- * And setting skipCount and maxItems to exceed the number of total items
- * Then hasMoreItems will be set to false
- */
- @Test
- public void searchWhenTotalItemsExceedRMUser()
- {
- final SearchRequestBuilder sqlRequest = new SearchRequestBuilder().setQueryBuilder(queryModel)
- .setPagingBuilder(new SearchRequestBuilder().setPagination(5, 16))
- .setFieldsBuilder(asList("id", "name"));
-
- SearchResponse searchResponse = getRestAPIFactory().getSearchAPI(rmUser).search(sqlRequest);
- assertEquals(searchResponse.getPagination().getCount(), 4, "Expected maxItems to be four");
- assertEquals(searchResponse.getPagination().getSkipCount(), 16, "Expected skip count to be sixteen");
- assertFalse(searchResponse.getPagination().isHasMoreItems(), "Expected hasMoreItems to be false");
- assertEquals(searchResponse.getEntries().size(), 4, "Expected total entries to be four");
- }
-
- // TODO enable the test when APPS-46 is fixed
- @Test (enabled = false)
- public void searchWhenTotalItemsExceedNonRMUser()
- {
- final SearchRequestBuilder sqlRequest = new SearchRequestBuilder().setQueryBuilder(queryModel)
- .setPagingBuilder(new SearchRequestBuilder().setPagination(5, 6))
- .setFieldsBuilder(asList("id", "name"));
-
- SearchResponse searchResponse = getRestAPIFactory().getSearchAPI(nonRMUser).search(sqlRequest);
- assertEquals(searchResponse.getPagination().getCount(), 4, "Expected maxItems to be four");
- assertEquals(searchResponse.getPagination().getSkipCount(), 6, "Expected skip count to be six");
- assertFalse(searchResponse.getPagination().isHasMoreItems(), "Expected hasMoreItems to be false");
- assertEquals(searchResponse.getEntries().size(), 4, "Expected total entries to be four");
- }
-
- /**
- * Given some documents ending with a particular text
- * When executing the search query with paging
- * And setting skipCount and maxItems under the number of total items
- * Then hasMoreItems will be set to true
- */
- // TODO enable the test when APPS-46 is fixed
- @Test (enabled = false)
- public void searchResultsUnderTotalItemsRMUser()
- {
- final SearchRequestBuilder sqlRequest = new SearchRequestBuilder().setQueryBuilder(queryModel)
- .setPagingBuilder(new SearchRequestBuilder().setPagination(4, 15))
- .setFieldsBuilder(asList("id", "name"));
-
- SearchResponse searchResponse = getRestAPIFactory().getSearchAPI(rmUser).search(sqlRequest);
- assertEquals(searchResponse.getPagination().getCount(), 4, "Expected maxItems to be four");
- assertEquals(searchResponse.getPagination().getSkipCount(), 15, "Expected skip count to be fifteen");
- assertTrue(searchResponse.getPagination().isHasMoreItems(), "Expected hasMoreItems to be true");
- assertEquals(searchResponse.getEntries().size(), 4, "Expected total entries to be four");
- }
-
- // TODO enable the test when APPS-46 is fixed
- @Test (enabled = false)
- public void searchResultsUnderTotalItemsNonRMUser()
- {
- final SearchRequestBuilder sqlRequest = new SearchRequestBuilder().setQueryBuilder(queryModel)
- .setPagingBuilder(new SearchRequestBuilder().setPagination(4, 5))
- .setFieldsBuilder(asList("id", "name"));
-
- SearchResponse searchResponse = getRestAPIFactory().getSearchAPI(nonRMUser).search(sqlRequest);
- assertEquals(searchResponse.getPagination().getCount(), 4, "Expected maxItems to be four");
- assertEquals(searchResponse.getPagination().getSkipCount(), 5, "Expected skip count to be five");
- assertTrue(searchResponse.getPagination().isHasMoreItems(), "Expected hasMoreItems to be true");
- assertEquals(searchResponse.getEntries().size(), 4, "Expected total entries to be four");
- }
-
- @AfterClass (alwaysRun = true)
- public void tearDown()
- {
- dataSite.usingAdmin().deleteSite(collaborationSite);
- userTrashcanAPI.emptyTrashcan(getAdminUser().getUsername(), getAdminUser().getPassword());
- }
-}
diff --git a/amps/ags/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/search/ShareLiveSearchTests.java b/amps/ags/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/search/ShareLiveSearchTests.java
deleted file mode 100644
index 11ac02e5d0..0000000000
--- a/amps/ags/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/search/ShareLiveSearchTests.java
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- * #%L
- * Alfresco Records Management Module
- * %%
- * Copyright (C) 2005 - 2021 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.search;
-
-import static org.testng.Assert.assertTrue;
-
-import java.util.Arrays;
-import java.util.List;
-
-import org.alfresco.rest.rm.community.base.BaseRMRestTest;
-import org.alfresco.rest.v0.SearchAPI;
-import org.alfresco.test.AlfrescoTest;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.testng.annotations.Test;
-
-public class ShareLiveSearchTests extends BaseRMRestTest
-{
- @Autowired
- SearchAPI searchApi;
-
- /**
- * Given the RM site has been created When I search for "vital" Then the "Vital Records Due for Review" search
- * object should not appear as a link in the quick search results drop down
- */
- @Test
- @AlfrescoTest(jira = "RM-5882")
- public void liveSearchForVitalWord()
- {
- List results = searchApi.liveSearchForDocumentsAsUser(getAdminUser().getUsername(), getAdminUser().getPassword(), "vital");
- assertTrue(results.isEmpty() || results.stream().noneMatch("Vital Records due for Review"::equalsIgnoreCase),
- "Share Live Search should return 0 results when searching for RM Saved Search filter words, but it returned:"
- + Arrays.toString(results.toArray()));
- }
-}
diff --git a/amps/ags/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/site/RMSiteTests.java b/amps/ags/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/site/RMSiteTests.java
deleted file mode 100644
index 31df16ce36..0000000000
--- a/amps/ags/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/site/RMSiteTests.java
+++ /dev/null
@@ -1,272 +0,0 @@
-/*
- * #%L
- * Alfresco Records Management Module
- * %%
- * Copyright (C) 2005 - 2021 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.site;
-
-import static org.alfresco.rest.rm.community.base.TestData.ANOTHER_ADMIN;
-import static org.alfresco.rest.rm.community.base.TestData.DEFAULT_PASSWORD;
-import static org.alfresco.rest.rm.community.model.site.RMSiteCompliance.DOD5015;
-import static org.alfresco.rest.rm.community.model.site.RMSiteCompliance.STANDARD;
-import static org.alfresco.rest.rm.community.utils.RMSiteUtil.RM_DESCRIPTION;
-import static org.alfresco.rest.rm.community.utils.RMSiteUtil.RM_ID;
-import static org.alfresco.rest.rm.community.utils.RMSiteUtil.RM_TITLE;
-import static org.alfresco.rest.rm.community.utils.RMSiteUtil.createDOD5015RMSiteModel;
-import static org.alfresco.rest.rm.community.utils.RMSiteUtil.createRMSiteModel;
-import static org.alfresco.rest.rm.community.utils.RMSiteUtil.createStandardRMSiteModel;
-import static org.alfresco.utility.constants.UserRole.SiteManager;
-import static org.springframework.http.HttpStatus.BAD_REQUEST;
-import static org.springframework.http.HttpStatus.CONFLICT;
-import static org.springframework.http.HttpStatus.CREATED;
-import static org.springframework.http.HttpStatus.FORBIDDEN;
-import static org.springframework.http.HttpStatus.NOT_FOUND;
-import static org.springframework.http.HttpStatus.NO_CONTENT;
-import static org.springframework.http.HttpStatus.OK;
-import static org.testng.Assert.assertEquals;
-import static org.testng.Assert.assertNotNull;
-
-import org.alfresco.dataprep.SiteService.Visibility;
-import org.alfresco.rest.rm.community.base.BaseRMRestTest;
-import org.alfresco.rest.rm.community.base.TestData;
-import org.alfresco.rest.rm.community.model.site.RMSite;
-import org.alfresco.rest.rm.community.requests.gscore.api.RMSiteAPI;
-import org.alfresco.utility.data.RandomData;
-import org.alfresco.utility.model.UserModel;
-import org.alfresco.utility.report.Bug;
-import org.testng.annotations.Test;
-
-/**
- * This class contains the tests for
- * the RM site CRUD API
- *
- * @author Rodica Sutu
- * @since 2.6
- */
-public class RMSiteTests extends BaseRMRestTest
-{
- /**
- * Given that RM module is installed
- * When I want to create the RM site with specific title, description and compliance
- * Then the RM site is created
- */
- @Test (description = "Create RM site with Standard Compliance as admin user", priority = 2)
- // Run after createRMSiteAsAnotherAdminUser. In this way the Dod site is deleted and standard site is created for the rest of the tests
- public void createRMSiteAsAdminUser()
- {
- RMSiteAPI rmSiteAPI = getRestAPIFactory().getRMSiteAPI();
-
- // Check if the RM site exists
- if (rmSiteAPI.existsRMSite())
- {
- // Delete the RM site
- rmSiteAPI.deleteRMSite();
- }
-
- // Create the RM site
- RMSite rmSiteResponse = rmSiteAPI.createRMSite(createStandardRMSiteModel());
-
- // Verify the status code
- assertStatusCode(CREATED);
-
- // Verify the returned file plan component
- assertEquals(rmSiteResponse.getId(), RM_ID);
- assertEquals(rmSiteResponse.getTitle(), RM_TITLE);
- assertEquals(rmSiteResponse.getDescription(), RM_DESCRIPTION);
- assertEquals(rmSiteResponse.getCompliance(), STANDARD);
- assertEquals(rmSiteResponse.getVisibility(), Visibility.PUBLIC);
- assertEquals(rmSiteResponse.getRole(), SiteManager.toString());
- }
-
- /**
- * Given that RM site exists
- * When I want to create the RM site
- * Then the response code 409 (Site with the given identifier already exists) is return
- */
- @Test (description = "Create RM site when site already exist with admin user", priority = 3)
- // Run test after the other tests with priority 0, 1 or 2
- public void createRMSiteWhenSiteExists()
- {
- // Create the RM site if it does not exist
- createRMSiteIfNotExists();
-
- // Construct new properties
- String newTitle = RM_TITLE + "createRMSiteWhenSiteExists";
- String newDescription = RM_DESCRIPTION + "createRMSiteWhenSiteExists";
-
- // Create the RM site
- RMSite rmSiteModel = createRMSiteModel(STANDARD, newTitle, newDescription);
- getRestAPIFactory().getRMSiteAPI().createRMSite(rmSiteModel);
-
- // Verify the status code
- assertStatusCode(CONFLICT);
- }
-
- /**
- * Given that RM site exists
- * When I want to delete the RM site
- * Then RM site is successfully deleted
- */
- @Test (description = "Delete RM site as admin user")
- public void deleteRMSite()
- {
- // Create the RM site if it does not exist
- createRMSiteIfNotExists();
-
- // Delete the RM site
- getRestAPIFactory().getRMSiteAPI().deleteRMSite();
-
- // Verify the status code
- assertStatusCode(NO_CONTENT);
- }
-
- /**
- * Given that RM site exists
- * When I GET the retrieve the RM site details
- * Then RM site details are returned
- */
- @Test (description = "GET the RM site as admin user", priority = 3)
- // Run test after the tests with priority 0, 1 or 2
- public void getRMSite()
- {
- RMSiteAPI rmSiteAPI = getRestAPIFactory().getRMSiteAPI();
-
- // Check if RM site exists
- if (!rmSiteAPI.existsRMSite())
- {
- // Verify the status code when RM site doesn't exist
- assertStatusCode(NOT_FOUND);
- createRMSiteIfNotExists();
- }
- else
- {
- // Get the RM site
- RMSite rmSiteModel = rmSiteAPI.getSite();
-
- // Verify the status code
- assertStatusCode(OK);
- assertEquals(rmSiteModel.getId(), RM_ID);
- assertEquals(rmSiteModel.getDescription(), RM_DESCRIPTION);
- assertEquals(rmSiteModel.getCompliance(), STANDARD);
- assertEquals(rmSiteModel.getVisibility(), Visibility.PUBLIC);
- }
- }
-
- /**
- * Given that an user is created and RM site doesn't exist
- * When the user wants to create a RM site with DOD compliance
- * Then RM site is created
- */
- // Run test after deleteRMSite. In this way rmSiteAPI.deleteRMSite isn't called because site is already deleted
- @Test (description = "Create RM site with DOD compliance as an another admin user", priority = 1)
- @Bug (id="RM-4289")
- public void createRMSiteAsAnotherAdminUser()
- {
- RMSiteAPI rmSiteAPI = getRestAPIFactory().getRMSiteAPI();
-
- // Check if the RM site exists
- if (rmSiteAPI.existsRMSite())
- {
- // Delete the RM site
- rmSiteAPI.deleteRMSite();
- }
-
- // Create user
- getRestAPIFactory().getRMUserAPI().createUser(ANOTHER_ADMIN, TestData.DEFAULT_PASSWORD, TestData.DEFAULT_EMAIL);
-
- // Create the RM site
- RMSite rmSiteModel = getRestAPIFactory().getRMSiteAPI(new UserModel(ANOTHER_ADMIN, DEFAULT_PASSWORD)).createRMSite(createDOD5015RMSiteModel());
-
- // Verify the status code
- assertStatusCode(CREATED);
-
- // Verify the returned file plan component
- assertEquals(rmSiteModel.getId(), RM_ID);
- assertEquals(rmSiteModel.getTitle(), RM_TITLE);
- assertEquals(rmSiteModel.getDescription(), RM_DESCRIPTION);
- assertEquals(rmSiteModel.getCompliance(), DOD5015);
- assertEquals(rmSiteModel.getVisibility(), Visibility.PUBLIC);
- assertEquals(rmSiteModel.getRole(), SiteManager.toString());
- }
-
- /**
- * Given that RM site exist
- * When a non-RM user wants to update the RM site details (title or description)
- * Then 403 response status code is return
- * When the admin user wants to update the RM site details (title or description)
- * Then RM site details are updated
- */
- @Test(priority = 3) // Run test after the other tests with priority 0, 1 or 2
- public void updateRMSiteDetails()
- {
- String NEW_TITLE = RM_TITLE + RandomData.getRandomAlphanumeric();
- String NEW_DESCRIPTION = RM_DESCRIPTION + RandomData.getRandomAlphanumeric();
-
- // Create the site if it does not exist
- createRMSiteIfNotExists();
-
- // Create RM site model
- RMSite rmSiteToUpdate = RMSite.builder().title(NEW_TITLE).description(NEW_DESCRIPTION).build();
-
- // Create the RM site
- getRestAPIFactory().getRMSiteAPI(getDataUser().createRandomTestUser("testUser")).updateRMSite(rmSiteToUpdate);
-
- // Verify the status code
- assertStatusCode(FORBIDDEN);
-
- // Update the RM Site
- RMSite rmSiteModel = getRestAPIFactory().getRMSiteAPI().updateRMSite(rmSiteToUpdate);
-
- // Verify the response status code
- assertStatusCode(OK);
-
- // Verify the returned file plan component
- assertEquals(rmSiteModel.getId(), RM_ID);
- assertEquals(rmSiteModel.getTitle(), NEW_TITLE);
- assertEquals(rmSiteModel.getDescription(), NEW_DESCRIPTION);
- assertNotNull(rmSiteModel.getCompliance());
- assertEquals(rmSiteModel.getVisibility(), Visibility.PUBLIC);
- }
-
- /**
- * Given that RM site exist
- * When the admin user wants to update the RM site compliance
- * Then RM site compliance is not updated
- */
- @Test(priority = 3) // Run test after the other tests with priority 0, 1 or 2
- public void updateRMSiteComplianceAsAdmin()
- {
- // Create the RM site if it does not exist
- createRMSiteIfNotExists();
-
- // Build the RM site properties
- RMSite rmSiteToUpdate = RMSite.builder().compliance(DOD5015).build();
-
- // Update the RM site
- getRestAPIFactory().getRMSiteAPI().updateRMSite(rmSiteToUpdate);
-
- // Verify the response status code
- assertStatusCode(BAD_REQUEST);
- }
-}
diff --git a/amps/ags/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/unfiledcontainers/UnfiledContainerTests.java b/amps/ags/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/unfiledcontainers/UnfiledContainerTests.java
deleted file mode 100644
index db983f4b04..0000000000
--- a/amps/ags/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/unfiledcontainers/UnfiledContainerTests.java
+++ /dev/null
@@ -1,477 +0,0 @@
-/*
- * #%L
- * Alfresco Records Management Module
- * %%
- * Copyright (C) 2005 - 2021 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.unfiledcontainers;
-
-import static java.time.LocalDateTime.now;
-
-import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentAlias.FILE_PLAN_ALIAS;
-import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentAlias.UNFILED_RECORDS_CONTAINER_ALIAS;
-import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentType.CONTENT_TYPE;
-import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentType.FOLDER_TYPE;
-import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentType.NON_ELECTRONIC_RECORD_TYPE;
-import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentType.UNFILED_CONTAINER_TYPE;
-import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentType.UNFILED_RECORD_FOLDER_TYPE;
-import static org.alfresco.rest.rm.community.utils.FilePlanComponentsUtil.createUnfiledContainerChildModel;
-import static org.alfresco.utility.data.RandomData.getRandomAlphanumeric;
-import static org.alfresco.utility.data.RandomData.getRandomName;
-import static org.springframework.http.HttpStatus.BAD_REQUEST;
-import static org.springframework.http.HttpStatus.CONFLICT;
-import static org.springframework.http.HttpStatus.CREATED;
-import static org.springframework.http.HttpStatus.OK;
-import static org.springframework.http.HttpStatus.UNPROCESSABLE_ENTITY;
-import static org.testng.Assert.assertEquals;
-import static org.testng.Assert.assertFalse;
-import static org.testng.Assert.assertNotEquals;
-import static org.testng.Assert.assertNotNull;
-import static org.testng.Assert.assertTrue;
-
-import java.util.ArrayList;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.NoSuchElementException;
-
-import org.alfresco.rest.rm.community.base.BaseRMRestTest;
-import org.alfresco.rest.rm.community.base.DataProviderClass;
-import org.alfresco.rest.rm.community.model.fileplan.FilePlan;
-import org.alfresco.rest.rm.community.model.unfiledcontainer.UnfiledContainer;
-import org.alfresco.rest.rm.community.model.unfiledcontainer.UnfiledContainerChild;
-import org.alfresco.rest.rm.community.model.unfiledcontainer.UnfiledContainerChildCollection;
-import org.alfresco.rest.rm.community.model.unfiledcontainer.UnfiledContainerChildProperties;
-import org.alfresco.rest.rm.community.model.unfiledcontainer.UnfiledRecordFolder;
-import org.alfresco.rest.rm.community.utils.FilePlanComponentsUtil;
-import org.alfresco.utility.report.Bug;
-import org.springframework.http.HttpStatus;
-import org.testng.annotations.AfterClass;
-import org.testng.annotations.DataProvider;
-import org.testng.annotations.Test;
-
-/**
- * Unfiled container related API tests
- *
- * @author Ana Bozianu
- * @since 2.6
- */
-public class UnfiledContainerTests extends BaseRMRestTest
-{
- /** Number of children (for children creation test) */
- private static final int NUMBER_OF_CHILDREN = 10;
- private final List unfiledChildren = new ArrayList<>();
-
- /**
- * Data Provider with:
- * with the object types for creating a Unfiled Record Folder
- *
- * @return file plan component alias
- */
- @DataProvider (name = "unfiledFolderTypes")
- public static Object[][] unfiledFolderTypes()
- {
- return new String[][] {
- { UNFILED_RECORD_FOLDER_TYPE },
- { FOLDER_TYPE }
- };
- }
-
-
- /**
- *
- * Given the RM site exists
- * When I retrieve the unfiled record conteiner by placeholder
- * Then the details of the unfiled record container is returned
- *
- */
- @Test
- (
- description = "Get the unfiled records container"
- )
- public void getUnfiledRecordsContainer()
- {
- // Get the unfiled records container
- UnfiledContainer container = getRestAPIFactory().getUnfiledContainersAPI().getUnfiledContainer(UNFILED_RECORDS_CONTAINER_ALIAS);
-
- // Check the response code
- assertStatusCode(OK);
-
- // Check the response contains the right node type
- assertEquals(container.getNodeType(), UNFILED_CONTAINER_TYPE);
- }
-
- /**
- *
- * Given that an unfiled container exists
- * When I ask the API to update the details of the unfiled container
- * Then the details of the unfiled container are updated
- *
- */
- @Test
- (
- description = "Rename unfiled container"
- )
- public void renameUnfiledContainer()
- {
- String newContainerName = "RenamedUnfiledContainer (" + getRandomAlphanumeric() + ")";
-
- // Build the properties which will be updated
- UnfiledContainer unfiledContainerUpdate = UnfiledContainer.builder().name(newContainerName).build();
-
- // Update the unfiled records container
- UnfiledContainer renamedUnfiledContainer = getRestAPIFactory().getUnfiledContainersAPI().updateUnfiledContainer(unfiledContainerUpdate, UNFILED_RECORDS_CONTAINER_ALIAS);
-
- // Verify the status code
- assertStatusCode(OK);
-
- // Verify the returned unfiled records container
- assertEquals(renamedUnfiledContainer.getName(), newContainerName);
-
- // Get actual FILE_PLAN_ALIAS id
- FilePlan filePlan = getRestAPIFactory().getFilePlansAPI().getFilePlan(FILE_PLAN_ALIAS);
-
- // verify renamed component still has this parent
- assertEquals(renamedUnfiledContainer.getParentId(), filePlan.getId());
- }
-
- /**
- *
- * Given that an unfiled records container exists
- * When I ask the API to create a child unfiled record folder
- * Then it is created within the unfiled records container
- *
- */
- @Test
- (
- description = "Create unfiled record folder child in unfiled root container",
- dataProvider = "unfiledFolderTypes"
- )
- public void createUnfiledRecordFolderChild(String folderType)
- {
- String unfiledRecordFolderName = "UnfiledRecordFolder-" + getRandomAlphanumeric();
- UnfiledContainerChild unfiledRecordFolderChild = createUnfiledContainerChild(UNFILED_RECORDS_CONTAINER_ALIAS, unfiledRecordFolderName, folderType);
- unfiledChildren.add(unfiledRecordFolderChild);
-
- assertNotNull(unfiledRecordFolderChild.getId());
-
- // Verify the returned file plan component
- assertFalse(unfiledRecordFolderChild.getIsRecord());
- assertTrue(unfiledRecordFolderChild.getIsUnfiledRecordFolder()); // it is not a _normal_ record folder!
-
- assertEquals(unfiledRecordFolderChild.getName(), unfiledRecordFolderName);
- assertEquals(unfiledRecordFolderChild.getNodeType(), UNFILED_RECORD_FOLDER_TYPE);
-
- assertEquals(unfiledRecordFolderChild.getCreatedByUser().getId(), getAdminUser().getUsername());
-
- UnfiledRecordFolder unfiledRecordFolder = getRestAPIFactory().getUnfiledRecordFoldersAPI().getUnfiledRecordFolder(unfiledRecordFolderChild.getId());
- // Verify the returned file plan component properties
- UnfiledContainerChildProperties unfiledRecordFolderChildProperties = unfiledRecordFolder.getProperties();
- assertEquals(unfiledRecordFolderChildProperties.getTitle(), FilePlanComponentsUtil.TITLE_PREFIX + unfiledRecordFolderName);
- assertNotNull(unfiledRecordFolderChildProperties.getIdentifier());
- assertEquals(unfiledRecordFolder.getParentId(),
- getRestAPIFactory().getUnfiledContainersAPI().getUnfiledContainer(UNFILED_RECORDS_CONTAINER_ALIAS).getId());
- }
-
- @Test
- ( description = "Create duplicate unfiled folder child",
- dataProvider = "unfiledFolderTypes"
- )
- @Bug(id ="RM-5116, RM-5148")
- public void createDuplicateUnfiledFolderChild(String folderType)
- {
- String unfiledRecordFolderName = "UnfiledRecordFolder-" + getRandomAlphanumeric();
- UnfiledContainerChild unfiledRecordFolderChild = createUnfiledContainerChild(UNFILED_RECORDS_CONTAINER_ALIAS,
- unfiledRecordFolderName, folderType);
-
- // Verify the status code
- assertStatusCode(CREATED);
- unfiledChildren.add(unfiledRecordFolderChild);
- assertEquals(unfiledRecordFolderChild.getName(), unfiledRecordFolderName);
-
- // create the same unfiled folder
- UnfiledContainerChild unfiledRecordFolderDuplicate = getRestAPIFactory().getUnfiledContainersAPI()
- .createUnfiledContainerChild(createUnfiledContainerChildModel(unfiledRecordFolderName, folderType),
- UNFILED_RECORDS_CONTAINER_ALIAS);
-
- // Verify the status code
- assertStatusCode(CONFLICT);
-
- // create the same unfiled folder with the autoRename parameter on true
- unfiledRecordFolderDuplicate = getRestAPIFactory().getUnfiledContainersAPI()
- .createUnfiledContainerChild(createUnfiledContainerChildModel(unfiledRecordFolderName, folderType),
- UNFILED_RECORDS_CONTAINER_ALIAS, "autoRename=true");
-
- //verify the response status code
- assertStatusCode(CREATED);
- unfiledChildren.add(unfiledRecordFolderDuplicate);
- assertNotEquals(unfiledRecordFolderDuplicate.getName(), unfiledRecordFolderName);
- assertTrue(unfiledRecordFolderDuplicate.getName().startsWith(unfiledRecordFolderName));
- }
-
- /**
- *
- * Given that an unfiled records container exists
- * When I ask the API to create a child unfiled record folder with relative path
- * Then it is not supported
- *
- */
- @Test
- (
- description = "Create unfiled record folder child in unfiled root container"
- )
- public void createUnfiledRecordFolderChildWithRelativePathNotSuported()
- {
- // relativePath specify the container structure to create relative to
- // the record folder to be created
- String relativePath = now().getYear() + "/" + now().getMonth() + "/" + now().getDayOfMonth();
- UnfiledContainerChild unfiledFolderModel = UnfiledContainerChild.builder()
- .name(getRandomName("UnfiledRecordFolder"))
- .nodeType(UNFILED_RECORD_FOLDER_TYPE)
- .relativePath(relativePath)
- .build();
- getRestAPIFactory().getUnfiledContainersAPI()
- .createUnfiledContainerChild(unfiledFolderModel, UNFILED_RECORDS_CONTAINER_ALIAS);
-
- // Check the API response code
- assertStatusCode(BAD_REQUEST);
- }
-
- /**
- *
- * Given that an unfiled records container exists
- * When I ask the API to create a child record
- * Then it is created within the unfiled records container
- *
- */
- @Test
- (
- description = "Create non-electronic record child in unfiled root container"
- )
- public void createNonElectronicRecordChild()
- {
- String recordName = "NERecord-" + getRandomAlphanumeric();
- UnfiledContainerChild unfiledRecord = createUnfiledContainerChild(UNFILED_RECORDS_CONTAINER_ALIAS, recordName, NON_ELECTRONIC_RECORD_TYPE);
- unfiledChildren.add(unfiledRecord);
-
- assertNotNull(unfiledRecord.getId());
- assertTrue(unfiledRecord.getIsRecord());
- assertEquals(unfiledRecord.getNodeType(), NON_ELECTRONIC_RECORD_TYPE);
- // check it was created in the unfiled root container
- UnfiledContainer container = getRestAPIFactory().getUnfiledContainersAPI().getUnfiledContainer(UNFILED_RECORDS_CONTAINER_ALIAS);
- assertEquals(unfiledRecord.getParentId(), container.getId());
- // check the name contains the identifier
- String identifier = unfiledRecord.getProperties().getIdentifier();
- assertNotNull(identifier);
- assertEquals(unfiledRecord.getName(), recordName + " (" + identifier + ")");
- }
-
- /**
- *
- * Given that an unfiled records container exists
- * When I ask the API to create a child record
- * Then it is created within the unfiled records container
- *
- */
- @Test
- (
- description = "Create electronic record child in unfiled root container"
- )
- public void createElectronicRecordChild()
- {
- String recordName = "ERecord-" + getRandomAlphanumeric();
- UnfiledContainerChild unfiledRecord = createUnfiledContainerChild(UNFILED_RECORDS_CONTAINER_ALIAS, recordName, CONTENT_TYPE);
- unfiledChildren.add(unfiledRecord);
-
- assertNotNull(unfiledRecord.getId());
- assertTrue(unfiledRecord.getIsRecord());
- assertEquals(unfiledRecord.getNodeType(), CONTENT_TYPE);
- // check it was created in the unfiled root container
- UnfiledContainer container = getRestAPIFactory().getUnfiledContainersAPI().getUnfiledContainer(UNFILED_RECORDS_CONTAINER_ALIAS);
- assertEquals(unfiledRecord.getParentId(), container.getId());
- // check the name contains the identifier
- String identifier = unfiledRecord.getProperties().getIdentifier();
- assertNotNull(identifier);
- assertEquals(unfiledRecord.getName(), recordName + " (" + identifier + ")");
- }
-
- /**
- *
- * Given the RM site is created
- * And contains a number of records and unfiled record folders
- * When I ask the API to get me the children of the unfiled root container
- * Then I am returned the contained record and unfiled record folders
- *
- */
- @Test
- (
- description = "Get children of the root unfiled root container"
- )
- public void getUnfiledRootContainerChildren()
- {
- // Add unfiled root container children
- List createdChildren = new LinkedList<>();
- for (int i = 0; i < NUMBER_OF_CHILDREN; i++)
- {
- String childType;
- if (i % 3 == 0)
- {
- childType = CONTENT_TYPE;
- }
- else if (i % 3 == 1)
- {
- childType = NON_ELECTRONIC_RECORD_TYPE;
- }
- else
- {
- childType = UNFILED_RECORD_FOLDER_TYPE;
- }
- UnfiledContainerChild child = createUnfiledContainerChild(UNFILED_RECORDS_CONTAINER_ALIAS, getRandomAlphanumeric(), childType);
- assertNotNull(child.getId());
- createdChildren.add(child);
- }
-
- // Get children from API
- UnfiledContainerChildCollection listedChildren = getRestAPIFactory().getUnfiledContainersAPI().getUnfiledContainerChildren(UNFILED_RECORDS_CONTAINER_ALIAS,"include=properties");
-
- // Check status code
- assertStatusCode(OK);
-
- // Check listed children contains created list
- UnfiledContainer unfiledContainer = getRestAPIFactory().getUnfiledContainersAPI().getUnfiledContainer(UNFILED_RECORDS_CONTAINER_ALIAS);
- List verifiedChildren = new LinkedList<>();
- listedChildren.getEntries().forEach(c ->
- {
- UnfiledContainerChild containerChild = c.getEntry();
- String childId = containerChild.getId();
-
- assertNotNull(childId);
- logger.info("Checking child " + childId);
-
- try
- {
- // Get the element from the created children list
- UnfiledContainerChild createdComponent = createdChildren.stream()
- .filter(child -> child.getId().equals(childId))
- .findFirst().orElseThrow();
-
- // Created by
- assertEquals(containerChild.getCreatedByUser().getId(), getAdminUser().getUsername());
-
- // Is parent id set correctly?
- assertEquals(containerChild.getParentId(), unfiledContainer.getId());
-
- // Boolean properties related to node type
- if (containerChild.getNodeType().equals(UNFILED_RECORD_FOLDER_TYPE))
- {
- assertFalse(containerChild.getIsRecord());
- }
- else
- {
- assertTrue(containerChild.getIsRecord());
- assertTrue(containerChild.getName().contains(containerChild.getProperties().getIdentifier()),
- "Records don't have in name the identifier");
- }
-
- // Does returned object have the same contents as the created one?
- assertEquals(createdComponent.getName(), containerChild.getName());
- assertEquals(createdComponent.getNodeType(), containerChild.getNodeType());
-
- // check rm identifier
- assertNotNull(createdComponent.getProperties().getIdentifier());
-
- // add the element to the matched children list
- verifiedChildren.add(createdComponent);
- }
- catch (NoSuchElementException e)
- {
- // the element was not created in this test, continue
- }
- });
-
- // check all the created elements have been returned
- assertTrue(verifiedChildren.containsAll(createdChildren));
- assertTrue(createdChildren.containsAll(verifiedChildren));
- unfiledChildren.addAll(createdChildren);
- }
-
- /**
- * Negative test to check that invalid types cannot be created at unfiled container root level
- * Only unfiled record folders and records can be created into unfiled container
- */
- @Test
- (
- dataProvider = "invalidRootTypes",
- dataProviderClass = DataProviderClass.class,
- description = "Only unfiled records folders and records can be created as children for unfiled container root"
- )
- public void createInvalidUnfiledChildren(String filePlanComponentType)
- {
- String unfiledRecordFolderName = "UnfiledRecordFolder-" + getRandomAlphanumeric();
-
- logger.info("creating " + filePlanComponentType);
-
- // Build unfiled records folder properties
- UnfiledContainerChild unfiledFolderModel = createUnfiledContainerChildModel(unfiledRecordFolderName, filePlanComponentType);
-
- getRestAPIFactory().getUnfiledContainersAPI().createUnfiledContainerChild(unfiledFolderModel, UNFILED_RECORDS_CONTAINER_ALIAS);
- // Verify the status code
- assertStatusCode(UNPROCESSABLE_ENTITY);
- }
-
- @Test(description = "Create a record with custom record identifier in unfiled container")
- public void createRecordWithCustomIdentifier()
- {
- String recordName = "customIdRecord-" + getRandomAlphanumeric();
- String customIdentifier = "customId";
- UnfiledContainerChildProperties propertiesModel = UnfiledContainerChildProperties.builder().identifier(customIdentifier).build();
-
- UnfiledContainerChild childModel = UnfiledContainerChild.builder()
- .name(recordName)
- .nodeType(CONTENT_TYPE)
- .properties(propertiesModel)
- .build();
-
- UnfiledContainerChild child = getRestAPIFactory().getUnfiledContainersAPI().createUnfiledContainerChild(childModel, UNFILED_RECORDS_CONTAINER_ALIAS);
-
- assertStatusCode(HttpStatus.CREATED);
- unfiledChildren.add(child);
- assertEquals(child.getProperties().getIdentifier(), customIdentifier);
- assertEquals(child.getName(), recordName + " (" + customIdentifier + ")");
- }
-
- @AfterClass (alwaysRun = true)
- public void tearDown()
- {
- unfiledChildren.forEach(unfiledChild ->
- {
- if (unfiledChild.getIsRecord())
- {
- getRestAPIFactory().getRecordsAPI().deleteRecord(unfiledChild.getId());
- }
- else
- {
- getRestAPIFactory().getUnfiledRecordFoldersAPI().deleteUnfiledRecordFolder(unfiledChild.getId());
- }
- });
- }
-}
diff --git a/amps/ags/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/unfiledrecordfolders/UnfiledRecordsFolderTests.java b/amps/ags/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/unfiledrecordfolders/UnfiledRecordsFolderTests.java
deleted file mode 100644
index c89bb5a37e..0000000000
--- a/amps/ags/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/unfiledrecordfolders/UnfiledRecordsFolderTests.java
+++ /dev/null
@@ -1,490 +0,0 @@
-/*
- * #%L
- * Alfresco Records Management Module
- * %%
- * Copyright (C) 2005 - 2021 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.unfiledrecordfolders;
-
-import static java.time.LocalDateTime.now;
-
-import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentAlias.FILE_PLAN_ALIAS;
-import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentAlias.TRANSFERS_ALIAS;
-import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentAlias.UNFILED_RECORDS_CONTAINER_ALIAS;
-import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PATH;
-import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentType.CONTENT_TYPE;
-import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentType.NON_ELECTRONIC_RECORD_TYPE;
-import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentType.UNFILED_RECORD_FOLDER_TYPE;
-import static org.alfresco.rest.rm.community.utils.FilePlanComponentsUtil.createTempFile;
-import static org.alfresco.rest.rm.community.utils.FilePlanComponentsUtil.createUnfiledContainerChildModel;
-import static org.alfresco.utility.data.RandomData.getRandomAlphanumeric;
-import static org.alfresco.utility.data.RandomData.getRandomName;
-import static org.springframework.http.HttpStatus.BAD_REQUEST;
-import static org.springframework.http.HttpStatus.CREATED;
-import static org.springframework.http.HttpStatus.NOT_FOUND;
-import static org.springframework.http.HttpStatus.NO_CONTENT;
-import static org.springframework.http.HttpStatus.OK;
-import static org.springframework.http.HttpStatus.UNPROCESSABLE_ENTITY;
-import static org.testng.Assert.assertEquals;
-import static org.testng.Assert.assertFalse;
-import static org.testng.Assert.assertNotNull;
-import static org.testng.Assert.assertTrue;
-import static org.testng.Assert.fail;
-
-import java.util.ArrayList;
-import java.util.List;
-import java.util.NoSuchElementException;
-import java.util.stream.Collectors;
-
-import org.alfresco.rest.rm.community.base.BaseRMRestTest;
-import org.alfresco.rest.rm.community.base.DataProviderClass;
-import org.alfresco.rest.rm.community.model.recordcategory.RecordCategory;
-import org.alfresco.rest.rm.community.model.unfiledcontainer.UnfiledContainerChild;
-import org.alfresco.rest.rm.community.model.unfiledcontainer.UnfiledContainerChildCollection;
-import org.alfresco.rest.rm.community.model.unfiledcontainer.UnfiledContainerChildProperties;
-import org.alfresco.rest.rm.community.model.unfiledcontainer.UnfiledRecordFolder;
-import org.alfresco.rest.rm.community.requests.gscore.api.UnfiledRecordFolderAPI;
-import org.alfresco.rest.rm.community.utils.FilePlanComponentsUtil;
-import org.testng.annotations.AfterClass;
-import org.testng.annotations.BeforeClass;
-import org.testng.annotations.DataProvider;
-import org.testng.annotations.Test;
-
-/**
- * Unfiled Records folder CRUD API tests
- *
- * @author Kristijan Conkas
- * @since 2.6
- */
-public class UnfiledRecordsFolderTests extends BaseRMRestTest
-{
- public static final String ELECTRONIC_RECORD_NAME = getRandomName("Record electronic");
- public static final String NONELECTRONIC_RECORD_NAME = getRandomName("Record nonelectronic");
-
- private RecordCategory rootCategory;
- private UnfiledContainerChild unfiledRecordFolder, rootUnfiledRecordFolder, unfiledRecord;
-
- @BeforeClass(alwaysRun = true)
- public void preconditionUnfiledRecordsFolderTests()
- {
- rootCategory = createRootCategory(getRandomName("CATEGORY NAME"));
- rootUnfiledRecordFolder = createUnfiledContainerChild(UNFILED_RECORDS_CONTAINER_ALIAS,
- getRandomName("RootUnfiledRecFolder"), UNFILED_RECORD_FOLDER_TYPE);
- unfiledRecord = createUnfiledContainerChild(UNFILED_RECORDS_CONTAINER_ALIAS,
- getRandomName("Unfiled Record"), CONTENT_TYPE);
- }
- /**
- * valid root level types, at unfiled record folder level these possible to create
- */
- @DataProvider (name = "validChildren")
- public Object[][] childrenForUnfiledRecord()
- {
- return new String[][]
- {
- { UNFILED_RECORD_FOLDER_TYPE },
- { CONTENT_TYPE },
- { NON_ELECTRONIC_RECORD_TYPE }
- };
- }
-
- /**
- * Invalid containers that cannot be updated/deleted with record folder endpoint
- */
- @DataProvider (name = "invalidNodesForDelete")
- public Object[][] getInvalidNodes()
- {
- return new String[][] {
- { getRestAPIFactory().getFilePlansAPI().getFilePlan(FILE_PLAN_ALIAS).getId() },
- { getRestAPIFactory().getUnfiledContainersAPI().getUnfiledContainer(UNFILED_RECORDS_CONTAINER_ALIAS).getId() },
- { getRestAPIFactory().getTransferContainerAPI().getTransferContainer(TRANSFERS_ALIAS).getId() },
- // an arbitrary record category
- { rootCategory.getId() },
- // an arbitrary unfiled records folder
- {createRecordFolder(rootCategory.getId(), getRandomName("recFolder")).getId()},
- {unfiledRecord.getId() }
- };
- }
-
- /**
- *
- * Given that I want to create an unfiled record folder
- * When I use the API with the relativePath
- * Then the folders specified in the relativePath that don't exist are created
- *
- */
- @Test
- (
- description = "Create a child into unfiled record folder based on the relativePath. " +
- "Containers in the relativePath that do not exist are created before the node is created",
- dataProvider = "validChildren"
- )
- public void createUnfiledRecordFolderWithRelativePath(String nodeType)
- {
- // relativePath specify the container structure to create relative to the record folder to be created
- String relativePath = now().getYear() + "/" + now().getMonth() + "/" + now().getDayOfMonth();
-
- // The record folder to be created
- UnfiledContainerChild unfiledChildModel = UnfiledContainerChild.builder()
- .name(getRandomName("UnfiledRecordFolder"))
- .nodeType(nodeType)
- .relativePath(relativePath)
- .build();
-
- UnfiledContainerChild unfiledRecordFolderChild = getRestAPIFactory().getUnfiledRecordFoldersAPI()
- .createUnfiledRecordFolderChild(unfiledChildModel, rootUnfiledRecordFolder.getId(), "include=" + PATH);
-
- // Check the API response code
- assertStatusCode(CREATED);
-
- // Verify the returned node type
- assertEquals(unfiledRecordFolderChild.getNodeType(), nodeType);
-
- // Check the path return contains the relativePath
- assertTrue(unfiledRecordFolderChild.getPath().getName().contains(relativePath));
-
- // Check the parent is a folder, not a record
- assertEquals(getRestAPIFactory().getUnfiledRecordFoldersAPI().getUnfiledRecordFolder(unfiledRecordFolderChild.getParentId()).getNodeType(),
- UNFILED_RECORD_FOLDER_TYPE);
-
- // New relative path only a part of containers need to be created before the record folder
- String newRelativePath = now().getYear() + "/" + now().getMonth() + "/" + (now().getDayOfMonth() + 1);
-
- // The record folder to be created
- UnfiledContainerChild newUnfiledFolderModel = UnfiledContainerChild.builder()
- .name(getRandomName("UnfiledRecordFolder"))
- .nodeType(nodeType)
- .relativePath(newRelativePath)
- .build();
-
- UnfiledContainerChild newUnfiledRecordFolderChild = getRestAPIFactory().getUnfiledRecordFoldersAPI()
- .createUnfiledRecordFolderChild(newUnfiledFolderModel, rootUnfiledRecordFolder.getId(), "include=" + PATH);
-
- // Check the API response code
- assertStatusCode(CREATED);
-
- // Check the path return contains the newRelativePath
- assertTrue(newUnfiledRecordFolderChild.getPath().getName().contains(newRelativePath));
-
- // Check the parent is a folder, not a record
- assertFalse(getRestAPIFactory().getUnfiledRecordFoldersAPI().getUnfiledRecordFolder(newUnfiledRecordFolderChild.getParentId()).equals(UNFILED_RECORD_FOLDER_TYPE));
- // Verify the returned node type
- assertEquals(newUnfiledRecordFolderChild.getNodeType(), nodeType);
- }
-
- /**
- * Negative test to check that invalid types cannot be created at unfiled container root level
- * Only unfiled record folders and records can be created into unfiled container
- */
- @Test
- (
- dataProvider = "invalidRootTypes",
- dataProviderClass = DataProviderClass.class,
- description = "Only unfiled records folders and records can be created as children for unfiled container root"
- )
- public void createInvalidUnfiledChildren(String filePlanComponentType)
- {
- // Build unfiled records folder properties
- UnfiledContainerChild unfiledFolderModel = createUnfiledContainerChildModel(getRandomName("UnfiledRecFolder"), filePlanComponentType);
-
- getRestAPIFactory().getUnfiledRecordFoldersAPI().createUnfiledRecordFolderChild(unfiledFolderModel, rootUnfiledRecordFolder.getId());
-
- // Verify the status code
- assertStatusCode(UNPROCESSABLE_ENTITY);
- }
-
- /**
- * Given an unfiled record folder
- * When I create an unfiled record folder via the ReST API
- * Then an unfiled record folder is created within the unfiled record folder
- */
- @Test(description = "Child unfiled records folder can be created in a parent unfiled records folder")
- public void childUnfiledRecordsFolderCanBeCreated()
- {
- String unfiledParentFolderName = "UnfiledParentFolder" + getRandomAlphanumeric();
- String unfiledChildFolderName = "UnfiledChildFolder " + getRandomAlphanumeric();
-
- // No need for fine control, create it using utility function
- UnfiledContainerChild unfiledParentFolder = createUnfiledRecordsFolderChild(rootUnfiledRecordFolder.getId(),
- unfiledParentFolderName, UNFILED_RECORD_FOLDER_TYPE);
- assertEquals(unfiledParentFolderName, unfiledParentFolder.getName());
-
- // Build the unfiled records folder properties
- UnfiledContainerChild unfiledChildFolderModel =
- UnfiledContainerChild.builder()
- .name(unfiledChildFolderName)
- .nodeType(UNFILED_RECORD_FOLDER_TYPE)
- .properties(UnfiledContainerChildProperties.builder()
- .title(FilePlanComponentsUtil.TITLE_PREFIX + unfiledChildFolderName)
- .description(FilePlanComponentsUtil.DESCRIPTION_PREFIX + unfiledChildFolderName).build())
- .build();
-
- // Create it as a child of parentFolder
- UnfiledContainerChild unfiledChildFolder = getRestAPIFactory().getUnfiledRecordFoldersAPI()
- .createUnfiledRecordFolderChild(unfiledChildFolderModel, unfiledParentFolder.getId());
-
- // Verify the status code
- assertStatusCode(CREATED);
-
- // Verify the returned unfiled child folder
- assertTrue(unfiledChildFolder.getIsUnfiledRecordFolder());
- assertFalse(unfiledChildFolder.getIsRecord());
-
- assertEquals(unfiledChildFolder.getName(), unfiledChildFolderName);
- assertEquals(unfiledChildFolder.getNodeType(), UNFILED_RECORD_FOLDER_TYPE);
- assertEquals(unfiledChildFolder.getCreatedByUser().getId(), getAdminUser().getUsername());
-
- // Verify the returned file plan component properties
- UnfiledRecordFolder unfiledChildRecordFolder = getRestAPIFactory().getUnfiledRecordFoldersAPI()
- .getUnfiledRecordFolder(unfiledChildFolder.getId());
- // Verify the returned file plan component properties
- UnfiledContainerChildProperties unfiledChildFolderProperties = unfiledChildRecordFolder.getProperties();
- assertEquals(unfiledChildFolderProperties.getTitle(), FilePlanComponentsUtil.TITLE_PREFIX + unfiledChildFolderName);
- assertEquals(unfiledChildFolderProperties.getDescription(), FilePlanComponentsUtil.DESCRIPTION_PREFIX + unfiledChildFolderName);
-
- // Does this child point to its parent?
- assertEquals(unfiledChildFolder.getParentId(), unfiledParentFolder.getId());
-
- // Does child's parent point to it?
- // Perform another call as our parentFolder had been executed before childFolder existed
- UnfiledContainerChildCollection parentsChildren = getRestAPIFactory().getUnfiledRecordFoldersAPI().getUnfiledRecordFolderChildren(unfiledParentFolder.getId());
- assertStatusCode(OK);
- List childIds = parentsChildren.getEntries()
- .stream()
- .map(c -> c.getEntry().getId())
- .collect(Collectors.toList());
-
- // Child folder is listed in parent
- assertTrue(childIds.contains(unfiledChildFolder.getId()));
-
- // There should be only one child
- assertEquals(1, childIds.size());
- }
-
- /**
- * Given an unfiled record folder
- * When I modify the unfiled record folder details via the ReST API
- * Then the details of the unfiled record folder are modified
- */
- @Test(description = "Unfiled record folder")
- public void editUnfiledRecordsFolder()
- {
- String modified = "Modified ";
- String unfiledFolderName = "UnfiledFolderToModify" + getRandomAlphanumeric();
-
- // No need for fine control, create it using utility function
- UnfiledContainerChild unfiledFolderToModify = createUnfiledRecordsFolderChild(rootUnfiledRecordFolder.getId(),
- unfiledFolderName, UNFILED_RECORD_FOLDER_TYPE);
- assertEquals(unfiledFolderName, unfiledFolderToModify.getName());
-
- // Build the properties which will be updated
- UnfiledRecordFolder unfiledChildFolderModel =
- UnfiledRecordFolder.builder()
- .name(modified + unfiledFolderName)
- .properties
- (UnfiledContainerChildProperties.builder()
- .title(modified + unfiledFolderToModify.getProperties().getTitle())
- .description(modified + unfiledFolderToModify.getProperties().getDescription())
- .build()
- )
- .build();
-
-
-
-
- // Update the unfiled records folder
- UnfiledRecordFolder updatedRecordFolder=getRestAPIFactory().getUnfiledRecordFoldersAPI().updateUnfiledRecordFolder(unfiledChildFolderModel, unfiledFolderToModify.getId());
-
- // Verify the status code
- assertStatusCode(OK);
- // Verify the returned file plan component
- assertEquals(unfiledChildFolderModel.getName(),
- updatedRecordFolder.getName());
- assertEquals(unfiledChildFolderModel.getProperties().getTitle(),
- updatedRecordFolder.getProperties().getTitle());
- assertEquals(unfiledChildFolderModel.getProperties().getDescription(),
- updatedRecordFolder.getProperties().getDescription());
- // This is to ensure the change was actually applied, rather than simply trusting the object returned by PUT
- UnfiledRecordFolder renamedUnfiledFolder = getRestAPIFactory().getUnfiledRecordFoldersAPI().getUnfiledRecordFolder(unfiledFolderToModify.getId());
-
- // Verify the returned file plan component
- assertEquals(modified + unfiledFolderToModify.getName(), renamedUnfiledFolder.getName());
- assertEquals(modified + unfiledFolderToModify.getProperties().getTitle(), renamedUnfiledFolder.getProperties().getTitle());
- assertEquals(modified + unfiledFolderToModify.getProperties().getDescription(), renamedUnfiledFolder.getProperties().getDescription());
- }
-
- /**
- * Given an unfiled record folder and some records inside
- * When I delete the unfiled record folder via the ReST API
- * Then the unfiled record folder is deleted and its content too
- */
- @Test(description = "Delete unfiled record folder")
- public void deleteUnfiledRecordsFolder()
- {
- String unfiledFolderName = "UnfiledFolderToDelete" + getRandomAlphanumeric();
- String nonElectronicRecordName = "NonElectronicRecord" + getRandomAlphanumeric();
- String electronicRecordName = "ElectronicRecord" + getRandomAlphanumeric();
-
- // Create unfiledFolderToDelete
- UnfiledContainerChild unfiledFolderToDelete = createUnfiledRecordsFolderChild(rootUnfiledRecordFolder.getId(),
- unfiledFolderName, UNFILED_RECORD_FOLDER_TYPE);
- assertEquals(unfiledFolderName, unfiledFolderToDelete.getName());
-
- // Create a non electronic record under unfiledFolderToDelete
- UnfiledContainerChild nonElectronicRecord = createUnfiledRecordsFolderChild(unfiledFolderToDelete.getId(),
- nonElectronicRecordName, NON_ELECTRONIC_RECORD_TYPE);
- assertEquals(nonElectronicRecord.getParentId(), unfiledFolderToDelete.getId());
-
- // Create an electronic record under unfiledFolderToDelete
- UnfiledContainerChild electronicRecord = createUnfiledRecordsFolderChild(unfiledFolderToDelete.getId(),
- electronicRecordName, CONTENT_TYPE);
- assertEquals(electronicRecord.getParentId(), unfiledFolderToDelete.getId());
-
- // Delete folderToDelete
- getRestAPIFactory().getUnfiledRecordFoldersAPI().deleteUnfiledRecordFolder(unfiledFolderToDelete.getId());
-
- // Verify the status code
- assertStatusCode(NO_CONTENT);
-
- // Deleted component should no longer be retrievable
- getRestAPIFactory().getUnfiledRecordFoldersAPI().getUnfiledRecordFolder(unfiledFolderToDelete.getId());
- assertStatusCode(NOT_FOUND);
- }
-
- /**
- *
- * Given other nodes type than unfiled record folders exists
- * When I use the API from unfiled record-folders to delete the nodes
- * Then the request fails
- *
- */
- @Test
- (
- description = "Delete invalid nodes type with the DELETE unfiled record folders request",
- dataProvider = "invalidNodesForDelete"
- )
- public void deleteInvalidNodesUnfiled(String nodeId)
- {
- // Delete the nodes with record-folders end-point
- getRestAPIFactory().getUnfiledRecordFoldersAPI().deleteUnfiledRecordFolder(nodeId);
-
- // Check the response status code
- assertStatusCode(BAD_REQUEST);
- }
-
- /**
- * Given a container that is a unfiled record folder
- * When I try to record the containers records
- * Then I receive a list of all the records contained within the unfiled record folder
- */
- @Test
- public void readRecordsFromUnfiledRecordFolder()
- {
- unfiledRecordFolder = createUnfiledContainerChild(UNFILED_RECORDS_CONTAINER_ALIAS, getRandomName("UnfiledRecordFolder"), UNFILED_RECORD_FOLDER_TYPE);
- String containerId = unfiledRecordFolder.getId();
-
- //we have unfiled record folder
- UnfiledRecordFolderAPI unfiledRecordFoldersAPI = getRestAPIFactory().getUnfiledRecordFoldersAPI();
-
- ArrayList children = new ArrayList<>();
- for (int i = 0; i < 5; i++)
- {
- // Create Electronic Records
- UnfiledContainerChild record = UnfiledContainerChild.builder()
- .name(ELECTRONIC_RECORD_NAME + i)
- .nodeType(CONTENT_TYPE)
- .build();
- UnfiledContainerChild child = unfiledRecordFoldersAPI.uploadRecord(record, containerId, createTempFile(ELECTRONIC_RECORD_NAME + i, ELECTRONIC_RECORD_NAME + i));
- children.add(child);
-
- //Create NonElectronicRecords
- UnfiledContainerChild nonelectronicRecord = UnfiledContainerChild.builder()
- .properties(UnfiledContainerChildProperties.builder()
- .description("Description")
- .title("Title")
- .build())
- .name(NONELECTRONIC_RECORD_NAME + i)
- .nodeType(NON_ELECTRONIC_RECORD_TYPE)
- .build();
- child = unfiledRecordFoldersAPI.createUnfiledRecordFolderChild(nonelectronicRecord, containerId);
- children.add(child);
- }
-
- // List children from API
- UnfiledContainerChildCollection apiChildren = (UnfiledContainerChildCollection) unfiledRecordFoldersAPI.getUnfiledRecordFolderChildren(containerId,"include=properties").assertThat().entriesListIsNotEmpty();
-
- // Check status code
- assertStatusCode(OK);
-
-
- // Check listed children against created list
- apiChildren.getEntries().forEach(c ->
- {
- UnfiledContainerChild record = c.getEntry();
- assertNotNull(record.getId());
- logger.info("Checking child " + record.getId());
-
- try
- {
- // Find this child in created children list
- UnfiledContainerChild createdComponent = children.stream()
- .filter(child -> child.getId().equals(record.getId()))
- .findFirst()
- .orElseThrow();
-
- // Created by
- assertEquals(record.getCreatedByUser().getId(), getAdminUser().getUsername());
-
- // Is parent Id set correctly
- assertEquals(record.getParentId(), containerId);
- assertTrue(record.getIsRecord());
-
- // Boolean properties related to node type
- assertFalse(record.getIsUnfiledRecordFolder());
-
- //check the record name
- assertEquals(createdComponent.getName(), record.getName(),
- "The record name " + record.getName() + " is not equal with the record name returned when creating the record " + createdComponent.getName());
- String identifier = " \\(" + record.getProperties().getIdentifier() + "\\)";
- String regex= "(" + NONELECTRONIC_RECORD_NAME + "|" + ELECTRONIC_RECORD_NAME + ")" + "[0-9]+" + identifier;
- assertTrue(record.getName().matches(regex),
- "The record name:" + record.getName() + " doesn't match the expression " + regex);
- assertTrue(createdComponent.getName().contains(createdComponent.getProperties().getIdentifier()));
- assertEquals(createdComponent.getNodeType(), record.getNodeType());
-
- }
- catch (NoSuchElementException e)
- {
- fail("No child element for " + record.getId());
- }
- });
- }
-
- @AfterClass (alwaysRun = true)
- public void tearDown()
- {
- deleteRecordCategory(rootCategory.getId());
- getRestAPIFactory().getRecordsAPI().deleteRecord(unfiledRecord.getId());
- getRestAPIFactory().getUnfiledRecordFoldersAPI().deleteUnfiledRecordFolder(rootUnfiledRecordFolder.getId());
- getRestAPIFactory().getUnfiledRecordFoldersAPI().deleteUnfiledRecordFolder(unfiledRecordFolder.getId());
- }
-}
diff --git a/amps/ags/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/utils/CoreUtil.java b/amps/ags/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/utils/CoreUtil.java
deleted file mode 100644
index 980dd4a66f..0000000000
--- a/amps/ags/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/utils/CoreUtil.java
+++ /dev/null
@@ -1,107 +0,0 @@
-/*
- * #%L
- * Alfresco Records Management Module
- * %%
- * Copyright (C) 2005 - 2021 Alfresco Software Limited
- * %%
- * This file is part of the Alfresco software.
- * -
- * If the software was purchased under a paid Alfresco license, the terms of
- * the paid license agreement will prevail. Otherwise, the software is
- * provided under the following open source license terms:
- * -
- * Alfresco is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- * -
- * Alfresco is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License for more details.
- * -
- * You should have received a copy of the GNU Lesser General Public License
- * along with Alfresco. If not, see .
- * #L%
- */
-package org.alfresco.rest.rm.community.utils;
-
-import java.lang.reflect.InvocationTargetException;
-
-import org.alfresco.rest.model.RestNodeBodyMoveCopyModel;
-import org.alfresco.utility.model.ContentModel;
-import org.alfresco.utility.model.FileModel;
-import org.alfresco.utility.model.RepoTestModel;
-
-/**
- * Utility class for core components models
- *
- * @author Rodica Sutu
- * @since 2.6
- */
-public class CoreUtil
-{
- private CoreUtil()
- {
- // Intentionally blank
- }
-
- /**
- * Creates a body model for move/copy with the given the target node id
- *
- * @param nodeId The node id
- * @return The {@link RestNodeBodyMoveCopyModel} with for the given node id
- */
- public static RestNodeBodyMoveCopyModel createBodyForMoveCopy(String nodeId)
- {
- RestNodeBodyMoveCopyModel moveDestinationInfo = new RestNodeBodyMoveCopyModel();
- moveDestinationInfo.setTargetParentId(nodeId);
- return moveDestinationInfo;
- }
-
- /**
- * Helper method to create a Content Model
- *
- * @return ContentModel
- */
- public static ContentModel toContentModel(String nodeId)
- {
- return toModel(nodeId, ContentModel.class);
- }
-
- /**
- * Helper method to create a File Model
- *
- * @return ContentModel
- */
- public static FileModel toFileModel(String nodeId)
- {
- return toModel(nodeId,FileModel.class);
- }
-
- /**
- * Helper method to create a RepoTestModel using the node id
- *
- * @param nodeId node ref of the test model
- * @param classOf repo test model class
- * @return
- */
- private static T toModel(String nodeId, Class classOf)
- {
- T target = null;
- try
- {
- target = (T) classOf.getDeclaredConstructor().newInstance();
- }
- catch (InvocationTargetException| NoSuchMethodException| IllegalAccessException | InstantiationException e)
- {
- e.printStackTrace();
- }
-
- target.setNodeRef(nodeId);
- return target;
-
- }
-
-
-}
diff --git a/amps/ags/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/utils/FilePlanComponentsUtil.java b/amps/ags/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/utils/FilePlanComponentsUtil.java
deleted file mode 100644
index 56dd5da2bb..0000000000
--- a/amps/ags/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/utils/FilePlanComponentsUtil.java
+++ /dev/null
@@ -1,356 +0,0 @@
-/*
- * #%L
- * Alfresco Records Management Module
- * %%
- * Copyright (C) 2005 - 2021 Alfresco Software Limited
- * %%
- * This file is part of the Alfresco software.
- * -
- * If the software was purchased under a paid Alfresco license, the terms of
- * the paid license agreement will prevail. Otherwise, the software is
- * provided under the following open source license terms:
- * -
- * Alfresco is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- * -
- * Alfresco is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License for more details.
- * -
- * You should have received a copy of the GNU Lesser General Public License
- * along with Alfresco. If not, see .
- * #L%
- */
-package org.alfresco.rest.rm.community.utils;
-
-import static java.nio.charset.Charset.forName;
-
-import static com.google.common.io.Resources.getResource;
-
-import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentType.CONTENT_TYPE;
-import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentType.NON_ELECTRONIC_RECORD_TYPE;
-import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentType.RECORD_CATEGORY_TYPE;
-import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentType.RECORD_FOLDER_TYPE;
-import static org.alfresco.utility.data.RandomData.getRandomAlphanumeric;
-import static org.testng.Assert.assertEquals;
-import static org.testng.Assert.assertTrue;
-
-import java.io.File;
-import java.io.FileOutputStream;
-import java.io.OutputStreamWriter;
-
-import org.alfresco.rest.rm.community.model.record.Record;
-import org.alfresco.rest.rm.community.model.record.RecordProperties;
-import org.alfresco.rest.rm.community.model.recordcategory.RecordCategory;
-import org.alfresco.rest.rm.community.model.recordcategory.RecordCategoryChild;
-import org.alfresco.rest.rm.community.model.recordcategory.RecordCategoryChildProperties;
-import org.alfresco.rest.rm.community.model.recordcategory.RecordCategoryProperties;
-import org.alfresco.rest.rm.community.model.recordfolder.RecordFolder;
-import org.alfresco.rest.rm.community.model.recordfolder.RecordFolderProperties;
-import org.alfresco.rest.rm.community.model.unfiledcontainer.UnfiledContainerChild;
-import org.alfresco.rest.rm.community.model.unfiledcontainer.UnfiledContainerChildProperties;
-
-/**
- * Utility class for file plan component models
- *
- * @author Tuna Aksoy
- * @since 2.6
- */
-public class FilePlanComponentsUtil
-{
- private FilePlanComponentsUtil()
- {
- // Intentionally blank
- }
-
- /** Name of the image resource file to be used for records body */
- public static final String IMAGE_FILE = "money.JPG";
-
- /** Title prefix for record category children */
- public static final String TITLE_PREFIX = "Title for ";
-
- /** Description prefix for record category children */
- public static final String DESCRIPTION_PREFIX = "This is the description for";
-
-
- /**
- * Helper method to get a file by its name
- *
- * @return The file
- */
- public static File getFile(String fileName)
- {
- return new File(getResource(fileName).getFile());
- }
-
- /**
- * Creates a record model with the given type and a random name (with "Record " prefix)
- *
- * @param nodeType The node type
- * @return The {@link Record} with for the given node type
- */
- private static Record createRecordModel(String nodeType)
- {
- return Record.builder()
- .name("Record " + getRandomAlphanumeric())
- .nodeType(nodeType)
- .build();
- }
-
- /**
- * Creates an electronic record model with a random name (with "Record " prefix)
- *
- * @return The electronic record as {@link Record}
- */
- public static Record createElectronicRecordModel()
- {
- return createRecordModel(CONTENT_TYPE);
- }
-
- /**
- * Creates a non-electronic unfiled container child model with a random name (with "Record " prefix)
- *
- * @return The electronic record as {@link UnfiledContainerChild}
- */
- public static UnfiledContainerChild createElectronicUnfiledContainerChildModel()
- {
- return createUnfiledContainerChildRecordModel("Record " + getRandomAlphanumeric(), CONTENT_TYPE);
- }
-
- /**
- * Creates an electronic unfiled container child model with a random name (with "Record " prefix)
- *
- * @return The electronic record as {@link UnfiledContainerChild}
- */
- public static UnfiledContainerChild createNonElectronicUnfiledContainerChildModel()
- {
- return createUnfiledContainerChildRecordModel("Record " + getRandomAlphanumeric(), NON_ELECTRONIC_RECORD_TYPE);
- }
-
- /**
- * Creates an unfiled records container child record model with the given name and type
- *
- * @param name The name of the unfiled records container child
- * @param nodeType The type of the record category child
- * @return The {@link UnfiledContainerChild} with the given details
- */
- public static UnfiledContainerChild createUnfiledContainerChildRecordModel(String name, String nodeType)
- {
- return UnfiledContainerChild.builder()
- .name(name)
- .nodeType(nodeType)
- .build();
- }
-
- /**
- * Creates a nonElectronic container child record model with all available properties for the non electronic records
- *
- * @param name The name of the unfiled records container child
- * @param nodeType The type of the record category child
- * @return The {@link UnfiledContainerChild} with the given details
- */
- public static UnfiledContainerChild createFullNonElectronicUnfiledContainerChildRecordModel(String name, String title, String description, String box, String file,
- String shelf, String storageLocation, Integer numberOfCopies, Integer physicalSize)
- {
- return UnfiledContainerChild.builder()
- .name(name)
- .nodeType(NON_ELECTRONIC_RECORD_TYPE)
- .properties(UnfiledContainerChildProperties.builder()
- .title(title)
- .description(description)
- .box(box)
- .file(file)
- .shelf(shelf)
- .storageLocation(storageLocation)
- .numberOfCopies(numberOfCopies)
- .physicalSize(physicalSize)
- .build())
- .build();
- }
-
- /**
- * Creates a non-electronic record model with a random name (with "Record " prefix)
- *
- * @return The non-electronic record as {@link Record}
- */
- public static Record createNonElectronicRecordModel()
- {
- return createRecordModel(NON_ELECTRONIC_RECORD_TYPE);
- }
-
- /**
- * Creates a non-electronic record model with with all available properties for the non electronic records
- *
- * @return The non-electronic record as {@link Record}
- */
- public static Record createFullNonElectronicRecordModel(String name, String title, String description, String box, String file,
- String shelf, String storageLocation, Integer numberOfCopies, Integer physicalSize)
- {
- return Record.builder()
- .name(name)
- .nodeType(NON_ELECTRONIC_RECORD_TYPE)
- .properties(RecordProperties.builder()
- .title(title)
- .description(description)
- .box(box)
- .file(file)
- .shelf(shelf)
- .storageLocation(storageLocation)
- .numberOfCopies(numberOfCopies)
- .physicalSize(physicalSize)
- .build())
- .build();
- }
-
- /**
- * Creates a record model with the given name, description and title
- *
- * @param name The name of the record
- * @param description The description of the record
- * @param title The title of the record
- * @return The {@link Record} with the given details
- */
- public static Record createRecordModel(String name, String description, String title)
- {
- return Record.builder()
- .name(name)
- .properties(RecordProperties.builder()
- .description(description)
- .title(title)
- .build())
- .build();
- }
-
- /**
- * Creates a record category child model with the given name and type
- *
- * @param name The name of the record category child
- * @param nodeType The type of the record category child
- * @return The {@link RecordCategoryChild} with the given details
- */
- public static RecordCategoryChild createRecordCategoryChildModel(String name, String nodeType)
- {
- return RecordCategoryChild.builder()
- .name(name)
- .nodeType(nodeType)
- .properties(RecordCategoryChildProperties.builder()
- .title(TITLE_PREFIX + name)
- .build())
- .build();
- }
-
- /**
- * Creates a record category model with the given name and title
- *
- * @param name The name of the record category
- * @param title The title of the record category
- * @return The {@link RecordCategory} with the given details
- */
- public static RecordCategory createRecordCategoryModel(String name, String title)
- {
- return RecordCategory.builder()
- .name(name)
- .nodeType(RECORD_CATEGORY_TYPE)
- .properties(RecordCategoryProperties.builder()
- .title(title)
- .build())
- .build();
- }
-
- /**
- * Creates a record folder model with the given name and title
- *
- * @param name The name of the record folder
- * @param title The title of the record folder
- * @return The {@link RecordFolder} with the given details
- */
- public static RecordFolder createRecordFolderModel(String name, String title)
- {
- return RecordFolder.builder()
- .name(name)
- .nodeType(RECORD_FOLDER_TYPE)
- .properties(RecordFolderProperties.builder()
- .title(title)
- .build())
- .build();
- }
-
- /**
- * Creates an unfiled records container child model with the given name and type
- *
- * @param name The name of the unfiled records container child
- * @param nodeType The type of the record category child
- * @return The {@link UnfiledContainerChild} with the given details
- */
- public static UnfiledContainerChild createUnfiledContainerChildModel(String name, String nodeType)
- {
- return UnfiledContainerChild.builder()
- .name(name)
- .nodeType(nodeType)
- .properties(UnfiledContainerChildProperties.builder()
- .title(TITLE_PREFIX + name)
- .build())
- .build();
- }
-
- /**
- * Create temp file with content
- *
- * @param name The file name
- * @return {@link File} The created file
- */
- public static File createTempFile(final String name, String content)
- {
- try
- {
- // Create file
- final File file = File.createTempFile(name, ".txt");
-
- // Create writer
- try (OutputStreamWriter writer = new OutputStreamWriter(new FileOutputStream(file), forName("UTF-8").newEncoder()))
- {
- // place content in file
- writer.write(content);
- }
-
- return file;
- }
- catch (Exception exception)
- {
- throw new RuntimeException("Unable to create test file.", exception);
- }
- }
-
- /**
- * Helper method to verify all properties of a nonElectronic record
- *
- * @param nonElectronicRecord
- * @param name
- * @param title
- * @param description
- * @param box
- * @param file
- * @param shelf
- * @param storageLocation
- * @param numberOfCopies
- * @param physicalSize
- */
- public static void verifyFullNonElectronicRecord(Record nonElectronicRecord, String name, String title, String description, String box, String file,
- String shelf, String storageLocation, Integer numberOfCopies, Integer physicalSize)
- {
- RecordProperties properties = nonElectronicRecord.getProperties();
- assertEquals(title, properties.getTitle());
- assertEquals(description, properties.getDescription());
- assertEquals(box, properties.getBox());
- assertEquals(file, properties.getFile());
- assertEquals(shelf, properties.getShelf());
- assertEquals(storageLocation, properties.getStorageLocation());
- assertEquals(numberOfCopies, properties.getNumberOfCopies());
- assertEquals(physicalSize, properties.getPhysicalSize());
- assertTrue(nonElectronicRecord.getName().contains(properties.getIdentifier()));
- assertTrue(nonElectronicRecord.getName().contains(name));
- }
-}
diff --git a/amps/ags/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/utils/RMSiteUtil.java b/amps/ags/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/utils/RMSiteUtil.java
deleted file mode 100644
index 8e6823585e..0000000000
--- a/amps/ags/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/utils/RMSiteUtil.java
+++ /dev/null
@@ -1,97 +0,0 @@
-/*
- * #%L
- * Alfresco Records Management Module
- * %%
- * Copyright (C) 2005 - 2021 Alfresco Software Limited
- * %%
- * This file is part of the Alfresco software.
- * -
- * If the software was purchased under a paid Alfresco license, the terms of
- * the paid license agreement will prevail. Otherwise, the software is
- * provided under the following open source license terms:
- * -
- * Alfresco is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- * -
- * Alfresco is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License for more details.
- * -
- * You should have received a copy of the GNU Lesser General Public License
- * along with Alfresco. If not, see .
- * #L%
- */
-package org.alfresco.rest.rm.community.utils;
-
-import static org.alfresco.rest.rm.community.model.site.RMSiteCompliance.DOD5015;
-import static org.alfresco.rest.rm.community.model.site.RMSiteCompliance.STANDARD;
-
-import org.alfresco.rest.rm.community.model.site.RMSiteCompliance;
-import org.alfresco.rest.rm.community.model.site.RMSite;
-
-/**
- * Utility class for the RM Site
- *
- * @author Tuna Aksoy
- * @since 2.6
- */
-public class RMSiteUtil
-{
- private RMSiteUtil()
- {
- // Intentionally blank
- }
-
- /** Constants */
- public static final String RM_ID = "rm";
- public static final String RM_TITLE = "Records Management";
- public static final String RM_DESCRIPTION = "Records Management Site";
- public static final String FILE_PLAN_PATH = "/rm/documentLibrary";
-
- /**
- * Creates an RM Site model for the given compliance, title and description
- *
- * @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 RMSite createRMSiteModel(RMSiteCompliance compliance, String title, String description)
- {
- return RMSite.builder().compliance(compliance).title(title).description(description).build();
- }
-
- /**
- * Creates an RM Site for the given compliance and default title and description
- *
- * @param compliance The RM site compliance
- * @return The {@link RMSite} with the given details
- */
- private static RMSite createRMSiteModel(RMSiteCompliance compliance)
- {
- return createRMSiteModel(compliance, RM_TITLE, RM_DESCRIPTION);
- }
-
- /**
- * Creates a standard RM site with the default title and description
- *
- * @return The standard RM site
- */
- public static RMSite createStandardRMSiteModel()
- {
- return createRMSiteModel(STANDARD);
- }
-
- /**
- * Creates a DOD5015 compliance RM site with the default title and description
- *
- * @return The DOD5015 compliance RM site
- */
- public static RMSite createDOD5015RMSiteModel()
- {
- return createRMSiteModel(DOD5015);
- }
-}
diff --git a/amps/ags/rm-automation/rm-automation-community-rest-api/src/test/resources/log4j.properties b/amps/ags/rm-automation/rm-automation-community-rest-api/src/test/resources/log4j.properties
deleted file mode 100644
index e01a70def8..0000000000
--- a/amps/ags/rm-automation/rm-automation-community-rest-api/src/test/resources/log4j.properties
+++ /dev/null
@@ -1,11 +0,0 @@
-# Root logger option
-log4j.rootLogger=INFO, file
-
-# Direct log messages to a log file
-log4j.appender.file=org.apache.log4j.RollingFileAppender
-log4j.appender.file.File=./target/reports/rm-automation-community-rest-api.log
-log4j.appender.file.MaxBackupIndex=10
-log4j.appender.file.layout=org.apache.log4j.PatternLayout
-log4j.appender.file.layout.ConversionPattern=[%t] %d{HH:mm:ss} %-5p %c{1}:%L - %m%n
-
-log4j.logger.com.example=debug
diff --git a/amps/ags/rm-automation/rm-automation-community-rest-api/src/test/resources/money.JPG b/amps/ags/rm-automation/rm-automation-community-rest-api/src/test/resources/money.JPG
deleted file mode 100644
index 5939b17709..0000000000
Binary files a/amps/ags/rm-automation/rm-automation-community-rest-api/src/test/resources/money.JPG and /dev/null differ
diff --git a/amps/ags/rm-automation/rm-automation-community-rest-api/src/test/resources/shared-resources/testdata/SampleTextFile_10kb.txt b/amps/ags/rm-automation/rm-automation-community-rest-api/src/test/resources/shared-resources/testdata/SampleTextFile_10kb.txt
deleted file mode 100644
index e0f98f53f9..0000000000
--- a/amps/ags/rm-automation/rm-automation-community-rest-api/src/test/resources/shared-resources/testdata/SampleTextFile_10kb.txt
+++ /dev/null
@@ -1,27 +0,0 @@
-Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vivamus condimentum sagittis lacus, laoreet luctus ligula laoreet ut. Vestibulum ullamcorper accumsan velit vel vehicula. Proin tempor lacus arcu. Nunc at elit condimentum, semper nisi et, condimentum mi. In venenatis blandit nibh at sollicitudin. Vestibulum dapibus mauris at orci maximus pellentesque. Nullam id elementum ipsum. Suspendisse cursus lobortis viverra. Proin et erat at mauris tincidunt porttitor vitae ac dui.
-
-Donec vulputate lorem tortor, nec fermentum nibh bibendum vel. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Praesent dictum luctus massa, non euismod lacus. Pellentesque condimentum dolor est, ut dapibus lectus luctus ac. Ut sagittis commodo arcu. Integer nisi nulla, facilisis sit amet nulla quis, eleifend suscipit purus. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Aliquam euismod ultrices lorem, sit amet imperdiet est tincidunt vel. Phasellus dictum justo sit amet ligula varius aliquet auctor et metus. Fusce vitae tortor et nisi pulvinar vestibulum eget in risus. Donec ante ex, placerat a lorem eget, ultricies bibendum purus. Nam sit amet neque non ante laoreet rutrum. Nullam aliquet commodo urna, sed ullamcorper odio feugiat id. Mauris nisi sapien, porttitor in condimentum nec, venenatis eu urna. Pellentesque feugiat diam est, at rhoncus orci porttitor non.
-
-Nulla luctus sem sit amet nisi consequat, id ornare ipsum dignissim. Sed elementum elit nibh, eu condimentum orci viverra quis. Aenean suscipit vitae felis non suscipit. Suspendisse pharetra turpis non eros semper dictum. Etiam tincidunt venenatis venenatis. Praesent eget gravida lorem, ut congue diam. Etiam facilisis elit at porttitor egestas. Praesent consequat, velit non vulputate convallis, ligula diam sagittis urna, in venenatis nisi justo ut mauris. Vestibulum posuere sollicitudin mi, et vulputate nisl fringilla non. Nulla ornare pretium velit a euismod. Nunc sagittis venenatis vestibulum. Nunc sodales libero a est ornare ultricies. Sed sed leo sed orci pellentesque ultrices. Mauris sollicitudin, sem quis placerat ornare, velit arcu convallis ligula, pretium finibus nisl sapien vel sem. Vivamus sit amet tortor id lorem consequat hendrerit. Nullam at dui risus.
-
-Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed feugiat semper velit consequat facilisis. Etiam facilisis justo non iaculis dictum. Fusce turpis neque, pharetra ut odio eu, hendrerit rhoncus lacus. Nunc orci felis, imperdiet vel interdum quis, porta eu ipsum. Pellentesque dictum sem lacinia, auctor dui in, malesuada nunc. Maecenas sit amet mollis eros. Proin fringilla viverra ligula, sollicitudin viverra ante sollicitudin congue. Donec mollis felis eu libero malesuada, et lacinia risus interdum.
-
-Etiam vitae accumsan augue. Ut urna orci, malesuada ut nisi a, condimentum gravida magna. Nulla bibendum ex in vulputate sagittis. Nulla facilisi. Nullam faucibus et metus ac consequat. Quisque tempor eros velit, id mattis nibh aliquet a. Aenean tempor elit ut finibus auctor. Sed at imperdiet mauris. Vestibulum pharetra non lacus sed pulvinar. Sed pellentesque magna a eros volutpat ullamcorper. In hac habitasse platea dictumst. Donec ipsum mi, feugiat in eros sed, varius lacinia turpis. Donec vulputate tincidunt dui ac laoreet. Sed in eros dui. Pellentesque placerat tristique ligula eu finibus. Proin nec faucibus felis, eu commodo ipsum.
-
-Integer eu hendrerit diam, sed consectetur nunc. Aliquam a sem vitae leo fermentum faucibus quis at sem. Etiam blandit, quam quis fermentum varius, ante urna ultricies lectus, vel pellentesque ligula arcu nec elit. Donec placerat ante in enim scelerisque pretium. Donec et rhoncus erat. Aenean tempor nisi vitae augue tincidunt luctus. Nam condimentum dictum ante, et laoreet neque pellentesque id. Curabitur consectetur cursus neque aliquam porta. Ut interdum nunc nec nibh vestibulum, in sagittis metus facilisis. Pellentesque feugiat condimentum metus. Etiam venenatis quam at ante rhoncus vestibulum. Maecenas suscipit congue pellentesque. Vestibulum suscipit scelerisque fermentum. Nulla iaculis risus ac vulputate porttitor.
-
-Mauris nec metus vel dolor blandit faucibus et vel magna. Ut tincidunt ipsum non nunc dapibus, sed blandit mi condimentum. Quisque pharetra interdum quam nec feugiat. Sed pellentesque nulla et turpis blandit interdum. Curabitur at metus vitae augue elementum viverra. Sed mattis lorem non enim fermentum finibus. Sed at dui in magna dignissim accumsan. Proin tincidunt ultricies cursus. Maecenas tincidunt magna at urna faucibus lacinia.
-
-Quisque venenatis justo sit amet tortor condimentum, nec tincidunt tellus viverra. Morbi risus ipsum, consequat convallis malesuada non, fermentum non velit. Nulla facilisis orci eget ligula mattis fermentum. Aliquam vel velit ultricies, sollicitudin nibh eu, congue velit. Donec nulla lorem, euismod id cursus at, sollicitudin et arcu. Proin vitae tincidunt ipsum. Vivamus elementum eleifend justo, placerat interdum nulla rutrum id.
-
-Phasellus fringilla luctus magna, a finibus justo dapibus a. Nam risus felis, rhoncus eget diam sit amet, congue facilisis nibh. Interdum et malesuada fames ac ante ipsum primis in faucibus. Praesent consequat euismod diam, eget volutpat magna convallis at. Mauris placerat pellentesque imperdiet. Nulla porta scelerisque enim, et scelerisque neque bibendum in. Proin eget turpis nisi. Suspendisse ut est a erat egestas eleifend at euismod arcu. Donec aliquet, nisi sed faucibus condimentum, nisi metus dictum eros, nec dignissim justo odio id nulla. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Maecenas sollicitudin, justo id elementum eleifend, justo neque aliquet nibh, finibus malesuada metus erat eget neque. Suspendisse nec auctor orci. Aenean et vestibulum nulla. Nullam hendrerit augue tristique, commodo metus id, sodales lorem. Etiam feugiat dui est, vitae auctor risus convallis non.
-
-Maecenas turpis enim, consectetur eget lectus eu, hendrerit posuere lacus. Praesent efficitur, felis eget dapibus consectetur, nisi massa dignissim enim, nec semper dolor est eu urna. Nullam ut sodales lorem. Aliquam dapibus faucibus diam. Vestibulum vel magna et dolor gravida imperdiet ut sit amet sem. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Curabitur elementum metus tincidunt nulla euismod ultricies. Duis elementum nec neque in porttitor. Nulla sagittis lorem elit, et consectetur ante laoreet eu. Maecenas nulla tellus, scelerisque ac erat sed, fermentum dapibus metus. Donec tincidunt fermentum molestie.
-
-Sed consequat mi at maximus faucibus. Pellentesque aliquet tincidunt sapien vel auctor. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Praesent accumsan nunc eget leo aliquam, facilisis hendrerit turpis egestas. Morbi in ultricies mauris, a eleifend turpis. Quisque fringilla massa iaculis risus ultrices, sit amet tincidunt dui varius. Quisque maximus porta tristique. Proin tincidunt, turpis ut tempor pretium, lectus ipsum ullamcorper leo, ac tincidunt felis dui non leo. Aenean porta augue ligula, non consequat ipsum aliquet et. Suspendisse ut suscipit ex. Pellentesque vitae lacinia arcu. Curabitur eget tincidunt nulla, non bibendum metus. Nullam mi ipsum, eleifend vitae tortor pulvinar, facilisis sollicitudin ipsum.
-
-Vestibulum molestie risus lorem, at feugiat lorem congue sed. Phasellus ullamcorper laoreet enim, nec aliquam turpis scelerisque et. Etiam dictum metus in elit aliquam dapibus. Vivamus vel lectus velit. Nam sed purus luctus, commodo dui quis, malesuada dui. Nulla porttitor aliquet elit sit amet viverra. Proin tempor nulla urna, non aliquet metus maximus quis. Aliquam ac lectus nec mi aliquam sagittis. Quisque venenatis quam eget nisl tempor, egestas rutrum eros eleifend. Nullam venenatis commodo velit, non tempor mauris fermentum ut. In a metus quis erat cursus sagittis. Donec congue nisl in viverra egestas.
-
-Vestibulum facilisis ligula magna, eu ornare lectus varius et. Mauris facilisis faucibus quam, quis mollis eros convallis non. Interdum et malesuada fames ac ante ipsum primis in faucibus. Praesent sit amet rutrum erat. Suspendisse potenti. Donec lorem mi, sagittis a fringilla sit amet, sagittis bibendum mauris. In in diam et lorem rutrum eleifend a et felis. Sed ac magna quis enim faucibus dictum. Suspendisse blandit enim eu ex laoreet gravida.
-
-Suspendisse sed semper felis. Etiam mattis magna mi, suscipit ullamcorper tellus euismod sed. Aenean congue scelerisque ligula id sodales. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Nunc sem lectus, gravida ac dui non, pharetra posuere leo. Maecenas lacus libero, facilisis et elit vitae, commodo facilisis sem. Vivamus id nisl nulla. Integer at maximus dui. Ut a tincidunt lorem. Vivamus vitae ligula vel lacus cursus condimentum. Phasellus quis mauris lobortis, finibus lorem in, vulputate ex. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed faucibus aliquam metus, quis varius elit porttitor id. Vivamus dignissim sollicitudin scelerisque. Morbi tincidunt, dolor quis vehicula consequat, dui diam condimentum nunc, vitae scelerisque odio libero nec ligula. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae;
diff --git a/amps/ags/rm-automation/rm-automation-community-rest-api/src/test/resources/testng.xml b/amps/ags/rm-automation/rm-automation-community-rest-api/src/test/resources/testng.xml
deleted file mode 100644
index 26a79d669c..0000000000
--- a/amps/ags/rm-automation/rm-automation-community-rest-api/src/test/resources/testng.xml
+++ /dev/null
@@ -1,9 +0,0 @@
-
-
-
-
-
-
-
-
-
diff --git a/amps/ags/rm-community/.editorConfig b/amps/ags/rm-community/.editorConfig
deleted file mode 100644
index 48fa6b4b8e..0000000000
--- a/amps/ags/rm-community/.editorConfig
+++ /dev/null
@@ -1,17 +0,0 @@
-
-# EditorConfig file: http://editorconfig.org/
-# Syntax at: https://github.com/editorconfig/editorconfig/wiki/EditorConfig-Properties
-
-# This is the Top level for the RM project
-root = true
-
-# All files should use spaces.
-[*]
-indent_style = space
-
-# Just JS for now.
-[*.js]
-indent_size = 3
-trim_trailing_whitespace = true
-
-#TODO: css, xml, ftl, etc.
diff --git a/amps/ags/rm-community/.jshintrc b/amps/ags/rm-community/.jshintrc
deleted file mode 100644
index a54fb37ca2..0000000000
--- a/amps/ags/rm-community/.jshintrc
+++ /dev/null
@@ -1,45 +0,0 @@
-
-{
- "bitwise": true,
- "curly": true,
- "eqeqeq": true,
- "es3": true,
- "forin": true,
- "freeze": true,
- "funcscope": true,
- "immed": true,
- "indent": 3,
- "iterator": true,
- "latedef": true,
- "maxcomplexity": 10,
- "maxdepth": 50,
- "maxerr": 50,
- "maxlen": 250,
- "maxparams": 50,
- "maxstatements": 30,
- "newcap": true,
- "noarg": true,
- "nonbsp": true,
- "nonew": true,
- "notypeof": true,
- "shadow": "outer",
- "undef": true,
- "unused": true,
-
- "globals": {
- "module": false,
- "model": true,
- "Alfresco": true,
- "YAHOO": false,
- "appContext": false,
- "PDFJS": false,
- "AlfrescoUtil": true,
- "msg": false
- },
-
- "expr": true,
- "strict": false,
-
- "browser": true,
- "dojo": true
-}
\ No newline at end of file
diff --git a/amps/ags/rm-community/LICENSE.txt b/amps/ags/rm-community/LICENSE.txt
deleted file mode 100644
index cca7fc278f..0000000000
--- a/amps/ags/rm-community/LICENSE.txt
+++ /dev/null
@@ -1,165 +0,0 @@
- GNU LESSER GENERAL PUBLIC LICENSE
- Version 3, 29 June 2007
-
- Copyright (C) 2007 Free Software Foundation, Inc.
- Everyone is permitted to copy and distribute verbatim copies
- of this license document, but changing it is not allowed.
-
-
- This version of the GNU Lesser General Public License incorporates
-the terms and conditions of version 3 of the GNU General Public
-License, supplemented by the additional permissions listed below.
-
- 0. Additional Definitions.
-
- As used herein, "this License" refers to version 3 of the GNU Lesser
-General Public License, and the "GNU GPL" refers to version 3 of the GNU
-General Public License.
-
- "The Library" refers to a covered work governed by this License,
-other than an Application or a Combined Work as defined below.
-
- An "Application" is any work that makes use of an interface provided
-by the Library, but which is not otherwise based on the Library.
-Defining a subclass of a class defined by the Library is deemed a mode
-of using an interface provided by the Library.
-
- A "Combined Work" is a work produced by combining or linking an
-Application with the Library. The particular version of the Library
-with which the Combined Work was made is also called the "Linked
-Version".
-
- The "Minimal Corresponding Source" for a Combined Work means the
-Corresponding Source for the Combined Work, excluding any source code
-for portions of the Combined Work that, considered in isolation, are
-based on the Application, and not on the Linked Version.
-
- The "Corresponding Application Code" for a Combined Work means the
-object code and/or source code for the Application, including any data
-and utility programs needed for reproducing the Combined Work from the
-Application, but excluding the System Libraries of the Combined Work.
-
- 1. Exception to Section 3 of the GNU GPL.
-
- You may convey a covered work under sections 3 and 4 of this License
-without being bound by section 3 of the GNU GPL.
-
- 2. Conveying Modified Versions.
-
- If you modify a copy of the Library, and, in your modifications, a
-facility refers to a function or data to be supplied by an Application
-that uses the facility (other than as an argument passed when the
-facility is invoked), then you may convey a copy of the modified
-version:
-
- a) under this License, provided that you make a good faith effort to
- ensure that, in the event an Application does not supply the
- function or data, the facility still operates, and performs
- whatever part of its purpose remains meaningful, or
-
- b) under the GNU GPL, with none of the additional permissions of
- this License applicable to that copy.
-
- 3. Object Code Incorporating Material from Library Header Files.
-
- The object code form of an Application may incorporate material from
-a header file that is part of the Library. You may convey such object
-code under terms of your choice, provided that, if the incorporated
-material is not limited to numerical parameters, data structure
-layouts and accessors, or small macros, inline functions and templates
-(ten or fewer lines in length), you do both of the following:
-
- a) Give prominent notice with each copy of the object code that the
- Library is used in it and that the Library and its use are
- covered by this License.
-
- b) Accompany the object code with a copy of the GNU GPL and this license
- document.
-
- 4. Combined Works.
-
- You may convey a Combined Work under terms of your choice that,
-taken together, effectively do not restrict modification of the
-portions of the Library contained in the Combined Work and reverse
-engineering for debugging such modifications, if you also do each of
-the following:
-
- a) Give prominent notice with each copy of the Combined Work that
- the Library is used in it and that the Library and its use are
- covered by this License.
-
- b) Accompany the Combined Work with a copy of the GNU GPL and this license
- document.
-
- c) For a Combined Work that displays copyright notices during
- execution, include the copyright notice for the Library among
- these notices, as well as a reference directing the user to the
- copies of the GNU GPL and this license document.
-
- d) Do one of the following:
-
- 0) Convey the Minimal Corresponding Source under the terms of this
- License, and the Corresponding Application Code in a form
- suitable for, and under terms that permit, the user to
- recombine or relink the Application with a modified version of
- the Linked Version to produce a modified Combined Work, in the
- manner specified by section 6 of the GNU GPL for conveying
- Corresponding Source.
-
- 1) Use a suitable shared library mechanism for linking with the
- Library. A suitable mechanism is one that (a) uses at run time
- a copy of the Library already present on the user's computer
- system, and (b) will operate properly with a modified version
- of the Library that is interface-compatible with the Linked
- Version.
-
- e) Provide Installation Information, but only if you would otherwise
- be required to provide such information under section 6 of the
- GNU GPL, and only to the extent that such information is
- necessary to install and execute a modified version of the
- Combined Work produced by recombining or relinking the
- Application with a modified version of the Linked Version. (If
- you use option 4d0, the Installation Information must accompany
- the Minimal Corresponding Source and Corresponding Application
- Code. If you use option 4d1, you must provide the Installation
- Information in the manner specified by section 6 of the GNU GPL
- for conveying Corresponding Source.)
-
- 5. Combined Libraries.
-
- You may place library facilities that are a work based on the
-Library side by side in a single library together with other library
-facilities that are not Applications and are not covered by this
-License, and convey such a combined library under terms of your
-choice, if you do both of the following:
-
- a) Accompany the combined library with a copy of the same work based
- on the Library, uncombined with any other library facilities,
- conveyed under the terms of this License.
-
- b) Give prominent notice with the combined library that part of it
- is a work based on the Library, and explaining where to find the
- accompanying uncombined form of the same work.
-
- 6. Revised Versions of the GNU Lesser General Public License.
-
- The Free Software Foundation may publish revised and/or new versions
-of the GNU Lesser General Public License from time to time. Such new
-versions will be similar in spirit to the present version, but may
-differ in detail to address new problems or concerns.
-
- Each version is given a distinguishing version number. If the
-Library as you received it specifies that a certain numbered version
-of the GNU Lesser General Public License "or any later version"
-applies to it, you have the option of following the terms and
-conditions either of that published version or of any later version
-published by the Free Software Foundation. If the Library as you
-received it does not specify a version number of the GNU Lesser
-General Public License, you may choose any version of the GNU Lesser
-General Public License ever published by the Free Software Foundation.
-
- If the Library as you received it specifies that a proxy can decide
-whether future versions of the GNU Lesser General Public License shall
-apply, that proxy's public statement of acceptance of any version is
-permanent authorization for you to choose that version for the
-Library.
diff --git a/amps/ags/rm-community/documentation/PatchService.md b/amps/ags/rm-community/documentation/PatchService.md
deleted file mode 100644
index 3472dde7fe..0000000000
--- a/amps/ags/rm-community/documentation/PatchService.md
+++ /dev/null
@@ -1,14 +0,0 @@
-# RM Patch Service
-
-The RM Patch service operates independently of the Core Patch service & behaves differently.
-
-Schema numbering is sequential, it’s a 4 digit number, prefixed with the major/minor version number, e.g. schema from a 2.4 version will be 24xx. This is a different policy to the core numbering (which bumps the schema number by 10 for each release).
-
-Patches run in a single transaction. They may process data in batches, but it’s all wrapped in a single transaction, which is rolled back if the patch fails or is interrupted. AbstractModulePatch#245. When we implement applyInternal within a patch, that whole method runs inside a transaction.
-
-DB Schema numbers update only after every patch runs. This means if a patch fails, earlier patches will re run. (see: ModulePatchExecuterImpl.executeInternal#140). This behaviour is different than core’s behaviour, which updates the schema number after each successful patch.
-
-DB Schema number is stored in the attribute service (key: “module-schema”) against the RM’s module ID. This is not exposed in the UI. Nor in a REST API. The attribute service stores it directly in the DB, so isn’t even accessible via the node browser.
-If a customer wants to determine the schema number for a running system, they’ll need to execute a DB query.
-
-It's possible to configure a patch not to run if being upgraded from a earlier schema version by setting `fixesFromSchema` in the patch config xml.
diff --git a/amps/ags/rm-community/documentation/README.md b/amps/ags/rm-community/documentation/README.md
deleted file mode 100644
index 8e5cf85337..0000000000
--- a/amps/ags/rm-community/documentation/README.md
+++ /dev/null
@@ -1,31 +0,0 @@
-## Community Technical Documentation Index
-
-* [Enterprise Technical Documentation](../../rm-enterprise/documentation/README.md) (the link will only work if this repository contains the enterprise code)
-* [Overview of the design of RM](overview.md)
-* Records Management
- * File Plan
- * List of Values
- * Records
- * EMail Records
- * Filed and Unfiled Records
- * Easy Access Records
- * Physical Records
- * Record Import and Export
- * [Version Records](./versionRecords)
- * Retention
- * [Destruction](./destruction)
- * Retention Schedules and Events
- * Transfer and Accession
-* Security
- * [Extended permission service](security/extendedPermissionService.md)
- * [Roles and Capabilities](security/rolesAndCapabilities.md)
-* Discovery
- * Governance Search
- * Legal Holds
-* Compliance
- * Governance Audit
- * Governance Rules
-* Core Module Services
- * [RM Patch Service](./PatchService.md)
-* Build and Release
- * [Build](./build)
diff --git a/amps/ags/rm-community/documentation/build/README.md b/amps/ags/rm-community/documentation/build/README.md
deleted file mode 100644
index 8a50c3219a..0000000000
--- a/amps/ags/rm-community/documentation/build/README.md
+++ /dev/null
@@ -1,6 +0,0 @@
-## GS Build 
-
-Build location: https://bamboo.alfresco.com/bamboo/browse/RM (not externally accessible.)
-
-Build Flow:
-
\ No newline at end of file
diff --git a/amps/ags/rm-community/documentation/build/resource/build.png b/amps/ags/rm-community/documentation/build/resource/build.png
deleted file mode 100644
index 902e37424b..0000000000
Binary files a/amps/ags/rm-community/documentation/build/resource/build.png and /dev/null differ
diff --git a/amps/ags/rm-community/documentation/build/resource/build.puml b/amps/ags/rm-community/documentation/build/resource/build.puml
deleted file mode 100644
index 7c56bef154..0000000000
--- a/amps/ags/rm-community/documentation/build/resource/build.puml
+++ /dev/null
@@ -1,66 +0,0 @@
-@startuml
-
-Title: Governance Services Build Pipeline (RM HEAD)
-
-'build plans:
-'Ent UI: Automated UI Tests Enterprise
-'Com API: Automation Community REST API
-'Ent API: Automation Enterprise REST API
-'Community
-'Com UI: Community Automated UI Tests
-'Enterprise
-'Ent L1: Enterprise Level 1 Automated UI Tests
-'Ent L2: Level 2 Automated UI Tests Enterprise
-'RM Benchmark Driver
-
-
-start
-
-if(Trigger) then (commit to path)
- if (rm-community/*)
- :Community;
- fork
- :Ent L1;
- fork again
- :Enterprise;
- fork
- :Ent L2;
- fork again
- :Ent UI;
- end fork
- end fork
- elseif (rm-enterprise/*)
- :Enterprise;
- fork
- :Ent L2;
- fork again
- :Ent UI;
- end fork
- elseif (rm-automation/*)
- fork
- :Ent L1;
- fork again
- :Ent L2;
- fork again
- :Ent UI;
- end fork
- stop
- elseif (rm-community-rest-api/*)
- :Com API;
- stop
- elseif (rm-enterprise-rest-api/*)
- :Ent API;
- stop
- elseif (rm-benchmark-driver/*)
- :Benchmark;
- stop
- else
- end
- endif
-else (Time: 1am)
- :Community UI;
- stop
-endif
-:Release Step;
-end
-@enduml
\ No newline at end of file
diff --git a/amps/ags/rm-community/documentation/destruction/README.md b/amps/ags/rm-community/documentation/destruction/README.md
deleted file mode 100644
index 67c3cd923a..0000000000
--- a/amps/ags/rm-community/documentation/destruction/README.md
+++ /dev/null
@@ -1,60 +0,0 @@
-## Destruction
-
-### Purpose
-
-Ensure the immediate and permanent destruction of sensitive content.
-
-This includes:
-
- * Records
- * Classified content
-
-### Overview
-
-Sensitive content is immediately deleted from the content store. It does not get added to the trashcan or any other recoverable location and as such should not be recoverable.
-
-It is possible to configure the component to include a cleansing step prior to content deletion. This allows the binary content to be repeatedly overwritten prior to deletion to make it harder to forensically recover the binary data.
-
-Recorded content can be explicitly destroyed whilst maintaining the original node and associated meta-data. This is configured as a characteristic of the destruction step within a retention schedule.
-
-### Artifacts and Guidance
-
-* Source Code Link: [GitHub](https://github.com/Alfresco/records-management)
-* License: Alfresco Community
-* Issue Tracker Link: [JIRA RM](https://issues.alfresco.com/jira/projects/RM/summary)
-* Contribution Model: Alfresco Closed Source
-* Documentation: [docs.alfresco.com (Records Management)](http://docs.alfresco.com/rm2.4/concepts/welcome-rm.html)
-
-***
-
-### Design
-
-#### Component Model
-
-#### Content Model
-
-* uri - http://www.alfresco.org/model/recordsmanagement/1.0
-* prefix - rma
-* rma:ghosted - aspect that indicates that a records content has been destroyed, but the records meta-data is still available.
-
-#### Flows
-
-
-
-#### Class Diagram
-
-
-
-***
-
-### Interfaces and APIs
-
-***
-
-### Configuration
-
-***
-
-### Considerations
-
-***
diff --git a/amps/ags/rm-community/documentation/destruction/resource/class/destruction-class.png b/amps/ags/rm-community/documentation/destruction/resource/class/destruction-class.png
deleted file mode 100644
index 1b8b0e3832..0000000000
Binary files a/amps/ags/rm-community/documentation/destruction/resource/class/destruction-class.png and /dev/null differ
diff --git a/amps/ags/rm-community/documentation/destruction/resource/class/destruction-class.puml b/amps/ags/rm-community/documentation/destruction/resource/class/destruction-class.puml
deleted file mode 100644
index f2377c0ffb..0000000000
--- a/amps/ags/rm-community/documentation/destruction/resource/class/destruction-class.puml
+++ /dev/null
@@ -1,43 +0,0 @@
-@startuml
-
-DestroyAction --> ContentDestructionComponent
-ContentDestructionComponent <|-- ExtendedContentDestructionComponent
-ContentDestructionComponent --> EagerContentStoreCleaner
-EagerContentStoreCleaner --> ContentCleanser
-ContentCleanser <|-- ContentCleanser522022M
-ContentCleanser +-- OverwriteOperation
-
-class DestroyAction {
- + boolean ghostingEnabled
-}
-
-class ContentDestructionComponent {
- + boolean cleansingEnabled
- + void destroyContent(NodeRef nodeRef)
- + void destroyContent(NodeRef nodeRef, boolean includeRenditions)
- + void registerAllContentForDestruction(NodeRef nodeRef, boolean clearContentProperty)
-}
-
-class ExtendedContentDestructionComponent {
- + void onBeforeNodeDelete(NodeRef nodeRef)
-}
-
-class EagerContentStoreCleaner {
- + void registerOrphanedContentUrlForCleansing(String contentUrl)
- # boolean deleteFromStore(String contentUrl, ContentStore store)
-}
-
-abstract class ContentCleanser {
- # OverwriteOperation overwriteZeros
- # OverwriteOperation overwriteOnes
- # OverwriteOperation overwriteRandom
- + {abstract} void cleanse(File file)
- # void overwrite(File file, OverwriteOperation overwriteOperation)
-}
-
-abstract class OverwriteOperation {
- + {abstract} void operation(OutputStream os) throws IOException
-}
-
-@enduml
-
diff --git a/amps/ags/rm-community/documentation/destruction/resource/sequence/destruction-sequence.png b/amps/ags/rm-community/documentation/destruction/resource/sequence/destruction-sequence.png
deleted file mode 100644
index 06d4fb4426..0000000000
Binary files a/amps/ags/rm-community/documentation/destruction/resource/sequence/destruction-sequence.png and /dev/null differ
diff --git a/amps/ags/rm-community/documentation/destruction/resource/sequence/destruction-sequence.puml b/amps/ags/rm-community/documentation/destruction/resource/sequence/destruction-sequence.puml
deleted file mode 100644
index 3dc04692c2..0000000000
--- a/amps/ags/rm-community/documentation/destruction/resource/sequence/destruction-sequence.puml
+++ /dev/null
@@ -1,40 +0,0 @@
-@startuml
-
-Title: Content Destruction and Cleansing Flow
-
-participant "Repository" as R
-participant "Behaviour" as B
-participant "ContentDestructionComponent" as CDC
-participant "EagerContentStoreCleaner" as ECSC
-participant ConentCleanser as CC
-participant ContentStore as CS
-
-R->B:beforeNodeDelete
-activate B
-
-note right of B: sensitive content
-B->CDC:registerAllContentForDestruction
-deactivate B
-activate CDC
-note right of CDC: cleansing enabled
-
-CDC->ECSC:registerOrphanedContentUrlForCleansing
-deactivate CDC
-activate ECSC
-
-ECSC->ECSC: registerOrphanedContentUrl
-
-R->ECSC:afterCommit
-
-ECSC->CC:cleanse
-activate CC
-CC->ECSC
-deactivate CC
-
-ECSC->CS:delete
-activate CS
-CS->ECSC
-deactivate CS
-deactivate ECSC
-
-@enduml
\ No newline at end of file
diff --git a/amps/ags/rm-community/documentation/overview.md b/amps/ags/rm-community/documentation/overview.md
deleted file mode 100644
index c5918e396a..0000000000
--- a/amps/ags/rm-community/documentation/overview.md
+++ /dev/null
@@ -1,77 +0,0 @@
-## Records Management Technical Overview
-
-
-
-
-
-### Purpose
-The Alfresco Records Management (RM) modules are installed on top of Alfresco Content Services and use a similar REST API and service architecture. This document provides an overview of the standard patterns that have been used throughout the RM modules.
-
-***
-
-### Overview
-RM is split into two main parts - a repository integration and a Share integration. The Share module communicates with the repository module using REST API calls. The repository module includes integration with the Alfresco database.
-
-***
-
-### Artifacts and Guidance
-
-* [Community Source Code](https://github.com/Alfresco/records-management)
-* [Enterprise Source Code](https://github.com/Alfresco/governance-services) (for partners and customers)
-* [Community License](../LICENSE.txt)
-* [Enterprise License](../../rm-enterprise/LICENSE.txt) (this file will only be present in clones of the Enterprise repository)
-* [Issue Tracker Link](https://issues.alfresco.com/jira/projects/RM)
-* [Community Documentation Link](http://docs.alfresco.com/rm-community/concepts/welcome-rm.html)
-* [Enterprise Documentation Link](http://docs.alfresco.com/rm/concepts/welcome-rm.html)
-* [Contribution Model](../../CONTRIBUTING.md)
-
-***
-
-### Prerequisite Knowledge
-An understanding of Alfresco Content Services is assumed. The following pages from the [developer documentation](http://docs.alfresco.com/5.2/concepts/dev-for-developers.html) give useful background information:
-
-* [ACS Architecture](http://docs.alfresco.com/5.2/concepts/dev-arch-overview.html)
-* [Platform Extensions](http://docs.alfresco.com/5.2/concepts/dev-platform-extensions.html)
-* [Share Extensions](http://docs.alfresco.com/5.2/concepts/dev-extensions-share.html)
-
-***
-
-### APIs and Interfaces
-The RM Share module communicates with the repository module via REST APIs. Internally the RM repository module uses a three layer model:
-
-* A REST API layer responsible for converting API requests into service calls.
-* A Java service layer responsible for handling business logic.
-* A DAO layer responsible for CRUD operations against the database.
-
-#### REST API
-The REST API endpoints fall into two main types - v0 (Webscripts) and v1. The [v0 API](http://docs.alfresco.com/5.2/references/dev-extension-points-webscripts.html) is older and not recommended for integrations. The [v1 API](http://docs.alfresco.com/5.1/pra/1/topics/pra-welcome-aara.html) is newer but isn't yet feature complete. If you are running RM locally then the GS API Explorer will be available at [this link](http://localhost:8080/gs-api-explorer/).
-
-Internally the GS v1 REST API is built on the [Alfresco v1 REST API framework](https://community.alfresco.com/community/ecm/blog/2016/10/11/v1-rest-api-part-1-introduction). It aims to be consistent with this in terms of behaviour and naming.
-
-#### Java Public API
-The Java service layer is fronted by a [Java Public API](http://docs.alfresco.com/5.2/concepts/java-public-api-list.html), which we will ensure backward compatible with previous releases. Before we remove any methods there will first be a release containing that method deprecated to allow third party integrations to migrate to a new method. The Java Public API also includes a set of POJO objects which are needed to communicate with the services. It is easy to identify classes that are part of the Java Public API as they are annotated `@AlfrescoPublicApi`.
-
-Each Java service will have at least four beans defined for it:
-
-* A 'lowerCase' inner bean, which is the actual service implementation.
-* An 'UpperCase' wrapper bean, which includes security and transaction management. This is the bean that should be used by third party integrations.
-* A bean to handle transactions on the service methods.
-* A bean to handle security restricting who can call different service methods.
-
-#### DAOs
-The DAOs are not part of the Java Public API, but handle CRUD operations against RM stored data. We have some custom queries to improve performance for particularly heavy operations.
-
-We use standard Alfresco [data modelling](http://docs.alfresco.com/5.2/references/dev-extension-points-content-model.html) to store RM metadata. We extend the [Alfresco patching mechanism](http://docs.alfresco.com/5.2/references/dev-extension-points-patch.html) to provide community and enterprise schema upgrades.
-
-***
-
-### Component Overview
-
-
-***
-
-### Design Decisions
-
-| Decision | Rationale | Date |
-| --------------- |:--------------------------:| ------------:|
-| | | |
diff --git a/amps/ags/rm-community/documentation/resource/class/governance-services.png b/amps/ags/rm-community/documentation/resource/class/governance-services.png
deleted file mode 100644
index f682a9d1eb..0000000000
Binary files a/amps/ags/rm-community/documentation/resource/class/governance-services.png and /dev/null differ
diff --git a/amps/ags/rm-community/documentation/resource/class/governance-services.puml b/amps/ags/rm-community/documentation/resource/class/governance-services.puml
deleted file mode 100644
index 2dda190d31..0000000000
--- a/amps/ags/rm-community/documentation/resource/class/governance-services.puml
+++ /dev/null
@@ -1,308 +0,0 @@
-@startuml
-
-'Core ACS entities
-
-package "ACS core - content" {
-
- class Content {
- }
-
- class Folder {
- }
-
- class File {
- }
-
- class Site {
- }
-
-}
-
-package "RM Core" {
-
- class FilePlanComponent {
- rootNodeRef: NodeRef
- }
-
- class RecordsManagementContainer {
- recordComponentIdentifier: String
- }
-
- class RmSite {
- }
-
- class FilePlan {
- }
-
- class RecordCategory {
- }
-
- class RecordFolder {
- recordComponentIdentifier: String
- }
-
- class Record {
- recordComponentIdentifier: String
- dateFiled: Date
- originalName: String
- location: String
- }
-
- class DodRecord {
- publicationDate: Date
- originator: String
- originatingOrganization: String
- mediaType: String
- format: String
- dateReceived: Date
- address: String
- otherAddress: String
- }
-
- class NonElectronicRecord {
- physicalSize: Int
- numberOfCopies: Int
- storageLocation: String
- shelf: String
- box: String
- file: String
- }
-
- class EasyAccessRecord {
- }
-
- class UnfiledRecordContainer {
- }
-
- class UnfiledRecordFolder {
- }
-
-}
-
-package "ACS core - people" {
-
- class User {
- }
-
- class Group {
- }
-}
-
-package "RM Roles and Capabilities" {
- class Role {
- }
-
- class Capability {
- name:String
- }
-
-}
-
-package "Information Lifecycle Management" {
-
- class TransferContainer {
- }
-
- class Transfer {
- location : String
- pdfIndicator : boolean
- }
-
- class RetentionSchedule {
- authority: String
- instructions: String
- recordLevelDisposition: Boolean
- }
-
- class DispositionActionDefinition {
- dispositionActionName: String
- dispositionDescription: String
- dispositionLocation: String
- dispositionPeriod: Period
- dispositionPeriodProperty: String
- dispositionEvent: String
- dispositionEventCombination: String
- combineDispositionStepConditions: String
- }
-
- class DispositionEvent {
- }
-
- class DispositionLifecycle {
- }
-
- class DispositionAction {
- dispositionActionId: String
- dispositionAction: String
- dispositionAsOf: Date
- manuallySetAsOf: Date
- dispositionEventsEligible: Boolean
- dispositionActionStartedAt: Date
- dispositionActionStartedBy: String
- dispositionActionCompletedAt: Date
- dispositionActionCompletedBy: String
- }
-
- class EventExecution {
- }
-
-}
-
-note bottom of RetentionSchedule {
- Retention is the new name for disposition.
- Retention is the user facing name,
- code refers to disposition
-}
-
-note bottom of Transfer {
- A holding pen for records
- that are being transferred
- out of the system
-}
-
-package "Legal Holds" {
- class HoldContainer {
- }
-
- class Hold {
- holdReason: String
- }
-
- class Frozen {
- frozenAt: Date
- frozenBy: String
- }
-
-}
-
-package "Security Controls" {
-
- class SecurityGroup <> {
- enum groupType
- {HIERARCHICAL,
- USER_REQUIRES_ANY,
- USER_REQUIRES_ALL}
- unmarkedMark: SecurityMark
- }
-
- class SecurityMark <> {
- }
-
- class SecurityClassification <> {
- }
-
- class ClassificationReason <> {
- }
-
- class ClassificationExemption <> {
- }
-
- class ClassificationInfo <> {
- classification: SecurityClassification
- reason:ClassificationReason[]
- classifiedBy: String
- agency:String
- }
-
- class SourceReference <> {
- name:String
- originatingOrg:String
- publicationDate:Date
- }
-
- class DowngradeSchedule <> {
- date:Date
- event:String
- instructions:String
- }
-
- class DeclassificationSchedule <> {
- date:Date
- event:String
- exemption:Exemption[]
- }
-
- class ClassificationGuide <> {
- }
-
- class DeclassificationTimeframe <> {
- }
-}
-
-Content <|-- Folder
-Content <|-- File
-
-File <|-- Record
-Folder <|-- RecordFolder
-
-Site <|-- RmSite
-
-Record <|- EasyAccessRecord
-Folder "1" o-- "*" EasyAccessRecord
-
-Record <|-- DodRecord
-
-FilePlanComponent <|-- RecordsManagementContainer
-FilePlanComponent <|-- RecordFolder
-FilePlanComponent <|-- NonElectronicRecord
-FilePlanComponent <|-- Record
-RecordsManagementContainer <|-- Hold
-RecordsManagementContainer <|-- UnfiledRecordContainer
-RecordsManagementContainer <|-- HoldContainer
-RecordsManagementContainer <|-- TransferContainer
-RecordsManagementContainer <|-- FilePlan
-RecordsManagementContainer <|-- RecordCategory
-
-RecordCategory "1" *- "*" RecordFolder
-RecordCategory *- "*" RecordCategory
-
-note bottom of RecordCategory {
- A RecordCategory may contain either RecordFolders or
- RecordCategories but not both. A RecordCategory may only exist
- as the child of either another RecordCategory or the FilePlan
-}
-
-RecordFolder *- "*" Record : contains
-RecordFolder *-- "*" NonElectronicRecord : contains
-
-UnfiledRecordContainer *-- "*" UnfiledRecordFolder
-UnfiledRecordFolder *-- "*" Record
-
-FilePlan *- "*" RecordsManagementContainer
-FilePlan "1" *- "*" RecordCategory
-
-RmSite "1" *- "1" FilePlan
-
-Hold "*" o- "*" FilePlanComponent : contains
-HoldContainer *- "*" Hold
-(FilePlanComponent, Hold) .. Frozen
-
-TransferContainer *- "*" Transfer
-Transfer *- "*" Record
-
-DispositionLifecycle o- "0..1" DispositionAction: nextDispositionAction
-DispositionLifecycle o- "*" DispositionAction: dispositionActionHistory
-
-RetentionSchedule o- "*" DispositionActionDefinition
-RetentionSchedule o- "*" FilePlanComponent
-
-DispositionAction O-- "*" EventExecution
-
-Role o- "*" Capability
-User o- "*" Role
-Group o- "*" Role
-
-Content o-- "*" SecurityMark : securityControls
-User o-- "*" SecurityMark : clearance
-Group o-- "*" SecurityMark : clearance
-
-SecurityGroup "1" *- "*" SecurityMark
-SecurityMark <|-- SecurityClassification
-Content o- "0..1" SecurityClassification
-
-(Content, SecurityClassification) .. ClassificationInfo
-
-ClassificationInfo *-- "*" SourceReference
-ClassificationInfo *-- "0..1" DowngradeSchedule
-
-@enduml
\ No newline at end of file
diff --git a/amps/ags/rm-community/documentation/resource/component/ig-component.png b/amps/ags/rm-community/documentation/resource/component/ig-component.png
deleted file mode 100644
index 788642c604..0000000000
Binary files a/amps/ags/rm-community/documentation/resource/component/ig-component.png and /dev/null differ
diff --git a/amps/ags/rm-community/documentation/resource/component/ig-component.puml b/amps/ags/rm-community/documentation/resource/component/ig-component.puml
deleted file mode 100644
index 1c446ccb46..0000000000
--- a/amps/ags/rm-community/documentation/resource/component/ig-component.puml
+++ /dev/null
@@ -1,58 +0,0 @@
-@startuml
-
-skinparam componentArrowColor white
-
-' IG Component Breakdown
-rectangle "Information Governance" as IG {
-
- rectangle "Records Management" as RM {
-
- component "File Plan" as FP
-
- rectangle "Records" as Rec {
- component "Filed and Unfiled Records"
- component "Easy Access Records"
- component "Version Records"
- component "Physical Records"
- component "Email Records"
- component "Record Import and Export"
- }
-
- rectangle "Retention" as Ret {
- component "Retention Schedules and Events"
- component "Transfer and Accession"
- component "Destruction"
- }
- component "List of Values" as LOV
- }
-
- rectangle "Security" as Sec {
- component "Roles, Capabilities and Permissions"
- component "Security Marks"
- component "Content Classification"
- }
-
- rectangle "Discovery" as Dis {
- component "Search"
- component "Legal Holds"
- }
-
- rectangle "Compliance" as Comp {
- component "Audit"
- component "DoD 5015.2"
- }
-
- rectangle "Automation" as Auto {
- component "Rules"
- }
-}
-
-' Fomatting
-RM -[hidden]---- Sec
-RM -[hidden]---- Dis
-Dis -[hidden]- Comp
-Rec -[hidden]-- Ret
-FP -[hidden]- LOV
-Sec -[hidden]-- Auto
-
-@enduml
\ No newline at end of file
diff --git a/amps/ags/rm-community/documentation/resource/image/CapabilitiesAndRoles.png b/amps/ags/rm-community/documentation/resource/image/CapabilitiesAndRoles.png
deleted file mode 100644
index 606a7d3a73..0000000000
Binary files a/amps/ags/rm-community/documentation/resource/image/CapabilitiesAndRoles.png and /dev/null differ
diff --git a/amps/ags/rm-community/documentation/security/extendedPermissionService.md b/amps/ags/rm-community/documentation/security/extendedPermissionService.md
deleted file mode 100644
index abc7d4a7d5..0000000000
--- a/amps/ags/rm-community/documentation/security/extendedPermissionService.md
+++ /dev/null
@@ -1,68 +0,0 @@
-## Alfresco Governance Services' Extended Permission Service
-
-
-
-
-
-### Purpose
-
-When working on the Records Management module, we needed additional functionality around permissions, and therefore
-introduced the [ExtendedPermissionService](../../rm-community/rm-community-repo/source/java/org/alfresco/repo/security/permissions/impl/ExtendedPermissionServiceImpl.java).
-
-### Overview
-
-The ExtendedPermissionService is wired in, via [Spring config](../../rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/extended-repository-context.xml),
-to extend Alfresco's core PermissionService, and adds support for:
-* the [RMPermissionModel](../../rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/RMPermissionModel.java), which defines the available permissions capabilities.
-* the [PermissionProcessorRegistry](../../rm-community/rm-community-repo/source/java/org/alfresco/repo/security/permissions/processor/PermissionProcessorRegistry.java), which introduces pre- and post- processors.
-* other minor method extensions (e.g. to setInheritParentPermissions)
-
-### Permission Processor Registry
-
-This was added in RM 2.4 to support the requirements around the additional security classifications and markings.
-
-The registry is simply two array lists, one for pre-processors and one for post-processors, which are iterated around
-before / after (respectively) the wrapped call PermissionService.hasPermission
-
-Out of the box, a system with the RM module installed will have the following permissions processors defined:
-
-#### Community:
-
-##### Pre-processors:
-* None.
-
-##### Post-processors:
-* [RecordsManagementPermissionPostProcessor](../../rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/permission/RecordsManagementPermissionPostProcessor.java)
- * If the node is an RM node (i.e. it has the [RecordsManagementModel.ASPECT_FILE_PLAN_COMPONENT](../../rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/model/RecordsManagementModel.java) marker aspect) and the
- core permissions evaluates to DENIED, then this post processor allows read/writes if the appropriate read/file
- permissions are present.
-
-#### Enterprise:
-(links only work in clones of Enterprise repos)
-
-##### Pre-processors:
-* [SecurityMarksPermissionPreProcessor](../../rm-enterprise/rm-enterprise-repo/src/main/java/org/alfresco/module/org_alfresco_module_rm/securitymarks/permission/SecurityMarksPermissionPreProcessor.java)
- * For all content: denies the result if the required security clearance rules (for classification or marks) are not satisfied. (uses
-[securityClearanceService.isClearedFor](../../rm-enterprise/rm-enterprise-repo/src/main/java/org/alfresco/module/org_alfresco_module_rm/securitymarks/SecurityClearanceServiceImpl.java))
-
-##### Post-processors:
-* None.
-
-
-### Configuration and Extension points
-
-Additional processors can be defined by extending either [PermissionPreProcessorBaseImpl](../../rm-community/rm-community-repo/source/java/org/alfresco/repo/security/permissions/processor/impl/PermissionPreProcessorBaseImpl.java)
-or [PermissionPostProcessorBaseImpl](../../rm-community/rm-community-repo/source/java/org/alfresco/repo/security/permissions/processor/impl/PermissionPostProcessorBaseImpl.java)
-which call the add method on the appropriate list during init.
-
-### Performance Implications
-
-There is certainly a performance overhead when adding additional processing to permission checks. This is most noticeable
- in the SecurityMarksPermissionPreProcessor where we need to call out to an external service. This has been profiled
- heavily and optimised during 2.5 and 2.6 development.
-
- ###TODO:
- Not yet documented (in related areas of the code) are:
- * Capabilities (see rm-capabilities-*.xml, declarativeCapability.java and DeclarativeCompositeCapability.java)
- * RM's permission system has an any allow allows policy unlike alfresco which policy is any deny denies
-
\ No newline at end of file
diff --git a/amps/ags/rm-community/documentation/security/rolesAndCapabilities.md b/amps/ags/rm-community/documentation/security/rolesAndCapabilities.md
deleted file mode 100644
index c3372d5b1c..0000000000
--- a/amps/ags/rm-community/documentation/security/rolesAndCapabilities.md
+++ /dev/null
@@ -1,41 +0,0 @@
-## Alfresco Governance Services' Roles and Capabilities
-
-
-
-
-
-### Purpose
-
-Roles and capabilities allow the GS system to provide a finer grain security evaluation, determining whether an authority has the capability to perform a perticular action on a node.
-
-### Overview
-
-Roles are defined as a collection of capabilities. A capability, generally, has a one to one relationship with an action within the system.
-
-Authorities are assigned roles. If an authority is assigned to a role then it that authority has the capabilities contained within that role, allowing them to perform the related actions.
-
-An authority can be assigned many roles, with the associated capabilities being additive.
-
-Capabilties are evaluated in addition to any ACLs attached to a node, but they are mutally exclusive. A authority may have the capability, but not the permissions on a node and vice versa.
-
-### Design
-
-Roles are implementented as groups. So for every role that is created, there is a corresponding group within the system.
-
-Capabilities are implemented as permissions. In order add a new capability to the system, the extended RM permission model needs to be extended.
-
-When a capability is added to a role, then the capability group is assigned the capability role on the root file plan node.
-
-In this way the permissions of the systems roles reflect their capabilities on the file plan via the capability permissions assigned.
-
-When an authority is assigned to a role, that authority is added as a member of the corresponding role group. In this way they inherit the capability permissions on the file plan that relate to that role group.
-
-If a user attempts to perform an action on a records management artifact which has a related capability. Assuming the user has permission to see the artifact in the first place, then the users capability to perform the action is evaluated.
-
-This is done by firstly determining whether the capability is relevant for this 'kind' of records management artifact. For example the addHold capability is not relevant for a record category.
-
-Then the capability permission is evaluated by traversing to the file plan node and checking whether the current user has the capabilty permission byt virtue of it's membership of the right role group.
-
-Finally any further conditions attached to the capability are evaluated.
-
-
\ No newline at end of file
diff --git a/amps/ags/rm-community/documentation/versionRecords/README.md b/amps/ags/rm-community/documentation/versionRecords/README.md
deleted file mode 100644
index 405827ed13..0000000000
--- a/amps/ags/rm-community/documentation/versionRecords/README.md
+++ /dev/null
@@ -1,20 +0,0 @@
-## Version Records 
-
-### Notes:
-
-NodesService varies depending on store. Version Service has a different service that hydrates effectively fake nodes (which contain url, version details, associations, aspects, as denormalised meta data) back into a full node
-
-Recorded Versions take content out of version store and create a record by version store implementation extension.
-
-Declaring record as version - standard use case is auto declaring or via records. Head version is extracted to a record, rather than a new version being created
-
-Records are linked by association
-
-Disposition events can be triggered automatically from versioning events.
-
-### Diagram:
-
-
-
-
-
diff --git a/amps/ags/rm-community/documentation/versionRecords/RecordedVersions.png b/amps/ags/rm-community/documentation/versionRecords/RecordedVersions.png
deleted file mode 100644
index 7ac208b9e2..0000000000
Binary files a/amps/ags/rm-community/documentation/versionRecords/RecordedVersions.png and /dev/null differ
diff --git a/amps/ags/rm-community/pom.xml b/amps/ags/rm-community/pom.xml
deleted file mode 100644
index c154e185f1..0000000000
--- a/amps/ags/rm-community/pom.xml
+++ /dev/null
@@ -1,23 +0,0 @@
-
- 4.0.0
- alfresco-governance-services-community-repo-parent
- pom
- Alfresco Governance Services Community
-
-
- org.alfresco
- alfresco-governance-services-community-parent
- 11.28-SNAPSHOT
-
-
-
- rm-community-rest-api-explorer
- rm-community-repo
-
-
-
-
- LGPL 3
-
-
-
diff --git a/amps/ags/rm-community/rm-community-repo/.env b/amps/ags/rm-community/rm-community-repo/.env
deleted file mode 100644
index bf5f645726..0000000000
--- a/amps/ags/rm-community/rm-community-repo/.env
+++ /dev/null
@@ -1,4 +0,0 @@
-TRANSFORMERS_TAG=2.3.10
-SOLR6_TAG=2.0.1
-POSTGRES_TAG=13.1
-ACTIVEMQ_TAG=5.16.1
diff --git a/amps/ags/rm-community/rm-community-repo/.maven-dockerignore b/amps/ags/rm-community/rm-community-repo/.maven-dockerignore
deleted file mode 100644
index 112bd18249..0000000000
--- a/amps/ags/rm-community/rm-community-repo/.maven-dockerignore
+++ /dev/null
@@ -1 +0,0 @@
-target/docker/
\ No newline at end of file
diff --git a/amps/ags/rm-community/rm-community-repo/Dockerfile b/amps/ags/rm-community/rm-community-repo/Dockerfile
deleted file mode 100644
index 751002a18b..0000000000
--- a/amps/ags/rm-community/rm-community-repo/Dockerfile
+++ /dev/null
@@ -1,30 +0,0 @@
-### Apply AGS community repo AMP to ACS image
-FROM alfresco/alfresco-community-repo-base:${image.tag}
-
-# Alfresco user does not have permissions to modify webapps or configuration. Switch to root.
-# The access will be fixed after all operations are done.
-USER root
-
-COPY target/alfresco-governance-services-community-repo-*.amp /usr/local/tomcat/amps/
-COPY target/alfresco-share-services-*.amp /usr/local/tomcat/amps/
-
-# Install amps on alfresco.war
-RUN java -jar /usr/local/tomcat/alfresco-mmt/alfresco-mmt*.jar install \
- /usr/local/tomcat/amps \
- /usr/local/tomcat/webapps/alfresco -directory -nobackup
-
-### Copy gs-api-explorer war into webapps folder
-COPY target/gs-api-explorer-*.war /usr/local/tomcat/webapps/
-
-### Unpack gs-api-explorer.war
-RUN mkdir /usr/local/tomcat/webapps/gs-api-explorer && cd /usr/local/tomcat/webapps/gs-api-explorer && \
- jar -xvf /usr/local/tomcat/webapps/gs-api-explorer-*.war && rm -f /usr/local/tomcat/webapps/gs-api-explorer-*.war
-
-# All files in the tomcat folder must be owned by root user and Alfresco group as mentioned in the parent Dockerfile
-RUN chgrp -R Alfresco /usr/local/tomcat && \
- find /usr/local/tomcat/webapps -type d -exec chmod 0750 {} \; && \
- find /usr/local/tomcat/webapps -type f -exec chmod 0640 {} \; && \
- chmod -R g+r /usr/local/tomcat/webapps
-
-# Switching back to alfresco user after having added amps files to run the container as non-root
-USER alfresco
diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/extension/subsystems/imap/default/default/rm-imap-server-context.xml b/amps/ags/rm-community/rm-community-repo/config/alfresco/extension/subsystems/imap/default/default/rm-imap-server-context.xml
deleted file mode 100644
index 16728d43c7..0000000000
--- a/amps/ags/rm-community/rm-community-repo/config/alfresco/extension/subsystems/imap/default/default/rm-imap-server-context.xml
+++ /dev/null
@@ -1,18 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/action-context.xml b/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/action-context.xml
deleted file mode 100644
index e7358d2770..0000000000
--- a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/action-context.xml
+++ /dev/null
@@ -1,62 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
- {http://www.alfresco.org/model/content/1.0}content
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- {http://www.alfresco.org/model/content/1.0}content
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/alfresco-global.properties b/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/alfresco-global.properties
deleted file mode 100644
index a669cf8351..0000000000
--- a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/alfresco-global.properties
+++ /dev/null
@@ -1,137 +0,0 @@
-# Enable ghosting of records on deletion
-rm.ghosting.enabled=true
-
-# Notification configuration
-rm.notification.role=RecordsManager
-# NOTE: the notification subject can now be set within the usual I18N property files per notification template
-
-#
-# Turn off imap server attachments if we are using RM.
-# TODO : Longer term needs to have a query based, dynamic
-# exclusion for RM sites.
-#
-imap.server.attachments.extraction.enabled=false
-
-#
-# Enable auditing
-#
-audit.enabled=true
-audit.rm.enabled=true
-audit.rm.viewLog.maxSize=100
-#audit.rm.runas=admin
-
-#audit.filter.alfresco-access.transaction.user=~null;.*
-
-#
-# Extended permission service cache sizing
-#
-cache.writersSharedCache.maxItems=10000
-cache.writersSharedCache.cluster.type=fully-distributed
-
-#
-#A cache for the json Conversion Component cache
-#
-cache.jsonConversionComponentCache.cluster.type=fully-distributed
-cache.jsonConversionComponentCache.tx.maxItems=50
-cache.jsonConversionComponentCache.tx.statsEnabled=${caches.tx.statsEnabled}
-cache.jsonConversionComponentCache.maxItems=0
-cache.jsonConversionComponentCache.timeToLiveSeconds=0
-cache.jsonConversionComponentCache.maxIdleSeconds=0
-cache.jsonConversionComponentCache.backup-count=1
-cache.jsonConversionComponentCache.eviction-policy=NONE
-cache.jsonConversionComponentCache.merge-policy=com.hazelcast.map.merge.PutIfAbsentMapMergePolicy
-cache.jsonConversionComponentCache.nearCache.maxSize=50
-cache.jsonConversionComponentCache.nearCache.maxIdleSeconds=0
-cache.jsonConversionComponentCache.nearCache.timeToLiveSeconds=0
-cache.jsonConversionComponentCache.readBackupData=false
-
-#
-# Indicates whether RM rules will be run as Admin or not by default
-#
-rm.rule.runasadmin=true
-
-#
-# Auto-complete suggestion parameters
-#
-# The minimum size of fragment supplied that will trigger a search for suggestions for auto completion
-rm.autocompletesuggestion.minfragmentsize=2
-# The maximum number of path suggestions to supply
-rm.autocompletesuggestion.maxsuggestions.path=5
-# The maximum number of node suggestions to supply
-rm.autocompletesuggestion.maxsuggestions.node=5
-# The maximum number of date suggestions to supply
-rm.autocompletesuggestion.maxsuggestions.date=5
-# Comma separated list of types/aspects to be used by the node parameter autocomplete suggester
-rm.autocompletesuggestion.nodeParameterSuggester.aspectsAndTypes=rma:record,cm:content
-
-#
-# Global RM retention lifecycle trigger cron job expression
-#
-rm.dispositionlifecycletrigger.cronexpression=0 0/5 * * * ?
-
-#
-# Global RM retention lifecycle cron job execution batch size
-#
-rm.dispositionlifecycletrigger.batchsize=500
-
-#
-# Global RM notify of records due for review cron job expression
-#
-rm.notifyOfRecordsDueForReview.cronExpression=0 0/15 * * * ?
-
-#
-# Records contributors group
-#
-# if false then record contributor check is ignored and all users can contribute records from
-# a collaboration site, if true then a user must be a member of the records contributor group
-# in order for them to contribute a record from a collaboration site. Default value 'false'.
-rm.record.contributors.group.enabled=false
-# record contributors group, default value 'RECORD_CONTRIBUTORS'
-rm.record.contributors.group.name=RECORD_CONTRIBUTORS
-
-#
-# Content cleansing
-#
-rm.content.cleansing.enabled=false
-rm.content.cleaner=contentCleanser.522022M
-
-# Indicates whether mandatory properties are checked before completing a record
-#
-rm.completerecord.mandatorypropertiescheck.enabled=true
-
-#
-# Indicates whether the existing file plan is converted to a standard file plan during
-# upgrade to V2.2, otherwise it will be converted to a DoD compliant file plan.
-#
-# Note that when converted to a standard file plan that DoD related record meta-data remains
-# on the individual records and will not be visible in the UI, but can be assessed via
-# deprecated model properties in the rma namespace.
-#
-rm.patch.v22.convertToStandardFilePlan=false
-
-# Permission mapping
-# these take a comma separated string of permissions from org.alfresco.service.cmr.security.PermissionService
-# read maps to ReadRecords and write to FileRecords
-rm.haspermissionmap.read=ReadProperties,ReadChildren
-rm.haspermissionmap.write=WriteProperties,AddChildren
-
-#
-# Extended auto-version behaviour. If true and other auto-version properties are satisfied, then
-# a document will be auto-versioned when its type is changed.
-#
-version.store.enableAutoVersionOnTypeChange=false
-
-#
-# Enable auto-version to be created when there is a difference between the document and latest record state
-# to ensure that the created version record matches the current document state,
-# otherwise create the version record from the version history
-#
-rm.enableAutoVersionOnRecordCreation=false
-
-#
-# Metadata Extraction
-#
-content.metadata.async.extract.6.enabled=false
-
-# Max number of entries returned in Record search view
-rm.recordSearch.maxItems=500
diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/audit/rm-audit.xml b/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/audit/rm-audit.xml
deleted file mode 100644
index 7e8cfc0eb6..0000000000
--- a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/audit/rm-audit.xml
+++ /dev/null
@@ -1,90 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/bootstrap/RMDataDictionaryBootstrap.xml b/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/bootstrap/RMDataDictionaryBootstrap.xml
deleted file mode 100644
index 38fd599a62..0000000000
--- a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/bootstrap/RMDataDictionaryBootstrap.xml
+++ /dev/null
@@ -1,251 +0,0 @@
-
-
-
-
-
-
- workspace
- SpacesStore
- rm_config_folder
- Records Management
- Records Management
- Configuration information for the Records Management application.
-
-
-
-
-
-
-
-
-
-
- workspace
- SpacesStore
- rm_event_config
- Records management event configuration.
- contentUrl=classpath:alfresco/module/org_alfresco_module_rm/bootstrap/content/rmEventConfigBootstrap.json|mimetype=text/plain|encoding=UTF-8
- rm_event_config.json
- rm_event_config.json
-
-
-
-
-
-
-
-
- workspace
- SpacesStore
- records_management_custom_model
- Records Management Custom Model
- contentUrl=classpath:alfresco/module/org_alfresco_module_rm/bootstrap/content/recordsCustomModel.xml|mimetype=text/plain|encoding=UTF-8
- recordsCustomModel.xml
- recordsCustomModel.xml
- {http://www.alfresco.org/model/rmcustom/1.0}rmcustom
- Records Management Custom Model
- Alfresco
- 1.0
- true
-
-
-
-
-
- workspace
- SpacesStore
- rm_behavior_scripts
- Records Management Behavior Scripts
- Records Management Behavior Scripts
- Scripts intended for execution in response to RM events.
-
-
-
-
-
-
-
-
-
- workspace
- SpacesStore
- Records management sample script.
- contentUrl=classpath:alfresco/module/org_alfresco_module_rm/bootstrap/content/onCreate_supersedes.js|mimetype=text/javascript|encoding=UTF-8
- onCreate_supersedes.js
- onCreate_supersedes.js
-
-
-
-
-
-
-
-
- workspace
- SpacesStore
- rm_scripts
- Records Management Scripts
- Records Management Scripts
- Scripts specific to RM that can also be executed by RM rules.
-
-
-
-
-
- workspace
- SpacesStore
- records_management_email_templates
- Records Management Email Templates
- Records Management Email Templates
- Email templates for records management.
-
-
-
-
-
-
-
-
-
-
-
-
- true
-
- Email template for notify records due for review job.
- contentUrl=classpath:alfresco/module/org_alfresco_module_rm/bootstrap/content/notify-records-due-for-review-email.ftl|mimetype=text/plain|size=|encoding=UTF-8|locale=en_US_
- notify-records-due-for-review-email.ftl
-
- notify-records-due-for-review-email.ftl
- org_alfresco_module_rm_notificationTemplatePatch
-
-
-
-
-
-
-
-
-
-
- workspace
- SpacesStore
- record_superseded_template
- Record superseded email template.
- contentUrl=classpath:alfresco/module/org_alfresco_module_rm/bootstrap/content/record-superseded-email.ftl|mimetype=text/plain|encoding=UTF-8
- record-superseded-email.ftl
- record-superseded-email.ftl
- org_alfresco_module_rm_notificationTemplatePatch
-
-
-
-
-
-
-
-
-
- workspace
- SpacesStore
- record_rejected_template
- Record rejected email template.
- contentUrl=classpath:alfresco/module/org_alfresco_module_rm/bootstrap/content/record-rejected-email.ftl|mimetype=text/plain|encoding=UTF-8
- record-rejected-email.ftl
- record-rejected-email.ftl
- org_alfresco_module_rm_notificationTemplatePatch
-
-
-
-
-
-
-
-
- workspace
- SpacesStore
- rm_report_templates
- Records Management Report Templates
- Records Management Report Templates
- Records management report templates.
-
-
-
-
-
-
-
-
-
- workspace
- SpacesStore
- rmr_destructionReport
- Desruction report template.
- contentUrl=classpath:alfresco/module/org_alfresco_module_rm/bootstrap/report/report_rmr_destructionReport.html.ftl|mimetype=text/plain|encoding=UTF-8
- Destruction Report Template
- report_rmr_destructionReport.html.ftl
-
-
-
-
-
-
-
-
-
-
- workspace
- SpacesStore
- rmr_transferReport
- Transfer report template.
- contentUrl=classpath:alfresco/module/org_alfresco_module_rm/bootstrap/report/report_rmr_transferReport.html.ftl|mimetype=text/plain|encoding=UTF-8
- Transfer Report Template
- report_rmr_transferReport.html.ftl
-
-
-
-
-
-
-
-
-
-
- workspace
- SpacesStore
- rmr_holdReport
- Hold report template.
- contentUrl=classpath:alfresco/module/org_alfresco_module_rm/bootstrap/report/report_rmr_holdReport.html.ftl|mimetype=text/plain|encoding=UTF-8
- Hold Report Template
- report_rmr_holdReport.html.ftl
-
-
-
-
-
-
-
-
-
-
-
diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/bootstrap/content/notify-records-due-for-review-email.ftl b/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/bootstrap/content/notify-records-due-for-review-email.ftl
deleted file mode 100644
index fd8dae9589..0000000000
--- a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/bootstrap/content/notify-records-due-for-review-email.ftl
+++ /dev/null
@@ -1,150 +0,0 @@
-<#--
- #%L
- Alfresco Records Management Module
- %%
- Copyright (C) 2005 - 2021 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%
--->
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Records due for review.
-
-
- ${date?datetime?string.full}
-
-
-
-
-
-
Hi,
-
-
The following records are now due for review:
-
- <#if (args.records)??>
-
- <#list args.records as record>
-
-
-