A 9-byte encoding of values in the range 0x0002000000000000 through 0xFFFFFFFFFFFFFFFF
Inheritance: BasicObject
        /// <summary>
        /// Deserialize sub response data from byte array.
        /// </summary>
        /// <param name="byteArray">The byte array which contains sub response data.</param>
        /// <param name="currentIndex">The index special where to start.</param>
        protected override void DeserializeSubResponseDataFromByteArray(byte[] byteArray, ref int currentIndex)
        {
            int index = currentIndex;

            int headerLength = 0;
            StreamObjectHeaderStart header;

            if ((headerLength = StreamObjectHeaderStart.TryParse(byteArray, index, out header)) == 0)
            {
                throw new ResponseParseErrorException(index, "Failed to parse the AllocateExtendedGuidRangeData stream object header", null);
            }

            if (header.Type != StreamObjectTypeHeaderStart.AllocateExtendedGUIDRangeResponse)
            {
                throw new ResponseParseErrorException(index, "Failed to extract the AllocateExtendedGuidRangeData stream object header type, unexpected value " + header.Type, null);
            }

            this.AllocateExtendedGUIDRangeResponse = new StreamObjectHeaderStart32bit(header.Type, header.Length);
            index += headerLength;
            int currentTmpIndex = index;

            byte[] guidarray = new byte[16];
            Array.Copy(byteArray, index, guidarray, 0, 16);
            this.GUIDComponent = new Guid(guidarray);
            index += 16;
            this.IntegerRangeMin = BasicObject.Parse <Compact64bitInt>(byteArray, ref index);
            this.IntegerRangeMax = BasicObject.Parse <Compact64bitInt>(byteArray, ref index);

            if (index - currentTmpIndex != header.Length)
            {
                throw new ResponseParseErrorException(-1, "AllocateExtendedGuidRangeData object over-parse error", null);
            }

            currentIndex = index;
        }
Exemplo n.º 2
0
 /// <summary>
 /// Initializes a new instance of the AllocateExtendedGuidRangeCellSubRequest class
 /// </summary>
 /// <param name="requestIDCount">A compact unsigned 64-bit integer that specifies the number of extended Guids to allocate.</param>
 /// <param name="subRequestID">Specify the sub-request id</param>
 public AllocateExtendedGuidRangeCellSubRequest(Compact64bitInt requestIDCount, ulong subRequestID)
 {
     this.RequestID   = subRequestID;
     this.RequestType = Convert.ToUInt64(RequestTypes.AllocateExtendedGuidRange);
     this.AllocateExtendedGuidRangeRequest = new StreamObjectHeaderStart32bit(StreamObjectTypeHeaderStart.AllocateExtendedGUIDRangeRequest, requestIDCount.SerializeToByteList().Count + 1);
     this.RequestIDCount = requestIDCount;
 }
        /// <summary>
        /// Deserialize sub response data from byte array.
        /// </summary>
        /// <param name="byteArray">The byte array which contains sub response data.</param>
        /// <param name="currentIndex">The index special where to start.</param>
        protected override void DeserializeSubResponseDataFromByteArray(byte[] byteArray, ref int currentIndex)
        {
            int index = currentIndex;

            int headerLength = 0;
            StreamObjectHeaderStart header;
            if ((headerLength = StreamObjectHeaderStart.TryParse(byteArray, index, out header)) == 0)
            {
                throw new ResponseParseErrorException(index, "Failed to parse the AllocateExtendedGuidRangeData stream object header", null);
            }

            if (header.Type != StreamObjectTypeHeaderStart.AllocateExtendedGUIDRangeResponse)
            {
                throw new ResponseParseErrorException(index, "Failed to extract the AllocateExtendedGuidRangeData stream object header type, unexpected value " + header.Type, null);
            }

            this.AllocateExtendedGUIDRangeResponse = new StreamObjectHeaderStart32bit(header.Type, header.Length);
            index += headerLength;
            int currentTmpIndex = index;
            byte[] guidarray = new byte[16];
            Array.Copy(byteArray, index, guidarray, 0, 16);
            this.GUIDComponent = new Guid(guidarray);
            index += 16;
            this.IntegerRangeMin = BasicObject.Parse<Compact64bitInt>(byteArray, ref index);
            this.IntegerRangeMax = BasicObject.Parse<Compact64bitInt>(byteArray, ref index);

            if (index - currentTmpIndex != header.Length)
            {
                throw new ResponseParseErrorException(-1, "AllocateExtendedGuidRangeData object over-parse error", null);
            }

            currentIndex = index;
        }
