Feature/rm 5148 create folder and records using auto rename

This commit is contained in:
Ramona Popa
2017-05-19 18:14:38 +01:00
parent 99faac4dbd
commit d34754fb7c
3 changed files with 32 additions and 10 deletions

View File

@@ -49,7 +49,6 @@ import static org.testng.Assert.assertTrue;
import org.alfresco.rest.rm.community.base.BaseRMRestTest;
import org.alfresco.rest.rm.community.model.record.Record;
import org.alfresco.rest.rm.community.model.record.RecordContent;
import org.alfresco.rest.rm.community.model.recordcategory.RecordCategoryChild;
import org.alfresco.rest.rm.community.model.unfiledcontainer.UnfiledContainerChild;
import org.alfresco.rest.rm.community.requests.gscore.api.RecordFolderAPI;
@@ -393,4 +392,33 @@ public class ElectronicRecordTests extends BaseRMRestTest
assertTrue(unfiledRecordFoldersAPI.getUnfiledRecordFolder(record.getParentId()).getName().equals(unfiledRecordFolderPathEl4));
}
/**
* <pre>
* Given a parent container that is a record folder
* When I try to create a record with name1 and create another one with the same given name
* Then the second record is created with success
* </pre>
*
* @throws Exception
* if record can't be created
*/
@Test(description = "Electronic records can be created in record folder with duplicate name")
@Bug(id ="RM-5116, RM-5012")
public void canCreateElectronicRecordsWithDuplicateName() throws Exception
{
RecordCategoryChild recordFolder = createCategoryFolderInFilePlan();
// Create an electronic record with the name "Record 1"
Record recordModel = Record.builder().name("Record 1").nodeType(CONTENT_TYPE).build();
getRestAPIFactory().getRecordFolderAPI().createRecord(recordModel, recordFolder.getId());
// Verify the status code
assertStatusCode(CREATED);
// Try to create another electronic record with the same name
getRestAPIFactory().getRecordFolderAPI().createRecord(recordModel, recordFolder.getId());
// Verify the status code
assertStatusCode(CREATED);
}
}

View File

@@ -33,9 +33,9 @@ import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanCo
import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentType.UNFILED_CONTAINER_TYPE;
import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentType.UNFILED_RECORD_FOLDER_TYPE;
import static org.alfresco.rest.rm.community.util.PojoUtility.toJson;
import static org.alfresco.rest.rm.community.utils.FilePlanComponentsUtil.createNonElectronicRecordModel;
import static org.alfresco.rest.rm.community.utils.FilePlanComponentsUtil.createFullNonElectronicUnfiledContainerChildRecordModel;
import static org.alfresco.rest.rm.community.utils.FilePlanComponentsUtil.createFullNonElectronicRecordModel;
import static org.alfresco.rest.rm.community.utils.FilePlanComponentsUtil.createFullNonElectronicUnfiledContainerChildRecordModel;
import static org.alfresco.rest.rm.community.utils.FilePlanComponentsUtil.createNonElectronicRecordModel;
import static org.alfresco.rest.rm.community.utils.FilePlanComponentsUtil.verifyFullNonElectronicRecord;
import static org.alfresco.utility.constants.UserRole.SiteManager;
import static org.alfresco.utility.data.RandomData.getRandomAlphanumeric;