public void Log141DataAdapter_AddToStore_With_Custom_Data_Delimiter()
        {
            var delimiter = "|";

            AddParents();

            // Set data delimiter to other charactrer than ","
            Log.DataDelimiter = delimiter;

            DevKit.InitHeader(Log, LogIndexType.measureddepth);
            DevKit.InitDataMany(Log, DevKit.Mnemonics(Log), DevKit.Units(Log), 10, hasEmptyChannel: false);

            var response = DevKit.Add <LogList, Log>(Log);

            Assert.AreEqual((short)ErrorCodes.Success, response.Result);

            var result = GetLog(Log);

            // Assert data delimiter
            Assert.AreEqual(delimiter, result.DataDelimiter);

            var data = result.LogData.FirstOrDefault()?.Data;

            Assert.IsNotNull(data);

            var channelCount = Log.LogCurveInfo.Count;

            // Assert data delimiter in log data
            foreach (var row in data)
            {
                var points = ChannelDataReader.Split(row, delimiter);
                Assert.AreEqual(channelCount, points.Length);
            }
        }
        public void Well141DataAdapter_UpdateInStore_Add_Nested_Array_Element_With_Uom_Success()
        {
            var well = DevKit.GetFullWell();

            well.Uid = DevKit.Uid();
            var referencePoint = well.ReferencePoint;

            well.ReferencePoint = null;
            var response = DevKit.Add <WellList, Well>(well);

            Assert.IsNotNull(response);
            Assert.AreEqual((short)ErrorCodes.Success, response.Result);

            // Create an update well with a new element that has attributes and Assert Success
            var updateWell = new Well()
            {
                Uid            = response.SuppMsgOut,
                ReferencePoint = referencePoint
            };

            var updateResponse = DevKit.Update <WellList, Well>(updateWell);

            Assert.IsNotNull(updateResponse);
            Assert.AreEqual((short)ErrorCodes.Success, updateResponse.Result);
        }
        public void Well141DataAdapter_UpdateInStore_Add_Nested_Element_Success()
        {
            // Add a minimal test well and Assert its Success
            Well.Name = DevKit.Name("WellAddNestedOnUpdate");
            var response = DevKit.Add <WellList, Well>(Well);

            Assert.IsNotNull(response);
            Assert.AreEqual((short)ErrorCodes.Success, response.Result);

            // Create an update well that adds a nested (non-recurring) element for the first time on update
            var updateWell = new Well()
            {
                Uid = response.SuppMsgOut,
                WellPublicLandSurveySystemLocation =
                    new PublicLandSurveySystem()
                {
                    PrincipalMeridian = PrincipalMeridian.ChoctawMeridian, Range = 1
                }
            };

            var updateResponse = DevKit.Update <WellList, Well>(updateWell);

            Assert.IsNotNull(updateResponse);
            Assert.AreEqual((short)ErrorCodes.Success, updateResponse.Result);
        }
        public void Well131DataAdapter_GetFromStore_Ignore_Uom_Attributes()
        {
            var well            = DevKit.CreateTestWell();
            var responseAddWell = DevKit.Add <WellList, Well>(well);

            Assert.IsNotNull(responseAddWell);
            Assert.AreEqual((short)ErrorCodes.Success, responseAddWell.Result);

            var uid = responseAddWell.SuppMsgOut;

            string queryIn = @" <wells xmlns=""http://www.witsml.org/schemas/131"" version=""1.3.1.1"">                                
                                <well uid=""" + uid + @""">
                                    <name />
                                    <groundElevation uom=""m"" />
                                    <measuredDepth uom=""ft"" /> 
                                    <waterDepth uom=""ft"" />                               
                                </well>
                                </wells>";

            var response = DevKit.GetFromStore(ObjectTypes.Well, queryIn, null, "");

            Assert.AreEqual((short)ErrorCodes.Success, response.Result);

            var wellListObject = EnergisticsConverter.XmlToObject <WellList>(response.XMLout);

            Assert.IsNotNull(wellListObject);
            Assert.AreEqual(1, wellListObject.Well.Count);
            Assert.AreEqual(uid, wellListObject.Well[0].Uid);
            Assert.AreEqual(well.Name, wellListObject.Well[0].Name);
        }
        public void Well141DataAdapter_UpdateInStore_Add_Element_With_Attribute_Success()
        {
            // Add a wellDatum to the test Well
            Well.Name      = DevKit.Name("WellAddWithAttributesOnUpdate");
            Well.WellDatum = new List <WellDatum> {
                DevKit.WellDatum("Kelly Bushing", ElevCodeEnum.KB, "KB")
            };

            // Add a well with a datum that we can reference in the update
            var response = DevKit.Add <WellList, Well>(Well);

            Assert.IsNotNull(response);
            Assert.AreEqual((short)ErrorCodes.Success, response.Result);

            // Create an update well with a new element that has attributes and Assert Success
            var updateWell = new Well()
            {
                Uid = response.SuppMsgOut,
                WellheadElevation = new WellElevationCoord()
                {
                    Uom = WellVerticalCoordinateUom.m, Datum = "KB"
                }
            };

            var updateResponse = DevKit.Update <WellList, Well>(updateWell);

            Assert.IsNotNull(updateResponse);
            Assert.AreEqual((short)ErrorCodes.Success, updateResponse.Result);
        }
        public void Well141DataAdapter_AddToStore_With_PrivateGroupOnly_True()
        {
            // Prevent large debug log output
            WitsmlSettings.TruncateXmlOutDebugSize = 100;

            // Add a well with PrivateGroupOnly set to false
            Well.CommonData = new CommonData()
            {
                PrivateGroupOnly = true
            };
            var response = DevKit.Add <WellList, Well>(Well);

            Assert.IsNotNull(response);
            Assert.AreEqual((short)ErrorCodes.Success, response.Result);

            var uidWell = response.SuppMsgOut;

            Assert.IsFalse(string.IsNullOrEmpty(uidWell));

            // Query all wells with default OptionsIn
            var query  = new Well();
            var result = DevKit.Query <WellList, Well>(query, optionsIn: OptionsIn.ReturnElements.All);

            Assert.IsNotNull(result);

            Assert.IsFalse(result.Any(x => x.CommonData?.PrivateGroupOnly ?? false));
            Assert.IsFalse(result.Any(x => uidWell.Equals(x.Uid)));
        }
