Example #1
0
        /// <summary>
        /// This method is used to record the coauth lock status with specified client ID and schema lock ID for the file URL.
        /// </summary>
        /// <param name="fileUrl">Specify the file URL which get the coauth lock.</param>
        /// <param name="clientId">Specify the client ID of the coauth lock.</param>
        /// <param name="schemaLockId">Specify the schema ID of the coauth lock.</param>
        /// <param name="userName">Specify the user name of the user who calls cell storage service.</param>
        /// <param name="password">Specify the password of the user who calls cell storage service.</param>
        /// <param name="domain">Specify the domain of the user who calls cell storage service.</param>
        public void RecordCoauthSession(string fileUrl, string clientId, string schemaLockId, string userName, string password, string domain)
        {
            Action function = () =>
            {
                CoauthSubRequestType coauthLockRequest = new CoauthSubRequestType();
                coauthLockRequest.SubRequestToken = SequenceNumberGenerator.GetCurrentToken().ToString();
                coauthLockRequest.SubRequestData  = new CoauthSubRequestDataType();
                coauthLockRequest.SubRequestData.CoauthRequestType          = CoauthRequestTypes.ExitCoauthoring;
                coauthLockRequest.SubRequestData.CoauthRequestTypeSpecified = true;
                coauthLockRequest.SubRequestData.SchemaLockID = schemaLockId;
                coauthLockRequest.SubRequestData.ClientID     = clientId;

                IMS_FSSHTTP_FSSHTTPBAdapter adapter = site.GetAdapter <IMS_FSSHTTP_FSSHTTPBAdapter>();
                this.intializeContext(fileUrl, userName, password, domain);

                CoauthSubResponseType subResponse = SharedTestSuiteHelper.ExtractSubResponse <CoauthSubResponseType>(adapter.CellStorageRequest(fileUrl, new SubRequestType[] { coauthLockRequest }), 0, 0, site);

                if (!string.Equals("Success", subResponse.ErrorCode, StringComparison.OrdinalIgnoreCase))
                {
                    this.errorMessage.Add(string.Format("Failed to leave the coauth session for the client id {1} and schema lock id {5} on the file {0} using the following user: {2}/{3}and password:{4}", fileUrl, clientId, userName, domain, password, schemaLockId));
                    this.isEnvironmentRollbackSuccess = false;
                }
            };

            this.AddOrUpdate(new SharedLockKey(fileUrl, clientId, schemaLockId), function);
        }
Example #2
0
        /// <summary>
        /// This method is used to record the exclusive lock status with specified exclusive lock ID for the file URL.
        /// </summary>
        /// <param name="fileUrl">Specify the file URL which get the exclusive lock.</param>
        /// <param name="exclusiveId">Specify the exclusive lock ID of the exclusive lock.</param>
        /// <param name="userName">Specify the user name of the user who calls cell storage service.</param>
        /// <param name="password">Specify the password of the user who calls cell storage service.</param>
        /// <param name="domain">Specify the domain of the user who calls cell storage service.</param>
        public void RecordExclusiveLock(string fileUrl, string exclusiveId, string userName, string password, string domain)
        {
            Action function = () =>
            {
                ExclusiveLockSubRequestType coauthLockRequest = new ExclusiveLockSubRequestType();
                coauthLockRequest.SubRequestToken = SequenceNumberGenerator.GetCurrentToken().ToString();
                coauthLockRequest.SubRequestData  = new ExclusiveLockSubRequestDataType();
                coauthLockRequest.SubRequestData.ExclusiveLockRequestType          = ExclusiveLockRequestTypes.ReleaseLock;
                coauthLockRequest.SubRequestData.ExclusiveLockRequestTypeSpecified = true;
                coauthLockRequest.SubRequestData.ExclusiveLockID = exclusiveId;

                IMS_FSSHTTP_FSSHTTPBAdapter adapter = site.GetAdapter <IMS_FSSHTTP_FSSHTTPBAdapter>();
                this.intializeContext(fileUrl, userName, password, domain);

                CoauthSubResponseType subResponse = SharedTestSuiteHelper.ExtractSubResponse <CoauthSubResponseType>(adapter.CellStorageRequest(fileUrl, new SubRequestType[] { coauthLockRequest }), 0, 0, site);

                if (!string.Equals("Success", subResponse.ErrorCode, StringComparison.OrdinalIgnoreCase))
                {
                    this.errorMessage.Add(string.Format("Failed to release the exclusive lock for the exclusive lock id {1} on the file {0} using the following user: {2}/{3}and password:{4}", fileUrl, exclusiveId, userName, domain, password));
                    this.isEnvironmentRollbackSuccess = false;
                }
            };

            this.AddOrUpdate(fileUrl, function, KeyStatus.ExclusiveLock);
        }
