From a35637ba09b442abe9ae05b08d0d31ceb7c52564 Mon Sep 17 00:00:00 2001 From: Rodica Sutu Date: Thu, 9 Feb 2017 12:44:04 +0200 Subject: [PATCH 1/4] additional checks to cover the issue RM-4572 --- .../FilePlanComponentProperties.java | 4 ++-- .../rest/rm/community/base/TestData.java | 21 +++++++++++++++-- .../ElectronicRecordTests.java | 2 ++ .../NonElectronicRecordTests.java | 6 ++++- .../fileplancomponents/ReadRecordTests.java | 23 +++++++++++-------- .../RecordCategoryTest.java | 3 ++- .../fileplancomponents/RecordFolderTests.java | 16 ++++++++++--- 7 files changed, 57 insertions(+), 18 deletions(-) diff --git a/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/model/fileplancomponents/FilePlanComponentProperties.java b/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/model/fileplancomponents/FilePlanComponentProperties.java index 4313910e50..950c4f18ee 100644 --- a/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/model/fileplancomponents/FilePlanComponentProperties.java +++ b/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/model/fileplancomponents/FilePlanComponentProperties.java @@ -107,7 +107,7 @@ public class FilePlanComponentProperties @JsonProperty(value = PROPERTIES_PHYSICAL_SIZE, required = false) private Integer physicalSize; - + @JsonProperty(value = PROPERTIES_RECORD_ID, required = false) - private String recordId; + private String rmIdentifier; } diff --git a/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/base/TestData.java b/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/base/TestData.java index 7fa5baa8e9..9d475ad71d 100644 --- a/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/base/TestData.java +++ b/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/base/TestData.java @@ -32,8 +32,10 @@ import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanCo import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentAlias.UNFILED_RECORDS_CONTAINER_ALIAS; import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentType.CONTENT_TYPE; import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentType.FILE_PLAN_TYPE; +import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentType.FOLDER_TYPE; import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentType.HOLD_CONTAINER_TYPE; import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentType.HOLD_TYPE; +import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentType.RECORD_FOLDER_TYPE; import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentType.TRANSFER_CONTAINER_TYPE; import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentType.TRANSFER_TYPE; import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentType.UNFILED_CONTAINER_TYPE; @@ -122,12 +124,12 @@ public interface TestData * The default electronic record name used when creating electronic records */ public static String ELECTRONIC_RECORD_NAME = "Record electronic" + getRandomAlphanumeric(); - + /** * The default Non electronic record name used when creating non-electronic records */ public static String NONELECTRONIC_RECORD_NAME = "Record nonelectronic" + getRandomAlphanumeric(); - + /** * Data Provider with: * with the object types not allowed as children for a record category @@ -148,4 +150,19 @@ public interface TestData { CONTENT_TYPE } }; } + + /** + * Data Provider with: + * with the object types for creating a Record Folder + * + * @return file plan component alias + */ + @DataProvider + public static Object[][] folderTypes() + { + return new Object[][] { + {RECORD_FOLDER_TYPE}, + {FOLDER_TYPE} + }; + } } diff --git a/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/fileplancomponents/ElectronicRecordTests.java b/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/fileplancomponents/ElectronicRecordTests.java index 3322e4b346..9cae3f6215 100644 --- a/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/fileplancomponents/ElectronicRecordTests.java +++ b/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/fileplancomponents/ElectronicRecordTests.java @@ -221,6 +221,7 @@ public class ElectronicRecordTests extends BaseRMRestTest // 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())); + assertTrue(electronicRecord.getName().contains(electronicRecord.getProperties().getRmIdentifier())); } /** @@ -252,6 +253,7 @@ public class ElectronicRecordTests extends BaseRMRestTest // record will have record identifier inserted in its name but will for sure start with file name // and end with its extension assertTrue(electronicRecord.getName().startsWith(IMAGE_FILE.substring(0, IMAGE_FILE.indexOf(".")))); + assertTrue(electronicRecord.getName().contains(electronicRecord.getProperties().getRmIdentifier())); } @Test diff --git a/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/fileplancomponents/NonElectronicRecordTests.java b/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/fileplancomponents/NonElectronicRecordTests.java index 0e09096d4d..681ef8d1f2 100644 --- a/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/fileplancomponents/NonElectronicRecordTests.java +++ b/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/fileplancomponents/NonElectronicRecordTests.java @@ -44,6 +44,7 @@ import static org.springframework.http.HttpStatus.FORBIDDEN; import static org.springframework.http.HttpStatus.UNPROCESSABLE_ENTITY; import static org.testng.Assert.assertEquals; import static org.testng.Assert.assertFalse; +import static org.testng.Assert.assertTrue; import java.util.Random; @@ -142,6 +143,7 @@ public class NonElectronicRecordTests extends BaseRMRestTest String file = "File " + getRandomAlphanumeric(); String shelf = "Shelf " + getRandomAlphanumeric(); String location = "Location " + getRandomAlphanumeric(); + String name = "Record " + getRandomAlphanumeric(); Random random = new Random(); Integer copies = random.nextInt(Integer.MAX_VALUE); @@ -149,7 +151,7 @@ public class NonElectronicRecordTests extends BaseRMRestTest // set values of all available properties for the non electronic records FilePlanComponent filePlanComponent = FilePlanComponent.builder() - .name("Record " + getRandomAlphanumeric()) + .name(name) .nodeType(NON_ELECTRONIC_RECORD_TYPE) .properties(FilePlanComponentProperties.builder() .title(title) @@ -183,6 +185,8 @@ public class NonElectronicRecordTests extends BaseRMRestTest assertEquals(location, nonElectronicRecord.getProperties().getLocation()); assertEquals(copies, nonElectronicRecord.getProperties().getNumberOfCopies()); assertEquals(size, nonElectronicRecord.getProperties().getPhysicalSize()); + assertTrue(nonElectronicRecord.getName().contains(nonElectronicRecord.getProperties().getRmIdentifier())); + assertTrue(nonElectronicRecord.getName().contains(name)); } /** diff --git a/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/fileplancomponents/ReadRecordTests.java b/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/fileplancomponents/ReadRecordTests.java index 8cf2ee3668..d46ace9914 100644 --- a/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/fileplancomponents/ReadRecordTests.java +++ b/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/fileplancomponents/ReadRecordTests.java @@ -85,7 +85,7 @@ public class ReadRecordTests extends BaseRMRestTest .nodeType(CONTENT_TYPE.toString()) .content(FilePlanComponentContent.builder().mimeType("text/plain").build()) .build(); - + private FilePlanComponent nonelectronicRecord = FilePlanComponent.builder() .properties(FilePlanComponentProperties.builder() .description(NONELECTRONIC_RECORD_NAME) @@ -178,6 +178,8 @@ public class ReadRecordTests extends BaseRMRestTest assertNotNull(recordWithContent.getContent().getEncoding()); assertNotNull(recordWithContent.getContent().getMimeType()); assertNotNull(recordWithContent.getAspectNames()); + assertFalse(recordWithContent.getName().equals(ELECTRONIC_RECORD_NAME)); + assertTrue(recordWithContent.getName().contains(recordWithContent.getProperties().getRmIdentifier())); assertStatusCode(OK); //create non-electronic record @@ -196,6 +198,8 @@ public class ReadRecordTests extends BaseRMRestTest assertNotNull(nonElectronicRecord.getContent().getMimeType()); assertNotNull(nonElectronicRecord.getAspectNames()); assertEquals(nonElectronicRecord.getProperties().getDescription(), NONELECTRONIC_RECORD_NAME); + assertFalse(nonElectronicRecord.getName().equals(NONELECTRONIC_RECORD_NAME)); + assertTrue(nonElectronicRecord.getName().contains(nonElectronicRecord.getProperties().getRmIdentifier())); assertStatusCode(OK); } @@ -209,11 +213,11 @@ public class ReadRecordTests extends BaseRMRestTest { FilePlanComponentAPI filePlanComponentAPI = getRestAPIFactory().getFilePlanComponentsAPI(); RecordsAPI recordsAPI = getRestAPIFactory().getRecordsAPI(); - + String RECORD_ELECTRONIC = "Record " + getRandomAlphanumeric(); String RECORD_ELECTRONIC_BINARY = "Binary Record" + getRandomAlphanumeric(); String RELATIVE_PATH = "/" + CATEGORY_NAME + getRandomAlphanumeric() + "/folder"; - + // create the containers from the relativePath FilePlanComponent recordFolder = FilePlanComponent.builder() .name(FOLDER_NAME) @@ -221,7 +225,7 @@ public class ReadRecordTests extends BaseRMRestTest .relativePath(RELATIVE_PATH) .build(); String folderId = filePlanComponentAPI.createFilePlanComponent(recordFolder, FILE_PLAN_ALIAS).getId(); - + // text file as an electronic record FilePlanComponent recordText = FilePlanComponent.builder() .name(RECORD_ELECTRONIC) @@ -237,19 +241,19 @@ public class ReadRecordTests extends BaseRMRestTest .name(RECORD_ELECTRONIC_BINARY) .nodeType(CONTENT_TYPE) .build(); - + String binaryRecordId = filePlanComponentAPI.createElectronicRecord(recordBinary, IMAGE_FILE, folderId).getId(); // binary content, therefore compare respective SHA1 checksums in order to verify this is identical content try ( InputStream recordContentStream = recordsAPI.getRecordContent(binaryRecordId).asInputStream(); FileInputStream localFileStream = new FileInputStream(new File(Resources.getResource(IMAGE_FILE).getFile())); - ) + ) { assertEquals(DigestUtils.sha1(recordContentStream), DigestUtils.sha1(localFileStream)); } assertStatusCode(OK); - + // electronic record with no content FilePlanComponent recordNoContent = FilePlanComponent.builder() .name(RECORD_ELECTRONIC) @@ -390,8 +394,9 @@ public class ReadRecordTests extends BaseRMRestTest assertFalse(filePlanComponent.getIsRecordFolder()); assertFalse(filePlanComponent.getIsCategory()); - //assertEquals(createdComponent.getName(), filePlanComponent.getName()); - assertTrue(filePlanComponent.getName().startsWith(createdComponent.getName())); + //check the record name + assertTrue(filePlanComponent.getName().equals(createdComponent.getName())); + assertTrue(createdComponent.getName().contains(createdComponent.getProperties().getRmIdentifier())); assertEquals(createdComponent.getNodeType(), filePlanComponent.getNodeType()); } diff --git a/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/fileplancomponents/RecordCategoryTest.java b/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/fileplancomponents/RecordCategoryTest.java index 653e83ef25..24a84d0818 100644 --- a/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/fileplancomponents/RecordCategoryTest.java +++ b/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/fileplancomponents/RecordCategoryTest.java @@ -316,6 +316,7 @@ public class RecordCategoryTest extends BaseRMRestTest // Verify properties // FIXME: Verify properties + assertNotNull(createdComponent.getProperties().getRmIdentifier()); } catch (NoSuchElementException e) { @@ -336,7 +337,7 @@ public class RecordCategoryTest extends BaseRMRestTest dataProvider = "childrenNotAllowedForCategory" ) - @Bug (id="RM-4367") + @Bug (id="RM-4367, RM-4572") public void createTypesNotAllowedInCategory(String nodeType) throws Exception { String COMPONENT_NAME = "Component"+getRandomAlphanumeric(); diff --git a/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/fileplancomponents/RecordFolderTests.java b/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/fileplancomponents/RecordFolderTests.java index cae584fdb8..86bf3b2e1a 100644 --- a/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/fileplancomponents/RecordFolderTests.java +++ b/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/fileplancomponents/RecordFolderTests.java @@ -74,12 +74,21 @@ public class RecordFolderTests extends BaseRMRestTest * Given that a record category exists * When I use the API to create a new record folder * Then it is created within the record category + * + * Given that a record category exists + * When I use the API to create a folder (cm:folder type) + * Then the folder is converted to rma:recordFolder within the record category + * (see RM-4572 comments) + * */ @Test ( - description = "Create a folder into a record category" + description = "Create a folder into a record category.", + dataProviderClass = TestData.class, + dataProvider = "folderTypes" ) - public void createFolderTest() throws Exception + @Bug (id = "RM-4572") + public void createFolderTest(String folderType) throws Exception { String CATEGORY = CATEGORY_NAME + getRandomAlphanumeric(); @@ -88,7 +97,7 @@ public class RecordFolderTests extends BaseRMRestTest FilePlanComponent recordFolder = FilePlanComponent.builder() .name(FOLDER_NAME) - .nodeType(RECORD_FOLDER_TYPE) + .nodeType(folderType) .properties(FilePlanComponentProperties.builder() .title(FOLDER_TITLE) .build()) @@ -113,6 +122,7 @@ public class RecordFolderTests extends BaseRMRestTest // Verify the returned file plan component properties FilePlanComponentProperties folderProperties = folder.getProperties(); assertEquals(folderProperties.getTitle(), FOLDER_TITLE); + assertNotNull(folderProperties.getRmIdentifier()); } /** From 1495e351b916755074a9520d526c19099ad3b6fb Mon Sep 17 00:00:00 2001 From: Rodica Sutu Date: Thu, 9 Feb 2017 17:30:42 +0200 Subject: [PATCH 2/4] updates: test to cover the scenario when a cm:folder is converted to a recordCategory --- .../rest/rm/community/base/TestData.java | 22 +++++++++++++++++-- .../RecordCategoryTest.java | 17 ++++++++++---- 2 files changed, 33 insertions(+), 6 deletions(-) diff --git a/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/base/TestData.java b/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/base/TestData.java index 9d475ad71d..b2f08c7d2f 100644 --- a/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/base/TestData.java +++ b/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/base/TestData.java @@ -35,6 +35,7 @@ import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanCo import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentType.FOLDER_TYPE; import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentType.HOLD_CONTAINER_TYPE; import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentType.HOLD_TYPE; +import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentType.RECORD_CATEGORY_TYPE; import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentType.RECORD_FOLDER_TYPE; import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentType.TRANSFER_CONTAINER_TYPE; import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentType.TRANSFER_TYPE; @@ -151,6 +152,8 @@ public interface TestData }; } + + /** * Data Provider with: * with the object types for creating a Record Folder @@ -161,8 +164,23 @@ public interface TestData public static Object[][] folderTypes() { return new Object[][] { - {RECORD_FOLDER_TYPE}, - {FOLDER_TYPE} + { RECORD_FOLDER_TYPE }, + { FOLDER_TYPE } + }; + } + + /** + * Data Provider with: + * with the object types for creating a Record Category + * + * @return file plan component alias + */ + @DataProvider + public static Object[][] categoryTypes() + { + return new Object[][] { + { FOLDER_TYPE }, + { RECORD_CATEGORY_TYPE } }; } } diff --git a/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/fileplancomponents/RecordCategoryTest.java b/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/fileplancomponents/RecordCategoryTest.java index 24a84d0818..51483fffd3 100644 --- a/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/fileplancomponents/RecordCategoryTest.java +++ b/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/fileplancomponents/RecordCategoryTest.java @@ -70,12 +70,21 @@ public class RecordCategoryTest extends BaseRMRestTest * Given that a file plan exists * When I ask the API to create a root record category * Then it is created as a root record category + * + * + * Given that a file plan exists + * When I use the API to create a folder (cm:folder type) into the fileplan + * Then the folder is converted to rma:recordCategory + * (see RM-4572 comments) + * */ @Test ( - description = "Create root category" + description = "Create root category", + dataProviderClass= TestData.class, + dataProvider = "categoryTypes" ) - public void createCategoryTest() throws Exception + public void createCategoryTest(String nodeType) throws Exception { String categoryName = "Category name " + getRandomAlphanumeric(); String categoryTitle = "Category title " + getRandomAlphanumeric(); @@ -83,7 +92,7 @@ public class RecordCategoryTest extends BaseRMRestTest // Build the record category properties FilePlanComponent recordCategory = FilePlanComponent.builder() .name(categoryName) - .nodeType(RECORD_CATEGORY_TYPE) + .nodeType(nodeType) .properties( FilePlanComponentProperties.builder() .title(categoryTitle) @@ -109,7 +118,7 @@ public class RecordCategoryTest extends BaseRMRestTest // Verify the returned file plan component properties FilePlanComponentProperties filePlanComponentProperties = filePlanComponent.getProperties(); assertEquals(filePlanComponentProperties.getTitle(), categoryTitle); - + assertNotNull(filePlanComponentProperties.getRmIdentifier()); logger.info("Aspects: " + filePlanComponent.getAspectNames()); } From b1033ad999bfd7d250ed6c79b764e7a78ab95e7d Mon Sep 17 00:00:00 2001 From: Silviu Dinuta Date: Thu, 9 Feb 2017 18:02:06 +0200 Subject: [PATCH 3/4] RM-4595: changed all ocurences of IGNode to FilePlanComponent in ig-core.yaml file --- .../main/webapp/definitions/ig-core-api.yaml | 70 +++++++++---------- 1 file changed, 35 insertions(+), 35 deletions(-) diff --git a/rm-community/rm-community-rest-api-explorer/src/main/webapp/definitions/ig-core-api.yaml b/rm-community/rm-community-rest-api-explorer/src/main/webapp/definitions/ig-core-api.yaml index 7550e5c147..5cba27939b 100644 --- a/rm-community/rm-community-rest-api-explorer/src/main/webapp/definitions/ig-core-api.yaml +++ b/rm-community/rm-community-rest-api-explorer/src/main/webapp/definitions/ig-core-api.yaml @@ -36,7 +36,7 @@ paths: operationId: getFileplanComponent parameters: - $ref: '#/parameters/fileplanComponentIdWithAliasParam' - - $ref: '#/parameters/IGNodeEntryIncludeParam' + - $ref: '#/parameters/FilePlanComponentEntryIncludeParam' - $ref: '#/parameters/relativePathParam' - $ref: '#/parameters/fieldsParam' produces: @@ -45,7 +45,7 @@ paths: '200': description: Successful response schema: - $ref: '#/definitions/IGNodeEntry' + $ref: '#/definitions/FilePlanComponentEntry' '400': description: | Invalid parameter: **fileplanComponentId** is not a valid format @@ -86,21 +86,21 @@ paths: operationId: updateFileplanComponent parameters: - $ref: '#/parameters/fileplanComponentIdWithAliasParam' - - $ref: '#/parameters/IGNodeEntryIncludeParam' + - $ref: '#/parameters/FilePlanComponentEntryIncludeParam' - $ref: '#/parameters/fieldsParam' - in: body name: nodeBodyUpdate description: The node information to update. required: true schema: - $ref: '#/definitions/IGNodeBodyUpdate' + $ref: '#/definitions/FilePlanComponentBodyUpdate' produces: - application/json responses: '200': description: Successful response schema: - $ref: '#/definitions/IGNodeEntry' + $ref: '#/definitions/FilePlanComponentEntry' '400': description: | Invalid parameter: the update request is invalid or **fileplanComponentId** is not a valid format or **nodeBody** is invalid @@ -175,7 +175,7 @@ paths: - $ref: '#/parameters/maxItemsParam' - $ref: '#/parameters/orderByParam' - $ref: '#/parameters/whereParam' - - $ref: '#/parameters/IGNodeEntryIncludeParam' + - $ref: '#/parameters/FilePlanComponentEntryIncludeParam' - $ref: '#/parameters/relativePathParam' - $ref: '#/parameters/includeSourceParam' - $ref: '#/parameters/fieldsParam' @@ -183,7 +183,7 @@ paths: '200': description: Successful response schema: - $ref: '#/definitions/IGNodeAssociationPaging' + $ref: '#/definitions/FilePlanComponentAssociationPaging' '401': description: If authentication fails '403': @@ -229,7 +229,7 @@ paths: This API method also supports node creation using application/json. - You must specify at least a **name** and **nodeType**. + You must specify at least a **name** and **nodeType**. You can create a category like this: ```JSON @@ -306,7 +306,7 @@ paths: } ``` The **relativePath** specifies the container structure to create relative to the node **nodeId**. Containers in the - **relativePath** that do not exist are created before the node is created. The container type is decided considering + **relativePath** that do not exist are created before the node is created. The container type is decided considering the type of the parent container and the type of the node to be created. You can set properties when creating a new fileplan component: @@ -324,7 +324,7 @@ paths: Any missing aspects are applied automatically. You can set aspects explicitly, if needed, using an **aspectNames** field. - **Note:** You can create more than one child by + **Note:** You can create more than one child by specifying a list of nodes in the JSON body. For example, the following JSON body creates two folders inside the specified **nodeId**, if the **nodeId** identifies a folder: @@ -341,7 +341,7 @@ paths: ] ``` If you specify a list as input, then a paginated list rather than an entry is returned in the response body. For example: - + ```JSON { "list": { @@ -375,7 +375,7 @@ paths: description: If true, then a name clash will cause an attempt to auto rename by finding a unique name using an integer suffix. required: false type: boolean - - $ref: '#/parameters/IGNodeEntryIncludeParam' + - $ref: '#/parameters/FilePlanComponentEntryIncludeParam' - $ref: '#/parameters/fieldsParam' - in: body name: nodeBodyCreate @@ -395,7 +395,7 @@ paths: '201': description: Successful response schema: - $ref: '#/definitions/IGNodeEntry' + $ref: '#/definitions/FilePlanComponentEntry' '400': description: | Invalid parameter: **fileplanComponentId** is not a valid format or **nodeBodyCreate** is invalid @@ -599,11 +599,11 @@ paths: $ref: '#/definitions/Error' '/records/{recordId}/file': post: - tags: + tags: - records summary: File a record description: | - Files the record **recordId** in the target record folder. + Files the record **recordId** in the target record folder. You can specify the target record folder by providing its id **targetParentId** or by providing the id of a parent container **targetParentId** and a relative path **relativePath**. @@ -613,11 +613,11 @@ paths: The relativePath is made of record containers and a record folder as the last element. Containers that are missing from relativePath will be created before filing. - If the record is already filed, a link to the target record folder is created. + If the record is already filed, a link to the target record folder is created. operationId: fileRecord - parameters: + parameters: - $ref: '#/parameters/recordIdParam' - - $ref: '#/parameters/IGNodeEntryIncludeParam' + - $ref: '#/parameters/FilePlanComponentEntryIncludeParam' - $ref: '#/parameters/fieldsParam' - in: body name: nodeBodyFile @@ -633,7 +633,7 @@ paths: '200': description: Successful response schema: - $ref: '#/definitions/IGNodeEntry' + $ref: '#/definitions/FilePlanComponentEntry' '400': description: | Invalid parameter: **recordIdParam** or **targetParentId** is not a valid format, @@ -654,12 +654,12 @@ paths: $ref: '#/definitions/Error' '/files/{fileId}/declare': post: - tags: + tags: - files summary: Declare as record description: Declares the file **fileId** in the unfiled record container. operationId: declareRecord - parameters: + parameters: - name: fileId in: path description: The identifier of a non-record file. @@ -670,7 +670,7 @@ paths: description: Flag to indicate whether the record should be hidden from the current parent folder. type: boolean default: false - - $ref: '#/parameters/IGNodeEntryIncludeParam' + - $ref: '#/parameters/FilePlanComponentEntryIncludeParam' - $ref: '#/parameters/fieldsParam' consumes: - application/json @@ -680,7 +680,7 @@ paths: '200': description: Successful response schema: - $ref: '#/definitions/IGNodeEntry' + $ref: '#/definitions/FilePlanComponentEntry' '400': description: | Invalid parameter: **fileId** is not a valid format @@ -742,7 +742,7 @@ parameters: information is returned on the node resolved by this path. required: false type: string - IGNodeEntryIncludeParam: + FilePlanComponentEntryIncludeParam: name: include in: query description: | @@ -854,14 +854,14 @@ parameters: type: string format: date-time definitions: - IGNodeEntry: + FilePlanComponentEntry: type: object required: - entry properties: entry: - $ref: '#/definitions/IGNode' - IGNode: + $ref: '#/definitions/FilePlanComponent' + FilePlanComponent: type: object required: - id @@ -932,7 +932,7 @@ definitions: type: string path: $ref: '#/definitions/PathInfo' - IGNodeAssociationPaging: + FilePlanComponentAssociationPaging: type: object properties: list: @@ -943,24 +943,24 @@ definitions: entries: type: array items: - $ref: '#/definitions/IGNodeChildAssociationEntry' + $ref: '#/definitions/FilePlanComponentChildAssociationEntry' source: - $ref: '#/definitions/IGNode' - IGNodeChildAssociationEntry: + $ref: '#/definitions/FilePlanComponent' + FilePlanComponentChildAssociationEntry: type: object required: - entry properties: entry: - $ref: '#/definitions/IGNodeChildAssociation' - IGNodeChildAssociation: + $ref: '#/definitions/FilePlanComponentChildAssociation' + FilePlanComponentChildAssociation: allOf: - - $ref: '#/definitions/IGNode' + - $ref: '#/definitions/FilePlanComponent' - type: object properties: association: $ref: '#/definitions/ChildAssociationInfo' - IGNodeBodyUpdate: + FilePlanComponentBodyUpdate: type: object properties: name: From 5fe413c26d403f9f2539103e65f17e2e51ba541b Mon Sep 17 00:00:00 2001 From: Rodica Sutu Date: Fri, 10 Feb 2017 09:21:33 +0200 Subject: [PATCH 4/4] fix the compilation error --- .../files/DeclareDocumentAsRecordTests.java | 38 +++++++++---------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/files/DeclareDocumentAsRecordTests.java b/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/files/DeclareDocumentAsRecordTests.java index 6f6dfcb4f1..681a703f14 100644 --- a/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/files/DeclareDocumentAsRecordTests.java +++ b/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/files/DeclareDocumentAsRecordTests.java @@ -79,15 +79,15 @@ public class DeclareDocumentAsRecordTests extends BaseRMRestTest // create test user and test collaboration site to store documents in testUser = dataUser.createRandomTestUser(); testUserReadOnly = dataUser.createRandomTestUser(); - + testSite = dataSite.usingAdmin().createPublicRandomSite(); - + dataUser.addUserToSite(testUser, testSite, UserRole.SiteContributor); dataUser.addUserToSite(testUserReadOnly, testSite, UserRole.SiteConsumer); - + testFolder = dataContent.usingSite(testSite).usingUser(testUser).createFolder(); } - + /** *
      * Given a document that is not a record