Beispiel #7
0
        public void WitsmlValidator_AddToStore_Error_466_Non_Conforming_Capabilities_In()
        {
            var response = DevKit.Add <WellList, Well>(Well, ObjectTypes.Well, "<capClients />");

            Assert.IsNotNull(response);
            Assert.AreEqual((short)ErrorCodes.CapabilitiesInNonConforming, response.Result);
        }
        public void Log141DataAdapter_AddToStore_Structural_Ranges_Ignored()
        {
            AddParents();

            DevKit.InitHeader(Log, LogIndexType.measureddepth);

            Log.StartIndex = new GenericMeasure {
                Uom = "m", Value = 1.0
            };
            Log.EndIndex = new GenericMeasure {
                Uom = "m", Value = 10.0
            };

            foreach (var curve in Log.LogCurveInfo)
            {
                curve.MinIndex = Log.StartIndex;
                curve.MaxIndex = Log.EndIndex;
            }

            var response = DevKit.Add <LogList, Log>(Log);

            Assert.AreEqual((short)ErrorCodes.Success, response.Result);

            var result = GetLog(Log);

            Assert.IsNull(result.StartIndex);
            Assert.IsNull(result.EndIndex);

            Assert.AreEqual(Log.LogCurveInfo.Count, result.LogCurveInfo.Count);
            foreach (var curve in result.LogCurveInfo)
            {
                Assert.IsNull(curve.MinIndex);
                Assert.IsNull(curve.MaxIndex);
            }
        }
