public void Wellbore141DataAdapter_UpdateInStore_Add_Recurring_Element_Success()
        {
            // Add well
            DevKit.AddAndAssert(Well);

            // Add wellbore
            DevKit.AddAndAssert(Wellbore);

            var extensionName1 = DevKit.ExtensionNameValue("Ext-1", "1.0", "m");
            var extensionName2 = DevKit.ExtensionNameValue("Ext-2", "2.0", "m");

            // Create an update well that adds a recurring element for the first time on update
            var update = new Wellbore()
            {
                UidWell    = Well.Uid,
                Uid        = Wellbore.Uid,
                CommonData = new CommonData
                {
                    ExtensionNameValue = new List <ExtensionNameValue>
                    {
                        extensionName1, extensionName2
                    }
                }
            };

            var results = DevKit.Update <WellboreList, Wellbore>(update);

            Assert.IsNotNull(results);
            Assert.AreEqual((short)ErrorCodes.Success, results.Result);
        }
        public void TestSetUp()
        {
            Logger.Debug($"Executing {TestContext.TestName}");
            DevKit = new DevKit200Aspect(TestContext);

            Well = new Well
            {
                Uuid     = DevKit.Uid(),
                Citation = DevKit.Citation("Well"),

                GeographicLocationWGS84 = DevKit.Location(),
                SchemaVersion           = "2.0",

                TimeZone = DevKit.TimeZone
            };
            Wellbore = new Wellbore
            {
                Uuid     = DevKit.Uid(),
                Citation = DevKit.Citation("Wellbore"),

                Well          = DevKit.DataObjectReference(Well),
                SchemaVersion = "2.0"
            };
            SurveyProgram = new SurveyProgram
            {
                Uuid     = DevKit.Uid(),
                Citation = DevKit.Citation("SurveyProgram"),

                Wellbore      = DevKit.DataObjectReference(Wellbore),
                SchemaVersion = EtpUris.GetUriFamily(typeof(SurveyProgram)).Version,
            };

            BeforeEachTest();
            OnTestSetUp();
        }
Пример #3
0
        public void TestSetUp()
        {
            DevKit = new DevKit141Aspect(TestContext);

            _testDataDir = new DirectoryInfo(@".\TestData").FullName;

            DevKit.Store.CapServerProviders = DevKit.Store.CapServerProviders
                                              .Where(x => x.DataSchemaVersion == OptionsIn.DataVersion.Version141.Value)
                                              .ToArray();

            Well = new Well {
                Name = DevKit.Name("Well 01"), TimeZone = DevKit.TimeZone
            };

            Wellbore = new Wellbore()
            {
                NameWell = Well.Name,
                Name     = DevKit.Name("Wellbore 01")
            };

            Log = new Log()
            {
                NameWell     = Well.Name,
                NameWellbore = Wellbore.Name,
                Name         = DevKit.Name("Log 01")
            };
        }
        protected override void PrepareData()
        {
            DevKit.Store.CapServerProviders = DevKit.Store.CapServerProviders
                                              .Where(x => x.DataSchemaVersion == OptionsIn.DataVersion.Version141.Value)
                                              .ToArray();

            Well = new Well
            {
                Uid      = DevKit.Uid(),
                Name     = DevKit.Name("Well"),
                TimeZone = DevKit.TimeZone
            };
            Wellbore = new Wellbore
            {
                Uid      = DevKit.Uid(),
                Name     = DevKit.Name("Wellbore"),
                UidWell  = Well.Uid,
                NameWell = Well.Name,
                MD       = new MeasuredDepthCoord(0, MeasuredDepthUom.ft)
            };
            WellboreCompletion = new WellboreCompletion
            {
                Uid          = DevKit.Uid(),
                Name         = DevKit.Name("WellboreCompletion"),
                UidWell      = Well.Uid,
                NameWell     = Well.Name,
                UidWellbore  = Wellbore.Uid,
                NameWellbore = Wellbore.Name
            };

            QueryEmptyList = DevKit.List(new WellboreCompletion());
        }
