public CacheService(TaxathandDbContext dbContext, IMapper mapper) { _contextRedis = new RedisConnect(); _cache = RedisConnect.Connection.GetDatabase(); _dbContext = dbContext ?? throw new ArgumentNullException(nameof(dbContext)); _mapper = mapper ?? throw new ArgumentNullException(nameof(mapper)); }
public RideServiceChecker() { funcList = new Dictionary <string, CheckFunction>(); db = new DataBaseConnect(SaveLog); redis = new RedisConnect(SaveLog); hashTransfer = new RedisHashTransfer(); }
public UserServiceUpdater() { funcList = new Dictionary <string, UpdateFunction>(); db = new DataBaseConnect(SaveLog); redis = new RedisConnect(SaveLog); hashTransfer = new RedisHashTransfer(); }
public void TestGetDestinationIds() { RedisConnect redis = new RedisConnect("167.71.73.16", "e48a27fb18497063edc3c1edbc"); List <string> list; list = redis.GetDestinationId("test"); Assert.AreEqual(1, list.Count); }
public void TestConnectionWithWrongPassword() { RedisConnect redis = new RedisConnect("167.71.73.16", "e48a27fb18497063edc3c1edbc1"); List <string> list = new List <string> { "test" }; Assert.ThrowsException <StackExchange.Redis.RedisConnectionException>(() => redis.SetDestinationId("test", list)); }
public void TestGetTransformation() { RedisConnect redis = new RedisConnect("167.71.73.16", "e48a27fb18497063edc3c1edbc"); List <string> list; list = redis.GetDestinationId("source2"); List <TransformationObject> list2 = redis.GetTransformationObjects(list); Assert.AreEqual(2, list2.Count); }
public void TestGetMessuringMetaData() { RedisConnect redis = new RedisConnect("167.71.73.16", "e48a27fb18497063edc3c1edbc"); List <string> list; list = redis.GetDestinationId("source1"); List <MeasuringPointMetaData> list2 = redis.GetMeasurementPoints(list); Assert.AreEqual(1, list2.Count); }
public void TestGetCurrentValues() { RedisConnect redis = new RedisConnect("167.71.73.16", "e48a27fb18497063edc3c1edbc"); List <string> list; list = redis.GetDestinationId("source2"); List <MeasuringPointMetaData> list2 = redis.GetMeasurementPoints(list); MeasuringPointMetaData obj = new MeasuringPointMetaData(); obj = list2[0]; string datatype = obj.PointMetadata.DataType; if (datatype == "int") { List <TimeSeriesPoint> list3 = redis.GetCurrentValue(list); Assert.AreEqual(2, list3.Count); } }
public void TestGetDestinationsIdwithNonExistingSourceId() { RedisConnect redis = new RedisConnect("167.71.73.16", "e48a27fb18497063edc3c1edbc"); Assert.ThrowsException <ArgumentNullException>(() => redis.GetDestinationId("madeupsourceid")); }
public List <TimeSeries> MapTimeSeries(JProperty jProprety) { string DataType = ""; string TagName = ""; string RetentionPolicy = ""; string DatabaseName = ""; List <MeasuringPointMetaData> metaData = new List <MeasuringPointMetaData>(); List <TimeSeries> mappedTimeSeries = new List <TimeSeries>(); foreach (var timeSeriesCollection in jProprety.Children()) { foreach (var timeSeries in timeSeriesCollection) { foreach (JProperty content in timeSeries) { if (content.Name.ToString() == "SourceID") { //connect to redis RedisConnect redisConnect = new RedisConnect("167.71.73.16", "e48a27fb18497063edc3c1edbc"); //get destinationid from sourceid List <string> destinationIDList = redisConnect.GetDestinationId(content.Value.ToString()); //creating and retriving the metadata from the destinationid metaData = redisConnect.GetMeasurementPoints(destinationIDList); } else if (content.Name.ToString() == "TimeSeriesPoint") { foreach (var item in metaData) { DataType = item.PointMetadata.DataType; if (DataType == "int") { List <TimeSeriesPoint> mappedtimeSeriesPoints = new List <TimeSeriesPoint>(); foreach (var timeSeriesPoint in content.Value) { mappedtimeSeriesPoints.Add(CreateTimeSeriesPoint(timeSeriesPoint, DataType)); } TagName = item.InfluxMetaData.MeasuringPointName; RetentionPolicy = item.InfluxMetaData.RetentionPolicy; DatabaseName = item.InfluxMetaData.DatabaseName; mappedTimeSeries.Add(CreateTimeSeries(TagName, RetentionPolicy, DatabaseName, mappedtimeSeriesPoints)); } else if (DataType == "double") { List <TimeSeriesPoint> mappedtimeSeriesPoints = new List <TimeSeriesPoint>(); foreach (var timeSeriesPoint in content.Value) { mappedtimeSeriesPoints.Add(CreateTimeSeriesPoint(timeSeriesPoint, DataType)); } TagName = item.InfluxMetaData.MeasuringPointName; RetentionPolicy = item.InfluxMetaData.RetentionPolicy; DatabaseName = item.InfluxMetaData.DatabaseName; mappedTimeSeries.Add(CreateTimeSeries(TagName, RetentionPolicy, DatabaseName, mappedtimeSeriesPoints)); } } } } } return(mappedTimeSeries); } return(null); }