public void SetUp() { // Set up length window view and a test child view _myView = new LastElementView(null); _childView = new SupportBeanClassView(typeof(SupportMarketDataBean)); _myView.AddView(_childView); }
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() { buffer = new PriorEventBufferSingle(1); view = new PriorEventView(buffer); childView = new SupportBeanClassView(typeof(SupportMarketDataBean)); view.AddView(childView); }
public void SetUp() { // Set up timed window view and a test child view, set the time window size to 1 second ExprNode node = SupportExprNodeFactory.MakeIdentNodeBean("LongPrimitive"); _myView = new ExternallyTimedWindowView(new ExternallyTimedWindowViewFactory(), node, node.ExprEvaluator, new ExprTimePeriodEvalDeltaConstGivenDelta(1000), null, SupportStatementContextFactory.MakeAgentInstanceViewFactoryContext()); _childView = new SupportBeanClassView(typeof(SupportBean)); _myView.AddView(_childView); }
public void SetUp() { // Set up length window view and a test child view EventType type = SizeView.CreateEventType(SupportStatementContextFactory.MakeContext(), null, 1); _myView = new SizeView(SupportStatementContextFactory.MakeAgentInstanceContext(), type, null); _childView = new SupportBeanClassView(typeof(SupportMarketDataBean)); _myView.AddView(_childView); }
public void SetUp() { // Set the scheduling service to use _schedulingServiceStub = new SupportSchedulingServiceImpl(); // Set up length window view and a test child view _myView = new TimeWindowView(SupportStatementContextFactory.MakeAgentInstanceViewFactoryContext(_schedulingServiceStub), new TimeWindowViewFactory(), new ExprTimePeriodEvalDeltaConstMsec(TEST_WINDOW_MSEC), null); _childView = new SupportBeanClassView(typeof(SupportMarketDataBean)); _myView.AddView(_childView); }
public void TestCopyView() { SupportBeanClassView parent = new SupportBeanClassView(typeof(SupportMarketDataBean)); _myView.Parent = parent; UniqueByPropertyView copied = (UniqueByPropertyView)_myView.CloneView(); Assert.AreEqual(_myView.CriteriaExpressions[0], copied.CriteriaExpressions[0]); }
public void SetUp() { // Set up length window view and a test child view UniqueByPropertyViewFactory factory = new UniqueByPropertyViewFactory(); factory.CriteriaExpressions = SupportExprNodeFactory.MakeIdentNodesMD("Symbol"); _myView = new UniqueByPropertyView(factory, null); _childView = new SupportBeanClassView(typeof(SupportMarketDataBean)); _myView.AddView(_childView); }
public void SetUp() { // Set up sum view and a test child view EventType type = RegressionLinestView.CreateEventType(SupportStatementContextFactory.MakeContext(), null, 1); RegressionLinestViewFactory viewFactory = new RegressionLinestViewFactory(); _myView = new RegressionLinestView(viewFactory, SupportStatementContextFactory.MakeAgentInstanceContext(), SupportExprNodeFactory.MakeIdentNodeMD("Price"), SupportExprNodeFactory.MakeIdentNodeMD("Volume"), type, null); _childView = new SupportBeanClassView(typeof(SupportMarketDataBean)); _myView.AddView(_childView); }
public void SetUp() { // Set up sum view and a test child view var type = UnivariateStatisticsView.CreateEventType(SupportStatementContextFactory.MakeContext(), null, 1); var factory = new UnivariateStatisticsViewFactory(); factory.EventType = type; factory.FieldExpression = SupportExprNodeFactory.MakeIdentNodeMD("Price"); _myView = new UnivariateStatisticsView(factory, SupportStatementContextFactory.MakeAgentInstanceViewFactoryContext()); _childView = new SupportBeanClassView(typeof(SupportMarketDataBean)); _myView.AddView(_childView); }
public void SetUp() { // Set up sum view and a test child view EventType type = WeightedAverageView.CreateEventType(SupportStatementContextFactory.MakeContext(), null, 1); WeightedAverageViewFactory factory = new WeightedAverageViewFactory(); factory.FieldNameX = SupportExprNodeFactory.MakeIdentNodeMD("Price"); factory.EventType = type; factory.FieldNameWeight = SupportExprNodeFactory.MakeIdentNodeMD("Volume"); _myView = new WeightedAverageView(factory, SupportStatementContextFactory.MakeAgentInstanceViewFactoryContext()); _childView = new SupportBeanClassView(typeof(SupportMarketDataBean)); _myView.AddView(_childView); }
public void SetUp() { _container = SupportContainer.Reset(); // 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(_container, _schedulingServiceStub), new ExprTimePeriodEvalDeltaConstGivenDelta(TEST_INTERVAL_MSEC), null, false, false, null); _childView = new SupportBeanClassView(typeof(SupportMarketDataBean)); _myView.AddView(_childView); }
public void SetUp() { _container = SupportContainer.Reset(); // Set up sum view and a test child view EventType type = CorrelationView.CreateEventType(SupportStatementContextFactory.MakeContext(_container), null, 1); CorrelationViewFactory factory = new CorrelationViewFactory(); _myView = new CorrelationView(factory, SupportStatementContextFactory.MakeAgentInstanceContext(_container), SupportExprNodeFactory.MakeIdentNodeMD("Price"), SupportExprNodeFactory.MakeIdentNodeMD("Volume"), type, null); _childView = new SupportBeanClassView(typeof(SupportMarketDataBean)); _myView.AddView(_childView); }
public void TestInstantiateChain() { SupportBeanClassView topView = new SupportBeanClassView(TEST_CLASS); IList <ViewFactory> viewFactories = SupportViewSpecFactory.MakeFactoryListOne(topView.EventType); AgentInstanceViewFactoryChainContext context = SupportStatementContextFactory.MakeAgentInstanceViewFactoryContext(); // Check correct views created IList <View> views = ViewServiceHelper.InstantiateChain(topView, viewFactories, context); Assert.AreEqual(3, views.Count); Assert.AreEqual(typeof(LengthWindowView), views[0].GetType()); Assert.AreEqual(typeof(UnivariateStatisticsView), views[1].GetType()); Assert.AreEqual(typeof(LastElementView), views[2].GetType()); // Check that the context is set viewFactories = SupportViewSpecFactory.MakeFactoryListFive(topView.EventType); views = ViewServiceHelper.InstantiateChain(topView, viewFactories, context); TimeWindowView timeWindow = (TimeWindowView)views[0]; }
public void TestMatch() { SupportStreamImpl stream = new SupportStreamImpl(TEST_CLASS, 10); IList <ViewFactory> viewFactories = SupportViewSpecFactory.MakeFactoryListOne(stream.EventType); // No views under stream, no matches Pair <Viewable, IList <View> > result = ViewServiceHelper.MatchExistingViews(stream, viewFactories); Assert.AreEqual(stream, result.First); Assert.AreEqual(3, viewFactories.Count); Assert.AreEqual(0, result.Second.Count); // One top view under the stream that doesn't match SupportBeanClassView testView = new SupportBeanClassView(TEST_CLASS); stream.AddView(new FirstElementView(null)); result = ViewServiceHelper.MatchExistingViews(stream, viewFactories); Assert.AreEqual(stream, result.First); Assert.AreEqual(3, viewFactories.Count); Assert.AreEqual(0, result.Second.Count); // Another top view under the stream that doesn't matche again testView = new SupportBeanClassView(TEST_CLASS); stream.AddView(new LengthWindowView(SupportStatementContextFactory.MakeAgentInstanceViewFactoryContext(), null, 999, null)); result = ViewServiceHelper.MatchExistingViews(stream, viewFactories); Assert.AreEqual(stream, result.First); Assert.AreEqual(3, viewFactories.Count); Assert.AreEqual(0, result.Second.Count); // One top view under the stream that does actually match LengthWindowView myLengthWindowView = new LengthWindowView(SupportStatementContextFactory.MakeAgentInstanceViewFactoryContext(), null, 1000, null); stream.AddView(myLengthWindowView); result = ViewServiceHelper.MatchExistingViews(stream, viewFactories); Assert.AreEqual(myLengthWindowView, result.First); Assert.AreEqual(2, viewFactories.Count); Assert.AreEqual(1, result.Second.Count); Assert.AreEqual(myLengthWindowView, result.Second[0]); // One child view under the top view that does not match testView = new SupportBeanClassView(TEST_CLASS); viewFactories = SupportViewSpecFactory.MakeFactoryListOne(stream.EventType); EventType type = UnivariateStatisticsView.CreateEventType(SupportStatementContextFactory.MakeContext(), null, 1); UnivariateStatisticsViewFactory factory = new UnivariateStatisticsViewFactory(); factory.EventType = type; factory.FieldExpression = SupportExprNodeFactory.MakeIdentNodeBean("LongBoxed"); myLengthWindowView.AddView(new UnivariateStatisticsView(factory, SupportStatementContextFactory.MakeAgentInstanceViewFactoryContext())); result = ViewServiceHelper.MatchExistingViews(stream, viewFactories); Assert.AreEqual(1, result.Second.Count); Assert.AreEqual(myLengthWindowView, result.Second[0]); Assert.AreEqual(myLengthWindowView, result.First); Assert.AreEqual(2, viewFactories.Count); // Add child view under the top view that does match viewFactories = SupportViewSpecFactory.MakeFactoryListOne(stream.EventType); UnivariateStatisticsViewFactory factoryTwo = new UnivariateStatisticsViewFactory(); factoryTwo.EventType = type; factoryTwo.FieldExpression = SupportExprNodeFactory.MakeIdentNodeBean("IntPrimitive"); UnivariateStatisticsView myUnivarView = new UnivariateStatisticsView(factoryTwo, SupportStatementContextFactory.MakeAgentInstanceViewFactoryContext()); myLengthWindowView.AddView(myUnivarView); result = ViewServiceHelper.MatchExistingViews(stream, viewFactories); Assert.AreEqual(myUnivarView, result.First); Assert.AreEqual(1, viewFactories.Count); // Add ultimate child view under the child view that does match viewFactories = SupportViewSpecFactory.MakeFactoryListOne(stream.EventType); LastElementView lastElementView = new LastElementView(null); myUnivarView.AddView(lastElementView); result = ViewServiceHelper.MatchExistingViews(stream, viewFactories); Assert.AreEqual(lastElementView, result.First); Assert.AreEqual(0, viewFactories.Count); }