public void testCheckInContentAgainstPwcUpdatableCapability() { if (!isVersioningAllowed()) { Assert.Skip(VERSIONING_NOT_SUPPORTTED_MESSAGE); } if (!isPwcUpdatable()) { Assert.Skip("PWC is Not Updatable"); } if (!isContentStreamAllowed()) { Assert.Skip("Content Stream is Not Allowed for Document Type"); } FileableObject document = createAndAssertObject(getAndAssertRootFolder(), enumVersioningState.checkedout, false); cmisContentStreamType changedContent = FileableObject.createCmisDocumentContent("Modified.txt", FileableObject.getContentEtry()); string objectId = document.ObjectId; string changeToken = null;// TODO cmisExtensionType extensions = new cmisExtensionType(); objectServiceClient.setContentStream(getAndAssertRepositoryId(), ref objectId, true, ref changeToken, changedContent, ref extensions); document.setId(objectId); document.setId(checkInAndAssert(objectId, true)); cancelCheckoutAndDeleteDocumentWithAssertion(document.ObjectId); }
public void testCheckInAgainstContentStreamAcceptation() { if (!isVersioningAllowed()) { Assert.Skip(VERSIONING_NOT_SUPPORTTED_MESSAGE); } FileableObject documentCreator = new FileableObject(enumTypesOfFileableObjects.documents, getAndAssertRootFolder(), getAndAssertDocumentTypeId(), null, enumVersioningState.checkedout, true); string checkedOutDocumentId = createAndAssertObject(documentCreator, false).ObjectId; cmisContentStreamType content = FileableObject.createCmisDocumentContent("test.txt", FileableObject.getContentEtry()); if (!isContentStreamAllowed()) { checkInAndAssertWithExpectedException(getAndAssertRepositoryId(), checkedOutDocumentId, null, null, content, CHECKIN_COMMENT, enumServiceException.streamNotSupported, "Not Allowed Content Stream"); } else { if (!isPwcUpdatable() && isContentStreamRequired()) { HashSet <enumServiceException> expectedExceptions = new HashSet <enumServiceException>(); expectedExceptions.Add(enumServiceException.storage); expectedExceptions.Add(enumServiceException.constraint); checkInAndAssertWithExpectedException(getAndAssertRepositoryId(), checkedOutDocumentId, null, null, null, CHECKIN_COMMENT, expectedExceptions, "Document with Required Content Stream when PWC Updatable capability not supported and Content Stream parameter was not introduced"); } else { checkedOutDocumentId = checkInAndAssert(checkedOutDocumentId, false); } } cancelCheckoutAndDeleteDocumentWithAssertion(checkedOutDocumentId); }
public void testNotCheckedOutObjectCheckining() { if (!isVersioningAllowed()) { Assert.Skip(VERSIONING_NOT_SUPPORTTED_MESSAGE); } FileableObject document = createAndAssertObject(getAndAssertRootFolder(), null, false); cmisContentStreamType content = null; if (!isPwcUpdatable() && isContentStreamRequired()) { content = FileableObject.createCmisDocumentContent("test.txt", FileableObject.getContentEtry()); } checkInAndAssertWithExpectedException(getAndAssertRepositoryId(), document.ObjectId, null, null, null, CHECKIN_COMMENT, null, "Not Checked Out Document Id"); deleteAndAssertObject(document, true); }
public void testInvalidObjectCheckining() { if (!isVersioningAllowed()) { Assert.Skip(VERSIONING_NOT_SUPPORTTED_MESSAGE); } cmisContentStreamType content = null; if (!isPwcUpdatable() && isContentStreamRequired()) { content = FileableObject.createCmisDocumentContent("test.txt", FileableObject.getContentEtry()); } HashSet <enumServiceException> expectedExceptions = new HashSet <enumServiceException>(); expectedExceptions.Add(enumServiceException.invalidArgument); expectedExceptions.Add(enumServiceException.objectNotFound); checkInAndAssertWithExpectedException(getAndAssertRepositoryId(), INVALID_OBJECT_ID, null, null, content, null, expectedExceptions, "Invalid Object Id"); }
public void testQueryFullText() { if (enumCapabilityQuery.none.Equals(getQueryAllowed()) || enumCapabilityQuery.metadataonly.Equals(getQueryAllowed())) { Assert.Skip("Full-Text query isn't supported"); } string name = FileableObject.generateObjectName(false, "TextSearch"); string content = getRandomLiteralString(7) + " " + getRandomLiteralString(5); cmisContentStreamType contentStremType = FileableObject.createCmisDocumentContent(name, Encoding.GetEncoding(FileableObject.DEFAULT_ENCODING).GetBytes(content)); FileableObject documentCreator = new FileableObject(enumTypesOfFileableObjects.documents, getAndAssertDocumentTypeId(), getAndAssertRootFolder()); documentCreator.ContentStream = contentStremType; createAndAssertObject(documentCreator); string query = "SELECT * FROM " + getAndAssertDocumentQueryName() + " WHERE CONTAINS('" + content + "')"; executeAndAssertQuery(query, PAGE_SIZE, 0, false, false, enumIncludeRelationships.none); deleteAndAssertObject(documentCreator.ObjectId); }
public void testNotVersionableAndNotCheckedOutDocumentCheckining() { if (!isVersioningAllowed()) { Assert.Skip(VERSIONING_NOT_SUPPORTTED_MESSAGE); } string notVersionalbeTypeId = enumerateAndAssertTypesForAction(getAndAssertTypeDescendants(getAndAssertBaseDocumentTypeId(), -1, false), new NotVersionableDocumentTypeSearcher(), true); if (isValueNotSet(notVersionalbeTypeId)) { Assert.Skip("Not Versionable Document Type was not found"); } FileableObject document = createAndAssertObject(false, getAndAssertRootFolder(), notVersionalbeTypeId); cmisContentStreamType content = null; if (!isPwcUpdatable() && isContentStreamRequired()) { content = FileableObject.createCmisDocumentContent("test.txt", FileableObject.getContentEtry()); } checkInAndAssertWithExpectedException(getAndAssertRepositoryId(), document.ObjectId, null, null, content, CHECKIN_COMMENT, enumServiceException.versioning, "Document with Not Versionable Type"); deleteAndAssertObject(document, true); }
private void checkInAndAssertWithExpectedException(string repositoryId, string checkedoutDocumentId, Nullable <bool> major, cmisPropertiesType properties, cmisContentStreamType content, string checkInComment, HashSet <enumServiceException> expectedExceptions, string caseMessage) { try { cmisExtensionType extensions = new cmisExtensionType(); logger.log("[VersioningService->checkIn()]"); // TODO: applyPolicies, addACEs, removeACEs versioningServiceClient.checkIn(repositoryId, ref checkedoutDocumentId, major, properties, content, checkInComment, null, null, null, ref extensions); logger.log("Expected exception during All Versions Receiving with " + caseMessage + " was not thrown"); } catch (FaultException <cmisFaultType> e) { if (expectedExceptions != null && expectedExceptions.Count > 0) { assertException(e, expectedExceptions); } } catch (Exception e) { cancelCheckoutAndDeleteDocumentWithAssertion(checkedoutDocumentId); throw e; } }
private void checkInAndAssertWithExpectedException(string repositoryId, string checkedoutDocumentId, Nullable <bool> major, cmisPropertiesType properties, cmisContentStreamType content, string checkInComment, enumServiceException expectedException, string caseMessage) { HashSet <enumServiceException> expectedExceptions = new HashSet <enumServiceException>(); expectedExceptions.Add(expectedException); checkInAndAssertWithExpectedException(repositoryId, checkedoutDocumentId, major, properties, content, checkInComment, expectedExceptions, caseMessage); }
protected override void resetObject() { base.resetObject(); objectName = null; contentStream = null; textualContentStream = null; }
public static cmisContentStreamType createCmisDocumentContent(string name, byte[] content) { cmisContentStreamType result = new cmisContentStreamType(); result.filename = name; result.length = content.Length.ToString(); result.mimeType = TEXT_DOCUMENT_MIMETYPE; result.stream = content; return result; }
private void checkInAndAssertWithExpectedException(string repositoryId, string checkedoutDocumentId, Nullable<bool> major, cmisPropertiesType properties, cmisContentStreamType content, string checkInComment, HashSet<enumServiceException> expectedExceptions, string caseMessage) { try { cmisExtensionType extensions = new cmisExtensionType(); logger.log("[VersioningService->checkIn()]"); // TODO: applyPolicies, addACEs, removeACEs versioningServiceClient.checkIn(repositoryId, ref checkedoutDocumentId, major, properties, content, checkInComment, null, null, null, ref extensions); logger.log("Expected exception during All Versions Receiving with " + caseMessage + " was not thrown"); } catch (FaultException<cmisFaultType> e) { if (expectedExceptions != null && expectedExceptions.Count > 0) { assertException(e, expectedExceptions); } } catch (Exception e) { cancelCheckoutAndDeleteDocumentWithAssertion(checkedoutDocumentId); throw e; } }
private void checkInAndAssertWithExpectedException(string repositoryId, string checkedoutDocumentId, Nullable<bool> major, cmisPropertiesType properties, cmisContentStreamType content, string checkInComment, enumServiceException expectedException, string caseMessage) { HashSet<enumServiceException> expectedExceptions = new HashSet<enumServiceException>(); expectedExceptions.Add(expectedException); checkInAndAssertWithExpectedException(repositoryId, checkedoutDocumentId, major, properties, content, checkInComment, expectedExceptions, caseMessage); }