-{
-
-}
diff --git a/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/model/fileplancomponents/ReviewPeriod.java b/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/model/fileplancomponents/ReviewPeriod.java
deleted file mode 100644
index c96a2bc9f9..0000000000
--- a/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/model/fileplancomponents/ReviewPeriod.java
+++ /dev/null
@@ -1,45 +0,0 @@
-package org.alfresco.rest.rm.model.fileplancomponents;
-
-/**
- * POJO for the review period
- *
- * @author Rodica Sutu
- * @since 2.6
- */
-public class ReviewPeriod
-{
- private String periodType;
- private String expression;
-
- /**
- * @return the periodType
- */
- public String getPeriodType()
- {
- return this.periodType;
- }
-
- /**
- * @param periodType the periodType to set
- */
- public void setPeriodType(String periodType)
- {
- this.periodType = periodType;
- }
-
- /**
- * @return the expression
- */
- public String getExpression()
- {
- return this.expression;
- }
-
- /**
- * @param expression the expression to set
- */
- public void setExpression(String expression)
- {
- this.expression = expression;
- }
-}
diff --git a/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/model/site/RMSite.java b/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/model/site/RMSite.java
deleted file mode 100644
index 08846558f9..0000000000
--- a/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/model/site/RMSite.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * #%L
- * Alfresco Records Management Module
- * %%
- * Copyright (C) 2005 - 2016 Alfresco Software Limited
- * %%
- * License rights for this program may be obtained from Alfresco Software, Ltd.
- * pursuant to a written agreement and any use of this program without such an
- * agreement is prohibited.
- * #L%
- */
-package org.alfresco.rest.rm.model.site;
-
-import com.fasterxml.jackson.annotation.JsonProperty;
-
-import org.alfresco.rest.model.RestSiteModel;
-
-/**
- * POJO for RM Site component
- *
- * @author Rodica Sutu
- * @since 2.6
- */
-public class RMSite extends RestSiteModel
-{
- @JsonProperty (required = true)
- private RMSiteCompliance compliance;
-
- /**
- * Helper method to set RM site compliance
- *
- * @param compliance {@link RMSiteCompliance} the compliance to set
- */
- public void setCompliance(RMSiteCompliance compliance)
- {
- this.compliance = compliance;
- }
-
- /**
- * Helper method to get RM site compliance
- *
- * @return compliance the RM Site compliance to get
- */
- public RMSiteCompliance getCompliance()
- {
- return compliance;
- }
-}
diff --git a/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/model/site/RMSiteCompliance.java b/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/model/site/RMSiteCompliance.java
deleted file mode 100644
index 96b16a678d..0000000000
--- a/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/model/site/RMSiteCompliance.java
+++ /dev/null
@@ -1,24 +0,0 @@
-/*
- * #%L
- * Alfresco Records Management Module
- * %%
- * Copyright (C) 2005 - 2016 Alfresco Software Limited
- * %%
- * License rights for this program may be obtained from Alfresco Software, Ltd.
- * pursuant to a written agreement and any use of this program without such an
- * agreement is prohibited.
- * #L%
- */
-package org.alfresco.rest.rm.model.site;
-
-/**
- * RM Site compliance
- *
- * @author Tuna Aksoy
- * @since 2.6
- */
-public enum RMSiteCompliance
-{
- STANDARD,
- DOD5015
-}
diff --git a/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/model/site/RMSiteFields.java b/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/model/site/RMSiteFields.java
deleted file mode 100644
index 4dd9cf918d..0000000000
--- a/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/model/site/RMSiteFields.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * #%L
- * Alfresco Records Management Module
- * %%
- * Copyright (C) 2005 - 2016 Alfresco Software Limited
- * %%
- * License rights for this program may be obtained from Alfresco Software, Ltd.
- * pursuant to a written agreement and any use of this program without such an
- * agreement is prohibited.
- * #L%
- */
-package org.alfresco.rest.rm.model.site;
-
-/**
- *RM Site properties from the RM Model Schema
- *"entry": {
- * "id": "string",
- * "guid": "string",
- * "title": "string",
- * "description": "string",
- * "visibility": "{@link org.springframework.social.alfresco.api.entities.Site.Visibility}",
- * "compliance": "{@link RMSiteCompliance}",
- * "role": "{@link org.alfresco.utility.constants.UserRole}"
- *}
- * @author Tuna Aksoy
- * @author Rodica Sutu
- * @since 2.6
- */
-public class RMSiteFields
-{
- public static final String ID = "id";
- public static final String COMPLIANCE = "compliance";
- public static final String TITLE = "title";
- public static final String DESCRIPTION = "description";
- public static final String VISIBILITY ="visibility";
- public static final String ROLE = "role";
-}
diff --git a/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/base/AllowableOperations.java b/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/base/AllowableOperations.java
deleted file mode 100644
index e50a7f07ff..0000000000
--- a/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/base/AllowableOperations.java
+++ /dev/null
@@ -1,25 +0,0 @@
-/*
- * #%L
- * Alfresco Records Management Module
- * %%
- * Copyright (C) 2005 - 2016 Alfresco Software Limited
- * %%
- * License rights for this program may be obtained from Alfresco Software, Ltd.
- * pursuant to a written agreement and any use of this program without such an
- * agreement is prohibited.
- * #L%
- */
-package org.alfresco.rest.rm.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/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/base/TestData.java b/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/base/TestData.java
deleted file mode 100644
index 45acbf1662..0000000000
--- a/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/base/TestData.java
+++ /dev/null
@@ -1,101 +0,0 @@
-/*
- * #%L
- * Alfresco Records Management Module
- * %%
- * Copyright (C) 2005 - 2016 Alfresco Software Limited
- * %%
- * License rights for this program may be obtained from Alfresco Software, Ltd.
- * pursuant to a written agreement and any use of this program without such an
- * agreement is prohibited.
- * #L%
- */
-package org.alfresco.rest.rm.base;
-
-import static org.alfresco.rest.rm.model.fileplancomponents.FilePlanComponentAlias.FILE_PLAN_ALIAS;
-import static org.alfresco.rest.rm.model.fileplancomponents.FilePlanComponentAlias.HOLDS_ALIAS;
-import static org.alfresco.rest.rm.model.fileplancomponents.FilePlanComponentAlias.TRANSFERS_ALIAS;
-import static org.alfresco.rest.rm.model.fileplancomponents.FilePlanComponentAlias.UNFILED_RECORDS_CONTAINER_ALIAS;
-import static org.alfresco.rest.rm.model.fileplancomponents.FilePlanComponentType.FILE_PLAN_TYPE;
-import static org.alfresco.rest.rm.model.fileplancomponents.FilePlanComponentType.HOLD_CONTAINER_TYPE;
-import static org.alfresco.rest.rm.model.fileplancomponents.FilePlanComponentType.TRANSFER_CONTAINER_TYPE;
-import static org.alfresco.rest.rm.model.fileplancomponents.FilePlanComponentType.UNFILED_CONTAINER_TYPE;
-import static org.alfresco.utility.data.RandomData.getRandomAlphanumeric;
-
-import org.testng.annotations.DataProvider;
-
-/**
- * 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";
-
- /**
- * Data Provider with the special file plan components alias
- * @return file plan component alias
- */
- @DataProvider
- public static Object[][] getContainers()
- {
- return new Object[][] {
- { FILE_PLAN_ALIAS.toString() },
- { TRANSFERS_ALIAS.toString() },
- { HOLDS_ALIAS.toString() },
- { UNFILED_RECORDS_CONTAINER_ALIAS.toString() },
- };
- }
-
- /**
- * Data Provider with:
- * the special file plan components alias
- * file plan component node type
- * @return file plan component alias
- */
- @DataProvider
- public static Object[][] getContainersAndTypes()
- {
- return new Object[][] {
- { FILE_PLAN_ALIAS, FILE_PLAN_TYPE },
- { TRANSFERS_ALIAS, TRANSFER_CONTAINER_TYPE },
- { HOLDS_ALIAS, HOLD_CONTAINER_TYPE },
- { UNFILED_RECORDS_CONTAINER_ALIAS, UNFILED_CONTAINER_TYPE },
- };
- }
-
- /**
- * The default CATEGORY name used when creating categories
- */
- public static String CATEGORY_NAME = "CATEGORY NAME"+ getRandomAlphanumeric();
-
- /**
- * The default CATEGORY title used when creating categories
- */
- public static String CATEGORY_TITLE = "CATEGORY TITLE" + getRandomAlphanumeric();
-
- /**
- * The default FOLDER name used when creating categories
- */
- public static String FOLDER_NAME = "FOLDER NAME" + getRandomAlphanumeric();
-
- /**
- * The default FOLDER title used when creating categories
- */
- public static String FOLDER_TITLE = "FOLDER TITLE" + getRandomAlphanumeric();
-}
diff --git a/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/base/AllowableOperations.java b/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/base/AllowableOperations.java
new file mode 100644
index 0000000000..7922c82613
--- /dev/null
+++ b/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/base/AllowableOperations.java
@@ -0,0 +1,40 @@
+/*
+ * #%L
+ * Alfresco Records Management Module
+ * %%
+ * Copyright (C) 2005 - 2016 Alfresco Software Limited
+ * %%
+ * This file is part of the Alfresco software.
+ * -
+ * If the software was purchased under a paid Alfresco license, the terms of
+ * the paid license agreement will prevail. Otherwise, the software is
+ * provided under the following open source license terms:
+ * -
+ * Alfresco is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ * -
+ * Alfresco is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ * -
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with Alfresco. If not, see .
+ * #L%
+ */
+package org.alfresco.rest.rm.community.base;
+
+/**
+ * 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/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/base/BaseRestTest.java b/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/base/BaseRestTest.java
similarity index 64%
rename from rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/base/BaseRestTest.java
rename to rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/base/BaseRestTest.java
index 089120d436..1006b79e52 100644
--- a/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/base/BaseRestTest.java
+++ b/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/base/BaseRestTest.java
@@ -4,40 +4,55 @@
* %%
* Copyright (C) 2005 - 2016 Alfresco Software Limited
* %%
- * License rights for this program may be obtained from Alfresco Software, Ltd.
- * pursuant to a written agreement and any use of this program without such an
- * agreement is prohibited.
+ * This file is part of the Alfresco software.
+ * -
+ * If the software was purchased under a paid Alfresco license, the terms of
+ * the paid license agreement will prevail. Otherwise, the software is
+ * provided under the following open source license terms:
+ * -
+ * Alfresco is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ * -
+ * Alfresco is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ * -
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with Alfresco. If not, see .
* #L%
*/
-package org.alfresco.rest.rm.base;
+package org.alfresco.rest.rm.community.base;
import static java.lang.Integer.parseInt;
-import static org.alfresco.rest.rm.base.TestData.CATEGORY_TITLE;
-import static org.alfresco.rest.rm.base.TestData.FOLDER_TITLE;
-import static org.alfresco.rest.rm.model.fileplancomponents.FilePlanComponentFields.NAME;
-import static org.alfresco.rest.rm.model.fileplancomponents.FilePlanComponentFields.NODE_TYPE;
-import static org.alfresco.rest.rm.model.fileplancomponents.FilePlanComponentFields.PROPERTIES;
-import static org.alfresco.rest.rm.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_TITLE;
-import static org.alfresco.rest.rm.model.fileplancomponents.FilePlanComponentType.RECORD_CATEGORY_TYPE;
-import static org.alfresco.rest.rm.model.fileplancomponents.FilePlanComponentType.RECORD_FOLDER_TYPE;
-import static org.alfresco.rest.rm.model.site.RMSiteCompliance.STANDARD;
-import static org.alfresco.rest.rm.model.site.RMSiteFields.COMPLIANCE;
-import static org.alfresco.rest.rm.model.site.RMSiteFields.DESCRIPTION;
-import static org.alfresco.rest.rm.model.site.RMSiteFields.TITLE;
+import static org.alfresco.rest.rm.community.base.TestData.CATEGORY_TITLE;
+import static org.alfresco.rest.rm.community.base.TestData.FOLDER_TITLE;
+import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.NAME;
+import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.NODE_TYPE;
+import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PROPERTIES;
+import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_TITLE;
+import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentType.RECORD_CATEGORY_TYPE;
+import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentType.RECORD_FOLDER_TYPE;
+import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentType.UNFILED_RECORD_FOLDER_TYPE;
+import static org.alfresco.rest.rm.community.model.site.RMSiteCompliance.STANDARD;
+import static org.alfresco.rest.rm.community.model.site.RMSiteFields.COMPLIANCE;
+import static org.alfresco.rest.rm.community.model.site.RMSiteFields.DESCRIPTION;
+import static org.alfresco.rest.rm.community.model.site.RMSiteFields.TITLE;
import static org.jglue.fluentjson.JsonBuilderFactory.buildObject;
import static org.springframework.http.HttpStatus.CREATED;
-import static org.springframework.http.HttpStatus.OK;
import com.google.gson.JsonObject;
import com.jayway.restassured.RestAssured;
import org.alfresco.rest.RestTest;
import org.alfresco.rest.core.RestWrapper;
-import org.alfresco.rest.rm.model.fileplancomponents.FilePlanComponent;
-import org.alfresco.rest.rm.model.fileplancomponents.FilePlanComponentType;
-import org.alfresco.rest.rm.requests.FilePlanComponentAPI;
-import org.alfresco.rest.rm.requests.RMSiteAPI;
+import org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponent;
+import org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentType;
+import org.alfresco.rest.rm.community.requests.FilePlanComponentAPI;
+import org.alfresco.rest.rm.community.requests.RMSiteAPI;
import org.alfresco.utility.data.DataUser;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
@@ -108,7 +123,7 @@ public class BaseRestTest extends RestTest
public void createRMSiteIfNotExists() throws Exception
{
// Check RM site doesn't exist
- if (!siteRMExists())
+ if (!rmSiteAPI.existsRMSite())
{
rmSiteAPI.usingRestWrapper().authenticateUser(dataUser.getAdminUser());
@@ -127,16 +142,6 @@ public class BaseRestTest extends RestTest
}
}
- /**
- * Check if the RM site exists via the GET request
- */
- public boolean siteRMExists() throws Exception
- {
- RestWrapper restWrapper = rmSiteAPI.usingRestWrapper().authenticateUser(dataUser.getAdminUser());
- rmSiteAPI.getSite();
- return restWrapper.getStatusCode().equals(OK.toString());
- }
-
/**
* Helper method to create child category
*
@@ -163,6 +168,19 @@ public class BaseRestTest extends RestTest
return createComponent(parentCategoryId, folderName, RECORD_FOLDER_TYPE, FOLDER_TITLE);
}
+ /**
+ * Helper method to create child unfiled record folder
+ *
+ * @param parentId The id of the parent folder
+ * @param folderName The name of the folder
+ * @return The created folder
+ * @throws Exception on unsuccessful component creation
+ */
+ public FilePlanComponent createUnfiledRecordsFolder(String parentId, String folderName) throws Exception
+ {
+ return createComponent(parentId, folderName, UNFILED_RECORD_FOLDER_TYPE, FOLDER_TITLE);
+ }
+
/**
* Helper method to create generic child component
*
diff --git a/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/base/TestData.java b/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/base/TestData.java
new file mode 100644
index 0000000000..43c9147d5f
--- /dev/null
+++ b/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/base/TestData.java
@@ -0,0 +1,145 @@
+/*
+ * #%L
+ * Alfresco Records Management Module
+ * %%
+ * Copyright (C) 2005 - 2016 Alfresco Software Limited
+ * %%
+ * This file is part of the Alfresco software.
+ * -
+ * If the software was purchased under a paid Alfresco license, the terms of
+ * the paid license agreement will prevail. Otherwise, the software is
+ * provided under the following open source license terms:
+ * -
+ * Alfresco is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ * -
+ * Alfresco is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ * -
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with Alfresco. If not, see .
+ * #L%
+ */
+package org.alfresco.rest.rm.community.base;
+
+import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentAlias.FILE_PLAN_ALIAS;
+import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentAlias.HOLDS_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.HOLD_CONTAINER_TYPE;
+import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentType.HOLD_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.utility.data.RandomData.getRandomAlphanumeric;
+
+import org.testng.annotations.DataProvider;
+
+/**
+ * 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";
+
+ /**
+ * Data Provider with the special file plan components alias
+ * @return file plan component alias
+ */
+ @DataProvider
+ public static Object[][] getContainers()
+ {
+ return new Object[][] {
+ { FILE_PLAN_ALIAS.toString() },
+ { TRANSFERS_ALIAS.toString() },
+ { HOLDS_ALIAS.toString() },
+ { UNFILED_RECORDS_CONTAINER_ALIAS.toString() },
+ };
+ }
+
+ /**
+ * Data Provider with:
+ * the special file plan components alias
+ * file plan component node type
+ * @return file plan component alias
+ */
+ @DataProvider
+ public static Object[][] getContainersAndTypes()
+ {
+ return new Object[][] {
+ { FILE_PLAN_ALIAS, FILE_PLAN_TYPE },
+ { TRANSFERS_ALIAS, TRANSFER_CONTAINER_TYPE },
+ { HOLDS_ALIAS, HOLD_CONTAINER_TYPE },
+ { UNFILED_RECORDS_CONTAINER_ALIAS, UNFILED_CONTAINER_TYPE },
+ };
+ }
+
+ /**
+ * The default CATEGORY name used when creating categories
+ */
+ public static String CATEGORY_NAME = "CATEGORY NAME"+ getRandomAlphanumeric();
+
+ /**
+ * The default CATEGORY title used when creating categories
+ */
+ public static String CATEGORY_TITLE = "CATEGORY TITLE" + getRandomAlphanumeric();
+
+ /**
+ * The default FOLDER name used when creating categories
+ */
+ public static String FOLDER_NAME = "FOLDER NAME" + getRandomAlphanumeric();
+
+ /**
+ * The default FOLDER title used when creating categories
+ */
+ public static String FOLDER_TITLE = "FOLDER TITLE" + getRandomAlphanumeric();
+
+
+ /**
+ * 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 Object[][] {
+ { FILE_PLAN_TYPE.toString() },
+ { TRANSFER_CONTAINER_TYPE.toString() },
+ { HOLD_CONTAINER_TYPE.toString() },
+ { UNFILED_CONTAINER_TYPE.toString() },
+ { UNFILED_RECORD_FOLDER_TYPE.toString()},
+ { HOLD_TYPE.toString()},
+ { TRANSFER_TYPE.toString()},
+ { FOLDER_TYPE.toString()},
+ { CONTENT_TYPE.toString()}
+ };
+ }
+
+}
diff --git a/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/fileplancomponents/FilePlanTests.java b/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/fileplancomponents/FilePlanTests.java
similarity index 83%
rename from rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/fileplancomponents/FilePlanTests.java
rename to rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/fileplancomponents/FilePlanTests.java
index 425963fced..2d50011cfa 100644
--- a/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/fileplancomponents/FilePlanTests.java
+++ b/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/fileplancomponents/FilePlanTests.java
@@ -4,25 +4,40 @@
* %%
* Copyright (C) 2005 - 2016 Alfresco Software Limited
* %%
- * License rights for this program may be obtained from Alfresco Software, Ltd.
- * pursuant to a written agreement and any use of this program without such an
- * agreement is prohibited.
+ * This file is part of the Alfresco software.
+ * -
+ * If the software was purchased under a paid Alfresco license, the terms of
+ * the paid license agreement will prevail. Otherwise, the software is
+ * provided under the following open source license terms:
+ * -
+ * Alfresco is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ * -
+ * Alfresco is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ * -
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with Alfresco. If not, see .
* #L%
*/
-package org.alfresco.rest.rm.fileplancomponents;
+package org.alfresco.rest.rm.community.fileplancomponents;
import static java.util.Arrays.asList;
-import static org.alfresco.rest.rm.base.AllowableOperations.CREATE;
-import static org.alfresco.rest.rm.base.AllowableOperations.DELETE;
-import static org.alfresco.rest.rm.base.AllowableOperations.UPDATE;
-import static org.alfresco.rest.rm.model.fileplancomponents.FilePlanComponentAlias.FILE_PLAN_ALIAS;
-import static org.alfresco.rest.rm.model.fileplancomponents.FilePlanComponentAlias.TRANSFERS_ALIAS;
-import static org.alfresco.rest.rm.model.fileplancomponents.FilePlanComponentFields.NAME;
-import static org.alfresco.rest.rm.model.fileplancomponents.FilePlanComponentFields.NODE_TYPE;
-import static org.alfresco.rest.rm.model.fileplancomponents.FilePlanComponentFields.PROPERTIES;
-import static org.alfresco.rest.rm.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_DESCRIPTION;
-import static org.alfresco.rest.rm.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_TITLE;
+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.FilePlanComponentAlias.TRANSFERS_ALIAS;
+import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.NAME;
+import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.NODE_TYPE;
+import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PROPERTIES;
+import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_DESCRIPTION;
+import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_TITLE;
import static org.alfresco.utility.data.RandomData.getRandomAlphanumeric;
import static org.jglue.fluentjson.JsonBuilderFactory.buildObject;
import static org.springframework.http.HttpStatus.FORBIDDEN;
@@ -35,13 +50,13 @@ import static org.testng.Assert.assertTrue;
import com.google.gson.JsonObject;
-import org.alfresco.rest.rm.base.BaseRestTest;
-import org.alfresco.rest.rm.base.TestData;
-import org.alfresco.rest.rm.model.fileplancomponents.FilePlanComponent;
-import org.alfresco.rest.rm.model.fileplancomponents.FilePlanComponentAlias;
-import org.alfresco.rest.rm.model.fileplancomponents.FilePlanComponentType;
-import org.alfresco.rest.rm.requests.FilePlanComponentAPI;
-import org.alfresco.rest.rm.requests.RMSiteAPI;
+import org.alfresco.rest.rm.community.base.BaseRestTest;
+import org.alfresco.rest.rm.community.base.TestData;
+import org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponent;
+import org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentAlias;
+import org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentType;
+import org.alfresco.rest.rm.community.requests.FilePlanComponentAPI;
+import org.alfresco.rest.rm.community.requests.RMSiteAPI;
import org.alfresco.utility.data.DataUser;
import org.alfresco.utility.model.UserModel;
import org.alfresco.utility.report.Bug;
@@ -80,7 +95,7 @@ public class FilePlanTests extends BaseRestTest
public void getFilePlanComponentWhenRMIsNotCreated(String filePlanAlias) throws Exception
{
// Check RM Site Exist
- if (siteRMExists())
+ if (rmSiteAPI.existsRMSite())
{
// Delete RM Site
rmSiteAPI.deleteRMSite();
diff --git a/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/fileplancomponents/RecordCategoryTest.java b/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/fileplancomponents/RecordCategoryTest.java
similarity index 78%
rename from rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/fileplancomponents/RecordCategoryTest.java
rename to rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/fileplancomponents/RecordCategoryTest.java
index 2a6c30f329..8b1e4cac09 100644
--- a/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/fileplancomponents/RecordCategoryTest.java
+++ b/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/fileplancomponents/RecordCategoryTest.java
@@ -4,26 +4,42 @@
* %%
* Copyright (C) 2005 - 2016 Alfresco Software Limited
* %%
- * License rights for this program may be obtained from Alfresco Software, Ltd.
- * pursuant to a written agreement and any use of this program without such an
- * agreement is prohibited.
+ * This file is part of the Alfresco software.
+ * -
+ * If the software was purchased under a paid Alfresco license, the terms of
+ * the paid license agreement will prevail. Otherwise, the software is
+ * provided under the following open source license terms:
+ * -
+ * Alfresco is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ * -
+ * Alfresco is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ * -
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with Alfresco. If not, see .
* #L%
*/
-package org.alfresco.rest.rm.fileplancomponents;
+package org.alfresco.rest.rm.community.fileplancomponents;
-import static org.alfresco.rest.rm.model.fileplancomponents.FilePlanComponentAlias.FILE_PLAN_ALIAS;
-import static org.alfresco.rest.rm.model.fileplancomponents.FilePlanComponentFields.NAME;
-import static org.alfresco.rest.rm.model.fileplancomponents.FilePlanComponentFields.NODE_TYPE;
-import static org.alfresco.rest.rm.model.fileplancomponents.FilePlanComponentFields.PROPERTIES;
-import static org.alfresco.rest.rm.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_TITLE;
-import static org.alfresco.rest.rm.model.fileplancomponents.FilePlanComponentType.RECORD_CATEGORY_TYPE;
-import static org.alfresco.rest.rm.model.fileplancomponents.FilePlanComponentType.RECORD_FOLDER_TYPE;
+import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentAlias.FILE_PLAN_ALIAS;
+import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.NAME;
+import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.NODE_TYPE;
+import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PROPERTIES;
+import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_TITLE;
+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.jglue.fluentjson.JsonBuilderFactory.buildObject;
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;
@@ -35,14 +51,16 @@ import java.util.NoSuchElementException;
import com.google.gson.JsonObject;
-import org.alfresco.rest.rm.base.BaseRestTest;
import org.alfresco.rest.core.RestWrapper;
-import org.alfresco.rest.rm.model.fileplancomponents.FilePlanComponent;
-import org.alfresco.rest.rm.model.fileplancomponents.FilePlanComponentProperties;
-import org.alfresco.rest.rm.model.fileplancomponents.FilePlanComponentType;
-import org.alfresco.rest.rm.model.fileplancomponents.FilePlanComponentsCollection;
-import org.alfresco.rest.rm.requests.FilePlanComponentAPI;
+import org.alfresco.rest.rm.community.base.BaseRestTest;
+import org.alfresco.rest.rm.community.base.TestData;
+import org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponent;
+import org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentProperties;
+import org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentType;
+import org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentsCollection;
+import org.alfresco.rest.rm.community.requests.FilePlanComponentAPI;
import org.alfresco.utility.data.DataUser;
+import org.alfresco.utility.report.Bug;
import org.springframework.beans.factory.annotation.Autowired;
import org.testng.annotations.Test;
@@ -333,6 +351,41 @@ public class RecordCategoryTest extends BaseRestTest
});
}
+ /**
+ * Given that a record category exists
+ * When I ask to create a 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 = TestData.class,
+ dataProvider = "childrenNotAllowedForCategory"
+
+ )
+ @Bug (id="RM-4367")
+ public void createTypesNotAllowedInCategory(String nodeType) throws Exception
+ {
+ String COMPONENT_NAME="Component"+getRandomAlphanumeric();
+ // Authenticate with admin user
+ filePlanComponentAPI.usingRestWrapper().authenticateUser(dataUser.getAdminUser());
+ FilePlanComponent category = createCategory(FILE_PLAN_ALIAS.toString(), COMPONENT_NAME);
+
+ //Build node properties
+ JsonObject componentProperties = buildObject()
+ .add(NAME, COMPONENT_NAME)
+ .add(NODE_TYPE, nodeType)
+ .addObject(PROPERTIES)
+ .add(PROPERTIES_TITLE, "Title for " + COMPONENT_NAME)
+ .end()
+ .getJson();
+
+ //create the invalid node type
+ filePlanComponentAPI.createFilePlanComponent(componentProperties, category.getId());
+ filePlanComponentAPI.usingRestWrapper().assertStatusCodeIs(UNPROCESSABLE_ENTITY);
+ }
+
+
/**
* Helper method to create child category
*
diff --git a/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/fileplancomponents/RecordFolderTests.java b/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/fileplancomponents/RecordFolderTests.java
similarity index 83%
rename from rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/fileplancomponents/RecordFolderTests.java
rename to rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/fileplancomponents/RecordFolderTests.java
index 9b0fd45e1a..fee7b46171 100644
--- a/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/fileplancomponents/RecordFolderTests.java
+++ b/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/fileplancomponents/RecordFolderTests.java
@@ -4,27 +4,42 @@
* %%
* Copyright (C) 2005 - 2016 Alfresco Software Limited
* %%
- * License rights for this program may be obtained from Alfresco Software, Ltd.
- * pursuant to a written agreement and any use of this program without such an
- * agreement is prohibited.
+ * This file is part of the Alfresco software.
+ * -
+ * If the software was purchased under a paid Alfresco license, the terms of
+ * the paid license agreement will prevail. Otherwise, the software is
+ * provided under the following open source license terms:
+ * -
+ * Alfresco is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ * -
+ * Alfresco is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ * -
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with Alfresco. If not, see .
* #L%
*/
-package org.alfresco.rest.rm.fileplancomponents;
+package org.alfresco.rest.rm.community.fileplancomponents;
-import static org.alfresco.rest.rm.base.TestData.CATEGORY_NAME;
-import static org.alfresco.rest.rm.base.TestData.FOLDER_NAME;
-import static org.alfresco.rest.rm.base.TestData.FOLDER_TITLE;
-import static org.alfresco.rest.rm.model.fileplancomponents.FilePlanComponentAlias.FILE_PLAN_ALIAS;
-import static org.alfresco.rest.rm.model.fileplancomponents.FilePlanComponentFields.IS_CLOSED;
-import static org.alfresco.rest.rm.model.fileplancomponents.FilePlanComponentFields.NAME;
-import static org.alfresco.rest.rm.model.fileplancomponents.FilePlanComponentFields.NODE_TYPE;
-import static org.alfresco.rest.rm.model.fileplancomponents.FilePlanComponentFields.PROPERTIES;
-import static org.alfresco.rest.rm.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_DESCRIPTION;
-import static org.alfresco.rest.rm.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_LOCATION;
-import static org.alfresco.rest.rm.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_REVIEW_PERIOD;
-import static org.alfresco.rest.rm.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_TITLE;
-import static org.alfresco.rest.rm.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_VITAL_RECORD_INDICATOR;
-import static org.alfresco.rest.rm.model.fileplancomponents.FilePlanComponentType.RECORD_FOLDER_TYPE;
+import static org.alfresco.rest.rm.community.base.TestData.CATEGORY_NAME;
+import static org.alfresco.rest.rm.community.base.TestData.FOLDER_NAME;
+import static org.alfresco.rest.rm.community.base.TestData.FOLDER_TITLE;
+import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentAlias.FILE_PLAN_ALIAS;
+import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.IS_CLOSED;
+import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.NAME;
+import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.NODE_TYPE;
+import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PROPERTIES;
+import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_DESCRIPTION;
+import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_LOCATION;
+import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_REVIEW_PERIOD;
+import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_TITLE;
+import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_VITAL_RECORD_INDICATOR;
+import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentType.RECORD_FOLDER_TYPE;
import static org.alfresco.utility.data.RandomData.getRandomAlphanumeric;
import static org.jglue.fluentjson.JsonBuilderFactory.buildObject;
import static org.springframework.http.HttpStatus.CREATED;
@@ -44,12 +59,12 @@ import java.util.NoSuchElementException;
import com.google.gson.JsonObject;
import org.alfresco.rest.core.RestWrapper;
-import org.alfresco.rest.rm.base.BaseRestTest;
-import org.alfresco.rest.rm.base.TestData;
-import org.alfresco.rest.rm.model.fileplancomponents.FilePlanComponent;
-import org.alfresco.rest.rm.model.fileplancomponents.FilePlanComponentProperties;
-import org.alfresco.rest.rm.model.fileplancomponents.FilePlanComponentsCollection;
-import org.alfresco.rest.rm.requests.FilePlanComponentAPI;
+import org.alfresco.rest.rm.community.base.BaseRestTest;
+import org.alfresco.rest.rm.community.base.TestData;
+import org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponent;
+import org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentProperties;
+import org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentsCollection;
+import org.alfresco.rest.rm.community.requests.FilePlanComponentAPI;
import org.alfresco.utility.data.DataUser;
import org.alfresco.utility.report.Bug;
import org.springframework.beans.factory.annotation.Autowired;
diff --git a/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/fileplancomponents/UnfiledRecordsFolderTests.java b/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/fileplancomponents/UnfiledRecordsFolderTests.java
new file mode 100644
index 0000000000..329131b95c
--- /dev/null
+++ b/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/fileplancomponents/UnfiledRecordsFolderTests.java
@@ -0,0 +1,329 @@
+/*
+ * #%L
+ * Alfresco Records Management Module
+ * %%
+ * Copyright (C) 2005 - 2016 Alfresco Software Limited
+ * %%
+ * This file is part of the Alfresco software.
+ * -
+ * If the software was purchased under a paid Alfresco license, the terms of
+ * the paid license agreement will prevail. Otherwise, the software is
+ * provided under the following open source license terms:
+ * -
+ * Alfresco is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ * -
+ * Alfresco is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ * -
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with Alfresco. If not, see .
+ * #L%
+ */
+package org.alfresco.rest.rm.community.fileplancomponents;
+
+import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentAlias.UNFILED_RECORDS_CONTAINER_ALIAS;
+import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.NAME;
+import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.NODE_TYPE;
+import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PROPERTIES;
+import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_DESCRIPTION;
+import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_TITLE;
+import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentType.FILE_PLAN_TYPE;
+import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentType.HOLD_CONTAINER_TYPE;
+import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentType.HOLD_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.UNFILED_CONTAINER_TYPE;
+import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentType.UNFILED_RECORD_FOLDER_TYPE;
+import static org.alfresco.utility.data.RandomData.getRandomAlphanumeric;
+import static org.jglue.fluentjson.JsonBuilderFactory.buildObject;
+import static org.springframework.http.HttpStatus.CREATED;
+import static org.springframework.http.HttpStatus.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.assertTrue;
+
+import java.util.List;
+import java.util.stream.Collectors;
+
+import com.google.gson.JsonObject;
+
+import org.alfresco.rest.core.RestWrapper;
+import org.alfresco.rest.rm.community.base.BaseRestTest;
+import org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponent;
+import org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentProperties;
+import org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentType;
+import org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentsCollection;
+import org.alfresco.rest.rm.community.requests.FilePlanComponentAPI;
+import org.alfresco.utility.data.DataUser;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.testng.annotations.DataProvider;
+import org.testng.annotations.Test;
+
+/**
+ * Unfiled Records folder CRUD API tests
+ *
+ * @author Kristijan Conkas
+ * @since 2.6
+ */
+public class UnfiledRecordsFolderTests extends BaseRestTest
+{
+ @Autowired
+ private FilePlanComponentAPI filePlanComponentAPI;
+
+ @Autowired
+ private DataUser dataUser;
+
+ /** invalid root level types, at unfiled records root level these shouldn't be possible to create */
+ @DataProvider(name = "invalidRootTypes")
+ public Object[][] createData1() {
+ return new Object[][] {
+ { FILE_PLAN_TYPE },
+ { RECORD_CATEGORY_TYPE },
+ { RECORD_FOLDER_TYPE },
+ { HOLD_TYPE },
+ { HOLD_CONTAINER_TYPE },
+ { TRANSFER_CONTAINER_TYPE },
+ { UNFILED_CONTAINER_TYPE }
+ };
+ }
+
+ /**
+ * Given the unfiled record container root
+ * When I create an unfiled record folder via the ReST API
+ * Then a root unfiled record folder is created
+ *
+ * @throws Exception if folder couldn't be created
+ */
+ @Test(description = "Create root unfiled records folder")
+ public void createRootUnfiledRecordsFolder() throws Exception
+ {
+ // Authenticate with admin user
+ RestWrapper restWrapper = filePlanComponentAPI.usingRestWrapper().authenticateUser(dataUser.getAdminUser());
+
+ String folderName = "Folder " + getRandomAlphanumeric();
+ String folderTitle = folderName + " Title";
+ String folderDescription = folderName + " Description";
+
+ // Build unfiled records folder properties
+ JsonObject unfiledFolderProperties = buildObject()
+ .add(NAME, folderName)
+ .add(NODE_TYPE, UNFILED_RECORD_FOLDER_TYPE.toString())
+ .addObject(PROPERTIES)
+ .add(PROPERTIES_TITLE, folderTitle)
+ .add(PROPERTIES_DESCRIPTION, folderDescription)
+ .end()
+ .getJson();
+
+ FilePlanComponent filePlanComponent = filePlanComponentAPI.createFilePlanComponent(unfiledFolderProperties,
+ UNFILED_RECORDS_CONTAINER_ALIAS.toString());
+
+ // Verify the status code
+ restWrapper.assertStatusCodeIs(CREATED);
+
+ // Verify the returned file plan component
+ assertFalse(filePlanComponent.isIsCategory());
+ assertFalse(filePlanComponent.isIsFile());
+ assertFalse(filePlanComponent.isIsRecordFolder()); // it is not a _normal_ record folder!
+
+ assertEquals(filePlanComponent.getName(), folderName);
+ assertEquals(filePlanComponent.getNodeType(), UNFILED_RECORD_FOLDER_TYPE.toString());
+ assertFalse(filePlanComponent.isHasRetentionSchedule());
+
+ assertEquals(filePlanComponent.getCreatedByUser().getId(), dataUser.getAdminUser().getUsername());
+
+ // Verify the returned file plan component properties
+ FilePlanComponentProperties filePlanComponentProperties = filePlanComponent.getProperties();
+ assertEquals(filePlanComponentProperties.getTitle(), folderTitle);
+ assertEquals(filePlanComponentProperties.getDescription(), folderDescription);
+ }
+
+ /**
+ * Negative test to verify only unfiled record folders can be created at root level
+ */
+ @Test
+ (
+ dataProvider = "invalidRootTypes",
+ description = "Only unfiled records folders can be created at unfiled records root level"
+ )
+ public void onlyRecordFoldersCanBeCreatedAtUnfiledRecordsRoot(FilePlanComponentType componentType)
+ {
+ RestWrapper restWrapper = filePlanComponentAPI.usingRestWrapper().authenticateUser(dataUser.getAdminUser());
+
+ String folderName = "Folder " + getRandomAlphanumeric();
+ String folderTitle = folderName + " Title";
+ String folderDescription = folderName + " Description";
+
+ logger.info("creating " + componentType.toString());
+
+ JsonObject unfiledFolderProperties = buildObject()
+ .add(NAME, folderName)
+ .add(NODE_TYPE, componentType.toString())
+ .addObject(PROPERTIES)
+ .add(PROPERTIES_TITLE, folderTitle)
+ .add(PROPERTIES_DESCRIPTION, folderDescription)
+ .end()
+ .getJson();
+ try
+ {
+ filePlanComponentAPI.createFilePlanComponent(unfiledFolderProperties,
+ UNFILED_RECORDS_CONTAINER_ALIAS.toString());
+ }
+ catch (Exception error)
+ {
+ }
+
+ // Verify the status code
+ restWrapper.assertStatusCodeIs(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
+ *
+ * @throws Exception for failed actions
+ */
+ @Test(description = "Child unfiled records folder can be created in a parent unfiled records folder")
+ public void childUnfiledRecordsFolderCanBeCreated() throws Exception
+ {
+ RestWrapper restWrapper = filePlanComponentAPI.usingRestWrapper().authenticateUser(dataUser.getAdminUser());
+
+ String parentFolderName = "Parent Folder " + getRandomAlphanumeric();
+ String childFolderName = "Child Folder " + getRandomAlphanumeric();
+ String childFolderTitle = childFolderName + " Title";
+ String childFolderDescription = childFolderName + " Description";
+
+ // No need for fine control, create it using utility function
+ FilePlanComponent parentFolder = createUnfiledRecordsFolder(UNFILED_RECORDS_CONTAINER_ALIAS.toString(), parentFolderName);
+ assertEquals(parentFolderName, parentFolder.getName());
+
+ // Build the unfiled records folder properties
+ JsonObject unfiledFolderProperties = buildObject()
+ .add(NAME, childFolderName)
+ .add(NODE_TYPE, UNFILED_RECORD_FOLDER_TYPE.toString())
+ .addObject(PROPERTIES)
+ .add(PROPERTIES_TITLE, childFolderTitle)
+ .add(PROPERTIES_DESCRIPTION, childFolderDescription)
+ .end()
+ .getJson();
+
+ // Create it as a child of parentFolder
+ FilePlanComponent childFolder = filePlanComponentAPI.createFilePlanComponent(unfiledFolderProperties,
+ parentFolder.getId());
+
+ // Verify the status code
+ restWrapper.assertStatusCodeIs(CREATED);
+
+ // Verify the returned file plan component
+ assertFalse(childFolder.isIsCategory());
+ assertFalse(childFolder.isIsFile());
+ assertFalse(childFolder.isIsRecordFolder()); // it is not a _normal_ record folder!
+
+ assertEquals(childFolder.getName(), childFolderName);
+ assertEquals(childFolder.getNodeType(), UNFILED_RECORD_FOLDER_TYPE.toString());
+ assertFalse(childFolder.isHasRetentionSchedule());
+
+ assertEquals(childFolder.getCreatedByUser().getId(), dataUser.getAdminUser().getUsername());
+
+ // Verify the returned file plan component properties
+ FilePlanComponentProperties childProperties = childFolder.getProperties();
+ assertEquals(childProperties.getTitle(), childFolderTitle);
+ assertEquals(childProperties.getDescription(), childFolderDescription);
+
+ // Does this child point to its parent?
+ assertEquals(childFolder.getParentId(), parentFolder.getId());
+
+ // Does child's parent point to it?
+ // Perform another call as our parentFolder had been executed before childFolder existed
+ FilePlanComponentsCollection parentsChildren = filePlanComponentAPI.listChildComponents(parentFolder.getId());
+ restWrapper.assertStatusCodeIs(OK);
+ List childIds = parentsChildren.getEntries()
+ .stream()
+ .map(c -> c.getFilePlanComponent().getId())
+ .collect(Collectors.toList());
+
+ // Child folder is listed in parent
+ assertTrue(childIds.contains(childFolder.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
+ *
+ * @throws Exception for failed actions
+ */
+ @Test(description = "Unfiled record folder")
+ public void editUnfiledRecordsFolder() throws Exception
+ {
+ RestWrapper restWrapper = filePlanComponentAPI.usingRestWrapper().authenticateUser(dataUser.getAdminUser());
+ String modified = "Modified ";
+ String folderName = "Folder To Modify" + getRandomAlphanumeric();
+
+ // No need for fine control, create it using utility function
+ FilePlanComponent folderToModify = createUnfiledRecordsFolder(UNFILED_RECORDS_CONTAINER_ALIAS.toString(), folderName);
+ assertEquals(folderName, folderToModify.getName());
+
+ // Build the properties which will be updated
+ JsonObject updateFolderProperties = buildObject()
+ .add(NAME, modified + folderToModify.getName())
+ .addObject(PROPERTIES)
+ .add(PROPERTIES_TITLE, modified + folderToModify.getProperties().getTitle())
+ .add(PROPERTIES_DESCRIPTION, modified + folderToModify.getProperties().getDescription())
+ .end()
+ .getJson();
+
+ // Update the unfiled records folder
+ filePlanComponentAPI.updateFilePlanComponent(updateFolderProperties, folderToModify.getId());
+ // Verify the status code
+ restWrapper.assertStatusCodeIs(OK);
+
+ // This is to ensure the change was actually applied, rather than simply trusting the object returned by PUT
+ FilePlanComponent renamedFolder = filePlanComponentAPI.getFilePlanComponent(folderToModify.getId());
+
+ // Verify the returned file plan component
+ assertEquals(modified + folderToModify.getName(), renamedFolder.getName());
+ assertEquals(modified + folderToModify.getProperties().getTitle(), renamedFolder.getProperties().getTitle());
+ assertEquals(modified + folderToModify.getProperties().getDescription(), renamedFolder.getProperties().getDescription());
+ }
+
+ /**
+ * Given an unfiled record folder
+ * When I delete the unfiled record folder via the ReST API
+ * Then the unfiled record folder is deleted
+ *
+ * @throws Exception for failed actions
+ */
+ @Test(description = "Delete unfiled record folder")
+ public void deleteUnfiledRecordsFolder() throws Exception
+ {
+ RestWrapper restWrapper = filePlanComponentAPI.usingRestWrapper().authenticateUser(dataUser.getAdminUser());
+ String folderName = "Folder To Delete" + getRandomAlphanumeric();
+
+ // Create folderToDelete
+ FilePlanComponent folderToDelete = createUnfiledRecordsFolder(UNFILED_RECORDS_CONTAINER_ALIAS.toString(), folderName);
+ assertEquals(folderName, folderToDelete.getName());
+
+ // Delete folderToDelete
+ filePlanComponentAPI.deleteFilePlanComponent(folderToDelete.getId());
+
+ // Verify the status code
+ restWrapper.assertStatusCodeIs(NO_CONTENT);
+
+ // Deleted component should no longer be retrievable
+ filePlanComponentAPI.getFilePlanComponent(folderToDelete.getId());
+ restWrapper.assertStatusCodeIs(NOT_FOUND);
+ }
+}
diff --git a/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/site/RMSiteTests.java b/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/site/RMSiteTests.java
similarity index 84%
rename from rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/site/RMSiteTests.java
rename to rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/site/RMSiteTests.java
index 3919935fac..4193ad70d6 100644
--- a/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/site/RMSiteTests.java
+++ b/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/site/RMSiteTests.java
@@ -4,21 +4,36 @@
* %%
* Copyright (C) 2005 - 2016 Alfresco Software Limited
* %%
- * License rights for this program may be obtained from Alfresco Software, Ltd.
- * pursuant to a written agreement and any use of this program without such an
- * agreement is prohibited.
+ * This file is part of the Alfresco software.
+ * -
+ * If the software was purchased under a paid Alfresco license, the terms of
+ * the paid license agreement will prevail. Otherwise, the software is
+ * provided under the following open source license terms:
+ * -
+ * Alfresco is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ * -
+ * Alfresco is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ * -
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with Alfresco. If not, see .
* #L%
*/
-package org.alfresco.rest.rm.site;
+package org.alfresco.rest.rm.community.site;
-import static org.alfresco.rest.rm.base.TestData.ANOTHER_ADMIN;
-import static org.alfresco.rest.rm.base.TestData.DEFAULT_EMAIL;
-import static org.alfresco.rest.rm.base.TestData.DEFAULT_PASSWORD;
-import static org.alfresco.rest.rm.model.site.RMSiteCompliance.DOD5015;
-import static org.alfresco.rest.rm.model.site.RMSiteCompliance.STANDARD;
-import static org.alfresco.rest.rm.model.site.RMSiteFields.COMPLIANCE;
-import static org.alfresco.rest.rm.model.site.RMSiteFields.DESCRIPTION;
-import static org.alfresco.rest.rm.model.site.RMSiteFields.TITLE;
+import static org.alfresco.rest.rm.community.base.TestData.ANOTHER_ADMIN;
+import static org.alfresco.rest.rm.community.base.TestData.DEFAULT_EMAIL;
+import static org.alfresco.rest.rm.community.base.TestData.DEFAULT_PASSWORD;
+import static org.alfresco.rest.rm.community.model.site.RMSiteCompliance.DOD5015;
+import static org.alfresco.rest.rm.community.model.site.RMSiteCompliance.STANDARD;
+import static org.alfresco.rest.rm.community.model.site.RMSiteFields.COMPLIANCE;
+import static org.alfresco.rest.rm.community.model.site.RMSiteFields.DESCRIPTION;
+import static org.alfresco.rest.rm.community.model.site.RMSiteFields.TITLE;
import static org.jglue.fluentjson.JsonBuilderFactory.buildObject;
import static org.springframework.http.HttpStatus.BAD_REQUEST;
import static org.springframework.http.HttpStatus.CONFLICT;
@@ -34,10 +49,10 @@ import static org.testng.Assert.assertNotNull;
import com.google.gson.JsonObject;
import org.alfresco.dataprep.UserService;
-import org.alfresco.rest.rm.base.BaseRestTest;
+import org.alfresco.rest.rm.community.base.BaseRestTest;
+import org.alfresco.rest.rm.community.model.site.RMSite;
+import org.alfresco.rest.rm.community.requests.RMSiteAPI;
import org.alfresco.rest.core.RestWrapper;
-import org.alfresco.rest.rm.model.site.RMSite;
-import org.alfresco.rest.rm.requests.RMSiteAPI;
import org.alfresco.utility.constants.UserRole;
import org.alfresco.utility.data.DataUser;
import org.alfresco.utility.data.RandomData;
@@ -79,7 +94,7 @@ public class RMSiteTests extends BaseRestTest
rmSiteAPI.usingRestWrapper().authenticateUser(dataUser.getAdminUser());
// Check if the RM site exists
- if (siteRMExists())
+ if (rmSiteAPI.existsRMSite())
{
// Delete the RM site
rmSiteAPI.deleteRMSite();
@@ -177,9 +192,8 @@ public class RMSiteTests extends BaseRestTest
// Authenticate with admin user
RestWrapper restWrapper = rmSiteAPI.usingRestWrapper().authenticateUser(dataUser.getAdminUser());
- // Get the RM site
- RMSite rmSite = rmSiteAPI.getSite();
- if (!siteRMExists())
+ // Check if RM site exists
+ if (!rmSiteAPI.existsRMSite())
{
// Verify the status code when RM site doesn't exist
restWrapper.assertStatusCodeIs(NOT_FOUND);
@@ -187,6 +201,9 @@ public class RMSiteTests extends BaseRestTest
}
else
{
+ // Get the RM site
+ RMSite rmSite = rmSiteAPI.getSite();
+
// Verify the status code
restWrapper.assertStatusCodeIs(OK);
assertEquals(rmSite.getId(), RM_ID);
@@ -212,7 +229,7 @@ public class RMSiteTests extends BaseRestTest
rmSiteAPI.usingRestWrapper().authenticateUser(dataUser.getAdminUser());
// Check if the RM site exists
- if (siteRMExists())
+ if (rmSiteAPI.existsRMSite())
{
// Delete the RM site
rmSiteAPI.deleteRMSite();
diff --git a/rm-automation/rm-automation-community-rest-api/src/test/resources/testng.xml b/rm-automation/rm-automation-community-rest-api/src/test/resources/testng.xml
index ed47d376d7..5686b980a6 100644
--- a/rm-automation/rm-automation-community-rest-api/src/test/resources/testng.xml
+++ b/rm-automation/rm-automation-community-rest-api/src/test/resources/testng.xml
@@ -1,10 +1,9 @@
-
-
+
\ No newline at end of file