Пример #1
0
        public void TestViewPushWithRefPoint()
        {
            long startTime = 50000;

            _schedulingServiceStub.Time = startTime;

            _myView    = new TimeBatchView(new TimeBatchViewFactory(), SupportStatementContextFactory.MakeAgentInstanceViewFactoryContext(_schedulingServiceStub), new ExprTimePeriodEvalDeltaConstMsec(TEST_INTERVAL_MSEC), 1505L, false, false, null);
            _childView = new SupportBeanClassView(typeof(SupportMarketDataBean));
            _myView.AddView(_childView);

            IDictionary <String, EventBean> events = EventFactoryHelper.MakeEventMap(
                new String[] { "A1", "A2", "A3" });

            // Send new events to the view - should have scheduled a callback for X msec after
            _myView.Update(new EventBean[] { events.Get("A1"), events.Get("A2"), events.Get("A3") }, null);
            Assert.IsTrue(_schedulingServiceStub.Added.Count == 1);
            Assert.IsTrue(_schedulingServiceStub.Added.Get(1505L) != null);
            _schedulingServiceStub.Added.Clear();
            EPAssertionUtil.AssertEqualsExactOrder(new EventBean[] { events.Get("A1"), events.Get("A2"), events.Get("A3") }, _myView.GetEnumerator());
            SupportViewDataChecker.CheckOldData(_childView, null);
            SupportViewDataChecker.CheckNewData(_childView, null);  // Data got batched, no data release till later

            // Pretend we have a callback, check data, check scheduled new callback
            _schedulingServiceStub.Time = (startTime + 1505);
            _myView.SendBatch();
            EPAssertionUtil.AssertEqualsExactOrder(null, _myView.GetEnumerator());
            SupportViewDataChecker.CheckOldData(_childView, null);
            SupportViewDataChecker.CheckNewData(_childView, new EventBean[] { events.Get("A1"), events.Get("A2"), events.Get("A3") });
            Assert.IsTrue(_schedulingServiceStub.Added.Count == 1);
            Assert.IsTrue(_schedulingServiceStub.Added.Get(TEST_INTERVAL_MSEC) != null);
        }
Пример #2
0
        public void SetUp()
        {
            // Set the scheduling service to use
            _schedulingServiceStub = new SupportSchedulingServiceImpl();

            // Set up length window view and a test child view
            _myView    = new TimeBatchView(new TimeBatchViewFactory(), SupportStatementContextFactory.MakeAgentInstanceViewFactoryContext(_schedulingServiceStub), new ExprTimePeriodEvalDeltaConstMsec(TEST_INTERVAL_MSEC), null, false, false, null);
            _childView = new SupportBeanClassView(typeof(SupportMarketDataBean));
            _myView.AddView(_childView);
        }