private cmisObjectListType getAndAssertRelationship(bool includeSubTypes, enumIncludeRelationships relationshipDirection, string typeId, string filter, bool allowableActions, Nullable <long> maxItems, Nullable <long> skipCount) { RelationshipObject relationship = createAndAssertRelationship(getAndAssertRelationshipTypeId(), getAndAssertRootFolder(), false, false, false); string objectId = null; enumRelationshipDirection direction = enumRelationshipDirection.either; switch (relationshipDirection) { case enumIncludeRelationships.source: { objectId = relationship.SourceObject.ObjectId; direction = enumRelationshipDirection.source; break; } case enumIncludeRelationships.target: { objectId = relationship.TargetObject.ObjectId; direction = enumRelationshipDirection.target; break; } case enumIncludeRelationships.both: { objectId = relationship.SourceObject.ObjectId; break; } } logger.log("[RelationshipService->getObjectRelationships]"); logger.log("Getting relationships for object with objectId='" + objectId + "', direction=" + relationshipDirection); cmisObjectListType response = relationshipServiceClient.getObjectRelationships(getAndAssertRepositoryId(), objectId, includeSubTypes, direction, typeId, filter, allowableActions, maxItems, skipCount, null); Assert.IsNotNull(response, "Object Relationships were not returned"); assertRelationships(objectId, response.objects, relationshipDirection); logger.log("Relationships were successfully received"); logger.log(""); deleteAndAssertRelationship(relationship); return(response); }
private cmisObjectListType getAndAssertRelationship(bool includeSubTypes, enumIncludeRelationships relationshipDirection, string typeId, string filter, bool allowableActions, Nullable<long> maxItems, Nullable<long> skipCount) { RelationshipObject relationship = createAndAssertRelationship(getAndAssertRelationshipTypeId(), getAndAssertRootFolder(), false, false, false); string objectId = null; enumRelationshipDirection direction = enumRelationshipDirection.either; switch (relationshipDirection) { case enumIncludeRelationships.source: { objectId = relationship.SourceObject.ObjectId; direction = enumRelationshipDirection.source; break; } case enumIncludeRelationships.target: { objectId = relationship.TargetObject.ObjectId; direction = enumRelationshipDirection.target; break; } case enumIncludeRelationships.both: { objectId = relationship.SourceObject.ObjectId; break; } } logger.log("[RelationshipService->getObjectRelationships]"); logger.log("Getting relationships for object with objectId='" + objectId + "', direction=" + relationshipDirection); cmisObjectListType response = relationshipServiceClient.getObjectRelationships(getAndAssertRepositoryId(), objectId, includeSubTypes, direction, typeId, filter, allowableActions, maxItems, skipCount, null); Assert.IsNotNull(response, "Object Relationships were not returned"); assertRelationships(objectId, response.objects, relationshipDirection); logger.log("Relationships were successfully received"); logger.log(""); deleteAndAssertRelationship(relationship); return response; }
private cmisObjectType[] executeAndAssertQuery(string query, int pageSize, int skipCount, bool allVersions, bool allowableActions, enumIncludeRelationships relationships, string renditionFilter) { logger.log("Executing query '" + query + "', pageSize=" + pageSize + ", skipCount=" + skipCount); logger.log("[DiscoveryService->query]"); cmisObjectListType response = discoveryServiceClient.query(getAndAssertRepositoryId(), query, allVersions, allowableActions, relationships, renditionFilter, pageSize, skipCount, null); Assert.IsNotNull(response, "response is null"); Assert.IsNotNull(response.objects, "Objects are undefined"); Assert.IsTrue(response.objects.Length > 0, "number of returned objects < 1"); if ((DOCS_COUNT - skipCount) >= pageSize) { Assert.IsTrue((response.objects.Length > 0 && response.objects.Length <= PAGE_SIZE), "number of returned objects(" + response.objects.Length + ") is not equal to expected(0 < N <=" + pageSize + ")"); } logger.log("Query successfully executed, number of returned objects=" + response.objects.Length); logger.log(""); return response.objects; }
private cmisObjectType[] executeAndAssertQuery(string query, int pageSize, int skipCount, bool allVersions, bool allowableActions, enumIncludeRelationships relationships) { return executeAndAssertQuery(query, pageSize, skipCount, allVersions, allowableActions, relationships, null); }
private cmisObjectType[] executeAndAssertQuery(string query, int pageSize, int skipCount, bool allVersions, bool allowableActions, enumIncludeRelationships relationships, string renditionFilter) { logger.log("Executing query '" + query + "', pageSize=" + pageSize + ", skipCount=" + skipCount); logger.log("[DiscoveryService->query]"); cmisObjectListType response = discoveryServiceClient.query(getAndAssertRepositoryId(), query, allVersions, allowableActions, relationships, renditionFilter, pageSize, skipCount, null); Assert.IsNotNull(response, "response is null"); Assert.IsNotNull(response.objects, "Objects are undefined"); Assert.IsTrue(response.objects.Length > 0, "number of returned objects < 1"); if ((DOCS_COUNT - skipCount) >= pageSize) { Assert.IsTrue((response.objects.Length > 0 && response.objects.Length <= PAGE_SIZE), "number of returned objects(" + response.objects.Length + ") is not equal to expected(0 < N <=" + pageSize + ")"); } logger.log("Query successfully executed, number of returned objects=" + response.objects.Length); logger.log(""); return(response.objects); }
private cmisObjectType[] executeAndAssertQuery(string query, int pageSize, int skipCount, bool allVersions, bool allowableActions, enumIncludeRelationships relationships) { return(executeAndAssertQuery(query, pageSize, skipCount, allVersions, allowableActions, relationships, null)); }
protected static void assertObject(FileableObject expectedProperties, cmisObjectType actualObject, bool includeAllowableActions, enumIncludeRelationships relationshipsType) { Assert.IsFalse(isValueNotSet(actualObject), "Returned Object is undefined"); Assert.IsFalse(isValueNotSet(actualObject.properties), "Properties of returned Object are undefined"); Assert.IsFalse(isValueNotSet(actualObject.properties.Items), "Properties of returned Object are empty"); object propertyValue = searchAndAssertPropertyByName(actualObject.properties.Items, NAME_PROPERTY, false); Assert.AreEqual(expectedProperties.ObjectName, propertyValue, ("Object Name Property value differs to Property value returned with Get Properties Response. Expected: " + expectedProperties.ObjectName + ", actual: " + propertyValue)); propertyValue = searchAndAssertPropertyByName(actualObject.properties.Items, TYPE_ID_PROPERTY, false); Assert.AreEqual(expectedProperties.ObjectTypeId, propertyValue, ("Object Type Id Property value differs to Property value returned with Get Properties Response. Expected: " + expectedProperties.ObjectName + ", actual: " + propertyValue)); propertyValue = searchAndAssertPropertyByName(actualObject.properties.Items, OBJECT_IDENTIFIER_PROPERTY, false); Assert.AreEqual(expectedProperties.ObjectId, propertyValue, ("Expected Object Id='" + expectedProperties.ObjectId + "' is not equal to actual Object Id='" + propertyValue + "'")); //TODO: uncomment when problem will be found //assertActualVersioningState(actualObject.properties, expectedProperties.InitialVersion); if (includeAllowableActions) { Assert.IsNotNull(actualObject.allowableActions, "Allowable Actions was not returned in Get Object Properties response"); Assert.IsTrue(!isValueNotSet(actualObject.allowableActions.canGetProperties) && actualObject.allowableActions.canGetProperties, ("Properties of Object with id='" + expectedProperties.ObjectId + "' Reading is not allowed but Properties were returned")); logger.log("Allowable actions were checked successfully"); } else { Assert.IsTrue(isValueNotSet(actualObject.allowableActions), "Allowable Actions were not requested but were returned in response of Get Properties"); } assertRelationships(expectedProperties.ObjectId, actualObject.relationship, relationshipsType); logger.log("Relationships for " + relationshipsType + " direction were checked successfully"); }