public void RunTest() { var storeId = "test"; var points = new Dictionary <string, double>(); var pointCount = 0; foreach (var pointId in _dataPoints) { pointCount++; points.Add(pointId, pointCount + 0.234); } int x = 0; for (var i = 0; i < _updateCount; i++) { foreach (var id in _ids) { x++; foreach (var key in _dataPoints) { points[key] += x; } var json = JsonGenerator.GenerateTelemetry(id, points); _storeProcessor.PatchJson(storeId, json); } } }
public void RunTest() { using (var testFolder = new TestFolder()) { var factory = new LoggerFactory(); var logger = factory.CreateLogger <RocksGraphProvider>(); var storeLogger = factory.CreateLogger <StoreProcessor>(); var provider = new RocksGraphProvider(logger, testFolder); var storeProvider = new SetProvider(provider); var storeProcessor = new StoreProcessor(storeProvider, new Reasoner(), storeLogger); var storeId = "test"; var points = new Dictionary <string, double>(); var pointCount = 0; foreach (var pointId in _dataPoints) { pointCount++; points.Add(pointId, pointCount + 0.234); } foreach (var id in _ids) { var json = JsonGenerator.GenerateTelemetry(id, points); storeProcessor.PatchJson(storeId, json); } } }
public void Patch_With_Values_Returns() { var doc = new { id = "100", name = "Device 100", data = new { temp = 50, humidity = 70, pressure = 1001.02, region = "seattle/1" } }; var patch = new { id = "100", data = new { temp = 55, pressure = 1001.03, region = "seattle/1" } }; var expected = new { id = "100", name = "Device 100", data = new { id = "100#data", temp = 55, humidity = 70, pressure = 1001.03, region = "seattle/1", }, }; StoreProcessor.Assert("app3", JObject.FromObject(doc), false); StoreProcessor.PatchJson("app3", JObject.FromObject(patch)); var rsp = StoreProcessor.GetSubject("app3", "100", null, 3); var rspString = TripleConverter.FromJson(rsp).ToArray(); var expectedString = TripleConverter.FromJson(JObject.FromObject(expected)).ToArray(); CollectionAssert.AreEquivalent(rspString, expectedString); }
public void Patch_With_Relationship_Returns() { var patch = new { id = "100", name = (string)null, contains = new { id = "200", name = "name202", values = new object[] { new { id = "300", name = "name303", age = (int?)null, }, } } }; StoreProcessor.PatchJson("app2", JObject.FromObject(patch)); var rsp = StoreProcessor.GetSubject("app2", "100", null, 3); var expected = new { id = "100", age = 20, contains = new { id = "200", name = "name202", values = new object[] { new { id = "300", name = "name303" }, new { id = "400", name = "name400" } } } }; Assert.IsTrue(JObject.DeepEquals(JObject.FromObject(expected), rsp)); }