Example #3
0
        /// <summary>
        /// This method is used to record the Editors Table status with specified client ID and editorsTableType for the file URL.
        /// </summary>
        /// <param name="fileUrl">Specify the file URL which get the file we use.</param>
        /// <param name="clientId">Specify the client ID of the editors table.</param>
        /// <param name="userName">Specify the user name of the user who calls cell storage service.</param>
        /// <param name="password">Specify the password of the user who calls cell storage service.</param>
        /// <param name="domain">Specify the domain of the user who calls cell storage service.</param>
        public void RecordEditorTable(string fileUrl, string clientId, string userName, string password, string domain)
        {
            Action function = () =>
            {
                EditorsTableSubRequestType ets = new EditorsTableSubRequestType();
                ets.Type                    = SubRequestAttributeType.EditorsTable;
                ets.SubRequestData          = new EditorsTableSubRequestDataType();
                ets.SubRequestData.ClientID = clientId;
                ets.SubRequestData.EditorsTableRequestTypeSpecified = true;
                ets.SubRequestData.EditorsTableRequestType          = EditorsTableRequestTypes.LeaveEditingSession;
                ets.SubRequestToken = SequenceNumberGenerator.GetCurrentToken().ToString();

                IMS_FSSHTTP_FSSHTTPBAdapter adapter = site.GetAdapter <IMS_FSSHTTP_FSSHTTPBAdapter>();
                this.intializeContext(fileUrl, userName, password, domain);
                EditorsTableSubResponseType subResponse = SharedTestSuiteHelper.ExtractSubResponse <EditorsTableSubResponseType>(adapter.CellStorageRequest(fileUrl, new SubRequestType[] { ets }), 0, 0, site);

                if (!string.Equals("Success", subResponse.ErrorCode, StringComparison.OrdinalIgnoreCase))
                {
                    this.errorMessage.Add(string.Format("Failed to release the editor tables join status for the client id {1} on the file {0} using the following user: {2}/{3}and password:{4}", fileUrl, clientId, userName, domain, password));
                    this.isEnvironmentRollbackSuccess = false;
                }
            };

            this.AddOrUpdate(new SharedLockKey(fileUrl, clientId, string.Empty), function);
        }
        public void MSFSSHTTP_FSSHTTPB_TestCase_S19_TC02_LockStatus_Error()
        {
            // Initialize the service
            this.InitializeContext(this.DefaultFileUrl, this.UserName01, this.Password01, this.Domain);

            LockStatusSubRequestType lockStatus = SharedTestSuiteHelper.CreateLockStatusSubRequest();

            CellStorageResponse response = this.Adapter.CellStorageRequest(null, new SubRequestType[] { lockStatus });

            if (Common.IsRequirementEnabled(2273, this.Site))
            {
                LockStatusSubResponseType lockStatusResponse = SharedTestSuiteHelper.ExtractSubResponse <LockStatusSubResponseType>(response, 0, 0, this.Site);

                if (SharedContext.Current.IsMsFsshttpRequirementsCaptured)
                {
                    //Verify MS-FSSHTTP requirement: MS-FSSHTTP_R2273
                    Site.CaptureRequirementIfAreNotEqual <string>(
                        "Success",
                        lockStatusResponse.ErrorCode,
                        "MS-FSSHTTP",
                        2273,
                        @"[LockStatusSubResponseType]In the case of failure, the ErrorCode attribute that is part of a SubResponse element specifies the error code result for this subrequest. ");
                }
                else
                {
                    Site.Assert.AreNotEqual <string>(
                        "Success",
                        lockStatusResponse.ErrorCode,
                        "In the case of failure, the ErrorCode attribute that is part of a SubResponse element specifies the error code result for this subrequest. ");
                }
            }
        }
        public void TestCase_S10_TC01_SubRequestToken()
        {
            // Initialize the service
            this.InitializeContext(this.DefaultFileUrl, this.UserName01, this.Password01, this.Domain);

            ExclusiveLockSubRequestType exclusiveLocksubRequest = SharedTestSuiteHelper.CreateExclusiveLockSubRequest(ExclusiveLockRequestTypes.GetLock);

            // Update the file contents when the coalesce is true.
            CellSubRequestType putChange = SharedTestSuiteHelper.CreateCellSubRequestEmbeddedPutChanges(SequenceNumberGenerator.GetCurrentFSSHTTPBSubRequestID(), System.Text.Encoding.Unicode.GetBytes(SharedTestSuiteHelper.GenerateRandomString(10)));

            putChange.SubRequestData.CoalesceSpecified = true;
            putChange.SubRequestData.Coalesce          = true;

            CellStorageResponse response = this.Adapter.CellStorageRequest(this.DefaultFileUrl, new SubRequestType[] { exclusiveLocksubRequest, putChange });
            int exclusiveIndex           = 0;
            int putchangeIndex           = 0;

            for (int i = 0; i < response.ResponseCollection.Response[0].SubResponse.Length; i++)
            {
                if (response.ResponseCollection.Response[0].SubResponse[i].SubRequestToken == exclusiveLocksubRequest.SubRequestToken)
                {
                    exclusiveIndex = i;
                }
                else if (response.ResponseCollection.Response[0].SubResponse[i].SubRequestToken == putChange.SubRequestToken)
                {
                    putchangeIndex = i;
                }
            }

            ExclusiveLockSubResponseType exclusiveResponse = SharedTestSuiteHelper.ExtractSubResponse <ExclusiveLockSubResponseType>(response, 0, exclusiveIndex, this.Site);
            CellSubResponseType          putChangeResponse = SharedTestSuiteHelper.ExtractSubResponse <CellSubResponseType>(response, 0, putchangeIndex, this.Site);

            this.Site.Assert.AreEqual <ErrorCodeType>(ErrorCodeType.Success, SharedTestSuiteHelper.ConvertToErrorCodeType(exclusiveResponse.ErrorCode, this.Site), "Test case cannot continue unless the get lock sub request succeeds.");
            this.StatusManager.RecordExclusiveLock(this.DefaultFileUrl, exclusiveLocksubRequest.SubRequestData.ExclusiveLockID);
            this.Site.Assert.AreEqual <ErrorCodeType>(ErrorCodeType.Success, SharedTestSuiteHelper.ConvertToErrorCodeType(putChangeResponse.ErrorCode, this.Site), "Test case cannot continue unless the put changes sub request succeeds.");

            this.Site.Assert.AreEqual <int>(
                int.Parse(exclusiveLocksubRequest.SubRequestToken),
                int.Parse(exclusiveResponse.SubRequestToken),
                "Test case cannot run unless the put change response token equals the expected sub request token.");
            this.Site.Assert.AreEqual <int>(
                int.Parse(putChange.SubRequestToken),
                int.Parse(putChangeResponse.SubRequestToken),
                "Test case cannot run unless the put change response token equals the expected sub request token.");

            if (SharedContext.Current.IsMsFsshttpRequirementsCaptured)
            {
                // If both the subRequest tokens are mapping, then MS-FSSHTTP_R1484 and MS-FSSHTTP_R283 can be captured.
                Site.CaptureRequirement(
                    "MS-FSSHTTP",
                    1484,
                    @"[In SubResponseType] SubRequestToken: If client sends 2 SubRequest elements in the Request, in the server response, SubRequestToken uniquely identifies the 2 SubRequest element whose subresponse is being generated as part of the SubResponse element.");

                // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R283
                Site.CaptureRequirement(
                    "MS-FSSHTTP",
                    283,
                    @"[In SubResponseType][SubRequestToken] The mapping subresponse that gets generated for the subrequest references the SubRequestToken to indicate that it is the response for that subrequest.");
            }
        }
        /// <summary>
        /// This method is used to prepare a coauthoring session on the file with the specified schema lock id and client id.
        /// </summary>
        /// <param name="fileUrl">Specify the file which is locked.</param>
        /// <param name="clientId">Specify the client ID.</param>
        /// <param name="schemaLockId">Specify the schemaLock ID.</param>
        /// <param name="userName">Specify the user name of the user who calls cell storage service.</param>
        /// <param name="password">Specify the password of the user who calls cell storage service.</param>
        /// <param name="domain">Specify the domain of the user who calls cell storage service.</param>
        /// <param name="timeout">Specify the timeout value.</param>
        /// <returns>Return the current coauthoring status when the user join the coauthoring session.</returns>
        protected CoauthStatusType PrepareCoauthoringSession(string fileUrl, string clientId, string schemaLockId, string userName, string password, string domain, int timeout = SharedTestSuiteHelper.DefaultTimeOut)
        {
            this.InitializeContext(fileUrl, userName, password, domain);

            // Join a Coauthoring session
            CoauthSubRequestType  subRequest   = SharedTestSuiteHelper.CreateCoauthSubRequestForJoinCoauthSession(clientId, schemaLockId, null, null, timeout);
            CellStorageResponse   cellResponse = this.Adapter.CellStorageRequest(fileUrl, new SubRequestType[] { subRequest });
            CoauthSubResponseType joinResponse = SharedTestSuiteHelper.ExtractSubResponse <CoauthSubResponseType>(cellResponse, 0, 0, this.Site);

            this.Site.Assert.AreEqual(
                ErrorCodeType.Success,
                SharedTestSuiteHelper.ConvertToErrorCodeType(joinResponse.ErrorCode, this.Site),
                "Join coauthoring session with client ID {0} and schema lock ID {4} by the user {1}@{2} on the file {3} should succeed.",
                clientId,
                userName,
                domain,
                fileUrl,
                schemaLockId);

            this.StatusManager.RecordCoauthSession(fileUrl, clientId, schemaLockId, userName, password, domain);

            this.Site.Assert.IsTrue(
                joinResponse.SubResponseData.CoauthStatusSpecified,
                "When join the coauthoring session succeeds, the coauth status should be returned.");

            return(joinResponse.SubResponseData.CoauthStatus);
        }
        public void MSFSSHTTP_FSSHTTPB_S08_TC02_GetDocMetaInfo_UrlNotSpecified()
        {
            // Initialize the service
            this.InitializeContext(this.DefaultFileUrl, this.UserName01, this.Password01, this.Domain);

            // Send the GetDocMetaInfo subRequest to the protocol server with Url attribute is not set.
            GetDocMetaInfoSubRequestType getDocMetaInfoSubRequest = SharedTestSuiteHelper.CreateGetDocMetaInfoSubRequest(SequenceNumberGenerator.GetCurrentToken());
            CellStorageResponse          response = this.Adapter.CellStorageRequest(null, new SubRequestType[] { getDocMetaInfoSubRequest });

            if (SharedContext.Current.IsMsFsshttpRequirementsCaptured)
            {
                // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R3007
                if (Common.IsRequirementEnabled("MS-FSSHTTP-FSSHTTPB", 3007, this.Site))
                {
                    Site.CaptureRequirementIfIsNull(
                        response.ResponseCollection,
                        "MS-FSSHTTP",
                        3007,
                        @"[In Appendix B: Product Behavior] If the Url attribute of the corresponding Request element doesn't exist, the implementation does not return Response element. <8> Section 2.2.3.5:  SharePoint Server 2013 will not return Response element.");
                }
            }
            else
            {
                Site.Assert.IsNull(
                    response.ResponseCollection,
                    @"[In Appendix B: Product Behavior] If the Url attribute of the corresponding Request element doesn't exist, the implementation does not return Response element. <8> Section 2.2.3.5:  SharePoint Server 2013 will not return Response element.");
            }
        }