Beispiel #9
0
        public void WitsmlValidator_AddToStore_Error_407_Missing_Witsml_Object_Type()
        {
            var response = DevKit.Add <WellList, Well>(Well, string.Empty);

            Assert.IsNotNull(response);
            Assert.AreEqual((short)ErrorCodes.MissingWmlTypeIn, response.Result);
        }
        public void Log141DataAdapter_AddToStore_Add_DecreasingLog()
        {
            AddParents();

            Log.RunNumber  = "101";
            Log.IndexCurve = "MD";
            Log.IndexType  = LogIndexType.measureddepth;
            Log.Direction  = LogIndexDirection.decreasing;

            DevKit.InitHeader(Log, Log.IndexType.Value, increasing: false);
            DevKit.InitDataMany(Log, DevKit.Mnemonics(Log), DevKit.Units(Log), 100, 0.9, increasing: false);

            var response = DevKit.Add <LogList, Log>(Log);

            Assert.AreEqual((short)ErrorCodes.Success, response.Result);

            var logAdded = GetLog(Log);

            Assert.IsNotNull(logAdded);
            Assert.AreEqual(LogIndexDirection.decreasing, logAdded.Direction);
            Assert.AreEqual(Log.RunNumber, logAdded.RunNumber);

            var logData = logAdded.LogData.FirstOrDefault();

            Assert.IsNotNull(logData);
            var firstIndex  = int.Parse(logData.Data[0].Split(',')[0]);
            var secondIndex = int.Parse(logData.Data[1].Split(',')[0]);

            Assert.IsTrue(firstIndex > secondIndex);
        }
Beispiel #11
0
        public void Log131DataAdapter_GetFromStore_Request_Multiple_Recurring_Items_With_Empty_Value()
        {
            AddParents();

            DevKit.InitHeader(Log, LogIndexType.measureddepth, false);
            var responseAddLog = DevKit.Add <LogList, Log>(Log);

            Assert.IsNotNull(responseAddLog);
            Assert.AreEqual((short)ErrorCodes.Success, responseAddLog.Result);

            var queryIn = @"
                            <logs xmlns=""http://www.witsml.org/schemas/131"" version=""1.3.1.1"">      
                                <log uid=""" + Log.Uid + @""">
                                    <logCurveInfo> 
                                        <mnemonic>ROP</mnemonic> 
                                        <unit /> 
                                    </logCurveInfo>
                                    <logCurveInfo>
                                        <mnemonic>{0}</mnemonic> 
                                        <unit /> 
                                    </logCurveInfo>
                                </log>
                            </logs>";

            var response = DevKit.GetFromStore(ObjectTypes.Log, string.Format(queryIn, "GR"), null, null);

            Assert.IsNotNull(response);
            Assert.AreEqual((short)ErrorCodes.Success, response.Result);

            var responseError = DevKit.GetFromStore(ObjectTypes.Log, string.Format(queryIn, ""), null, null);

            Assert.IsNotNull(responseError);
            Assert.AreEqual((short)ErrorCodes.RecurringItemsEmptySelection, responseError.Result);
        }
Beispiel #12
0
        public void WitsmlValidator_AddToStore_Error_411_OptionsIn_Invalid_Format()
        {
            var response = DevKit.Add <WellList, Well>(Well, optionsIn: "compressionMethod:gzip");

            Assert.IsNotNull(response);
            Assert.AreEqual((short)ErrorCodes.ParametersNotEncodedByRules, response.Result);
        }
Beispiel #13
0
        public void WitsmlValidator_AddToStore_Error_440_OptionsIn_Keyword_Not_Recognized()
        {
            var response = DevKit.Add <WellList, Well>(Well, optionsIn: "returnElements=all");

            Assert.IsNotNull(response);
            Assert.AreEqual((short)ErrorCodes.KeywordNotSupportedByFunction, response.Result);
        }
