Exemplo n.º 1
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);
        }
Exemplo n.º 2
0
 public override void Context()
 {
     _callCollection          = mock <ICallCollection>();
     _call                    = mock <ICall>();
     _sequenceNumberGenerator = mock <SequenceNumberGenerator>();
     _sequenceNumberGenerator.stub(x => x.Next()).Return(42);
 }
Exemplo n.º 3
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);
        }
Exemplo n.º 4
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);
        }
Exemplo n.º 5
0
        /// <summary>
        /// A method used to create a CellSubRequest object for QueryChanges and initialize it.
        /// </summary>
        /// <param name="subRequestId">A parameter represents the subRequest identifier.</param>
        /// <returns>A return value represents the CellRequest object for QueryChanges.</returns>
        private CellSubRequestType CreateCellSubRequestEmbeddedQueryChanges(ulong subRequestId)
        {
            FsshttpbCellRequest        cellRequest = this.CreateFsshttpbCellRequest();
            QueryChangesCellSubRequest queryChange = this.BuildFsshttpbQueryChangesSubRequest(subRequestId);

            cellRequest.AddSubRequest(queryChange, null);

            CellSubRequestType cellSubRequest = this.CreateCellSubRequest(SequenceNumberGenerator.GetCurrentToken(), cellRequest.ToBase64());

            return(cellSubRequest);
        }
        public void TestCase_S17_TC02_FileOperation_ErrorCode()
        {
            // Initialize the service
            this.InitializeContext(this.DefaultFileUrl, this.UserName01, this.Password01, this.Domain);

            FileOperationSubRequestType fileOperationSubRequest = new FileOperationSubRequestType();

            fileOperationSubRequest.SubRequestToken = SequenceNumberGenerator.GetCurrentToken().ToString();
            fileOperationSubRequest.SubRequestData  = new FileOperationSubRequestDataType();
            fileOperationSubRequest.SubRequestData.FileOperation          = FileOperationRequestTypes.Rename;
            fileOperationSubRequest.SubRequestData.FileOperationSpecified = false;
            fileOperationSubRequest.SubRequestData.ExclusiveLockID        = null;

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

            if (SharedContext.Current.IsMsFsshttpRequirementsCaptured)
            {
                // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R11267
                if (Common.IsRequirementEnabled("MS-FSSHTTP-FSSHTTPB", 11267, this.Site))
                {
                    // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R11267
                    Site.CaptureRequirementIfAreEqual <GenericErrorCodeTypes>(
                        GenericErrorCodeTypes.InvalidArgument,
                        cellStoreageResponse.ResponseVersion.ErrorCode,
                        "MS-FSSHTTP",
                        11267,
                        @"[In Appendix B: Product Behavior]  If the specified attributes[FileOperation] are not provided, the implementation does return error code. &lt;33&gt; Section 2.3.1.33:  SharePoint Server 2010 returns an ""InvalidArgument"" error code as part of the SubResponseData element associated with the file operation subresponse(Microsoft Office 2010 suites/Microsoft SharePoint Foundation 2010/Microsoft SharePoint Server 2010/Microsoft SharePoint Workspace 2010 follow this behavior.)");
                }

                // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R11268
                if (Common.IsRequirementEnabled("MS-FSSHTTP-FSSHTTPB", 11268, this.Site))
                {
                    // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R11268
                    Site.CaptureRequirementIfAreEqual <GenericErrorCodeTypes>(
                        GenericErrorCodeTypes.HighLevelExceptionThrown,
                        cellStoreageResponse.ResponseVersion.ErrorCode,
                        "MS-FSSHTTP",
                        11268,
                        @"[In Appendix B: Product Behavior]  If the specified attributes[FileOperation] are not provided, the implementation does return error code. &lt;33&gt; Section 2.3.1.33:  SharePoint Server 2013 and SharePoint Server 2016, return ""HighLevelExceptionThrown"" error code as part of the SubResponseData element associated with the file operation subresponse(Microsoft SharePoint Foundation 2013/Microsoft SharePoint Server 2013/Microsoft SharePoint Server 2016 follow this behavior).");
                }
            }

            else
            {
                if (Common.IsRequirementEnabled("MS-FSSHTTP-FSSHTTPB", 11267, this.Site))
                {
                    // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R11267
                    Site.Assert.AreEqual <GenericErrorCodeTypes>(
                        GenericErrorCodeTypes.HighLevelExceptionThrown,
                        cellStoreageResponse.ResponseVersion.ErrorCode,
                        @"[In Appendix B: Product Behavior] If the specified attributes[FileOperation attribute] are not provided, the implementation does return an ""InvalidArgument"" error code as part of the SubResponseData element associated with the file opeartion subresponse. (Microsoft Office 2010 suites/Microsoft SharePoint Foundation 2010/Microsoft SharePoint Server 2010/Microsoft SharePoint Workspace 2010/Microsoft Office 2016/Microsoft SharePoint Server 2016/Microsoft Office 2019/Microsoft SharePoint Server 2019 follow this behavior.)");
                }
            }
        }
        public async Task Generate_Works()
        {
            var sng       = new SequenceNumberGenerator();
            var current   = sng.Generate();
            var currentUL = ulong.Parse(current);
            await Task.Delay(TimeSpan.FromSeconds(1));

            var next   = sng.Generate();
            var nextUL = ulong.Parse(next);

            Assert.Equal(1UL, nextUL - currentUL);
        }
        public async Task CanGenerateSequenceNumbers()
        {
            var sut = new SequenceNumberGenerator();

            Assert.AreEqual(1, sut.NewSequenceNumber(SequenceName));
            Assert.AreEqual(2, sut.NewSequenceNumber(SequenceName));
            Assert.AreEqual(1, sut.NewSequenceNumber(OtherSequenceName));
            var sequenceNumbers = (await Task.WhenAll(Enumerable.Range(0, 1000).Select(i => Task.Run(() => sut.NewSequenceNumber(SequenceName))))).ToList();

            Assert.AreEqual(sequenceNumbers.Distinct().Count(), sequenceNumbers.Count);
            Assert.IsTrue(Enumerable.Range(0, 1000).All(i => sequenceNumbers.Contains(i + 3)));
        }
