use of com.infiniteautomation.mango.pointvaluecache.PointValueCache in project ma-core-public by infiniteautomation.
the class DataPointRTPointValueCacheTest method test1.
/**
* Test an initial cash that is larger than the default
*/
@Test
public void test1() {
DataPointVO vo = new DataPointVO();
vo.setId(1);
PointValueDao dao = Common.getBean(PointValueDao.class);
PointValueCache pointValueCache = Common.getBean(PointValueCache.class);
List<PointValueTime> initialCache = createCache(vo, 5);
DataPointRTPointValueCache cache = new DataPointRTPointValueCache(vo, 1, initialCache, dao, pointValueCache);
Assert.assertEquals(initialCache.get(0).getValue(), cache.getLatestPointValue().getValue());
Assert.assertEquals(initialCache.get(0).getTime(), cache.getLatestPointValue().getTime());
}
use of com.infiniteautomation.mango.pointvaluecache.PointValueCache in project ma-core-public by infiniteautomation.
the class DataPointRTPointValueCacheTest method test3.
/**
* Test resetting the cache
*/
@Test
public void test3() {
DataPointVO vo = new DataPointVO();
vo.setId(1);
PointValueDao dao = Common.getBean(PointValueDao.class);
PointValueCache pointValueCache = Common.getBean(PointValueCache.class);
List<PointValueTime> initialCache = createCache(vo, 5);
DataPointRTPointValueCache cache = new DataPointRTPointValueCache(vo, 5, initialCache, dao, pointValueCache);
cache.invalidate(true);
List<PointValueTime> latest = cache.getLatestPointValues(5);
for (int i = 0; i < 5; i++) {
Assert.assertEquals(initialCache.get(i).getValue(), latest.get(i).getValue());
Assert.assertEquals(initialCache.get(i).getTime(), latest.get(i).getTime());
}
}
Aggregations