Beispiel #1
0
 private IResource ToResource(IEtpAdapter etpAdapter, Well entity)
 {
     return(etpAdapter.CreateResource(
                uuid: null,
                uri: entity.GetUri(),
                resourceType: ResourceTypes.DataObject,
                name: entity.Name,
                count: _wellboreDataProvider.Count(entity.GetUri()),
                lastChanged: entity.GetLastChangedMicroseconds()));
 }
Beispiel #2
0
        public async Task Well131_PutObject_Can_Add_Well()
        {
            AddParents();
            await RequestSessionAndAssert();

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

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

            // 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 <WellList, Well>(xml);

            Assert.IsNotNull(result);
        }
Beispiel #3
0
        public async Task Well141_PutObject_Can_Add_Well()
        {
            AddParents();
            await RequestSessionAndAssert();

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

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

            // 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 <WellList, Well>(xml);

            Assert.IsNotNull(result);
        }
Beispiel #4
0
        public async Task Well200_PutObject_Add_Well_Without_Citation_Returns_Protocol_Exception()
        {
            AddParents();
            await RequestSessionAndAssert();

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

            // Try adding minimal Well without Citation
            Well = new Well
            {
                Uuid          = DevKit.Uid(),
                SchemaVersion = "2.0"
            };

            var dataObject = CreateDataObject(uri, Well);

            dataObject.Resource.Name = DevKit.Name("Well 20");

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

            // Put Object
            await PutAndAssert(handler, dataObject, EtpErrorCodes.InvalidObject);
        }
Beispiel #5
0
        public async Task Well200_PutObject_Add_Well_Without_Citation_Returns_Protocol_Exception()
        {
            AddParents();
            await RequestSessionAndAssert();

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

            // Try adding minimal Well without Citation
            Well = new Well
            {
                Uuid          = DevKit.Uid(),
                SchemaVersion = "2.0"
            };

            var dataObject = CreateDataObject(uri, Well);

            dataObject.Resource.Name = DevKit.Name("Well 20");

            // 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, EtpErrorCodes.InvalidObject);
        }
Beispiel #6
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 Witsml141Context_GetAllWellbores_Can_Query_For_All_Wells()
        {
            AddParents();
            var wellbores = Context.GetWellbores(Well.GetUri()).ToList();

            Assert.IsTrue(wellbores.Count > 0);
            Assert.IsNotNull(wellbores.FirstOrDefault(w => w.Uid == Wellbore.Uid));
        }
        public async Task Well200_PutObject_Can_Update_Well()
        {
            AddParents();
            await RequestSessionAndAssert();

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

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

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

            var dataObject = CreateDataObject(uri, Well);

            // 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 <Well>(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 <Well>(updateXml);
            Assert.IsNotNull(result);

            // Test Data Object overwrite
            Assert.IsNull(result.ExtensionNameValue.FirstOrDefault(e => e.Name.Equals(envName)));
        }
        public void Witsml141Context_GetObjectIdOnly_Can_Query_For_Object_Ids()
        {
            AddParents();

            var objectIdOnly = Context.GetObjectIdOnly(ObjectTypes.Well, Well.GetUri());

            Assert.IsNotNull(objectIdOnly);
            Assert.AreEqual(Well.Uid, objectIdOnly.Uid);
        }
Beispiel #10
0
        public void Witsml141Context_GetObjectDetails_Can_Query_For_Object_Details()
        {
            AddParents();

            var objectDetails = Context.GetObjectDetails(ObjectTypes.Well, Well.GetUri());

            Assert.IsNotNull(objectDetails);
            Assert.AreEqual(Well.Uid, objectDetails.Uid);
        }
Beispiel #11
0
 private Resource ToResource(Well entity)
 {
     return(DiscoveryStoreProvider.New(
                uuid: entity.Uid,
                uri: entity.GetUri(),
                resourceType: ResourceTypes.DataObject,
                name: entity.Name,
                count: -1));
 }
Beispiel #12
0
        public async Task Well131_PutObject_Can_Update_Well()
        {
            AddParents();
            await RequestSessionAndAssert();

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

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

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

            // 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 <WellList, Well>(xml);

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

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

            var updateDataObject = CreateDataObject <WellList, Well>(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 <WellList, Well>(updateXml);
            Assert.IsNotNull(result);

            // Test Data Object overwrite
            Assert.IsNull(result.CommonData.Comments);
        }
Beispiel #13
0
        public async Task Well131_GetResources_Can_Get_All_Well_Resources()
        {
            AddParents();
            DevKit.AddAndAssert <WellList, Well>(Well);
            await RequestSessionAndAssert();

            var uri       = Well.GetUri();
            var parentUri = uri.Parent;

            await GetResourcesAndAssert(parentUri);

            var folderUri = parentUri.Append(uri.ObjectType);

            await GetResourcesAndAssert(folderUri);
        }
Beispiel #14
0
        public async Task Well141_PutObject_Can_Update_Well()
        {
            AddParents();
            await RequestSessionAndAssert();

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

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

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

            // 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 for Add
            await PutAndAssert(handler, dataObject);

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

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

            var result = Parse <WellList, Well>(xml);

            Assert.IsNotNull(result);

            Assert.IsNotNull(result.CommonData.Comments);

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

            var updateDataObject = CreateDataObject <WellList, Well>(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 <WellList, Well>(updateXml);

            Assert.IsNotNull(result);

            // Test Data Object overwrite

            Assert.IsNull(result.CommonData.Comments);
        }