public async Task ChannelSet200_PutObject_Can_Add_ChannelSet() { AddParents(); await RequestSessionAndAssert(); var handler = _client.Handler <IStoreCustomer>(); var uri = ChannelSet.GetUri(); var dataObject = CreateDataObject(uri, ChannelSet); // 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 <ChannelSet>(xml); Assert.IsNotNull(result); }
public async Task ChannelSet200_PutObject_Can_Add_ChannelSet() { AddParents(); await RequestSessionAndAssert(); var handler = _client.Handler <IStoreCustomer>(); var uri = ChannelSet.GetUri(); var dataObject = CreateDataObject(uri, ChannelSet); // 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 <ChannelSet>(xml); Assert.IsNotNull(result); }
/// <summary> /// Adds <see cref="ChannelSet" /> to the data store. /// </summary> /// <param name="parser">The input template parser.</param> /// <param name="dataObject">The <see cref="ChannelSet" /> to be added.</param> public override void Add(WitsmlQueryParser parser, ChannelSet dataObject) { // Extract Data var reader = ExtractDataReader(dataObject); InsertEntity(dataObject); if (reader != null) { Logger.DebugFormat("Adding ChannelSet data with uid '{0}' and name '{1}'", dataObject.Uuid, dataObject.Citation.Title); var increasing = dataObject.IsIncreasing(); var allMnemonics = reader.Indices.Select(i => i.Mnemonic).Concat(reader.Mnemonics).ToArray(); // Get current index information var ranges = GetCurrentIndexRange(dataObject); var indexCurve = dataObject.Index[0]; Logger.DebugFormat("Index curve mnemonic: {0}.", indexCurve.Mnemonic); GetUpdatedLogHeaderIndexRange(reader, allMnemonics, ranges, increasing); // Add ChannelDataChunks ChannelDataChunkAdapter.Add(reader); // Update index range UpdateIndexRange(dataObject.GetUri(), dataObject, ranges, allMnemonics); } }
private async Task CreateChannelSet(string name, double holeSize, string timeDepth, Tuple <double, int, double, double> tuple) { ChannelSet.Uuid = DevKit.Uid(); ChannelSet.Citation.Title = name; ChannelSet.RunNumber = tuple.Item2.ToString(); ChannelSet.StartIndex = new DepthIndexValue { Depth = (float)tuple.Item3 }; ChannelSet.EndIndex = new DepthIndexValue { Depth = (float)tuple.Item4 }; ChannelSet.NominalHoleSize = new LengthMeasureExt(holeSize, "in"); ChannelSet.TimeDepth = timeDepth; var handler = _client.Handler <IStoreCustomer>(); var uri = ChannelSet.GetUri(); var dataObject = CreateDataObject(uri, ChannelSet); // Get Object Expecting it Not to Exist //await GetAndAssert(handler, uri, Energistics.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<ChannelSet>(xml); //Assert.IsNotNull(result); }
/// <summary> /// Updates the specified <see cref="Log" /> instance in the store. /// </summary> /// <param name="parser">The update parser.</param> /// <param name="dataObject">The data object to be updated.</param> public override void Update(WitsmlQueryParser parser, ChannelSet dataObject) { using (var transaction = GetTransaction()) { transaction.SetContext(dataObject.GetUri()); var uri = dataObject.GetUri(); UpdateEntity(parser, uri); // Extract Data var reader = ExtractDataReader(dataObject, GetEntity(uri)); UpdateChannelDataAndIndexRange(uri, reader); // Commit transaction transaction.Commit(); } }
public async Task ChannelSet200_PutObject_Can_Update_ChannelSet() { AddParents(); await RequestSessionAndAssert(); var handler = _client.Handler <IStoreCustomer>(); var uri = ChannelSet.GetUri(); // Add a ExtensionNameValue to Data Object var envName = "TestPutObject"; var env = DevKit.ExtensionNameValue(envName, envName); ChannelSet.ExtensionNameValue = new List <ExtensionNameValue>() { env }; var dataObject = CreateDataObject(uri, ChannelSet); // 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 <ChannelSet>(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 <ChannelSet>(updateXml); Assert.IsNotNull(result); // Test Data Object overwrite Assert.IsNull(result.ExtensionNameValue.FirstOrDefault(e => e.Name.Equals(envName))); }
public void ChannelSet200DataAdapter_Can_Update_ChannelSet_With_Middle_Depth_Data() { var dataGenerator = new DataGenerator(); var channelIndex = new ChannelIndex { Direction = IndexDirection.increasing, IndexType = ChannelIndexType.measureddepth, Mnemonic = "MD", Uom = UnitOfMeasure.m }; ChannelSet.Index = dataGenerator.List(channelIndex); ChannelSet.Channel = new List <Channel> { new Channel() { Uuid = dataGenerator.Uid(), Citation = new Citation { Title = dataGenerator.Name("ChannelSetTest") }, Mnemonic = "MSG", Uom = null, ChannelClass = dataGenerator.ToPropertyKindReference("velocity"), DataType = EtpDataType.@long, GrowingStatus = ChannelStatus.active, Index = ChannelSet.Index, StartIndex = new DepthIndexValue(), EndIndex = new DepthIndexValue(), SchemaVersion = OptionsIn.DataVersion.Version200.Value } }; ChannelSet.Data = new ChannelData(); ChannelSet.SetData(@"[ [ [0 ], [ 3.11 ] ], [ [100 ], [ 3.12 ] ], [ [150 ], [ 3.14 ] ], [ [200 ], [ 3.15 ] ], ]"); DevKit.AddAndAssert(ChannelSet); ChannelSet.Data = new ChannelData(); ChannelSet.SetData(@"[ [ [0 ], [ 3.11 ] ], [ [100 ], [ 3.12 ] ], [ [120 ], [ 3.13 ] ], [ [150 ], [ 3.14 ] ], [ [200 ], [ 3.15 ] ], ]"); DevKit.UpdateAndAssert(ChannelSet); var mnemonics = ChannelSet.Index.Select(i => i.Mnemonic).Concat(ChannelSet.Channel.Select(c => c.Mnemonic)).ToList(); var dataOut = _channelDataProvider.GetChannelData(ChannelSet.GetUri(), new Range <double?>(0, null), mnemonics, null); Assert.AreEqual(5, dataOut.Count); Assert.AreEqual(2, dataOut[1].Count); Assert.AreEqual(3.13, dataOut[2][1][0]); }
/// <summary> /// Updates the specified <see cref="Log" /> instance in the store. /// </summary> /// <param name="parser">The update parser.</param> /// <param name="dataObject">The data object to be updated.</param> public override void Update(WitsmlQueryParser parser, ChannelSet dataObject) { var uri = dataObject.GetUri(); UpdateEntity(parser, uri); // Extract Data var reader = ExtractDataReader(dataObject, GetEntity(uri)); UpdateChannelDataAndIndexRange(uri, reader); }
public async Task ChannelSet200_GetResources_Can_Get_All_ChannelSet_Resources() { AddParents(); DevKit.AddAndAssert(ChannelSet); await RequestSessionAndAssert(); var uri = ChannelSet.GetUri(); var parentUri = uri.Parent; await GetResourcesAndAssert(ChannelSet.Wellbore.GetUri()); var folderUri = parentUri.Append(uri.ObjectType); await GetResourcesAndAssert(folderUri); }