use of org.alfresco.opencmis.CMISDispatcherRegistry.Binding in project alfresco-remote-api by Alfresco.
the class TestCMIS method testACE3433.
@Test
public void testACE3433() throws Exception {
final TestNetwork network = getTestFixture().getRandomNetwork();
NodeRef rootNodeRef = TenantUtil.runAsSystemTenant(new TenantRunAsWork<NodeRef>() {
@Override
public NodeRef doWork() throws Exception {
NodeRef rootNodeRef = repoService.getNodeService().getRootNode(StoreRef.STORE_REF_WORKSPACE_SPACESSTORE);
List<ChildAssociationRef> 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<String, String> parameters = new HashMap<String, String>();
// 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<String, String> parameters = new HashMap<String, String>();
// 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);
}
}
Aggregations