Exemplo n.º 9
0
 public RouteFactory(SequenceNumberGenerator sequenceNumberGenerator,
                     IThreadLocalContext threadLocalContext,
                     ICallSpecificationFactory callSpecificationFactory,
                     IReceivedCallsExceptionThrower receivedCallsExceptionThrower,
                     IPropertyHelper propertyHelper,
                     IDefaultForType defaultForType)
 {
     _sequenceNumberGenerator       = sequenceNumberGenerator;
     _threadLocalContext            = threadLocalContext;
     _callSpecificationFactory      = callSpecificationFactory;
     _receivedCallsExceptionThrower = receivedCallsExceptionThrower;
     _propertyHelper = propertyHelper;
     _defaultForType = defaultForType;
 }
Exemplo n.º 10
0
 public RouteFactory(SequenceNumberGenerator sequenceNumberGenerator,
                     IThreadLocalContext threadLocalContext,
                     ICallSpecificationFactory callSpecificationFactory,
                     IReceivedCallsExceptionThrower receivedCallsExceptionThrower,
                     IPropertyHelper propertyHelper,
                     IDefaultForType defaultForType)
 {
     _sequenceNumberGenerator       = sequenceNumberGenerator ?? throw new ArgumentNullException(nameof(sequenceNumberGenerator));
     _threadLocalContext            = threadLocalContext ?? throw new ArgumentNullException(nameof(threadLocalContext));
     _callSpecificationFactory      = callSpecificationFactory ?? throw new ArgumentNullException(nameof(callSpecificationFactory));
     _receivedCallsExceptionThrower = receivedCallsExceptionThrower ?? throw new ArgumentNullException(nameof(receivedCallsExceptionThrower));
     _propertyHelper = propertyHelper ?? throw new ArgumentNullException(nameof(propertyHelper));
     _defaultForType = defaultForType ?? throw new ArgumentNullException(nameof(defaultForType));
 }
        public void TestCase_S17_TC02_FileOperation_ErrorCode()
        {
            // Initialize the service
            this.InitializeContext(this.DefaultFileUrl, this.UserName01, this.Password01, this.Domain);

            FileOperationSubRequestType fileOperationSubRequest = new FileOperationSubRequestType();

            fileOperationSubRequest.SubRequestToken = SequenceNumberGenerator.GetCurrentToken().ToString();
            fileOperationSubRequest.SubRequestData  = new FileOperationSubRequestDataType();
            fileOperationSubRequest.SubRequestData.FileOperation = FileOperationRequestTypes.Rename;
            fileOperationSubRequest.SubRequestData.FileOperationRequestTypeSpecified = false;
            fileOperationSubRequest.SubRequestData.ExclusiveLockID = null;

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

            FileOperationSubResponseType subResponse = SharedTestSuiteHelper.ExtractSubResponse <FileOperationSubResponseType>(cellStoreageResponse, 0, 0, this.Site);
            ErrorCodeType errorCode = SharedTestSuiteHelper.ConvertToErrorCodeType(subResponse.ErrorCode, this.Site);

            if (SharedContext.Current.IsMsFsshttpRequirementsCaptured)
            {
                // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R11267
                if (Common.IsRequirementEnabled("MS-FSSHTTP-FSSHTTPB", 11267, this.Site))
                {
                    // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R11267
                    Site.CaptureRequirementIfAreEqual <ErrorCodeType>(
                        ErrorCodeType.InvalidArgument,
                        errorCode,
                        "MS-FSSHTTP",
                        11267,
                        @"[In Appendix B: Product Behavior] If the specified attributes[FileOperationRequestType attribute] are not provided, the implementation does return an ""InvalidArgument"" error code as part of the SubResponseData element associated with the file opeartion subresponse. (Microsoft Office 2010 suites/Microsoft SharePoint Foundation 2010/Microsoft SharePoint Server 2010/Microsoft SharePoint Workspace 2010/Microsoft Office 2016/Microsoft SharePoint Server 2016 follow this behavior.)");
                }
            }

            else
            {
                if (Common.IsRequirementEnabled("MS-FSSHTTP-FSSHTTPB", 11267, this.Site))
                {
                    // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R11267
                    Site.Assert.AreEqual <ErrorCodeType>(
                        ErrorCodeType.InvalidArgument,
                        errorCode,
                        @"[In Appendix B: Product Behavior] If the specified attributes[FileOperationRequestType attribute] are not provided, the implementation does return an ""InvalidArgument"" error code as part of the SubResponseData element associated with the file opeartion subresponse. (Microsoft Office 2010 suites/Microsoft SharePoint Foundation 2010/Microsoft SharePoint Server 2010/Microsoft SharePoint Workspace 2010/Microsoft Office 2016/Microsoft SharePoint Server 2016 follow this behavior.)");
                }
            }
        }
