RM-4023: fixed CI findings

This commit is contained in:
Kristijan Conkas
2016-11-17 09:23:35 +00:00
parent dd5bef1df7
commit 045cf50ec1

View File

@@ -36,7 +36,6 @@ import static org.testng.Assert.assertEquals;
import static org.testng.Assert.assertFalse; import static org.testng.Assert.assertFalse;
import static org.testng.Assert.assertTrue; import static org.testng.Assert.assertTrue;
import java.util.Arrays;
import java.util.List; import java.util.List;
import java.util.stream.Collectors; import java.util.stream.Collectors;
@@ -51,6 +50,7 @@ import org.alfresco.rest.rm.model.fileplancomponents.FilePlanComponentsCollectio
import org.alfresco.rest.rm.requests.FilePlanComponentAPI; import org.alfresco.rest.rm.requests.FilePlanComponentAPI;
import org.alfresco.utility.data.DataUser; import org.alfresco.utility.data.DataUser;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.testng.annotations.DataProvider;
import org.testng.annotations.Test; import org.testng.annotations.Test;
/** /**
@@ -68,14 +68,18 @@ public class UnfiledRecordsFolderTests extends BaseRestTest
private DataUser dataUser; private DataUser dataUser;
/** invalid root level types, at unfiled records root level these shouldn't be possible to create */ /** invalid root level types, at unfiled records root level these shouldn't be possible to create */
private static final List<FilePlanComponentType> INVALID_ROOT_TYPES = Arrays.asList( @DataProvider(name = "invalidRootTypes")
FILE_PLAN_TYPE, public Object[][] createData1() {
RECORD_CATEGORY_TYPE, return new Object[][] {
RECORD_FOLDER_TYPE, { FILE_PLAN_TYPE },
HOLD_TYPE, { RECORD_CATEGORY_TYPE },
HOLD_CONTAINER_TYPE, { RECORD_FOLDER_TYPE },
TRANSFER_CONTAINER_TYPE, { HOLD_TYPE },
UNFILED_CONTAINER_TYPE); { HOLD_CONTAINER_TYPE },
{ TRANSFER_CONTAINER_TYPE },
{ UNFILED_CONTAINER_TYPE }
};
}
/** /**
* Given the unfiled record container root * Given the unfiled record container root
@@ -94,7 +98,7 @@ public class UnfiledRecordsFolderTests extends BaseRestTest
String folderTitle = folderName + " Title"; String folderTitle = folderName + " Title";
String folderDescription = folderName + " Description"; String folderDescription = folderName + " Description";
// Build the record category properties // Build unfiled records folder properties
JsonObject unfiledFolderProperties = buildObject() JsonObject unfiledFolderProperties = buildObject()
.add(NAME, folderName) .add(NAME, folderName)
.add(NODE_TYPE, UNFILED_RECORD_FOLDER_TYPE.toString()) .add(NODE_TYPE, UNFILED_RECORD_FOLDER_TYPE.toString())
@@ -130,8 +134,12 @@ public class UnfiledRecordsFolderTests extends BaseRestTest
/** /**
* Negative test to verify only unfiled record folders can be created at root level * Negative test to verify only unfiled record folders can be created at root level
*/ */
@Test(description = "Only unfiled records folders can be created at unfiled records root level") @Test
public void onlyRecordFoldersCanBeCreatedAtUnfiledRecordsRoot() (
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()); RestWrapper restWrapper = filePlanComponentAPI.usingRestWrapper().authenticateUser(dataUser.getAdminUser());
@@ -139,12 +147,11 @@ public class UnfiledRecordsFolderTests extends BaseRestTest
String folderTitle = folderName + " Title"; String folderTitle = folderName + " Title";
String folderDescription = folderName + " Description"; String folderDescription = folderName + " Description";
INVALID_ROOT_TYPES.stream() logger.info("creating " + componentType.toString());
.peek(a -> logger.info("creating " + a.toString()))
.forEach(t -> {
JsonObject unfiledFolderProperties = buildObject() JsonObject unfiledFolderProperties = buildObject()
.add(NAME, folderName) .add(NAME, folderName)
.add(NODE_TYPE, t.toString()) .add(NODE_TYPE, componentType.toString())
.addObject(PROPERTIES) .addObject(PROPERTIES)
.add(PROPERTIES_TITLE, folderTitle) .add(PROPERTIES_TITLE, folderTitle)
.add(PROPERTIES_DESCRIPTION, folderDescription) .add(PROPERTIES_DESCRIPTION, folderDescription)
@@ -161,7 +168,6 @@ public class UnfiledRecordsFolderTests extends BaseRestTest
// Verify the status code // Verify the status code
restWrapper.assertStatusCodeIs(UNPROCESSABLE_ENTITY); restWrapper.assertStatusCodeIs(UNPROCESSABLE_ENTITY);
});
} }
/** /**
@@ -185,7 +191,7 @@ public class UnfiledRecordsFolderTests extends BaseRestTest
FilePlanComponent parentFolder = createUnfiledRecordsFolder(UNFILED_RECORDS_CONTAINER_ALIAS.toString(), parentFolderName); FilePlanComponent parentFolder = createUnfiledRecordsFolder(UNFILED_RECORDS_CONTAINER_ALIAS.toString(), parentFolderName);
assertEquals(parentFolderName, parentFolder.getName()); assertEquals(parentFolderName, parentFolder.getName());
// Build the record category properties // Build the unfiled records folder properties
JsonObject unfiledFolderProperties = buildObject() JsonObject unfiledFolderProperties = buildObject()
.add(NAME, childFolderName) .add(NAME, childFolderName)
.add(NODE_TYPE, UNFILED_RECORD_FOLDER_TYPE.toString()) .add(NODE_TYPE, UNFILED_RECORD_FOLDER_TYPE.toString())