From bebca649fe8335bc07bb33d9376f7639b73c7629 Mon Sep 17 00:00:00 2001 From: Rodica Sutu Date: Tue, 3 Jan 2017 08:16:12 +0200 Subject: [PATCH] -Add tests for Read Records (1) --- .../rm-automation-community-rest-api/pom.xml | 27 ++ .../fileplancomponents/FilePlanComponent.java | 2 +- .../FilePlanComponentContent.java | 9 + .../requests/FilePlanComponentAPI.java | 6 +- .../rm/community/requests/RecordsAPI.java | 70 ++++ .../rest/rm/community/base/BaseRestTest.java | 50 ++- .../fileplancomponents/ReadRecordTests.java | 305 ++++++++++++++++++ 7 files changed, 458 insertions(+), 11 deletions(-) create mode 100644 rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/requests/RecordsAPI.java create mode 100644 rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/fileplancomponents/ReadRecordTests.java diff --git a/rm-automation/rm-automation-community-rest-api/pom.xml b/rm-automation/rm-automation-community-rest-api/pom.xml index 0579d444e2..24280df4be 100644 --- a/rm-automation/rm-automation-community-rest-api/pom.xml +++ b/rm-automation/rm-automation-community-rest-api/pom.xml @@ -19,6 +19,16 @@ + + + + org.projectlombok + lombok-maven-plugin + 1.16.10 + + + + org.codehaus.mojo @@ -29,6 +39,23 @@ ${project.parent.parent.basedir}/license/description.ftl + + org.projectlombok + lombok-maven-plugin + 1.16.8.0 + + UTF-8 + + + + generate-sources + + testDelombok + delombok + + + + diff --git a/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/model/fileplancomponents/FilePlanComponent.java b/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/model/fileplancomponents/FilePlanComponent.java index 4b3c0274df..5fbf4cb383 100644 --- a/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/model/fileplancomponents/FilePlanComponent.java +++ b/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/model/fileplancomponents/FilePlanComponent.java @@ -90,7 +90,7 @@ public class FilePlanComponent @JsonProperty (required = true) private FilePlanComponentUserInfo createdByUser; - @JsonProperty(value = PROPERTIES, required = true) + @JsonProperty(value = PROPERTIES) private FilePlanComponentProperties properties; @JsonProperty (value = ALLOWABLE_OPERATIONS) diff --git a/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/model/fileplancomponents/FilePlanComponentContent.java b/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/model/fileplancomponents/FilePlanComponentContent.java index 9a7a23bbde..36eada3bb5 100644 --- a/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/model/fileplancomponents/FilePlanComponentContent.java +++ b/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/model/fileplancomponents/FilePlanComponentContent.java @@ -28,11 +28,20 @@ package org.alfresco.rest.rm.community.model.fileplancomponents; import com.fasterxml.jackson.annotation.JsonProperty; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + /** * POJO for FilePlanComponent content field * @author Kristijan Conkas * @since 2.6 */ +@Builder +@Data +@NoArgsConstructor +@AllArgsConstructor public class FilePlanComponentContent { @JsonProperty (required = true) diff --git a/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/requests/FilePlanComponentAPI.java b/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/requests/FilePlanComponentAPI.java index 5279bdf67f..5a2a269fbd 100644 --- a/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/requests/FilePlanComponentAPI.java +++ b/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/requests/FilePlanComponentAPI.java @@ -110,8 +110,8 @@ public class FilePlanComponentAPI extends RestAPI return usingRestWrapper().processModels(FilePlanComponentsCollection.class, simpleRequest( GET, - "fileplan-components/{fileplanComponentId}/children", - filePlanComponentId + "fileplan-components/{fileplanComponentId}/children?{parameters}", + filePlanComponentId, getParameters() )); } @@ -203,7 +203,7 @@ public class FilePlanComponentAPI extends RestAPI builder.addMultiPart("filedata", recordContent, ContentType.BINARY.name()); /* - * RestWrapper adds some headers which break multipart/form-data uploads and also assumes json POST requests. + * RestWrapper adds some headers which break multipart/form-data uploads and also assumes json POST requests. * Upload the file using RestAssured library. */ Response response = given() diff --git a/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/requests/RecordsAPI.java b/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/requests/RecordsAPI.java new file mode 100644 index 0000000000..b0423791ba --- /dev/null +++ b/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/requests/RecordsAPI.java @@ -0,0 +1,70 @@ +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2017 Alfresco Software Limited + * %% + * This file is part of the Alfresco software. + * - + * If the software was purchased under a paid Alfresco license, the terms of + * the paid license agreement will prevail. Otherwise, the software is + * provided under the following open source license terms: + * - + * Alfresco is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * - + * Alfresco is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * - + * You should have received a copy of the GNU Lesser General Public License + * along with Alfresco. If not, see . + * #L% + */ +package org.alfresco.rest.rm.community.requests; + +import static com.jayway.restassured.RestAssured.given; + +import static org.alfresco.rest.rm.community.util.ParameterCheck.mandatoryString; + +import com.jayway.restassured.response.Response; + +import org.alfresco.rest.core.RestAPI; +import org.alfresco.rest.core.RestRequest; +import org.alfresco.rest.model.RestHtmlResponse; +import org.springframework.context.annotation.Scope; +import org.springframework.http.HttpMethod; +import org.springframework.stereotype.Component; + +/** + *Records REST API Wrapper + * + *@author Rodica Sutu + *@since 2.6 + */ +@Component +@Scope (value = "prototype") +public class RecordsAPI extends RestAPI +{ + public T getRecordContentText(String recordId) throws Exception + { + mandatoryString("recordId", recordId); + //RestRequest request = RestRequest.simpleRequest(HttpMethod.GET, "records/{recordId}/content?{parameters}", recordId, getParameters()); + Response response = given().auth().basic(usingRestWrapper().getTestUser().getUsername(), usingRestWrapper().getTestUser().getPassword()) + .get("records/{recordId}/content?{parameters}", recordId, getParameters()) + .andReturn(); + usingRestWrapper().setStatusCode(Integer.toString(response.getStatusCode())); + LOG.info("The record content is " + response.getBody().prettyPrint()); + return (T) response.getBody().prettyPrint(); + } + + public RestHtmlResponse getRecordContent(String recordId) throws Exception + { + mandatoryString("recordId", recordId); + RestRequest request = RestRequest.simpleRequest(HttpMethod.GET, "records/{recordId}/content?{parameters}", recordId, getParameters()); + return usingRestWrapper().processHtmlResponse(request); + } +} diff --git a/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/base/BaseRestTest.java b/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/base/BaseRestTest.java index d888ab2692..407942452f 100644 --- a/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/base/BaseRestTest.java +++ b/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/base/BaseRestTest.java @@ -44,6 +44,11 @@ import static org.springframework.http.HttpStatus.CREATED; import static org.springframework.http.HttpStatus.OK; import com.google.gson.JsonObject; +import java.io.File; +import java.io.FileOutputStream; +import java.io.OutputStreamWriter; +import java.nio.charset.Charset; + import com.jayway.restassured.RestAssured; import com.jayway.restassured.builder.RequestSpecBuilder; import com.jayway.restassured.http.ContentType; @@ -99,7 +104,7 @@ public class BaseRestTest extends RestTest @Autowired private RMSiteAPI rmSiteAPI; - + @Autowired private DataUser dataUser; @@ -239,18 +244,18 @@ public class BaseRestTest extends RestTest public FilePlanComponent closeFolder(String folderId) throws Exception { RestWrapper restWrapper = filePlanComponentAPI.usingRestWrapper().authenticateUser(dataUser.getAdminUser()); - + // build fileplan component + properties for update request FilePlanComponentProperties properties = new FilePlanComponentProperties(); properties.setIsClosed(true); FilePlanComponent filePlanComponent = new FilePlanComponent(); filePlanComponent.setProperties(properties); - + FilePlanComponent updatedComponent = filePlanComponentAPI.updateFilePlanComponent(filePlanComponent, folderId); restWrapper.assertStatusCodeIs(OK); return updatedComponent; } - + /** * Helper method to create a randomly-named / structure in fileplan * @param user user under whose privileges this structure is going to be created @@ -261,14 +266,14 @@ public class BaseRestTest extends RestTest public FilePlanComponent createCategoryFolderInFilePlan(UserModel user, String parentId) throws Exception { filePlanComponentAPI.usingRestWrapper().authenticateUser(user); - + // create root category FilePlanComponent recordCategory = createCategory(parentId, "Category " + getRandomAlphanumeric()); - + // and return a folder underneath return createFolder(recordCategory.getId(), "Folder " + getRandomAlphanumeric()); } - + /** * Helper method to retieve a fileplan component with user's privilege * @param user user under whose privileges a component is to be read @@ -281,6 +286,7 @@ public class BaseRestTest extends RestTest filePlanComponentAPI.usingRestWrapper().authenticateUser(user); return filePlanComponentAPI.getFilePlanComponent(componentId); } + /** * Helper method to add permission on a component to user @@ -325,3 +331,33 @@ public class BaseRestTest extends RestTest filePlanComponentAPI.usingRestWrapper().setStatusCode(Integer.toString(response.getStatusCode())); } } + + /** + * Create temp file + * real size content + * + * @param name file name + * @return {@link File} file + */ + public static File createTempFile(final String name,String content) + { + try + { + // create file + final File file = File.createTempFile(name, ".txt"); + + // create writer + try (FileOutputStream fos = new FileOutputStream(file); + OutputStreamWriter writer = new OutputStreamWriter(fos, Charset.forName("UTF-8").newEncoder())) + { + // place content in file + writer.write(content); + } + + return file; + } catch (Exception exception) + { + throw new RuntimeException("Unable to create test file.", exception); + } + } +} 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 new file mode 100644 index 0000000000..45f8f5c90b --- /dev/null +++ b/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/fileplancomponents/ReadRecordTests.java @@ -0,0 +1,305 @@ +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2017 Alfresco Software Limited + * %% + * This file is part of the Alfresco software. + * - + * If the software was purchased under a paid Alfresco license, the terms of + * the paid license agreement will prevail. Otherwise, the software is + * provided under the following open source license terms: + * - + * Alfresco is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * - + * Alfresco is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * - + * You should have received a copy of the GNU Lesser General Public License + * along with Alfresco. If not, see . + * #L% + */ +package org.alfresco.rest.rm.community.fileplancomponents; + +import static org.alfresco.rest.rm.community.base.TestData.FOLDER_NAME; +import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentAlias.FILE_PLAN_ALIAS; +import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentAlias.HOLDS_ALIAS; +import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentAlias.TRANSFERS_ALIAS; +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.NON_ELECTRONIC_RECORD_TYPE; +import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentType.RECORD_FOLDER_TYPE; +import static org.alfresco.utility.data.RandomData.getRandomAlphanumeric; +import static org.springframework.http.HttpStatus.BAD_REQUEST; +import static org.springframework.http.HttpStatus.OK; +import static org.testng.Assert.assertEquals; +import static org.testng.AssertJUnit.assertTrue; + +import org.alfresco.rest.rm.community.base.BaseRestTest; +import org.alfresco.rest.rm.community.base.TestData; +import org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponent; +import org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentContent; +import org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentProperties; +import org.alfresco.rest.rm.community.requests.FilePlanComponentAPI; +import org.alfresco.rest.rm.community.requests.RecordsAPI; +import org.alfresco.utility.data.DataUser; +import org.springframework.beans.factory.annotation.Autowired; +import org.testng.annotations.DataProvider; +import org.testng.annotations.Test; + +/** + * This class contains the tests for + * read records API + * + * @author Rodica Sutu + * @since 2.6 + */ +public class ReadRecordTests extends BaseRestTest +{ + + @Autowired + private FilePlanComponentAPI filePlanComponentAPI; + @Autowired + private RecordsAPI recordsAPI; + + @Autowired + private DataUser dataUser; + + private String CATEGORY_NAME=TestData.CATEGORY_NAME +getRandomAlphanumeric(); + + String ELECTRONIC_RECORD_NAME = "Record electronic" + getRandomAlphanumeric(); + String NONELECTRONIC_RECORD_NAME = "Record nonelectronic" + getRandomAlphanumeric(); + + FilePlanComponent electronicRecord = FilePlanComponent.builder() + .name(ELECTRONIC_RECORD_NAME) + .nodeType(CONTENT_TYPE.toString()) + .content(FilePlanComponentContent.builder().mimeType("text/plain").build()) + .build(); + FilePlanComponent nonelectronicRecord = FilePlanComponent.builder() + .properties(FilePlanComponentProperties.builder() + .description("Description") + .title("Title") + .build()) + .name(NONELECTRONIC_RECORD_NAME) + .nodeType(NON_ELECTRONIC_RECORD_TYPE.toString()) + .build(); + + /** + * Given a record category or a container which can't contain records + * When I try to read the children filtering the results to records + * Then I receive an empty list + */ + @DataProvider(name="invalidContainersForRecords") + public Object[][] getContainers() throws Exception + { + return new Object[][] { + { FILE_PLAN_ALIAS.toString() }, + { TRANSFERS_ALIAS.toString() }, + { HOLDS_ALIAS.toString() }, + { createCategory(FILE_PLAN_ALIAS.toString(), CATEGORY_NAME).getId()} + }; + } + @Test + ( + dataProvider ="invalidContainersForRecords", + description ="Reading records from invalid containers" + ) + public void readRecordsFromInvalidContainers(String container) throws Exception + { + + + filePlanComponentAPI.usingRestWrapper().authenticateUser(dataUser.getAdminUser()); + + FilePlanComponent electronicRecord = FilePlanComponent.builder() + .name(ELECTRONIC_RECORD_NAME) + .nodeType(CONTENT_TYPE.toString()) + .content(FilePlanComponentContent.builder().mimeType("text/plain").build()) + .build(); + FilePlanComponent nonelectronicRecord= FilePlanComponent.builder() + .properties(FilePlanComponentProperties.builder() + .description("Description") + .title("Title") + .build()) + .name(NONELECTRONIC_RECORD_NAME) + .nodeType(NON_ELECTRONIC_RECORD_TYPE.toString()) + .build(); + //create records + filePlanComponentAPI.createFilePlanComponent(electronicRecord,container); + filePlanComponentAPI.createFilePlanComponent(nonelectronicRecord, container); + + // List children from API + filePlanComponentAPI.withParams("where=(isFile=true)").listChildComponents(container) + //check the list returned is empty + .assertThat().entriesListIsEmpty().assertThat().paginationExist(); + // Check status code + filePlanComponentAPI.usingRestWrapper().assertStatusCodeIs(OK); + } + //TODO MAYBE Update AC ?? + /** + * Given a record + * When I try to read the children + * Then I receive error + */ + @Test + public void readChildrenOnRecordsString() throws Exception + { + String ELECTRONIC_RECORD_NAME = "Record electronic" + getRandomAlphanumeric(); + String NONELECTRONIC_RECORD_NAME = "Record nonelectronic" + getRandomAlphanumeric(); + String RELATIVE_PATH="CATEGORY"+ getRandomAlphanumeric()+"/FOLDER"; + + filePlanComponentAPI.usingRestWrapper().authenticateUser(dataUser.getAdminUser()); + + + //create records in Unfiled Container + FilePlanComponent recordElecInUnfiled = filePlanComponentAPI.createFilePlanComponent(electronicRecord, UNFILED_RECORDS_CONTAINER_ALIAS.toString()); + FilePlanComponent recordNonElecInUnfiled = filePlanComponentAPI.createFilePlanComponent(nonelectronicRecord, UNFILED_RECORDS_CONTAINER_ALIAS.toString()); + + // List children for the electronic Record + filePlanComponentAPI.withParams("where=(isFile=true)").listChildComponents(recordElecInUnfiled.getId()) + //check the list returned is empty + .assertThat().entriesListIsEmpty().assertThat().paginationExist(); + // Check status code + filePlanComponentAPI.usingRestWrapper().assertStatusCodeIs(OK); + + // List children for the nonElectronic Record + filePlanComponentAPI.withParams("where=(isFile=true)").listChildComponents(recordNonElecInUnfiled.getId()) + //check the list returned is empty + .assertThat().entriesListIsEmpty().assertThat().paginationExist(); + // Check status code + filePlanComponentAPI.usingRestWrapper().assertStatusCodeIs(OK); + + //Update the Records objects + electronicRecord.setRelativePath(RELATIVE_PATH); + nonelectronicRecord.setRelativePath(RELATIVE_PATH); + + //create records in Unfiled Container + FilePlanComponent recordElecFromRecordFolder = filePlanComponentAPI.createFilePlanComponent(electronicRecord, FILE_PLAN_ALIAS.toString()); + FilePlanComponent recordNonElecFromRecordFolder = filePlanComponentAPI.createFilePlanComponent(nonelectronicRecord, FILE_PLAN_ALIAS.toString()); + + // List children for the electronic Record + filePlanComponentAPI.withParams("where=(isFile=true)").listChildComponents(recordElecFromRecordFolder.getId()) + //check the list returned is empty + .assertThat().entriesListIsEmpty().assertThat().paginationExist(); + // Check status code + filePlanComponentAPI.usingRestWrapper().assertStatusCodeIs(OK); + + // List children for the nonElectronic Record + filePlanComponentAPI.withParams("where=(isFile=true)").listChildComponents(recordNonElecFromRecordFolder.getId()) + //check the list returned is empty + .assertThat().entriesListIsEmpty().assertThat().paginationExist(); + // Check status code + filePlanComponentAPI.usingRestWrapper().assertStatusCodeIs(OK); + } + + /** + * Given a record + * When I try to read the meta-data + * Then I successfully receive the meta-data values for that record + */ + @Test + public void readRecordMetadata() throws Exception + { + recordsAPI.usingRestWrapper().authenticateUser(dataUser.getAdminUser()); + logger.info("NEW TEST" + recordsAPI.getRecordContentText("05978b97-bc84-4693-9f3f-f1b0502cfa7b").toString()); + + } + + /** + * Given an electronic record + * When I try to read the content + * Then I successfully receive the content of the record + */ + @Test + public void readRecordContent() throws Exception + { + String RECORD_ELECTRONIC= "Record " + getRandomAlphanumeric(); + String RELATIVE_PATH="/"+CATEGORY_NAME+ getRandomAlphanumeric()+"/folder"; + filePlanComponentAPI.usingRestWrapper().authenticateUser(dataUser.getAdminUser()); + //create the containers from the relativePath + FilePlanComponent recordFolder = FilePlanComponent.builder() + .name(FOLDER_NAME) + .nodeType(RECORD_FOLDER_TYPE.toString()) + .relativePath(RELATIVE_PATH) + .build(); + String folderId=filePlanComponentAPI.createFilePlanComponent(recordFolder,FILE_PLAN_ALIAS.toString()).getId(); + // + FilePlanComponent record = FilePlanComponent.builder() + .name(RECORD_ELECTRONIC) + .nodeType(CONTENT_TYPE.toString()) + .build(); + String recordId =filePlanComponentAPI.createElectronicRecord(record, createTempFile(RECORD_ELECTRONIC, RECORD_ELECTRONIC), folderId).getId(); + + recordsAPI.usingRestWrapper().authenticateUser(dataUser.getAdminUser()); + + assertEquals(recordsAPI.getRecordContentText(recordId),RECORD_ELECTRONIC); + // Check status code + recordsAPI.usingRestWrapper().assertStatusCodeIs(OK); + + FilePlanComponent recordNoContent = FilePlanComponent.builder() + .name(RECORD_ELECTRONIC) + .nodeType(CONTENT_TYPE.toString()) + .build(); + String recordNoContentId=filePlanComponentAPI.createFilePlanComponent(recordNoContent,folderId).getId(); + assertTrue(recordsAPI.getRecordContentText(recordNoContentId).toString().isEmpty()); + recordsAPI.usingRestWrapper().assertStatusCodeIs(OK); + } + /** + * Given a non-electronic record + * When I try to read the content + * Then I am informed that the record has no content + */ + @Test + public void readRecordNonElectronicContent() throws Exception + { + + String NONELECTRONIC_RECORD_NAME = "Record nonelectronic" + getRandomAlphanumeric(); + FilePlanComponent record = FilePlanComponent.builder() + .name(NONELECTRONIC_RECORD_NAME) + .nodeType(NON_ELECTRONIC_RECORD_TYPE.toString()) + .relativePath("/"+CATEGORY_NAME+"/"+FOLDER_NAME) + .build(); + filePlanComponentAPI.usingRestWrapper().authenticateUser(dataUser.getAdminUser()); + String nonElectronicRecord=filePlanComponentAPI.createFilePlanComponent(record,FILE_PLAN_ALIAS.toString()).getId(); + recordsAPI.usingRestWrapper().authenticateUser(dataUser.getAdminUser()); + assertTrue(recordsAPI.getRecordContentText(nonElectronicRecord).toString().isEmpty()); + recordsAPI.usingRestWrapper().assertStatusCodeIs(OK); + } + + /** + * Given a container (eg record folder, record category, etc) + * When I try to read the content + * Then I receive an error + */ + @Test + ( + dataProvider = "getContainers", + dataProviderClass = TestData.class, + description = "Reading records from invalid containers" + ) + public void readContainFromInvalidContainers(String container) throws Exception + { + recordsAPI.usingRestWrapper().authenticateUser(dataUser.getAdminUser()); + recordsAPI.getRecordContentText(container).toString(); + recordsAPI.usingRestWrapper().assertStatusCodeIs(BAD_REQUEST); + } + + /** + * Given a container that is a record folder + * When I try to record the containers records + * Then I receive a list of all the records contained within the record folder + */ + + /** + * Given a container this an unfiled record folder or the unfiled record container root + * When I try to record the containers records + * Then I receive a list of all the records contained within the unfiled record folder or the unfiled record container root + */ + + + +}