Example #8
0
        public void MSFSSHTTP_FSSHTTPB_S07_TC02_EditorsTable_JoinEditSession_EmptyUrl()
        {
            if (!Common.IsRequirementEnabled("MS-FSSHTTP-FSSHTTPB", 9001, this.Site))
            {
                Site.Assume.Inconclusive("Implementation does not support the editors table.");
            }

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

            // Create a EditorsTable subRequest with all valid parameters.
            EditorsTableSubRequestType subRequest = SharedTestSuiteHelper.CreateEditorsTableSubRequestForJoinSession(SharedTestSuiteHelper.DefaultClientID, 3600);

            // Send the serverTime subRequest to the protocol server with Url attribute set to en empty string.
            CellStorageResponse response = this.Adapter.CellStorageRequest(string.Empty, new SubRequestType[] { subRequest });

            // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R3009
            if (Common.IsRequirementEnabled("MS-FSSHTTP-FSSHTTPB", 3009, this.Site))
            {
                if (SharedContext.Current.IsMsFsshttpRequirementsCaptured)
                {
                    Site.CaptureRequirementIfIsNull(
                        response.ResponseCollection,
                        "MS-FSSHTTP",
                        3009,
                        @"[In Appendix B: Product Behavior] If the Url attribute of the corresponding Request element is an empty string, the implementation does not return Response element. <3> Section 2.2.3.5:  SharePoint Server 2013 will not return Response element.");
                }
                else
                {
                    Site.Assert.IsNull(
                        response.ResponseCollection,
                        @"[In Appendix B: Product Behavior] If the Url attribute of the corresponding Request element is an empty string, the implementation does not return Response element. <3> Section 2.2.3.5:  SharePoint Server 2013 will not return Response element.");
                }
            }
        }
Example #9
0
        public void MSFSSHTTP_FSSHTTPB_S04_TC06_ExclusiveLock_FileNotExistsOrCannotBeCreated()
        {
            // Initialize the service
            this.InitializeContext(this.DefaultFileUrl, this.UserName01, this.Password01, this.Domain);
            string notExistsFileUrl = this.DefaultFileUrl.Substring(0, this.DefaultFileUrl.LastIndexOf('/')) + "/noexistsFile.txt";
            ExclusiveLockSubRequestType subRequest = SharedTestSuiteHelper.CreateExclusiveLockSubRequest(ExclusiveLockRequestTypes.GetLock);

            // Get the exclusive lock with nonexistent file URL and expect the server returns error code "LockRequestFail" or "Unknown".
            CellStorageResponse          response          = this.Adapter.CellStorageRequest(notExistsFileUrl, new SubRequestType[] { subRequest });
            ExclusiveLockSubResponseType exclusiveResponse = SharedTestSuiteHelper.ExtractSubResponse <ExclusiveLockSubResponseType>(response, 0, 0, this.Site);

            ErrorCodeType errorType       = SharedTestSuiteHelper.ConvertToErrorCodeType(exclusiveResponse.ErrorCode, this.Site);
            bool          isR1926Verified = errorType == ErrorCodeType.LockRequestFail || errorType == ErrorCodeType.Unknown || errorType == ErrorCodeType.FileNotExistsOrCannotBeCreated;

            this.Site.Log.Add(
                LogEntryKind.Debug,
                "For requirement MS-FSSHTTP_R1926, expect the error code LockRequestFail or Unknown or FileNotExistsOrCannotBeCreated, but actually error code is " + errorType);

            if (SharedContext.Current.IsMsFsshttpRequirementsCaptured)
            {
                // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R1926
                Site.CaptureRequirementIfIsTrue(
                    isR1926Verified,
                    "MS-FSSHTTP",
                    1926,
                    @"[In ExclusiveLock Subrequest][The protocol returns results based on the following conditions: ] If the protocol server was unable to find the URL for the file specified in the Url attribute, the protocol server reports a failure by returning an error code value set to ""LockRequestFail "" or ""Unknown"" or ""FileNotExistsOrCannotBeCreated""  in the ErrorCode attribute sent back in the SubResponse element.");
            }
            else
            {
                Site.Assert.IsTrue(
                    isR1926Verified,
                    @"[In ExclusiveLock Subrequest][The protocol returns results based on the following conditions: ] If the protocol server was unable to find the URL for the file specified in the Url attribute, the protocol server reports a failure by returning an error code value set to ""LockRequestFail "" or ""Unknown"" or ""FileNotExistsOrCannotBeCreated""  in the ErrorCode attribute sent back in the SubResponse element.");
            }
        }
Example #10
0
        public void MSFSSHTTP_FSSHTTPB_TestCase_S16_TC01_Versioning_EmptyUrl()
        {
            // Initialize the service
            this.InitializeContext(this.DefaultFileUrl, this.UserName01, this.Password01, this.Domain);

            VersioningSubRequestType versioningSubRequest = SharedTestSuiteHelper.CreateVersioningSubRequest(SequenceNumberGenerator.GetCurrentToken(), VersioningRequestTypes.GetVersionList, null, this.Site);
            CellStorageResponse      cellStoreageResponse = Adapter.CellStorageRequest(string.Empty, new SubRequestType[] { versioningSubRequest });

            if (Common.IsRequirementEnabled(11151, this.Site))
            {
                SubResponseType subResponse = cellStoreageResponse.ResponseCollection.Response[0].SubResponse[0];
                ErrorCodeType   errorCode   = SharedTestSuiteHelper.ConvertToErrorCodeType(subResponse.ErrorCode, this.Site);

                if (SharedContext.Current.IsMsFsshttpRequirementsCaptured)
                {
                    // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R11151
                    Site.CaptureRequirementIfAreNotEqual <ErrorCodeType>(
                        ErrorCodeType.Success,
                        errorCode,
                        "MS-FSSHTTP",
                        11151,
                        @"[In VersioningSubResponseType] In the case of failure, the ErrorCode attribute that is part of a SubResponse element specifies the error code result for this subrequest.");
                }
                else
                {
                    Site.Assert.AreNotEqual <ErrorCodeType>(
                        ErrorCodeType.Success,
                        errorCode,
                        "Error should occur if call versioning request with empty url.");
                }
            }
        }
        /// <summary>
        /// This method is used to fetch editor table on the specified file.
        /// </summary>
        /// <param name="file">Specify the file URL.</param>
        /// <returns>Return the editors table on the file if the server support the editor tables, otherwise return null.</returns>
        protected EditorsTable FetchEditorTable(string file)
        {
            if (Common.IsRequirementEnabled("MS-FSSHTTP-FSSHTTPB", 2053, this.Site))
            {
                // Call QueryEditorsTable to get editors table
                this.InitializeContext(file, this.UserName01, this.Password01, this.Domain);
                CellSubRequestType  cellSubRequestEditorsTable      = SharedTestSuiteHelper.CreateCellSubRequestEmbeddedQueryEditorsTable(SequenceNumberGenerator.GetCurrentFSSHTTPBSubRequestID());
                CellStorageResponse cellStorageResponseEditorsTable = this.Adapter.CellStorageRequest(file, new SubRequestType[] { cellSubRequestEditorsTable });
                CellSubResponseType subResponse = SharedTestSuiteHelper.ExtractSubResponse <CellSubResponseType>(cellStorageResponseEditorsTable, 0, 0, this.Site);
                FsshttpbResponse    queryEditorsTableResponse = SharedTestSuiteHelper.ExtractFsshttpbResponse(subResponse, this.Site);

                // Get EditorsTable
                EditorsTable editorsTable = EditorsTableUtils.GetEditorsTableFromResponse(queryEditorsTableResponse, this.Site);

                if (SharedContext.Current.IsMsFsshttpRequirementsCaptured)
                {
                    // If can fetch the editors table, then the following requirement can be directly captured.
                    this.Site.CaptureRequirement(
                        "MS-FSSHTTP",
                        2053,
                        @"[In Appendix B: Product Behavior]  Implementation does represent the editors table as a compressed XML fragment. (<42> Section 3.1.4.8: On servers running Office 2013, the editors table is represented as a compressed XML fragment.)");
                }

                return(editorsTable);
            }

            return(null);
        }