Пример #5
0
        public void TestSetUp()
        {
            _devKit = new DevKit141Aspect(TestContext);

            _devKit.Store.CapServerProviders = _devKit.Store.CapServerProviders
                                               .Where(x => x.DataSchemaVersion == OptionsIn.DataVersion.Version141.Value)
                                               .ToArray();

            _well = new Well {
                Uid = _devKit.Uid(), Name = _devKit.Name("Well 01"), TimeZone = _devKit.TimeZone
            };

            _wellbore = new Wellbore()
            {
                Uid      = _devKit.Uid(),
                UidWell  = _well.Uid,
                NameWell = _well.Name,
                Name     = _devKit.Name("Wellbore 01")
            };

            _log = new Log()
            {
                Uid          = _devKit.Uid(),
                UidWell      = _well.Uid,
                UidWellbore  = _wellbore.Uid,
                NameWell     = _well.Name,
                NameWellbore = _wellbore.Name,
                Name         = _devKit.Name("Log 01")
            };
        }
        public void Wellbore141DataAdapter_DeleteFromStore_Error_432Wellbore_Has_Child_Data_Objects()
        {
            // Add well
            DevKit.AddAndAssert(Well);

            // Add wellbore
            DevKit.AddAndAssert(Wellbore);

            // Add rig
            var rig = new Rig()
            {
                UidWell      = Well.Uid,
                UidWellbore  = Wellbore.Uid,
                Uid          = DevKit.Uid(),
                NameWell     = Well.Name,
                NameWellbore = Wellbore.Name,
                Name         = "Big Rig"
            };

            DevKit.AddAndAssert(rig);

            // Delete wellbore
            var delete = new Wellbore {
                Uid = Wellbore.Uid, UidWell = Well.Uid
            };

            var results = DevKit.Delete <WellboreList, Wellbore>(delete, ObjectTypes.Wellbore);

            Assert.IsNotNull(results);
            Assert.AreEqual((short)ErrorCodes.NotBottomLevelDataObject, results.Result);
        }
Пример #7
0
        public static WitsmlWellbores CreateWitsmlWellbore(Wellbore wellbore)
        {
            if (!string.IsNullOrEmpty(wellbore.WellboreParentUid))
            {
                return(new WitsmlWellbores
                {
                    Wellbores = new WitsmlWellbore
                    {
                        Uid = wellbore.Uid,
                        Name = wellbore.Name,
                        UidWell = wellbore.WellUid,
                        NameWell = wellbore.WellName,
                        ParentWellbore = new WitsmlParentWellbore
                        {
                            UidRef = wellbore.WellboreParentUid,
                            Value = wellbore.WellboreParentName
                        },
                        PurposeWellbore = wellbore.WellborePurpose
                    }.AsSingletonList()
                });
            }

            return(new WitsmlWellbores
            {
                Wellbores = new WitsmlWellbore
                {
                    Uid = wellbore.Uid,
                    Name = wellbore.Name,
                    UidWell = wellbore.WellUid,
                    NameWell = wellbore.WellName,
                    PurposeWellbore = wellbore.WellborePurpose
                }.AsSingletonList()
            });
        }
Пример #8
0
        public async Task Wellbore141_PutObject_Can_Add_Wellbore()
        {
            AddParents();
            await RequestSessionAndAssert();

            var handler = _client.Handler <IStoreCustomer>();
            var uri     = Wellbore.GetUri();

            var dataObject = CreateDataObject <WellboreList, Wellbore>(uri, Wellbore);

            // Get Object Expecting it Not to Exist
            await GetAndAssert(handler, uri, Energistics.Etp.EtpErrorCodes.NotFound);

            // Put Object
            await PutAndAssert(handler, dataObject);

            // Get Object
            var args = await GetAndAssert(handler, uri);

            // Check Data Object XML
            Assert.IsNotNull(args?.Message.DataObject);
            var xml = args.Message.DataObject.GetString();

            var result = Parse <WellboreList, Wellbore>(xml);

            Assert.IsNotNull(result);
        }
