/// <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(RootNodeObject 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 <IntermediateNodeObject> 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 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(RootNodeObject 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<IntermediateNodeObject> 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 RootNodeObject type. /// </summary> /// <param name="rootNode">Specify the RootNodeObject instance.</param> /// <param name="site">Specify the ITestSite instance.</param> public static void VerifyRootNodeObject(RootNodeObject rootNode, ITestSite site) { // Verify MS-FSSHTTPD requirement: MS-FSSHTTPD_R44 site.CaptureRequirementIfAreEqual<ulong>( (ulong)rootNode.GetContent().Count, rootNode.DataSize.DataSize, "MS-FSSHTTPD", 44, @"[In Root Node Object Data] Data Size (8 bytes): An unsigned 64-bit integer that specifies the size of the file data represented by this Root Node Object."); // Verify MS-FSSHTTPD requirement: MS-FSSHTTPD_R49 site.CaptureRequirementIfAreEqual<ulong>( (ulong)rootNode.GetContent().Count, rootNode.DataSize.DataSize, "MS-FSSHTTPD", 49, @"[In Root Node Object References] 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 Root Node Object."); // When after build the Root node object successfully, the following requirements can be directly captured. site.CaptureRequirement( "MS-FSSHTTPD", 48, @"[In Root Node Object References] Each Object Extended GUID MUST specify an Intermediate Node Object."); // Verify MS-FSSHTTPD requirement: MS-FSSHTTPD_R8011 site.CaptureRequirement( "MS-FSSHTTPD", 8011, @"[In Root Node Object References] The Object Extended GUID Array, as specified in [MS-FSSHTTPB] section 2.2.1.12.6.4, of the Root Node Object MUST specify an ordered set of Object Extended GUIDs. "); // Verify MS-FSSHTTPD requirement: MS-FSSHTTPD_R8012 site.CaptureRequirement( "MS-FSSHTTPD", 8012, @"[In Root Node Object References] Object Extended GUID Array entries MUST be ordered based on the sequential file bytes represented by each Node Object."); }