mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-14 17:58:59 +00:00
Merged 5.2.N (5.2.1) to HEAD (5.2)
129790 jvonka: REPO-164 / REPO-1141: fix error mapping when unable to update content due to locked node (should be 409 not 500) - also minor cleanup of error handling/mapping (handle within common "writeContent") git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@130230 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -764,16 +764,29 @@ public abstract class AbstractBaseApiTest extends EnterpriseTestApi
|
||||
|
||||
// create empty file
|
||||
HttpResponse response = post(getNodeChildrenUrl(parentFolderId), toJsonAsStringNonNull(d1), params, null, "alfresco", expectedStatus);
|
||||
if (expectedStatus != 201)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
return RestApiUtil.parseRestApiEntry(response.getJsonResponse(), Document.class);
|
||||
}
|
||||
|
||||
protected Document updateTextFile(String contentId, String textContent, Map<String, String> params) throws IOException, Exception
|
||||
protected Document updateTextFile(String contentId, String textContent, Map<String, String> params) throws Exception
|
||||
{
|
||||
return updateTextFile(contentId, textContent, params, 200);
|
||||
}
|
||||
|
||||
protected Document updateTextFile(String contentId, String textContent, Map<String, String> params, int expectedStatus) throws 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, params, 200);
|
||||
HttpResponse response = putBinary(getNodeContentUrl(contentId), payload, null, params, expectedStatus);
|
||||
if (expectedStatus != 200)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
return RestApiUtil.parseRestApiEntry(response.getJsonResponse(), Document.class);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user