Example #1
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 TestCase_S06_TC01_ServerTime_Success()
        {
            // Initialize the service
            this.InitializeContext(this.DefaultFileUrl, this.UserName01, this.Password01, this.Domain);

            // Invoke "ServerTime"sub-request with correct input parameters.
            ServerTimeSubRequestType  serverTimeSubRequest  = SharedTestSuiteHelper.CreateServerTimeSubRequest(SequenceNumberGenerator.GetCurrentToken());
            CellStorageResponse       cellStoreageResponse  = Adapter.CellStorageRequest(this.DefaultFileUrl, new SubRequestType[] { serverTimeSubRequest });
            ServerTimeSubResponseType serverTimeSubResponse = SharedTestSuiteHelper.ExtractSubResponse <ServerTimeSubResponseType>(cellStoreageResponse, 0, 0, this.Site);

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

            if (SharedContext.Current.IsMsFsshttpRequirementsCaptured)
            {
                // If the error code in the sub-response equals "Success", then capture MS-FSSHTTP_R1342
                Site.CaptureRequirementIfAreEqual <ErrorCodeType>(
                    ErrorCodeType.Success,
                    SharedTestSuiteHelper.ConvertToErrorCodeType(serverTimeSubResponse.ErrorCode, this.Site),
                    "MS-FSSHTTP",
                    1342,
                    @"[In ServerTime Subrequest] The protocol returns results based on the following conditions: Otherwise [except: the processing of the ServerTime subrequest by the server fails to get the server time or encountered an unknown exception], the protocol server sets the error code value to ""Success"" to indicate success in processing the ServerTime subrequest.");

                bool isVerifyR737 = System.Convert.ToInt64(serverTimeSubResponse.SubResponseData.ServerTime) > 0;
                this.Site.Log.Add(
                    LogEntryKind.Debug,
                    "For MS-FSSHTTP_R737, expect the serverTime larger than 0, the actual value is " + serverTimeSubResponse.SubResponseData.ServerTime);

                // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R737
                Site.CaptureRequirementIfIsTrue(
                    isVerifyR737,
                    "MS-FSSHTTP",
                    737,
                    @"[In ServerTimeSubResponseDataType] ServerTime: A positive integer that specifies the server time, which is expressed as a tick count.");
            }
            else
            {
                Site.Assert.AreEqual <ErrorCodeType>(
                    ErrorCodeType.Success,
                    SharedTestSuiteHelper.ConvertToErrorCodeType(serverTimeSubResponse.ErrorCode, this.Site),
                    @"[In ServerTime Subrequest] The protocol returns results based on the following conditions: Otherwise [except: the processing of the ServerTime subrequest by the server fails to get the server time or encountered an unknown exception], the protocol server sets the error code value to ""Success"" to indicate success in processing the ServerTime subrequest.");

                bool isVerifyR737 = System.Convert.ToInt64(serverTimeSubResponse.SubResponseData.ServerTime) > 0;
                this.Site.Log.Add(
                    LogEntryKind.Debug,
                    "For MS-FSSHTTP_R737, expect the serverTime larger than 0, the actual value is " + serverTimeSubResponse.SubResponseData.ServerTime);

                Site.Assert.IsTrue(
                    isVerifyR737,
                    @"[In ServerTimeSubResponseDataType] ServerTime: A positive integer that specifies the server time, which is expressed as a tick count.");
            }
        }
