示例#1
0
        public void ChannelDataChunkAdapter_AddToStore_Error_463_Nodes_With_Same_Index()
        {
            AddParents();

            var logData = _devKit.List <string>();

            _log.LogData = _devKit.List(new LogData()
            {
                Data = logData
            });

            logData.Add("13,13.1,");
            logData.Add("14,14.1,");
            logData.Add("15,15.1,");
            logData.Add("15,16.1,");
            logData.Add("17,17.1,");
            logData.Add("21,,21.2");
            logData.Add("22,,22.2");
            logData.Add("23,,23.2");
            _devKit.InitHeader(_log, LogIndexType.measureddepth);

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

            Assert.AreEqual((short)ErrorCodes.NodesWithSameIndex, response.Result);
        }
示例#2
0
        private void AddParents()
        {
            var response = _devKit.Add <WellList, Well>(_well);

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

            response = _devKit.Add <WellboreList, Wellbore>(_wellbore);
            Assert.AreEqual((short)ErrorCodes.Success, response.Result);
        }
示例#3
0
        public void WitsmlStore_AddToStore_Error_404_Invalid_Schema_Version()
        {
            var client = new CapClient {
                ApiVers = "1.4.1.1", SchemaVersion = "1.4.1.1,1.3.1.1"
            };
            var clients = new CapClients {
                Version = "1.4.1.1", CapClient = client
            };
            var capabilitiesIn = EnergisticsConverter.ObjectToXml(clients);
            var well           = new Well {
                Name = "Well-to-add-invalid-schema-version"
            };
            var response = _devKit.Add <WellList, Well>(well, capClient: capabilitiesIn);

            Assert.IsNotNull(response);
            Assert.AreEqual((short)ErrorCodes.InvalidClientSchemaVersion, response.Result);
        }
        public void Log141Adapter_AddToStore_Can_Add_Data_Chunk_Exceeds_MongoDb_Document_Size()
        {
            var response = _devKit.Add <WellList, Well>(_well);

            // Adjust Points and Nodes for large file
            WitsmlSettings.LogMaxDataPointsAdd = 5000000;
            WitsmlSettings.LogMaxDataNodesAdd  = 15000;
            WitsmlSettings.LogMaxDataPointsGet = 5000000;
            WitsmlSettings.LogMaxDataNodesGet  = 15000;

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

            var xmlfile = Path.Combine(_testDataDir, string.Format(_exceedFileFormat, "log"));
            var xmlin   = File.ReadAllText(xmlfile);

            var logList = EnergisticsConverter.XmlToObject <LogList>(xmlin);

            Assert.IsNotNull(logList);

            var log = logList.Log.FirstOrDefault();

            Assert.IsNotNull(log);

            log.Uid          = null;
            log.UidWell      = _wellbore.UidWell;
            log.UidWellbore  = response.SuppMsgOut;
            log.NameWell     = _well.Name;
            log.NameWellbore = _wellbore.Name;

            var logDataAdded = log.LogData.FirstOrDefault();

            Assert.IsNotNull(logDataAdded);

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

            var uidLog = response.SuppMsgOut;

            log.Uid = uidLog;
            var uri = log.GetUri();

            // Query Channel Data Chunk
            var filter     = MongoDbUtility.BuildFilter <ChannelDataChunk>("Uri", uri.ToString());
            var database   = _provider.GetDatabase();
            var collection = database.GetCollection <ChannelDataChunk>("channelDataChunk");
            var chunks     = collection.Find(filter).ToList();

            Assert.IsTrue(chunks.Count > 0);

            // Query Mongo File
            var fileChunks = chunks.Where(c => string.IsNullOrEmpty(c.Data)).ToList();

            Assert.IsTrue(fileChunks.Count > 0);

            var bucket = new GridFSBucket(database, new GridFSBucketOptions
            {
                BucketName     = ChannelDataChunkAdapter.BucketName,
                ChunkSizeBytes = WitsmlSettings.ChunkSizeBytes
            });

            foreach (var fc in fileChunks)
            {
                Assert.IsNull(fc.Data);
                var mongoFileFilter = Builders <GridFSFileInfo> .Filter.Eq(fi => fi.Metadata[ChannelDataChunkAdapter.FileName], fc.Uid);

                var mongoFile = bucket.Find(mongoFileFilter).FirstOrDefault();
                Assert.IsNotNull(mongoFile);
            }

            // Query Log
            var query = new Log
            {
                Uid         = uidLog,
                UidWell     = log.UidWell,
                UidWellbore = log.UidWellbore
            };

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

            Assert.AreEqual(1, results.Count);

            var result = results.First();

            Assert.IsNotNull(result);

            var logDataReturned = result.LogData.FirstOrDefault();

            Assert.IsNotNull(logDataReturned);

            Assert.AreEqual(logDataAdded.Data.Count, logDataReturned.Data.Count);
        }