Example #12
0
        public void MSFSSHTTP_FSSHTTPB_TestCase_S16_TC02_Versioning_FileNotExistsOrCannotBeCreated()
        {
            string fileUrlNotExit = SharedTestSuiteHelper.GenerateNonExistFileUrl(this.Site);

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

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

            if (SharedContext.Current.IsMsFsshttpRequirementsCaptured)
            {
                // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R11246
                Site.CaptureRequirementIfAreEqual <ErrorCodeType>(
                    ErrorCodeType.FileNotExistsOrCannotBeCreated,
                    SharedTestSuiteHelper.ConvertToErrorCodeType(versioningSubResponse.ErrorCode, this.Site),
                    "MS-FSSHTTP",
                    11246,
                    @"[In Versioning Subrequest] [The protocol returns results based on the following conditions:]If the protocol server was unable to find the URL for the file specified in the Url attribute, the protocol server reports a failure by returning an error code value set to ""FileNotExistsOrCannotBeCreated"" in the ErrorCode attribute sent back in the SubResponse element.");
            }
            else
            {
                Site.Assert.AreEqual <ErrorCodeType>(
                    ErrorCodeType.FileNotExistsOrCannotBeCreated,
                    SharedTestSuiteHelper.ConvertToErrorCodeType(versioningSubResponse.ErrorCode, this.Site),
                    "Error FileNotExistsOrCannotBeCreated should be returned if the protocol server was unable to find the URL for the file.");
            }
        }
        public void MSFSSHTTP_FSSHTTPB_S02_TC04_JoinCoauthSession_FileNotExistsOrCannotBeCreated()
        {
            // Join a coauthoring session on a nonexistent file, expect the server returns the error code "FileNotExistsOrCannotBeCreated".
            string fileUrlNotExit = SharedTestSuiteHelper.GenerateNonExistFileUrl(this.Site);

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

            // Join a Coauthoring session with the non-exist URL.
            CoauthSubRequestType  subRequest   = SharedTestSuiteHelper.CreateCoauthSubRequestForJoinCoauthSession(SharedTestSuiteHelper.DefaultClientID, SharedTestSuiteHelper.ReservedSchemaLockID, null, null, 3600);
            CellStorageResponse   cellResponse = this.Adapter.CellStorageRequest(fileUrlNotExit, new SubRequestType[] { subRequest });
            CoauthSubResponseType joinResponse = SharedTestSuiteHelper.ExtractSubResponse <CoauthSubResponseType>(cellResponse, 0, 0, this.Site);

            if (SharedContext.Current.IsMsFsshttpRequirementsCaptured)
            {
                // If the ErrorCode attribute returned equals "FileNotExistsOrCannotBeCreated", MS-FSSHTTP_R4003 can be covered.
                Site.CaptureRequirementIfAreEqual <ErrorCodeType>(
                    ErrorCodeType.FileNotExistsOrCannotBeCreated,
                    SharedTestSuiteHelper.ConvertToErrorCodeType(joinResponse.ErrorCode, this.Site),
                    "MS-FSSHTTP",
                    4003,
                    @"[In Coauth Subrequest][The protocol server returns results based on the following conditions:] If the protocol server was unable to find the URL for the file specified in the Url attribute, the protocol server reports a failure by returning an error code value set to ""FileNotExistsOrCannotBeCreated"" in the ErrorCode attribute sent back in the SubResponse element.");
            }
            else
            {
                Site.Assert.AreEqual <ErrorCodeType>(
                    ErrorCodeType.FileNotExistsOrCannotBeCreated,
                    SharedTestSuiteHelper.ConvertToErrorCodeType(joinResponse.ErrorCode, this.Site),
                    @"[In Coauth Subrequest][The protocol server returns results based on the following conditions:] If the protocol server was unable to find the URL for the file specified in the Url attribute, the protocol server reports a failure by returning an error code value set to ""FileNotExistsOrCannotBeCreated"" in the ErrorCode attribute sent back in the SubResponse element.");
            }
        }
        public void MSFSSHTTP_FSSHTTPB_S02_TC06_JoinCoauthoringSession_PathNotFound()
        {
            Site.Assume.IsTrue(Common.IsRequirementEnabled(11265, this.Site), "This test case only runs PathNotFound is returned when the file path is not found.");

            string fileUrlNotExit = SharedTestSuiteHelper.GenerateNonExistFileUrl(this.Site);
            string path           = fileUrlNotExit.Substring(0, fileUrlNotExit.LastIndexOf('/'));

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

            CoauthSubRequestType  subRequest   = SharedTestSuiteHelper.CreateCoauthSubRequestForJoinCoauthSession(SharedTestSuiteHelper.DefaultClientID, SharedTestSuiteHelper.ReservedSchemaLockID, null, null, 3600);
            CellStorageResponse   cellResponse = this.Adapter.CellStorageRequest(path, new SubRequestType[] { subRequest });
            CoauthSubResponseType joinResponse = SharedTestSuiteHelper.ExtractSubResponse <CoauthSubResponseType>(cellResponse, 0, 0, this.Site);

            if (SharedContext.Current.IsMsFsshttpRequirementsCaptured)
            {
                Site.CaptureRequirementIfAreEqual <ErrorCodeType>(
                    ErrorCodeType.PathNotFound,
                    SharedTestSuiteHelper.ConvertToErrorCodeType(joinResponse.ErrorCode, this.Site),
                    "MS-FSSHTTP",
                    11265,
                    @"[In Appendix B: Product Behavior] Implementation does return the value ""PathNotFound"" of GenericErrorCodeTypes when the file path is not found. (Microsoft Office 2016/Microsoft SharePoint Server 2016 follow this behavior.)");
            }
            else
            {
                Site.Assert.AreEqual <ErrorCodeType>(
                    ErrorCodeType.PathNotFound,
                    SharedTestSuiteHelper.ConvertToErrorCodeType(joinResponse.ErrorCode, this.Site),
                    @"Error ""PathNotFound"" should be returned when the file path is not found.");
            }
        }
