Merged HEAD-BUG-FIX (5.0/Cloud) to HEAD (4.3/Cloud)

71623: Merged V4.2-BUG-FIX (4.2.3) to HEAD-BUG-FIX (4.3/Cloud)
      71393: Reverse Merge V4.2-BUG-FIX (4.2.3)
        <<Main solution is correct. Fix required for the test specifically for 4.2-BUG-FIX branch>> 
         71299: Reverse Merge V4.2-BUG-FIX (4.2.3)
            <<Caused build failures since #347 on 4.2-BUG-FIX branch>>
            70399: Merged V4.1-BUG-FIX (4.1.9) to V4.2-BUG-FIX (4.2.3)
               70351: Merged DEV to V4.1-BUG-FIX (4.1.9)
                  66550 : MNT-8624 : CMIS Query breaks with non cmis objects
                     - Ignoring entities of non-cmis types
                  70135 : MNT-8624 : CMIS Query breaks with non cmis objects
                     - Test to demonstrate working with link object (link is non-cmis type)


git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@74706 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Will Abson
2014-06-25 15:32:40 +00:00
parent 66245b22b5
commit 1af4dde0ca
2 changed files with 71 additions and 0 deletions

View File

@@ -45,6 +45,7 @@
[#-- --]
[#macro document node renditionfilter="cmis:none" propfilter="*" includeallowableactions=false includerelationships="none" includeacl=false ns=""]
[#if cmistype(node)??]
[@entry ns]
<author><name>${node.properties.creator!""}</name></author>
[@contentstream node/]
@@ -71,6 +72,7 @@
</cmisra:object>
<cmisra:pathSegment>${node.name?xml}</cmisra:pathSegment>
[/@entry]
[/#if]
[/#macro]
[#macro documentCMISLinks node]
@@ -100,6 +102,7 @@
[/#macro]
[#macro folder node renditionfilter="cmis:none" propfilter="*" typesfilter="any" includeallowableactions=false includerelationships="none" includeacl=false ns="" depth=1 maxdepth=1 relativePathSegment="" nestedkind=""]
[#if cmistype(node)??]
[@entry ns]
<author><name>${node.properties.creator!""}</name></author>
[@contentstream node/]
@@ -144,6 +147,7 @@
[/#if]
[/#if]
[/@entry]
[/#if]
[/#macro]
[#macro folderCMISLinks node]
@@ -167,6 +171,7 @@
[#-- --]
[#macro assoc assoc propfilter="*" includeallowableactions=false ns=""]
[#if cmistype(node)??]
[@entry ns]
<author><name>${assoc.source.properties.creator!""}</name></author>
<content>[@namedvalue cmisconstants.PROP_OBJECT_ID assoc cmisconstants.DATATYPE_ID/]</content>
@@ -182,6 +187,7 @@
[#if includeallowableactions][@assocallowableactions assoc/][/#if]
</cmisra:object>
[/@entry]
[/#if]
[/#macro]
[#macro assocCMISLinks assoc]

View File

@@ -18,17 +18,33 @@
*/
package org.alfresco.repo.cmis.rest.test;
import java.io.Serializable;
import java.util.HashMap;
import java.util.Map;
import org.alfresco.model.ApplicationModel;
import org.alfresco.model.ContentModel;
import org.alfresco.repo.security.authentication.AuthenticationUtil;
import org.alfresco.service.cmr.repository.ChildAssociationRef;
import org.alfresco.service.cmr.repository.NodeRef;
import org.alfresco.service.cmr.repository.NodeService;
import org.alfresco.service.namespace.QName;
import org.alfresco.util.ApplicationContextHelper;
import org.apache.abdera.model.Entry;
import org.apache.abdera.model.Link;
import org.junit.Assert;
import org.junit.Test;
import org.springframework.context.ApplicationContext;
import org.springframework.extensions.webscripts.TestWebScriptServer.GetRequest;
import org.springframework.extensions.webscripts.TestWebScriptServer.Request;
import org.springframework.extensions.webscripts.TestWebScriptServer.Response;
public class CMISAtomTemplatesTest extends BaseCMISTest
{
private static ApplicationContext ctx = ApplicationContextHelper.getApplicationContext(new String[]{ApplicationContextHelper.CONFIG_LOCATIONS[0],"classpath:test-cmisinteger_modell-context.xml"});
private NodeService nodeService;
static String docName;
static String xmlResponse;
@@ -47,6 +63,8 @@ public class CMISAtomTemplatesTest extends BaseCMISTest
Assert.assertNotNull(documentRes);
xmlResponse = documentRes.getContentAsString();
Assert.assertNotNull(xmlResponse);
this.nodeService = (NodeService)ctx.getBean("NodeService");
}
@Test
@@ -68,4 +86,51 @@ public class CMISAtomTemplatesTest extends BaseCMISTest
// check document name with repeatable spaces in xml response.
assertEquals("Probably, item.get.atomentry.ftl template has compress dirrective", true, xmlResponse.contains(docName));
}
/*
* Get children, if parent has object of non-cmis type
* cm:folderlink is non-cmis type.
*/
@Test
public void testChildrenWithLink() throws Exception
{
String testFolderRefStr = testCaseFolder.getId().toString().replace("urn:uuid:", "workspace://SpacesStore/");
NodeRef testFolderRef = new NodeRef(testFolderRefStr);
Map<QName, Serializable> props = new HashMap<QName, Serializable>(2, 1.0f);
String linkName = "link " + testCaseFolder.getTitle() + ".url";
props.put(ContentModel.PROP_NAME, linkName);
props.put(ContentModel.PROP_LINK_DESTINATION, testFolderRef);
AuthenticationUtil.pushAuthentication();;
AuthenticationUtil.setAdminUserAsFullyAuthenticatedUser();
NodeRef linkRef = null;
try
{
ChildAssociationRef childRef = nodeService.createNode(
testFolderRef,
ContentModel.ASSOC_CONTAINS,
QName.createQName(testCaseFolder.getTitle()),
ApplicationModel.TYPE_FOLDERLINK,
props);
linkRef = childRef.getChildRef();
String id = testCaseFolder.getId().toString().replace("urn:uuid:", "workspace:SpacesStore/i/");
Request get = new GetRequest("/cmis/s/" + id + "/children");
sendRequest(get, 200);
}
finally
{
if (linkRef != null)
{
nodeService.deleteNode(linkRef);
}
AuthenticationUtil.popAuthentication();
}
}
}