Exemplo n.º 12
0
        public async Task <string> GetNextSequenceNumber(string name)
        {
            object userCompanyId;

            TenantContext.Properties.TryGetValue("CompanyId", out userCompanyId);

            if (userCompanyId != null && typeof(ICompanyEntity <Guid?, Guid, TKey>).IsAssignableFrom(typeof(TEntity)))
            {
                var companyId = Guid.Parse(userCompanyId.ToString());
                var sequence  = await DbContext.Set <SequenceNumber>()
                                .Where(e => e.TenantId == RepositoryManager.Tenant.Id &&
                                       e.CompanyId == companyId &&
                                       e.Name == name &&
                                       e.Active &&
                                       !e.Deleted)
                                .FirstOrDefaultAsync();

                if (sequence != null)
                {
                    var generator = new SequenceNumberGenerator()
                                    .SetPrefix(sequence.Prefix)
                                    .SetSuffix(sequence.Suffix)
                                    .SetLeftPadding(sequence.LeftPadding, sequence.LeftPaddingChar)
                                    .SetRightPadding(sequence.RightPadding, sequence.RightPaddingChar)
                                    .SetEndCyclePosition(sequence.EndCyclePosition, sequence.CycleSequence)
                                    .SetResetValue(sequence.ResetValue)
                                    .SetStartingValue(sequence.StartingValue);
                    var sequenceNo = generator.GenerateSequenceNumber();
                    sequence.StartingValue = generator.StartingValue;
                    DbContext.Set <SequenceNumber>().Update(sequence);
                    return(await Task.FromResult(sequenceNo));
                }
            }

            return(null);
        }
Exemplo n.º 13
0
        public void TestCase_S14_TC02_AllocateExtendedGuidRange_ReservedIgnore()
        {
            // Initialize the service
            this.InitializeContext(this.DefaultFileUrl, this.UserName01, this.Password01, this.Domain);

            FsshttpbCellRequest fsshttpRequest = SharedTestSuiteHelper.CreateFsshttpbCellRequest();
            AllocateExtendedGuidRangeCellSubRequest allocateExtendedGuidRange = new AllocateExtendedGuidRangeCellSubRequest(new Compact64bitInt(8000), SequenceNumberGenerator.GetCurrentFSSHTTPBSubRequestID());

            // Make the reserved value equal to 0.
            allocateExtendedGuidRange.Reserved = 0;
            fsshttpRequest.AddSubRequest(allocateExtendedGuidRange, null);
            CellSubRequestType  cellSubRequest  = SharedTestSuiteHelper.CreateCellSubRequest((ulong)SequenceNumberGenerator.GetCurrentToken(), fsshttpRequest.ToBase64());
            CellStorageResponse response        = this.Adapter.CellStorageRequest(this.DefaultFileUrl, new SubRequestType[] { cellSubRequest });
            CellSubResponseType cellSubResponse = SharedTestSuiteHelper.ExtractSubResponse <CellSubResponseType>(response, 0, 0, this.Site);

            this.Site.Assert.AreEqual <ErrorCodeType>(
                ErrorCodeType.Success,
                SharedTestSuiteHelper.ConvertToErrorCodeType(cellSubResponse.ErrorCode, this.Site),
                "Test case cannot continue unless the allocate extended guid range operation on the file {0} succeed.",
                this.DefaultFileUrl);

            FsshttpbResponse fsshttpbResponse = SharedTestSuiteHelper.ExtractFsshttpbResponse(cellSubResponse, this.Site);

            SharedTestSuiteHelper.ExpectMsfsshttpbSubResponseSucceed(fsshttpbResponse, this.Site);

            FsshttpbCellRequest fsshttpRequestSecond = SharedTestSuiteHelper.CreateFsshttpbCellRequest();
            AllocateExtendedGuidRangeCellSubRequest allocateExtendedGuidRangeSecond = new AllocateExtendedGuidRangeCellSubRequest(new Compact64bitInt(8000), SequenceNumberGenerator.GetCurrentFSSHTTPBSubRequestID());

            // Make the reserved value equal to 1.
            allocateExtendedGuidRangeSecond.Reserved = 1;
            fsshttpRequestSecond.AddSubRequest(allocateExtendedGuidRangeSecond, null);
            CellSubRequestType  cellSubRequestSecond  = SharedTestSuiteHelper.CreateCellSubRequest((ulong)SequenceNumberGenerator.GetCurrentToken(), fsshttpRequestSecond.ToBase64());
            CellStorageResponse responseSecond        = this.Adapter.CellStorageRequest(this.DefaultFileUrl, new SubRequestType[] { cellSubRequestSecond });
            CellSubResponseType cellSubResponseSecond = SharedTestSuiteHelper.ExtractSubResponse <CellSubResponseType>(responseSecond, 0, 0, this.Site);

            this.Site.Assert.AreEqual <ErrorCodeType>(
                ErrorCodeType.Success,
                SharedTestSuiteHelper.ConvertToErrorCodeType(cellSubResponseSecond.ErrorCode, this.Site),
                "Test case cannot continue unless the allocate extended guid range operation on the file {0} succeed.",
                this.DefaultFileUrl);

            FsshttpbResponse fsshttpbResponseSecond = SharedTestSuiteHelper.ExtractFsshttpbResponse(cellSubResponseSecond, this.Site);

            SharedTestSuiteHelper.ExpectMsfsshttpbSubResponseSucceed(fsshttpbResponseSecond, this.Site);

            // Compare this two responses roughly, and if these two responses are identical in main part, then capture the requirement MS-FSSHTTPB_R2189
            bool isVerifyR2189 = SharedTestSuiteHelper.ComapreSucceedFsshttpAllocateExtendedGuidRangeResposne(fsshttpbResponse, fsshttpbResponseSecond, this.Site);

            this.Site.Log.Add(TestTools.LogEntryKind.Debug, "Expect the two allocate extended GUID range responses are same, actual {0}", isVerifyR2189);

            if (SharedContext.Current.IsMsFsshttpRequirementsCaptured)
            {
                // Verify MS-FSSHTTPB requirement: MS-FSSHTTPB_R2189
                Site.CaptureRequirementIfIsTrue(
                    isVerifyR2189,
                    "MS-FSSHTTPB",
                    2189,
                    @"[In Allocate Extended GUID Range] A - Reserved (8 bits): Whenever A - Reserved is set to one or zero, the protocol server must return the same response.");
            }
            else
            {
                Site.Assert.IsTrue(
                    isVerifyR2189,
                    @"[In Allocate Extended GUID Range] A - Reserved (8 bits): Whenever A - Reserved is set to one or zero, the protocol server must return the same response.");
            }
        }
