Merged RETURN-OF-THE-API (5.2.0) to 5.2.N (5.2.1)

128681 jvonka: V1 REST API: version history - add api sanity check for auto-version on metadata-only updates
   REPO-348, REPO-313, REPO-905


git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/BRANCHES/DEV/5.2.N/root@129184 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Martin Muller
2016-08-05 13:47:57 +00:00
parent 2f4ee372f1
commit 79149bf9b3
5 changed files with 153 additions and 49 deletions

View File

@@ -742,7 +742,12 @@ public abstract class AbstractBaseApiTest extends EnterpriseTestApi
return RestApiUtil.parseRestApiEntry(response.getJsonResponse(), Document.class);
}
protected Document createEmptyTextFile(Folder parentFolder, String docName) throws Exception
protected Document createEmptyTextFile(String parentFolderId, String docName) throws Exception
{
return createEmptyTextFile(parentFolderId, docName, null, 201);
}
protected Document createEmptyTextFile(String parentFolderId, String docName, Map<String, String> params, int expectedStatus) throws Exception
{
Document d1 = new Document();
d1.setName(docName);
@@ -752,17 +757,17 @@ public abstract class AbstractBaseApiTest extends EnterpriseTestApi
d1.setContent(ci);
// create empty file
HttpResponse response = post(getNodeChildrenUrl(parentFolder.getId()), toJsonAsStringNonNull(d1), 201);
HttpResponse response = post(getNodeChildrenUrl(parentFolderId), toJsonAsStringNonNull(d1), params, null, "alfresco", expectedStatus);
return RestApiUtil.parseRestApiEntry(response.getJsonResponse(), Document.class);
}
protected Document updateTextFile(String contentId, String textContent, Map<String, String> parameters) throws IOException, Exception
protected Document updateTextFile(String contentId, String textContent, Map<String, String> params) throws IOException, Exception
{
ByteArrayInputStream inputStream = new ByteArrayInputStream(textContent.getBytes());
File txtFile = TempFileProvider.createTempFile(inputStream, getClass().getSimpleName(), ".txt");
BinaryPayload payload = new BinaryPayload(txtFile);
HttpResponse response = putBinary(getNodeContentUrl(contentId), payload, null, parameters, 200);
HttpResponse response = putBinary(getNodeContentUrl(contentId), payload, null, params, 200);
return RestApiUtil.parseRestApiEntry(response.getJsonResponse(), Document.class);
}