コード例 #1
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.");
            }
        }
コード例 #2
0
        public void TestCase_S10_TC08_OnSuccessOrNotSupported_OnNotSupport()
        {
            if (!Common.IsRequirementEnabled("MS-FSSHTTP-FSSHTTPB", 337, this.Site))
            {
                Site.Assume.Inconclusive("Implementation does not return Success when its sub-request dependency type is OnSuccessOrNotSupported and the dependent subRequest is not supported");
            }

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

            // Disable the coauthoring feature.
            bool isSwitchedSuccessfully = SutPowerShellAdapter.SwitchCoauthoringFeature(true);

            this.Site.Assert.IsTrue(isSwitchedSuccessfully, "The Coauthoring Feature should be disabled.");
            this.StatusManager.RecordDisableCoauth();

            // create a coauthoring subRequest with all valid parameters.
            CoauthSubRequestType coauthSubRequest = SharedTestSuiteHelper.CreateCoauthSubRequestForJoinCoauthSession(SharedTestSuiteHelper.DefaultClientID, SharedTestSuiteHelper.ReservedSchemaLockID);

            // Create a serverTime subRequest with DependencyType set to "OnSuccessOrNotSupported", which depends on the coauthoring subRequest.
            ServerTimeSubRequestType serverTimeSubRequest = SharedTestSuiteHelper.CreateServerTimeSubRequest(SequenceNumberGenerator.GetCurrentToken());

            serverTimeSubRequest.DependencyType          = DependencyTypes.OnSuccessOrNotSupported;
            serverTimeSubRequest.DependencyTypeSpecified = true;
            serverTimeSubRequest.DependsOn = coauthSubRequest.SubRequestToken;

            // Send these two subRequests to the protocol server, expect the protocol server returns error code "Success" for the serverTimeSubRequest.
            CellStorageResponse   response          = this.Adapter.CellStorageRequest(this.DefaultFileUrl, new SubRequestType[] { coauthSubRequest, serverTimeSubRequest });
            CoauthSubResponseType coauthSubResponse = SharedTestSuiteHelper.ExtractSubResponse <CoauthSubResponseType>(response, 0, 0, this.Site);

            this.Site.Assert.AreNotEqual <ErrorCodeType>(ErrorCodeType.Success, SharedTestSuiteHelper.ConvertToErrorCodeType(coauthSubResponse.ErrorCode, this.Site), "The coauthoring operation should be failed.");
            ServerTimeSubResponseType serverTimeSubResponse = SharedTestSuiteHelper.ExtractSubResponse <ServerTimeSubResponseType>(response, 0, 1, this.Site);

            if (SharedContext.Current.IsMsFsshttpRequirementsCaptured)
            {
                // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R337
                Site.CaptureRequirementIfAreEqual <ErrorCodeType>(
                    ErrorCodeType.Success,
                    SharedTestSuiteHelper.ConvertToErrorCodeType(serverTimeSubResponse.ErrorCode, this.Site),
                    "MS-FSSHTTP",
                    337,
                    @"[In DependencyTypes] OnSuccessOrNotSupported: Indicates that the subrequest MUST be processed only when one of the following conditions is true:
                             If the other subrequest is not supported. (Microsoft SharePoint Foundation 2010/Microsoft SharePoint Server 2010 follow this behavior.)");
            }
            else
            {
                Site.Assert.AreEqual <ErrorCodeType>(
                    ErrorCodeType.Success,
                    SharedTestSuiteHelper.ConvertToErrorCodeType(serverTimeSubResponse.ErrorCode, this.Site),
                    @"[In DependencyTypes] OnSuccessOrNotSupported: Indicates that the subrequest MUST be processed only when one of the following conditions is true:
                    If the other subrequest is not supported. (Microsoft SharePoint Foundation 2010/Microsoft SharePoint Server 2010 follow this behavior.)");
            }
        }
        public void MSFSSHTTP_FSSHTTPB_TestCase_S19_TC01_LockStatus_ExclusiveLock()
        {
            // Initialize the service
            this.InitializeContext(this.DefaultFileUrl, this.UserName01, this.Password01, this.Domain);

            // Disable the Coauthoring Feature
            bool isSwitchedSuccessfully = SutPowerShellAdapter.SwitchCoauthoringFeature(true);

            this.Site.Assert.IsTrue(isSwitchedSuccessfully, "The Coauthoring Feature should be disabled.");
            this.StatusManager.RecordDisableCoauth();

            // Waiting change takes effect
            System.Threading.Thread.Sleep(30 * 1000);

            // Join a Coauthoring session
            CoauthSubRequestType  subRequest   = SharedTestSuiteHelper.CreateCoauthSubRequestForJoinCoauthSession(SharedTestSuiteHelper.DefaultClientID, SharedTestSuiteHelper.ReservedSchemaLockID, true, SharedTestSuiteHelper.DefaultExclusiveLockID);
            CellStorageResponse   cellResponse = this.Adapter.CellStorageRequest(this.DefaultFileUrl, new SubRequestType[] { subRequest });
            CoauthSubResponseType subResponse  = SharedTestSuiteHelper.ExtractSubResponse <CoauthSubResponseType>(cellResponse, 0, 0, this.Site);

            this.Site.Assert.AreEqual(
                ErrorCodeType.Success,
                SharedTestSuiteHelper.ConvertToErrorCodeType(subResponse.ErrorCode, this.Site),
                string.Format("Account {0} with client ID {1} and schema lock ID {2} should join the coauthoring session successfully.", this.UserName01, SharedTestSuiteHelper.DefaultClientID, SharedTestSuiteHelper.DefaultExclusiveLockID));
            this.StatusManager.RecordCoauthSession(this.DefaultFileUrl, SharedTestSuiteHelper.DefaultClientID, SharedTestSuiteHelper.DefaultExclusiveLockID);

            LockStatusSubRequestType lockStatus = SharedTestSuiteHelper.CreateLockStatusSubRequest();

            CellStorageResponse       response           = this.Adapter.CellStorageRequest(this.DefaultFileUrl, new SubRequestType[] { lockStatus });
            LockStatusSubResponseType lockStatusResponse = SharedTestSuiteHelper.ExtractSubResponse <LockStatusSubResponseType>(response, 0, 0, this.Site);
            SubResponseType           subresponse        = response.ResponseCollection.Response[0].SubResponse[0];

            if (SharedContext.Current.IsMsFsshttpRequirementsCaptured)
            {
                // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R404011
                Site.CaptureRequirementIfAreEqual <int>(
                    2,
                    int.Parse(lockStatusResponse.SubResponseData.LockType),
                    "MS-FSSHTTP",
                    404011,
                    @"[In LockTypes] 2: The integer value ""2"", indicating an exclusive lock on the file.");
            }
            else
            {
                Site.Assert.AreEqual <int>(
                    2,
                    int.Parse(lockStatusResponse.SubResponseData.LockType),
                    @"2: The integer value ""2"", indicating an exclusive lock on the file.");
            }
        }
コード例 #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_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. ");
            }
        }