Пример #9
0
        public override string Xml(EtpVersion version, string indentation = "", bool embedded = false) =>
        $@"{indentation}<ChannelSet{Namespaces(embedded)} schemaVersion=""2.0"" uuid=""{Uuid}""{DefaultNamespace(embedded)}>
{indentation}  <Citation xmlns=""http://www.energistics.org/energyml/data/commonv2"">
{indentation}    <Title>{Title}</Title>
{indentation}    <Originator>ETP DevKit</Originator>
{indentation}    <Creation>{Creation.ToUniversalTime():O}</Creation>
{indentation}    <Format>Energistics:ETP DevKit {typeof(IEtpSession).Assembly.GetName().Version}</Format>
{indentation}    <LastUpdate>{LastUpdate.ToUniversalTime():O}</LastUpdate>
{indentation}  </Citation>
{indentation}  <Index>
{indentation}    <IndexType>{(IsTime ? "date time" : "measured depth")}</IndexType>
{indentation}    <Uom>{(IsTime ? "s" : "m")}</Uom>
{indentation}    <Direction>increasing</Direction>
{indentation}    <Mnemonic>{(IsTime ? "Time" : "Depth")}</Mnemonic>
{indentation}  </Index>
{string.Concat(Channels.Select(c => c.Xml(version, indentation = "  ", embedded = true)))}
{indentation}  <TimeDepth>{(IsTime ? "time" : "depth")}</TimeDepth>
{indentation}  <StartIndex xsi:type=""{(IsTime ? "TimeIndexValue" : "DepthIndexValue")}"">
{indentation}    <{(IsTime ? "Time" : "Depth")}>{(IsTime ? TimeStartIndex?.ToString("O", CultureInfo.InvariantCulture) : DepthStartIndex?.ToString(CultureInfo.InvariantCulture))}</{(IsTime ? "Time" : "Depth")}>
{indentation}  </StartIndex>
{indentation}  <EndIndex xsi:type=""{(IsTime ? "TimeIndexValue" : "DepthIndexValue")}"">
{indentation}    <{(IsTime ? "Time" : "Depth")}>{(IsTime ? TimeEndIndex?.ToString("O", CultureInfo.InvariantCulture) : DepthEndIndex?.ToString(CultureInfo.InvariantCulture))}</{(IsTime ? "Time" : "Depth")}>
{indentation}  </EndIndex>
{indentation}  <LoggingCompanyName>ETP DevKit</LoggingCompanyName>
{indentation}  <Wellbore>
{indentation}    <ContentType xmlns=""http://www.energistics.org/energyml/data/commonv2"">{Wellbore.ContentType}</ContentType>
{indentation}    <Title xmlns=""http://www.energistics.org/energyml/data/commonv2"">{Wellbore.Title}</Title>
{indentation}    <Uuid xmlns=""http://www.energistics.org/energyml/data/commonv2"">{Wellbore.Uuid}</Uuid>
{indentation}    <Uri xmlns=""http://www.energistics.org/energyml/data/commonv2"">{Wellbore.Uri(version)}</Uri>
{indentation}  </Wellbore>
{indentation}</ChannelSet>";
Пример #10
0
        public void TestSetUp()
        {
            _devKit   = new DevKit141Aspect(TestContext);
            _provider = _devKit.Container.Resolve <IDatabaseProvider>();

            _testDataDir = new DirectoryInfo(@".\TestData").FullName;

            _devKit.Store.CapServerProviders = _devKit.Store.CapServerProviders
                                               .Where(x => x.DataSchemaVersion == OptionsIn.DataVersion.Version141.Value)
                                               .ToArray();

            _well = new Well {
                Uid = _devKit.Uid(), Name = _devKit.Name("Well 01"), TimeZone = _devKit.TimeZone
            };

            _wellbore = new Wellbore()
            {
                Uid      = _devKit.Uid(),
                UidWell  = _well.Uid,
                NameWell = _well.Name,
                Name     = _devKit.Name("Wellbore 01")
            };

            _log = _devKit.CreateLog(_devKit.Uid(), _devKit.Name("Log 01"), _well.Uid, _well.Name, _wellbore.Uid, _wellbore.Name);
        }
Пример #11
0
        public void CascadedDelete141Tests_Can_Delete_Well_With_Empty_Wellbores()
        {
            DevKit.AddAndAssert(Well);

            // Number of objects to generate
            var numOfObjects = 5;

            // Add 5 empty wellbores
            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);
            }

            // Delete well with cascadedDelete options in
            var deleteWell = new Well {
                Uid = Well.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(Well, false);
        }