@@ -103,17 +103,17 @@ public class DeclareDocumentAsRecordTests extends BaseRMRestTest
     @Test(description = "User with correct permissions can declare document as a record")
     @AlfrescoTest(jira = "RM-4429")
     public void userWithPrivilegesCanDeclareDocumentAsRecord() throws Exception
-    {        
-        // create document in a folder in a collaboration site       
+    {
+        // create document in a folder in a collaboration site
         FileModel document = dataContent.usingSite(testSite)
             .usingUser(testUser)
             .usingResource(testFolder)
             .createContent(CMISUtil.DocumentType.TEXT_PLAIN);
-    
+
         // declare document as record
         FilePlanComponent record = getRestAPIFactory().getFilesAPI(testUser).declareAsRecord(document.getNodeRefWithoutVersion());
         assertStatusCode(CREATED);
-       
+
         // verify the declared record is in Unfiled Records folder
         FilePlanComponentAPI filePlanComponentAPI = getRestAPIFactory().getFilePlanComponentsAPI();
         List matchingRecords = filePlanComponentAPI.listChildComponents(UNFILED_RECORDS_CONTAINER_ALIAS)
@@ -134,8 +134,8 @@ public class DeclareDocumentAsRecordTests extends BaseRMRestTest
         assertEquals(filesAfterRename.size(), 1, "There should be only one file in folder " + testFolder.getName());
 
         // verify the new name has the form of " ()."
-        assertEquals(filesAfterRename.get(0).getFilePlanComponentModel().getName(), 
-            document.getName().replace(".", String.format(" (%s).", record.getProperties().getRecordId())));
+        assertEquals(filesAfterRename.get(0).getFilePlanComponentModel().getName(),
+            document.getName().replace(".", String.format(" (%s).", record.getProperties().getRmIdentifier())));
 
         // verify the document in collaboration site is now a record, note the file is now renamed hence folder + doc. name concatenation
         // this also verifies the document is still in the initial folder
@@ -151,7 +151,7 @@ public class DeclareDocumentAsRecordTests extends BaseRMRestTest
         assertFalse(documentSecondary.isEmpty(), "Document is not a record");
 
         // verify the document is readable and has same content as corresponding record
-        try 
+        try
         (
             InputStream recordInputStream = getRestAPIFactory().getRecordsAPI().getRecordContent(record.getId()).asInputStream();
             InputStream documentInputStream = documentPostFiling.getContentStream().getStream();
@@ -160,7 +160,7 @@ public class DeclareDocumentAsRecordTests extends BaseRMRestTest
             assertEquals(DigestUtils.sha1(recordInputStream), DigestUtils.sha1(documentInputStream));
         }
     }
-    
+
     /**
      * 
      * Given a document that is not a record
@@ -172,18 +172,18 @@ public class DeclareDocumentAsRecordTests extends BaseRMRestTest
      */
     @Test(description = "User with read-only permissions can't declare document a record")
     @AlfrescoTest(jira = "RM-4429")
-    public void userWithReadPermissionsCantDeclare() throws Exception 
+    public void userWithReadPermissionsCantDeclare() throws Exception
     {
         // create document in a folder in a collaboration site
         FileModel document = dataContent.usingSite(testSite)
             .usingUser(testUser)
             .usingResource(testFolder)
             .createContent(CMISUtil.DocumentType.TEXT_PLAIN);
-    
+
         // declare document as record as testUserReadOnly
         getRestAPIFactory().getFilesAPI(testUserReadOnly).declareAsRecord(document.getNodeRefWithoutVersion());
         assertStatusCode(FORBIDDEN);
-        
+
         // verify the document is still in the original folder
         // FIXME: this call uses the FilePlanComponentAPI due to no TAS support for Node API in TAS restapi v 5.2.0-0. See RM-4585 for details.
         List filesAfterRename = getRestAPIFactory().getFilePlanComponentsAPI()
@@ -219,15 +219,15 @@ public class DeclareDocumentAsRecordTests extends BaseRMRestTest
         FilePlanComponent record = getRestAPIFactory().getFilePlanComponentsAPI()
             .createFilePlanComponent(nonelectronicRecord, createCategoryFolderInFilePlan().getId());
         assertStatusCode(CREATED);
-        
+
         // try to declare it as a record
         getRestAPIFactory().getFilesAPI().declareAsRecord(record.getId());
         assertStatusCode(UNPROCESSABLE_ENTITY);
     }
-    
+
     /**
      * 
-     * Given a node that is NOT a document 
+     * Given a node that is NOT a document
      * When I declare the node as a record
      * Then I get a invalid operation exception
      * 
@@ -238,7 +238,7 @@ public class DeclareDocumentAsRecordTests extends BaseRMRestTest public void nonDocumentCantBeDeclaredARecord() throws Exception { FolderModel otherTestFolder = dataContent.usingSite(testSite).usingUser(testUser).createFolder(); - + // try to declare otherTestFolder as a record getRestAPIFactory().getFilesAPI().declareAsRecord(otherTestFolder.getNodeRefWithoutVersion()); assertStatusCode(UNPROCESSABLE_ENTITY);