Beispiel #14
0
        public void WitsmlValidator_AddToStore_Error_441_optionsIn_value_not_recognized()
        {
            var response = DevKit.Add <WellList, Well>(Well, optionsIn: "compressionMethod=7zip");

            Assert.IsNotNull(response);
            Assert.AreEqual((short)ErrorCodes.InvalidKeywordValue, response.Result);
        }
        public void Well141DataAdapter_UpdateInStore_Error_409_Missing_Required_Fields_For_Optional_Property()
        {
            // Add well
            var response = DevKit.Add <WellList, Well>(Well);

            Assert.IsNotNull(response);
            Assert.AreEqual((short)ErrorCodes.Success, response.Result);

            var uid = response.SuppMsgOut;

            var wellDatum = new WellDatum
            {
                Uid  = "DF",
                Code = ElevCodeEnum.DF
            };

            var update = new Well
            {
                Uid       = uid,
                WellDatum = new List <WellDatum> {
                    wellDatum
                }
            };

            var updateResponse = DevKit.Update <WellList, Well>(update);

            Assert.IsNotNull(updateResponse);
            Assert.AreEqual((short)ErrorCodes.UpdateTemplateNonConforming, updateResponse.Result);
        }
Beispiel #16
0
        public void WitsmlValidator_AddToStore_Error_442_OptionsIn_Keyword_Not_Supported()
        {
            var response = DevKit.Add <WellList, Well>(Well, optionsIn: "compressionMethod=gzip");

            Assert.IsNotNull(response);
            Assert.AreEqual((short)ErrorCodes.KeywordNotSupportedByServer, response.Result);
        }
        public void Log131DataAdapter_AddToStore_With_Non_Double_Data_Types()
        {
            AddParents();

            // Initialize Log Header
            DevKit.InitHeader(Log, LogIndexType.measureddepth);

            // Add Log Curves with double, datetime, long and string data types
            Log.LogCurveInfo.Clear();
            Log.LogCurveInfo.AddRange(new List <LogCurveInfo>()
            {
                DevKit.LogGenerator.CreateLogCurveInfo("MD", "m", LogDataType.@double, 0),
                DevKit.LogGenerator.CreateLogCurveInfo("ROP", "m/h", LogDataType.@double, 1),
                DevKit.LogGenerator.CreateLogCurveInfo("TS", "s", LogDataType.datetime, 2),
                DevKit.LogGenerator.CreateLogCurveInfo("CNT", "m", LogDataType.@long, 3),
                DevKit.LogGenerator.CreateLogCurveInfo("MSG", "unitless", LogDataType.@string, 4)
            });

            // Generated the data
            var numRows = 5;

            DevKit.LogGenerator.GenerateLogData(Log, numRows);

            var response = DevKit.Add <LogList, Log>(Log);

            Assert.AreEqual((short)ErrorCodes.Success, response.Result);

            var result = GetLog(Log);

            // Assert that Data Types match before and after
            for (var i = 0; i < Log.LogCurveInfo.Count; i++)
            {
                Assert.IsNotNull(Log.LogCurveInfo[i].TypeLogData);
                Assert.IsNotNull(result.LogCurveInfo[i].TypeLogData);
                Assert.AreEqual(Log.LogCurveInfo[i].TypeLogData.Value, result.LogCurveInfo[i].TypeLogData.Value);
            }

            // Assert data matches before and after
            var logData      = Log.LogData;
            var logDataAdded = result.LogData;

            Assert.AreEqual(logData.Count, logDataAdded.Count);

            // For each row of data
            for (int i = 0; i < logData.Count; i++)
            {
                var data      = logData[i].Split(',');
                var dataAdded = logDataAdded[i].Split(',');
                Assert.AreEqual(data.Length, dataAdded.Length);

                // Check that the string data matches
                for (int j = 0; j < data.Length; j++)
                {
                    if (Log.LogCurveInfo[j].TypeLogData.Value == LogDataType.@string)
                    {
                        Assert.AreEqual(data[j], dataAdded[j]);
                    }
                }
            }
        }
        public void Log131DataAdapter_AddToStore_Structural_Ranges_Ignored()
        {
            var response = DevKit.Add <WellList, Well>(Well);

            Wellbore.UidWell = response.SuppMsgOut;
            response         = DevKit.Add <WellboreList, Wellbore>(Wellbore);

            var log = new Log()
            {
                UidWell      = Wellbore.UidWell,
                NameWell     = Well.Name,
                UidWellbore  = response.SuppMsgOut,
                NameWellbore = Wellbore.Name,
                Name         = DevKit.Name()
            };

            DevKit.InitHeader(log, LogIndexType.measureddepth);

            log.StartIndex = new GenericMeasure {
                Uom = "m", Value = 1.0
            };
            log.EndIndex = new GenericMeasure {
                Uom = "m", Value = 10.0
            };

            foreach (var curve in log.LogCurveInfo)
            {
                curve.MinIndex = log.StartIndex;
                curve.MaxIndex = log.EndIndex;
            }

            response = DevKit.Add <LogList, Log>(log);
            Assert.AreEqual((short)ErrorCodes.Success, response.Result);

            var query = new Log
            {
                Uid         = response.SuppMsgOut,
                UidWell     = log.UidWell,
                UidWellbore = log.UidWellbore
            };

            var results = DevKit.Query <LogList, Log>(query, optionsIn: OptionsIn.ReturnElements.HeaderOnly);

            Assert.AreEqual(1, results.Count);

            var result = results.First();

            Assert.IsNotNull(result);

            Assert.IsNull(result.StartIndex);
            Assert.IsNull(result.EndIndex);

            Assert.AreEqual(log.LogCurveInfo.Count, result.LogCurveInfo.Count);
            foreach (var curve in result.LogCurveInfo)
            {
                Assert.IsNull(curve.MinIndex);
                Assert.IsNull(curve.MaxIndex);
            }
        }
        public void Wellbore141Validator_AddToStore_Error_406_Missing_Parent_Uid()
        {
            Wellbore.UidWell = null;
            var response = DevKit.Add <WellboreList, Wellbore>(Wellbore);

            Assert.IsNotNull(response);
            Assert.AreEqual((short)ErrorCodes.MissingElementUidForAdd, response.Result);
        }
