예제 #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 TestCanReuse()
 {
     _factory.SetViewParameters(SupportStatementContextFactory.MakeViewContext(), TestViewSupport.ToExprListBean(new Object[] { 1000 }));
     Assert.IsFalse(_factory.CanReuse(new FirstElementView(null)));
     Assert.IsFalse(_factory.CanReuse(new LengthWindowView(SupportStatementContextFactory.MakeAgentInstanceViewFactoryContext(), _factory, 1, null)));
     Assert.IsTrue(_factory.CanReuse(new LengthWindowView(SupportStatementContextFactory.MakeAgentInstanceViewFactoryContext(), _factory, 1000, null)));
 }
예제 #3
0
 public void TestCanReuse()
 {
     _factory.SetViewParameters(SupportStatementContextFactory.MakeViewContext(), TestViewSupport.ToExprListBean(new Object[] { 1000 }));
     Assert.IsFalse(_factory.CanReuse(new FirstElementView(null)));
     Assert.IsFalse(_factory.CanReuse(new TimeBatchView(null, SupportStatementContextFactory.MakeAgentInstanceViewFactoryContext(), new ExprTimePeriodEvalDeltaConstMsec(1000), null, false, false, null)));
     Assert.IsTrue(_factory.CanReuse(new TimeWindowView(SupportStatementContextFactory.MakeAgentInstanceViewFactoryContext(), _factory, new ExprTimePeriodEvalDeltaConstMsec(1000000), null)));
 }
예제 #4
0
        private void TryParameter(Object[] param)
        {
            LastElementViewFactory factory = new LastElementViewFactory();

            factory.SetViewParameters(SupportStatementContextFactory.MakeViewContext(), TestViewSupport.ToExprListBean(param));
            Assert.IsTrue(factory.MakeView(SupportStatementContextFactory.MakeAgentInstanceViewFactoryContext()) is LastElementView);
        }
예제 #5
0
        public void SetUp()
        {
            var schema = new Dictionary <String, Object>();

            schema["STDDEV"] = typeof(double?);
            _parentEventType = SupportEventTypeFactory.CreateMapType(schema);

            var addProps = new Dictionary <String, Object>();

            addProps["Symbol"] = typeof(string);

            var mergeEventType = SupportEventAdapterService.Service.CreateAnonymousWrapperType(
                "test", _parentEventType, addProps);

            // Set up length window view and a test child view
            _myView = new AddPropertyValueOptionalView(
                SupportStatementContextFactory.MakeAgentInstanceViewFactoryContext(),
                new String[] { "Symbol" }, "IBM", mergeEventType);

            _parentView = new SupportMapView(schema);
            _parentView.AddView(_myView);

            _childView = new SupportSchemaNeutralView();
            _myView.AddView(_childView);
        }
예제 #6
0
 public void TestCanReuse()
 {
     _factory.SetViewParameters(_viewFactoryContext, TestViewSupport.ToExprListMD(new Object[] { "Symbol", "Feed" }));
     _factory.Attach(SupportEventTypeFactory.CreateBeanType(typeof(SupportMarketDataBean)), SupportStatementContextFactory.MakeContext(), null, _parents);
     Assert.IsFalse(_factory.CanReuse(new FirstElementView(null)));
     Assert.IsFalse(_factory.CanReuse(new MergeView(SupportStatementContextFactory.MakeAgentInstanceViewFactoryContext(), SupportExprNodeFactory.MakeIdentNodesMD("Symbol"), null, true)));
     Assert.IsTrue(_factory.CanReuse(new MergeView(SupportStatementContextFactory.MakeAgentInstanceViewFactoryContext(), SupportExprNodeFactory.MakeIdentNodesMD("Symbol", "Feed"), null, true)));
 }
예제 #7
0
        private void TryParameter(Object param, long msec)
        {
            var factory = new TimeWindowViewFactory();

            factory.SetViewParameters(SupportStatementContextFactory.MakeViewContext(_container), TestViewSupport.ToExprListBean(new Object[] { param }));
            var view = (TimeWindowView)factory.MakeView(SupportStatementContextFactory.MakeAgentInstanceViewFactoryContext(_container));

            Assert.AreEqual(msec, view.TimeDeltaComputation.DeltaAdd(0));
        }
        private void TryParameter(Object[] @params, String fieldNameX, String fieldNameY)
        {
            _factory.SetViewParameters(_viewFactoryContext, TestViewSupport.ToExprListMD(@params));
            _factory.Attach(SupportEventTypeFactory.CreateBeanType(typeof(SupportMarketDataBean)), SupportStatementContextFactory.MakeContext(), null, null);
            RegressionLinestView view = (RegressionLinestView)_factory.MakeView(SupportStatementContextFactory.MakeAgentInstanceViewFactoryContext());

            Assert.AreEqual(fieldNameX, view.ExpressionX.ToExpressionStringMinPrecedenceSafe());
            Assert.AreEqual(fieldNameY, view.ExpressionY.ToExpressionStringMinPrecedenceSafe());
        }
