mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-21 18:09:20 +00:00
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:
@@ -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();
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user