public void TestCase_S12_TC11_QueryChanges_DataElementIDsFilter_Include() { if (!Common.IsRequirementEnabled("MS-FSSHTTP-FSSHTTPB", 10003, this.Site)) { Site.Assume.Inconclusive("Implementation does not support Query Changes sub-request with filters in the current test suite."); } // Initialize the service this.InitializeContext(this.DefaultFileUrl, this.UserName01, this.Password01, this.Domain); FsshttpbCellRequest cellRequest = SharedTestSuiteHelper.CreateFsshttpbCellRequest(); QueryChangesCellSubRequest queryChange = SharedTestSuiteHelper.BuildFsshttpbQueryChangesSubRequest(SequenceNumberGenerator.GetCurrentFSSHTTPBSubRequestID(), 0, true, true, true, 0, true, true, 0, null, 100, null, null); cellRequest.AddSubRequest(queryChange, null); CellSubRequestType cellSubRequest = SharedTestSuiteHelper.CreateCellSubRequest(SequenceNumberGenerator.GetCurrentToken(), cellRequest.ToBase64()); CellStorageResponse cellStorageResponse = this.Adapter.CellStorageRequest(this.DefaultFileUrl, new SubRequestType[] { cellSubRequest }); CellSubResponseType subResponse = SharedTestSuiteHelper.ExtractSubResponse<CellSubResponseType>(cellStorageResponse, 0, 0, this.Site); this.Site.Assert.AreEqual<ErrorCodeType>( ErrorCodeType.Success, SharedTestSuiteHelper.ConvertToErrorCodeType(subResponse.ErrorCode, this.Site), "Test case cannot continue unless the query changes succeed."); FsshttpbResponse queryResponse = SharedTestSuiteHelper.ExtractFsshttpbResponse(subResponse, this.Site); SharedTestSuiteHelper.ExpectMsfsshttpbSubResponseSucceed(queryResponse, this.Site); // Get the first element id. ExGuid e1 = queryResponse.DataElementPackage.DataElements[0].DataElementExtendedGUID; List<ExGuid> extendedGuid = new List<ExGuid>(); extendedGuid.Add(e1); ExGUIDArray extendedArray = new ExGUIDArray(extendedGuid); DataElementIDsFilter filterType = new DataElementIDsFilter(extendedArray); filterType.FilterOperation = 1; AllFilter allFilter = new AllFilter(); allFilter.FilterOperation = 0; List<Filter> filters = new List<Filter>(); filters.Add(allFilter); filters.Add(filterType); // Query change with the data element id. cellRequest = SharedTestSuiteHelper.CreateFsshttpbCellRequest(); queryChange = SharedTestSuiteHelper.BuildFsshttpbQueryChangesSubRequest(SequenceNumberGenerator.GetCurrentFSSHTTPBSubRequestID(), 0, true, true, true, 0, true, true, 0, null, 100, filters, null); cellRequest.AddSubRequest(queryChange, null); cellSubRequest = SharedTestSuiteHelper.CreateCellSubRequest(SequenceNumberGenerator.GetCurrentToken(), cellRequest.ToBase64()); cellStorageResponse = this.Adapter.CellStorageRequest(this.DefaultFileUrl, new SubRequestType[] { cellSubRequest }); subResponse = SharedTestSuiteHelper.ExtractSubResponse<CellSubResponseType>(cellStorageResponse, 0, 0, this.Site); this.Site.Assert.AreEqual<ErrorCodeType>( ErrorCodeType.Success, SharedTestSuiteHelper.ConvertToErrorCodeType(subResponse.ErrorCode, this.Site), "Test case cannot continue unless the query changes succeed."); queryResponse = SharedTestSuiteHelper.ExtractFsshttpbResponse(subResponse, this.Site); SharedTestSuiteHelper.ExpectMsfsshttpbSubResponseSucceed(queryResponse, this.Site); bool isOnlyReturnSpecifiedId = queryResponse.DataElementPackage.DataElements.All(dataElement => dataElement.DataElementExtendedGUID.Equals(e1)); this.Site.Assert.IsTrue( isOnlyReturnSpecifiedId, "The server only responses the data element with the specified extended guid {0}", e1.GUID); }
public void TestCase_S12_TC17_QueryChanges_IncludeFilteredOutDataElementsInKnowledge() { if (!Common.IsRequirementEnabled("MS-FSSHTTP-FSSHTTPB", 10003, this.Site)) { Site.Assume.Inconclusive("Implementation does not support Query Changes sub-request with filters in the current test suite."); } // Initialize the service this.InitializeContext(this.DefaultFileUrl, this.UserName01, this.Password01, this.Domain); // Send request with no filter and get the GUID array. CellSubRequestType queryChange = SharedTestSuiteHelper.CreateCellSubRequestEmbeddedQueryChanges(SequenceNumberGenerator.GetCurrentFSSHTTPBSubRequestID()); CellStorageResponse response = Adapter.CellStorageRequest(this.DefaultFileUrl, new SubRequestType[] { queryChange }); 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 query change operation succeeds."); FsshttpbResponse queryResponse = SharedTestSuiteHelper.ExtractFsshttpbResponse(cellSubResponse, this.Site); // Build all Filters and Hierarchy Filter ExGuid exguid = queryResponse.DataElementPackage.DataElements.FirstOrDefault(e => e.DataElementType == DataElementType.StorageIndexDataElementData).DataElementExtendedGUID; byte[] bytes = new byte[21]; exguid.GUID.ToByteArray().CopyTo(bytes, 1); // These two bytes are magic number which is not documented in the open specification in the current stage, but it will be wrote down in the future. bytes[0] = 0x29; bytes[17] = 0x01; HierarchyFilter filterType1 = new HierarchyFilter(bytes); filterType1.FilterOperation = 1; filterType1.Depth = HierarchyFilterDepth.Deep; List<Filter> filters = new List<Filter>(); AllFilter allFilter = new AllFilter(); allFilter.FilterOperation = 0; filters.Add(allFilter); filters.Add(filterType1); // Send request with all Filters, Hierarchy Filter and the flag "Include Filtered Out Data Elements In Knowledge" as false. FsshttpbCellRequest cellRequest = SharedTestSuiteHelper.CreateFsshttpbCellRequest(); QueryChangesCellSubRequest queryChangeSubRequest = SharedTestSuiteHelper.BuildFsshttpbQueryChangesSubRequest(SequenceNumberGenerator.GetCurrentFSSHTTPBSubRequestID(), 0, true, true, false, 0, true, true, 0, null, null, filters, null); cellRequest.AddSubRequest(queryChangeSubRequest, null); CellSubRequestType cellSubRequest = SharedTestSuiteHelper.CreateCellSubRequest(SequenceNumberGenerator.GetCurrentToken(), cellRequest.ToBase64()); CellStorageResponse cellStorageResponse = this.Adapter.CellStorageRequest(this.DefaultFileUrl, new SubRequestType[] { cellSubRequest }); CellSubResponseType subResponse = SharedTestSuiteHelper.ExtractSubResponse<CellSubResponseType>(cellStorageResponse, 0, 0, this.Site); // Get the fsshttpbResponse which include Knowledge element FsshttpbResponse queryResponseFirst = SharedTestSuiteHelper.ExtractFsshttpbResponse(subResponse, this.Site); // Send request with all Filters, Hierarchy Filter and the flag "Include Filtered Out Data Elements In Knowledge" as true. FsshttpbCellRequest cellRequestSecond = SharedTestSuiteHelper.CreateFsshttpbCellRequest(); QueryChangesCellSubRequest queryChangeSubRequestSecond = SharedTestSuiteHelper.BuildFsshttpbQueryChangesSubRequest(SequenceNumberGenerator.GetCurrentFSSHTTPBSubRequestID(), 0, true, true, true, 0, true, true, 0, null, null, filters, null); cellRequestSecond.AddSubRequest(queryChangeSubRequestSecond, null); CellSubRequestType cellSubRequestSecond = SharedTestSuiteHelper.CreateCellSubRequest(SequenceNumberGenerator.GetCurrentToken(), cellRequestSecond.ToBase64()); CellStorageResponse cellStorageResponseSecond = this.Adapter.CellStorageRequest(this.DefaultFileUrl, new SubRequestType[] { cellSubRequestSecond }); CellSubResponseType subResponseSecond = SharedTestSuiteHelper.ExtractSubResponse<CellSubResponseType>(cellStorageResponseSecond, 0, 0, this.Site); // Get the fsshttpbResponse which include Knowledge element FsshttpbResponse queryResponseSecond = SharedTestSuiteHelper.ExtractFsshttpbResponse(subResponseSecond, this.Site); bool isVerified = queryResponseFirst.CellSubResponses[0].GetSubResponseData<QueryChangesSubResponseData>().Knowledge.SpecializedKnowledges.Count < queryResponseSecond.CellSubResponses[0].GetSubResponseData<QueryChangesSubResponseData>().Knowledge.SpecializedKnowledges.Count; Site.Log.Add( LogEntryKind.Debug, "When Include Filtered Out Data Elements In Knowledge is set, the server responds the specialized knowledge number is {0}", queryResponseSecond.CellSubResponses[0].GetSubResponseData<QueryChangesSubResponseData>().Knowledge.SpecializedKnowledges.Count); Site.Log.Add( LogEntryKind.Debug, "When Include Filtered Out Data Elements In Knowledge is not set, the server responds the specialized knowledge number is {0}", queryResponseFirst.CellSubResponses[0].GetSubResponseData<QueryChangesSubResponseData>().Knowledge.SpecializedKnowledges.Count); Site.Log.Add( LogEntryKind.Debug, "Expect the specialized knowledge number is larger when the Include Filtered Out Data Elements In Knowledge is set, and actually it {0}", isVerified ? "is" : "is not"); // Verify MS-FSSHTTPB requirement: MS-FSSHTTPB_R2148, MS-FSSHTTPB_R2149 if (SharedContext.Current.IsMsFsshttpRequirementsCaptured) { Site.CaptureRequirementIfIsTrue( isVerified, "MS-FSSHTTPB", 2148, @"[In Query Changes] D - Include Filtered Out Data Elements In Knowledge (1 bit): If set, a bit that specifies to include the serial numbers (section 2.2.1.9) of filtered out data elements in the response knowledge."); Site.CaptureRequirementIfIsTrue( isVerified, "MS-FSSHTTPB", 2149, @"[In Query Changes] D - Include Filtered Out Data Elements In Knowledge (1 bit): otherwise[If D - Include Filtered Out Data Elements In Knowledge is not set], the serial numbers of filtered out data elements are not included in the response knowledge."); } else { Site.Assert.IsTrue(isVerified, "Include Filtered Out Data Elements In Knowledge (1 bit): If set, a bit that specifies to include the serial numbers (section 2.2.1.9) of filtered out data elements in the response knowledge."); } }
public void TestCase_S12_TC10_QueryChanges_DataElementTypeFilter_IncludeObjectGroupDataElement() { if (!Common.IsRequirementEnabled("MS-FSSHTTP-FSSHTTPB", 10003, this.Site)) { Site.Assume.Inconclusive("Implementation does not support Query Changes sub-request with filters in the current test suite."); } // Initialize the service this.InitializeContext(this.DefaultFileUrl, this.UserName01, this.Password01, this.Domain); AllFilter allFilter = new AllFilter(); allFilter.FilterOperation = 0; DataElementTypeFilter filterType = new DataElementTypeFilter(DataElementType.ObjectGroupDataElementData); filterType.FilterOperation = 1; List<Filter> filters = new List<Filter>(); filters.Add(allFilter); filters.Add(filterType); FsshttpbCellRequest cellRequest = SharedTestSuiteHelper.CreateFsshttpbCellRequest(); QueryChangesCellSubRequest queryChange = SharedTestSuiteHelper.BuildFsshttpbQueryChangesSubRequest(SequenceNumberGenerator.GetCurrentFSSHTTPBSubRequestID(), 0, true, true, true, 0, true, true, 0, null, 2, filters, null); cellRequest.AddSubRequest(queryChange, null); CellSubRequestType cellSubRequest = SharedTestSuiteHelper.CreateCellSubRequest(SequenceNumberGenerator.GetCurrentToken(), cellRequest.ToBase64()); CellStorageResponse cellStorageResponse = this.Adapter.CellStorageRequest(this.DefaultFileUrl, new SubRequestType[] { cellSubRequest }); CellSubResponseType subResponse = SharedTestSuiteHelper.ExtractSubResponse<CellSubResponseType>(cellStorageResponse, 0, 0, this.Site); this.Site.Assert.AreEqual<ErrorCodeType>( ErrorCodeType.Success, SharedTestSuiteHelper.ConvertToErrorCodeType(subResponse.ErrorCode, this.Site), "Test case cannot continue unless the query changes succeed."); FsshttpbResponse queryResponse = SharedTestSuiteHelper.ExtractFsshttpbResponse(subResponse, this.Site); SharedTestSuiteHelper.ExpectMsfsshttpbSubResponseSucceed(queryResponse, this.Site); bool isIncludeObjectGroupDataElement = queryResponse.DataElementPackage.DataElements.All(dataElement => dataElement.DataElementType == DataElementType.ObjectGroupDataElementData); this.Site.Assert.IsTrue( isIncludeObjectGroupDataElement, "The response should only contains the ObjectGroupDataElement."); }