try to fix diff indentation

This commit is contained in:
Rodica Sutu
2017-01-26 17:50:47 +02:00
parent aea517f0f7
commit e0f29cfaa2

View File

@@ -257,32 +257,40 @@ public class ElectronicRecordTests extends BaseRMRestTest
* Given I want to create an electronic record
* When I use the path relative to the filePlanComponentid
* Then the containers in the relativePath that don't exist are created before creating the electronic record
*/
public void createElectronicRecordWithRelativePath() throws Exception
{
//the containers specified on the RELATIVE_PATH parameter don't exist on server
String RELATIVE_PATH = CATEGORY_NAME + "/"+ CATEGORY_NAME +"/"+ FOLDER_NAME;
String RELATIVE_PATH = CATEGORY_NAME + "/" + CATEGORY_NAME + "/" + FOLDER_NAME;
FilePlanComponent electronicRecord = FilePlanComponent.builder()
.name(ELECTRONIC_RECORD_NAME)
.nodeType(CONTENT_TYPE.toString())
.content(FilePlanComponentContent.builder().mimeType("text/plain").build())
.properties(FilePlanComponentProperties.builder().description("Description").build())
.content(FilePlanComponentContent
.builder()
.mimeType("text/plain")
.build()
)
.properties(FilePlanComponentProperties
.builder()
.description("Description")
.build()
)
.relativePath(RELATIVE_PATH)
.build();
FilePlanComponentAPI filePlanComponentsAPI = getRestAPIFactory().getFilePlanComponentsAPI();
FilePlanComponent recordCreated = filePlanComponentsAPI.createElectronicRecord(electronicRecord,
createTempFile(ELECTRONIC_RECORD_NAME, ELECTRONIC_RECORD_NAME), FILE_PLAN_ALIAS);
FilePlanComponent recordCreated = filePlanComponentsAPI.createElectronicRecord(electronicRecord, createTempFile(ELECTRONIC_RECORD_NAME, ELECTRONIC_RECORD_NAME), FILE_PLAN_ALIAS
);
// verify the create request status code
assertStatusCode(CREATED);
// get newly created electronic record and verify its properties
assertTrue(filePlanComponentsAPI.getFilePlanComponent(recordCreated.getId()).getName().startsWith(ELECTRONIC_RECORD_NAME));
assertTrue(filePlanComponentsAPI.getFilePlanComponent(recordCreated.getParentId()).getName().equals(FOLDER_NAME));
assertTrue(filePlanComponentsAPI.getFilePlanComponent(recordCreated.getId())
.getName().startsWith(ELECTRONIC_RECORD_NAME));
assertTrue(filePlanComponentsAPI.getFilePlanComponent(recordCreated.getParentId())
.getName().equals(FOLDER_NAME));
//get newly created electronic record using the relativePath
assertTrue(filePlanComponentsAPI.getFilePlanComponent(FILE_PLAN_ALIAS,
FilePlanComponentFields.RELATIVE_PATH + "=" + RELATIVE_PATH + "/" + recordCreated.getName())
assertTrue(filePlanComponentsAPI.getFilePlanComponent(FILE_PLAN_ALIAS, FilePlanComponentFields.RELATIVE_PATH + "=" + RELATIVE_PATH + "/" + recordCreated.getName())
.getId().equals(recordCreated.getId()));
//the category specified via the RELATIVE_PATH exist, folder doesn't exist
@@ -292,38 +300,40 @@ public class ElectronicRecordTests extends BaseRMRestTest
// verify the create request status code
assertStatusCode(CREATED);
// get newly created electronic record and verify its properties
assertTrue(filePlanComponentsAPI.getFilePlanComponent(recordCreated.getId()).getName().startsWith(ELECTRONIC_RECORD_NAME));
assertTrue(filePlanComponentsAPI.getFilePlanComponent(recordCreated.getParentId()).getName().startsWith(FOLDER_NAME));
assertTrue(filePlanComponentsAPI.getFilePlanComponent(recordCreated.getId())
.getName().startsWith(ELECTRONIC_RECORD_NAME));
assertTrue(filePlanComponentsAPI.getFilePlanComponent(recordCreated.getParentId())
.getName().startsWith(FOLDER_NAME));
//get newly created electronic record using the relativePath
assertTrue(filePlanComponentsAPI.getFilePlanComponent(FILE_PLAN_ALIAS,
FilePlanComponentFields.RELATIVE_PATH+"="+RELATIVE_PATH+"/"+recordCreated.getName())
assertTrue(filePlanComponentsAPI.getFilePlanComponent(FILE_PLAN_ALIAS, FilePlanComponentFields.RELATIVE_PATH + "=" + RELATIVE_PATH + "/" + recordCreated.getName())
.getId().equals(recordCreated.getId()));
//the containers from the RELATIVE PATH exists
electronicRecord.setName(ELECTRONIC_RECORD_NAME + getRandomAlphanumeric());
recordCreated = filePlanComponentsAPI.createElectronicRecord(electronicRecord,
createTempFile(ELECTRONIC_RECORD_NAME, ELECTRONIC_RECORD_NAME),
FILE_PLAN_ALIAS);
recordCreated = filePlanComponentsAPI.createElectronicRecord(electronicRecord, createTempFile(ELECTRONIC_RECORD_NAME, ELECTRONIC_RECORD_NAME), FILE_PLAN_ALIAS);
// verify the create request status code
assertStatusCode(CREATED);
// get newly created electronic record and verify its properties
assertTrue(filePlanComponentsAPI.getFilePlanComponent(recordCreated.getId()).getName().startsWith(ELECTRONIC_RECORD_NAME));
assertTrue(filePlanComponentsAPI.getFilePlanComponent(recordCreated.getParentId()).getName().startsWith(FOLDER_NAME));
assertTrue(filePlanComponentsAPI.getFilePlanComponent(recordCreated.getId())
.getName().startsWith(ELECTRONIC_RECORD_NAME));
assertTrue(filePlanComponentsAPI.getFilePlanComponent(recordCreated.getParentId())
.getName().startsWith(FOLDER_NAME));
//get newly created electronic record using the relativePath
assertTrue(filePlanComponentsAPI.getFilePlanComponent(FILE_PLAN_ALIAS, FilePlanComponentFields.RELATIVE_PATH + "=" + RELATIVE_PATH + "/" + recordCreated.getName())
.getId().equals(recordCreated.getId()));
//create the container structure relative to the categoryId
String categoryId = filePlanComponentsAPI.getFilePlanComponent(FILE_PLAN_ALIAS, FilePlanComponentFields.RELATIVE_PATH + "="+CATEGORY_NAME)
.getId();
RELATIVE_PATH = CATEGORY_NAME+ CATEGORY_NAME+"/"+FOLDER_NAME;
String categoryId = filePlanComponentsAPI.getFilePlanComponent(FILE_PLAN_ALIAS, FilePlanComponentFields.RELATIVE_PATH + "=" + CATEGORY_NAME)
.getId();
RELATIVE_PATH = CATEGORY_NAME + CATEGORY_NAME + "/" + FOLDER_NAME;
electronicRecord.setRelativePath(RELATIVE_PATH);
recordCreated = filePlanComponentsAPI.createElectronicRecord(electronicRecord,
createTempFile(ELECTRONIC_RECORD_NAME, ELECTRONIC_RECORD_NAME),categoryId);
recordCreated = filePlanComponentsAPI.createElectronicRecord(electronicRecord, createTempFile(ELECTRONIC_RECORD_NAME, ELECTRONIC_RECORD_NAME), categoryId);
// verify the create request status code
assertStatusCode(CREATED);
// get newly created electronic record and verify its properties
assertTrue(filePlanComponentsAPI.getFilePlanComponent(recordCreated.getId()).getName().startsWith(ELECTRONIC_RECORD_NAME));
assertTrue(filePlanComponentsAPI.getFilePlanComponent(recordCreated.getParentId()).getName().startsWith(FOLDER_NAME));
assertTrue(filePlanComponentsAPI.getFilePlanComponent(recordCreated.getId())
.getName().startsWith(ELECTRONIC_RECORD_NAME));
assertTrue(filePlanComponentsAPI.getFilePlanComponent(recordCreated.getParentId())
.getName().startsWith(FOLDER_NAME));
}
}