コード例 #1
0
        public void TestCase_S09_TC06_ResourceIDDifferentWithUrl()
        {
            Site.Assume.IsTrue(Common.IsRequirementEnabled("MS-FSSHTTP-FSSHTTPB", 11272, this.Site), "This test case runs only when implementation uses the value of the ResourceID attribute to identify the file instead of the Url attribute  when UseResourceID set to true and the ResourceID attribute is set on the Request element.");

            string anotherFile = this.PrepareFile();

            // Initialize the service
            this.InitializeContext(this.DefaultFileUrl, this.UserName01, this.Password01, this.Domain);

            // Invoke "GetVersions"sub-request with correct input parameters.
            GetVersionsSubRequestType getVersionsSubRequest = SharedTestSuiteHelper.CreateGetVersionsSubRequest(SequenceNumberGenerator.GetCurrentToken());
            CellStorageResponse       cellStoreageResponse  = Adapter.CellStorageRequest(
                this.DefaultFileUrl,
                new SubRequestType[] { getVersionsSubRequest },
                "1", 2, 2, null, null, null, null, null, null, true);
            GetVersionsSubResponseType getVersionsSubResponse = SharedTestSuiteHelper.ExtractSubResponse <GetVersionsSubResponseType>(cellStoreageResponse, 0, 0, this.Site);

            Site.Assert.AreEqual <ErrorCodeType>(
                ErrorCodeType.Success,
                SharedTestSuiteHelper.ConvertToErrorCodeType(getVersionsSubResponse.ErrorCode, this.Site), "Get versions should be succeed.");

            VersionType version = cellStoreageResponse.ResponseVersion as VersionType;

            Site.Assume.AreEqual <ushort>(3, version.MinorVersion, "This test case runs only when MinorVersion is 3 which indicates the protocol server is capable of performing ResourceID specific behavior.");

            // Set both Url and ResourceID attribute
            cellStoreageResponse = Adapter.CellStorageRequest(
                anotherFile,
                new SubRequestType[] { getVersionsSubRequest },
                "1", 2, 2, null, null, null, null, null, cellStoreageResponse.ResponseCollection.Response[0].ResourceID, true);

            if (SharedContext.Current.IsMsFsshttpRequirementsCaptured)
            {
                // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R11272
                Site.CaptureRequirementIfIsTrue(
                    cellStoreageResponse.ResponseCollection.Response[0].Url.Equals(this.DefaultFileUrl, StringComparison.CurrentCultureIgnoreCase),
                    "MS-FSSHTTP",
                    11272,
                    @"[In Appendix B: Product Behavior] [UseResourceID] Also when true and the ResourceID attribute is set on the Request element, the implementation does use the value of the ResourceID attribute to identify the file instead of the Url attribute. (Microsoft SharePoint Foundation 2010/Microsoft SharePoint Server 2010 and above follow this behavior.)");

                // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R11074
                Site.CaptureRequirementIfAreEqual <ErrorCodeType>(
                    ErrorCodeType.Success,
                    SharedTestSuiteHelper.ConvertToErrorCodeType(getVersionsSubResponse.ErrorCode, this.Site),
                    "MS-FSSHTTP",
                    11074,
                    @"[In MinorVersionNumberType][The value of MinorVersionNumberType] 3: In responses, indicates that the protocol server is capable of performing ResourceID specific behavior.");
            }
            else
            {
                Site.Assert.IsTrue(
                    cellStoreageResponse.ResponseCollection.Response[0].Url.Equals(this.DefaultFileUrl, StringComparison.CurrentCultureIgnoreCase),
                    "[In Appendix B: Product Behavior] [UseResourceID] Also when true and the ResourceID attribute is set on the Request element, the implementation does use the value of the ResourceID attribute to identify the file instead of the Url attribute. (Microsoft SharePoint Foundation 2010/Microsoft SharePoint Server 2010 and above follow this behavior.)");
                Site.Assert.AreEqual <ErrorCodeType>(
                    ErrorCodeType.Success,
                    SharedTestSuiteHelper.ConvertToErrorCodeType(getVersionsSubResponse.ErrorCode, this.Site),
                    @"[In MinorVersionNumberType][The value of MinorVersionNumberType] 3: In responses, indicates that the protocol server is capable of performing ResourceID specific behavior.");
            }
        }
コード例 #2
0
        public void TestCase_S09_TC02_GetVersions_Success_Results_ListId()
        {
            // Initialize the service
            this.InitializeContext(this.DefaultFileUrl, this.UserName01, this.Password01, this.Domain);

            // Get the GUID of expected list using SUT control Adapter method.
            string listName         = Common.GetConfigurationPropertyValue("MSFSSHTTPFSSHTTPBLibraryName", this.Site);
            string expectedListGuid = SutPowerShellAdapter.GetListGuidByName(listName);

            // Invoke "GetVersions"sub-request with correct input parameters.
            GetVersionsSubRequestType getVersionsSubRequest = SharedTestSuiteHelper.CreateGetVersionsSubRequest(SequenceNumberGenerator.GetCurrentToken());
            CellStorageResponse       cellStoreageResponse  = Adapter.CellStorageRequest(
                this.DefaultFileUrl,
                new SubRequestType[] { getVersionsSubRequest },
                "1", 2, 2, null, null, null, null, null, null, false);
            GetVersionsSubResponseType getVersionsSubResponse = SharedTestSuiteHelper.ExtractSubResponse <GetVersionsSubResponseType>(cellStoreageResponse, 0, 0, this.Site);

            this.Site.Assert.IsNotNull(getVersionsSubResponse, "The object 'getVersionsSubResponse' should not be null.");
            this.Site.Assert.IsNotNull(getVersionsSubResponse.ErrorCode, "The object 'getVersionsSubResponse.ErrorCode' should not be null.");

            if (SharedContext.Current.IsMsFsshttpRequirementsCaptured)
            {
                // Make sure the error code value in the response equals "Success"
                Site.Assert.AreEqual <ErrorCodeType>(
                    ErrorCodeType.Success,
                    SharedTestSuiteHelper.ConvertToErrorCodeType(getVersionsSubResponse.ErrorCode, this.Site),
                    @"The response of the ""getVersions"" sub-request on the file {0} should succeed.",
                    this.DefaultFileUrl);

                // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R2302
                Site.CaptureRequirementIfAreEqual <System.Guid>(
                    new System.Guid(expectedListGuid),
                    new System.Guid(getVersionsSubResponse.GetVersionsResponse.GetVersionsResult.results.list.id),
                    "MS-FSSHTTP",
                    2302,
                    @"[In GetVersionsSubResponseType][Results complex type] list.id: Specifies the GUID of the document library in which the file resides.");

                VersionType version = cellStoreageResponse.ResponseVersion as VersionType;

                // MinorVersion 3 indicates the protocol server is capable of performing ResourceID specific behavior.
                if (Common.IsRequirementEnabled(11276, this.Site) && version.MinorVersion == 3)
                {
                    // Capture the requirement MS-FSSHTTP_R11276
                    Site.CaptureRequirementIfIsNull(
                        cellStoreageResponse.ResponseCollection.Response[0].ResourceID,
                        "MS-FSSHTTP",
                        11276,
                        @"[In Appendix B: Product Behavior] The ResourceID attribute [MAY be present when the UseResourceID attribute is set to true in the corresponding Request element, and] is not present otherwise[when the UseResourceID attribute is set to false in the corresponding Request element]. (Microsoft SharePoint Foundation 2010/Microsoft SharePoint Server 2010 and above follow this behavior.)");
                }
            }
            else
            {
                Site.Assert.AreEqual <System.Guid>(
                    new System.Guid(expectedListGuid),
                    new System.Guid(getVersionsSubResponse.GetVersionsResponse.GetVersionsResult.results.list.id),
                    @"[In GetVersionsSubResponseType][Results complex type] list.id: Specifies the GUID of the document library in which the file resides.");
            }
        }