コード例 #7
0
        public void MSFSSHTTP_FSSHTTPB_S03_TC04_GetLock_Success_ExclusiveLockReturnReason_CheckedOutByCurrentUser()
        {
            // Initialize the service
            this.InitializeContext(this.DefaultFileUrl, this.UserName01, this.Password01, this.Domain);

            // Check out one file by a specified user name.
            bool isCheckOutSuccess = SutPowerShellAdapter.CheckOutFile(this.DefaultFileUrl, this.UserName01, this.Password01, this.Domain);

            Site.Assert.AreEqual(true, isCheckOutSuccess, "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);

            if (Common.IsRequirementEnabled("MS-FSSHTTP-FSSHTTPB", 3086, this.Site))
            {
                // Change the authentication mode
                if (!this.SutPowerShellAdapter.SwitchClaimsAuthentication(false))
                {
                    this.Site.Assert.Fail("Cannot change the authentication mode to windows based.");
                }

                this.StatusManager.RecordDisableClaimsBasedAuthentication();
            }

            // Get a schema lock with AllowFallbackToExclusive set to true, expect the server returns the error code "Success".
            SchemaLockSubRequestType  subRequest            = SharedTestSuiteHelper.CreateSchemaLockSubRequest(SchemaLockRequestTypes.GetLock, true, null);
            CellStorageResponse       response              = Adapter.CellStorageRequest(this.DefaultFileUrl, new SubRequestType[] { subRequest });
            SchemaLockSubResponseType schemaLockSubResponse = SharedTestSuiteHelper.ExtractSubResponse <SchemaLockSubResponseType>(response, 0, 0, this.Site);

            this.Site.Assert.AreEqual <ErrorCodeType>(ErrorCodeType.Success, SharedTestSuiteHelper.ConvertToErrorCodeType(schemaLockSubResponse.ErrorCode, this.Site), "The test case cannot continue unless the server responses Success when the user get a schema lock with AllowFallBack attribute true on an already checked out file by the same account.");
            this.StatusManager.RecordExclusiveLock(this.DefaultFileUrl, subRequest.SubRequestData.ExclusiveLockID);

            #region Verify related requirements

            if (SharedContext.Current.IsMsFsshttpRequirementsCaptured)
            {
                // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R404
                Site.CaptureRequirementIfAreEqual <LockTypes>(
                    LockTypes.ExclusiveLock,
                    schemaLockSubResponse.SubResponseData.LockType,
                    "MS-FSSHTTP",
                    404,
                    @"[In LockTypes] ExclusiveLock: The string value ""ExclusiveLock"", indicating an exclusive lock on the file.");

                // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R406
                Site.CaptureRequirementIfAreEqual <LockTypes>(
                    LockTypes.ExclusiveLock,
                    schemaLockSubResponse.SubResponseData.LockType,
                    "MS-FSSHTTP",
                    406,
                    @"[In LockTypes][ExclusiveLock] In a cell storage service response message, an exclusive lock indicates that an exclusive lock is granted to the current client for that specific file.");

                // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R1428
                this.Site.Log.Add(
                    LogEntryKind.Debug,
                    "For MS-FSSHTTP_R1428 and MS-FSSHTTP_R717, the ExclusiveLockReturnReason attribute in the response should be specified, actually it is {0}.",
                    schemaLockSubResponse.SubResponseData.ExclusiveLockReturnReasonSpecified ? "specified" : "not specified");

                Site.CaptureRequirementIfIsTrue(
                    schemaLockSubResponse.SubResponseData.ExclusiveLockReturnReasonSpecified,
                    "MS-FSSHTTP",
                    1428,
                    @"[In SubResponseDataOptionalAttributes][ExclusiveLockReturnReason] The ExclusiveLockReturnReason attribute MUST be specified in a subresponse that is generated in response to one of the following types of cell storage service subrequest operations when the LockType attribute in the subresponse is set to ""ExclusiveLock"": A schema lock subrequest of type ""Get lock"".");

                // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R717
                Site.CaptureRequirementIfIsTrue(
                    schemaLockSubResponse.SubResponseData.ExclusiveLockReturnReasonSpecified,
                    "MS-FSSHTTP",
                    717,
                    @"[In SchemaLockSubResponseDataType] The ExclusiveLockReturnReason attribute MUST be specified in a schema lock subresponse that is generated in response to a schema lock subrequest of type ""Get lock"" when the LockType attribute in the subresponse is set to ""ExclusiveLock"".");

                // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R715
                Site.CaptureRequirementIfAreEqual <ExclusiveLockReturnReasonTypes>(
                    ExclusiveLockReturnReasonTypes.CheckedOutByCurrentUser,
                    schemaLockSubResponse.SubResponseData.ExclusiveLockReturnReason,
                    "MS-FSSHTTP",
                    715,
                    @"[In SchemaLockSubResponseDataType] ExclusiveLockReturnReason: An ExclusiveLockReturnReasonTypes that specifies the reason why an exclusive lock is granted in a schema lock subresponse.");

                // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R350
                Site.CaptureRequirementIfAreEqual <ExclusiveLockReturnReasonTypes>(
                    ExclusiveLockReturnReasonTypes.CheckedOutByCurrentUser,
                    schemaLockSubResponse.SubResponseData.ExclusiveLockReturnReason,
                    "MS-FSSHTTP",
                    350,
                    @"[In ExclusiveLockReturnReasonTypes] CheckedOutByCurrentUser: The string value ""CheckedOutByCurrentUser"", indicating that an exclusive lock is granted on the file because the file is checked out by the current user who sent the cell storage service request message.");
            }
            else
            {
                Site.Assert.AreEqual <LockTypes>(
                    LockTypes.ExclusiveLock,
                    schemaLockSubResponse.SubResponseData.LockType,
                    @"[In LockTypes] ExclusiveLock: The string value ""ExclusiveLock"", indicating an exclusive lock on the file.");

                Site.Assert.IsTrue(
                    schemaLockSubResponse.SubResponseData.ExclusiveLockReturnReasonSpecified,
                    @"[In SubResponseDataOptionalAttributes][ExclusiveLockReturnReason] The ExclusiveLockReturnReason attribute MUST be specified in a subresponse that is generated in response to one of the following types of cell storage service subrequest operations when the LockType attribute in the subresponse is set to ""ExclusiveLock"": A schema lock subrequest of type ""Get lock"".");

                Site.Assert.AreEqual <ExclusiveLockReturnReasonTypes>(
                    ExclusiveLockReturnReasonTypes.CheckedOutByCurrentUser,
                    schemaLockSubResponse.SubResponseData.ExclusiveLockReturnReason,
                    @"[In SchemaLockSubResponseDataType] ExclusiveLockReturnReason: An ExclusiveLockReturnReasonTypes that specifies the reason why an exclusive lock is granted in a schema lock subresponse.");
            }

            #endregion
        }
コード例 #8
0
        public void MSFSSHTTP_FSSHTTPB_S05_TC01_WhoAmI_ClaimsBased()
        {
            // Initialize the service
            this.InitializeContext(this.DefaultFileUrl, this.UserName01, this.Password01, this.Domain);

            if (Common.IsRequirementEnabled("MS-FSSHTTP-FSSHTTPB", 3086, this.Site))
            {
                // Enable the windows-based authentication
                bool isSwitchedSuccessfully = SutPowerShellAdapter.SwitchClaimsAuthentication(false);
                this.Site.Assert.IsTrue(isSwitchedSuccessfully, "The windows-based authentication should be enabled successfully.");
                this.StatusManager.RecordDisableClaimsBasedAuthentication();
            }

            int waitTime   = Common.GetConfigurationPropertyValue <int>("WaitTime", this.Site);
            int retryCount = Common.GetConfigurationPropertyValue <int>("RetryCount", this.Site);

            WhoAmISubRequestType  subRequest  = null;
            CellStorageResponse   response    = null;
            WhoAmISubResponseType subResponse = null;

            while (retryCount > 0)
            {
                // Create a WhoAmI subRequest with all valid parameters
                subRequest  = SharedTestSuiteHelper.CreateWhoAmISubRequest(SequenceNumberGenerator.GetCurrentToken());
                response    = Adapter.CellStorageRequest(this.DefaultFileUrl, new SubRequestType[] { subRequest });
                subResponse = SharedTestSuiteHelper.ExtractSubResponse <WhoAmISubResponseType>(response, 0, 0, this.Site);
                Site.Assert.AreEqual <ErrorCodeType>(ErrorCodeType.Success, SharedTestSuiteHelper.ConvertToErrorCodeType(subResponse.ErrorCode, this.Site), "WhoAmI subRequest should be succeed.");

                Regex regex = new Regex(@"^[a-zA-Z]([a-zA-Z0-9\-_])*\\[a-zA-Z]([a-zA-Z0-9])*");
                if (regex.IsMatch(subResponse.SubResponseData.UserLogin))
                {
                    break;
                }

                retryCount--;
                if (retryCount == 0)
                {
                    Site.Assert.Fail("Additional authentication prefix should not exist in UserLogin if claim-based authentication mode is enabled");
                }

                System.Threading.Thread.Sleep(waitTime);
            }

            if (SharedContext.Current.IsMsFsshttpRequirementsCaptured)
            {
                // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R3087
                Regex regex           = new Regex(@"^[a-zA-Z]([a-zA-Z0-9\-_])*\\[a-zA-Z]([a-zA-Z0-9])*");
                bool  isVerifiedR3087 = regex.IsMatch(subResponse.SubResponseData.UserLogin);

                Site.Log.Add(
                    LogEntryKind.Debug,
                    @"The UserLoginType will match pattern ^[a-zA-Z]([a-zA-Z0-9\-_])*\\[a-zA-Z]([a-zA-Z0-9])*, actually its value is {0}",
                    subResponse.SubResponseData.UserLogin);

                this.Site.CaptureRequirementIfIsTrue(
                    isVerifiedR3087,
                    "MS-FSSHTTP",
                    3087,
                    @"[In Appendix B: Product Behavior] If claims-based authentication mode isn't enabled, the implementation does return the UserLogin attribute which apply the following schema:
                              <xs:simpleType name=""UserLoginType"">
                                 <xs:restriction base=""xs:string"">
                                    <xs:pattern value=""^[a-zA-Z]([a-zA-Z0-9\-_])*\\[a-zA-Z]([a-zA-Z0-9])*""/>
                                 </xs:restriction>
                              </xs:simpleType>");
            }

            // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R3086
            if (Common.IsRequirementEnabled("MS-FSSHTTP-FSSHTTPB", 3086, this.Site))
            {
                // Enable the claims-based authentication
                bool isSwitchedSuccessfully = SutPowerShellAdapter.SwitchClaimsAuthentication(true);
                this.Site.Assert.IsTrue(isSwitchedSuccessfully, "The claims-based authentication should be enabled successfully.");

                waitTime   = Common.GetConfigurationPropertyValue <int>("WaitTime", this.Site);
                retryCount = Common.GetConfigurationPropertyValue <int>("RetryCount", this.Site);

                while (retryCount > 0)
                {
                    // Send the WhoAmI subRequest to the protocol server
                    response    = Adapter.CellStorageRequest(this.DefaultFileUrl, new SubRequestType[] { subRequest });
                    subResponse = SharedTestSuiteHelper.ExtractSubResponse <WhoAmISubResponseType>(response, 0, 0, this.Site);
                    Site.Assert.AreEqual <ErrorCodeType>(ErrorCodeType.Success, SharedTestSuiteHelper.ConvertToErrorCodeType(subResponse.ErrorCode, this.Site), "WhoAmI subRequest should be succeed.");

                    Regex r2    = new Regex(@"([a-zA-Z]([a-zA-Z0-9\-_])*\\[a-zA-Z]([a-zA-Z0-9])*)$");
                    Match match = r2.Match(subResponse.SubResponseData.UserLogin);
                    if (r2.IsMatch(subResponse.SubResponseData.UserLogin) && match.Success && match.Index > 0)
                    {
                        break;
                    }

                    retryCount--;
                    if (retryCount == 0)
                    {
                        Site.Assert.Fail("Additional authentication prefix should not exist in UserLogin if claim-based authentication mode is enabled");
                    }

                    System.Threading.Thread.Sleep(waitTime);
                }

                Regex regex2 = new Regex(@"([a-zA-Z]([a-zA-Z0-9\-_])*\\[a-zA-Z]([a-zA-Z0-9])*)$");
                Match m      = regex2.Match(subResponse.SubResponseData.UserLogin);

                if (SharedContext.Current.IsMsFsshttpRequirementsCaptured)
                {
                    Site.Log.Add(
                        LogEntryKind.Debug,
                        string.Format("The UserLogin should have prefix when the authentication is claims based, actual the prefix {0}", m.Index > 0 ? "exists" : "does not exist"));

                    this.Site.CaptureRequirementIfIsTrue(
                        m.Success && m.Index > 0,
                        "MS-FSSHTTP",
                        3086,
                        @"[In Appendix B: Product Behavior] Implementation does add an additional authentication prefix for the UserLogin attribute. (Microsoft SharePoint Foundation 2016/Microsoft SharePoint Server 2016 and above follow this behavior.)");
                }
                else
                {
                    Site.Log.Add(
                        LogEntryKind.Debug,
                        string.Format("The UserLogin should have prefix when the authentication is claims based, actual the prefix {0}", m.Index > 0 ? "exists" : "does not exist"));

                    this.Site.Assert.IsTrue(
                        m.Success && m.Index > 0,
                        @"[In Appendix B: Product Behavior] Implementation does add an additional authentication prefix for the UserLogin attribute. <28> Section 2.3.2.6: There is an additional authentication prefix if claims-based authentication mode is enabled. (Microsoft SharePoint Foundation 2016/Microsoft SharePoint Server 2016 and above follow this behavior.)");
                }
            }
        }
コード例 #9
0
        public void TestCase_S16_TC05_FileVersionEventDataType_Rename()
        {
            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);

            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);

            string fileName = this.DefaultFileUrl.Substring(this.DefaultFileUrl.LastIndexOf("/", StringComparison.OrdinalIgnoreCase) + 1);
            string newName  = Common.GenerateResourceName(this.Site, "fileName") + ".txt";

            FileOperationSubRequestType fileOperationSubRequest = SharedTestSuiteHelper.CreateFileOperationSubRequest(FileOperationRequestTypes.Rename, newName, null, this.Site);

            CellStorageResponse cellStoreageResponse = Adapter.CellStorageRequest(this.DefaultFileUrl, new SubRequestType[] { fileOperationSubRequest });

            FileOperationSubResponseType fileOperationSubResponse = SharedTestSuiteHelper.ExtractSubResponse <FileOperationSubResponseType>(cellStoreageResponse, 0, 0, this.Site);

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

            string fileUrl = this.DefaultFileUrl.Substring(0, this.DefaultFileUrl.LastIndexOf("/", StringComparison.OrdinalIgnoreCase) + 1) + newName;

            VersioningSubRequestType versioningSubRequest = SharedTestSuiteHelper.CreateVersioningSubRequest(SequenceNumberGenerator.GetCurrentToken(), VersioningRequestTypes.GetVersionList, null, this.Site);

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

            this.Site.Assert.AreEqual <ErrorCodeType>(
                ErrorCodeType.Success,
                SharedTestSuiteHelper.ConvertToErrorCodeType(versioningSubResponse.ErrorCode, this.Site),
                "Get version list should succeed.");
            this.Site.Assert.AreEqual <int>(
                2,
                versioningSubResponse.SubResponseData.Versions.Version.Length,
                "There should be 2 version numbers.");

            // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R1117502
            Site.CaptureRequirementIfIsNull(
                versioningSubResponse.SubResponseData.Versions.Version[1].IsCurrent,
                "MS-FSSHTTP",
                1117502,
                @"[In FileVersionDataType] IsCurrent: This attribute is not present if this version is not the most recent version of the file.");


            // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R11189
            Site.CaptureRequirementIfAreEqual <string>(
                "2",
                versioningSubResponse.SubResponseData.Versions.Version[0].Events[0].Type,
                "MS-FSSHTTP",
                11189,
                @"[In FileVersionEventDataType] 2 means A user renamed the file.");
        }
