diff --git a/config/alfresco/public-rest-context.xml b/config/alfresco/public-rest-context.xml index 46defecd79..7beda3861d 100644 --- a/config/alfresco/public-rest-context.xml +++ b/config/alfresco/public-rest-context.xml @@ -743,6 +743,7 @@ + @@ -753,6 +754,7 @@ + @@ -763,6 +765,7 @@ + () + { + @Override + public NodeRef doWork() throws Exception + { + NodeRef rootNodeRef = repoService.getNodeService().getRootNode(StoreRef.STORE_REF_WORKSPACE_SPACESSTORE); + List childAssocs = repoService.getNodeService().getChildAssocsByPropertyValue(rootNodeRef, + ContentModel.PROP_TITLE, "Company Home"); + assertEquals(1, childAssocs.size()); + NodeRef companyHomeNodeRef = childAssocs.get(0).getChildRef(); + return companyHomeNodeRef; + } + + }, network.getId()); + assertNotNull(rootNodeRef); + + // atom + { + Binding binding = Binding.atom; + String url = httpClient.getPublicApiCmisUrl(TenantUtil.DEFAULT_TENANT, binding, "1.1", null); + + Map parameters = new HashMap(); + + // user credentials + parameters.put(SessionParameter.USER, "admin@" + network.getId()); + parameters.put(SessionParameter.PASSWORD, "admin"); + parameters.put(SessionParameter.ATOMPUB_URL, url); + parameters.put(SessionParameter.BINDING_TYPE, binding.getOpenCmisBinding().value()); + + SessionFactory factory = SessionFactoryImpl.newInstance(); + Repository repository = factory.getRepositories(parameters).get(0); + String rootFolderId = repository.getRootFolderId(); + + assertEquals(rootNodeRef.getId(), rootFolderId); + } + + { + Binding binding = Binding.browser; + String url = httpClient.getPublicApiCmisUrl(TenantUtil.DEFAULT_TENANT, binding, "1.1", null); + + Map parameters = new HashMap(); + + // user credentials + parameters.put(SessionParameter.USER, "admin@" + network.getId()); + parameters.put(SessionParameter.PASSWORD, "admin"); + parameters.put(SessionParameter.BROWSER_URL, url); + parameters.put(SessionParameter.BINDING_TYPE, binding.getOpenCmisBinding().value()); + + SessionFactory factory = SessionFactoryImpl.newInstance(); + Repository repository = factory.getRepositories(parameters).get(0); + String rootFolderId = repository.getRootFolderId(); + + assertEquals(rootNodeRef.getId(), rootFolderId); + } + } }