Exemplo n.º 1
0
 public AggJobManage(List <BaseAggConfig> aggConfigs)
 {
     ProcessFactory.Init();
     DataPoolFactory.Init();
     schedule = CreateScheduler();
     CreateJobs(aggConfigs);
 }
Exemplo n.º 2
0
        public void WeekDataPoolTester()
        {
            BaseAggConfig config = CreateCommonConfig(AggType.Week);

            config.TimeRange = new AggTimeRange {
                DataBeginHour = 1, DataEndHour = 2, DateBegin = 1, DateEnd = 1
            };

            DataPoolFactory.Init();
            IDataPool dataPool = DataPoolFactory.GetDataPool(config);

            Assert.IsNotNull(dataPool);

            DateTime   time  = new DateTime(2015, 2, 15);
            AggRawData data  = dataPool.GetAggRawData(time);
            int        count = 0;

            foreach (var tmp in data.Datas)
            {
                count += tmp.Values.Count;
            }
            Console.WriteLine(string.Format("共读取{0}条数据", count));
            Assert.IsTrue(data.TimeTag == "2015W7");
            Assert.IsTrue(data.FactorId == config.FactorId);
            Assert.IsTrue(data.Datas.Count > 0);
            //Assert.IsTrue(data.LastAggDatas != null);
        }
Exemplo n.º 3
0
        public void MonthDataPoolTester()
        {
            BaseAggConfig config = CreateCommonConfig(AggType.Month);

            config.TimeRange = new AggTimeRange {
                DataBeginHour = 1, DataEndHour = 3, DateBegin = 1, DateEnd = 1
            };

            DataPoolFactory.Init();
            IDataPool dataPool = DataPoolFactory.GetDataPool(config);

            Assert.IsNotNull(dataPool);

            DateTime  time = new DateTime(2015, 2, 15);
            Stopwatch sw   = new Stopwatch();

            sw.Start();
            AggRawData data = dataPool.GetAggRawData(time);

            sw.Stop();
            Console.WriteLine(string.Format("MonthDataPoolTester 耗时:{0}ms", sw.ElapsedMilliseconds));
            int count = 0;

            foreach (var tmp in data.Datas)
            {
                count += tmp.Values.Count;
            }
            Console.WriteLine(string.Format("共读取{0}条数据", count));
            Assert.IsTrue(data.TimeTag == "201502");
            Assert.IsTrue(data.FactorId == config.FactorId);
            Assert.IsTrue(data.Datas.Count > 0);
            //Assert.IsTrue(data.LastAggDatas != null);
        }
Exemplo n.º 4
0
        public void CreateDataPoolTester()
        {
            BaseAggConfig config = CreateCommonConfig(AggType.Day);

            config.TimeRange = new AggTimeRange {
                DataBeginHour = 1, DataEndHour = 2, DateBegin = 0, DateEnd = 0
            };
            DataPoolFactory.Init();
            IDataPool dataPool = DataPoolFactory.GetDataPool(config);

            Assert.IsNotNull(dataPool);

            config   = CreateCommonConfig(AggType.Week);
            dataPool = DataPoolFactory.GetDataPool(config);
            Assert.IsNotNull(dataPool);

            config   = CreateCommonConfig(AggType.Month);
            dataPool = DataPoolFactory.GetDataPool(config);
            Assert.IsNotNull(dataPool);
        }