Esempio n. 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.");
            }
        }
Esempio n. 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.)");
            }
        }
        /// <summary>
        /// Capture requirements related with ServerTime Sub-request.
        /// </summary>
        /// <param name="servertimeSubResponse">The SubResponse information.</param>
        /// <param name="site">Instance of ITestSite</param>
        public static void ValidateServerTimeSubResponse(ServerTimeSubResponseType servertimeSubResponse, ITestSite site)
        {
            // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R4691
            site.CaptureRequirementIfAreEqual <Type>(
                typeof(ServerTimeSubResponseType),
                servertimeSubResponse.GetType(),
                "MS-FSSHTTP",
                4691,
                @"[In SubResponseElementGenericType] Depending on the Type attribute specified in the SubRequest element, the SubResponseElementGenericType MUST take one of the forms: ServerTimeSubResponseType.");

            // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R5745
            site.CaptureRequirementIfAreEqual <Type>(
                typeof(ServerTimeSubResponseType),
                servertimeSubResponse.GetType(),
                "MS-FSSHTTP",
                5745,
                @"[In SubResponseType] The SubResponseElementGenericType takes one of the following forms: ServerTimeSubResponseType.");

            // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R746
            site.CaptureRequirement(
                "MS-FSSHTTP",
                746,
                @"[In ServerTimeSubResponseType][ServerTimeSubResponseType schema is:]
                     <xs:complexType name=""ServerTimeSubResponseType"">
                       <xs:complexContent>
                         <xs:extension base=""tns:SubResponseType"">
                          <xs:sequence minOccurs=""1"" maxOccurs=""1"">
                            <xs:element name=""SubResponseData"" type=""tns:ServerTimeSubResponseDataType""/>
                          </xs:sequence>
                         </xs:extension>
                       </xs:complexContent>
                     </xs:complexType>");

            // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R1331
            site.CaptureRequirementIfAreEqual <Type>(
                typeof(ServerTimeSubResponseType),
                servertimeSubResponse.GetType(),
                "MS-FSSHTTP",
                1331,
                @"[In ServerTime Subrequest][The protocol client sends a ServerTime SubRequest message, which is of ServerTimeSubRequestType] The protocol server responds with a ServerTime SubResponse message, which is of type ServerTimeSubResponseType as specified in section 2.3.1.19.");

            ErrorCodeType errorCode;

            site.Assert.IsTrue(Enum.TryParse <ErrorCodeType>(servertimeSubResponse.ErrorCode, true, out errorCode), "Fail to convert the error code string {0} to the Enum type ErrorCodeType", servertimeSubResponse.ErrorCode);
            if (errorCode == ErrorCodeType.Success)
            {
                // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R266
                // If servertimeSubResponse.SubResponseData is not null, SubResponseData element is sent.
                site.Log.Add(
                    LogEntryKind.Debug,
                    "For requirement MS-FSSHTTP_R266, the SubResponseData element should be sent as part of the SubResponse element in a cell storage service response message, the actual SubResponseData value is: {0}",
                    servertimeSubResponse.SubResponseData != null ? servertimeSubResponse.SubResponseData.ToString() : "NULL");

                site.CaptureRequirementIfIsNotNull(
                    servertimeSubResponse.SubResponseData,
                    "MS-FSSHTTP",
                    266,
                    @"[In SubResponseElementGenericType][The SubResponseData element MUST be sent as part of the SubResponse element in a cell storage service response message if the ErrorCode attribute that is part of the SubResponse element is set to a value of ""Success"" and one of the following conditions is true:] The Type attribute that is specified in the SubRequest element is set to a value of ""ServerTime"".");
            }

            // Verify requirements related with its base type: SubResponseType
            ValidateSubResponseType(servertimeSubResponse as SubResponseType, site);

            // Verify requirements related with ServerTimeSubResponseDataType
            if (servertimeSubResponse.SubResponseData != null)
            {
                ValidateServerTimeSubResponseDataType(servertimeSubResponse.SubResponseData, site);
            }
        }
Esempio n. 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.)");
            }
        }