updates: test to cover the scenario when a cm:folder is converted to a recordCategory

This commit is contained in:
Rodica Sutu
2017-02-09 17:30:42 +02:00
parent 6bccc5f827
commit ea0239b9a8
2 changed files with 33 additions and 6 deletions

View File

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

View File

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