Exemplo n.º 14
0
        public void TestCase_S05_TC01_WhoAmI_Success()
        {
            // Initialize the service
            this.InitializeContext(this.DefaultFileUrl, this.UserName01, this.Password01, this.Domain);

            // Invoke "WhoAmI"sub-request with correct input parameters.
            WhoAmISubRequestType  whoAmISubRequest     = SharedTestSuiteHelper.CreateWhoAmISubRequest(SequenceNumberGenerator.GetCurrentToken());
            CellStorageResponse   cellStoreageResponse = Adapter.CellStorageRequest(this.DefaultFileUrl, new SubRequestType[] { whoAmISubRequest });
            WhoAmISubResponseType whoAmISubResponse    = SharedTestSuiteHelper.ExtractSubResponse <WhoAmISubResponseType>(cellStoreageResponse, 0, 0, this.Site);

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

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

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

                // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R7681
                Site.CaptureRequirementIfIsNotNull(
                    whoAmISubResponse.SubResponseData,
                    "MS-FSSHTTP",
                    7681,
                    @"[In WhoAmISubResponseType] As part of processing the WhoAmI subrequest, the SubResponseData element MUST be sent as part of the SubResponse element in a cell storage service response message if the following condition is true:
                         The ErrorCode attribute that is part of the SubResponse element is set to a value of ""Success"".");

                bool isVerifyR904 = whoAmISubResponse.SubResponseData.UserName.IndexOf(this.UserName01, System.StringComparison.OrdinalIgnoreCase) >= 0;
                this.Site.Log.Add(
                    LogEntryKind.Debug,
                    "For MS-FSSHTTP_R904, expect the UserName attribute contains the value {0}, the actual UserName attribute value is {1}",
                    this.UserName01,
                    whoAmISubResponse.SubResponseData.UserName);

                // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R904
                Site.CaptureRequirementIfIsTrue(
                    isVerifyR904,
                    "MS-FSSHTTP",
                    904,
                    @"[In WhoAmISubResponseDataOptionalAttributes] UserName: [A UserNameType] that specifies the user name for the protocol client.");
            }
            else
            {
                Site.Assert.AreEqual <ErrorCodeType>(
                    ErrorCodeType.Success,
                    SharedTestSuiteHelper.ConvertToErrorCodeType(whoAmISubResponse.ErrorCode, this.Site),
                    @"[In WhoAmI Subrequest] The protocol server returns results based on the following conditions: Otherwise[except: the processing of the WhoAmI subrequest by the protocol server failed to get the client-specific user information or encountered an unknown exception], the protocol server sets the error code value to ""Success"" to indicate success in processing the WhoAmI subrequest.");

                Site.Assert.IsNotNull(
                    whoAmISubResponse.SubResponseData,
                    @"[In WhoAmISubResponseType] As part of processing the WhoAmI subrequest, the SubResponseData element MUST be sent as part of the SubResponse element in a cell storage service response message if the following condition is true:
                        The ErrorCode attribute that is part of the SubResponse element is set to a value of ""Success"".");

                bool isVerifyR904 = whoAmISubResponse.SubResponseData.UserName.IndexOf(this.UserName01, System.StringComparison.OrdinalIgnoreCase) >= 0;
                Site.Assert.IsTrue(
                    isVerifyR904,
                    @"[In WhoAmISubResponseDataOptionalAttributes] UserName: [A UserNameType] that specifies the user name for the client.");
            }
        }
Exemplo n.º 15
0
        public void TestCase_S09_TC01_GetVersions_Success()
        {
            // Initialize the service
            this.InitializeContext(this.DefaultFileUrl, this.UserName01, this.Password01, this.Domain);

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

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

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

                // Capture the requirement MS-FSSHTTP_R10004
                Site.CaptureRequirement(
                    "MS-FSSHTTP",
                    10004,
                    @"[In Appendix B: Product Behavior] Implementation does support this operation[GetVersions]. (Microsoft SharePoint Foundation 2013/Microsoft SharePoint Server 2013 follow this behavior.)");
            }
            else
            {
                Site.Assert.AreEqual <ErrorCodeType>(
                    ErrorCodeType.Success,
                    SharedTestSuiteHelper.ConvertToErrorCodeType(getVersionsSubResponse.ErrorCode, this.Site),
                    @"[In GetVersions Subrequest][The protocol returns results based on the following conditions:] 
                            Otherwise[the processing of the GetVersions subrequest by the protocol server get the requested versions information successfully], the protocol server sets the error code value to ""Success"" to indicate success in processing the GetVersions subrequest.");
            }
        }
Exemplo n.º 16
0
        public void TestCase_S09_TC05_GetVersions_Success_Results_VersionData()
        {
            string documentLibraryName = Common.GetConfigurationPropertyValue("MSFSSHTTPFSSHTTPBLibraryName", this.Site);

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

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

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

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

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

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

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

            this.StatusManager.CancelRecordCheckOut(fileUrl);

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

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

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

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

            this.StatusManager.CancelRecordCheckOut(fileUrl);

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

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

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

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

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

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

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

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

            bool isFindVersion    = false;
            bool isNotStartWithAt = false;

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

            if (SharedContext.Current.IsMsFsshttpRequirementsCaptured)
            {
                // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R2310
                Site.CaptureRequirementIfIsTrue(
                    isNotStartWithAt,
                    "MS-FSSHTTP",
                    2310,
                    @"[In GetVersionsSubResponseType][VersionData complex type] version: All the other versions MUST exist without any prefix. ");
            }
            else
            {
                Site.Assert.IsTrue(
                    isNotStartWithAt,
                    @"[In GetVersionsSubResponseType][VersionData complex type] version: All the other versions MUST exist without any prefix. ");
            }
        }
Exemplo n.º 17
0
 private void C_Seq(string args)
 {
     string[] parts = Chop(args);
     string key = parts[0];
     string fmt = parts.Length > 1 ? parts[1] : "0";
     int min = parts.Length > 2 ? int.Parse(parts[2]) : 1;
     int step = parts.Length > 3 ? int.Parse(parts[3]) : 1;
     int max = parts.Length > 4 ? int.Parse(parts[4]) : int.MaxValue;
     _NumberGenerators[key] = new SequenceNumberGenerator(fmt, min, step, max).GetEnumerator();
 }
Exemplo n.º 18
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.");
                }
            }
        }
