mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-07-31 17:39:05 +00:00
Merge branch 'feature/RM-4367_RecordCategoryAcceptOnly' into 'master'
Feature/rm 4367 record category accept only Test created to cover the issue https://issues.alfresco.com/jira/browse/RM-4367 See merge request !640
This commit is contained in:
@@ -27,8 +27,11 @@ public enum FilePlanComponentType
|
||||
HOLD_TYPE("rma:hold"),
|
||||
UNFILED_RECORD_FOLDER_TYPE("rma:unfiledRecordFolder"),
|
||||
HOLD_CONTAINER_TYPE("rma:holdContainer"),
|
||||
TRANSFER_TYPE("rma:transfer"),
|
||||
TRANSFER_CONTAINER_TYPE("rma:transferContainer"),
|
||||
UNFILED_CONTAINER_TYPE("rma:unfiledRecordContainer");
|
||||
UNFILED_CONTAINER_TYPE("rma:unfiledRecordContainer"),
|
||||
FOLDER_TYPE("cm:folder"),
|
||||
CONTENT_TYPE("cm:content");
|
||||
|
||||
private String type;
|
||||
|
||||
|
@@ -15,10 +15,15 @@ import static org.alfresco.rest.rm.model.fileplancomponents.FilePlanComponentAli
|
||||
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.CONTENT_TYPE;
|
||||
import static org.alfresco.rest.rm.model.fileplancomponents.FilePlanComponentType.FILE_PLAN_TYPE;
|
||||
import static org.alfresco.rest.rm.model.fileplancomponents.FilePlanComponentType.FOLDER_TYPE;
|
||||
import static org.alfresco.rest.rm.model.fileplancomponents.FilePlanComponentType.HOLD_CONTAINER_TYPE;
|
||||
import static org.alfresco.rest.rm.model.fileplancomponents.FilePlanComponentType.HOLD_TYPE;
|
||||
import static org.alfresco.rest.rm.model.fileplancomponents.FilePlanComponentType.TRANSFER_CONTAINER_TYPE;
|
||||
import static org.alfresco.rest.rm.model.fileplancomponents.FilePlanComponentType.TRANSFER_TYPE;
|
||||
import static org.alfresco.rest.rm.model.fileplancomponents.FilePlanComponentType.UNFILED_CONTAINER_TYPE;
|
||||
import static org.alfresco.rest.rm.model.fileplancomponents.FilePlanComponentType.UNFILED_RECORD_FOLDER_TYPE;
|
||||
import static org.alfresco.utility.data.RandomData.getRandomAlphanumeric;
|
||||
|
||||
import org.testng.annotations.DataProvider;
|
||||
@@ -98,4 +103,28 @@ public interface TestData
|
||||
* 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()}
|
||||
};
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -24,6 +24,7 @@ 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 +36,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.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.FilePlanComponentType;
|
||||
import org.alfresco.rest.rm.model.fileplancomponents.FilePlanComponentsCollection;
|
||||
import org.alfresco.rest.rm.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 +336,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
|
||||
FilePlanComponent fpc = filePlanComponentAPI.createFilePlanComponent(componentProperties, category.getId());
|
||||
filePlanComponentAPI.usingRestWrapper().assertStatusCodeIs(UNPROCESSABLE_ENTITY);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Helper method to create child category
|
||||
*
|
||||
|
Reference in New Issue
Block a user