Example #3
0
        public void TestCase_S10_TC07_InvalidRequestDependencyType()
        {
            if (!Common.IsRequirementEnabled("MS-FSSHTTP-FSSHTTPB", 325, this.Site))
            {
                Site.Assume.Inconclusive("Implementation does not return InvalidRequestDependencyType when the sub-request dependency type that is not valid.");
            }

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

            // Create a serverTime subRequest with all valid parameters.
            ServerTimeSubRequestType serverTimeSubRequest = SharedTestSuiteHelper.CreateServerTimeSubRequest(SequenceNumberGenerator.GetCurrentToken());

            // Create a WhoAmI subRequest with all valid parameters and depends on the serverTime subRequest.
            WhoAmISubRequestType whoAmiSubRequest = SharedTestSuiteHelper.CreateWhoAmISubRequest(SequenceNumberGenerator.GetCurrentToken());

            whoAmiSubRequest.DependencyType          = DependencyTypes.Invalid;
            whoAmiSubRequest.DependencyTypeSpecified = true;
            whoAmiSubRequest.DependsOn = serverTimeSubRequest.SubRequestToken;

            // Send the subRequest to the protocol server, expect the protocol server returns error code "InvalidRequestDependencyType".
            CellStorageResponse       response = this.Adapter.CellStorageRequest(this.DefaultFileUrl, new SubRequestType[] { serverTimeSubRequest, whoAmiSubRequest });
            ServerTimeSubResponseType serverTimeSubResponse = SharedTestSuiteHelper.ExtractSubResponse <ServerTimeSubResponseType>(response, 0, 0, this.Site);

            this.Site.Assert.AreEqual <ErrorCodeType>(ErrorCodeType.Success, SharedTestSuiteHelper.ConvertToErrorCodeType(serverTimeSubResponse.ErrorCode, this.Site), "The serverTime operation should succeed.");
            SchemaLockSubResponseType subResponse = SharedTestSuiteHelper.ExtractSubResponse <SchemaLockSubResponseType>(response, 0, 1, this.Site);

            if (SharedContext.Current.IsMsFsshttpRequirementsCaptured)
            {
                // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R325
                Site.CaptureRequirementIfAreEqual <ErrorCodeType>(
                    ErrorCodeType.InvalidRequestDependencyType,
                    SharedTestSuiteHelper.ConvertToErrorCodeType(subResponse.ErrorCode, this.Site),
                    "MS-FSSHTTP",
                    325,
                    @"[In DependencyCheckRelatedErrorCodeTypes] InvalidRequestDependencyType: 
                             Indicates an error when a subrequest dependency type that is not valid is specified. (Microsoft SharePoint Foundation 2010/Microsoft SharePoint Server 2010 follow this behavior.)");
            }
            else
            {
                Site.Assert.AreEqual <ErrorCodeType>(
                    ErrorCodeType.InvalidRequestDependencyType,
                    SharedTestSuiteHelper.ConvertToErrorCodeType(subResponse.ErrorCode, this.Site),
                    @"[In DependencyCheckRelatedErrorCodeTypes] InvalidRequestDependencyType: 
                        Indicates an error when a subrequest dependency type that is not valid is specified. (Microsoft SharePoint Foundation 2010/Microsoft SharePoint Server 2010 follow this behavior.)");
            }
        }
        public void MSFSSHTTP_FSSHTTPB_S06_TC01_ServerTime_EmptyUrl()
        {
            // Initialize the service
            this.InitializeContext(this.DefaultFileUrl, this.UserName01, this.Password01, this.Domain);

            // Create a serverTime subRequest with all valid parameters.
            ServerTimeSubRequestType subRequest = SharedTestSuiteHelper.CreateServerTimeSubRequest(SequenceNumberGenerator.GetCurrentToken());

            CellStorageResponse response = new CellStorageResponse();
            bool isR3008Verified         = false;

            try
            {
                // Send a ServerTime subRequest to the protocol server without specifying URL attribute.
                response = this.Adapter.CellStorageRequest(string.Empty, new SubRequestType[] { subRequest });
            }
            catch (System.Xml.XmlException exception)
            {
                string message = exception.Message;
                isR3008Verified  = message.Contains("Duplicate attribute");
                isR3008Verified &= message.Contains("ErrorCode");
            }

            if (SharedContext.Current.IsMsFsshttpRequirementsCaptured)
            {
                // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R3008
                if (Common.IsRequirementEnabled("MS-FSSHTTP-FSSHTTPB", 3008, this.Site))
                {
                    Site.Log.Add(
                        LogEntryKind.Debug,
                        "SharePoint server 2010 and SharePoint Foundation responses two ErrorCode attributes when the URL is non exists.");

                    Site.CaptureRequirementIfIsTrue(
                        isR3008Verified,
                        "MS-FSSHTTP",
                        3008,
                        @"[In Appendix B: Product Behavior] If the Url attribute of the corresponding Request element is an empty string, the implementation does return two ErrorCode attributes in Response element. <11> Section 2.2.3.5:  SharePoint Server 2010 will return 2 ErrorCode attributes in Response element.");
                }

                // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R3009
                if (Common.IsRequirementEnabled("MS-FSSHTTP-FSSHTTPB", 3009, this.Site))
                {
                    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. <11> Section 2.2.3.5:  SharePoint Server 2013 will not return Response element.");
                }
            }
            else
            {
                if (Common.IsRequirementEnabled("MS-FSSHTTP-FSSHTTPB", 3008, this.Site))
                {
                    Site.Log.Add(
                        LogEntryKind.Debug,
                        "SharePoint server 2010 and SharePoint Foundation responses two ErrorCode attributes when the URL is empty string.");

                    Site.Assert.IsTrue(
                        isR3008Verified,
                        "[In Appendix B: Product Behavior] If the URL attribute of the corresponding Request element is an empty string, the implementation does return two ErrorCode attributes in Response element. &lt;3&gt; Section 2.2.3.5:  SharePoint Server 2010 will return 2 ErrorCode attributes in Response element.");
                }

                if (Common.IsRequirementEnabled("MS-FSSHTTP-FSSHTTPB", 3009, this.Site))
                {
                    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 #5
0
        public void TestCase_S10_TC09_DependencyTypeOnExecute()
        {
            // Initialize the service
            this.InitializeContext(this.DefaultFileUrl, this.UserName01, this.Password01, this.Domain);

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

            // Create another coauthoring subRequest which depends on the previous coauthoring subRequest and set the dependency type to OnFail so as to make the second subRequest not executed.
            CoauthSubRequestType secondCoauthSubRequest = SharedTestSuiteHelper.CreateCoauthSubRequestForJoinCoauthSession(Guid.NewGuid().ToString(), SharedTestSuiteHelper.ReservedSchemaLockID);

            secondCoauthSubRequest.DependencyType          = DependencyTypes.OnFail;
            secondCoauthSubRequest.DependencyTypeSpecified = true;
            secondCoauthSubRequest.DependsOn = firstCoauthSubRequest.SubRequestToken;

            // Create a serverTime subRequest which depends on the second coauthoring subRequest and set the dependency type to OnExecute.
            // Create a ServerTime subRequest which depends on the coauthoring subRequest.
            ServerTimeSubRequestType serverTimeSubRequest = SharedTestSuiteHelper.CreateServerTimeSubRequest(SequenceNumberGenerator.GetCurrentToken());

            serverTimeSubRequest.DependsOn               = secondCoauthSubRequest.SubRequestToken;
            serverTimeSubRequest.DependencyType          = DependencyTypes.OnExecute;
            serverTimeSubRequest.DependencyTypeSpecified = true;

            // Send these three subRequests to the protocol server, expect the protocol server returns error code "Success" for the first coauthoring subRequest, returns "DependentOnlyOnFailRequestSucceeded" for the second coauthoring subRequest and returns "DependentRequestNotExecuted" for the severTime subRequest.
            CellStorageResponse response = this.Adapter.CellStorageRequest(this.DefaultFileUrl, new SubRequestType[] { firstCoauthSubRequest, secondCoauthSubRequest, serverTimeSubRequest });

            this.StatusManager.RecordCoauthSession(this.DefaultFileUrl, SharedTestSuiteHelper.DefaultClientID, SharedTestSuiteHelper.ReservedSchemaLockID);
            CoauthSubResponseType firstCoauthSubResponse = SharedTestSuiteHelper.ExtractSubResponse <CoauthSubResponseType>(response, 0, 0, this.Site);

            this.Site.Assert.AreEqual <ErrorCodeType>(ErrorCodeType.Success, SharedTestSuiteHelper.ConvertToErrorCodeType(firstCoauthSubResponse.ErrorCode, this.Site), "The first coauthoring operation should succeed.");
            CoauthSubResponseType secondCoauthSubResponse = SharedTestSuiteHelper.ExtractSubResponse <CoauthSubResponseType>(response, 0, 1, this.Site);

            this.Site.Assert.AreEqual <ErrorCodeType>(ErrorCodeType.DependentOnlyOnFailRequestSucceeded, SharedTestSuiteHelper.ConvertToErrorCodeType(secondCoauthSubResponse.ErrorCode, this.Site), "The second coauthoring operation should not be executed.");
            ServerTimeSubResponseType serverTimeSubResponse = SharedTestSuiteHelper.ExtractSubResponse <ServerTimeSubResponseType>(response, 0, 2, this.Site);

            if (SharedContext.Current.IsMsFsshttpRequirementsCaptured)
            {
                if (Common.IsRequirementEnabled("MS-FSSHTTP-FSSHTTPB", 332, this.Site))
                {
                    // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R332
                    Site.CaptureRequirementIfAreEqual <ErrorCodeType>(
                        ErrorCodeType.DependentRequestNotExecuted,
                        SharedTestSuiteHelper.ConvertToErrorCodeType(serverTimeSubResponse.ErrorCode, this.Site),
                        "MS-FSSHTTP",
                        332,
                        @"[In DependencyTypes] OnExecute:Indicates that the subrequest MUST be processed only on the execution of the other subrequest. (Microsoft SharePoint Foundation 2013/Microsoft SharePoint Server 2013 follow this behavior.)");

                    Site.CaptureRequirementIfAreEqual <ErrorCodeType>(
                        ErrorCodeType.DependentRequestNotExecuted,
                        SharedTestSuiteHelper.ConvertToErrorCodeType(serverTimeSubResponse.ErrorCode, this.Site),
                        "MS-FSSHTTP",
                        321,
                        @"[In DependencyCheckRelatedErrorCodeTypes] DependentRequestNotExecuted: 
                             Indicates an error when the subrequest on which this specific subrequest is dependent has not been executed and the DependencyType attribute in this subrequest is set to ""OnExecute"".");
                }
            }
            else
            {
                Site.Assert.AreEqual <ErrorCodeType>(
                    ErrorCodeType.DependentRequestNotExecuted,
                    SharedTestSuiteHelper.ConvertToErrorCodeType(serverTimeSubResponse.ErrorCode, this.Site),
                    @"[In DependencyTypes] OnExecute:Indicates that the subrequest MUST be processed only on the execution of the other subrequest. (Microsoft SharePoint Foundation 2013/Microsoft SharePoint Server 2013 follow this behavior.)");
            }
        }