Exemplo n.º 19
0
        public void TestCase_S11_TC01_QueryAccessReadWrite()
        {
            // Initialize the service
            this.InitializeContext(this.DefaultFileUrl, this.UserName01, this.Password01, this.Domain);

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

            this.Site.Assert.AreEqual(ErrorCodeType.Success, SharedTestSuiteHelper.ConvertToErrorCodeType(querySubResponse.ErrorCode, this.Site), "The operation QueryChanges should succeed.");
            FsshttpbResponse fsshttpbResponse = SharedTestSuiteHelper.ExtractFsshttpbResponse(querySubResponse, this.Site);
            ExGuid           storageIndex     = fsshttpbResponse.CellSubResponses[0].GetSubResponseData <QueryChangesSubResponseData>().StorageIndexExtendedGUID;

            // Create a putChanges cellSubRequest
            FsshttpbCellRequest cellRequest = SharedTestSuiteHelper.CreateFsshttpbCellRequest();
            ExGuid                   storageIndexExGuid;
            List <DataElement>       dataElements = DataElementUtils.BuildDataElements(System.Text.Encoding.Unicode.GetBytes("bad"), out storageIndexExGuid);
            PutChangesCellSubRequest putChange    = new PutChangesCellSubRequest(SequenceNumberGenerator.GetCurrentFSSHTTPBSubRequestID(), storageIndexExGuid);

            putChange.ExpectedStorageIndexExtendedGUID = storageIndex;
            dataElements.AddRange(fsshttpbResponse.DataElementPackage.DataElements);
            cellRequest.AddSubRequest(putChange, dataElements);
            CellSubRequestType putChangesSubRequest = SharedTestSuiteHelper.CreateCellSubRequest(SequenceNumberGenerator.GetCurrentToken(), cellRequest.ToBase64());

            // Put changes to the protocol server
            CellStorageResponse response        = Adapter.CellStorageRequest(this.DefaultFileUrl, new SubRequestType[] { putChangesSubRequest });
            CellSubResponseType cellSubResponse = SharedTestSuiteHelper.ExtractSubResponse <CellSubResponseType>(response, 0, 0, this.Site);

            // Expect the Put changes operation succeeds
            this.Site.Assert.AreEqual(ErrorCodeType.Success, SharedTestSuiteHelper.ConvertToErrorCodeType(cellSubResponse.ErrorCode, this.Site), "The PutChanges operation should succeed.");
            SharedTestSuiteHelper.ExpectMsfsshttpbSubResponseSucceed(SharedTestSuiteHelper.ExtractFsshttpbResponse(cellSubResponse, this.Site), this.Site);

            // Call QueryAccess.
            CellSubRequestType  cellSubRequest      = SharedTestSuiteHelper.CreateCellSubRequestEmbeddedQueryAccess(0);
            CellStorageResponse cellStorageResponse = this.Adapter.CellStorageRequest(this.DefaultFileUrl, new SubRequestType[] { cellSubRequest });
            CellSubResponseType subResponse         = SharedTestSuiteHelper.ExtractSubResponse <CellSubResponseType>(cellStorageResponse, 0, 0, this.Site);
            FsshttpbResponse    queryAccessResponse = SharedTestSuiteHelper.ExtractFsshttpbResponse(subResponse, this.Site);

            // Get readAccessResponse and writeAccessResponse Data.
            HRESULTError dataRead = queryAccessResponse.CellSubResponses[0]
                                    .GetSubResponseData <QueryAccessSubResponseData>()
                                    .ReadAccessResponse.ReadResponseError
                                    .GetErrorData <HRESULTError>();

            this.Site.Assert.AreEqual <int>(
                0,
                dataRead.ErrorCode,
                "Test case cannot continue unless the read HRESULTError code equals 0 when the user have read/write permission.");

            HRESULTError dataWrite = queryAccessResponse.CellSubResponses[0]
                                     .GetSubResponseData <QueryAccessSubResponseData>()
                                     .WriteAccessResponse.WriteResponseError
                                     .GetErrorData <HRESULTError>();

            if (SharedContext.Current.IsMsFsshttpRequirementsCaptured)
            {
                // If the error type is HRESULTError, then capture R946.
                Site.CaptureRequirementIfIsNotNull(
                    dataWrite,
                    "MS-FSSHTTPB",
                    946,
                    @"[In Query Access] Response Error (variable): If the Put Changes operation will succeed, the response error will have an error type of HRESULT error.");

                // If the error type is HRESULTError and error code equals 0, then capture R2229.
                Site.CaptureRequirementIfAreEqual <int>(
                    0,
                    dataWrite.ErrorCode,
                    "MS-FSSHTTPB",
                    2229,
                    @"[In Query Access] Response Error (variable): [If the Put Changes operation will succeed, ]the HRESULT error code will be zero.");

                // If error code equals 0, then capture R2231.
                Site.CaptureRequirementIfAreEqual <int>(
                    0,
                    dataWrite.ErrorCode,
                    "MS-FSSHTTPB",
                    2231,
                    @"[In HRESULT Error] Error Code (4 bytes): Zero means that no error occurred.");
            }
            else
            {
                Site.Assert.IsNotNull(
                    dataWrite,
                    @"[In Query Access] Response Error (variable): If the Put Changes operation will succeed, the response error will have an error type of HRESULT error.");

                Site.Assert.AreEqual <int>(
                    0,
                    dataWrite.ErrorCode,
                    @"[In Query Access] Response Error (variable): [If the Put Changes operation will succeed, ]the HRESULT error code will be zero.");
            }
        }
        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.");
                }
            }
        }
