mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-07-31 17:39:05 +00:00
New test for RM-4367
This commit is contained in:
@@ -27,8 +27,11 @@ public enum FilePlanComponentType
|
|||||||
HOLD_TYPE("rma:hold"),
|
HOLD_TYPE("rma:hold"),
|
||||||
UNFILED_RECORD_FOLDER_TYPE("rma:unfiledRecordFolder"),
|
UNFILED_RECORD_FOLDER_TYPE("rma:unfiledRecordFolder"),
|
||||||
HOLD_CONTAINER_TYPE("rma:holdContainer"),
|
HOLD_CONTAINER_TYPE("rma:holdContainer"),
|
||||||
|
TRANSFER_TYPE("rma:transfer"),
|
||||||
TRANSFER_CONTAINER_TYPE("rma:transferContainer"),
|
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;
|
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.HOLDS_ALIAS;
|
||||||
import static org.alfresco.rest.rm.model.fileplancomponents.FilePlanComponentAlias.TRANSFERS_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.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.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_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_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_CONTAINER_TYPE;
|
||||||
|
import static org.alfresco.rest.rm.model.fileplancomponents.FilePlanComponentType.UNFILED_RECORD_FOLDER_TYPE;
|
||||||
import static org.alfresco.utility.data.RandomData.getRandomAlphanumeric;
|
import static org.alfresco.utility.data.RandomData.getRandomAlphanumeric;
|
||||||
|
|
||||||
import org.testng.annotations.DataProvider;
|
import org.testng.annotations.DataProvider;
|
||||||
@@ -98,4 +103,28 @@ public interface TestData
|
|||||||
* The default FOLDER title used when creating categories
|
* The default FOLDER title used when creating categories
|
||||||
*/
|
*/
|
||||||
public static String FOLDER_TITLE = "FOLDER TITLE" + getRandomAlphanumeric();
|
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.NOT_FOUND;
|
||||||
import static org.springframework.http.HttpStatus.NO_CONTENT;
|
import static org.springframework.http.HttpStatus.NO_CONTENT;
|
||||||
import static org.springframework.http.HttpStatus.OK;
|
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.assertEquals;
|
||||||
import static org.testng.Assert.assertFalse;
|
import static org.testng.Assert.assertFalse;
|
||||||
import static org.testng.Assert.assertNotNull;
|
import static org.testng.Assert.assertNotNull;
|
||||||
@@ -35,8 +36,9 @@ import java.util.NoSuchElementException;
|
|||||||
|
|
||||||
import com.google.gson.JsonObject;
|
import com.google.gson.JsonObject;
|
||||||
|
|
||||||
import org.alfresco.rest.rm.base.BaseRestTest;
|
|
||||||
import org.alfresco.rest.core.RestWrapper;
|
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.FilePlanComponent;
|
||||||
import org.alfresco.rest.rm.model.fileplancomponents.FilePlanComponentProperties;
|
import org.alfresco.rest.rm.model.fileplancomponents.FilePlanComponentProperties;
|
||||||
import org.alfresco.rest.rm.model.fileplancomponents.FilePlanComponentType;
|
import org.alfresco.rest.rm.model.fileplancomponents.FilePlanComponentType;
|
||||||
@@ -333,6 +335,39 @@ public class RecordCategoryTest extends BaseRestTest
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <pre>
|
||||||
|
* 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 object types not allowed inside a category",
|
||||||
|
dataProviderClass = TestData.class,
|
||||||
|
dataProvider = "childrenNotAllowedForCategory"
|
||||||
|
|
||||||
|
)
|
||||||
|
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);
|
||||||
|
|
||||||
|
JsonObject componentProperties = buildObject()
|
||||||
|
.add(NAME, COMPONENT_NAME)
|
||||||
|
.add(NODE_TYPE, nodeType)
|
||||||
|
.addObject(PROPERTIES)
|
||||||
|
.add(PROPERTIES_TITLE, "Title for " + COMPONENT_NAME)
|
||||||
|
.end()
|
||||||
|
.getJson();
|
||||||
|
|
||||||
|
FilePlanComponent fpc = filePlanComponentAPI.createFilePlanComponent(componentProperties, category.getId());
|
||||||
|
filePlanComponentAPI.usingRestWrapper().assertStatusCodeIs(UNPROCESSABLE_ENTITY);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Helper method to create child category
|
* Helper method to create child category
|
||||||
*
|
*
|
||||||
|
Reference in New Issue
Block a user