Пример #12
0
        public async Task Wellbore131_PutObject_Can_Add_Wellbore()
        {
            AddParents();
            await RequestSessionAndAssert();

            var handler = _client.Handler <IStoreCustomer>();
            var uri     = Wellbore.GetUri();

            var dataObject = CreateDataObject <WellboreList, Wellbore>(uri, Wellbore);

            // Get Object
            var args = await GetAndAssert(handler, uri);

            // Check for message flag indicating No Data
            Assert.IsNotNull(args?.Header);
            Assert.AreEqual((int)MessageFlags.NoData, args.Header.MessageFlags);

            // Put Object
            await PutAndAssert(handler, dataObject);

            // Get Object
            args = await GetAndAssert(handler, uri);

            // Check Data Object XML
            Assert.IsNotNull(args?.Message.DataObject);
            var xml = args.Message.DataObject.GetString();

            var result = Parse <WellboreList, Wellbore>(xml);

            Assert.IsNotNull(result);
        }
 private void Verify(Wellbore wellbore)
 {
     if (string.IsNullOrEmpty(wellbore.Name))
     {
         throw new InvalidOperationException($"{nameof(wellbore.Name)} cannot be empty");
     }
 }
Пример #14
0
        public async Task Well141_DeleteObject_Cannot_Delete_Well_With_Child_Wellbore()
        {
            AddParents();
            await RequestSessionAndAssert();

            var handler = _client.Handler <IStoreCustomer>();
            var uri     = Well.GetUri();

            var dataObject = CreateDataObject <WellList, Well>(uri, Well);

            // Put Object
            await PutAndAssert(handler, dataObject);

            var wellbore = new Wellbore()
            {
                UidWell  = Well.Uid,
                Uid      = DevKit.Uid(),
                NameWell = Well.Name,
                Name     = DevKit.Name("Wellbore")
            };

            var wellboreObject = CreateDataObject <WellboreList, Wellbore>(wellbore.GetUri(), wellbore);

            // Put Wellbore
            await PutAndAssert(handler, wellboreObject);

            // Delete Well
            await DeleteAndAssert(handler, uri, EtpErrorCodes.NoCascadeDelete);

            // Delete Wellbore
            await DeleteAndAssert(handler, wellbore.GetUri());

            // Delete Well
            await DeleteAndAssert(handler, uri);
        }
        public void Wellbore141DataAdapter_DeleteFromStore_Can_Delete_FullWellbore_With_Case_Insensitive_Uid()
        {
            var uid = DevKit.Uid();

            Wellbore.Uid = "wb" + uid;

            // Add wellbore
            AddParents();
            DevKit.AddAndAssert(Wellbore);

            // Assert wellbore is added
            DevKit.GetAndAssert(Wellbore);

            // Delete wellbore
            var delete = new Wellbore {
                Uid = "Wb" + uid, UidWell = Wellbore.UidWell
            };

            DevKit.DeleteAndAssert(delete);

            // Assert the wellbore has been deleted
            var results = DevKit.Query <WellboreList, Wellbore>(delete, ObjectTypes.Wellbore, null, optionsIn: OptionsIn.ReturnElements.All);

            Assert.AreEqual(0, results.Count);
        }
        public void Wellbore141DataAdapter_UpdateInStore_Error_464_Updating_An_Element_With_Same_UID_As_Existing_Element()
        {
            // Add well
            DevKit.AddAndAssert(Well);

            // Add wellbore
            DevKit.AddAndAssert(Wellbore);

            var extensionName1 = DevKit.ExtensionNameValue("SameUID", "1.0", "m");
            var extensionName2 = DevKit.ExtensionNameValue("SameUID", "2.0", "m");

            // Create an update well that adds a recurring element for the first time on update
            var update = new Wellbore()
            {
                UidWell    = Well.Uid,
                Uid        = Wellbore.Uid,
                CommonData = new CommonData
                {
                    ExtensionNameValue = new List <ExtensionNameValue>
                    {
                        extensionName1, extensionName2
                    }
                }
            };

            var results = DevKit.Update <WellboreList, Wellbore>(update);

            Assert.IsNotNull(results);
            Assert.AreEqual((short)ErrorCodes.ChildUidNotUnique, results.Result);
        }
Пример #17
0
 protected override void PrepareData()
 {
     Well = new Well
     {
         Uuid     = DevKit.Uid(),
         Citation = DevKit.Citation("Well"),
         GeographicLocationWGS84 = DevKit.Location(),
         SchemaVersion           = "2.0",
         TimeZone = DevKit.TimeZone
     };
     Wellbore = new Wellbore
     {
         Uuid          = DevKit.Uid(),
         Citation      = DevKit.Citation("Wellbore"),
         Well          = DevKit.DataObjectReference(Well),
         SchemaVersion = "2.0"
     };
     Tubular = new Tubular
     {
         Uuid          = DevKit.Uid(),
         Citation      = DevKit.Citation("Tubular"),
         Wellbore      = DevKit.DataObjectReference(Wellbore),
         SchemaVersion = EtpUris.GetUriFamily(typeof(Tubular)).Version,
     };
 }