예제 #9
0
        private void TryParameter(object[] parameters, string fieldNameX, string fieldNameY)
        {
            _factory.SetViewParameters(_viewFactoryContext, TestViewSupport.ToExprListMD(parameters));
            _factory.Attach(SupportEventTypeFactory.CreateBeanType(typeof(SupportMarketDataBean)), SupportStatementContextFactory.MakeContext(), null, null);
            CorrelationView view = (CorrelationView)_factory.MakeView(SupportStatementContextFactory.MakeAgentInstanceViewFactoryContext());

            Assert.AreEqual(fieldNameX, ExprNodeUtility.ToExpressionStringMinPrecedenceSafe(view.ExpressionX));
            Assert.AreEqual(fieldNameY, ExprNodeUtility.ToExpressionStringMinPrecedenceSafe(view.ExpressionY));
        }
예제 #10
0
        private void TryParameter(Object[] param, int size)
        {
            var factory = new LengthWindowViewFactory();

            factory.SetViewParameters(SupportStatementContextFactory.MakeViewContext(), TestViewSupport.ToExprListBean(param));
            var view = (LengthWindowView)factory.MakeView(SupportStatementContextFactory.MakeAgentInstanceViewFactoryContext());

            Assert.AreEqual(size, view.Size);
        }
예제 #11
0
        public void SetUp()
        {
            // Set up length window view and a test child view
            _myView = new MergeView(SupportStatementContextFactory.MakeAgentInstanceViewFactoryContext(),
                                    SupportExprNodeFactory.MakeIdentNodesMD("Symbol"),
                                    SupportEventTypeFactory.CreateBeanType(typeof(SupportBean)), false);

            _childView = new SupportBeanClassView(typeof(SupportMarketDataBean));
            _myView.AddView(_childView);
        }
        private void TryParameter(Object param, String fieldName)
        {
            UniqueByPropertyViewFactory factory = new UniqueByPropertyViewFactory();

            factory.SetViewParameters(null, TestViewSupport.ToExprListBean(new Object[] { param }));
            factory.Attach(SupportEventTypeFactory.CreateBeanType(typeof(SupportBean)), SupportStatementContextFactory.MakeContext(), null, null);
            UniqueByPropertyView view = (UniqueByPropertyView)factory.MakeView(SupportStatementContextFactory.MakeAgentInstanceViewFactoryContext());

            Assert.AreEqual(fieldName, view.CriteriaExpressions[0].ToExpressionStringMinPrecedenceSafe());
        }
예제 #13
0
        private void TryParameter(Object[] param, long msec, long?referencePoint)
        {
            var factory = new TimeBatchViewFactory();

            factory.SetViewParameters(SupportStatementContextFactory.MakeViewContext(), TestViewSupport.ToExprListBean(param));
            var view = (TimeBatchView)factory.MakeView(SupportStatementContextFactory.MakeAgentInstanceViewFactoryContext());

            Assert.IsTrue(new ExprTimePeriodEvalDeltaConstGivenDelta(msec).EqualsTimePeriod(view.TimeDeltaComputation));
            Assert.AreEqual(referencePoint, view.InitialReferencePoint);
        }
예제 #14
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 TimeWindowView(SupportStatementContextFactory.MakeAgentInstanceViewFactoryContext(_schedulingServiceStub), new TimeWindowViewFactory(), new ExprTimePeriodEvalDeltaConstMsec(TEST_WINDOW_MSEC), null);
            _childView = new SupportBeanClassView(typeof(SupportMarketDataBean));
            _myView.AddView(_childView);
        }
 public void TestIncorrectUse()
 {
     try {
         _myView = new ExternallyTimedWindowView(
             null,
             SupportExprNodeFactory.MakeIdentNodeBean("TheString"), null,
             new ExprTimePeriodEvalDeltaConstGivenDelta(0), null,
             SupportStatementContextFactory.MakeAgentInstanceViewFactoryContext(_container));
     } catch (ArgumentException) {
         // Expected exception
     }
 }
