Merge branch 'master' into feature/RM-4585_Amend_Test_Code_After_TAS_5202_Release

Conflicts:
	rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/files/DeclareDocumentAsRecordTests.java
This commit is contained in:
Tuna Aksoy
2017-02-10 10:35:57 +00:00
9 changed files with 124 additions and 58 deletions

View File

@@ -109,5 +109,5 @@ public class FilePlanComponentProperties
private Integer physicalSize;
@JsonProperty(value = PROPERTIES_RECORD_ID, required = false)
private String recordId;
private String rmIdentifier;
}

View File

@@ -32,8 +32,11 @@ 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_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;
import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentType.UNFILED_CONTAINER_TYPE;
@@ -148,4 +151,36 @@ 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 }
};
}
/**
* 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 }
};
}
}

View File

@@ -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

View File

@@ -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));
}
/**

View File

@@ -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);
}
@@ -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());
}

View File

@@ -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());
}
@@ -316,6 +325,7 @@ public class RecordCategoryTest extends BaseRMRestTest
// Verify properties
// FIXME: Verify properties
assertNotNull(createdComponent.getProperties().getRmIdentifier());
}
catch (NoSuchElementException e)
{
@@ -336,7 +346,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();

View File

@@ -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());
}
/**

View File

@@ -136,7 +136,7 @@ public class DeclareDocumentAsRecordTests extends BaseRMRestTest
// verify the new name has the form of "<original name> (<record Id>).<original extension>"
String recordName = filesAfterRename.get(0).onModel().getName();
assertEquals(recordName, document.getName().replace(".", String.format(" (%s).", record.getProperties().getRecordId())));
assertEquals(recordName, 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

View File

@@ -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':
@@ -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
@@ -617,7 +617,7 @@ paths:
operationId: fileRecord
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,
@@ -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: