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)
129161 mmuller: Merged RETURN-OF-THE-API (5.2.0) to 5.2.N (5.2.1) 128476 jvonka: REPO-839: Follow-on to fix subtle issue in mimeType guess (ie. application/octet-stream should be last resort, if magic bytes indicate text and there is no file ext) git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@129335 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -76,6 +76,7 @@ import org.alfresco.service.cmr.security.MutableAuthenticationService;
|
|||||||
import org.alfresco.service.cmr.security.PermissionService;
|
import org.alfresco.service.cmr.security.PermissionService;
|
||||||
import org.alfresco.service.cmr.security.PersonService;
|
import org.alfresco.service.cmr.security.PersonService;
|
||||||
import org.alfresco.service.cmr.site.SiteVisibility;
|
import org.alfresco.service.cmr.site.SiteVisibility;
|
||||||
|
import org.alfresco.util.GUID;
|
||||||
import org.alfresco.util.TempFileProvider;
|
import org.alfresco.util.TempFileProvider;
|
||||||
import org.json.simple.JSONObject;
|
import org.json.simple.JSONObject;
|
||||||
import org.junit.After;
|
import org.junit.After;
|
||||||
@@ -1021,6 +1022,20 @@ public class NodeApiTest extends AbstractBaseApiTest
|
|||||||
contentInfo = document.getContent();
|
contentInfo = document.getContent();
|
||||||
assertEquals(MimetypeMap.MIMETYPE_OPENXML_WORDPROCESSING, contentInfo.getMimeType());
|
assertEquals(MimetypeMap.MIMETYPE_OPENXML_WORDPROCESSING, contentInfo.getMimeType());
|
||||||
assertEquals("UTF-8", contentInfo.getEncoding());
|
assertEquals("UTF-8", contentInfo.getEncoding());
|
||||||
|
|
||||||
|
// additional test
|
||||||
|
fileName = "CMIS-Delete.json";
|
||||||
|
file = getResourceFile(fileName);
|
||||||
|
|
||||||
|
multiPartBuilder = MultiPartBuilder.create()
|
||||||
|
.setFileData(new FileData("special-"+GUID.generate(), file));
|
||||||
|
reqBody = multiPartBuilder.build();
|
||||||
|
|
||||||
|
response = post(getNodeChildrenUrl(fId), user1, reqBody.getBody(), null, reqBody.getContentType(), 201);
|
||||||
|
document = RestApiUtil.parseRestApiEntry(response.getJsonResponse(), Document.class);
|
||||||
|
contentInfo = document.getContent();
|
||||||
|
assertEquals(MimetypeMap.MIMETYPE_TEXT_PLAIN, contentInfo.getMimeType());
|
||||||
|
assertEquals("UTF-8", contentInfo.getEncoding());
|
||||||
|
|
||||||
// cleanup
|
// cleanup
|
||||||
delete(URL_NODES, user1, fId, 204);
|
delete(URL_NODES, user1, fId, 204);
|
||||||
|
68
source/test-resources/publicapi/upload/CMIS-Delete.json
Normal file
68
source/test-resources/publicapi/upload/CMIS-Delete.json
Normal file
@@ -0,0 +1,68 @@
|
|||||||
|
{
|
||||||
|
"id": "9703fafd-3041-c6fb-2f20-367eeb1b7697",
|
||||||
|
"name": "CMIS Delete",
|
||||||
|
"description": "",
|
||||||
|
"order": [
|
||||||
|
"7d4fa49e-125d-7f40-328d-6998fd383b1c",
|
||||||
|
"fb149dbf-4725-db4c-163a-a541ce0bb830"
|
||||||
|
],
|
||||||
|
"folders": [],
|
||||||
|
"timestamp": 1461678623161,
|
||||||
|
"owner": "250102",
|
||||||
|
"remoteLink": "",
|
||||||
|
"public": false,
|
||||||
|
"requests": [
|
||||||
|
{
|
||||||
|
"id": "7d4fa49e-125d-7f40-328d-6998fd383b1c",
|
||||||
|
"headers": "Authorization: Basic xxxx\n",
|
||||||
|
"url": "{{baseUrl}}/{{networkId}}/public/cmis/versions/1.1/browser/root?objectId=d57861c1-48a3-4e3f-b1e3-9822e52707d1",
|
||||||
|
"preRequestScript": "",
|
||||||
|
"pathVariables": {},
|
||||||
|
"method": "POST",
|
||||||
|
"data": [
|
||||||
|
{
|
||||||
|
"key": "cmisaction",
|
||||||
|
"value": "delete",
|
||||||
|
"type": "text",
|
||||||
|
"enabled": true
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"dataMode": "urlencoded",
|
||||||
|
"tests": null,
|
||||||
|
"currentHelper": "normal",
|
||||||
|
"helperAttributes": {},
|
||||||
|
"time": 1461678196209,
|
||||||
|
"name": "Delete object",
|
||||||
|
"description": "NOTE: This will delete an empty folder but not a folder with children, use \"deletetree\" action for that!",
|
||||||
|
"collectionId": "9703fafd-3041-c6fb-2f20-367eeb1b7697",
|
||||||
|
"responses": []
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "fb149dbf-4725-db4c-163a-a541ce0bb830",
|
||||||
|
"headers": "Authorization: Basic xxxx\n",
|
||||||
|
"url": "{{baseUrl}}/{{networkId}}/public/cmis/versions/1.1/browser/root?objectId=14463495-b278-45f2-bef4-d9d2d0f91485",
|
||||||
|
"pathVariables": {},
|
||||||
|
"preRequestScript": "",
|
||||||
|
"method": "POST",
|
||||||
|
"collectionId": "9703fafd-3041-c6fb-2f20-367eeb1b7697",
|
||||||
|
"data": [
|
||||||
|
{
|
||||||
|
"key": "cmisaction",
|
||||||
|
"value": "deletetree",
|
||||||
|
"type": "text",
|
||||||
|
"enabled": true
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"dataMode": "urlencoded",
|
||||||
|
"name": "Delete folder",
|
||||||
|
"description": "",
|
||||||
|
"descriptionFormat": "html",
|
||||||
|
"time": 1461678531597,
|
||||||
|
"version": 2,
|
||||||
|
"responses": [],
|
||||||
|
"tests": null,
|
||||||
|
"currentHelper": "normal",
|
||||||
|
"helperAttributes": {}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
Reference in New Issue
Block a user