예제 #16
0
        private void TryParameter(Object[] paramList, String[] fieldNames, int size)
        {
            _factory.SetViewParameters(null, TestViewSupport.ToExprListMD(paramList));
            _factory.Attach(SupportEventTypeFactory.CreateBeanType(typeof(SupportMarketDataBean)), SupportStatementContextFactory.MakeContext(), null, null);
            SortWindowView view = (SortWindowView)_factory.MakeView(SupportStatementContextFactory.MakeAgentInstanceViewFactoryContext());

            Assert.AreEqual(size, view.SortWindowSize);
            Assert.AreEqual(fieldNames[0], view.SortCriteriaExpressions[0].ToExpressionStringMinPrecedenceSafe());
            if (fieldNames.Length > 0)
            {
                Assert.AreEqual(fieldNames[1], view.SortCriteriaExpressions[1].ToExpressionStringMinPrecedenceSafe());
            }
        }
예제 #17
0
        public void TestCanReuse()
        {
            var agentInstanceContext = SupportStatementContextFactory.MakeAgentInstanceContext();

            _factory.SetViewParameters(SupportStatementContextFactory.MakeViewContext(), TestViewSupport.ToExprListBean(new Object[] { 1000 }));
            Assert.IsFalse(_factory.CanReuse(new FirstElementView(null), agentInstanceContext));
            Assert.IsFalse(_factory.CanReuse(new TimeBatchView(_factory, SupportStatementContextFactory.MakeAgentInstanceViewFactoryContext(), new ExprTimePeriodEvalDeltaConstGivenDelta(1), null, false, false, null), agentInstanceContext));
            Assert.IsTrue(_factory.CanReuse(new TimeBatchView(_factory, SupportStatementContextFactory.MakeAgentInstanceViewFactoryContext(), new ExprTimePeriodEvalDeltaConstGivenDelta(1000000), null, false, false, null), agentInstanceContext));

            _factory.SetViewParameters(SupportStatementContextFactory.MakeViewContext(), TestViewSupport.ToExprListBean(new Object[] { 1000, 2000L }));
            Assert.IsFalse(_factory.CanReuse(new TimeBatchView(_factory, SupportStatementContextFactory.MakeAgentInstanceViewFactoryContext(), new ExprTimePeriodEvalDeltaConstGivenDelta(1), null, false, false, null), agentInstanceContext));
            Assert.IsTrue(_factory.CanReuse(new TimeBatchView(_factory, SupportStatementContextFactory.MakeAgentInstanceViewFactoryContext(), new ExprTimePeriodEvalDeltaConstGivenDelta(1000000), 2000L, false, false, null), agentInstanceContext));
        }
예제 #18
0
        private void TryParameter(Object[] parameters, String[] fieldNames)
        {
            var factory = new GroupByViewFactory();

            factory.SetViewParameters(_viewFactoryContext, TestViewSupport.ToExprListBean(parameters));
            factory.Attach(SupportEventTypeFactory.CreateBeanType(typeof(SupportBean)),
                           SupportStatementContextFactory.MakeContext(_container), null, null);
            var view = (GroupByView)factory.MakeView(
                SupportStatementContextFactory.MakeAgentInstanceViewFactoryContext(_container));

            Assert.AreEqual(fieldNames[0],
                            view.CriteriaExpressions[0].ToExpressionStringMinPrecedenceSafe());
        }
예제 #19
0
        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);
        }
예제 #20
0
        private void TryParameter(Object[] parameters, String[] fieldNames)
        {
            MergeViewFactory factory = new MergeViewFactory();

            factory.SetViewParameters(_viewFactoryContext, TestViewSupport.ToExprListMD(parameters));
            factory.Attach(SupportEventTypeFactory.CreateBeanType(typeof(SupportMarketDataBean)), SupportStatementContextFactory.MakeContext(_container), null, _parents);
            MergeView view = (MergeView)factory.MakeView(SupportStatementContextFactory.MakeAgentInstanceViewFactoryContext(_container));

            Assert.AreEqual(fieldNames[0], view.GroupFieldNames[0].ToExpressionStringMinPrecedenceSafe());
            if (fieldNames.Length > 0)
            {
                Assert.AreEqual(fieldNames[1], view.GroupFieldNames[1].ToExpressionStringMinPrecedenceSafe());
            }
        }
예제 #21
0
        public void TestCanReuse()
        {
            AgentInstanceContext agentInstanceContext = SupportStatementContextFactory.MakeAgentInstanceContext(_container);

            _factory.SetViewParameters(_viewFactoryContext, TestViewSupport.ToExprListBean(new Object[] { "TheString", "LongPrimitive" }));
            _factory.Attach(SupportEventTypeFactory.CreateBeanType(typeof(SupportBean)), SupportStatementContextFactory.MakeContext(_container), null, null);
            Assert.IsFalse(_factory.CanReuse(new FirstElementView(null), agentInstanceContext));
            Assert.IsFalse(_factory.CanReuse(new GroupByViewImpl(SupportStatementContextFactory.MakeAgentInstanceViewFactoryContext(_container), SupportExprNodeFactory.MakeIdentNodesBean("TheString"), null), agentInstanceContext));
            Assert.IsTrue(_factory.CanReuse(new GroupByViewImpl(SupportStatementContextFactory.MakeAgentInstanceViewFactoryContext(_container), SupportExprNodeFactory.MakeIdentNodesBean("TheString", "LongPrimitive"), null), agentInstanceContext));

            _factory.SetViewParameters(_viewFactoryContext, TestViewSupport.ToExprListBean(new Object[] { SupportExprNodeFactory.MakeIdentNodesBean("TheString", "LongPrimitive") }));
            Assert.IsFalse(_factory.CanReuse(new GroupByViewImpl(SupportStatementContextFactory.MakeAgentInstanceViewFactoryContext(_container), SupportExprNodeFactory.MakeIdentNodesBean("TheString"), null), agentInstanceContext));
            Assert.IsTrue(_factory.CanReuse(new GroupByViewImpl(SupportStatementContextFactory.MakeAgentInstanceViewFactoryContext(_container), SupportExprNodeFactory.MakeIdentNodesBean("TheString", "LongPrimitive"), null), agentInstanceContext));
        }
예제 #22
0
        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 TestCanReuse()
        {
            _factory.SetViewParameters(_viewFactoryContext, TestViewSupport.ToExprListMD(new Object[] { "Price", "Volume" }));
            _factory.Attach(SupportEventTypeFactory.CreateBeanType(typeof(SupportMarketDataBean)), SupportStatementContextFactory.MakeContext(), null, null);
            Assert.IsFalse(_factory.CanReuse(new FirstElementView(null)));
            EventType type = WeightedAverageView.CreateEventType(SupportStatementContextFactory.MakeContext(), null, 1);
            WeightedAverageViewFactory factoryTwo = new WeightedAverageViewFactory();

            factoryTwo.FieldNameX      = SupportExprNodeFactory.MakeIdentNodeMD("Price");
            factoryTwo.EventType       = type;
            factoryTwo.FieldNameWeight = SupportExprNodeFactory.MakeIdentNodeMD("Price");
            Assert.IsFalse(_factory.CanReuse(new WeightedAverageView(factoryTwo, SupportStatementContextFactory.MakeAgentInstanceViewFactoryContext())));
            factoryTwo.FieldNameWeight = SupportExprNodeFactory.MakeIdentNodeMD("Volume");
            Assert.IsTrue(_factory.CanReuse(new WeightedAverageView(factoryTwo, SupportStatementContextFactory.MakeAgentInstanceViewFactoryContext())));
        }
예제 #24
0
        public void SetUp()
        {
            _streamOne = new SupportStreamImpl(typeof(SupportBean), 1);
            _streamTwo = new SupportStreamImpl(typeof(SupportBean_A), 1);

            _viewService = new ViewServiceImpl();

            AgentInstanceViewFactoryChainContext context = SupportStatementContextFactory.MakeAgentInstanceViewFactoryContext();

            _viewOne   = _viewService.CreateViews(_streamOne, SupportViewSpecFactory.MakeFactoryListOne(_streamOne.EventType), context, false).FinalViewable;
            _viewTwo   = _viewService.CreateViews(_streamOne, SupportViewSpecFactory.MakeFactoryListTwo(_streamOne.EventType), context, false).FinalViewable;
            _viewThree = _viewService.CreateViews(_streamOne, SupportViewSpecFactory.MakeFactoryListThree(_streamOne.EventType), context, false).FinalViewable;
            _viewFour  = _viewService.CreateViews(_streamOne, SupportViewSpecFactory.MakeFactoryListFour(_streamOne.EventType), context, false).FinalViewable;
            _viewFive  = _viewService.CreateViews(_streamTwo, SupportViewSpecFactory.MakeFactoryListFive(_streamTwo.EventType), context, false).FinalViewable;
        }
예제 #25
0
        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 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(_container));
            _childView = new SupportBeanClassView(typeof(SupportBean));
            _myView.AddView(_childView);
        }
예제 #27
0
        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];
        }
예제 #28
0
        public void TestCanReuse()
        {
            AgentInstanceContext agentInstanceContext = SupportStatementContextFactory.MakeAgentInstanceContext(_container);

            _factory.SetViewParameters(_viewFactoryContext, TestViewSupport.ToExprListMD(new Object[] { "Price" }));
            _factory.Attach(SupportEventTypeFactory.CreateBeanType(typeof(SupportMarketDataBean)), SupportStatementContextFactory.MakeContext(_container), null, null);
            Assert.IsFalse(_factory.CanReuse(new FirstElementView(null), agentInstanceContext));
            EventType type = UnivariateStatisticsView.CreateEventType(SupportStatementContextFactory.MakeContext(_container), null, 1);
            UnivariateStatisticsViewFactory factoryOne = new UnivariateStatisticsViewFactory();

            factoryOne.EventType       = type;
            factoryOne.FieldExpression = SupportExprNodeFactory.MakeIdentNodeMD("Volume");
            UnivariateStatisticsViewFactory factoryTwo = new UnivariateStatisticsViewFactory();

            factoryTwo.EventType       = type;
            factoryTwo.FieldExpression = SupportExprNodeFactory.MakeIdentNodeMD("Price");
            Assert.IsFalse(_factory.CanReuse(new UnivariateStatisticsView(factoryOne, SupportStatementContextFactory.MakeAgentInstanceViewFactoryContext(_container)), agentInstanceContext));
            Assert.IsTrue(_factory.CanReuse(new UnivariateStatisticsView(factoryTwo, SupportStatementContextFactory.MakeAgentInstanceViewFactoryContext(_container)), agentInstanceContext));
        }
예제 #29
0
        public void SetUp()
        {
            _statementContext     = SupportStatementContextFactory.MakeContext();
            _agentInstanceContext = SupportStatementContextFactory.MakeAgentInstanceViewFactoryContext();

            var expressions = SupportExprNodeFactory.MakeIdentNodesMD("Symbol");

            _myGroupByView = new GroupByViewImpl(_agentInstanceContext, expressions, ExprNodeUtility.GetEvaluators(expressions));

            var childView = new SupportBeanClassView(typeof(SupportMarketDataBean));

            var myMergeView = new MergeView(_agentInstanceContext, SupportExprNodeFactory.MakeIdentNodesMD("Symbol"), SupportEventTypeFactory.CreateBeanType(typeof(SupportMarketDataBean)), false);

            _ultimateChildView = new SupportBeanClassView(typeof(SupportMarketDataBean));

            // This is the view hierarchy
            _myGroupByView.AddView(childView);
            childView.AddView(myMergeView);
            myMergeView.AddView(_ultimateChildView);

            SupportBeanClassView.Instances.Clear();
        }
예제 #30
0
        public void TestCanReuse()
        {
            EventType            parentType           = SupportEventTypeFactory.CreateBeanType(typeof(SupportBean));
            AgentInstanceContext agentInstanceContext = SupportStatementContextFactory.MakeAgentInstanceContext();

            _factory.SetViewParameters(SupportStatementContextFactory.MakeViewContext(), TestViewSupport.ToExprListBean(new Object[] { "LongBoxed", 1000 }));
            _factory.Attach(parentType, SupportStatementContextFactory.MakeContext(), null, null);
            Assert.IsFalse(_factory.CanReuse(new FirstElementView(null), agentInstanceContext));
            Assert.IsFalse(_factory.CanReuse(new ExternallyTimedWindowView(_factory, SupportExprNodeFactory.MakeIdentNodeBean("LongPrimitive"), null, new ExprTimePeriodEvalDeltaConstGivenDelta(1000), null, SupportStatementContextFactory.MakeAgentInstanceViewFactoryContext()), agentInstanceContext));
            Assert.IsFalse(_factory.CanReuse(new ExternallyTimedWindowView(_factory, SupportExprNodeFactory.MakeIdentNodeBean("LongBoxed"), null, new ExprTimePeriodEvalDeltaConstGivenDelta(999), null, SupportStatementContextFactory.MakeAgentInstanceViewFactoryContext()), agentInstanceContext));
            Assert.IsTrue(_factory.CanReuse(new ExternallyTimedWindowView(_factory, SupportExprNodeFactory.MakeIdentNodeBean("LongBoxed"), null, new ExprTimePeriodEvalDeltaConstGivenDelta(1000000), null, SupportStatementContextFactory.MakeAgentInstanceViewFactoryContext()), agentInstanceContext));
        }