Пример #1
0
        public void MSONESTORE_S01_TC03_QueryOneFileWithoutFileData()
        {
            // Get the resource url that contains the file data.
            string resourceName = Common.GetConfigurationPropertyValue("OneFileWithoutFileData", Site);
            string url          = this.GetResourceUrl(resourceName);

            this.InitializeContext(url, this.UserName, this.Password, this.Domain);

            // Call QueryChange to get the data that is specified by above step.
            CellSubRequestType  cellSubRequest      = this.CreateCellSubRequestEmbeddedQueryChanges(SequenceNumberGenerator.GetCurrentSerialNumber());
            CellStorageResponse cellStorageResponse = this.SharedAdapter.CellStorageRequest(url, new SubRequestType[] { cellSubRequest });
            MSOneStorePackage   package             = this.ConvertOneStorePackage(cellStorageResponse);

            // Call adapter to load same file in local.
            OneNoteRevisionStoreFile file = this.Adapter.LoadOneNoteFile(resourceName);

            #region Capture code for Header Cell
            for (int i = 0; i < package.HeaderCell.ObjectData.Body.RgPrids.Length; i++)
            {
                PropertyID propId = package.HeaderCell.ObjectData.Body.RgPrids[i];
                if (propId.Value == 0x14001D93)
                {
                    FourBytesOfData crcData = package.HeaderCell.ObjectData.Body.RgData[i] as FourBytesOfData;

                    // Verify MS-ONESTORE requirement: MS-ONESTORE_R917
                    Site.CaptureRequirementIfAreEqual <uint>(
                        file.Header.crcName,
                        BitConverter.ToUInt32(crcData.Data, 0),
                        917,
                        @"[In Header Cell] FileNameCRC's PropertyID 0x14001D93 with value: MUST be the Header.crcName field.");
                }
                else if (propId.Value == 0x1C001D94)
                {
                    PrtFourBytesOfLengthFollowedByData guidFileData = package.HeaderCell.ObjectData.Body.RgData[i] as PrtFourBytesOfLengthFollowedByData;

                    // Verify MS-ONESTORE requirement: MS-ONESTORE_R912
                    Site.CaptureRequirementIfAreEqual <Guid>(
                        file.Header.guidFile,
                        new Guid(guidFileData.Data),
                        912,
                        @"[In Header Cell] [FileIdentityGuid] MUST be the value specified by the Header.guidFile field.");
                }
                else if (propId.Value == 0x1C001D95)
                {
                    PrtFourBytesOfLengthFollowedByData guidAncestorData = package.HeaderCell.ObjectData.Body.RgData[i] as PrtFourBytesOfLengthFollowedByData;

                    // Verify MS-ONESTORE requirement: MS-ONESTORE_R914
                    Site.CaptureRequirementIfAreEqual <Guid>(
                        file.Header.guidAncestor,
                        new Guid(guidAncestorData.Data),
                        914,
                        @"[In Header Cell] [FileAncestorIdentityGuid] MUST be the value specified by the Header.guidAncestor field.");
                }
            }
            #endregion

            #region Capture code for Revision
            List <RevisionManifest> revisionManifestList = new List <RevisionManifest>();

            foreach (ObjectSpaceManifestList objSpaceManifestList in file.RootFileNodeList.ObjectSpaceManifestList)
            {
                foreach (RevisionManifestList revManifestList in objSpaceManifestList.RevisionManifestList)
                {
                    revisionManifestList.AddRange(revManifestList.RevisionManifests);
                }
            }

            foreach (RevisionManifestDataElementData revisionManifestData in package.RevisionManifests)
            {
                ExGuid revisionId     = revisionManifestData.RevisionManifest.RevisionID;
                ExGuid baseRevisionId = revisionManifestData.RevisionManifest.BaseRevisionID;

                ExtendedGUID rid          = null;
                ExtendedGUID ridDependent = null;
                bool         isFound      = false;
                for (int i = 0; i < revisionManifestList.Count; i++)
                {
                    FileNode revisionStart = revisionManifestList[i].FileNodeSequence[0];
                    if (revisionStart.FileNodeID == FileNodeIDValues.RevisionManifestStart6FND)
                    {
                        rid          = ((RevisionManifestStart6FND)revisionStart.fnd).rid;
                        ridDependent = ((RevisionManifestStart6FND)revisionStart.fnd).ridDependent;
                    }
                    else if (revisionStart.FileNodeID == FileNodeIDValues.RevisionManifestStart7FND)
                    {
                        rid          = ((RevisionManifestStart7FND)revisionStart.fnd).Base.rid;
                        ridDependent = ((RevisionManifestStart7FND)revisionStart.fnd).Base.ridDependent;
                    }

                    if (rid.Guid == revisionId.GUID && rid.N == revisionId.Value)
                    {
                        isFound = true;
                        break;
                    }
                }

                // Verify MS-ONESTORE requirement: MS-ONESTORE_R925
                Site.CaptureRequirementIfIsTrue(
                    isFound,
                    925,
                    @"[In Revisions] § Revision ID: MUST be equal to the revision store file revision identifier (section 2.1.8).");

                // Verify MS-ONESTORE requirement: MS-ONESTORE_R926
                Site.CaptureRequirementIfIsTrue(
                    baseRevisionId.GUID == ridDependent.Guid && baseRevisionId.Value == ridDependent.N,
                    926,
                    @"[In Revisions] § Base Revision ID: MUST be equal to the revision store file dependency revision identifier (section 2.1.9).");

                ExGuid objectGroupId      = revisionManifestData.RevisionManifestObjectGroupReferencesList[0].ObjectGroupExtendedGUID;
                bool   isFoundObjectGroup = false;

                isFoundObjectGroup = package.DataRoot.Where(o => o.ObjectGroupID == objectGroupId).ToArray().Length > 0 ||
                                     package.OtherFileNodeList.Where(o => o.ObjectGroupID == objectGroupId).ToArray().Length > 0;

                // Verify MS-ONESTORE requirement: MS-ONESTORE_R935
                Site.CaptureRequirementIfIsTrue(
                    isFoundObjectGroup,
                    935,
                    @"[In Object Groups] The Revision Manifest Data Element structure, as specified in [MS-FSSHTTPB] section 2.2.1.12.5, that references an object group MUST specify the object group extended GUID to be equal to the revision store object group identifier.");
            }
            #endregion
        }
