public void testAddingObjectWithAllVersions() { if (!isCapabilityMultifilingEnabled()) { Assert.Skip("Multi-Filing capability is not supported"); } if (!isVersioningAllowed()) { Assert.Skip("Versioning is not supported for " + getAndAssertDocumentTypeId() + " Document Type"); } MultifiledObject document = createAndAssertMultifilledDocument(getAndAssertRootFolder(), 5); string versionedMultiFilledDocument = createAndAssertVersionedDocument(document.DocumentObject.ObjectId, 5, true); FileableObject folder = createAndAssertFolder(getAndAssertRootFolder()); cmisExtensionType extensions = new cmisExtensionType(); multifilingServiceClient.addObjectToFolder(getAndAssertRepositoryId(), document.DocumentObject.ObjectId, folder.ObjectId, true, ref extensions); cmisObjectInFolderListType children = getAndAssertChildren(folder.ObjectId, "*", null, 10L, 0L, null); if (!isVersionSpecificFiling()) { logger.log("Children were received. Version Specific Filing is not supported. 5 Versions were created for document"); Assert.AreEqual(1, children.objects.Length, "Amount of Children more than 1"); } else { logger.log("Children were received. Version Specific Filing is supported. 5 Versions were created for document"); Assert.IsTrue((6 == children.objects.Length), "Amount of Children is not equal to 6"); } deleteAndAssertObject(versionedMultiFilledDocument, true); deleteAndAssertObject(folder, false); foreach (CmisObject parent in document.Parents) { deleteAndAssertObject(parent, false); } }
public void testInvalidRepositoryIdUsing() { if (!isCapabilityMultifilingEnabled()) { Assert.Skip("Multi-filling is not supported. Test will be skipped..."); } string rootFolderId = getAndAssertRootFolder(); MultifiledObject document = createAndAssertMultifilledDocument(rootFolderId, 2); FileableObject folder = createAndAssertFolder(rootFolderId); logger.log("Invalid Repository Id using for Add Object To Folder service"); cmisExtensionType extensions = new cmisExtensionType(); try { multifilingServiceClient.addObjectToFolder(INVALID_REPOSITORY_ID, document.DocumentObject.ObjectId, folder.ObjectId, false, ref extensions); deleteMultiFilledDocumentAndLogIfFailed(document, "Multi-filled Document was created but it can't be deleted. Error cause message: "); deleteObjectAndLogIfFailed(folder, "Folder was created but it can't be deleted. Error cause message: "); Assert.Fail("Document Object was moved ignoring Invalid Repository Id"); } catch (Exception e) { deleteAndAssertObject(folder, true); if (e is FaultException <cmisFaultType> ) { assertException((FaultException <cmisFaultType>)e, enumServiceException.invalidArgument); } else { throw e; } } logger.log("Invalid Repository Id using for Remove Object From Folder service"); try { multifilingServiceClient.removeObjectFromFolder(INVALID_REPOSITORY_ID, document.DocumentObject.ObjectId, document.Parents[0].ObjectId, ref extensions); deleteMultiFilledDocumentAndLogIfFailed(document, "Document was created but it can't be deleted. Error cause message: "); Assert.Fail("Document Object was moved ignoring Invalid Repository Id"); } catch (Exception e) { if (e is FaultException <cmisFaultType> ) { assertException((FaultException <cmisFaultType>)e, enumServiceException.invalidArgument); } else { throw e; } } }
public void testDeletingOfMultiFilledObject() { if (!isCapabilityMultifilingEnabled()) { Assert.Skip("Multi-Filing capability is not supported"); } MultifiledObject document = createAndAssertMultifilledDocument(getAndAssertRootFolder(), 5); deleteAndAssertObject(document.DocumentObject, true); foreach (CmisObject parent in document.Parents) { deleteAndAssertObject(parent, false); } }
private void assertMultiFilledParentsReceving(string rootFolderId) { MultifiledObject multifilledDocument = createAndAssertMultifilledDocument(rootFolderId, 10); string[] parents = new string[multifilledDocument.Parents.Length + 1]; parents[0] = rootFolderId; int parentIndex = 1; foreach (FileableObject parentObject in multifilledDocument.Parents) { parents[parentIndex++] = parentObject.ObjectId; } assertDocumentParents(multifilledDocument.DocumentObject.ObjectId, parents); deleteAndAssertMultifilledDocument(multifilledDocument); }
public void testRemovingObjectFromFolderAgainsUnfilingCapability() { string rootFolderId = getAndAssertRootFolder(); if (!isCapabilityMultifilingEnabled()) { Assert.Skip("Multi-Filing capability is not supported"); } MultifiledObject multiFilledDocument = createAndAssertMultifilledDocument(rootFolderId, 1); cmisExtensionType extensions = new cmisExtensionType(); if (!isCapabilityUnfilingEnabled()) { logger.log("Un-Filing capability is not supported!"); try { multifilingServiceClient.removeObjectFromFolder(getAndAssertRepositoryId(), multiFilledDocument.DocumentObject.ObjectId, null, ref extensions); deleteMultiFilledDocumentAndLogIfFailed(multiFilledDocument, "Multi-filled Document was created but it can't be deleted. Error cause message: "); Assert.Fail("Un-Filing capability is not supported but Object was removed from all Parent Folder Objects"); } catch (Exception e) { deleteAndAssertMultifilledDocument(multiFilledDocument); if (e is FaultException <cmisFaultType> ) { assertException((FaultException <cmisFaultType>)e, null); } else { throw e; } } } else { logger.log("Un-Filing is supported!"); multifilingServiceClient.removeObjectFromFolder(getAndAssertRepositoryId(), multiFilledDocument.DocumentObject.ObjectId, null, ref extensions); deleteAndAssertMultifilledDocument(multiFilledDocument); } }
public void testAddingAndRemovingObjectToFolder() { string rootFolderId = getAndAssertRootFolder(); MultifiledObject multifilledDocument = null; if (!isCapabilityMultifilingEnabled()) { try { multifilledDocument = createAndAssertMultifilledDocument(rootFolderId, 10); deleteMultiFilledDocumentAndLogIfFailed(multifilledDocument, "Multi-filled Document was created with Not Allowed Multi-filling capability but it can't be deleted. Error cause message: "); Assert.Fail("Multi-filled Document Object was created with Not Allowed Multi-filling capability"); } catch (FaultException <cmisFaultType> e) { assertException(e, enumServiceException.notSupported); } } else { multifilledDocument = createAndAssertMultifilledDocument(rootFolderId, 10); deleteAndAssertMultifilledDocument(multifilledDocument); } }
public void deleteAndAssertMultifilledDocument(MultifiledObject multifiledDocument) { if (isValueNotSet(multifiledDocument.DocumentObject)) { return; } if (!isValueNotSet(multifiledDocument.Parents)) { logger.log("Removing Parents for Document, documentId='" + multifiledDocument.DocumentObject.ObjectId + "'"); string repositoryId = getAndAssertRepositoryId(); foreach (FileableObject parent in multifiledDocument.Parents) { if (isValueNotSet(parent) || isValueNotSet(parent.ObjectId)) { logger.log("Invalid undefined Parent Object was faced"); continue; } logger.log(""); logger.log("Removing Parent with parentId='" + parent.ObjectId + "'"); logger.log("[MultiFilingService->removeObjectFromFolder]"); cmisExtensionType extension = new cmisExtensionType(); multifilingServiceClient.removeObjectFromFolder(repositoryId, multifiledDocument.DocumentObject.ObjectId, parent.ObjectId, ref extension); logger.log(""); deleteAndAssertFolder(parent, false); } logger.log("Parents were successfully removed"); } else { logger.log("Parents' list of Document with Id='" + multifiledDocument.DocumentObject.ObjectId + "' is empty"); } deleteAndAssertObject(multifiledDocument.DocumentObject, true); }
protected void deleteMultiFilledDocumentAndLogIfFailed(MultifiledObject document, string messagePrefix) { try { deleteAndAssertMultifilledDocument(document); } catch (Exception e) { logger.log(messagePrefix + e.Message); } }