/// <summary> /// This method is used to workFlow element related requirements. /// </summary> /// <param name="responseOfGetWorkflowDataForItem">A parameter represents the response Of GetWorkflowDataForItem operation.</param> private void VerifyWorkflowItemInGetWorkflowDataForItemResponse(GetWorkflowDataForItemResponseGetWorkflowDataForItemResult responseOfGetWorkflowDataForItem) { if (null == responseOfGetWorkflowDataForItem.WorkflowData.ActiveWorkflowsData.Workflows) { return; } #region Capture Workflows related requirement XmlNode workflows = AdapterHelper.GetNodeFromXML("Workflows", SchemaValidation.LastRawResponseXml); if (null == workflows.ChildNodes || 0 == workflows.ChildNodes.Count) { return; } List<string> invalidStatusPageUrlValues = new List<string>(); List<string> invalidInternalStateValues = new List<string>(); List<string> itemsWithOutActivityDetailsAttribute = new List<string>(); List<string> itemsWithActivityDetailsAttribute = new List<string>(); List<string> itemsWithOutCorrelationIdAttribute = new List<string>(); List<string> itemsWithCorrelationIdAttribute = new List<string>(); List<string> invalidIdValues = new List<string>(); foreach (XmlNode workflowitem in workflows.ChildNodes) { #region Verify StatusPageUrl attribute. // Get the value of StatusPageUrl. string statusPageUrl = workflowitem.Attributes["StatusPageUrl"].InnerText; if (!string.IsNullOrEmpty(statusPageUrl)) { // Fully qualified URL means a URL that includes a protocol transport scheme name("http" or "https") and a host name. // Absolute means URL is from the very start, e.g.http://abc.com/a/b/c.htm. Uri statusPageUrlUriInstance; bool isabsoluteAndFullyqualifiedURL = false; if (Uri.TryCreate(statusPageUrl, UriKind.Absolute, out statusPageUrlUriInstance)) { if (statusPageUrlUriInstance.HostNameType == UriHostNameType.Dns) { string currentsutComputerName = Common.GetConfigurationPropertyValue("SUTComputerName", this.Site); isabsoluteAndFullyqualifiedURL = statusPageUrlUriInstance.Host.Equals(currentsutComputerName, StringComparison.OrdinalIgnoreCase); } else { isabsoluteAndFullyqualifiedURL = true; } } if (!isabsoluteAndFullyqualifiedURL) { invalidStatusPageUrlValues.Add(statusPageUrl); } } #endregion verify StatusPageUrl attributes. #region Verify InternalState attribute. // Get the value of InternalState. string internalStateValue = workflowitem.Attributes["InternalState"].InnerText; long internalState; bool isvalidinternalStateValue = false; if (long.TryParse(internalStateValue, out internalState)) { // The values in the array are the possible bitmasks for combining the value of internalState. long[] bitMasks = new long[] { 0x00000001, 0x00000002, 0x00000004, 0x00000008, 0x00000040, 0x00000080, 0x00000100, 0x00000400, 0x00000800, 0x00001000 }; // Check whether the value of internalState is zero or more combination of the bitmasks. isvalidinternalStateValue = AdapterHelper.IsValueValid(internalState, bitMasks); } if (!isvalidinternalStateValue) { invalidInternalStateValues.Add(internalStateValue); } #endregion Verify InternalState attribute. #region Verify ActivityDetails attribute var withActivityDetails = from XmlAttribute attributeItem in workflowitem.Attributes where attributeItem.Name.Equals("ActivityDetails", StringComparison.OrdinalIgnoreCase) select attributeItem; if (withActivityDetails.Count() == 0) { string workflowitemId = workflowitem.Attributes["Id"].Value; itemsWithOutActivityDetailsAttribute.Add(workflowitemId); } else if (withActivityDetails.Count() == 1) { string workflowitemId = workflowitem.Attributes["Id"].Value; itemsWithActivityDetailsAttribute.Add(workflowitemId); } else { this.Site.Assert.Fail(@"The work flow item have un-expected number [{0}] of [ActivityDetails] attribute.", withActivityDetails.Count()); } #endregion Verify ActivityDetails attribute #region Verify CorrelationId Attribute var withCorrelationId = from XmlAttribute attributeItem in workflowitem.Attributes where attributeItem.Name.Equals("CorrelationId", StringComparison.OrdinalIgnoreCase) select attributeItem; if (withCorrelationId.Count() == 0) { string workflowitemId = workflowitem.Attributes["Id"].Value; itemsWithOutCorrelationIdAttribute.Add(workflowitemId); } else if (withCorrelationId.Count() == 1) { string workflowitemId = workflowitem.Attributes["Id"].Value; itemsWithCorrelationIdAttribute.Add(workflowitemId); } else { this.Site.Assert.Fail(@"The work flow item have un-expected number [{0}] of [CorrelationId] attribute.", withCorrelationId.Count()); } #endregion Verify CorrelationId Attribute #region Verify ID attribute string idattributeValue = workflowitem.Attributes["Id"].InnerText; if (string.IsNullOrEmpty(idattributeValue)) { invalidIdValues.Add("EmptyOrNull"); } Guid pasrseValue; if (!Guid.TryParse(idattributeValue, out pasrseValue)) { invalidIdValues.Add(idattributeValue); } #endregion Verify ID attribute } // Add logs for R222 string logMsg = string.Empty; if (invalidIdValues.Count != 0) { string title = "These below values indicate invalid Id values in [ActiveWorkflowsData] element:"; logMsg = this.GenerateLogsForMutipleItem(invalidIdValues, title); this.Site.Log.Add(LogEntryKind.Debug, logMsg); } // Verify R223 this.Site.CaptureRequirementIfAreEqual( 0, invalidIdValues.Count, 223, @"[In GetWorkflowDataForItemResponse] GetWorkflowDataForItemResult.WorkflowData.ActiveWorkflowsData. Workflows.Workflow.Id: A workflow identifier."); // Add logs for R222 logMsg = string.Empty; if (invalidStatusPageUrlValues.Count != 0) { string title = "There are invalid StatusPageUrl values:"; logMsg = this.GenerateLogsForMutipleItem(invalidStatusPageUrlValues, title); this.Site.Log.Add(LogEntryKind.Debug, logMsg); } // Verify R222 this.Site.CaptureRequirementIfAreEqual( 0, invalidStatusPageUrlValues.Count, 222, @"[In GetWorkflowDataForItemResponse] This URL[GetWorkflowDataForItemResult.WorkflowData.ActiveWorkflowsData.Workflows.Workflow.StatusPageUrl] MUST be both a fully qualified URL and an absolute URL."); // Add the log for R448. logMsg = string.Empty; if (invalidInternalStateValues.Count != 0) { string title = "There are invalid InternalState values:"; logMsg = this.GenerateLogsForMutipleItem(invalidInternalStateValues, title); this.Site.Log.Add(LogEntryKind.Debug, logMsg); } if (Common.IsRequirementEnabled(422, this.Site)) { // Add the log for R422. logMsg = string.Empty; // If the response have any item which does not include ActivityDetails attributes, output the logs. if (itemsWithOutActivityDetailsAttribute.Count != 0) { string title = "These below ids indicate those workflow items in [ActiveWorkflowsData] element does not include [ActivityDetails] attribute:"; logMsg = this.GenerateLogsForMutipleItem(itemsWithOutActivityDetailsAttribute, title); this.Site.Log.Add(LogEntryKind.Debug, logMsg); } // If all items have ActivityDetails Attribute, then verify R422 this.Site.CaptureRequirementIfAreEqual( workflows.ChildNodes.Count, itemsWithActivityDetailsAttribute.Count, 422, @"[In Appendix B: Product Behavior] Implementation does include his attribute[ActivityDetails].(Microsoft® SharePoint® Foundation 2010 and above follow this behavior.)"); } if (Common.IsRequirementEnabled(365, this.Site)) { // Add the log for R365. logMsg = string.Empty; // If the response have any item which include ActivityDetails attributes, output the logs. if (itemsWithActivityDetailsAttribute.Count != 0) { string title = "These below ids indicate those workflow items in [ActiveWorkflowsData] element does not include [ActivityDetails] attribute:"; logMsg = this.GenerateLogsForMutipleItem(invalidInternalStateValues, title); this.Site.Log.Add(LogEntryKind.Debug, logMsg); } // If all items have ActivityDetails Attribute, then Verify R365 this.Site.CaptureRequirementIfAreEqual( workflows.ChildNodes.Count, itemsWithOutActivityDetailsAttribute.Count, 365, @"[In Appendix B: Product Behavior] Implementation does not include this attribute[ActivityDetails]. [In Appendix B: Product Behavior] <3> Section 3.1.4.5.2.2: Office SharePoint Server 2007 does not include this attribute[ActivityDetails]."); } if (Common.IsRequirementEnabled(423, this.Site)) { // Add the log for R423. logMsg = string.Empty; if (itemsWithCorrelationIdAttribute.Count != 0) { string title = "These below ids indicate those workflow items in [ActiveWorkflowsData] element does include [CorrelationId] attribute:"; logMsg = this.GenerateLogsForMutipleItem(itemsWithCorrelationIdAttribute, title); this.Site.Log.Add(LogEntryKind.Debug, logMsg); } // Verify R423 this.Site.CaptureRequirementIfAreEqual( 0, itemsWithCorrelationIdAttribute.Count, 423, @"[In Appendix B: Product Behavior] Implementation does not include this attribute[CorrelationId]. [In Appendix B: Product Behavior] <4> Section 3.1.4.5.2.2: Office SharePoint Server 2007 and SharePoint Server 2010 do not include this attribute[CorrelationId]."); } if (Common.IsRequirementEnabled(424, this.Site)) { // Add the log for R424. logMsg = string.Empty; if (itemsWithOutCorrelationIdAttribute.Count != 0) { string title = "These below ids indicate those workflow items in [ActiveWorkflowsData] element does include [CorrelationId] attribute:"; logMsg = this.GenerateLogsForMutipleItem(itemsWithOutCorrelationIdAttribute, title); this.Site.Log.Add(LogEntryKind.Debug, logMsg); } // Verify R424 this.Site.CaptureRequirementIfAreEqual( 0, itemsWithOutCorrelationIdAttribute.Count, 424, @"[In Appendix B: Product Behavior] Implementation does include his attribute[CorrelationId].(Microsoft® SharePoint® Foundation 2013 Preview follow this behavior.)"); } #endregion Capture Workflows related requirement }
/// <summary> /// Capture soap information related requirements of GetWorkflowDataForItem operation. /// </summary> /// <param name="responseOfGetWorkflowDataForItem">A parameter represents the response Of GetWorkflowDataForItem operation.</param> private void CaptureGetWorkflowDataForItem(GetWorkflowDataForItemResponseGetWorkflowDataForItemResult responseOfGetWorkflowDataForItem) { // Verify MS-WWSP requirement: MS-WWSP_R207 bool isVerifyR207 = AdapterHelper.HasElement(SchemaValidation.LastRawResponseXml, "GetWorkflowDataForItemResponse"); Site.CaptureRequirementIfIsTrue( isVerifyR207, 207, "[In GetWorkflowDataForItemSoapOut] The SOAP body contains a GetWorkflowDataForItemResponse element."); this.VerifyWorkflowItemInGetWorkflowDataForItemResponse(responseOfGetWorkflowDataForItem); }