Пример #18
0
        public void TestSetUp()
        {
            Logger.Debug($"Executing {TestContext.TestName}");
            DevKit = new DevKit131Aspect(TestContext);

            DevKit.Store.CapServerProviders = DevKit.Store.CapServerProviders
                                              .Where(x => x.DataSchemaVersion == OptionsIn.DataVersion.Version131.Value)
                                              .ToArray();

            Well = new Well
            {
                Uid  = DevKit.Uid(),
                Name = DevKit.Name("Well"),

                TimeZone = DevKit.TimeZone
            };
            Wellbore = new Wellbore
            {
                Uid  = DevKit.Uid(),
                Name = DevKit.Name("Wellbore"),

                UidWell   = Well.Uid,
                NameWell  = Well.Name,
                MDCurrent = new MeasuredDepthCoord(0, MeasuredDepthUom.ft)
            };

            QueryEmptyList = DevKit.List(new Wellbore());

            BeforeEachTest();
            OnTestSetUp();
        }
        public void Well141DataAdapter_DeleteFromStore_Error_432_Deleting_AWell_Has_A_Child()
        {
            // Add well
            DevKit.AddAndAssert(Well);

            // Add wellbore
            var wellbore = new Wellbore()
            {
                UidWell  = Well.Uid,
                NameWell = Well.Name,
                Uid      = DevKit.Uid(),
                Name     = DevKit.Name("Wellbore 01")
            };

            DevKit.AddAndAssert(wellbore);

            var delete = new Well()
            {
                Uid = Well.Uid
            };
            // Delete well
            var deleteResponse = DevKit.Delete <WellList, Well>(delete);

            Assert.IsNotNull(deleteResponse);
            Assert.AreEqual((short)ErrorCodes.NotBottomLevelDataObject, deleteResponse.Result);
        }
        private static WitsmlWellbores SetupWellboreToCreate(Wellbore wellbore)
        {
            if (wellbore.WellboreParentUid != "")
            {
                return(new WitsmlWellbores
                {
                    Wellbores = new WitsmlWellbore
                    {
                        Uid = wellbore.Uid,
                        Name = wellbore.Name,
                        UidWell = wellbore.WellUid,
                        NameWell = wellbore.WellName,
                        ParentWellbore = new WitsmlParentWellbore
                        {
                            UidRef = wellbore.WellboreParentUid,
                            Value = wellbore.WellboreParentName
                        },
                        PurposeWellbore = wellbore.WellborePurpose
                    }.AsSingletonList()
                });
            }

            return(new WitsmlWellbores
            {
                Wellbores = new WitsmlWellbore
                {
                    Uid = wellbore.Uid,
                    Name = wellbore.Name,
                    UidWell = wellbore.WellUid,
                    NameWell = wellbore.WellName,
                    PurposeWellbore = wellbore.WellborePurpose
                }.AsSingletonList()
            });
        }
        public void Well141DataAdapter_DeleteFromStore_Error_419_Specifying_A_Non_Recuring_Container_Without_UID()
        {
            // Add a minimal test well and Assert its Success
            DevKit.AddAndAssert(Well);

            // Add wellbore
            var wellbore = new Wellbore()
            {
                UidWell  = Well.Uid,
                Uid      = DevKit.Uid(),
                Name     = DevKit.Name("Wellbore 01"),
                NameWell = Well.Name
            };

            DevKit.AddAndAssert(wellbore);

            // Add rig
            var rig = new Rig()
            {
                UidWell      = Well.Uid,
                UidWellbore  = wellbore.Uid,
                Uid          = DevKit.Uid(),
                Name         = DevKit.Name("Rig 01"),
                NameWellbore = wellbore.Name,
                NameWell     = Well.Name
            };

            DevKit.AddAndAssert(rig);
            var wellDatum = new WellDatum()
            {
                Uid  = "RIG",
                Name = "Rig",
                Rig  = new RefWellWellboreRig()
                {
                    RigReference = new RefNameString()
                    {
                        UidRef = rig.Uid,
                        Value  = rig.Name
                    }
                }
            };

            var returnWell = DevKit.GetAndAssert(Well);

            returnWell.WellDatum = new List <WellDatum>()
            {
                wellDatum
            };
            DevKit.UpdateAndAssert(returnWell);

            // Delete
            var deleteXml = string.Format(BasicXMLTemplate, Well.Uid,
                                          $"<wellDatum uid=\"{wellDatum.Uid}\"><rig /></wellDatum>");

            var results = DevKit.DeleteFromStore(ObjectTypes.Well, deleteXml, null, null);

            Assert.IsNotNull(results);
            Assert.AreEqual((short)ErrorCodes.EmptyNonRecurringElementSpecified, results.Result);
        }
        public async Task Wellbore200_PutObject_Can_Update_Wellbore()
        {
            AddParents();
            await RequestSessionAndAssert();

            var handler = _client.Handler <IStoreCustomer>();
            var uri     = Wellbore.GetUri();

            // Add a ExtensionNameValue to Data Object
            var envName = "TestPutObject";
            var env     = DevKit.ExtensionNameValue(envName, envName);

            Wellbore.ExtensionNameValue = new List <ExtensionNameValue>()
            {
                env
            };

            var dataObject = CreateDataObject(uri, Wellbore);

            // Get Object Expecting it Not to Exist
            await GetAndAssert(handler, uri, Energistics.EtpErrorCodes.NotFound);

            // Put Object for Add
            await PutAndAssert(handler, dataObject);

            // Get Added Object
            var args = await GetAndAssert(handler, uri);

            // Check Added Data Object XML
            Assert.IsNotNull(args?.Message.DataObject);
            var xml = args.Message.DataObject.GetString();

            var result = Parse <Wellbore>(xml);

            Assert.IsNotNull(result);
            Assert.IsNotNull(result.ExtensionNameValue.FirstOrDefault(e => e.Name.Equals(envName)));

            // Remove Comment from Data Object
            result.ExtensionNameValue.Clear();

            var updateDataObject = CreateDataObject(uri, result);

            // Put Object for Update
            await PutAndAssert(handler, updateDataObject);

            // Get Updated Object
            args = await GetAndAssert(handler, uri);

            // Check Added Data Object XML
            Assert.IsNotNull(args?.Message.DataObject);
            var updateXml = args.Message.DataObject.GetString();

            result = Parse <Wellbore>(updateXml);
            Assert.IsNotNull(result);

            // Test Data Object overwrite
            Assert.IsNull(result.ExtensionNameValue.FirstOrDefault(e => e.Name.Equals(envName)));
        }
