updates on Read Records API tests

This commit is contained in:
Rodica Sutu
2017-01-03 14:20:55 +02:00
parent f0f896668b
commit 9892d88c5b
5 changed files with 95 additions and 26 deletions

View File

@@ -28,6 +28,7 @@ package org.alfresco.rest.rm.community.model.fileplancomponents;
import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.ALLOWABLE_OPERATIONS;
import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.IS_CLOSED;
import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.IS_COMPLETED;
import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PATH;
import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PROPERTIES;
import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.RELATIVE_PATH;
@@ -81,7 +82,7 @@ public class FilePlanComponent
@JsonProperty(value = IS_CLOSED)
private Boolean isClosed;
@JsonProperty
@JsonProperty(value = IS_COMPLETED)
private Boolean isCompleted;
@JsonProperty (required = true)

View File

@@ -49,6 +49,7 @@ public class FilePlanComponentFields
public static final String PROPERTIES_REVIEW_PERIOD = "rma:reviewPeriod";
public static final String PROPERTIES_LOCATION = "rma:location";
public static final String PROPERTIES_IS_CLOSED = "rma:isClosed"; // not to be confused with IS_CLOSED!
public static final String IS_COMPLETED = "isCompleted";
// for non-electronic records
public static final String PROPERTIES_BOX = "rma:box";
@@ -58,7 +59,7 @@ public class FilePlanComponentFields
public static final String PROPERTIES_SHELF = "rma:shelf";
public static final String PROPERTIES_STORAGE_LOCATION = "rma:storageLocation";
//RelativePath specifies the container structure to create relative to the node nodeId.
//RelativePath specifies the container structure to create relative to the nodeId.
public static final String RELATIVE_PATH = "relativePath";
public static final String PATH = "path";
}

View File

@@ -49,18 +49,45 @@ import org.springframework.stereotype.Component;
@Scope (value = "prototype")
public class RecordsAPI extends RestAPI<FilePlanComponentAPI>
{
/**
* Get the content for the electronic record
*
* @param recordId The id of the electronic record
* @return The content for the given record id
* @throws Exception for the following cases:
* <ul>
* <li>{@code recordId} has no content</li>
* <li> {@code recordId} is not a valid format, or is not a record</li>
* <li>authentication fails</li>
* <li>{@code recordId} does not exist</li>
* </ul>
*/
public <T> 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();
.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();
}
/**
* Get the html content for the electronic record
*
* @param recordId The id of the electronic record
* @return The content for the given record id
* @throws Exception for the following cases:
* <ul>
* <li>{@code recordId} has no content</li>
* <li> {@code recordId} is not a valid format, or is not a record</li>
* <li>authentication fails</li>
* <li>{@code recordId} does not exist</li>
* </ul>
*/
public RestHtmlResponse getRecordContent(String recordId) throws Exception
{
mandatoryString("recordId", recordId);