Ejemplo n.º 1
0
        public void WbGeometry141_GetResources_IsValidUri()
        {
            var providers = DevKit.Container.ResolveAll <PDS.WITSMLstudio.Store.Providers.Discovery.IDiscoveryStoreProvider>();

            Assert.IsNotNull(providers);

            var list = providers.ToList();

            Assert.IsTrue(list.Any());

            foreach (var provider in list)
            {
                Debug.WriteLine(provider.DataSchemaVersion);
            }

            var actual = list.FirstOrDefault(x => x.DataSchemaVersion == "1.4.1.1") as Providers.Discovery.Witsml141Provider;

            Assert.IsNotNull(actual);

            var access = new PrivateObject(actual);

            var uri       = WbGeometry.GetUri();
            var parentUri = uri.Parent;
            var folderUri = parentUri.Append(uri.ObjectType);

            bool valid = (bool)access.Invoke("IsValidUri", folderUri);

            Assert.IsTrue(valid);
        }
Ejemplo n.º 2
0
        public async Task WbGeometry141_PutObject_Can_Add_WbGeometry()
        {
            AddParents();
            await RequestSessionAndAssert();

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

            var dataObject = CreateDataObject <WbGeometryList, WbGeometry>(uri, WbGeometry);

            // 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 <WbGeometryList, WbGeometry>(xml);

            Assert.IsNotNull(result);
        }
Ejemplo n.º 3
0
        public async Task WbGeometry141_GetResources_Can_Get_All_WbGeometry_Resources_2()
        {
            AddParents();
            DevKit.AddAndAssert <WbGeometryList, WbGeometry>(WbGeometry);
            {
                var actual = await RequestSessionAndAssert();

                Assert.IsNotNull(actual);
            }

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

            {
                var actual = await GetResourcesAndAssert(parentUri);

                Assert.IsNotNull(actual);
                Assert.IsTrue(actual.Any());
            }

            {
                var folderUri = parentUri.Append(uri.ObjectType);
                var actual    = await GetResourcesAndAssert(folderUri);

                Assert.IsNotNull(actual);
                Assert.IsTrue(actual.Any());
            }
        }
Ejemplo n.º 4
0
        public async Task WbGeometry141_PutObject_Can_Add_WbGeometry()
        {
            AddParents();
            await RequestSessionAndAssert();

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

            var dataObject = CreateDataObject <WbGeometryList, WbGeometry>(uri, WbGeometry);

            // 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 <WbGeometryList, WbGeometry>(xml);

            Assert.IsNotNull(result);
        }
        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)
            };
            WbGeometry = new WbGeometry
            {
                Uid          = DevKit.Uid(),
                Name         = DevKit.Name("WbGeometry"),
                UidWell      = Well.Uid,
                NameWell     = Well.Name,
                UidWellbore  = Wellbore.Uid,
                NameWellbore = Wellbore.Name
            };

            QueryEmptyList = DevKit.List(new WbGeometry());
        }
Ejemplo n.º 6
0
        public async Task WbGeometry141_PutObject_Can_Update_WbGeometry()
        {
            AddParents();
            await RequestSessionAndAssert();

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

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

            var dataObject = CreateDataObject <WbGeometryList, WbGeometry>(uri, WbGeometry);

            // 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 <WbGeometryList, WbGeometry>(xml);

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

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

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

            // Test Data Object overwrite
            Assert.IsNull(result.CommonData.Comments);
        }
Ejemplo n.º 7
0
        public async Task WbGeometry141_GetResources_Can_Get_All_WbGeometry_Resources()
        {
            AddParents();
            DevKit.AddAndAssert <WbGeometryList, WbGeometry>(WbGeometry);
            await RequestSessionAndAssert();

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

            await GetResourcesAndAssert(parentUri);

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

            await GetResourcesAndAssert(folderUri);
        }
        public void TestSetUp()
        {
            Logger.Debug($"Executing {TestContext.TestName}");
            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"),

                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)
            };
            WbGeometry = new WbGeometry
            {
                Uid  = DevKit.Uid(),
                Name = DevKit.Name("WbGeometry"),

                UidWell      = Well.Uid,
                NameWell     = Well.Name,
                UidWellbore  = Wellbore.Uid,
                NameWellbore = Wellbore.Name
            };

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

            BeforeEachTest();
            OnTestSetUp();
        }
Ejemplo n.º 9
0
        public async Task WbGeometry141_PutObject_Can_Update_WbGeometry()
        {
            AddParents();
            await RequestSessionAndAssert();

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

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

            var dataObject = CreateDataObject <WbGeometryList, WbGeometry>(uri, WbGeometry);

            // 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 <WbGeometryList, WbGeometry>(xml);

            Assert.IsNotNull(result);

            Assert.IsNotNull(result.CommonData.Comments);

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

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

            Assert.IsNotNull(result);

            // Test Data Object overwrite

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