Example #15
0
        public void MSFSSHTTP_FSSHTTPB_TestCase_S18_TC02_AmIAlone_Error()
        {
            // Initialize the service
            this.InitializeContext(this.DefaultFileUrl, this.UserName01, this.Password01, this.Domain);

            AmIAloneSubRequestType  amIAlone         = SharedTestSuiteHelper.CreateAmIAloneSubRequest();
            CellStorageResponse     response         = this.Adapter.CellStorageRequest(this.DefaultFileUrl, new SubRequestType[] { amIAlone });
            AmIAloneSubResponseType amIAloneResponse = SharedTestSuiteHelper.ExtractSubResponse <AmIAloneSubResponseType>(response, 0, 0, this.Site);

            if (SharedContext.Current.IsMsFsshttpRequirementsCaptured)
            {
                //Verify MS-FSSHTTP requirement: MS-FSSHTTP_R22522
                Site.CaptureRequirementIfAreNotEqual <string>(
                    "Success",
                    amIAloneResponse.ErrorCode,
                    "MS-FSSHTTP",
                    22522,
                    @"[In AmIAloneSubResponseType]In the case of failure, the ErrorCode attribute that is part of a SubResponse element specifies the error code result for this subrequest. ");
            }
            else
            {
                Site.Assert.AreNotEqual <string>(
                    "Success",
                    amIAloneResponse.ErrorCode,
                    "In the case of failure, the ErrorCode attribute that is part of a SubResponse element specifies the error code result for this subrequest. ");
            }
        }
Example #16
0
        public void MSFSSHTTP_FSSHTTPB_S03_TC01_GetLock_FileNotExistsOrCannotBeCreated()
        {
            // Get a schema lock with a nonexistent file, expect the server returns the error code "FileNotExistsOrCannotBeCreated".
            string fileUrlNotExit = SharedTestSuiteHelper.GenerateNonExistFileUrl(this.Site);

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

            SchemaLockSubRequestType  subRequest            = SharedTestSuiteHelper.CreateSchemaLockSubRequest(SchemaLockRequestTypes.GetLock, false, null);
            CellStorageResponse       response              = Adapter.CellStorageRequest(fileUrlNotExit, new SubRequestType[] { subRequest });
            SchemaLockSubResponseType schemaLockSubResponse = SharedTestSuiteHelper.ExtractSubResponse <SchemaLockSubResponseType>(response, 0, 0, this.Site);

            if (SharedContext.Current.IsMsFsshttpRequirementsCaptured)
            {
                // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R1913
                Site.CaptureRequirementIfAreEqual <ErrorCodeType>(
                    ErrorCodeType.FileNotExistsOrCannotBeCreated,
                    SharedTestSuiteHelper.ConvertToErrorCodeType(schemaLockSubResponse.ErrorCode, this.Site),
                    "MS-FSSHTTP",
                    1913,
                    @"[In SchemaLock Subrequest][The protocol server returns results based on the following conditions:] If the protocol server was unable to find the URL for the file specified in the Url attribute, the protocol server reports a failure by returning an error code value set to ""FileNotExistsOrCannotBeCreated"" in the ErrorCode attribute sent back in the SubResponse element.");
            }
            else
            {
                Site.Assert.AreEqual <ErrorCodeType>(
                    ErrorCodeType.FileNotExistsOrCannotBeCreated,
                    SharedTestSuiteHelper.ConvertToErrorCodeType(schemaLockSubResponse.ErrorCode, this.Site),
                    @"[In SchemaLock Subrequest][The protocol server returns results based on the following conditions:] If the protocol server was unable to find the URL for the file specified in the Url attribute, the protocol server reports a failure by returning an error code value set to ""FileNotExistsOrCannotBeCreated"" in the ErrorCode attribute sent back in the SubResponse element.");
            }
        }
Example #17
0
        public void MSFSSHTTP_FSSHTTPB_S09_TC01_GetVersions_EmptyUrl()
        {
            // 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       response = Adapter.CellStorageRequest(string.Empty, new SubRequestType[] { getVersionsSubRequest });

            // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R3009
            if (Common.IsRequirementEnabled("MS-FSSHTTP-FSSHTTPB", 3009, this.Site))
            {
                if (SharedContext.Current.IsMsFsshttpRequirementsCaptured)
                {
                    Site.CaptureRequirementIfIsNull(
                        response.ResponseCollection,
                        "MS-FSSHTTP",
                        3009,
                        @"[In Appendix B: Product Behavior] If the Url attribute of the corresponding Request element is an empty string, the implementation does not return Response element. <8> Section 2.2.3.5:  SharePoint Server 2013 will not return Response element.");
                }
                else
                {
                    Site.Assert.IsNull(
                        response.ResponseCollection,
                        @"[In Appendix B: Product Behavior] If the Url attribute of the corresponding Request element is an empty string, the implementation does not return Response element. <8> Section 2.2.3.5:  SharePoint Server 2013 will not return Response element.");
                }
            }
        }