Exemplo n.º 4
0
        /// <summary>
        /// This method is used to deserialize the FileChunk basic object 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 FileChunk basic object.</returns>
        protected override int DoDeserializeFromByteArray(byte[] byteArray, int startIndex)
        {
            int index = startIndex;

            this.Start  = BasicObject.Parse <Compact64bitInt>(byteArray, ref index);
            this.Length = BasicObject.Parse <Compact64bitInt>(byteArray, ref index);

            return(index - startIndex);
        }
        /// <summary>
        /// Used to de-serialize the element.
        /// </summary>
        /// <param name="byteArray">A Byte array</param>
        /// <param name="currentIndex">Start position</param>
        /// <param name="lengthOfItems">The length of the items</param>
        protected override void DeserializeItemsFromByteArray(byte[] byteArray, ref int currentIndex, int lengthOfItems)
        {
            int index = currentIndex;

            this.ObjectChangeFrequency = BasicObject.Parse <Compact64bitInt>(byteArray, ref index);

            if (index - currentIndex != lengthOfItems)
            {
                throw new StreamObjectParseErrorException(currentIndex, "ObjectGroupMetadata", "Stream object over-parse error", null);
            }

            currentIndex = index;
        }
Exemplo n.º 6
0
        /// <summary>
        /// This method is used to deserialize the items of the waterline Knowledge Entry from the byte array.
        /// </summary>
        /// <param name="byteArray">Specify the byte array.</param>
        /// <param name="currentIndex">Specify the start index from the byte array.</param>
        /// <param name="lengthOfItems">Specify the current length of items in the waterline Knowledge Entry.</param>
        protected override void DeserializeItemsFromByteArray(byte[] byteArray, ref int currentIndex, int lengthOfItems)
        {
            int index = currentIndex;

            this.CellStorageExtendedGUID = BasicObject.Parse <ExGuid>(byteArray, ref index);
            this.Waterline = BasicObject.Parse <Compact64bitInt>(byteArray, ref index);
            this.Reserved  = BasicObject.Parse <Compact64bitInt>(byteArray, ref index);

            if (index - currentIndex != lengthOfItems)
            {
                throw new StreamObjectParseErrorException(currentIndex, "WaterlineKnowledgeEntry", "Stream object over-parse error", null);
            }

            currentIndex = index;
        }
        /// <summary>
        /// Used to de-serialize the element.
        /// </summary>
        /// <param name="byteArray">A Byte array</param>
        /// <param name="currentIndex">Start position</param>
        /// <param name="lengthOfItems">The length of the items</param>
        protected override void DeserializeItemsFromByteArray(byte[] byteArray, ref int currentIndex, int lengthOfItems)
        {
            int index = currentIndex;

            this.ObjectExGUID          = BasicObject.Parse <ExGuid>(byteArray, ref index);
            this.ObjectDataBLOBExGUID  = BasicObject.Parse <ExGuid>(byteArray, ref index);
            this.ObjectPartitionID     = BasicObject.Parse <Compact64bitInt>(byteArray, ref index);
            this.ObjectReferencesCount = BasicObject.Parse <Compact64bitInt>(byteArray, ref index);
            this.CellReferencesCount   = BasicObject.Parse <Compact64bitInt>(byteArray, ref index);

            if (index - currentIndex != lengthOfItems)
            {
                throw new StreamObjectParseErrorException(currentIndex, "ObjectGroupObjectBLOBDataDeclaration", "Stream object over-parse error", null);
            }

            currentIndex = index;
        }