Exemplo n.º 21
0
        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.");
            }
        }
Exemplo n.º 22
0
        public void MSFSSHTTP_FSSHTTPB_S01_TC01_DownloadContents_EmptyUrl()
        {
            if ((!Common.IsRequirementEnabled("MS-FSSHTTP-FSSHTTPB", 3008, this.Site)) &&
                (!Common.IsRequirementEnabled("MS-FSSHTTP-FSSHTTPB", 3009, this.Site)))
            {
                Site.Assume.Inconclusive("Implementation does not have same behaviors as Microsoft products.");
            }

            // Initialize the context using user01 and defaultFileUrl.
            this.InitializeContext(this.DefaultFileUrl, this.UserName01, this.Password01, this.Domain);

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

            try
            {
                // Query the updated file content.
                CellSubRequestType queryChange = SharedTestSuiteHelper.CreateCellSubRequestEmbeddedQueryChanges(SequenceNumberGenerator.GetCurrentFSSHTTPBSubRequestID());
                response = Adapter.CellStorageRequest(string.Empty, new SubRequestType[] { queryChange });
            }
            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 empty.");

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

                    Site.Assert.IsTrue(
                        isR3008Verified,
                        "SharePoint server 2010 and SharePoint Foundation responses two ErrorCode attributes when the URL is non exists.");
                }

                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.");
                }
            }
        }