Beispiel #20
0
        public void Trajectory141Validator_AddToStore_Error_442_OptionsIn_Keyword_Not_Supported()
        {
            AddParents();

            var response = DevKit.Add <TrajectoryList, Trajectory>(Trajectory, optionsIn: "compressionMethod=gzip");

            Assert.IsNotNull(response);
            Assert.AreEqual((short)ErrorCodes.KeywordNotSupportedByServer, response.Result);
        }
Beispiel #21
0
        public void Trajectory141Validator_AddToStore_Error_440_OptionsIn_Keyword_Not_Recognized()
        {
            AddParents();

            var response = DevKit.Add <TrajectoryList, Trajectory>(Trajectory, optionsIn: "returnElements=all");

            Assert.IsNotNull(response);
            Assert.AreEqual((short)ErrorCodes.KeywordNotSupportedByFunction, response.Result);
        }
Beispiel #22
0
        public void Trajectory141Validator_AddToStore_Error_441_optionsIn_value_not_recognized()
        {
            AddParents();

            var response = DevKit.Add <TrajectoryList, Trajectory>(Trajectory, optionsIn: "compressionMethod=7zip");

            Assert.IsNotNull(response);
            Assert.AreEqual((short)ErrorCodes.InvalidKeywordValue, response.Result);
        }
        public void Trajectory131Validator_AddToStore_Error_407_Missing_Witsml_Object_Type()
        {
            AddParents();

            var response = DevKit.Add <TrajectoryList, Trajectory>(Trajectory, string.Empty);

            Assert.IsNotNull(response);
            Assert.AreEqual((short)ErrorCodes.MissingWmlTypeIn, response.Result);
        }
Beispiel #24
0
        private WMLS_AddToStoreResponse AddWell(Well well, string wellName = null)
        {
            well.Name = wellName ?? well.Name;
            var response = DevKit.Add <WellList, Well>(well);

            Assert.IsNotNull(response);
            Assert.AreEqual((short)ErrorCodes.Success, response.Result);

            return(response);
        }
