From ea0239b9a8630753cb98f74eb92cda2c8e78c80b Mon Sep 17 00:00:00 2001 From: Rodica Sutu Date: Thu, 9 Feb 2017 17:30:42 +0200 Subject: [PATCH] updates: test to cover the scenario when a cm:folder is converted to a recordCategory --- .../rest/rm/community/base/TestData.java | 22 +++++++++++++++++-- .../RecordCategoryTest.java | 17 ++++++++++---- 2 files changed, 33 insertions(+), 6 deletions(-) diff --git a/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/base/TestData.java b/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/base/TestData.java index 9d475ad71d..b2f08c7d2f 100644 --- a/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/base/TestData.java +++ b/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/base/TestData.java @@ -35,6 +35,7 @@ import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanCo 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.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; @@ -151,6 +152,8 @@ public interface TestData }; } + + /** * Data Provider with: * with the object types for creating a Record Folder @@ -161,8 +164,23 @@ public interface TestData public static Object[][] folderTypes() { return new Object[][] { - {RECORD_FOLDER_TYPE}, - {FOLDER_TYPE} + { 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 Object[][] { + { FOLDER_TYPE }, + { RECORD_CATEGORY_TYPE } }; } } diff --git a/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/fileplancomponents/RecordCategoryTest.java b/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/fileplancomponents/RecordCategoryTest.java index 24a84d0818..51483fffd3 100644 --- a/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/fileplancomponents/RecordCategoryTest.java +++ b/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/fileplancomponents/RecordCategoryTest.java @@ -70,12 +70,21 @@ public class RecordCategoryTest extends BaseRMRestTest * 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" + description = "Create root category", + dataProviderClass= TestData.class, + dataProvider = "categoryTypes" ) - public void createCategoryTest() throws Exception + public void createCategoryTest(String nodeType) throws Exception { String categoryName = "Category name " + getRandomAlphanumeric(); String categoryTitle = "Category title " + getRandomAlphanumeric(); @@ -83,7 +92,7 @@ public class RecordCategoryTest extends BaseRMRestTest // Build the record category properties FilePlanComponent recordCategory = FilePlanComponent.builder() .name(categoryName) - .nodeType(RECORD_CATEGORY_TYPE) + .nodeType(nodeType) .properties( FilePlanComponentProperties.builder() .title(categoryTitle) @@ -109,7 +118,7 @@ public class RecordCategoryTest extends BaseRMRestTest // Verify the returned file plan component properties FilePlanComponentProperties filePlanComponentProperties = filePlanComponent.getProperties(); assertEquals(filePlanComponentProperties.getTitle(), categoryTitle); - + assertNotNull(filePlanComponentProperties.getRmIdentifier()); logger.info("Aspects: " + filePlanComponent.getAspectNames()); }