Exemplo n.º 23
0
        public void TestCase_S14_TC01_AllocateExtendedGuidRange_Success()
        {
            // Initialize the service
            this.InitializeContext(this.DefaultFileUrl, this.UserName01, this.Password01, this.Domain);

            // Allocate Extended GUID Range
            Compact64bitInt     requestIdCount  = new Compact64bitInt(8000);
            CellSubRequestType  allocateRequest = SharedTestSuiteHelper.CreateCellSubRequestEmbeddedAllocateExtendedGuidRange((int)SequenceNumberGenerator.GetCurrentToken(), SequenceNumberGenerator.GetCurrentFSSHTTPBSubRequestID(), requestIdCount);
            CellStorageResponse response        = this.Adapter.CellStorageRequest(this.DefaultFileUrl, new SubRequestType[] { allocateRequest });
            CellSubResponseType cellSubResponse = SharedTestSuiteHelper.ExtractSubResponse <CellSubResponseType>(response, 0, 0, this.Site);

            this.Site.Assert.AreEqual <ErrorCodeType>(
                ErrorCodeType.Success,
                SharedTestSuiteHelper.ConvertToErrorCodeType(cellSubResponse.ErrorCode, this.Site),
                "Test case cannot continue unless the allocate extended guid range operation on the file {0} succeed.",
                this.DefaultFileUrl);

            FsshttpbResponse fsshttpbResponse = SharedTestSuiteHelper.ExtractFsshttpbResponse(cellSubResponse, this.Site);

            SharedTestSuiteHelper.ExpectMsfsshttpbSubResponseSucceed(fsshttpbResponse, this.Site);

            // Extract the Allocate ExtendedGuid Range sub-response info
            this.Site.Assert.IsTrue(fsshttpbResponse.CellSubResponses.Count > 0, "The protocol server should return SubResponse for Allocate ExtendedGuid Range sub-request processing.");
            this.Site.Assert.IsNotNull(fsshttpbResponse.CellSubResponses[0].GetSubResponseData <AllocateExtendedGuidRangeSubResponseData>(), "The protocol server should return SubResponseData for Allocate ExtendedGuid Range sub-request processing.");

            AllocateExtendedGuidRangeSubResponseData allocateResponse = fsshttpbResponse.CellSubResponses[0].GetSubResponseData <AllocateExtendedGuidRangeSubResponseData>();

            // Assert for elements in Allocate Extended Guid Range sub-response
            this.Site.Assert.IsNotNull(allocateResponse.AllocateExtendedGUIDRangeResponse, "The protocol server should return Allocate Extended GUID Range Response.");
            this.Site.Assert.IsNotNull(allocateResponse.GUIDComponent, "The protocol server should allocate ExtendedGuids as requested.");
            this.Site.Assert.IsNotNull(allocateResponse.IntegerRangeMin, "The protocol server should return an integer Range Min in the sub-response.");
            this.Site.Assert.IsNotNull(allocateResponse.IntegerRangeMax, "The protocol server should return an integer Range Max in the sub-response.");

            if (SharedContext.Current.IsMsFsshttpRequirementsCaptured)
            {
                // Verify MS-FSSHTTPB requirement: MS-FSSHTTPB_R9005
                Site.CaptureRequirement(
                    "MS-FSSHTTPB",
                    99099,
                    @"[In Appendix B: Product Behavior] The implementation does support this sub-request [Allocate ExtendedGuid Range Sub-Request]( SharePoint Server 2013 and above follow this behavior.)");
            }

            // Allocate Extended GUID Range value less than 1000.
            requestIdCount  = new Compact64bitInt(100);
            allocateRequest = SharedTestSuiteHelper.CreateCellSubRequestEmbeddedAllocateExtendedGuidRange((int)SequenceNumberGenerator.GetCurrentToken(), SequenceNumberGenerator.GetCurrentFSSHTTPBSubRequestID(), requestIdCount);
            response        = this.Adapter.CellStorageRequest(this.DefaultFileUrl, new SubRequestType[] { allocateRequest });
            cellSubResponse = SharedTestSuiteHelper.ExtractSubResponse <CellSubResponseType>(response, 0, 0, this.Site);
            this.Site.Assert.AreEqual <ErrorCodeType>(
                ErrorCodeType.Success,
                SharedTestSuiteHelper.ConvertToErrorCodeType(cellSubResponse.ErrorCode, this.Site),
                "Test case cannot continue unless the allocate extended guid range operation on the file {0} succeed.",
                this.DefaultFileUrl);

            // Allocate Extended GUID Range value less than 100000.
            requestIdCount  = new Compact64bitInt(150000);
            allocateRequest = SharedTestSuiteHelper.CreateCellSubRequestEmbeddedAllocateExtendedGuidRange((int)SequenceNumberGenerator.GetCurrentToken(), SequenceNumberGenerator.GetCurrentFSSHTTPBSubRequestID(), requestIdCount);
            response        = this.Adapter.CellStorageRequest(this.DefaultFileUrl, new SubRequestType[] { allocateRequest });
            cellSubResponse = SharedTestSuiteHelper.ExtractSubResponse <CellSubResponseType>(response, 0, 0, this.Site);
            this.Site.Assert.AreEqual <ErrorCodeType>(
                ErrorCodeType.Success,
                SharedTestSuiteHelper.ConvertToErrorCodeType(cellSubResponse.ErrorCode, this.Site),
                "Test case cannot continue unless the allocate extended guid range operation on the file {0} succeed.",
                this.DefaultFileUrl);
        }
Exemplo n.º 24
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.");
                }
            }
        }
Exemplo n.º 25
0
        public void TestCase_S09_TC02_GetVersions_Success_Results_ListId()
        {
            // Initialize the service
            this.InitializeContext(this.DefaultFileUrl, this.UserName01, this.Password01, this.Domain);

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

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

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

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

                // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R2302
                Site.CaptureRequirementIfAreEqual <System.Guid>(
                    new System.Guid(expectedListGuid),
                    new System.Guid(getVersionsSubResponse.GetVersionsResponse.GetVersionsResult.results.list.id),
                    "MS-FSSHTTP",
                    2302,
                    @"[In GetVersionsSubResponseType][Results complex type] list.id: Specifies the GUID of the document library in which the file resides.");
            }
            else
            {
                Site.Assert.AreEqual <System.Guid>(
                    new System.Guid(expectedListGuid),
                    new System.Guid(getVersionsSubResponse.GetVersionsResponse.GetVersionsResult.results.list.id),
                    @"[In GetVersionsSubResponseType][Results complex type] list.id: Specifies the GUID of the document library in which the file resides.");
            }
        }
Exemplo n.º 26
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.");
            }
        }