Пример #23
0
 private Resource ToResource(Wellbore entity)
 {
     return(DiscoveryStoreProvider.New(
                uuid: entity.Uid,
                uri: entity.GetUri(),
                resourceType: ResourceTypes.DataObject,
                name: entity.Name,
                count: -1));
 }
Пример #24
0
 protected override void UpdateDataLastWrite(DateTime lastWrite)
 {
     base.UpdateDataLastWrite(lastWrite);
     SetActive(true, lastWrite);
     if (Wellbore != null)
     {
         Wellbore.SetActive(true, lastWrite);
     }
 }
Пример #25
0
        public void Witsml141Context_GetObjectDetails_Can_Query_For_Object_Details_With_OptionsIn()
        {
            AddParents();

            var objectDetails = Context.GetObjectDetails(ObjectTypes.Wellbore, Wellbore.GetUri(), OptionsIn.ReturnElements.IdOnly);

            Assert.IsNotNull(objectDetails);
            Assert.AreEqual(Wellbore.Uid, objectDetails.Uid);
        }
Пример #26
0
 private IResource ToResource(IEtpAdapter etpAdapter, Wellbore entity)
 {
     return(etpAdapter.CreateResource(
                uuid: null,
                uri: entity.GetUri(),
                resourceType: ResourceTypes.DataObject,
                name: entity.Name,
                count: GetWellboreDataAdapters().Count(),
                lastChanged: entity.GetLastChangedMicroseconds()));
 }
Пример #27
0
        public void Wellbore141Validator_GetFromStore_without_ReturnElements_Error_407_Missing_Witsml_Object_Type()
        {
            var wellbore = new Wellbore {
                Name = "Wellbore-to-query-missing-witsml-type"
            };
            var response = DevKit.Get <WellboreList, Wellbore>(DevKit.List(wellbore), string.Empty);

            Assert.IsNotNull(response);
            Assert.AreEqual((short)ErrorCodes.MissingWmlTypeIn, response.Result);
        }
