review updates

This commit is contained in:
Rodica Sutu
2017-04-28 12:43:55 +03:00
parent cf96210824
commit e439f8d14b
2 changed files with 32 additions and 24 deletions

View File

@@ -67,7 +67,6 @@ import org.alfresco.rest.rm.community.requests.gscore.api.FilePlanAPI;
import org.alfresco.rest.rm.community.requests.gscore.api.RecordCategoryAPI; import org.alfresco.rest.rm.community.requests.gscore.api.RecordCategoryAPI;
import org.alfresco.rest.rm.community.requests.gscore.api.RecordFolderAPI; import org.alfresco.rest.rm.community.requests.gscore.api.RecordFolderAPI;
import org.alfresco.utility.report.Bug; import org.alfresco.utility.report.Bug;
import org.testng.AssertJUnit;
import org.testng.annotations.DataProvider; import org.testng.annotations.DataProvider;
import org.testng.annotations.Test; import org.testng.annotations.Test;
@@ -162,6 +161,7 @@ public class RecordCategoryTests extends BaseRMRestTest
// Create the root record category // Create the root record category
RecordCategory rootRecordCategory = createRootCategory(categoryName, categoryTitle); RecordCategory rootRecordCategory = createRootCategory(categoryName, categoryTitle);
int totalEntries= getRestAPIFactory().getFilePlansAPI().getRootRecordCategories(FILE_PLAN_ALIAS).getPagination().getTotalItems();
// Delete the record category // Delete the record category
RecordCategoryAPI recordCategoryAPI = getRestAPIFactory().getRecordCategoryAPI(); RecordCategoryAPI recordCategoryAPI = getRestAPIFactory().getRecordCategoryAPI();
String recordCategoryId = rootRecordCategory.getId(); String recordCategoryId = rootRecordCategory.getId();
@@ -173,6 +173,9 @@ public class RecordCategoryTests extends BaseRMRestTest
// Deleted component should no longer be retrievable // Deleted component should no longer be retrievable
recordCategoryAPI.getRecordCategory(recordCategoryId); recordCategoryAPI.getRecordCategory(recordCategoryId);
assertStatusCode(NOT_FOUND); assertStatusCode(NOT_FOUND);
//check the number of entries after delete
int totalEntriesAfterDelete = getRestAPIFactory().getFilePlansAPI().getRootRecordCategories(FILE_PLAN_ALIAS).getPagination().getTotalItems();
assertEquals(totalEntriesAfterDelete,(totalEntries-1));
} }
/** /**
@@ -195,7 +198,7 @@ public class RecordCategoryTests extends BaseRMRestTest
recordCategoryAPI.deleteRecordCategory(nodeId); recordCategoryAPI.deleteRecordCategory(nodeId);
// Verify the status code // Verify the status code
assertStatusCode(BAD_REQUEST); assertStatusCode(BAD_REQUEST);
} }
@@ -270,18 +273,18 @@ public class RecordCategoryTests extends BaseRMRestTest
assertStatusCode(CREATED); assertStatusCode(CREATED);
// Check record folder has been created within the record category // Check record folder has been created within the record category
AssertJUnit.assertEquals(rootRecordCategory.getId(), recordFolder.getParentId()); assertEquals(rootRecordCategory.getId(), recordFolder.getParentId());
// Verify the returned values for the record folder // Verify the returned values for the record folder
assertFalse(recordFolder.getIsRecordCategory()); assertFalse(recordFolder.getIsRecordCategory());
AssertJUnit.assertTrue(recordFolder.getIsRecordFolder()); assertTrue(recordFolder.getIsRecordFolder());
AssertJUnit.assertEquals(recordFolder.getName(), RECORD_FOLDER_NAME); assertEquals(recordFolder.getName(), RECORD_FOLDER_NAME);
AssertJUnit.assertEquals(recordFolder.getNodeType(), RECORD_FOLDER_TYPE); assertEquals(recordFolder.getNodeType(), RECORD_FOLDER_TYPE);
AssertJUnit.assertEquals(recordFolder.getCreatedByUser().getId(), getAdminUser().getUsername()); assertEquals(recordFolder.getCreatedByUser().getId(), getAdminUser().getUsername());
// Verify the returned record folder properties // Verify the returned record folder properties
RecordCategoryChildProperties folderProperties = recordFolder.getProperties(); RecordCategoryChildProperties folderProperties = recordFolder.getProperties();
AssertJUnit.assertEquals(folderProperties.getTitle(), TITLE_PREFIX + RECORD_FOLDER_NAME); assertEquals(folderProperties.getTitle(), TITLE_PREFIX + RECORD_FOLDER_NAME);
assertNotNull(folderProperties.getIdentifier()); assertNotNull(folderProperties.getIdentifier());
} }
/** /**
@@ -454,7 +457,7 @@ public class RecordCategoryTests extends BaseRMRestTest
assertEquals(recordCategoryChild.getParentId(), rootRecordCategory.getId()); assertEquals(recordCategoryChild.getParentId(), rootRecordCategory.getId());
// Boolean properties related to node type // Boolean properties related to node type
AssertJUnit.assertTrue(recordCategoryChild.getIsRecordFolder()); assertTrue(recordCategoryChild.getIsRecordFolder());
assertFalse(recordCategoryChild.getIsRecordCategory()); assertFalse(recordCategoryChild.getIsRecordCategory());
assertEquals(createdComponent.getName(), recordCategoryChild.getName()); assertEquals(createdComponent.getName(), recordCategoryChild.getName());

View File

@@ -235,11 +235,14 @@ public class UnfiledRecordsFolderTests extends BaseRMRestTest
assertEquals(unfiledParentFolderName, unfiledParentFolder.getName()); assertEquals(unfiledParentFolderName, unfiledParentFolder.getName());
// Build the unfiled records folder properties // Build the unfiled records folder properties
UnfiledContainerChild unfiledChildFolderModel = UnfiledContainerChild.builder().name(unfiledChildFolderName) UnfiledContainerChild unfiledChildFolderModel =
.nodeType(UNFILED_RECORD_FOLDER_TYPE) UnfiledContainerChild.builder()
.properties(UnfiledContainerChildProperties.builder().title(FilePlanComponentsUtil.TITLE_PREFIX + unfiledChildFolderName) .name(unfiledChildFolderName)
.description(FilePlanComponentsUtil.DESCRIPTION_PREFIX + unfiledChildFolderName).build()) .nodeType(UNFILED_RECORD_FOLDER_TYPE)
.build(); .properties(UnfiledContainerChildProperties.builder()
.title(FilePlanComponentsUtil.TITLE_PREFIX + unfiledChildFolderName)
.description(FilePlanComponentsUtil.DESCRIPTION_PREFIX + unfiledChildFolderName).build())
.build();
// Create it as a child of parentFolder // Create it as a child of parentFolder
UnfiledContainerChild unfiledChildFolder = getRestAPIFactory().getUnfiledRecordFoldersAPI() UnfiledContainerChild unfiledChildFolder = getRestAPIFactory().getUnfiledRecordFoldersAPI()
@@ -305,15 +308,16 @@ public class UnfiledRecordsFolderTests extends BaseRMRestTest
assertEquals(unfiledFolderName, unfiledFolderToModify.getName()); assertEquals(unfiledFolderName, unfiledFolderToModify.getName());
// Build the properties which will be updated // Build the properties which will be updated
UnfiledRecordFolder unfiledChildFolderModel = UnfiledRecordFolder.builder() UnfiledRecordFolder unfiledChildFolderModel =
.name(modified + unfiledFolderName) UnfiledRecordFolder.builder()
.properties .name(modified + unfiledFolderName)
(UnfiledContainerChildProperties.builder() .properties
.title(modified + unfiledFolderToModify.getProperties().getTitle()) (UnfiledContainerChildProperties.builder()
.description(modified + unfiledFolderToModify.getProperties().getDescription()) .title(modified + unfiledFolderToModify.getProperties().getTitle())
.build() .description(modified + unfiledFolderToModify.getProperties().getDescription())
) .build()
.build(); )
.build();
@@ -484,7 +488,8 @@ public class UnfiledRecordsFolderTests extends BaseRMRestTest
assertTrue(createdComponent.getName().contains(createdComponent.getProperties().getIdentifier())); assertTrue(createdComponent.getName().contains(createdComponent.getProperties().getIdentifier()));
assertEquals(createdComponent.getNodeType(), record.getNodeType()); assertEquals(createdComponent.getNodeType(), record.getNodeType());
} catch (NoSuchElementException e) }
catch (NoSuchElementException e)
{ {
fail("No child element for " + record.getId()); fail("No child element for " + record.getId());
} }