Merged HEAD (5.2) to 5.2.N (5.2.1)

126394 jkaabimofrad: Merged FILE-FOLDER-API (5.2.0) to HEAD (5.2)
      120648 jkaabimofrad: RA-640: Added test to update node content. Also, minor modification to satisfy the IDEA's code analysis.


git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/BRANCHES/DEV/5.2.N/root@126740 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Ancuta Morarasu
2016-05-11 11:00:37 +00:00
parent 6fddaa8eb1
commit 83a44a7d33

View File

@@ -590,7 +590,7 @@ public class NodeApiTest extends AbstractBaseApiTest
HttpResponse response = getAll(getChildrenUrl(Nodes.PATH_MY), user1, paging, 200); HttpResponse response = getAll(getChildrenUrl(Nodes.PATH_MY), user1, paging, 200);
PublicApiClient.ExpectedPaging pagingResult = parsePaging(response.getJsonResponse()); PublicApiClient.ExpectedPaging pagingResult = parsePaging(response.getJsonResponse());
assertNotNull(paging); assertNotNull(paging);
final int numOfNodes = pagingResult.getCount().intValue(); final int numOfNodes = pagingResult.getCount();
MultiPartBuilder multiPartBuilder = MultiPartBuilder.create() MultiPartBuilder multiPartBuilder = MultiPartBuilder.create()
.setFileData(new FileData(fileName, file, MimetypeMap.MIMETYPE_PDF)); .setFileData(new FileData(fileName, file, MimetypeMap.MIMETYPE_PDF));
@@ -706,7 +706,7 @@ public class NodeApiTest extends AbstractBaseApiTest
HttpResponse response = getAll(getChildrenUrl(folderA_Ref), userOneN1.getId(), paging, 200); HttpResponse response = getAll(getChildrenUrl(folderA_Ref), userOneN1.getId(), paging, 200);
PublicApiClient.ExpectedPaging pagingResult = parsePaging(response.getJsonResponse()); PublicApiClient.ExpectedPaging pagingResult = parsePaging(response.getJsonResponse());
assertNotNull(paging); assertNotNull(paging);
final int numOfNodes = pagingResult.getCount().intValue(); final int numOfNodes = pagingResult.getCount();
MultiPartBuilder multiPartBuilder = MultiPartBuilder.create() MultiPartBuilder multiPartBuilder = MultiPartBuilder.create()
.setFileData(new FileData(fileName, file, null)); .setFileData(new FileData(fileName, file, null));
@@ -1232,6 +1232,7 @@ public class NodeApiTest extends AbstractBaseApiTest
final String docName = "testdoc"; final String docName = "testdoc";
doc.setName(docName); doc.setName(docName);
doc.setNodeType("cm:content"); doc.setNodeType("cm:content");
doc.setProperties(Collections.singletonMap("cm:title", (Object)"test title"));
ContentInfo contentInfo = new ContentInfo(); ContentInfo contentInfo = new ContentInfo();
contentInfo.setMimeType(MimetypeMap.MIMETYPE_TEXT_PLAIN); contentInfo.setMimeType(MimetypeMap.MIMETYPE_TEXT_PLAIN);
doc.setContent(contentInfo); doc.setContent(contentInfo);
@@ -1263,10 +1264,26 @@ public class NodeApiTest extends AbstractBaseApiTest
response = putBinary(url, user1, payload, null, null, 200); response = putBinary(url, user1, payload, null, null, 200);
docResp = RestApiUtil.parseRestApiEntry(response.getJsonResponse(), Document.class); docResp = RestApiUtil.parseRestApiEntry(response.getJsonResponse(), Document.class);
assertEquals(docName, docResp.getName()); assertEquals(docName, docResp.getName());
assertNotNull(docResp.getId());
assertNotNull(docResp.getCreatedAt());
assertNotNull(docResp.getCreatedByUser());
assertNotNull(docResp.getModifiedAt());
assertNotNull(docResp.getModifiedByUser());
assertFalse(docResp.getIsFolder());
assertNull(docResp.getIsLink());
assertEquals("cm:content", docResp.getNodeType());
assertNotNull(docResp.getParentId());
assertEquals(f1_nodeId, docResp.getParentId());
assertNotNull(docResp.getProperties());
assertNotNull(docResp.getAspectNames());
contentInfo = docResp.getContent();
assertNotNull(contentInfo);
assertNotNull(contentInfo.getEncoding());
assertTrue(contentInfo.getSizeInBytes() > 0);
assertEquals(MimetypeMap.MIMETYPE_TEXT_PLAIN, contentInfo.getMimeType());
assertNotNull(contentInfo.getMimeTypeName());
// path is not part of the default response
assertNull(docResp.getPath()); assertNull(docResp.getPath());
assertNotNull(docResp.getContent());
assertTrue(docResp.getContent().getSizeInBytes().intValue() > 0);
assertEquals(MimetypeMap.MIMETYPE_TEXT_PLAIN, docResp.getContent().getMimeType());
// Download the file // Download the file
response = getSingle(url, user1, null, 200); response = getSingle(url, user1, null, 200);