Модульный тест с cmis: primaryObjectTypeIds:
@Test
public void createStDocumentWithCMIS11() {
String folderId = "workspace://SpacesStore/03de40f1-e80d-4e0d-8b67-67e93f6e30a1";
// Connection and session to CMIS 1.1
HashMap<String, String> params = new HashMap<>();
params.put(SessionParameter.ATOMPUB_URL, "http://localhost:8084/alfresco/api/-default-/cmis/versions/1.1/atom");
params.put(SessionParameter.USER, "admin");
params.put(SessionParameter.PASSWORD, "admin");
params.put(SessionParameter.BINDING_TYPE, BindingType.ATOMPUB.value());
params.put(SessionParameter.OBJECT_FACTORY_CLASS, "org.alfresco.cmis.client.impl.AlfrescoObjectFactoryImpl");
SessionFactory factory = SessionFactoryImpl.newInstance();
Session session = factory.getRepositories(params).get(0).createSession();
// Find root folder
Folder folder = (Folder) session.getObject(folderId);
assertNotNull(folder);
// Properties for type
Map<String, Object> properties = new HashMap<>();
properties.put(PropertyIds.NAME, "Test CMIS folder type stDocument");
properties.put(PropertyIds.OBJECT_TYPE_ID, "F:sd:structDocument");
properties.put("sd:situation", "situation");
// Create folder
Folder stDocument = folder.createFolder(properties);
assertNotNull(stDocument);
// Add secondary objects (Aspects)
List<Object> aspects = stDocument.getProperty("cmis:secondaryObjectTypeIds").getValues();
aspects.add("P:sd:additionalInfo");
HashMap<String, Object> props = new HashMap<>();
props.put("cmis:secondaryObjectTypeIds", aspects);
stDocument.updateProperties(props);
// Add aspect's property
HashMap<String, Object> propsAspects = new HashMap<>();
propsAspects.put("sd:cause", "test");
stDocument.updateProperties(propsAspects);
assertEquals("test", stDocument.getProperty("sd:cause").getValueAsString());
}
Но не работает ...: (*