コード例 #3
0
        public void TestCase_S17_TC04_ResourceIdDoesNotExist()
        {
            string invalidUrl = this.DefaultFileUrl + "Invalid";

            // Initialize the service
            this.InitializeContext(this.DefaultFileUrl, this.UserName01, this.Password01, this.Domain);

            // Invoke "GetVersions"sub-request with correct invalid parameters.
            GetVersionsSubRequestType getVersionsSubRequest = SharedTestSuiteHelper.CreateGetVersionsSubRequest(SequenceNumberGenerator.GetCurrentToken());
            CellStorageResponse       cellStoreageResponse  = Adapter.CellStorageRequest(
                invalidUrl,
                new SubRequestType[] { getVersionsSubRequest },
                "1", 2, 2, null, null, null, null, null, "test", true);

            if (Common.IsRequirementEnabled(11023, this.Site))
            {
                GetVersionsSubResponseType getVersionsSubResponse = SharedTestSuiteHelper.ExtractSubResponse <GetVersionsSubResponseType>(cellStoreageResponse, 0, 0, this.Site);

                VersionType version = cellStoreageResponse.ResponseVersion as VersionType;
                Site.Assume.AreEqual <ushort>(3, version.MinorVersion, "This test case runs only when MinorVersion is 3 which indicates the protocol server is capable of performing ResourceID specific behavior.");

                if (SharedContext.Current.IsMsFsshttpRequirementsCaptured)
                {
                    // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R2171
                    Site.CaptureRequirementIfAreEqual <ErrorCodeType>(
                        ErrorCodeType.ResourceIdDoesNotExist,
                        SharedTestSuiteHelper.ConvertToErrorCodeType(getVersionsSubResponse.ErrorCode, this.Site),
                        "MS-FSSHTTP",
                        2171,
                        @"[In GenericErrorCodeTypes] InvalidArgument indicates an error when any of the cell storage service subrequests for the targeted URL for the file contains input parameters that are not valid.");

                    // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R11023
                    Site.CaptureRequirementIfAreEqual <ErrorCodeType>(
                        ErrorCodeType.ResourceIdDoesNotExist,
                        SharedTestSuiteHelper.ConvertToErrorCodeType(getVersionsSubResponse.ErrorCode, this.Site),
                        "MS-FSSHTTP",
                        11023,
                        @"[In Request] [UseResourceID]In the case where the protocol server is using the ResourceID attribute but the ResourceID attribute does not identify a valid file the protocol server SHOULD set an error code in the ErrorCode attribute of the corresponding Response attribute.");
                }
                else
                {
                    Site.Assert.AreEqual <ErrorCodeType>(
                        ErrorCodeType.ResourceIdDoesNotExist,
                        SharedTestSuiteHelper.ConvertToErrorCodeType(getVersionsSubResponse.ErrorCode, this.Site),
                        @"[In GenericErrorCodeTypes] InvalidArgument indicates an error when any of the cell storage service subrequests for the targeted URL for the file contains input parameters that are not valid.");
                }
            }
        }
コード例 #4
0
        public void TestCase_S09_TC03_GetVersions_Success_Results_VersioningDiabled()
        {
            // Initialize the service
            this.InitializeContext(this.DefaultFileUrl, this.UserName01, this.Password01, this.Domain);

            string documentLibraryName = Common.GetConfigurationPropertyValue("MSFSSHTTPFSSHTTPBLibraryName", this.Site);

            if (!SutPowerShellAdapter.SwitchMajorVersioning(documentLibraryName, false))
            {
                this.Site.Assert.Fail("Cannot disable the version on the document library {0}", documentLibraryName);
            }

            this.StatusManager.RecordDisableVersioning(documentLibraryName);

            // Invoke GetVersions sub-request with the file URL that under a document list whose versioning is disabled.
            GetVersionsSubRequestType  getVersionsSubRequest  = SharedTestSuiteHelper.CreateGetVersionsSubRequest(SequenceNumberGenerator.GetCurrentToken());
            CellStorageResponse        cellStoreageResponse   = Adapter.CellStorageRequest(this.DefaultFileUrl, new SubRequestType[] { getVersionsSubRequest });
            GetVersionsSubResponseType getVersionsSubResponse = SharedTestSuiteHelper.ExtractSubResponse <GetVersionsSubResponseType>(cellStoreageResponse, 0, 0, this.Site);

            this.Site.Assert.IsNotNull(getVersionsSubResponse, "The object 'getVersionsSubResponse' should not be null.");
            this.Site.Assert.IsNotNull(getVersionsSubResponse.ErrorCode, "The object 'getVersionsSubResponse.ErrorCode' should not be null.");

            if (SharedContext.Current.IsMsFsshttpRequirementsCaptured)
            {
                // Make sure the error code value in the response equals "Success".
                Site.Assert.AreEqual <ErrorCodeType>(
                    ErrorCodeType.Success,
                    SharedTestSuiteHelper.ConvertToErrorCodeType(getVersionsSubResponse.ErrorCode, this.Site),
                    @"The response of the ""getVersions"" sub-request on the file {0} should succeed.",
                    this.DefaultFileUrl);

                // If the value of "versioning enabled" is 0 under "results" element in the sub-response, then capture MS-FSSHTTP_R2304.
                Site.CaptureRequirementIfAreEqual <byte>(
                    0,
                    getVersionsSubResponse.GetVersionsResponse.GetVersionsResult.results.versioning.enabled,
                    "MS-FSSHTTP",
                    2304,
                    @"[In GetVersionsSubResponseType][Results complex type] versioning.enabled: A value of ""0"" indicates that versioning is disabled.");
            }
            else
            {
                Site.Assert.AreEqual <byte>(
                    0,
                    getVersionsSubResponse.GetVersionsResponse.GetVersionsResult.results.versioning.enabled,
                    @"[In GetVersionsSubResponseType][Results complex type] versioning.enabled: A value of ""0"" indicates that versioning is disabled.");
            }
        }
