Ejemplo n.º 1
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);
        }
Ejemplo n.º 2
0
 private IResource ToResource(IEtpAdapter etpAdapter, Wellbore entity)
 {
     return(etpAdapter.CreateResource(
                uuid: null,
                uri: entity.GetUri(),
                resourceType: ResourceTypes.DataObject,
                name: entity.Name,
                count: _logDataProvider.Count(entity.GetUri()),
                lastChanged: entity.GetLastChangedMicroseconds()));
 }
Ejemplo n.º 3
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);
        }
Ejemplo n.º 4
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);
        }
        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)));
        }
Ejemplo n.º 6
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);
        }
Ejemplo n.º 7
0
 private Resource ToResource(Wellbore entity)
 {
     return(DiscoveryStoreProvider.New(
                uuid: entity.Uid,
                uri: entity.GetUri(),
                resourceType: ResourceTypes.DataObject,
                name: entity.Name,
                count: -1));
 }
Ejemplo n.º 8
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);
        }
Ejemplo n.º 9
0
        public async Task Wellbore141_GetResources_Can_Get_All_Wellbore_Resources()
        {
            AddParents();
            DevKit.AddAndAssert <WellboreList, Wellbore>(Wellbore);
            await RequestSessionAndAssert();

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

            await GetResourcesAndAssert(parentUri);

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

            await GetResourcesAndAssert(folderUri);
        }
Ejemplo n.º 10
0
        public async Task Wellbore200_PutObject_Can_Add_200_Wellbores()
        {
            AddParents();

            await RequestSessionAndAssert();

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

            foreach (var i in Enumerable.Range(1, 200))
            {
                Wellbore.Uuid           = DevKit.Uid();
                Wellbore.Citation       = DevKit.Citation("Wellbore");
                Wellbore.Citation.Title = "Wellbore " + i.ToString().PadLeft(3, '0');

                var dataObject = CreateDataObject(Wellbore.GetUri(), Wellbore);

                // Put Object
                await PutAndAssert(handler, dataObject);
            }
        }
Ejemplo n.º 11
0
        public async Task Wellbore141_DeleteObject_Cannot_Delete_Well_With_Child_Object()
        {
            AddParents();
            await RequestSessionAndAssert();

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

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

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

            var message = new Message()
            {
                UidWell      = Well.Uid,
                UidWellbore  = Wellbore.Uid,
                Uid          = DevKit.Uid(),
                NameWell     = Well.Name,
                NameWellbore = Wellbore.Name,
                Name         = DevKit.Name("Wellbore"),
                DateTime     = new Timestamp(),
                TypeMessage  = MessageType.unknown
            };

            var messageObject = CreateDataObject <MessageList, Message>(message.GetUri(), message);

            // Put Message
            await PutAndAssert(handler, messageObject);

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

            // Delete Message
            await DeleteAndAssert(handler, message.GetUri());

            // Delete Wellbore
            await DeleteAndAssert(handler, uri);
        }
Ejemplo n.º 12
0
        public async Task Wellbore131_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
            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 <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);
        }