Example #18
0
        public void MSFSSHTTP_FSSHTTPB_TestCase_S17_TC01_FileOperation_EmptyUrl()
        {
            // Initialize the service
            this.InitializeContext(this.DefaultFileUrl, this.UserName01, this.Password01, this.Domain);

            string fileName = this.DefaultFileUrl.Substring(this.DefaultFileUrl.LastIndexOf("/", System.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(string.Empty, new SubRequestType[] { fileoperationSubRequest });

            if (Common.IsRequirementEnabled(11121, this.Site))
            {
                SubResponseType subresponse = cellStoreageResponse.ResponseCollection.Response[0].SubResponse[0];

                if (SharedContext.Current.IsMsFsshttpRequirementsCaptured)
                {
                    // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R11121
                    Site.CaptureRequirementIfAreNotEqual <string>(
                        GenericErrorCodeTypes.Success.ToString(),
                        subresponse.ErrorCode,
                        "MS-FSSHTTP",
                        11121,
                        @"[In FileOperationSubResponseType] In the case of failure, the ErrorCode attribute that is part of a SubResponse element specifies the error code result for this subrequest.");
                }
                else
                {
                    Site.Assert.AreNotEqual <string>(
                        GenericErrorCodeTypes.Success.ToString(),
                        subresponse.ErrorCode,
                        "Error should occur if call fileoperation request with empty url.");
                }
            }
        }
        public void TestCase_S08_TC01_GetDocMetaInfo_Success()
        {
            // Initialize the service
            this.InitializeContext(this.DefaultFileUrl, this.UserName01, this.Password01, this.Domain);

            // Invoke "GetDocMetaInfo"sub-request with correct input parameters.
            GetDocMetaInfoSubRequestType  getDocMetaInfoSubRequest  = SharedTestSuiteHelper.CreateGetDocMetaInfoSubRequest(SequenceNumberGenerator.GetCurrentToken());
            CellStorageResponse           cellStoreageResponse      = Adapter.CellStorageRequest(this.DefaultFileUrl, new SubRequestType[] { getDocMetaInfoSubRequest });
            GetDocMetaInfoSubResponseType getDocMetaInfoSubResponse = SharedTestSuiteHelper.ExtractSubResponse <GetDocMetaInfoSubResponseType>(cellStoreageResponse, 0, 0, this.Site);

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

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

                // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R1802
                Site.CaptureRequirementIfAreEqual <ErrorCodeType>(
                    ErrorCodeType.Success,
                    SharedTestSuiteHelper.ConvertToErrorCodeType(getDocMetaInfoSubResponse.ErrorCode, this.Site),
                    "MS-FSSHTTP",
                    1802,
                    @"[In GetDocMetaInfoSubResponseType] The protocol server sets the value of the ErrorCode attribute to ""Success"" if the protocol server succeeds in processing the GetDocMetaInfo subrequest.");

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

                // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R11050
                Site.CaptureRequirementIfIsNotNull(
                    getDocMetaInfoSubResponse.SubResponseData.DocProps,
                    "MS-FSSHTTP",
                    11050,
                    @"[In SubResponseDataGenericType] DocProps: An element of type GetDocMetaInfoPropertySetType (section 2.3.1.28) that specifies metadata properties pertaining to the server file.");

                // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R11051
                Site.CaptureRequirementIfIsNotNull(
                    getDocMetaInfoSubResponse.SubResponseData.FolderProps,
                    "MS-FSSHTTP",
                    11051,
                    @"[In SubResponseDataGenericType] FolderProps: An element of type GetDocMetaInfoPropertySetType (section 2.3.1.28) that specifies metadata properties pertaining to the parent directory of the server file.");
            }
            else
            {
                Site.Assert.AreEqual <ErrorCodeType>(
                    ErrorCodeType.Success,
                    SharedTestSuiteHelper.ConvertToErrorCodeType(getDocMetaInfoSubResponse.ErrorCode, this.Site),
                    @"[In GetDocMetaInfo Subrequest][The protocol returns results based on the following conditions:] Otherwise[the processing of the GetDocMetaInfo subrequest by the protocol server get the requested metadata successfully], the protocol server sets the error code value to ""Success"" to indicate success in processing the GetDocMetaInfo subrequest.");
            }
        }
Example #20
0
        public void MSFSSHTTP_FSSHTTPB_TestCase_S18_TC01_AmIAlone_False()
        {
            // Initialize the service
            this.InitializeContext(this.DefaultFileUrl, this.UserName01, this.Password01, this.Domain);

            // Join Coauthoring session using the first user
            CoauthSubRequestType  subRequest   = SharedTestSuiteHelper.CreateCoauthSubRequestForJoinCoauthSession(SharedTestSuiteHelper.DefaultClientID, SharedTestSuiteHelper.ReservedSchemaLockID);
            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.ReservedSchemaLockID));
            this.StatusManager.RecordCoauthSession(this.DefaultFileUrl, SharedTestSuiteHelper.DefaultClientID, SharedTestSuiteHelper.ReservedSchemaLockID);

            // Join the Coauthoring session using the second user with same SchemaLockId
            this.InitializeContext(this.DefaultFileUrl, this.UserName02, this.Password02, this.Domain);
            string secondClientId = System.Guid.NewGuid().ToString();

            subRequest   = SharedTestSuiteHelper.CreateCoauthSubRequestForJoinCoauthSession(secondClientId, SharedTestSuiteHelper.ReservedSchemaLockID);
            cellResponse = this.Adapter.CellStorageRequest(this.DefaultFileUrl, new SubRequestType[] { subRequest });
            CoauthSubResponseType secondResponse = SharedTestSuiteHelper.ExtractSubResponse <CoauthSubResponseType>(cellResponse, 0, 0, this.Site);

            this.StatusManager.RecordCoauthSession(this.DefaultFileUrl, secondClientId, SharedTestSuiteHelper.ReservedSchemaLockID, this.UserName02, this.Password02, this.Domain);

            string transitionId = secondResponse.SubResponseData.TransitionID;

            AmIAloneSubRequestType amIAlone = SharedTestSuiteHelper.CreateAmIAloneSubRequest();

            amIAlone.SubRequestData.TransitionID = transitionId;
            CellStorageResponse     response         = this.Adapter.CellStorageRequest(this.DefaultFileUrl, new SubRequestType[] { amIAlone });
            AmIAloneSubResponseType amIAloneResponse = SharedTestSuiteHelper.ExtractSubResponse <AmIAloneSubResponseType>(response, 0, 0, this.Site);

            if (SharedContext.Current.IsMsFsshttpRequirementsCaptured)
            {
                //Verify MS-FSSHTTP requirement: MS-FSSHTTP_R224912
                Site.CaptureRequirementIfAreEqual <string>(
                    "False",
                    amIAloneResponse.SubResponseData.AmIAlone,
                    "MS-FSSHTTP",
                    224912,
                    @"[In AmIAloneSubResponseDataType]AmIAlone: False means the user is not alone in the coauthoring session.");

                //Verify MS-FSSHTTP requirement: MS-FSSHTTP_R2181012
                //If MS-FSSHTTP224912 is verified, this requirement can be verified directly
                Site.CaptureRequirement(
                    "MS-FSSHTTP",
                    2181012,
                    @"[In SubResponseDataOptionalAttributes]AmIAlone: False means the user is not alone in the coauthoring session.");
            }
            else
            {
                Site.Assert.AreEqual <string>(
                    "False",
                    amIAloneResponse.SubResponseData.AmIAlone,
                    "AmIAlone: False means the user is not alone in the coauthoring session.");
            }
        }
Example #21
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.");
            }
        }
Example #22
0
        public void MSFSSHTTP_FSSHTTPB_S04_TC05_ConvertToSchema_ConvertToSchemaFailedFileCheckedOutByCurrentUser()
        {
            // 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.UserName01);
            }

            // Record the file check out status.
            this.StatusManager.RecordFileCheckOut(this.DefaultFileUrl, this.UserName01, this.Password01, this.Domain);

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

            CheckLockAvailability();

            // Get the exclusive lock with same user name on the checked out file.
            this.PrepareExclusiveLock(this.DefaultFileUrl, SharedTestSuiteHelper.DefaultExclusiveLockID);

            // Convert the current exclusive lock to a coauthoring shared lock on the already check out file, expect the server returns the error code "ConvertToSchemaFailedFileCheckedOutByCurrentUser".
            ExclusiveLockSubRequestType  subRequest        = SharedTestSuiteHelper.CreateExclusiveLockSubRequest(ExclusiveLockRequestTypes.ConvertToSchema);
            CellStorageResponse          response          = this.Adapter.CellStorageRequest(this.DefaultFileUrl, new SubRequestType[] { subRequest });
            ExclusiveLockSubResponseType exclusiveResponse = SharedTestSuiteHelper.ExtractSubResponse <ExclusiveLockSubResponseType>(response, 0, 0, this.Site);

            if (SharedContext.Current.IsMsFsshttpRequirementsCaptured)
            {
                // If the error code equals "FailedFileCheckedOutByCurrentUser", then capture MS-FSSHTTP_R1230,MS-FSSHTTP_R1949
                Site.CaptureRequirementIfAreEqual <ErrorCodeType>(
                    ErrorCodeType.ConvertToSchemaFailedFileCheckedOutByCurrentUser,
                    SharedTestSuiteHelper.ConvertToErrorCodeType(exclusiveResponse.ErrorCode, this.Site),
                    "MS-FSSHTTP",
                    1230,
                    @"[In ExclusiveLock Subrequest][If the protocol server gets an exclusive lock subrequest of type ""Convert to schema lock with] ""Convert to schema lock"" for a file, and the conversion fails because the file is checked out by the current client, the protocol server returns an error code value set to ""ConvertToSchemaFailedFileCheckedOutByCurrentUser"".");

                // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R1299
                Site.CaptureRequirementIfAreEqual <ErrorCodeType>(
                    ErrorCodeType.ConvertToSchemaFailedFileCheckedOutByCurrentUser,
                    SharedTestSuiteHelper.ConvertToErrorCodeType(exclusiveResponse.ErrorCode, this.Site),
                    "MS-FSSHTTP",
                    1299,
                    @"[In Convert to Schema Lock] The protocol server returns error codes according to the following rules: If the protocol server is unable to convert the exclusive lock to a shared lock on the file because the file is checked out by the current user, the protocol server returns an error code value set to ""ConvertToSchemaFailedFileCheckedOutByCurrentUser"".");

                // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R387
                Site.CaptureRequirementIfAreEqual <ErrorCodeType>(
                    ErrorCodeType.ConvertToSchemaFailedFileCheckedOutByCurrentUser,
                    SharedTestSuiteHelper.ConvertToErrorCodeType(exclusiveResponse.ErrorCode, this.Site),
                    "MS-FSSHTTP",
                    387,
                    @"[In LockAndCoauthRelatedErrorCodeTypes] ConvertToSchemaFailedFileCheckedOutByCurrentUser indicates an error when converting to a shared lock fails because the file is checked out by the current client.");
            }
            else
            {
                Site.Assert.AreEqual <ErrorCodeType>(
                    ErrorCodeType.ConvertToSchemaFailedFileCheckedOutByCurrentUser,
                    SharedTestSuiteHelper.ConvertToErrorCodeType(exclusiveResponse.ErrorCode, this.Site),
                    @"[In ExclusiveLock Subrequest][If the protocol server gets an exclusive lock subrequest of type ""Convert to schema lock with] ""Convert to schema lock"" for a file, and the conversion fails because the file is checked out by the current client, the protocol server returns an error code value set to ""ConvertToSchemaFailedFileCheckedOutByCurrentUser"".");
            }
        }