コード例 #5
0
        public void TestCase_S09_TC02_GetVersions_Success_Results_ListId()
        {
            // Initialize the service
            this.InitializeContext(this.DefaultFileUrl, this.UserName01, this.Password01, this.Domain);

            // Get the GUID of expected list using SUT control Adapter method.
            string listName         = Common.GetConfigurationPropertyValue("MSFSSHTTPFSSHTTPBLibraryName", this.Site);
            string expectedListGuid = SutPowerShellAdapter.GetListGuidByName(listName);

            // Invoke "GetVersions"sub-request with correct input parameters.
            GetVersionsSubRequestType  getVersionsSubRequest  = SharedTestSuiteHelper.CreateGetVersionsSubRequest(SequenceNumberGenerator.GetCurrentToken());
            CellStorageResponse        cellStoreageResponse   = Adapter.CellStorageRequest(this.DefaultFileUrl, new SubRequestType[] { getVersionsSubRequest });
            GetVersionsSubResponseType getVersionsSubResponse = SharedTestSuiteHelper.ExtractSubResponse <GetVersionsSubResponseType>(cellStoreageResponse, 0, 0, this.Site);

            this.Site.Assert.IsNotNull(getVersionsSubResponse, "The object 'getVersionsSubResponse' should not be null.");
            this.Site.Assert.IsNotNull(getVersionsSubResponse.ErrorCode, "The object 'getVersionsSubResponse.ErrorCode' should not be null.");

            if (SharedContext.Current.IsMsFsshttpRequirementsCaptured)
            {
                // Make sure the error code value in the response equals "Success"
                Site.Assert.AreEqual <ErrorCodeType>(
                    ErrorCodeType.Success,
                    SharedTestSuiteHelper.ConvertToErrorCodeType(getVersionsSubResponse.ErrorCode, this.Site),
                    @"The response of the ""getVersions"" sub-request on the file {0} should succeed.",
                    this.DefaultFileUrl);

                // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R2302
                Site.CaptureRequirementIfAreEqual <System.Guid>(
                    new System.Guid(expectedListGuid),
                    new System.Guid(getVersionsSubResponse.GetVersionsResponse.GetVersionsResult.results.list.id),
                    "MS-FSSHTTP",
                    2302,
                    @"[In GetVersionsSubResponseType][Results complex type] list.id: Specifies the GUID of the document library in which the file resides.");
            }
            else
            {
                Site.Assert.AreEqual <System.Guid>(
                    new System.Guid(expectedListGuid),
                    new System.Guid(getVersionsSubResponse.GetVersionsResponse.GetVersionsResult.results.list.id),
                    @"[In GetVersionsSubResponseType][Results complex type] list.id: Specifies the GUID of the document library in which the file resides.");
            }
        }