コード例 #10
0
        public void TestCase_S16_TC04_FileVersionEventDataType_Restore()
        {
            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);

            VersioningSubRequestType versioningSubRequest = SharedTestSuiteHelper.CreateVersioningSubRequest(SequenceNumberGenerator.GetCurrentToken(), VersioningRequestTypes.RestoreVersion, "1.0", this.Site);
            CellStorageResponse      cellStoreageResponse = Adapter.CellStorageRequest(
                this.DefaultFileUrl,
                new SubRequestType[] { versioningSubRequest });
            VersioningSubResponseType versioningSubResponse = SharedTestSuiteHelper.ExtractSubResponse <VersioningSubResponseType>(cellStoreageResponse, 0, 0, this.Site);

            this.Site.Assert.AreEqual <ErrorCodeType>(
                ErrorCodeType.Success,
                SharedTestSuiteHelper.ConvertToErrorCodeType(versioningSubResponse.ErrorCode, this.Site),
                "Restore file version should succeed.");

            GetDocMetaInfoSubRequestType getDocMetaInfoSubRequest = SharedTestSuiteHelper.CreateGetDocMetaInfoSubRequest(SequenceNumberGenerator.GetCurrentToken());

            cellStoreageResponse = Adapter.CellStorageRequest(this.DefaultFileUrl, new SubRequestType[] { getDocMetaInfoSubRequest });
            GetDocMetaInfoSubResponseType getDocMetaInfoSubResponse = SharedTestSuiteHelper.ExtractSubResponse <GetDocMetaInfoSubResponseType>(cellStoreageResponse, 0, 0, this.Site);

            this.Site.Assert.AreEqual <ErrorCodeType>(
                ErrorCodeType.Success,
                SharedTestSuiteHelper.ConvertToErrorCodeType(getDocMetaInfoSubResponse.ErrorCode, this.Site),
                "Get doc meta info should succeed.");

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

            this.Site.Assert.AreEqual <ErrorCodeType>(
                ErrorCodeType.Success,
                SharedTestSuiteHelper.ConvertToErrorCodeType(versioningSubResponse.ErrorCode, this.Site),
                "Get version list should succeed.");
            this.Site.Assert.AreEqual <int>(
                3,
                versioningSubResponse.SubResponseData.Versions.Version.Length,
                "There should be 3 version numbers.");

            // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R11190
            Site.CaptureRequirementIfAreEqual <string>(
                "3",
                versioningSubResponse.SubResponseData.Versions.Version[0].Events[0].Type,
                "MS-FSSHTTP",
                11190,
                @"[In FileVersionEventDataType] 3 means A user restored the file content to its state at a previous version.");

            GetDocMetaInfoPropertyType lastModifiedProperty = null;

            foreach (GetDocMetaInfoPropertyType property in getDocMetaInfoSubResponse.SubResponseData.DocProps.Property)
            {
                if (property.Key.ToLower().Contains("timelastmodified"))
                {
                    lastModifiedProperty = property;
                }
            }

            Site.Assert.IsNotNull(lastModifiedProperty, "Property for last modified time should be found.");

            System.DateTime time = Convert.ToDateTime(lastModifiedProperty.Value);

            long createTime       = long.Parse(versioningSubResponse.SubResponseData.Versions.Version[0].Events[0].CreateTime);
            bool isR11193Verified = ((System.Math.Round((double)createTime / 10000000)) == (time - new System.DateTime(1601, 1, 1, 0, 0, 0)).TotalSeconds);

            // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R11193
            Site.CaptureRequirementIfIsTrue(
                isR11193Verified,
                "MS-FSSHTTP",
                11193,
                @"[In FileVersionEventDataType] CreateTime specifies the number of 100-nanosecond intervals that have elapsed since 00:00:00 on January 1, 1601, which MUST be Coordinated Universal Time (UTC).");

            // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R11192
            Site.CaptureRequirementIfIsTrue(
                isR11193Verified,
                "MS-FSSHTTP",
                11192,
                @"[In FileVersionEventDataType] A single tick represents 100 nanoseconds, or one ten-millionth of a second.");

            // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R11194
            Site.CaptureRequirementIfAreEqual <string>(
                versioningSubResponse.SubResponseData.UserTable.User[0].UserId,
                versioningSubResponse.SubResponseData.Versions.Version[0].Events[0].UserId,
                "MS-FSSHTTP",
                11194,
                @"[In FileVersionEventDataType] UserId: An integer which specifies which user performed this event.");

            // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R11195
            Site.CaptureRequirementIfAreEqual <string>(
                versioningSubResponse.SubResponseData.UserTable.User[0].UserId,
                versioningSubResponse.SubResponseData.Versions.Version[0].Events[0].UserId,
                "MS-FSSHTTP",
                11195,
                @"[In FileVersionEventDataType] The UserId MUST match the UserId attribute of a UserDataType (section 2.3.1.42) described in the VersioningUserTableType in the current VersioningSubResponseDataType.");
        }
コード例 #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.");
            }
        }