public void GetDataTransferIndices() { XDocument benchmark = null; DxiRequest dxiRequest = new DxiRequest(); dxiRequest.DataFilter = new DataFilter(); dxiRequest.Manifest = _dxfrProvider.GetManifest(_settings["ProjectName"], _settings["ApplicationName"]); DataTransferIndices dtiList = null; dtiList = _dxfrProvider.GetDataTransferIndicesWithFilter( _settings["ProjectName"], _settings["ApplicationName"], _settings["GraphName"], null, dxiRequest); deleteHashValue(ref dtiList); string path = String.Format( "{0}DxfrGetDataTransferIndices.xml", _settings["AppDataPath"] ); XDocument xDocument = ToXml(dtiList.DataTransferIndexList); xDocument.Save(path); Assert.AreNotEqual(null, xDocument); benchmark = XDocument.Load(path); String dtiListString = ToXml(dtiList.DataTransferIndexList).ToString(); String benchmarkString = benchmark.ToString(); Assert.AreEqual(dtiListString, benchmarkString); }
private void deleteHashValue(ref DataTransferIndices dtiList) { foreach (DataTransferIndex dti in dtiList.DataTransferIndexList) { dti.HashValue = null; } }
public void GetDataTransferIndicesWithFilter() { XDocument benchmark = null; DxiRequest dxiRequest = new DxiRequest(); dxiRequest.DataFilter = new DataFilter(); dxiRequest.Manifest = _dxfrProvider.GetManifest(_settings["ProjectName"], _settings["ApplicationName"]); DataFilter filter = new DataFilter(); filter.Expressions.Add( new Expression { PropertyName = "PipingNetworkSystem.NominalDiameter.valValue", Values = new Values { "40" }, RelationalOperator = RelationalOperator.EqualTo } ); filter.OrderExpressions.Add( new OrderExpression { PropertyName = "PipingNetworkSystem.IdentificationByTag.valIdentifier", SortOrder = SortOrder.Asc } ); DataTransferIndices dtiList = null; dtiList = _dxfrProvider.GetDataTransferIndicesWithFilter( _settings["ProjectName"], _settings["ApplicationName"], _settings["GraphName"], null, dxiRequest); deleteHashValue(ref dtiList); string path = String.Format( "{0}DxfrGetDataTransferIndicesWithFilter.xml", _settings["AppDataPath"] ); XDocument xDocument = ToXml(dtiList.DataTransferIndexList); xDocument.Save(path); Assert.AreNotEqual(null, xDocument); benchmark = XDocument.Load(path); String dtiListString = ToXml(dtiList.DataTransferIndexList).ToString(); String benchmarkString = benchmark.ToString(); Assert.AreEqual(dtiListString, benchmarkString); }
public void GetDataTransferObjects(string scope, string app, string graph, DataTransferIndices dataTransferIndices) { try { DataTransferObjects dtos = _dtoProvider.GetDataTransferObjects(scope, app, graph, dataTransferIndices); HttpContext.Current.Response.ContentType = "application/xml"; HttpContext.Current.Response.Write(Utility.SerializeDataContract <DataTransferObjects>(dtos)); } catch (Exception ex) { ExceptionHander(ex); } }
public void GetPagedDataTransferIndicesWithFilter(string scope, string app, string graph, DataFilter filter, int start, int limit) { try { DataTransferIndices dtis = _dtoProvider.GetPagedDataTransferIndices(scope, app, graph, filter, start, limit); HttpContext.Current.Response.ContentType = "application/xml"; HttpContext.Current.Response.Write(Utility.SerializeDataContract <DataTransferIndices>(dtis)); } catch (Exception ex) { ExceptionHander(ex); } }
public void GetDataTransferIndicesWithManifest(string scope, string app, string graph, string hashAlgorithm, Manifest manifest) { try { DataTransferIndices dtis = _dtoProvider.GetDataTransferIndicesWithManifest(scope, app, graph, hashAlgorithm, manifest); HttpContext.Current.Response.ContentType = "application/xml"; HttpContext.Current.Response.Write(Utility.SerializeDataContract <DataTransferIndices>(dtis)); } catch (Exception ex) { ExceptionHander(ex); } }
public void GetDataTransferIndicesWithFilter(string scope, string app, string graph, string hashAlgorithm, DxiRequest request) { try { if (IsAsync()) { string statusURL = _dtoProvider.AsyncGetDataTransferIndicesWithFilter(scope, app, graph, hashAlgorithm, request); WebOperationContext.Current.OutgoingResponse.StatusCode = HttpStatusCode.Accepted; WebOperationContext.Current.OutgoingResponse.Headers["location"] = statusURL; } else { DataTransferIndices dtis = _dtoProvider.GetDataTransferIndicesWithFilter(scope, app, graph, hashAlgorithm, request); HttpContext.Current.Response.ContentType = "application/xml"; HttpContext.Current.Response.Write(Utility.SerializeDataContract <DataTransferIndices>(dtis)); } } catch (Exception ex) { ExceptionHander(ex); } }
//[Test] public void PostDataTransferObjects() { XDocument benchmark = null; Response response = null; DxoRequest dxoRequest = new DxoRequest(); DataTransferObjects postDtos = null; List <DataTransferObject> dtoList = null; DxiRequest dxiRequest = new DxiRequest(); dxiRequest.DataFilter = new DataFilter(); DataTransferIndices dtiList = null; dxiRequest.DataFilter.Expressions.Add( new Expression { PropertyName = "PipingNetworkSystem.NominalDiameter.valValue", Values = new Values { "80" }, RelationalOperator = RelationalOperator.EqualTo } ); dxiRequest.DataFilter.OrderExpressions.Add( new OrderExpression { PropertyName = "PipingNetworkSystem.IdentificationByTag.valIdentifier", SortOrder = SortOrder.Asc } ); dxiRequest.Manifest = _dxfrProvider.GetManifest(_settings["ProjectName"], _settings["ApplicationName"]); dtiList = _dxfrProvider.GetDataTransferIndicesWithFilter( _settings["ProjectName"], _settings["ApplicationName"], _settings["GraphName"], "MD5", dxiRequest); dxoRequest.Manifest = _dxfrProvider.GetManifest(_settings["ProjectName"], _settings["ApplicationName"]); dxoRequest.DataTransferIndices = dtiList; //dxoRequest.DataTransferIndices = // _dxfrProvider.GetDataTransferIndicesWithManifest( // _settings["ProjectName"], _settings["ApplicationName"], // _settings["GraphName"], "MD5", dxoRequest.Manifest); postDtos = _dxfrProvider.GetDataTransferObjects(_settings["ProjectName"], _settings["ApplicationName"], _settings["GraphName"], dxoRequest, false); dtoList = postDtos.DataTransferObjectList; dtoList[0].transferType = TransferType.Delete; dtoList[1].classObjects[1].templateObjects[0].roleObjects[2].oldValue = dtoList[1].classObjects[1].templateObjects[0].roleObjects[2].value; dtoList[1].classObjects[1].templateObjects[0].roleObjects[2].value = "200"; string path = String.Format( "{0}DxfrNewDto.xml", _settings["AppDataPath"] ); benchmark = XDocument.Load(path); DataTransferObject newDto = Utility.DeserializeDataContract <DataTransferObject>(benchmark.ToString()); dtoList.Add(newDto); response = _dxfrProvider.PostDataTransferObjects(_settings["ProjectName"], _settings["ApplicationName"], _settings["GraphName"], postDtos); path = String.Format( "{0}DxfrResponse.xml", _settings["AppDataPath"] ); XDocument xDocument = ToXml(response); xDocument.Save(path); Assert.AreNotEqual(null, xDocument); benchmark = XDocument.Load(path); String res = ToXml(response).ToString(); Response xmlResponse = Utility.DeserializeDataContract <Response>(benchmark.ToString()); Assert.AreEqual(response.Level.ToString(), xmlResponse.Level.ToString()); foreach (Status status in response.StatusList) { foreach (Status xmlStatus in xmlResponse.StatusList) { Assert.AreEqual(status.Messages.ToString(), xmlStatus.Messages.ToString()); Assert.AreEqual(status.Identifier, xmlStatus.Identifier); xmlResponse.StatusList.Remove(xmlStatus); break; } } //restore the table ResetDatabase(); }