From fc32af3a913b90da3b566c0c8783fa7af8c77b11 Mon Sep 17 00:00:00 2001 From: KharchenkoVV Date: Mon, 4 Oct 2021 15:41:47 +0500 Subject: [PATCH] Added demo values for Measures --- AsbCloudDbDemoData/ControllerLoadTester.cs | 7 +- AsbCloudDbDemoData/DbDemoDataFiller.cs | 83 +++++++++++++++++++++- 2 files changed, 84 insertions(+), 6 deletions(-) diff --git a/AsbCloudDbDemoData/ControllerLoadTester.cs b/AsbCloudDbDemoData/ControllerLoadTester.cs index 7eccf6bd..41430b57 100644 --- a/AsbCloudDbDemoData/ControllerLoadTester.cs +++ b/AsbCloudDbDemoData/ControllerLoadTester.cs @@ -11,7 +11,6 @@ namespace AsbCloudDevOperations { public class ControllerLoadTester { - private readonly HttpClient client = new(); private readonly Random rand = new(); //Пример роута: "api/telemetryDataSaub/123123_"; @@ -43,10 +42,12 @@ namespace AsbCloudDevOperations var uid = $"123123_1"; + using var httpClient = new HttpClient(); + Console.WriteLine($"Sending telemetry info with uid: {uid}"); var tInfoUri = new Uri($"http://localhost:5000/api/telemetry/{uid}/info"); - var infoResponse = await client.PostAsync(tInfoUri, stringContent, token); + using var infoResponse = await httpClient.PostAsync(tInfoUri, stringContent, token); Console.WriteLine($"Передана telemetry info с: {infoResponse.StatusCode}"); @@ -54,7 +55,7 @@ namespace AsbCloudDevOperations { await Task.Delay(rand.Next(1000, 5000), token); var dataSaubUri = new Uri($"http://localhost:5000/api/telemetryDataSaub/{uid}"); - var saubResponse = await client.PostAsync(dataSaubUri, stringContent, token); + using var saubResponse = await httpClient.PostAsync(dataSaubUri, stringContent, token); Console.WriteLine(saubResponse.StatusCode); } diff --git a/AsbCloudDbDemoData/DbDemoDataFiller.cs b/AsbCloudDbDemoData/DbDemoDataFiller.cs index d342213d..f5332785 100644 --- a/AsbCloudDbDemoData/DbDemoDataFiller.cs +++ b/AsbCloudDbDemoData/DbDemoDataFiller.cs @@ -36,9 +36,85 @@ namespace AsbCloudDevOperations ); demoContext.Measures.AddRange( - new Measure { Id = 1, IdCategory = 1, IdWell = 1, Timestamp = DateTime.Now.AddHours(1), Data = new Dictionary { { "a", 1 } } }, - new Measure { Id = 2, IdCategory = 1, IdWell = 1, Timestamp = DateTime.Now.AddHours(2), Data = new Dictionary { { "a", 2 } } }, - new Measure { Id = 3, IdCategory = 2, IdWell = 1, Timestamp = DateTime.Now.AddHours(3), Data = new Dictionary { { "a", 3 } } } + new Measure { Id = 1, IdCategory = 1, IdWell = 1, Timestamp = DateTime.Now.AddHours(1), + Data = new Dictionary { + { "name", "Наименование" }, + { "temperature", "35" }, + { "density", "113" }, + { "conditionalViscosity", "354" }, + { "r300", "234" }, + { "r600", "4765" }, + { "r3r6", "456" }, + { "dnsDpa", "6789" }, + { "plasticViscocity", "456" }, + { "snsDpa", "8908" }, + { "r3r649С", "567" }, + { "dns49Cdpa", "34654" }, + { "plasticViscocity49c", "6786" }, + { "sns49Cdpa", "456" }, + { "mbt", "86" }, + { "sand", "234" }, + { "filtering", "5675" }, + { "crust", "23424" }, + { "ktk", "4567" }, + { "ph", "3455" }, + { "hardness", "587678" }, + { "chlorides", "3453" }, + { "pf", "2342" }, + { "mf", "78678" }, + { "pm", "345345" }, + { "fluidSolidPhase", "3453" }, + { "grease", "67567" }, + { "calciumCarbonate", "23424" } + } + }, + new Measure { Id = 2, IdCategory = 2, IdWell = 1, Timestamp = DateTime.Now.AddHours(2), + Data = new Dictionary { + { "probeNumber", "345345" }, + { "probeExtractionDepth", "345" }, + { "sandstone", "345345" }, + { "siltstone", "35" }, + { "argillit", "113" }, + { "brokenArgillit", "354" }, + { "coal", "234" }, + { "sand", "4765" }, + { "clay", "456" }, + { "camstone", "6789" }, + { "cement", "456" }, + { "summary", "8908" }, + { "drillingMud", "567" }, + { "sludge", "34654" }, + { "maxSum", "6786" }, + { "methane", "456" }, + { "ethane", "86" }, + { "propane", "234" }, + { "butane", "5675" }, + { "pentane", "23424" }, + { "mechanicalSpeed", "4567" }, + { "preliminaryConclusion", "Заключение" } + } + }, + new Measure { Id = 3, IdCategory = 3, IdWell = 1, Timestamp = DateTime.Now.AddHours(3), + Data = new Dictionary { + { "depth", "345345" }, + { "zenithAngle", "35" }, + { "magneticAzimuth", "113" }, + { "trueAzimuth", "354" }, + { "directAzimuth", "234" }, + { "verticalDepth", "4765" }, + { "absoluteMark", "456" }, + { "localNorthOffset", "6789" }, + { "localEastOffset", "456" }, + { "outFallOffset", "8908" }, + { "offsetAzimuth", "567" }, + { "areaIntensity", "34654" }, + { "offsetStopAngle", "6786" }, + { "zenithIntensity", "456" }, + { "comment", "Some comment" }, + { "depthPlanFactDifference", "234" }, + { "distancePlanFactDifference", "5675" } + } + } ); demoContext.Telemetries.Add( @@ -302,6 +378,7 @@ namespace AsbCloudDevOperations catch (Exception ex) { Console.WriteLine(ex.Message); + Console.ReadLine(); } } }