Пример #2
0
        /// <summary>
        /// This method is used to deserialize the PropertySet from the specified byte array and start index.
        /// </summary>
        /// <param name="byteArray">Specify the byte array.</param>
        /// <param name="startIndex">Specify the start index from the byte array.</param>
        /// <returns>Return the length in byte of the PropertySet.</returns>
        public int DoDeserializeFromByteArray(byte[] byteArray, int startIndex)
        {
            int index = startIndex;

            this.CProperties = BitConverter.ToUInt16(byteArray, index);
            index           += 2;
            this.RgPrids     = new PropertyID[this.CProperties];
            for (int i = 0; i < this.CProperties; i++)
            {
                PropertyID propertyID = new PropertyID();
                propertyID.DoDeserializeFromByteArray(byteArray, index);
                this.RgPrids[i] = propertyID;
                index          += 4;
            }
            this.RgData = new List <IProperty>();
            foreach (PropertyID propertyID in this.RgPrids)
            {
                IProperty property = null;
                switch ((PropertyType)propertyID.Type)
                {
                case PropertyType.NoData:
                case PropertyType.Bool:
                case PropertyType.ObjectID:
                case PropertyType.ContextID:
                case PropertyType.ObjectSpaceID:
                    property = new NoData();
                    break;

                case PropertyType.ArrayOfObjectIDs:
                case PropertyType.ArrayOfObjectSpaceIDs:
                case PropertyType.ArrayOfContextIDs:
                    property = new ArrayNumber();
                    break;

                case PropertyType.OneByteOfData:
                    property = new OneByteOfData();
                    break;

                case PropertyType.TwoBytesOfData:
                    property = new TwoBytesOfData();
                    break;

                case PropertyType.FourBytesOfData:
                    property = new FourBytesOfData();
                    break;

                case PropertyType.EightBytesOfData:
                    property = new EightBytesOfData();
                    break;

                case PropertyType.FourBytesOfLengthFollowedByData:
                    property = new PrtFourBytesOfLengthFollowedByData();
                    break;

                case PropertyType.ArrayOfPropertyValues:
                    property = new PrtArrayOfPropertyValues();
                    break;

                case PropertyType.PropertySet:
                    property = new PropertySet();
                    break;

                default:
                    break;
                }
                if (property != null)
                {
                    int len = property.DoDeserializeFromByteArray(byteArray, index);
                    this.RgData.Add(property);
                    index += len;
                }
            }

            return(index - startIndex);
        }