Example #23
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.");
            }
        }
        /// <summary>
        /// This method is used to check the user with specified client whether exist in a coauthoring session.
        /// </summary>
        /// <param name="fileUrl">Specify the file which is locked.</param>
        /// <param name="clientId">Specify the client ID.</param>
        /// <param name="schemaLockId">Specify the schemaLock ID.</param>
        /// <param name="userName">Specify the user name of the user who calls cell storage service.</param>
        /// <param name="password">Specify the password of the user who calls cell storage service.</param>
        /// <param name="domain">Specify the domain of the user who calls cell storage service.</param>
        /// <returns>Return true is exist in the coauthoring session, otherwise return false.</returns>
        protected bool IsPresentInCoauthSession(string fileUrl, string clientId, string schemaLockId, string userName, string password, string domain)
        {
            this.InitializeContext(fileUrl, userName, password, domain);
            CoauthSubRequestType  subRequest   = SharedTestSuiteHelper.CreateCoauthSubRequestForMarkTransitionComplete(clientId, schemaLockId);
            CellStorageResponse   cellResponse = this.Adapter.CellStorageRequest(fileUrl, new SubRequestType[] { subRequest });
            CoauthSubResponseType response     = SharedTestSuiteHelper.ExtractSubResponse <CoauthSubResponseType>(cellResponse, 0, 0, this.Site);

            return(SharedTestSuiteHelper.ConvertToErrorCodeType(response.ErrorCode, this.Site) == ErrorCodeType.Success);
        }
        public void TestCase_S17_TC01_FileOperation_Success()
        {
            // Initialize the context using user01 and defaultFileUrl.
            this.InitializeContext(this.DefaultFileUrl, this.UserName01, this.Password01, this.Domain);

            // Get the exclusive lock with all valid parameters, expect the server responses the error code "Success".
            ExclusiveLockSubRequestType  subRequest           = SharedTestSuiteHelper.CreateExclusiveLockSubRequest(ExclusiveLockRequestTypes.GetLock);
            CellStorageResponse          cellStoreageResponse = this.Adapter.CellStorageRequest(this.DefaultFileUrl, new SubRequestType[] { subRequest });
            ExclusiveLockSubResponseType exclusiveResponse    = SharedTestSuiteHelper.ExtractSubResponse <ExclusiveLockSubResponseType>(cellStoreageResponse, 0, 0, this.Site);

            this.Site.Assert.AreEqual <ErrorCodeType>(
                ErrorCodeType.Success,
                SharedTestSuiteHelper.ConvertToErrorCodeType(exclusiveResponse.ErrorCode, this.Site),
                "Test case cannot continue unless the Get Lock of ExclusiveLock sub request succeeds.");

            // Record the current file status.
            this.StatusManager.RecordExclusiveLock(this.DefaultFileUrl, subRequest.SubRequestData.ExclusiveLockID);

            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, SharedTestSuiteHelper.DefaultExclusiveLockID, this.Site);

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

            if (SharedContext.Current.IsMsFsshttpRequirementsCaptured)
            {
                // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R11146
                Site.CaptureRequirementIfAreEqual <string>(
                    "Success",
                    fileOperationSubResponse.ErrorCode,
                    "MS-FSSHTTP",
                    11109,
                    @"[In FileOperationSubRequestDataType] This parameter [ExclusiveLockID] is used to validate that the file operation can be performed even though the file is under exclusive lock.");

                // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R11120
                // This requirement can be captured directly after capturing MS-FSSHTTP_R11109
                Site.CaptureRequirement(
                    "MS-FSSHTTP",
                    11120,
                    @"[In FileOperationSubResponseType] In the case of success, it contains information requested as part of a file operation subrequest.");
            }
            else
            {
                Assert.AreEqual <string>(
                    "Success",
                    fileOperationSubResponse.ErrorCode,
                    "MS-FSSHTTP",
                    @"[In FileOperationSubRequestDataType] This parameter [ExclusiveLockID] is used to validate that the file operation can be performed even though the file is under exclusive lock.");
            }
        }
