mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-07-31 17:39:05 +00:00
RM-4542: record name doesn't default to file name
This commit is contained in:
@@ -178,6 +178,7 @@ public class FilePlanComponentAPI extends RestAPI<FilePlanComponentAPI>
|
||||
.auth().basic(currentUser.getUsername(), currentUser.getPassword())
|
||||
.multiPart("nodeBodyCreate", toJson(electronicRecordModel), ContentType.JSON.name())
|
||||
.multiPart("filedata", recordContent, ContentType.BINARY.name())
|
||||
.multiPart("name", electronicRecordModel.getName() != null ? electronicRecordModel.getName() : recordContent.getName())
|
||||
.when()
|
||||
.post("fileplan-components/{fileplanComponentId}/children?{parameters}", parentId, getParameters())
|
||||
.andReturn();
|
||||
|
@@ -223,6 +223,37 @@ public class ElectronicRecordTests extends BaseRestTest
|
||||
// verify the create request status code
|
||||
filePlanComponentAPI.usingRestWrapper().assertStatusCodeIs(CREATED);
|
||||
|
||||
// get newly created electonic record and verify its properties
|
||||
FilePlanComponent electronicRecord = filePlanComponentAPI.getFilePlanComponent(newRecordId);
|
||||
// created record will have record identifier inserted in its name but will be prefixed with
|
||||
// the name it was created as
|
||||
assertTrue(electronicRecord.getName().startsWith(record.getName()));
|
||||
}
|
||||
|
||||
/**
|
||||
* This test verified that in the test client implementation if record name isn't specified it
|
||||
* defaults to filed file name.
|
||||
* @param container valid record container
|
||||
* @throws Exception if record creation failed
|
||||
*/
|
||||
@Test
|
||||
(
|
||||
dataProvider = "validRootContainers",
|
||||
description = "Electronic records can be created in unfiled record folder or unfiled record root"
|
||||
)
|
||||
public void recordNameDerivedFromFileName(FilePlanComponent container) throws Exception
|
||||
{
|
||||
filePlanComponentAPI.usingRestWrapper().authenticateUser(dataUser.getAdminUser());
|
||||
|
||||
// record object without name set
|
||||
FilePlanComponent record = new FilePlanComponent();
|
||||
record.setNodeType(CONTENT_TYPE.toString());
|
||||
record.setProperties(new FilePlanComponentProperties());
|
||||
String newRecordId = filePlanComponentAPI.createElectronicRecord(record, IMAGE_FILE, container.getId()).getId();
|
||||
|
||||
// verify the create request status code
|
||||
filePlanComponentAPI.usingRestWrapper().assertStatusCodeIs(CREATED);
|
||||
|
||||
// get newly created electonic record and verify its properties
|
||||
FilePlanComponent electronicRecord = filePlanComponentAPI.getFilePlanComponent(newRecordId);
|
||||
// record will have record identifier inserted in its name but will for sure start with file name
|
||||
|
Reference in New Issue
Block a user