GetContent() public method

Get all the content which is represented by the intermediate node object.
public GetContent ( ) : List
return List
Esempio n. 1
0
        /// <summary>
        /// This method is used to create the instance of AbstractChunking.
        /// </summary>
        /// <param name="nodeObject">Specify the root node object.</param>
        /// <returns>The instance of AbstractChunking.</returns>
        public static AbstractChunking CreateChunkingInstance(IntermediateNodeObject nodeObject)
        {
            byte[] fileContent = nodeObject.GetContent().ToArray();

            if (EditorsTableUtils.IsEditorsTableHeader(fileContent))
            {
                return(null);
            }

            if (ZipHeader.IsFileHeader(fileContent, 0))
            {
                return(new ZipFilesChunking(fileContent));
            }
            else
            {
                // For SharePoint Server 2013 compatible SUTs, always using the RDC Chunking method in the current test suite involved file resources.
                if (SharedContext.Current.CellStorageVersionType.MinorVersion >= 2)
                {
                    return(new RDCAnalysisChunking(fileContent));
                }

                // For SharePoint Server 2010 SP2 compatible SUTs, chunking method depends on file content and size. So first try using the simple chunking.
                AbstractChunking returnChunking = new SimpleChunking(fileContent);

                List <LeafNodeObject> nodes = returnChunking.Chunking();
                if (nodeObject.IntermediateNodeObjectList.Count == nodes.Count)
                {
                    bool isDataSizeMatching = true;
                    for (int i = 0; i < nodes.Count; i++)
                    {
                        if (nodeObject.IntermediateNodeObjectList[i].DataSize.DataSize != nodes[i].DataSize.DataSize)
                        {
                            isDataSizeMatching = false;
                            break;
                        }
                    }

                    if (isDataSizeMatching)
                    {
                        return(returnChunking);
                    }
                }

                // If the intermediate count number or data size does not equals, then try to use RDC chunking method.
                return(new RDCAnalysisChunking(fileContent));
            }
        }
        /// <summary>
        /// This method is used to verify the requirements related with the IntermediateNodeObject type.
        /// </summary>
        /// <param name="interNode">Specify the IntermediateNodeObject instance.</param>
        /// <param name="site">Specify the ITestSite instance.</param>
        public static void VerifyIntermediateNodeObject(IntermediateNodeObject interNode, ITestSite site)
        {
            // Verify MS-FSSHTTPD requirement: MS-FSSHTTPD_R69
            site.CaptureRequirement(
                     "MS-FSSHTTPD",
                     69,
                     @"[In Data Node Object Data] Binary data than specifies the contents of the chunk of the file that is represented by this Data Node.");

            // Verify MS-FSSHTTPD requirement: MS-FSSHTTPD_R62
            site.CaptureRequirementIfAreEqual<ulong>(
                     (ulong)interNode.GetContent().Count,
                     interNode.DataSize.DataSize,
                     "MS-FSSHTTPD",
                     62,
                     @"[In Intermediate Node Object Data] Data Size (8 bytes): An unsigned 64-bit integer that specifies the size of the file data represented by this Intermediate Node Object.");

            // Verify MS-FSSHTTPD requirement: MS-FSSHTTPD_R66
            site.CaptureRequirementIfAreEqual<ulong>(
                     (ulong)interNode.GetContent().Count,
                     interNode.DataSize.DataSize,
                     "MS-FSSHTTPD",
                     66,
                     @"[In Intermediate Node Object References] The size of the Data Node Object or the sum of the Data Size values from all of the Intermediate Node Objects MUST equal the Data Size specified in the Object Data of this Intermediate Node Object.");

            // Verify MS-FSSHTTPD requirement: MS-FSSHTTPD_R8015
            site.CaptureRequirement(
                     "MS-FSSHTTPD",
                     8015,
                     @"[In Intermediate Node Object References] The ordered set of Object Extended GUIDs MUST contain the Object Extended GUID of a single Data Node Object or an ordered list of Extended GUIDs for the Intermediate Node Object.");

            // Verify MS-FSSHTTPD requirement: MS-FSSHTTPD_R8017
            site.CaptureRequirement(
                     "MS-FSSHTTPD",
                     8017,
                     @"[In Intermediate Node Object References] Object Extended GUID Array entries MUST be ordered based on the sequential file bytes represented by each Node Object. ");
        }