Exemplo n.º 27
0
        public void TestCase_S09_TC04_GetVersions_Success_Results_VersioningEnabled()
        {
            // Initialize the service
            this.InitializeContext(this.DefaultFileUrl, this.UserName01, this.Password01, this.Domain);

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

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

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

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

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

                // If the value of "versioning enabled" is 1 under "results" element in the sub-response, then capture MS-FSSHTTP_R2305.
                Site.CaptureRequirementIfAreEqual <byte>(
                    1,
                    getVersionsSubResponse.GetVersionsResponse.GetVersionsResult.results.versioning.enabled,
                    "MS-FSSHTTP",
                    2305,
                    @"[In GetVersionsSubResponseType][Results complex type] versioning.enabled: a value of ""1"" indicates that versioning is enabled. ");
            }
            else
            {
                Site.Assert.AreEqual <byte>(
                    1,
                    getVersionsSubResponse.GetVersionsResponse.GetVersionsResult.results.versioning.enabled,
                    @"[In GetVersionsSubResponseType][Results complex type] versioning.enabled: a value of ""1"" indicates that versioning is enabled. ");
            }
        }
Exemplo n.º 28
0
        public void TestCase_S11_TC02_QueryAccessRead()
        {
            string readOnlyUser         = Common.GetConfigurationPropertyValue("ReadOnlyUser", this.Site);
            string readOnlyUserPassword = Common.GetConfigurationPropertyValue("ReadOnlyUserPwd", this.Site);

            // Initialize the service
            this.InitializeContext(this.DefaultFileUrl, readOnlyUser, readOnlyUserPassword, this.Domain);

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

            this.Site.Assert.AreEqual(
                ErrorCodeType.Success,
                SharedTestSuiteHelper.ConvertToErrorCodeType(querySubResponse.ErrorCode, this.Site),
                "The operation QueryChanges should succeed when the user {0} only has ViewOnly permission.",
                readOnlyUser);

            this.Site.Assert.IsFalse(
                fsshttpbResponse.CellSubResponses[0].Status,
                "The operation QueryChanges should succeed when the user {0} only has ViewOnly permission.",
                readOnlyUser);

            // Call QueryAccess
            CellSubRequestType  cellSubRequest      = SharedTestSuiteHelper.CreateCellSubRequestEmbeddedQueryAccess(0);
            CellStorageResponse cellStorageResponse = this.Adapter.CellStorageRequest(this.DefaultFileUrl, new SubRequestType[] { cellSubRequest });
            CellSubResponseType subResponse         = SharedTestSuiteHelper.ExtractSubResponse <CellSubResponseType>(cellStorageResponse, 0, 0, this.Site);
            FsshttpbResponse    queryAccessResponse = SharedTestSuiteHelper.ExtractFsshttpbResponse(subResponse, this.Site);

            // Get readAccessResponse and writeAccessResponse Data.
            HRESULTError dataRead = queryAccessResponse.CellSubResponses[0]
                                    .GetSubResponseData <QueryAccessSubResponseData>()
                                    .ReadAccessResponse.ReadResponseError
                                    .GetErrorData <HRESULTError>();

            if (SharedContext.Current.IsMsFsshttpRequirementsCaptured)
            {
                // If the error type is HRESULTError, then capture R944.
                Site.CaptureRequirementIfIsNotNull(
                    dataRead,
                    "MS-FSSHTTPB",
                    944,
                    @"[In Query Access] Response Error (variable): If read operations will succeed, the response error will have an error type of HRESULT error.");

                // If HResult is 0,MS-FSSHTTPB_R2228 should be covered.
                Site.CaptureRequirementIfAreEqual <int>(
                    0,
                    dataRead.ErrorCode,
                    "MS-FSSHTTPB",
                    2228,
                    @"[In Query Access] Response Error (variable): [If read operations will succeed, ]the HRESULT error code will be zero.");
            }
            else
            {
                Site.Assert.IsNotNull(
                    dataRead,
                    @"[In Query Access] Response Error (variable): If read operations will succeed, the response error will have an error type of HRESULT error.");

                Site.Assert.AreEqual <int>(
                    0,
                    dataRead.ErrorCode,
                    @"[In Query Access] Response Error (variable): [If read operations will succeed, ]the HRESULT error code will be zero.");
            }

            HRESULTError dataWrite = queryAccessResponse.CellSubResponses[0]
                                     .GetSubResponseData <QueryAccessSubResponseData>()
                                     .WriteAccessResponse.WriteResponseError
                                     .GetErrorData <HRESULTError>();

            this.Site.Assert.AreNotEqual <int>(
                0,
                dataWrite.ErrorCode,
                "Test case cannot continue unless the write HRESULTError code not equals 0 when the user have read permission.");
        }
        public void TestCase_S17_TC03_ResourceIDNotChanged()
        {
            // Initialize the service
            this.InitializeContext(this.DefaultFileUrl, this.UserName01, this.Password01, this.Domain);

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

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

            VersionType version = cellStoreageResponse.ResponseVersion as VersionType;

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

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

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

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

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

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

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

            if (SharedContext.Current.IsMsFsshttpRequirementsCaptured)
            {
                // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R11026
                Site.CaptureRequirementIfAreEqual <string>(
                    resourceID,
                    resourceID2,
                    "MS-FSSHTTP",
                    11026,
                    @"[In Response] [ResourceID] A ResourceID MUST NOT change over the lifetime of a file, even if the URL of the file changes.");
            }
            else
            {
                Site.Assert.AreEqual <string>(
                    resourceID, resourceID2, "ResourceID MUST NOT change over the lifetime of a file, even if the URL of the file changes.");
            }
        }
        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.");
            }
        }
        public void TestCase_S17_TC04_ResourceIdDoesNotExist()
        {
            string invalidUrl = this.DefaultFileUrl + "Invalid";

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

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

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

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

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

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