Example #26
0
        public void TestCase_S10_TC04_DependencyTypeOnNotSupported_Support()
        {
            // Initialize the service
            this.InitializeContext(this.DefaultFileUrl, this.UserName01, this.Password01, this.Domain);

            ExclusiveLockSubRequestType exclusiveLocksubRequest = SharedTestSuiteHelper.CreateExclusiveLockSubRequest(ExclusiveLockRequestTypes.GetLock);

            // Update the file contents when the coalesce is true.
            CellSubRequestType putChange = SharedTestSuiteHelper.CreateCellSubRequestEmbeddedPutChanges(SequenceNumberGenerator.GetCurrentFSSHTTPBSubRequestID(), System.Text.Encoding.Unicode.GetBytes(SharedTestSuiteHelper.GenerateRandomString(10)));

            putChange.SubRequestData.CoalesceSpecified = true;
            putChange.SubRequestData.Coalesce          = true;

            // Make a putChanges subRequest dependent on the exclusive lock and the dependency type is OnNotSupported.
            putChange.DependencyTypeSpecified = true;
            putChange.DependencyType          = DependencyTypes.OnNotSupported;
            putChange.DependsOn = exclusiveLocksubRequest.SubRequestToken;

            CellStorageResponse response = this.Adapter.CellStorageRequest(this.DefaultFileUrl, new SubRequestType[] { exclusiveLocksubRequest, putChange });

            ExclusiveLockSubResponseType exclusiveResponse = SharedTestSuiteHelper.ExtractSubResponse <ExclusiveLockSubResponseType>(response, 0, 0, this.Site);
            CellSubResponseType          putChanges        = SharedTestSuiteHelper.ExtractSubResponse <CellSubResponseType>(response, 0, 1, this.Site);

            this.Site.Assert.AreEqual <ErrorCodeType>(ErrorCodeType.Success, SharedTestSuiteHelper.ConvertToErrorCodeType(exclusiveResponse.ErrorCode, this.Site), "Test case cannot continue unless the get lock sub request succeeds.");
            this.StatusManager.RecordExclusiveLock(this.DefaultFileUrl, exclusiveLocksubRequest.SubRequestData.ExclusiveLockID);

            if (SharedContext.Current.IsMsFsshttpRequirementsCaptured)
            {
                // If the error code equals DependentOnlyOnNotSupportedRequestGetSupported, then capture R324 and R2244
                Site.CaptureRequirementIfAreEqual <ErrorCodeType>(
                    ErrorCodeType.DependentOnlyOnNotSupportedRequestGetSupported,
                    SharedTestSuiteHelper.ConvertToErrorCodeType(putChanges.ErrorCode, this.Site),
                    "MS-FSSHTTP",
                    324,
                    @"[In DependencyCheckRelatedErrorCodeTypes] DependentOnlyOnNotSupportedRequestGetSupported:
                         Indicates an error when the subrequest on which this specific subrequest is dependent is supported and the DependencyType attribute in this subrequest is set to ""OnNotSupported"" or [""OnSuccessOrOnNotSupported""].");

                // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R2244
                Site.CaptureRequirementIfAreEqual <ErrorCodeType>(
                    ErrorCodeType.DependentOnlyOnNotSupportedRequestGetSupported,
                    SharedTestSuiteHelper.ConvertToErrorCodeType(putChanges.ErrorCode, this.Site),
                    "MS-FSSHTTP",
                    2244,
                    @"[In DependencyTypes] OnNotSupported: Indicates that the subrequest MUST NOT be processed if the other subrequest is supported.");
            }
            else
            {
                Site.Assert.AreEqual <ErrorCodeType>(
                    ErrorCodeType.DependentOnlyOnNotSupportedRequestGetSupported,
                    SharedTestSuiteHelper.ConvertToErrorCodeType(putChanges.ErrorCode, this.Site),
                    @"[In DependencyCheckRelatedErrorCodeTypes] DependentOnlyOnNotSupportedRequestGetSupported:
                        Indicates an error when the subrequest on which this specific subrequest is dependent is supported and the DependencyType attribute in this subrequest is set to ""OnNotSupported"" or [""OnSuccessOrOnNotSupported""].");
            }
        }
Example #27
0
        public void MSFSSHTTP_FSSHTTPB_S04_TC02_GetExclusiveLock_CheckoutByCurrentClient()
        {
            // 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);
            }

            // Record the file check out status.
            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();
            }

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

            CheckLockAvailability();

            // Get the exclusive lock using the same user name comparing with the previous step for the already checked out file, expect the server responds the error code "Success".
            // Now the service channel is initialized using the userName01 account by default.
            ExclusiveLockSubRequestType  subRequest        = SharedTestSuiteHelper.CreateExclusiveLockSubRequest(ExclusiveLockRequestTypes.GetLock);
            CellStorageResponse          response          = this.Adapter.CellStorageRequest(this.DefaultFileUrl, new SubRequestType[] { subRequest });
            ExclusiveLockSubResponseType exclusiveResponse = SharedTestSuiteHelper.ExtractSubResponse <ExclusiveLockSubResponseType>(response, 0, 0, this.Site);

            if (SharedContext.Current.IsMsFsshttpRequirementsCaptured)
            {
                // If the error code equals "Success", then capture MS-FSSHTTP_R1247
                Site.CaptureRequirementIfAreEqual <ErrorCodeType>(
                    ErrorCodeType.Success,
                    SharedTestSuiteHelper.ConvertToErrorCodeType(exclusiveResponse.ErrorCode, this.Site),
                    "MS-FSSHTTP",
                    1247,
                    @"[In Get Lock] If the checkout of the file has been done by the current client, the protocol server MUST allow an exclusive lock on the file.");
            }
            else
            {
                Site.Assert.AreEqual <ErrorCodeType>(
                    ErrorCodeType.Success,
                    SharedTestSuiteHelper.ConvertToErrorCodeType(exclusiveResponse.ErrorCode, this.Site),
                    @"[In Get Lock] If the checkout of the file has been done by the current client, the protocol server MUST allow an exclusive lock on the file.");
            }

            // Record the file exclusive lock status.
            this.StatusManager.RecordExclusiveLock(this.DefaultFileUrl, subRequest.SubRequestData.ExclusiveLockID);
        }
Example #28
0
        public void MSFSSHTTP_FSSHTTPB_S04_TC07_ExclusiveLock_CellStorageWebServiceDisabled()
        {
            Site.Assume.IsTrue(Common.IsRequirementEnabled("MS-FSSHTTP-FSSHTTPB", 15181, this.Site), "This test case only runs when WebServiceTurnedOff is returned if this protocol is not enabled on server.");

            if (!this.SutPowerShellAdapter.SwitchCellStorageService(false))
            {
                this.Site.Assert.Fail("Cannot disable the cell storage web service.");
            }

            this.StatusManager.RecordDisableCellStorageService();

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

            // Call the GetExclusiveLock to expect fail.
            ExclusiveLockSubRequestType subRequest = SharedTestSuiteHelper.CreateExclusiveLockSubRequest(ExclusiveLockRequestTypes.GetLock);
            CellStorageResponse         response   = this.Adapter.CellStorageRequest(this.DefaultFileUrl, new SubRequestType[] { subRequest });

            this.Site.Log.Add(
                LogEntryKind.Debug,
                "When the cell storage service is turned off, the error code should be not null but actual {0}",
                response.ResponseVersion.ErrorCodeSpecified ? "is not null" : "null");

            if (SharedContext.Current.IsMsFsshttpRequirementsCaptured)
            {
                // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R15181
                Site.CaptureRequirementIfIsTrue(
                    response.ResponseVersion.ErrorCodeSpecified,
                    "MS-FSSHTTP",
                    15181,
                    @"[In ResponseVersion] This attribute[ErrorCode] MUST be present if any one of the following is true.
                         This protocol is not enabled on the protocol server.");

                // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R368
                Site.CaptureRequirementIfAreEqual <GenericErrorCodeTypes>(
                    GenericErrorCodeTypes.WebServiceTurnedOff,
                    response.ResponseVersion.ErrorCode,
                    "MS-FSSHTTP",
                    368,
                    @"[In GenericErrorCodeTypes] WebServiceTurnedOff indicates an error when the web service is turned off during the processing of the cell storage service request.");
            }
            else
            {
                Site.Assert.IsTrue(
                    response.ResponseVersion.ErrorCodeSpecified,
                    @"[In ResponseVersion] This attribute[ErrorCode] MUST be present if any one of the following is true.
                    This protocol is not enabled on the protocol server.");

                Site.Assert.AreEqual <GenericErrorCodeTypes>(
                    GenericErrorCodeTypes.WebServiceTurnedOff,
                    response.ResponseVersion.ErrorCode,
                    @"[In GenericErrorCodeTypes] WebServiceTurnedOff indicates an error when the web service is turned off during the processing of the cell storage service request.");
            }
        }
        public void MSFSSHTTP_FSSHTTPB_S02_TC05_JoinCoauthoringSession_CheckedOutByCurrentUser()
        {
            // Initialize the service
            this.InitializeContext(this.DefaultFileUrl, this.UserName01, this.Password01, this.Domain);

            // Check out the file
            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);

            CheckLockAvailability();

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

            this.Site.Assert.AreEqual(
                ErrorCodeType.Success,
                SharedTestSuiteHelper.ConvertToErrorCodeType(response.ErrorCode, this.Site),
                "The test case cannot continue unless the server response succeeds when the user join the coauthoring session with allowFallback set to true on an already checked out file by the same user.");
            this.StatusManager.RecordExclusiveLock(this.DefaultFileUrl, SharedTestSuiteHelper.DefaultExclusiveLockID);

            this.Site.Assert.AreEqual(
                "ExclusiveLock",
                response.SubResponseData.LockType,
                "The test case cannot continue unless the server responses an exclusive lock type when the user join the coauthoring session with allowFallback set to true on an already checked out file by the same user.");

            this.Site.Assert.IsTrue(
                response.SubResponseData.ExclusiveLockReturnReasonSpecified,
                "The test case cannot continue unless the server returns ExclusiveLockReturnReason attribute when the user join the coauthoring session with allowFallback set to true on an already checked out file by the same user.");

            if (SharedContext.Current.IsMsFsshttpRequirementsCaptured)
            {
                // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R350
                Site.CaptureRequirementIfAreEqual <ExclusiveLockReturnReasonTypes>(
                    ExclusiveLockReturnReasonTypes.CheckedOutByCurrentUser,
                    response.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 <ExclusiveLockReturnReasonTypes>(
                    ExclusiveLockReturnReasonTypes.CheckedOutByCurrentUser,
                    response.SubResponseData.ExclusiveLockReturnReason,
                    "The server should response when 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.");
            }
        }
Example #30
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.)");
            }
        }