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); }
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); }
private void TryParameter(Object[] param, long msec, long?referencePoint) { TimeBatchViewFactory factory = new TimeBatchViewFactory(); factory.SetViewParameters(SupportStatementContextFactory.MakeViewContext(), TestViewSupport.ToExprListBean(param)); TimeBatchView view = (TimeBatchView)factory.MakeView(SupportStatementContextFactory.MakeAgentInstanceViewFactoryContext()); Assert.IsTrue(new ExprTimePeriodEvalDeltaConstMsec(msec).EqualsTimePeriod(view.TimeDeltaComputation)); Assert.AreEqual(referencePoint, view.InitialReferencePoint); }
public bool CanReuse(View view, AgentInstanceContext agentInstanceContext) { if (!(view is TimeBatchView)) { return(false); } TimeBatchView myView = (TimeBatchView)view; ExprTimePeriodEvalDeltaConst timeDeltaComputation = timeDeltaComputationFactory.Make( ViewName, "view", agentInstanceContext); if (!timeDeltaComputation.EqualsTimePeriod(myView.TimeDeltaComputation)) { return(false); } if ((myView.InitialReferencePoint != null) && (_optionalReferencePoint != null)) { if (!myView.InitialReferencePoint.Equals(_optionalReferencePoint.Value)) { return(false); } } if (((myView.InitialReferencePoint == null) && (_optionalReferencePoint != null)) || ((myView.InitialReferencePoint != null) && (_optionalReferencePoint == null))) { return(false); } if (myView.IsForceOutput != IsForceUpdate) { return(false); } if (myView.IsStartEager) { // since it's already started return(false); } return(myView.IsEmpty()); }