Beispiel #25
0
        public void WitsmlValidator_AddToStore_Error_409_Non_Conforming_Input_Template()
        {
            WitsmlSettings.DefaultTimeZone = null;

            Well.TimeZone = null; // <-- Missing required TimeZone
            var response = DevKit.Add <WellList, Well>(Well);

            Assert.IsNotNull(response);
            Assert.AreEqual((short)ErrorCodes.InputTemplateNonConforming, response.Result);
        }
        private void AddLogWithData(Log log, LogIndexType indexType, int numOfRows)
        {
            AddParents();

            DevKit.InitHeader(log, indexType);
            DevKit.InitDataMany(log, DevKit.Mnemonics(log), DevKit.Units(log), numOfRows);

            var response = DevKit.Add <LogList, Log>(log);

            Assert.AreEqual((short)ErrorCodes.Success, response.Result);
        }
        public void Log141DataAdapter_AddToStore_Add_Unsequenced_Decreasing_TimeLog()
        {
            AddParents();

            Log.StartDateTimeIndex = new Energistics.DataAccess.Timestamp();
            Log.EndDateTimeIndex   = new Energistics.DataAccess.Timestamp();
            Log.LogData            = DevKit.List(new LogData()
            {
                Data = DevKit.List <string>()
            });

            var logData = Log.LogData.First();

            logData.Data.Add("2016-04-13T15:30:42.0000000-05:00,30.1,30.2");
            logData.Data.Add("2016-04-13T15:35:42.0000000-05:00,35.1,35.2");
            logData.Data.Add("2016-04-13T15:31:42.0000000-05:00,31.1,31.2");
            logData.Data.Add("2016-04-13T15:32:42.0000000-05:00,32.1,32.2");
            logData.Data.Add("2016-04-13T15:33:42.0000000-05:00,33.1,33.2");
            logData.Data.Add("2016-04-13T15:34:42.0000000-05:00,34.1,34.2");

            DevKit.InitHeader(Log, LogIndexType.datetime, false);

            var response = DevKit.Add <LogList, Log>(Log);

            Assert.AreEqual((short)ErrorCodes.Success, response.Result);

            var result = GetLog(Log);

            Assert.AreEqual(1, result.LogData.Count);
            Assert.AreEqual(6, result.LogData[0].Data.Count);

            var            resultLogData    = result.LogData[0].Data;
            var            index            = 35;
            DateTimeOffset?previousDateTime = null;

            foreach (var row in resultLogData)
            {
                var columns  = row.Split(',');
                var outIndex = DateTimeOffset.Parse(columns[0]);
                Assert.AreEqual(index, outIndex.Minute);
                if (previousDateTime.HasValue)
                {
                    Assert.IsTrue((outIndex.ToUnixTimeMicroseconds() - previousDateTime.Value.ToUnixTimeMicroseconds()) == -60 * MicrosecondsPerSecond);
                }
                previousDateTime = outIndex;

                var outColumn1 = double.Parse(columns[1]);
                Assert.AreEqual(index + 0.1, outColumn1);

                var outColumn2 = double.Parse(columns[2]);
                Assert.AreEqual(index + 0.2, outColumn2);
                index--;
            }
        }
        public void Log141DataAdapter_AddToStore_Add_DepthLog_With_Data()
        {
            AddParents();

            DevKit.InitHeader(Log, LogIndexType.measureddepth);
            DevKit.InitDataMany(Log, DevKit.Mnemonics(Log), DevKit.Units(Log), 10);

            var response = DevKit.Add <LogList, Log>(Log);

            Assert.AreEqual((short)ErrorCodes.Success, response.Result);
        }
        public void Log131DataAdapter_AddToStore_Add_TimeLog_With_Data()
        {
            AddParents();

            DevKit.InitHeader(Log, LogIndexType.datetime);
            DevKit.InitDataMany(Log, DevKit.Mnemonics(Log), DevKit.Units(Log), 10, 1, false, false);

            var response = DevKit.Add <LogList, Log>(Log);

            Assert.AreEqual((short)ErrorCodes.Success, response.Result);
        }
        public void Log131DataAdapter_AddToStore_Error_Add_DepthLog_Without_IndexCurve()
        {
            AddParents();

            DevKit.InitHeader(Log, LogIndexType.measureddepth);
            DevKit.InitDataMany(Log, DevKit.Mnemonics(Log), DevKit.Units(Log), 10);
            Log.IndexCurve = null;
            var response = DevKit.Add <LogList, Log>(Log);

            Assert.AreEqual((short)ErrorCodes.InputTemplateNonConforming, response.Result);
        }