A class used to store the response data of "GetItem" operation.
예제 #1
0
        /// <summary>
        /// A method used to verify GetItem operation related captures.
        /// </summary>
        /// <param name="responseOfGetItem">A parameter represents the response of a GetItem operation.</param>
        private void VerifyGetItemOperationCapture(GetItemResponse responseOfGetItem)
        {
            if (null == responseOfGetItem)
            {
                throw new ArgumentNullException("responseOfGetItem");
            }

            this.VerifyTransPortAndSOAPCapture();

            // If schema validation is successful, the request and response schema definition related requirements: MS-COPYS_R169, MS-COPYS_R171, MS-COPYS_R184, MS-COPYS_R191, MS-COPYS_R192 and MS-COPYS_R195 can be directly captured.
            this.Site.CaptureRequirement(
                169,
                @"[In GetItem] [The GetItem schema is:]: <wsdl:operation name=""GetItem"">
    <wsdl:input message=""tns:GetItemSoapIn"" />
    <wsdl:output message=""tns:GetItemSoapOut"" />
</wsdl:operation>");

            // Verified requirement: MS-COPYS_R171
            this.Site.CaptureRequirement(
                171,
                @"[In GetItem] [The protocol client sends a GetItemSoapIn request message (section 3.1.4.1.1.1) and] the protocol server responds with a GetItemSoapOut response message (section 3.1.4.1.1.2) as follows:");

            // Verified requirement: MS-COPYS_R184
            this.Site.CaptureRequirement(
                184,
                @"[In GetItemSoapOut] The SOAP body contains a GetItemResponse element (section 3.1.4.1.2.2).");

            // Verified requirement: MS-COPYS_R191
            this.Site.CaptureRequirement(
                191,
                @"[In GetItemResponse] It contains content and metadata for the requested file.");

            // Verified requirement: MS-COPYS_R192
            this.Site.CaptureRequirement(
                192,
                @"[In GetItemResponse] [The schema of the GetItemResponse is defined as:] <s:element name=""GetItemResponse"">
              <s:complexType>
                <s:sequence>
                  <s:element minOccurs=""1"" maxOccurs=""1""
                    name=""GetItemResult"" type=""s:unsignedInt"" />
                  <s:element minOccurs=""0"" maxOccurs=""1""
                    name=""Fields"" type=""tns:FieldInformationCollection"" />
                  <s:element minOccurs=""0"" maxOccurs=""1""
                    name=""Stream"" type=""s:base64Binary"" />
                </s:sequence>
              </s:complexType>
            </s:element>");

            this.Site.CaptureRequirementIfIsTrue(
                responseOfGetItem.GetItemResult.Equals(0),
                195,
                @"[In GetItemResponse] [GetItemResult] The protocol server MUST set this value to zero.");

          // Validate the field information collection and field information items.
            this.VerifyFieldInfromationCollection(responseOfGetItem.Fields);
        }
예제 #2
0
        /// <summary>
        /// A method used to verify GetItem operation related captures.
        /// </summary>
        /// <param name="responseOfGetItem">A parameter represents the response of a GetItem operation.</param>
        private void VerifyGetItemOperationCapture(GetItemResponse responseOfGetItem)
        {
            if (null == responseOfGetItem)
            {
                throw new ArgumentNullException("responseOfGetItem");
            }

            this.VerifyTransPortAndSOAPCapture();

            // If schema validation is successful, the request and response schema definition related requirements: MS-COPYS_R169, MS-COPYS_R171, MS-COPYS_R184, MS-COPYS_R191, MS-COPYS_R192 and MS-COPYS_R195 can be directly captured.
            this.Site.CaptureRequirement(
                169,
                @"[In GetItem] [The GetItem schema is:]: <wsdl:operation name=""GetItem"">
    <wsdl:input message=""tns:GetItemSoapIn"" />
    <wsdl:output message=""tns:GetItemSoapOut"" />
</wsdl:operation>");

            // Verified requirement: MS-COPYS_R171
            this.Site.CaptureRequirement(
                171,
                @"[In GetItem] [The protocol client sends a GetItemSoapIn request message (section 3.1.4.1.1.1) and] the protocol server responds with a GetItemSoapOut response message (section 3.1.4.1.1.2) as follows:");

            // Verified requirement: MS-COPYS_R184
            this.Site.CaptureRequirement(
                184,
                @"[In GetItemSoapOut] The SOAP body contains a GetItemResponse element (section 3.1.4.1.2.2).");

            // Verified requirement: MS-COPYS_R191
            this.Site.CaptureRequirement(
                191,
                @"[In GetItemResponse] It contains content and metadata for the requested file.");

            // Verified requirement: MS-COPYS_R192
            this.Site.CaptureRequirement(
                192,
                @"[In GetItemResponse] [The schema of the GetItemResponse is defined as:] <s:element name=""GetItemResponse"">
              <s:complexType>
                <s:sequence>
                  <s:element minOccurs=""1"" maxOccurs=""1""
                    name=""GetItemResult"" type=""s:unsignedInt"" />
                  <s:element minOccurs=""0"" maxOccurs=""1""
                    name=""Fields"" type=""tns:FieldInformationCollection"" />
                  <s:element minOccurs=""0"" maxOccurs=""1""
                    name=""Stream"" type=""s:base64Binary"" />
                </s:sequence>
              </s:complexType>
            </s:element>");

            this.Site.CaptureRequirementIfIsTrue(
                responseOfGetItem.GetItemResult.Equals(0),
                195,
                @"[In GetItemResponse] [GetItemResult] The protocol server MUST set this value to zero.");

            // Validate the field information collection and field information items.
            this.VerifyFieldInfromationCollection(responseOfGetItem.Fields);
        }
        public void MSCOPYS_S02_TC07_CopyIntoItemsLocal_EncodedAbsUrlField()
        {
            this.Site.Assume.IsTrue(Common.IsRequirementEnabled(232, this.Site), @"This is executed only when R232Enable is set to true.");

            // Get the value of the source file URL.
            string sourceFileUrl = this.GetSourceFileUrl(SourceFileUrlType.SourceFileOnDesSUT);

            // Get the first destination location.
            string desFileUrl = this.GetDestinationFileUrl(DestinationFileUrlType.NormalDesLibraryOnDesSUT);

            string[] desUrls = new string[] { desFileUrl };

            // Retrieve the contents and metadata for a file from the specified location.
            GetItemResponse getitemsResponse = MSCopysAdapter.GetItem(sourceFileUrl);

            this.Site.Assert.IsNotNull(getitemsResponse, "GetItem operation should succeed");

            // Select a field by specified field attribute value.
            FieldInformation fieldInfoScource = this.SelectFieldBySpecifiedAtrribute(
                getitemsResponse.Fields,
                "EncodedAbsUrl",
                FieldAttributeType.InternalName);

            // Copy a file to the destination server.
            CopyIntoItemsLocalResponse copyIntoItemsLocalResponse = MSCopysAdapter.CopyIntoItemsLocal(
                sourceFileUrl,
                desUrls);

            // Verify whether all copy results are successful.
            bool isVerifyCopySuccess = VerifyAllCopyResultsSuccess(copyIntoItemsLocalResponse.Results, true);

            this.Site.Assert.IsTrue(isVerifyCopySuccess, "CopyIntoItemsLocal operation should succeed.");

            // Collect files from specified file URLs.
            this.CollectFileByUrl(desUrls);

            // Retrieve content and metadata for a file that is stored in a source location with first destination URL.
            GetItemResponse getitemsResponseDes = MSCopysAdapter.GetItem(copyIntoItemsLocalResponse.Results[0].DestinationUrl);

            // Select a field by specified field attribute value.
            FieldInformation fieldInfoDes = this.SelectFieldBySpecifiedAtrribute(
                getitemsResponseDes.Fields,
                "EncodedAbsUrl",
                FieldAttributeType.InternalName);

            if (Common.IsRequirementEnabled(232, this.Site))
            {
                // Verify MS-COPYS requirement: MS-COPYS_R232
                this.Site.CaptureRequirementIfAreNotEqual(
                    fieldInfoScource.Value.ToLower(),
                    fieldInfoDes.Value.ToLower(),
                    232,
                    @"[In Appendix B: Product Behavior] CopyIntoItemsLocal operation does not copy the EncodedAbsUrl field.(Windows SharePoint Services 3.0, SharePoint Foundation 2010 and SharePoint Foundation 2013 follow this behavior.)");
            }
        }
예제 #4
0
        public void MSCOPYS_S02_TC08_CopyIntoItemsLocal_CopySourceField()
        {
            this.Site.Assume.IsTrue(Common.IsRequirementEnabled(149, this.Site), @"This is executed only when R149Enable is set to true.");

            // Get the value of the source file URL.
            string sourceFileUrl = this.GetSourceFileUrl(SourceFileUrlType.SourceFileOnDesSUT);

            // Get the first destination location.
            string desFileUrl = this.GetDestinationFileUrl(DestinationFileUrlType.NormalDesLibraryOnDesSUT);

            string[] desUrls = new string[] { desFileUrl };

            // Copy a file to the destination server.
            CopyIntoItemsLocalResponse copyIntoItemsLocalResponse = MSCopysAdapter.CopyIntoItemsLocal(
                sourceFileUrl,
                desUrls);

            // Verify whether all copy results are successful.
            bool isVerifyCopySuccess = VerifyAllCopyResultsSuccess(copyIntoItemsLocalResponse.Results, true);

            this.Site.Assert.IsTrue(isVerifyCopySuccess, "CopyIntoItemsLocal operation should succeed.");

            // Collect files from specified file URLs.
            this.CollectFileByUrl(desUrls);

            // Retrieve content and metadata for a file that is stored in a source location with first destination URL.
            GetItemResponse getitemsResponseDes = MSCopysAdapter.GetItem(copyIntoItemsLocalResponse.Results[0].DestinationUrl);

            // Select a field by specified field attribute value.
            FieldInformation fieldInfoDes = this.SelectFieldBySpecifiedAtrribute(
                getitemsResponseDes.Fields,
                "_CopySource",
                FieldAttributeType.InternalName);

            // Verify MS-COPYS requirement: MS-COPYS_R149
            this.Site.CaptureRequirementIfAreEqual(
                sourceFileUrl.ToLower(),
                fieldInfoDes.Value.ToLower(),
                149,
                @"[In Appendix B: Product Behavior] [For CopyIntoItemsLocation operation] Implementation [the value of field with internal name _CopySource ] does equal to the value of source location.(SharePoint Foundation 2010 follow this behavior.)");
        }
        /// <summary>
        /// A method is used to retrieve the contents and metadata for a file from the specified location.
        /// </summary>
        /// <param name="url">A parameter represents the location of the file.</param>
        /// <returns>A return value represents the file contents and metadata.</returns>
        public GetItemResponse GetItem(string url)
        {
            GetItemResponse getItemResponse;
            uint            getItemResult;

            FieldInformation[] fields;
            byte[]             rawStreamValues;

            try
            {
                getItemResult   = this.copySoapService.GetItem(url, out fields, out rawStreamValues);
                getItemResponse = new GetItemResponse(getItemResult, fields, rawStreamValues);
            }
            catch (SoapException)
            {
                throw;
            }

            this.VerifyGetItemOperationCapture(getItemResponse);
            return(getItemResponse);
        }
        /// <summary>
        /// A method is used to retrieve the contents and metadata for a file from the specified location.
        /// </summary>
        /// <param name="url">A parameter represents the location of the file.</param>
        /// <returns>A return value represents the file contents and metadata.</returns>
        public GetItemResponse GetItem(string url)
        {
            GetItemResponse getItemResponse;
            uint getItemResult;
            FieldInformation[] fields;
            byte[] rawStreamValues;

            try
            {
                getItemResult = this.copySoapService.GetItem(url, out fields, out rawStreamValues);
                getItemResponse = new GetItemResponse(getItemResult, fields, rawStreamValues);
            }
            catch (SoapException soapEx)
            {
                this.VerifySoapExceptionDetailCapture(soapEx);
                throw;
            }

            this.VerifyGetItemOperationCapture(getItemResponse);
            return getItemResponse;
        }
        public void MSCOPYS_S02_TC09_CopyIntoItemsLocal_CheckFileContent()
        {
            // Get resource from properties,normal source file and normal destination library.
            string sourceFileUrlOnDesSut = this.GetSourceFileUrl(SourceFileUrlType.SourceFileOnDesSUT);

            // Get the first destination location.
            string desFileUrl1 = this.GetDestinationFileUrl(DestinationFileUrlType.NormalDesLibraryOnDesSUT);

            // Get the section destination location.
            string desFileUrl2 = this.GetDestinationFileUrl(DestinationFileUrlType.NormalDesLibraryOnDesSUT);

            string[] desUrls = new string[] { desFileUrl1, desFileUrl2 };

            // Copy files in same SUT.
            CopyIntoItemsLocalResponse copyIntoItemsLocalResponse = MSCopysAdapter.CopyIntoItemsLocal(
                sourceFileUrlOnDesSut,
                desUrls);

            // Verify whether all copy results are successful.
            bool isVerifyCopySuccess = VerifyAllCopyResultsSuccess(copyIntoItemsLocalResponse.Results, true);

            this.Site.Assert.IsTrue(isVerifyCopySuccess, "CopyIntoItemsLocal operation should succeed.");

            // Collect files from specified file URLs.
            this.CollectFileByUrl(desUrls);

            this.Site.Assert.AreEqual(2, copyIntoItemsLocalResponse.Results.Length, "CopyIntoItemsLocal operation return a collection must contain two items if the DestinationUrls have two items in the request.");

            // Retrieve content and metadata for a file that is stored in a source location with first destination URL.
            GetItemResponse getitemsResponseDes1 = MSCopysAdapter.GetItem(copyIntoItemsLocalResponse.Results[0].DestinationUrl);

            // Retrieve content and metadata for a file that is stored in a source location with second destination URL.
            GetItemResponse getitemsResponseDes2 = MSCopysAdapter.GetItem(copyIntoItemsLocalResponse.Results[1].DestinationUrl);

            this.Site.Assert.IsNotNull(getitemsResponseDes1.StreamRawValues, "The element StreamRawValues should be returned.");
            this.Site.Assert.IsNotNull(getitemsResponseDes2.StreamRawValues, "The element StreamRawValues should be returned.");

            // If the contents of the file are equal to the property which is configured, then R168, R285, R265 and R261 should be covered.
            this.Site.Assert.AreEqual(
                Common.GetConfigurationPropertyValue("SourceFileContents", this.Site),
                Encoding.UTF8.GetString(getitemsResponseDes1.StreamRawValues),
                "The file content should equal to the source which is copied to the destination location.");

            this.Site.Assert.AreEqual(
                Common.GetConfigurationPropertyValue("SourceFileContents", this.Site),
                Encoding.UTF8.GetString(getitemsResponseDes2.StreamRawValues),
                "The file content should equal to the source which is copied to the destination location.");

            // Verify MS-COPYS requirement: MS-COPYS_R168
            this.Site.CaptureRequirement(
                168,
                @"[In Message Processing Events and Sequencing Rules] CopyIntoItemsLocal: Copies a file when the destination 
                of the operation is on the same protocol server as the source location.");

            // Verify MS-COPYS requirement: MS-COPYS_R285
            this.Site.CaptureRequirement(
                285,
                @"[In CopyIntoItemsLocal] The protocol server MUST attempt to copy the file to all destination locations that 
                are specified in the request.");

            // Because the server is never be changed, the source location and destination server is the same server all the time.
            // Verify MS-COPYS requirement: MS-COPYS_R265
            this.Site.CaptureRequirement(
                265,
                @"[In CopyIntoItemsLocal] The source location and the destination server refer to the same protocol server for 
                this operation.");

            // Verify MS-COPYS requirement: MS-COPYS_R261
            this.Site.CaptureRequirement(
                261,
                @"[In CopyIntoItemsLocal] The CopyIntoItemsLocal operation copies a file, and the associated metadata, from one 
                location to one or more locations on the same protocol server.");
        }