Exemplo n.º 8
0
        /// <summary>
        /// This method is used to deserialize the items of the cell knowledge range from the byte array.
        /// </summary>
        /// <param name="byteArray">Specify the byte array.</param>
        /// <param name="currentIndex">Specify the start index from the byte array.</param>
        /// <param name="lengthOfItems">Specify the current length of items in the cell knowledge range.</param>
        protected override void DeserializeItemsFromByteArray(byte[] byteArray, ref int currentIndex, int lengthOfItems)
        {
            int index = currentIndex;

            byte[] temp = new byte[16];
            Array.Copy(byteArray, index, temp, 0, 16);
            this.CellKnowledgeRangeGUID = new Guid(temp);
            index += 16;

            this.From = BasicObject.Parse <Compact64bitInt>(byteArray, ref index);
            this.To   = BasicObject.Parse <Compact64bitInt>(byteArray, ref index);

            if (index - currentIndex != lengthOfItems)
            {
                throw new StreamObjectParseErrorException(currentIndex, "CellKnowledgeRange", "Stream object over-parse error", null);
            }

            currentIndex = index;
        }
        /// <summary>
        /// This method is used to deserialize the StreamObjectHeaderStart32bit basic object 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 StreamObjectHeaderStart32bit basic object.</returns>
        protected override int DoDeserializeFromByteArray(byte[] byteArray, int startIndex)
        {
            using (BitReader bitReader = new BitReader(byteArray, startIndex))
            {
                this.HeaderType = bitReader.ReadInt32(2);
                if (this.HeaderType != StreamObjectHeaderStart.StreamObjectHeaderStart32bit)
                {
                    throw new InvalidOperationException(string.Format("Failed to get the StreamObjectHeaderStart32bit header type value, expect value {0}, but actual value is {1}", StreamObjectHeaderStart.StreamObjectHeaderStart32bit, this.HeaderType));
                }

                this.Compound = bitReader.ReadInt32(1);
                int typeValue = bitReader.ReadInt32(14);
                if (!Enum.IsDefined(typeof(StreamObjectTypeHeaderStart), typeValue))
                {
                    throw new InvalidOperationException(string.Format("Failed to get the StreamObjectHeaderStart32bit type value, the value {0} is not defined", typeValue));
                }

                this.Type = (StreamObjectTypeHeaderStart)typeValue;
                if (StreamObject.CompoundTypes.Contains(this.Type) && this.Compound != 1)
                {
                    throw new InvalidOperationException(string.Format("Failed to parse the StreamObjectHeaderStart32bit header. If the type value is {0} then the compound value should 1, but actual value is 0", typeValue));
                }

                this.Length = bitReader.ReadInt32(15);

                int index = startIndex;
                index += 4;

                if (this.Length == 32767)
                {
                    this.LargeLength = BasicObject.Parse <Compact64bitInt>(byteArray, ref index);
                }

                return(index - startIndex);
            }
        }
        /// <summary>
        /// Used to de-serialize the element.
        /// </summary>
        /// <param name="byteArray">A Byte array</param>
        /// <param name="currentIndex">Start position</param>
        /// <param name="lengthOfItems">The length of the items</param>
        protected override void DeserializeItemsFromByteArray(byte[] byteArray, ref int currentIndex, int lengthOfItems)
        {
            int index = currentIndex;
            this.ObjectChangeFrequency = BasicObject.Parse<Compact64bitInt>(byteArray, ref index);

            if (index - currentIndex != lengthOfItems)
            {
                throw new StreamObjectParseErrorException(currentIndex, "ObjectGroupMetadata", "Stream object over-parse error", null);
            }

            currentIndex = index;
        }
        /// <summary>
        /// Used to de-serialize the element.
        /// </summary>
        /// <param name="byteArray">A Byte array</param>
        /// <param name="currentIndex">Start position</param>
        /// <param name="lengthOfItems">The length of the items</param>
        protected override void DeserializeItemsFromByteArray(byte[] byteArray, ref int currentIndex, int lengthOfItems)
        {
            int index = currentIndex;

            this.ObjectExGUID = BasicObject.Parse<ExGuid>(byteArray, ref index);
            this.ObjectDataBLOBExGUID = BasicObject.Parse<ExGuid>(byteArray, ref index);
            this.ObjectPartitionID = BasicObject.Parse<Compact64bitInt>(byteArray, ref index);
            this.ObjectReferencesCount = BasicObject.Parse<Compact64bitInt>(byteArray, ref index);
            this.CellReferencesCount = BasicObject.Parse<Compact64bitInt>(byteArray, ref index);

            if (index - currentIndex != lengthOfItems)
            {
                throw new StreamObjectParseErrorException(currentIndex, "ObjectGroupObjectBLOBDataDeclaration", "Stream object over-parse error", null);
            }

            currentIndex = index;
        }
        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);
        }
        /// <summary>
        /// This method is used to deserialize the items of the waterline Knowledge Entry from the byte array.
        /// </summary>
        /// <param name="byteArray">Specify the byte array.</param>
        /// <param name="currentIndex">Specify the start index from the byte array.</param>
        /// <param name="lengthOfItems">Specify the current length of items in the waterline Knowledge Entry.</param>
        protected override void DeserializeItemsFromByteArray(byte[] byteArray, ref int currentIndex, int lengthOfItems)
        {
            int index = currentIndex;

            this.CellStorageExtendedGUID = BasicObject.Parse<ExGuid>(byteArray, ref index);
            this.Waterline = BasicObject.Parse<Compact64bitInt>(byteArray, ref index);
            this.Reserved = BasicObject.Parse<Compact64bitInt>(byteArray, ref index);

            if (index - currentIndex != lengthOfItems)
            {
                throw new StreamObjectParseErrorException(currentIndex, "WaterlineKnowledgeEntry", "Stream object over-parse error", null);
            }

            currentIndex = index;
        }
        /// <summary>
        /// This method is used to deserialize the StreamObjectHeaderStart32bit basic object 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 StreamObjectHeaderStart32bit basic object.</returns>
        protected override int DoDeserializeFromByteArray(byte[] byteArray, int startIndex)
        {
            using (BitReader bitReader = new BitReader(byteArray, startIndex))
            {
                this.HeaderType = bitReader.ReadInt32(2);
                if (this.HeaderType != StreamObjectHeaderStart.StreamObjectHeaderStart32bit)
                {
                    throw new InvalidOperationException(string.Format("Failed to get the StreamObjectHeaderStart32bit header type value, expect value {0}, but actual value is {1}", StreamObjectHeaderStart.StreamObjectHeaderStart32bit, this.HeaderType));
                }

                this.Compound = bitReader.ReadInt32(1);
                int typeValue = bitReader.ReadInt32(14);
                if (!Enum.IsDefined(typeof(StreamObjectTypeHeaderStart), typeValue))
                {
                    throw new InvalidOperationException(string.Format("Failed to get the StreamObjectHeaderStart32bit type value, the value {0} is not defined", typeValue));
                }

                this.Type = (StreamObjectTypeHeaderStart)typeValue;
                if (StreamObject.CompoundTypes.Contains(this.Type) && this.Compound != 1)
                {
                    throw new InvalidOperationException(string.Format("Failed to parse the StreamObjectHeaderStart32bit header. If the type value is {0} then the compound value should 1, but actual value is 0", typeValue));
                }

                this.Length = bitReader.ReadInt32(15);

                int index = startIndex;
                index += 4;

                if (this.Length == 32767)
                {
                    this.LargeLength = BasicObject.Parse<Compact64bitInt>(byteArray, ref index);
                }

                return index - startIndex;
            }
        }
Exemplo n.º 15
0
        /// <summary>
        /// This method is used to deserialize the items of the cell knowledge range from the byte array.
        /// </summary>
        /// <param name="byteArray">Specify the byte array.</param>
        /// <param name="currentIndex">Specify the start index from the byte array.</param>
        /// <param name="lengthOfItems">Specify the current length of items in the cell knowledge range.</param>
        protected override void DeserializeItemsFromByteArray(byte[] byteArray, ref int currentIndex, int lengthOfItems)
        {
            int index = currentIndex;

            byte[] temp = new byte[16];
            Array.Copy(byteArray, index, temp, 0, 16);
            this.CellKnowledgeRangeGUID = new Guid(temp);
            index += 16;

            this.From = BasicObject.Parse<Compact64bitInt>(byteArray, ref index);
            this.To = BasicObject.Parse<Compact64bitInt>(byteArray, ref index);

            if (index - currentIndex != lengthOfItems)
            {
                throw new StreamObjectParseErrorException(currentIndex, "CellKnowledgeRange", "Stream object over-parse error", null);
            }

            currentIndex = index;
        }