public void BhaRun131DataAdapter_GetFromStore_Can_Get_BhaRun() { AddParents(); DevKit.AddAndAssert <BhaRunList, BhaRun>(BhaRun); DevKit.GetAndAssert <BhaRunList, BhaRun>(BhaRun); }
public void Wellbore141Validator_AddToStore_Error_405_Wellbore_Already_Exists() { AddParents(); DevKit.AddAndAssert <WellboreList, Wellbore>(Wellbore); DevKit.AddAndAssert <WellboreList, Wellbore>(Wellbore, ErrorCodes.DataObjectUidAlreadyExists); }
public void Wellbore141Validator_AddToStore_Error_481_Wellbore_Parent_Does_Not_Exist() { DevKit.AddAndAssert(Wellbore, ErrorCodes.MissingParentDataObject); }
public void Risk131DataAdapter_AddToStore_Can_Add_Risk() { AddParents(); DevKit.AddAndAssert <RiskList, Risk>(Risk); }
public void Log141Validator_AddToStore_Error_406_Log_Missing_Parent_Uid() { AddParents(); Log.UidWellbore = null; DevKit.AddAndAssert(Log, ErrorCodes.MissingElementUidForAdd); }
public void Trajectory141DataAdapter_GetFromStore_Filter_ExtensionNameValue() { AddParents(); var extensionName1 = DevKit.ExtensionNameValue("Ext-1", "1.0", "m"); var extensionName2 = DevKit.ExtensionNameValue("Ext-2", "2.0", "cm", PrimitiveType.@float); extensionName2.MeasureClass = MeasureClass.Length; var extensionName3 = DevKit.ExtensionNameValue("Ext-3", "3.0", "cm", PrimitiveType.unknown); Trajectory.CommonData = new CommonData() { ExtensionNameValue = new List <ExtensionNameValue>() { extensionName1, extensionName2, extensionName3 } }; // Add the Trajectory141 DevKit.AddAndAssert(Trajectory); // Query for first extension var commonDataXml = "<commonData>" + Environment.NewLine + "<extensionNameValue uid=\"\">" + Environment.NewLine + "<name />{0}" + Environment.NewLine + "</extensionNameValue>" + Environment.NewLine + "</commonData>"; var extValueQuery = string.Format(commonDataXml, "<dataType>double</dataType>"); var queryXml = string.Format(BasicXMLTemplate, Trajectory.UidWell, Trajectory.UidWellbore, Trajectory.Uid, extValueQuery); var result = DevKit.Query <TrajectoryList, Trajectory>(ObjectTypes.Trajectory, queryXml, null, OptionsIn.ReturnElements.Requested); Assert.IsNotNull(result); Assert.AreEqual(1, result.Count); var resultTrajectory = result[0]; Assert.IsNotNull(resultTrajectory); var commonData = resultTrajectory.CommonData; Assert.IsNotNull(commonData); Assert.AreEqual(1, commonData.ExtensionNameValue.Count); var env = commonData.ExtensionNameValue[0]; Assert.IsNotNull(env); Assert.AreEqual(extensionName1.Uid, env.Uid); Assert.AreEqual(extensionName1.Name, env.Name); // Query for second extension extValueQuery = string.Format(commonDataXml, "<measureClass>length</measureClass>"); queryXml = string.Format(BasicXMLTemplate, Trajectory.UidWell, Trajectory.UidWellbore, Trajectory.Uid, extValueQuery); result = DevKit.Query <TrajectoryList, Trajectory>(ObjectTypes.Trajectory, queryXml, null, OptionsIn.ReturnElements.Requested); Assert.IsNotNull(result); Assert.AreEqual(1, result.Count); resultTrajectory = result[0]; Assert.IsNotNull(resultTrajectory); commonData = resultTrajectory.CommonData; Assert.IsNotNull(commonData); Assert.AreEqual(1, commonData.ExtensionNameValue.Count); env = commonData.ExtensionNameValue[0]; Assert.IsNotNull(env); Assert.AreEqual(extensionName2.Uid, env.Uid); Assert.AreEqual(extensionName2.Name, env.Name); // Query for third extension extValueQuery = string.Format(commonDataXml, "<dataType>unknown</dataType>"); queryXml = string.Format(BasicXMLTemplate, Trajectory.UidWell, Trajectory.UidWellbore, Trajectory.Uid, extValueQuery); result = DevKit.Query <TrajectoryList, Trajectory>(ObjectTypes.Trajectory, queryXml, null, OptionsIn.ReturnElements.Requested); Assert.IsNotNull(result); Assert.AreEqual(1, result.Count); resultTrajectory = result[0]; Assert.IsNotNull(resultTrajectory); commonData = resultTrajectory.CommonData; Assert.IsNotNull(commonData); Assert.AreEqual(1, commonData.ExtensionNameValue.Count); env = commonData.ExtensionNameValue[0]; Assert.IsNotNull(env); Assert.AreEqual(extensionName3.Uid, env.Uid); Assert.AreEqual(extensionName3.Name, env.Name); }
public void Trajectory141DataAdapter_AddToStore_Can_Add_Trajectory() { AddParents(); DevKit.AddAndAssert <TrajectoryList, Trajectory>(Trajectory); }
public void Well141DataAdapter_UpdateInStore_Can_Update_CustomData_Elements() { DevKit.AddAndAssert <WellList, Well>(Well); // Update with New Data var doc = new XmlDocument(); var element1 = doc.CreateElement("FirstItem", "http://www.witsml.org/schemas/1series"); element1.InnerText = "123.45"; var element2 = doc.CreateElement("LastItem", element1.NamespaceURI); element2.InnerText = "987.65"; Well.CustomData = new CustomData { Any = DevKit.List(element1, element2) }; DevKit.UpdateAndAssert <WellList, Well>(Well); // Query var query = new Well { Uid = Well.Uid }; var result = DevKit.Query <WellList, Well>(query, ObjectTypes.Well, null, optionsIn: OptionsIn.ReturnElements.All); var well = result.FirstOrDefault(); Assert.IsNotNull(well?.CustomData); Assert.AreEqual(2, well.CustomData.Any.Count); Assert.AreEqual(element1.LocalName, well.CustomData.Any[0].LocalName); Assert.AreEqual(element1.InnerText, well.CustomData.Any[0].InnerText); Assert.AreEqual(element2.LocalName, well.CustomData.Any[1].LocalName); Assert.AreEqual(element2.InnerText, well.CustomData.Any[1].InnerText); // Partial Update well.CustomData.Any[1].InnerText = "0.0"; var element3 = doc.CreateElement("NewItem", element1.NamespaceURI); element3.InnerText = "abc"; well.CustomData.Any.Add(element3); DevKit.UpdateAndAssert <WellList, Well>(well); // Query result = DevKit.Query <WellList, Well>(query, ObjectTypes.Well, null, optionsIn: OptionsIn.ReturnElements.All); well = result.FirstOrDefault(); Assert.IsNotNull(well?.CustomData); Assert.AreEqual(3, well.CustomData.Any.Count); Assert.AreEqual(element1.LocalName, well.CustomData.Any[0].LocalName); Assert.AreEqual(element1.InnerText, well.CustomData.Any[0].InnerText); Assert.AreEqual(element2.LocalName, well.CustomData.Any[1].LocalName); Assert.AreEqual("0.0", well.CustomData.Any[1].InnerText); Assert.AreEqual(element3.LocalName, well.CustomData.Any[2].LocalName); Assert.AreEqual(element3.InnerText, well.CustomData.Any[2].InnerText); }
public void WellCMLedger200DataAdapter_AddToStore_Can_Add_WellCMLedger() { AddParents(); DevKit.AddAndAssert(WellCMLedger); }
public void Log141DataAdapter_GetFromStore_Can_Get_Log() { AddParents(); DevKit.AddAndAssert <LogList, Log>(Log); DevKit.GetAndAssert <LogList, Log>(Log); }
public void Log141DataAdapter_AddToStore_Can_Add_Log() { AddParents(); DevKit.AddAndAssert <LogList, Log>(Log); }
public void CementJob131Validator_AddToStore_Error_406_CementJob_Missing_Parent_Uid() { AddParents(); CementJob.UidWellbore = null; DevKit.AddAndAssert(CementJob, ErrorCodes.MissingElementUidForAdd); }
public void Trajectory141Validator_AddToStore_Error_481_Parent_Missing() { DevKit.AddAndAssert(Trajectory, ErrorCodes.MissingParentDataObject); }
public void BhaRun131DataAdapter_AddToStore_Can_Add_BhaRun() { AddParents(); DevKit.AddAndAssert <BhaRunList, BhaRun>(BhaRun); }
public void FluidsReport131Validator_AddToStore_Error_405_FluidsReport_Already_Exists() { AddParents(); DevKit.AddAndAssert <FluidsReportList, FluidsReport>(FluidsReport); DevKit.AddAndAssert <FluidsReportList, FluidsReport>(FluidsReport, ErrorCodes.DataObjectUidAlreadyExists); }
public async Task CascadedDelete141Tests_Can_Parallel_Delete_Populated_Wellbores() { DevKit.AddAndAssert(Well); // Number of objects to generate var numOfObjects = 5; // Create logs var logs = DevKit.GenerateLogs(Well.Uid, Well.Name, LogIndexType.measureddepth, numOfObjects); // Create trajectories var trajectories = DevKit.GenerateTrajectories(Well.Uid, Well.Name, numOfObjects); // Add 5 wellbores with data objects for (var i = 0; i < numOfObjects; i++) { var wellbore = new Wellbore() { Uid = DevKit.Uid(), UidWell = Well.Uid, Name = DevKit.Name(), NameWell = Well.Name }; DevKit.AddAndAssert(wellbore); DevKit.AddListOfLogsToWellbore(logs, wellbore); DevKit.AddListOfTrajectoriesToWellbore(trajectories, wellbore); } // Delete well with cascadedDelete options in var wellbores = DevKit.Get <WellboreList, Wellbore>(DevKit.List(new Wellbore() { UidWell = Well.Uid }), ObjectTypes.Wellbore, string.Empty, OptionsIn.ReturnElements.IdOnly); Assert.IsNotNull(wellbores); var wellboreList = EnergisticsConverter.XmlToObject <WellboreList>(wellbores.XMLout); Assert.IsNotNull(wellboreList); Assert.AreEqual(numOfObjects, wellboreList.Wellbore.Count); // Delete each wellbore in parallel var taskList = new List <Task>(); wellboreList.Wellbore.ForEach(x => { taskList.Add(new Task(() => { var deleteWellbore = new Wellbore { Uid = x.Uid, UidWell = x.UidWell }; var result = DevKit.Delete <WellboreList, Wellbore>(deleteWellbore, ObjectTypes.Wellbore, string.Empty, OptionsIn.CascadedDelete.True); Assert.IsNotNull(result); Assert.AreEqual(result.Result, 1); // Ensure wellbore does not exist anymore DevKit.GetAndAssert(deleteWellbore, false); })); }); taskList.ForEach(x => x.Start()); await Task.WhenAll(taskList); // Get all wellbores remaining under well wellbores = DevKit.Get <WellboreList, Wellbore>(DevKit.List(new Wellbore() { UidWell = Well.Uid }), ObjectTypes.Wellbore, string.Empty, OptionsIn.ReturnElements.IdOnly); Assert.IsNotNull(wellbores); wellboreList = EnergisticsConverter.XmlToObject <WellboreList>(wellbores.XMLout); Assert.IsNotNull(wellboreList); Assert.AreEqual(0, wellboreList.Wellbore.Count); }
public void FluidsReport131Validator_AddToStore_Error_481_FluidsReport_Parent_Does_Not_Exist() { DevKit.AddAndAssert(FluidsReport, ErrorCodes.MissingParentDataObject); }
public async Task CascadedDelete141Tests_Can_Parallel_Delete_Well_With_Populated_Wellbores() { // Number of objects to generate var numOfObjects = 5; var wellList = new List <Well>(); for (var i = 0; i < numOfObjects; i++) { wellList.Add(new Well() { Uid = DevKit.Uid(), Name = DevKit.Name(), TimeZone = "-06:00" }); } // Add wells wellList.ForEach(x => DevKit.AddAndAssert(x)); foreach (var well in wellList) { // Create logs var logs = DevKit.GenerateLogs(well.Uid, well.Name, LogIndexType.measureddepth, numOfObjects); // Create trajectories var trajectories = DevKit.GenerateTrajectories(well.Uid, well.Name, numOfObjects); // Add 5 wellbores with data objects for (var i = 0; i < numOfObjects; i++) { var wellbore = new Wellbore() { Uid = DevKit.Uid(), UidWell = well.Uid, Name = DevKit.Name(), NameWell = well.Name }; DevKit.AddAndAssert(wellbore); DevKit.AddListOfLogsToWellbore(logs, wellbore); DevKit.AddListOfTrajectoriesToWellbore(trajectories, wellbore); } } // Delete each well in parallel var taskList = new List <Task>(); wellList.ForEach(x => { taskList.Add(new Task(() => { var deleteWell = new Well { Uid = x.Uid }; var result = DevKit.Delete <WellList, Well>(deleteWell, ObjectTypes.Well, string.Empty, OptionsIn.CascadedDelete.True); Assert.IsNotNull(result); Assert.AreEqual(result.Result, 1); // Ensure well does not exist anymore DevKit.GetAndAssert(deleteWell, false); })); }); taskList.ForEach(x => x.Start()); await Task.WhenAll(taskList); wellList.ForEach(x => { var wells = DevKit.Get <WellList, Well>(DevKit.List(new Well() { Uid = x.Uid })); Assert.IsNotNull(wells); var result = EnergisticsConverter.XmlToObject <WellList>(wells.XMLout); Assert.IsNotNull(wells); Assert.AreEqual(0, result.Well.Count); }); }
public void Trajectory141DataAdapter_GetFromStore_Can_Get_Trajectory() { AddParents(); DevKit.AddAndAssert <TrajectoryList, Trajectory>(Trajectory); DevKit.GetAndAssert <TrajectoryList, Trajectory>(Trajectory); }
public void CementJob131Validator_AddToStore_Error_405_CementJob_Already_Exists() { AddParents(); DevKit.AddAndAssert <CementJobList, CementJob>(CementJob); DevKit.AddAndAssert <CementJobList, CementJob>(CementJob, ErrorCodes.DataObjectUidAlreadyExists); }
public void Risk131DataAdapter_GetFromStore_Can_Get_Risk() { AddParents(); DevKit.AddAndAssert <RiskList, Risk>(Risk); DevKit.GetAndAssert <RiskList, Risk>(Risk); }
public void CementJob131Validator_AddToStore_Error_481_CementJob_Parent_Does_Not_Exist() { DevKit.AddAndAssert(CementJob, ErrorCodes.MissingParentDataObject); }
public void Log141Validator_AddToStore_Error_405_Log_Already_Exists() { AddParents(); DevKit.AddAndAssert <LogList, Log>(Log); DevKit.AddAndAssert <LogList, Log>(Log, ErrorCodes.DataObjectUidAlreadyExists); }
public void Trajectory200DataAdapter_GetFromStore_Can_Get_Trajectory() { AddParents(); DevKit.AddAndAssert(Trajectory); DevKit.GetAndAssert(Trajectory); }
public void Log141Validator_AddToStore_Error_481_Log_Parent_Does_Not_Exist() { DevKit.AddAndAssert(Log, ErrorCodes.MissingParentDataObject); }
public void Trajectory200DataAdapter_AddToStore_Can_Add_Trajectory() { AddParents(); DevKit.AddAndAssert(Trajectory); }
public void Wellbore141Validator_AddToStore_Error_406_Wellbore_Missing_Parent_Uid() { AddParents(); Wellbore.UidWell = null; DevKit.AddAndAssert(Wellbore, ErrorCodes.MissingElementUidForAdd); }
protected virtual void AddParents() { DevKit.AddAndAssert <WellList, Well>(Well); }
public void Well200DataAdapter_GetFromStore_Can_Get_Well() { AddParents(); DevKit.AddAndAssert(Well); DevKit.GetAndAssert(Well); }
public void WellCMLedger141Validator_AddToStore_Error_405_WellCMLedger_Already_Exists() { AddParents(); DevKit.AddAndAssert <WellCMLedgerList, WellCMLedger>(WellCMLedger); DevKit.AddAndAssert <WellCMLedgerList, WellCMLedger>(WellCMLedger, ErrorCodes.DataObjectUidAlreadyExists); }