Пример #28
0
        public async Task Wellbore141_PutObject_Can_Update_Wellbore()
        {
            AddParents();
            await RequestSessionAndAssert();

            var handler = _client.Handler <IStoreCustomer>();
            var uri     = Wellbore.GetUri();

            // Add a Comment to Data Object
            Wellbore.CommonData = new CommonData()
            {
                Comments = "Test PutObject"
            };

            var dataObject = CreateDataObject <WellboreList, Wellbore>(uri, Wellbore);

            // Get Object Expecting it Not to Exist
            await GetAndAssert(handler, uri, Energistics.Etp.EtpErrorCodes.NotFound);

            // Put Object for Add
            await PutAndAssert(handler, dataObject);

            // Get Added Object
            var args = await GetAndAssert(handler, uri);

            // Check Added Data Object XML
            Assert.IsNotNull(args?.Message.DataObject);
            var xml = args.Message.DataObject.GetString();

            var result = Parse <WellboreList, Wellbore>(xml);

            Assert.IsNotNull(result);
            Assert.IsNotNull(result.CommonData.Comments);

            // Remove Comment from Data Object
            result.CommonData.Comments = null;

            var updateDataObject = CreateDataObject <WellboreList, Wellbore>(uri, result);

            // Put Object for Update
            await PutAndAssert(handler, updateDataObject);

            // Get Updated Object
            args = await GetAndAssert(handler, uri);

            // Check Added Data Object XML
            Assert.IsNotNull(args?.Message.DataObject);
            var updateXml = args.Message.DataObject.GetString();

            result = Parse <WellboreList, Wellbore>(updateXml);
            Assert.IsNotNull(result);

            // Test Data Object overwrite
            Assert.IsNull(result.CommonData.Comments);
        }
        public void Wellbore141DataAdapter_UpdateInStore_Error_444_Updating_With_More_Than_One_Data_Object()
        {
            // Add well
            DevKit.AddAndAssert(Well);

            // Add second well
            var well2 = new Well()
            {
                Uid      = DevKit.Uid(),
                Name     = DevKit.Name("Well 02"),
                TimeZone = DevKit.TimeZone
            };

            DevKit.AddAndAssert(well2);

            // Add wellbore
            DevKit.AddAndAssert(Wellbore);

            // Add second wellbore
            var wellbore2 = new Wellbore()
            {
                UidWell  = well2.Uid,
                NameWell = well2.Name,
                Uid      = DevKit.Uid(),
                Name     = DevKit.Name("Wellbore 02"),
                MD       = new MeasuredDepthCoord(0, MeasuredDepthUom.ft)
            };

            DevKit.AddAndAssert(wellbore2);

            var multiObjectXml = "<wellbores xmlns=\"http://www.witsml.org/schemas/1series\" version=\"1.4.1.1\">" + Environment.NewLine +
                                 "   <wellbore uidWell=\"{0}\" uid=\"{1}\">" + Environment.NewLine +
                                 "{2}" +
                                 "   </wellbore>" + Environment.NewLine +
                                 "   <wellbore uidWell=\"{3}\" uid=\"{4}\">" + Environment.NewLine +
                                 "{5}" +
                                 "   </wellbore>" + Environment.NewLine +
                                 "</wellbores>";

            // Update wellbore
            var updateXml = string.Format(
                multiObjectXml,
                Well.Uid,
                Wellbore.Uid,
                "<md uom=\"ft\">1</md>",
                well2.Uid,
                wellbore2.Uid,
                "<md uom=\"ft\">2</md>"
                );

            var results = DevKit.UpdateInStore(ObjectTypes.Wellbore, updateXml, null, null);

            Assert.IsNotNull(results);
            Assert.AreEqual((short)ErrorCodes.InputTemplateMultipleDataObjects, results.Result);
        }
Пример #30
0
        public WellboreGridViewModel(Wellbore wellbore) : this()
        {
            Id     = wellbore.Id;
            Name   = wellbore.Name;
            WellId = wellbore.WellId;

            foreach (ProfilePath profilePath in wellbore.ProfilePaths)
            {
                ChildItems.AddExisting(new ProfilePathGridViewModel(profilePath));
            }
        }