コード例 #6
0
        public void TestCase_S09_TC01_GetVersions_Success()
        {
            // Initialize the service
            this.InitializeContext(this.DefaultFileUrl, this.UserName01, this.Password01, this.Domain);

            // Invoke "GetVersions"sub-request with correct input parameters.
            GetVersionsSubRequestType  getVersionsSubRequest  = SharedTestSuiteHelper.CreateGetVersionsSubRequest(SequenceNumberGenerator.GetCurrentToken());
            CellStorageResponse        cellStoreageResponse   = Adapter.CellStorageRequest(this.DefaultFileUrl, new SubRequestType[] { getVersionsSubRequest });
            GetVersionsSubResponseType getVersionsSubResponse = SharedTestSuiteHelper.ExtractSubResponse <GetVersionsSubResponseType>(cellStoreageResponse, 0, 0, this.Site);

            this.Site.Assert.IsNotNull(getVersionsSubResponse, "The object 'getVersionsSubResponse' should not be null.");
            this.Site.Assert.IsNotNull(getVersionsSubResponse.ErrorCode, "The object 'getVersionsSubResponse.ErrorCode' should not be null.");

            if (SharedContext.Current.IsMsFsshttpRequirementsCaptured)
            {
                // If the value of attribute "ErrorCode" in the sub-response equals "Success", then capture MS-FSSHTTP_R2029.
                Site.CaptureRequirementIfAreEqual <ErrorCodeType>(
                    ErrorCodeType.Success,
                    SharedTestSuiteHelper.ConvertToErrorCodeType(getVersionsSubResponse.ErrorCode, this.Site),
                    "MS-FSSHTTP",
                    2029,
                    @"[In GetVersions Subrequest][The protocol returns results based on the following conditions:] 
                         Otherwise[the processing of the GetVersions subrequest by the protocol server get the requested versions information successfully], the protocol server sets the error code value to ""Success"" to indicate success in processing the GetVersions subrequest.");

                // Capture the requirement MS-FSSHTTP_R10004
                Site.CaptureRequirement(
                    "MS-FSSHTTP",
                    10004,
                    @"[In Appendix B: Product Behavior] Implementation does support this operation[GetVersions]. (Microsoft SharePoint Foundation 2013/Microsoft SharePoint Server 2013 follow this behavior.)");
            }
            else
            {
                Site.Assert.AreEqual <ErrorCodeType>(
                    ErrorCodeType.Success,
                    SharedTestSuiteHelper.ConvertToErrorCodeType(getVersionsSubResponse.ErrorCode, this.Site),
                    @"[In GetVersions Subrequest][The protocol returns results based on the following conditions:] 
                            Otherwise[the processing of the GetVersions subrequest by the protocol server get the requested versions information successfully], the protocol server sets the error code value to ""Success"" to indicate success in processing the GetVersions subrequest.");
            }
        }
コード例 #7
0
        /// <summary>
        /// Capture requirements related to GetVersions sub response.
        /// </summary>
        /// <param name="getVersionsSubResponse">Containing the getVersionsSubResponse information.</param>
        /// <param name="site">An object provides logging, assertions, and SUT adapters for test code onto its execution context.</param>
        public static void ValidateGetVersionsSubResponse(GetVersionsSubResponseType getVersionsSubResponse, ITestSite site)
        {
            ValidateSubResponseType(getVersionsSubResponse as SubResponseType, site);

            // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R4694
            // if can launch this method, the schema matches
            site.CaptureRequirementIfAreEqual <Type>(
                typeof(GetVersionsSubResponseType),
                getVersionsSubResponse.GetType(),
                "MS-FSSHTTP",
                4695,
                @"[In SubResponseElementGenericType] Depending on the Type attribute specified in the SubRequest element, the SubResponseElementGenericType MUST take one of the forms: GetVersionsSubResponseType.");

            // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R1816
            // if can launch this method, the GetVersionsSubResponseType schema matches.
            site.CaptureRequirement(
                "MS-FSSHTTP",
                1816,
                @"[In GetVersionsSubResponseType][The schema of GetVersionsSubResponseType is] <xs:complexType name=""GetVersionsSubResponseType"">
                       <xs:complexContent>
                         <xs:extension base=""tns:SubResponseType"">
                           <xs:sequence minOccurs=""0"" maxOccurs=""1"">
                              <xs:element ref=""tns:GetVersionsResponse""/>
                           </xs:sequence>
                         </xs:extension>
                       </xs:complexContent>
                     </xs:complexType>");

            // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R2020
            // if can launch this method, the GetVersionsSubResponseType schema matches.
            site.CaptureRequirementIfAreEqual <Type>(
                typeof(GetVersionsSubResponseType),
                getVersionsSubResponse.GetType(),
                "MS-FSSHTTP",
                2020,
                @"[In GetVersions Subrequest][The protocol client sends a GetVersions SubRequest message, which is of type GetVersionsSubRequestType] The protocol server responds with a GetVersions SubResponse message, which is of type GetVersionsSubResponseType as specified in section 2.3.1.32.");

            // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R2026
            // if can launch this method, the GetVersionsSubResponseType schema matches.
            site.CaptureRequirement(
                "MS-FSSHTTP",
                2026,
                @"[In GetVersions Subrequest] The Results element, as specified in [MS-VERSS] section 2.2.4.1, is a complex type that specifies information about the file's versions.");

            // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R2301
            // If isSchemaValid is true, the GetVersionsSubResponseType schema matches.
            site.CaptureRequirement(
                "MS-FSSHTTP",
                2301,
                @"[In GetVersionsSubResponseType][In Results] The DeleteAllVersions, DeleteVersion, GetVersions, and RestoreVersion methods return the Results complex type.
                     <s:complexType name=""Results"">
                       <s:sequence>
                         <s:element name=""list"" maxOccurs=""1"" minOccurs=""1"">
                           <s:complexType>
                             <s:attribute name=""id"" type=""s:string"" use=""required"" />
                           </s:complexType>
                         </s:element>
                         <s:element name=""versioning"" maxOccurs=""1"" minOccurs=""1"">
                           <s:complexType>
                             <s:attribute name=""enabled"" type=""s:unsignedByte"" use=""required"" />
                           </s:complexType>
                         </s:element>
                         <s:element name=""settings"" maxOccurs=""1"" minOccurs=""1"">
                           <s:complexType>
                             <s:attribute name=""url"" type=""s:string"" use=""required"" />
                           </s:complexType>
                         </s:element>
                         <s:element name=""result"" maxOccurs=""unbounded"" minOccurs=""1"" type=""tns:VersionData""/>
                       </s:sequence>
                     </s:complexType>");

            if (getVersionsSubResponse.GetVersionsResponse != null)
            {
                // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R2303
                // Add the log information.
                site.Log.Add(LogEntryKind.Debug, "For requirement MS-FSSHTTP_R2303, the versioning.enabled MUST be '0' or '1', the versioning.enabled value is : {0}", getVersionsSubResponse.GetVersionsResponse.GetVersionsResult.results.versioning.enabled.ToString());

                // if can launch this method and the versioning.enabled schema matches and value must be 0 or 1.
                bool isVerifyR2303 = getVersionsSubResponse.GetVersionsResponse.GetVersionsResult.results.versioning.enabled == 0 || getVersionsSubResponse.GetVersionsResponse.GetVersionsResult.results.versioning.enabled == 1;
                site.CaptureRequirementIfIsTrue(
                    isVerifyR2303,
                    "MS-FSSHTTP",
                    2303,
                    @"[In GetVersionsSubResponseType][Results complex type] versioning.enabled: The value of this attribute [versioning.enabled] MUST be ""0"" or ""1"".");

                // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R2308
                // if can launch this method, the versioning.enabled schema matches.
                site.CaptureRequirement(
                    "MS-FSSHTTP",
                    2308,
                    @"[In GetVersionsSubResponseType][In VersionData] The VersionData complex type specifies the details about a single version of a file.
                     <s:complexType name=""VersionData"">
                       <s:attribute name=""version"" type=""s:string"" use=""required"" />
                       <s:attribute name=""url"" type=""s:string"" use=""required"" />
                       <s:attribute name=""created"" type=""s:string"" use=""required"" />
                       <s:attribute name=""createdRaw"" type=""s:string"" use=""required"" />  
                       <s:attribute name=""createdBy"" type=""s:string"" use=""required"" />
                       <s:attribute name=""createdByName"" type=""s:string"" use=""optional"" />
                       <s:attribute name=""size"" type=""s:unsignedLong"" use=""required"" />
                       <s:attribute name=""comments"" type=""s:string"" use=""required"" />
                     </s:complexType>");

                // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R3083
                // if can launch this method, the versioning.enabled schema matches.
                site.CaptureRequirement(
                    "MS-FSSHTTP",
                    3083,
                    @"[In GetVersionsResponse][The schema of GetVersionsResponse element is defined as:] 
                     <s:element name=""GetVersionsResponse"">
                       <s:complexType>
                         <s:sequence>
                           <s:element minOccurs=""1"" maxOccurs=""1"" name=""GetVersionsResult"">
                             <s:complexType>
                               <s:sequence>
                                 <s:element name=""results"" minOccurs=""1"" maxOccurs=""1"" type=""tns:Results"" />
                               </s:sequence>
                             </s:complexType>
                           </s:element>
                         </s:sequence>
                       </s:complexType>
                     </s:element>");

                // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R3084
                // if can launch this method, the versioning.enabled schema matches.
                site.CaptureRequirement(
                    "MS-FSSHTTP",
                    3084,
                    @"[In GetVersionsResponse] GetVersionsResult: An XML node that conforms to the structure specified in section 2.2.4.1. ");

                // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R2306
                // if can launch this method, the versioning.enabled schema matches.
                site.CaptureRequirement(
                    "MS-FSSHTTP",
                    2306,
                    @"[In GetVersionsSubResponseType][Results complex type] settings.url: Specifies the URL to the webpage of versioning-related settings for the document library in which the file resides. ");

                // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R60101
                // if can launch this method, the versioning.enabled schema matches.
                site.CaptureRequirement(
                    "MS-FSSHTTP",
                    60101,
                    @"[In GetVersionsSubResponseType][VersionData] Implementation does contain the version of the file, including the major version and minor version numbers connected by period, for example, ""1.0"". (Microsoft SharePoint Foundation 2010/Microsoft SharePoint Server 2010 and above follow this behavior.)");
            }
        }
コード例 #8
0
        public void TestCase_S09_TC05_GetVersions_Success_Results_VersionData()
        {
            string documentLibraryName = Common.GetConfigurationPropertyValue("MSFSSHTTPFSSHTTPBLibraryName", this.Site);

            if (!SutPowerShellAdapter.SwitchMajorVersioning(documentLibraryName, true))
            {
                this.Site.Assert.Fail("Cannot disable the version on the document library {0}", documentLibraryName);
            }

            // Prepare a file.
            string fileUrl = this.PrepareFile();

            // Initialize the context
            this.InitializeContext(fileUrl, this.UserName01, this.Password01, this.Domain);

            // Check out one file by a specified user name.
            if (!this.SutPowerShellAdapter.CheckOutFile(fileUrl, this.UserName01, this.Password01, this.Domain))
            {
                this.Site.Assert.Fail("Cannot change the file {0} to check out status using the user name {1} and password {2}", fileUrl, this.UserName01, this.Password01);
            }

            this.StatusManager.RecordFileCheckOut(fileUrl, this.UserName01, this.Password01, this.Domain);

            string checkInComments1 = "New Comment1 for testing purpose on the operation GetVersions.";

            if (!SutPowerShellAdapter.CheckInFile(fileUrl, this.UserName01, this.Password01, this.Domain, checkInComments1))
            {
                this.Site.Assert.Fail("Cannot change the file {0} to check in status using the user name {1} and password {2}", fileUrl, this.UserName01, this.Password01);
            }

            this.StatusManager.CancelRecordCheckOut(fileUrl);

            // Check out one file by a specified user name again.
            if (!this.SutPowerShellAdapter.CheckOutFile(fileUrl, this.UserName02, this.Password02, this.Domain))
            {
                this.Site.Assert.Fail("Cannot change the file {0} to check out status using the user name {1} and password {2}", fileUrl, this.UserName02, this.Password02);
            }

            this.StatusManager.RecordFileCheckOut(fileUrl, this.UserName02, this.Password02, this.Domain);

            string checkInComments2 = "New Comment2 for testing purpose on the operation GetVersions.";

            if (!SutPowerShellAdapter.CheckInFile(fileUrl, this.UserName02, this.Password02, this.Domain, checkInComments2))
            {
                this.Site.Assert.Fail("Cannot change the file {0} to check in status using the user name {1} and password {2}", fileUrl, this.UserName02, this.Password02);
            }

            this.StatusManager.CancelRecordCheckOut(fileUrl);

            // Query changes from the protocol server
            CellSubRequestType  queryChange      = SharedTestSuiteHelper.CreateCellSubRequestEmbeddedQueryChanges(SequenceNumberGenerator.GetCurrentFSSHTTPBSubRequestID());
            CellStorageResponse queryResponse    = Adapter.CellStorageRequest(fileUrl, new SubRequestType[] { queryChange });
            CellSubResponseType querySubResponse = SharedTestSuiteHelper.ExtractSubResponse <CellSubResponseType>(queryResponse, 0, 0, this.Site);

            this.Site.Assert.AreEqual(ErrorCodeType.Success, SharedTestSuiteHelper.ConvertToErrorCodeType(querySubResponse.ErrorCode, this.Site), "The operation QueryChanges should succeed.");
            FsshttpbResponse fsshttpbResponse = SharedTestSuiteHelper.ExtractFsshttpbResponse(querySubResponse, this.Site);

            SharedTestSuiteHelper.ExpectMsfsshttpbSubResponseSucceed(fsshttpbResponse, this.Site);
            int contentLength = new RootNodeObject.RootNodeObjectBuilder().Build(
                fsshttpbResponse.DataElementPackage.DataElements,
                fsshttpbResponse.CellSubResponses[0].GetSubResponseData <QueryChangesSubResponseData>().StorageIndexExtendedGUID).GetContent().Count;

            // Invoke "GetVersions" sub-request with the test file URL that under a document list which is enable versioning.
            GetVersionsSubRequestType  getVersionsSubRequest  = SharedTestSuiteHelper.CreateGetVersionsSubRequest(SequenceNumberGenerator.GetCurrentToken());
            CellStorageResponse        cellStoreageResponse   = Adapter.CellStorageRequest(fileUrl, new SubRequestType[] { getVersionsSubRequest });
            GetVersionsSubResponseType getVersionsSubResponse = SharedTestSuiteHelper.ExtractSubResponse <GetVersionsSubResponseType>(cellStoreageResponse, 0, 0, this.Site);

            this.Site.Assert.IsNotNull(getVersionsSubResponse, "The object 'getVersionsSubResponse' should not be null.");
            this.Site.Assert.IsNotNull(getVersionsSubResponse.ErrorCode, "The object 'getVersionsSubResponse.ErrorCode' should not be null.");

            // Make sure the error code value in the response equals "Success"
            Site.Assert.AreEqual <ErrorCodeType>(
                ErrorCodeType.Success,
                SharedTestSuiteHelper.ConvertToErrorCodeType(getVersionsSubResponse.ErrorCode, this.Site),
                @"The response of the ""getVersions"" sub-request on the file {0} should succeed.",
                this.DefaultFileUrl);

            if (SharedContext.Current.IsMsFsshttpRequirementsCaptured)
            {
                // If the result contains 3 versions (1.the original, 2. User01 checked in, 3 User02 checked in), then the MS-FSSHTTP requirement: MS-FSSHTTP_R2307 is verified.
                Site.CaptureRequirementIfAreEqual <int>(
                    3,
                    getVersionsSubResponse.GetVersionsResponse.GetVersionsResult.results.result.Length,
                    "MS-FSSHTTP",
                    2307,
                    @"[In GetVersionsSubResponseType][Results complex type] result: A separate result element MUST exist for each version of the file that the user can access.");

                // If the result contains 3 versions (1.the original, 2. User01 checked in, 3 User02 checked in), then the MS-FSSHTTP requirement: MS-FSSHTTP_R30841 is verified.
                Site.CaptureRequirementIfAreEqual <int>(
                    3,
                    getVersionsSubResponse.GetVersionsResponse.GetVersionsResult.results.result.Length,
                    "MS-FSSHTTP",
                    30841,
                    @"[In GetVersionsResponse] GetVersionsResult: An XML node that contains the details about all the versions of the specified file that the user can access.");
            }
            else
            {
                Site.Assert.AreEqual <int>(
                    3,
                    getVersionsSubResponse.GetVersionsResponse.GetVersionsResult.results.result.Length,
                    @"[In GetVersionsSubResponseType][Results complex type] result: A separate result element MUST exist for each version of the file that the user can access.");
            }

            bool isFindVersion    = false;
            bool isNotStartWithAt = false;

            foreach (VersionData item in getVersionsSubResponse.GetVersionsResponse.GetVersionsResult.results.result)
            {
                if (string.Compare(checkInComments2, item.comments, StringComparison.OrdinalIgnoreCase) == 0)
                {
                    bool isCreatedBy = item.createdBy != null && item.createdBy.IndexOf(this.UserName02, System.StringComparison.OrdinalIgnoreCase) >= 0;
                    this.Site.Log.Add(
                        LogEntryKind.Debug,
                        "For requirement MS-FSSHTTP_R2312, expect the CreatedBy contains the user name {0}, the actual value is {1}",
                        this.UserName02,
                        item.createdBy);

                    if (SharedContext.Current.IsMsFsshttpRequirementsCaptured)
                    {
                        // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R2312
                        Site.CaptureRequirementIfIsTrue(
                            isCreatedBy,
                            "MS-FSSHTTP",
                            2312,
                            @"[In GetVersionsSubResponseType][VersionData complex type] createdBy: The creator of the version of the file.");

                        bool isCreatedByName = item.createdByName != null && item.createdByName.IndexOf(this.UserName02, System.StringComparison.OrdinalIgnoreCase) >= 0;
                        this.Site.Log.Add(
                            LogEntryKind.Debug,
                            "For requirement MS-FSSHTTP_R2313, expect the createdByName contains the user name {0}, the actual value is {1}",
                            this.UserName02,
                            item.createdByName);

                        // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R2313
                        Site.CaptureRequirementIfIsTrue(
                            isCreatedByName,
                            "MS-FSSHTTP",
                            2313,
                            @"[In GetVersionsSubResponseType][VersionData complex type] createdByName: The display name of the creator of the version of the file.");

                        bool isVersion = item.version != null && item.version.StartsWith("@", StringComparison.OrdinalIgnoreCase);
                        this.Site.Log.Add(
                            LogEntryKind.Debug,
                            "For requirement MS-FSSHTTP_R2309, expect the version start with @, the actual value is {0}",
                            item.version);

                        // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R2309
                        Site.CaptureRequirementIfIsTrue(
                            isVersion,
                            "MS-FSSHTTP",
                            2309,
                            @"[In GetVersionsSubResponseType][VersionData complex type] version: The most recent version of the file MUST be preceded with an at sign (@).");

                        // Using UNICODE, so the actual file size will double the length 5.
                        Site.CaptureRequirementIfAreEqual <ulong>(
                            (ulong)contentLength,
                            item.size,
                            "MS-FSSHTTP",
                            2314,
                            @"[In GetVersionsSubResponseType][VersionData complex type] size: The size, in bytes, of the version of the file.");

                        // If go through here, then the requirement MS-FSSHTTP_R2315 can be directly captured.
                        Site.CaptureRequirement(
                            "MS-FSSHTTP",
                            2315,
                            @"[In GetVersionsSubResponseType][VersionData complex type] comments: The comment entered when the version of the file was replaced on the protocol server during check in.");
                    }
                    else
                    {
                        Site.Assert.IsTrue(
                            isCreatedBy,
                            @"[In GetVersionsSubResponseType][VersionData complex type] createdBy: The creator of the version of the file.");

                        Site.Assert.IsNotNull(
                            item.createdRaw,
                            @"[In GetVersionsSubResponseType] Implementation does return this attribute[createdRaw]. [In VersionData] createdRaw: The creation date and time for the version of the file in DateTime format, as specified in [ISO-8601]. (Microsoft SharePoint Foundation 2010 and above follow this behavior.)");

                        bool isCreatedByName = item.createdByName != null && item.createdByName.IndexOf(this.UserName02, System.StringComparison.OrdinalIgnoreCase) >= 0;
                        Site.Assert.IsTrue(
                            isCreatedByName,
                            @"[In GetVersionsSubResponseType][VersionData complex type] createdByName: The display name of the creator of the version of the file.");

                        bool isVersion = item.version != null && item.version.StartsWith("@", StringComparison.OrdinalIgnoreCase);
                        Site.Assert.IsTrue(
                            isVersion,
                            @"[In GetVersionsSubResponseType][VersionData complex type] version: The most recent version of the file MUST be preceded with an at sign (@).");

                        Site.Assert.AreEqual <ulong>(
                            (ulong)contentLength,
                            item.size,
                            @"[In GetVersionsSubResponseType][VersionData complex type] size: The size, in bytes, of the version of the file.");
                    }

                    isFindVersion = true;
                }
                else
                {
                    isNotStartWithAt = !item.version.StartsWith("@", StringComparison.OrdinalIgnoreCase);
                }
            }

            if (!isFindVersion)
            {
                this.Site.Assert.Fail("Cannot find the Version record for the comment {0}", checkInComments2);
            }

            Site.Log.Add(
                LogEntryKind.Debug,
                "All the other versions MUST exist without any prefix, and actually they {0} have prefix.",
                isNotStartWithAt ? "do not" : "do");

            if (SharedContext.Current.IsMsFsshttpRequirementsCaptured)
            {
                // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R2310
                Site.CaptureRequirementIfIsTrue(
                    isNotStartWithAt,
                    "MS-FSSHTTP",
                    2310,
                    @"[In GetVersionsSubResponseType][VersionData complex type] version: All the other versions MUST exist without any prefix. ");
            }
            else
            {
                Site.Assert.IsTrue(
                    isNotStartWithAt,
                    @"[In GetVersionsSubResponseType][VersionData complex type] version: All the other versions MUST exist without any prefix. ");
            }
        }
コード例 #9
0
        public void TestCase_S17_TC03_ResourceIDNotChanged()
        {
            // Initialize the service
            this.InitializeContext(this.DefaultFileUrl, this.UserName01, this.Password01, this.Domain);

            // Invoke "GetVersions"sub-request with correct input parameters.
            GetVersionsSubRequestType getVersionsSubRequest = SharedTestSuiteHelper.CreateGetVersionsSubRequest(SequenceNumberGenerator.GetCurrentToken());
            CellStorageResponse       cellStoreageResponse  = Adapter.CellStorageRequest(
                this.DefaultFileUrl,
                new SubRequestType[] { getVersionsSubRequest },
                "1", 2, 2, null, null, null, null, null, null, true);
            GetVersionsSubResponseType getVersionsSubResponse = SharedTestSuiteHelper.ExtractSubResponse <GetVersionsSubResponseType>(cellStoreageResponse, 0, 0, this.Site);

            this.Site.Assert.AreEqual <ErrorCodeType>(
                ErrorCodeType.Success,
                SharedTestSuiteHelper.ConvertToErrorCodeType(getVersionsSubResponse.ErrorCode, this.Site),
                "GetVersions should be succeed.");

            VersionType version = cellStoreageResponse.ResponseVersion as VersionType;

            Site.Assume.AreEqual <ushort>(3, version.MinorVersion, "This test case runs only when MinorVersion is 3 which indicates the protocol server is capable of performing ResourceID specific behavior.");

            string resourceID = cellStoreageResponse.ResponseCollection.Response[0].ResourceID;

            // Rename the file
            string newName = Common.GenerateResourceName(this.Site, "fileName") + ".txt";
            FileOperationSubRequestType fileOperationSubRequest = SharedTestSuiteHelper.CreateFileOperationSubRequest(FileOperationRequestTypes.Rename, newName, null, this.Site);

            cellStoreageResponse = Adapter.CellStorageRequest(this.DefaultFileUrl, new SubRequestType[] { fileOperationSubRequest });
            FileOperationSubResponseType fileOperationSubResponse = SharedTestSuiteHelper.ExtractSubResponse <FileOperationSubResponseType>(cellStoreageResponse, 0, 0, this.Site);

            this.Site.Assert.AreEqual <ErrorCodeType>(
                ErrorCodeType.Success,
                SharedTestSuiteHelper.ConvertToErrorCodeType(getVersionsSubResponse.ErrorCode, this.Site),
                "Rename file should be succeed.");

            this.DefaultFileUrl  = this.DefaultFileUrl.Substring(0, this.DefaultFileUrl.LastIndexOf('/') + 1) + newName;
            cellStoreageResponse = Adapter.CellStorageRequest(
                this.DefaultFileUrl,
                new SubRequestType[] { getVersionsSubRequest },
                "1", 2, 2, null, null, null, null, null, null, true);
            getVersionsSubResponse = SharedTestSuiteHelper.ExtractSubResponse <GetVersionsSubResponseType>(cellStoreageResponse, 0, 0, this.Site);
            this.Site.Assert.AreEqual <ErrorCodeType>(
                ErrorCodeType.Success,
                SharedTestSuiteHelper.ConvertToErrorCodeType(getVersionsSubResponse.ErrorCode, this.Site),
                "GetVersions should be succeed.");

            string resourceID2 = cellStoreageResponse.ResponseCollection.Response[0].ResourceID;

            if (SharedContext.Current.IsMsFsshttpRequirementsCaptured)
            {
                // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R11026
                Site.CaptureRequirementIfAreEqual <string>(
                    resourceID,
                    resourceID2,
                    "MS-FSSHTTP",
                    11026,
                    @"[In Response] [ResourceID] A ResourceID MUST NOT change over the lifetime of a file, even if the URL of the file changes.");
            }
            else
            {
                Site.Assert.AreEqual <string>(
                    resourceID, resourceID2, "ResourceID MUST NOT change over the lifetime of a file, even if the URL of the file changes.");
            }
        }
コード例 #10
0
        public void TestCase_S09_TC01_GetVersions_Success()
        {
            // Initialize the service
            this.InitializeContext(this.DefaultFileUrl, this.UserName01, this.Password01, this.Domain);

            // Invoke "GetVersions"sub-request with correct input parameters.
            GetVersionsSubRequestType getVersionsSubRequest = SharedTestSuiteHelper.CreateGetVersionsSubRequest(SequenceNumberGenerator.GetCurrentToken());
            CellStorageResponse       cellStoreageResponse  = Adapter.CellStorageRequest(
                this.DefaultFileUrl,
                new SubRequestType[] { getVersionsSubRequest },
                "1", 2, 2, null, null, null, null, null, null, true);
            GetVersionsSubResponseType getVersionsSubResponse = SharedTestSuiteHelper.ExtractSubResponse <GetVersionsSubResponseType>(cellStoreageResponse, 0, 0, this.Site);

            this.Site.Assert.IsNotNull(getVersionsSubResponse, "The object 'getVersionsSubResponse' should not be null.");
            this.Site.Assert.IsNotNull(getVersionsSubResponse.ErrorCode, "The object 'getVersionsSubResponse.ErrorCode' should not be null.");

            if (SharedContext.Current.IsMsFsshttpRequirementsCaptured)
            {
                // If the value of attribute "ErrorCode" in the sub-response equals "Success", then capture MS-FSSHTTP_R2029.
                Site.CaptureRequirementIfAreEqual <ErrorCodeType>(
                    ErrorCodeType.Success,
                    SharedTestSuiteHelper.ConvertToErrorCodeType(getVersionsSubResponse.ErrorCode, this.Site),
                    "MS-FSSHTTP",
                    2029,
                    @"[In GetVersions Subrequest][The protocol returns results based on the following conditions:] 
                         Otherwise[the processing of the GetVersions subrequest by the protocol server get the requested versions information successfully], the protocol server sets the error code value to ""Success"" to indicate success in processing the GetVersions subrequest.");

                // Capture the requirement MS-FSSHTTP_R10004
                Site.CaptureRequirement(
                    "MS-FSSHTTP",
                    10004,
                    @"[In Appendix B: Product Behavior] Implementation does support this operation[GetVersions]. (Microsoft SharePoint Foundation 2013/Microsoft SharePoint Server 2013 and above follow this behavior.)");

                VersionType version = cellStoreageResponse.ResponseVersion as VersionType;

                // MinorVersion 3 indicates the protocol server is capable of performing ResourceID specific behavior.
                if (Common.IsRequirementEnabled(11275, this.Site) && version.MinorVersion == 3)
                {
                    // Capture the requirement MS-FSSHTTP_R11275
                    Site.CaptureRequirementIfIsNotNull(
                        cellStoreageResponse.ResponseCollection.Response[0].ResourceID,
                        "MS-FSSHTTP",
                        11275,
                        @"[In Appendix B: Product Behavior] The ResourceID attribute is present when the UseResourceID attribute is set to true in the corresponding Request element, [and SHOULD NOT be present otherwise]. (Microsoft SharePoint Foundation 2010/Microsoft SharePoint Server 2010 and above follow this behavior.)");

                    // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R11025
                    Site.CaptureRequirementIfIsNotNull(
                        cellStoreageResponse.ResponseCollection.Response[0].ResourceID,
                        "MS-FSSHTTP",
                        11025,
                        @"[In Response] ResourceID: A string that specifies the invariant ResourceID for a file, which uniquely identifies the file whose response is being generated.");

                    // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R11029
                    Site.CaptureRequirementIfIsTrue(
                        !string.IsNullOrEmpty(cellStoreageResponse.ResponseCollection.Response[0].ResourceID),
                        "MS-FSSHTTP",
                        11029,
                        @"[In Response] [ResourceID] If present, the string value MUST NOT be an empty string.");

                    // Capture the requirement MS-FSSHTTP_R11271
                    Site.CaptureRequirementIfIsNotNull(
                        cellStoreageResponse.ResponseCollection.Response[0].ResourceID,
                        "MS-FSSHTTP",
                        11271,
                        @"[In Appendix B: Product Behavior] [UseResourceID] When true, the implementation sets the ResourceID attribute on the corresponding Response element to the ResourceID of the file. (Microsoft SharePoint Foundation 2010/Microsoft SharePoint Server 2010 and above follow this behavior.)");
                }
            }
            else
            {
                Site.Assert.AreEqual <ErrorCodeType>(
                    ErrorCodeType.Success,
                    SharedTestSuiteHelper.ConvertToErrorCodeType(getVersionsSubResponse.ErrorCode, this.Site),
                    @"[In GetVersions Subrequest][The protocol returns results based on the following conditions:] 
                            Otherwise[the processing of the GetVersions subrequest by the protocol server get the requested versions information successfully], the protocol server sets the error code value to ""Success"" to indicate success in processing the GetVersions subrequest.");
            }
        }
コード例 #11
0
        public void TestCase_S16_TC03_Versioning_RestoreVersion_VersionNotFound()
        {
            string documentLibraryName = Common.GetConfigurationPropertyValue("MSFSSHTTPFSSHTTPBLibraryName", this.Site);

            if (!SutPowerShellAdapter.SwitchMajorVersioning(documentLibraryName, true))
            {
                this.Site.Assert.Fail("Cannot enable the version on the document library {0}", documentLibraryName);
            }

            // Initialize the service
            this.InitializeContext(this.DefaultFileUrl, this.UserName01, this.Password01, this.Domain);

            // Check out one file by a specified user name.
            if (!this.SutManagedAdapter.CheckOutFile(this.DefaultFileUrl, this.UserName01, this.Password01, this.Domain))
            {
                this.Site.Assert.Fail("Cannot change the file {0} to check out status using the user name {1} and password {2}", this.DefaultFileUrl, this.UserName01, this.Password01);
            }

            this.StatusManager.RecordFileCheckOut(this.DefaultFileUrl, this.UserName01, this.Password01, this.Domain);

            string checkInComments1 = "New Comment1 for testing purpose on the operation Versioning.";

            if (!SutManagedAdapter.CheckInFile(this.DefaultFileUrl, this.UserName01, this.Password01, this.Domain, checkInComments1))
            {
                this.Site.Assert.Fail("Cannot change the file {0} to check in status using the user name {1} and password {2}", this.DefaultFileUrl, this.UserName01, this.Password01);
            }

            this.StatusManager.CancelRecordCheckOut(this.DefaultFileUrl);

            GetVersionsSubRequestType  getVersionsSubRequest  = SharedTestSuiteHelper.CreateGetVersionsSubRequest(SequenceNumberGenerator.GetCurrentToken());
            CellStorageResponse        cellStoreageResponse   = Adapter.CellStorageRequest(this.DefaultFileUrl, new SubRequestType[] { getVersionsSubRequest });
            GetVersionsSubResponseType getVersionsSubResponse = SharedTestSuiteHelper.ExtractSubResponse <GetVersionsSubResponseType>(cellStoreageResponse, 0, 0, this.Site);

            VersioningSubRequestType versioningSubRequest = SharedTestSuiteHelper.CreateVersioningSubRequest(SequenceNumberGenerator.GetCurrentToken(), VersioningRequestTypes.RestoreVersion, "3.0", this.Site);

            cellStoreageResponse = Adapter.CellStorageRequest(
                this.DefaultFileUrl,
                new SubRequestType[] { versioningSubRequest });
            VersioningSubResponseType versioningSubResponse = SharedTestSuiteHelper.ExtractSubResponse <VersioningSubResponseType>(cellStoreageResponse, 0, 0, this.Site);

            this.Site.Assert.IsNotNull(versioningSubResponse, "The object 'versioningSubResponse' should not be null.");
            this.Site.Assert.IsNotNull(versioningSubResponse.ErrorCode, "The object 'versioningSubResponse.ErrorCode' should not be null.");

            if (SharedContext.Current.IsMsFsshttpRequirementsCaptured)
            {
                // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R11247
                Site.CaptureRequirementIfAreEqual <ErrorCodeType>(
                    ErrorCodeType.VersionNotFound,
                    SharedTestSuiteHelper.ConvertToErrorCodeType(versioningSubResponse.ErrorCode, this.Site),
                    "MS-FSSHTTP",
                    11247,
                    @"[In Versioning Subrequest] [The protocol returns results based on the following conditions:]If the protocol server gets a versioning subrequest of type ""Restore version"" and the restore fails because the version number specifies a non-existent version, the protocol server returns an error code value set to ""VersionNotFound"".");

                // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R11256
                Site.CaptureRequirementIfAreEqual <ErrorCodeType>(
                    ErrorCodeType.VersionNotFound,
                    SharedTestSuiteHelper.ConvertToErrorCodeType(versioningSubResponse.ErrorCode, this.Site),
                    "MS-FSSHTTP",
                    11256,
                    @"[In Restore Version] If the Version attribute specifies a version that doesn't exist, the protocol server returns an error status set to ""VersionNotFound"".");

                // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R11083
                Site.CaptureRequirementIfAreEqual <ErrorCodeType>(
                    ErrorCodeType.VersionNotFound,
                    SharedTestSuiteHelper.ConvertToErrorCodeType(versioningSubResponse.ErrorCode, this.Site),
                    "MS-FSSHTTP",
                    11083,
                    @"[In VersioningRelatedErrorCodeTypes] The value ""VersionNotFound"" indicates that the version number specified by the protocol client doesn’t match a version of the file on the protocol server.");
            }
            else
            {
                Site.Assert.AreEqual <ErrorCodeType>(
                    ErrorCodeType.VersionNotFound,
                    SharedTestSuiteHelper.ConvertToErrorCodeType(versioningSubResponse.ErrorCode, this.Site),
                    @"Error VersionNotFound should be returned if restore version with not found version.");
            }
        }
コード例 #12
0
        public void TestCase_S16_TC02_Versioning_RestoreVersion_Success()
        {
            string documentLibraryName = Common.GetConfigurationPropertyValue("MSFSSHTTPFSSHTTPBLibraryName", this.Site);

            if (!SutPowerShellAdapter.SwitchMajorVersioning(documentLibraryName, true))
            {
                this.Site.Assert.Fail("Cannot enable the version on the document library {0}", documentLibraryName);
            }

            // Initialize the service
            this.InitializeContext(this.DefaultFileUrl, this.UserName01, this.Password01, this.Domain);

            // Check out one file by a specified user name.
            if (!this.SutManagedAdapter.CheckOutFile(this.DefaultFileUrl, this.UserName01, this.Password01, this.Domain))
            {
                this.Site.Assert.Fail("Cannot change the file {0} to check out status using the user name {1} and password {2}", this.DefaultFileUrl, this.UserName01, this.Password01);
            }

            this.StatusManager.RecordFileCheckOut(this.DefaultFileUrl, this.UserName01, this.Password01, this.Domain);

            string checkInComments1 = "New Comment1 for testing purpose on the operation Versioning.";

            if (!SutManagedAdapter.CheckInFile(this.DefaultFileUrl, this.UserName01, this.Password01, this.Domain, checkInComments1))
            {
                this.Site.Assert.Fail("Cannot change the file {0} to check in status using the user name {1} and password {2}", this.DefaultFileUrl, this.UserName01, this.Password01);
            }

            this.StatusManager.CancelRecordCheckOut(this.DefaultFileUrl);

            GetVersionsSubRequestType  getVersionsSubRequest  = SharedTestSuiteHelper.CreateGetVersionsSubRequest(SequenceNumberGenerator.GetCurrentToken());
            CellStorageResponse        cellStoreageResponse   = Adapter.CellStorageRequest(this.DefaultFileUrl, new SubRequestType[] { getVersionsSubRequest });
            GetVersionsSubResponseType getVersionsSubResponse = SharedTestSuiteHelper.ExtractSubResponse <GetVersionsSubResponseType>(cellStoreageResponse, 0, 0, this.Site);

            VersioningSubRequestType versioningSubRequest = SharedTestSuiteHelper.CreateVersioningSubRequest(SequenceNumberGenerator.GetCurrentToken(), VersioningRequestTypes.RestoreVersion, "1.0", this.Site);

            cellStoreageResponse = Adapter.CellStorageRequest(
                this.DefaultFileUrl,
                new SubRequestType[] { versioningSubRequest });
            VersioningSubResponseType versioningSubResponse = SharedTestSuiteHelper.ExtractSubResponse <VersioningSubResponseType>(cellStoreageResponse, 0, 0, this.Site);

            this.Site.Assert.IsNotNull(versioningSubResponse, "The object 'versioningSubResponse' should not be null.");
            this.Site.Assert.IsNotNull(versioningSubResponse.ErrorCode, "The object 'versioningSubResponse.ErrorCode' should not be null.");

            if (SharedContext.Current.IsMsFsshttpRequirementsCaptured)
            {
                // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R11248
                Site.CaptureRequirementIfAreEqual <ErrorCodeType>(
                    ErrorCodeType.Success,
                    SharedTestSuiteHelper.ConvertToErrorCodeType(versioningSubResponse.ErrorCode, this.Site),
                    "MS-FSSHTTP",
                    11248,
                    @"[In Versioning Subrequest] [The protocol returns results based on the following conditions:]An ErrorCode value of ""Success"" indicates success in processing the versioning request.");

                // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R11254
                Site.CaptureRequirement(
                    "MS-FSSHTTP",
                    11254,
                    @"[In Restore Version] If the VersioningRequestType attribute is set to ""RestoreVersion"", the protocol server considers the versioning subrequest to be of type ""Restore Version"". ");

                // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R11255
                Site.CaptureRequirement(
                    "MS-FSSHTTP",
                    11255,
                    @"[In Restore Version] The protocol server processes this request by restoring the file to its state in the version specified by the Version attribute.");
            }
            else
            {
                Site.Assert.AreEqual <ErrorCodeType>(
                    ErrorCodeType.Success,
                    SharedTestSuiteHelper.ConvertToErrorCodeType(versioningSubResponse.ErrorCode, this.Site),
                    @"Restore version should succeed.");
            }
        }