Example #1
0
        public void SetUp()
        {
            _container            = SupportContainer.Reset();
            _agentInstanceContext = SupportStatementContextFactory.MakeAgentInstanceContext(_container);

            var selectExprEventTypeRegistry = new SelectExprEventTypeRegistry(
                "abc", new StatementEventTypeRefImpl(_container.RWLockManager()));
            var factory = new SelectExprProcessorHelper(
                Collections.GetEmptyList <int>(),
                SupportSelectExprFactory.MakeSelectListFromIdent("TheString", "s0"),
                Collections.GetEmptyList <SelectExprStreamDesc>(),
                null, null, false,
                new SupportStreamTypeSvc1Stream(),
                _container.Resolve <EventAdapterService>(), null,
                selectExprEventTypeRegistry,
                _agentInstanceContext.StatementContext.EngineImportService,
                1, "stmtname", null,
                new Configuration(_container), null,
                new TableServiceImpl(_container),
                null);
            var selectProcessor = factory.GetEvaluator();

            _supportAggregationService = new SupportAggregationService();

            var groupKeyNodes = new ExprEvaluator[2];

            groupKeyNodes[0] = SupportExprNodeFactory.MakeIdentNode("IntPrimitive", "s0").ExprEvaluator;
            groupKeyNodes[1] = SupportExprNodeFactory.MakeIdentNode("IntBoxed", "s0").ExprEvaluator;

            var prototype = new ResultSetProcessorRowPerGroupFactory(selectProcessor, null, groupKeyNodes, null, true, false, null, false, false, false, false, null, false, 1, null);

            _processor = (ResultSetProcessorRowPerGroup)prototype.Instantiate(null, _supportAggregationService, _agentInstanceContext);
        }
Example #2
0
        public void TestCanReuse()
        {
            Assert.IsFalse(_factory.CanReuse(new LastElementView(null)));
            EventType type = SizeView.CreateEventType(SupportStatementContextFactory.MakeContext(), null, 1);

            Assert.IsTrue(_factory.CanReuse(new SizeView(SupportStatementContextFactory.MakeAgentInstanceContext(), type, null)));
        }
        public void TestCanReuse()
        {
            AgentInstanceContext agentInstanceContext = SupportStatementContextFactory.MakeAgentInstanceContext();

            Assert.IsFalse(_factory.CanReuse(new FirstElementView(null), agentInstanceContext));
            Assert.IsTrue(_factory.CanReuse(new LastElementView(null), agentInstanceContext));
        }
        public void TestCanReuse()
        {
            AgentInstanceContext agentInstanceContext = SupportStatementContextFactory.MakeAgentInstanceContext();

            _factory.SetViewParameters(null, TestViewSupport.ToExprListBean(new Object[] { "IntPrimitive" }));
            _factory.Attach(SupportEventTypeFactory.CreateBeanType(typeof(SupportBean)), SupportStatementContextFactory.MakeContext(), null, null);
            Assert.IsFalse(_factory.CanReuse(new FirstElementView(null), agentInstanceContext));
        }
Example #5
0
        public void TestSchema()
        {
            EventType type = SizeView.CreateEventType(SupportStatementContextFactory.MakeContext(), null, 1);
            SizeView  view = new SizeView(SupportStatementContextFactory.MakeAgentInstanceContext(), type, null);

            EventType eventType = view.EventType;

            Assert.AreEqual(typeof(long?), eventType.GetPropertyType(ViewFieldEnum.SIZE_VIEW__SIZE.GetName()));
        }
        public virtual void TestEvaluate()
        {
            SupportAggregationResultFuture future = new SupportAggregationResultFuture(new Object[] { 10, 20 });

            ValidatedNodeToTest.SetAggregationResultFuture(future, 1);
            AgentInstanceContext agentInstanceContext = SupportStatementContextFactory.MakeAgentInstanceContext();

            Assert.AreEqual(20, ValidatedNodeToTest.Evaluate(new EvaluateParams(null, false, agentInstanceContext)));
        }
Example #7
0
        public void TestCanReuse()
        {
            AgentInstanceContext 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 LengthWindowView(SupportStatementContextFactory.MakeAgentInstanceViewFactoryContext(), _factory, 1, null), agentInstanceContext));
            Assert.IsTrue(_factory.CanReuse(new LengthWindowView(SupportStatementContextFactory.MakeAgentInstanceViewFactoryContext(), _factory, 1000, null), agentInstanceContext));
        }
 public void SetUp()
 {
     _typeService1Stream   = new SupportStreamTypeSvc1Stream();
     _typeService3Stream   = new SupportStreamTypeSvc3Stream();
     _groupByList          = new List <ExprNode>();
     _orderByList          = new List <OrderByItem>();
     _agentInstanceContext = SupportStatementContextFactory.MakeAgentInstanceContext();
     _stmtContext          = _agentInstanceContext.StatementContext;
 }
Example #9
0
        public void TestCanReuse()
        {
            AgentInstanceContext agentInstanceContext = SupportStatementContextFactory.MakeAgentInstanceContext(_container);

            _factory.SetViewParameters(SupportStatementContextFactory.MakeViewContext(_container), TestViewSupport.ToExprListBean(new Object[] { 1000 }));
            Assert.IsFalse(_factory.CanReuse(new FirstElementView(null), agentInstanceContext));
            Assert.IsFalse(_factory.CanReuse(new TimeBatchView(null, SupportStatementContextFactory.MakeAgentInstanceViewFactoryContext(_container), new ExprTimePeriodEvalDeltaConstGivenDelta(1000), null, false, false, null), agentInstanceContext));
            Assert.IsTrue(_factory.CanReuse(new TimeWindowView(SupportStatementContextFactory.MakeAgentInstanceViewFactoryContext(_container), _factory, new ExprTimePeriodEvalDeltaConstGivenDelta(1000000), null), agentInstanceContext));
        }
Example #10
0
        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);
        }
Example #11
0
        public void TestCanReuse()
        {
            AgentInstanceContext agentInstanceContext = SupportStatementContextFactory.MakeAgentInstanceContext(_container);

            _factory.SetViewParameters(_viewFactoryContext, TestViewSupport.ToExprListMD(new Object[] { "Symbol", "Feed" }));
            _factory.Attach(SupportEventTypeFactory.CreateBeanType(typeof(SupportMarketDataBean)), SupportStatementContextFactory.MakeContext(_container), null, _parents);
            Assert.IsFalse(_factory.CanReuse(new FirstElementView(null), agentInstanceContext));
            Assert.IsFalse(_factory.CanReuse(new MergeView(SupportStatementContextFactory.MakeAgentInstanceViewFactoryContext(_container), SupportExprNodeFactory.MakeIdentNodesMD("Symbol"), null, true), agentInstanceContext));
            Assert.IsTrue(_factory.CanReuse(new MergeView(SupportStatementContextFactory.MakeAgentInstanceViewFactoryContext(_container), SupportExprNodeFactory.MakeIdentNodesMD("Symbol", "Feed"), null, true), agentInstanceContext));
        }
Example #12
0
        public void TestCanReuse()
        {
            factory.SetViewParameters(new ViewFactoryContext(null, 1, 1, null, null), 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 = CorrelationView.CreateEventType(SupportStatementContextFactory.MakeContext(), null, 1);

            Assert.IsFalse(factory.CanReuse(new CorrelationView(null, SupportStatementContextFactory.MakeAgentInstanceContext(), SupportExprNodeFactory.MakeIdentNodeMD("Volume"), SupportExprNodeFactory.MakeIdentNodeMD("Price"), type, null)));
            Assert.IsFalse(factory.CanReuse(new CorrelationView(null, SupportStatementContextFactory.MakeAgentInstanceContext(), SupportExprNodeFactory.MakeIdentNodeMD("Feed"), SupportExprNodeFactory.MakeIdentNodeMD("Volume"), type, null)));
            Assert.IsTrue(factory.CanReuse(new CorrelationView(null, SupportStatementContextFactory.MakeAgentInstanceContext(), SupportExprNodeFactory.MakeIdentNodeMD("Price"), SupportExprNodeFactory.MakeIdentNodeMD("Volume"), type, null)));
        }
Example #13
0
        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);
        }
Example #14
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));
        }
        public void TestCanReuse()
        {
            AgentInstanceContext agentInstanceContext = SupportStatementContextFactory.MakeAgentInstanceContext();

            _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), agentInstanceContext));
            EventType type = RegressionLinestView.CreateEventType(SupportStatementContextFactory.MakeContext(), null, 1);

            Assert.IsFalse(_factory.CanReuse(new RegressionLinestView(null, SupportStatementContextFactory.MakeAgentInstanceContext(), SupportExprNodeFactory.MakeIdentNodeMD("Price"), SupportExprNodeFactory.MakeIdentNodeMD("Price"), type, null), agentInstanceContext));
            Assert.IsFalse(_factory.CanReuse(new RegressionLinestView(null, SupportStatementContextFactory.MakeAgentInstanceContext(), SupportExprNodeFactory.MakeIdentNodeMD("Volume"), SupportExprNodeFactory.MakeIdentNodeMD("Price"), type, null), agentInstanceContext));
            Assert.IsTrue(_factory.CanReuse(new RegressionLinestView(null, SupportStatementContextFactory.MakeAgentInstanceContext(), SupportExprNodeFactory.MakeIdentNodeMD("Price"), SupportExprNodeFactory.MakeIdentNodeMD("Volume"), type, null), agentInstanceContext));
        }
Example #16
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));
        }
        public static PatternAgentInstanceContext MakePatternAgentInstanceContext(SchedulingService scheduleService)
        {
            StatementContext stmtContext;

            if (scheduleService == null)
            {
                stmtContext = SupportStatementContextFactory.MakeContext();
            }
            else
            {
                stmtContext = SupportStatementContextFactory.MakeContext(scheduleService);
            }
            PatternContext context = new PatternContext(stmtContext, 1, new MatchedEventMapMeta(new String[0], false), false);

            return(new PatternAgentInstanceContext(context, SupportStatementContextFactory.MakeAgentInstanceContext(), false));
        }
Example #18
0
        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);
        }
Example #19
0
        public void TestCanReuse()
        {
            AgentInstanceContext agentInstanceContext = SupportStatementContextFactory.MakeAgentInstanceContext();

            _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), agentInstanceContext));
            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()), agentInstanceContext));
            factoryTwo.FieldNameWeight = SupportExprNodeFactory.MakeIdentNodeMD("Volume");
            Assert.IsTrue(_factory.CanReuse(new WeightedAverageView(factoryTwo, SupportStatementContextFactory.MakeAgentInstanceViewFactoryContext()), agentInstanceContext));
        }
Example #20
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));
        }
Example #21
0
        public void TestCanReuse()
        {
            StatementContext context = SupportStatementContextFactory.MakeContext();

            AgentInstanceContext agentInstanceContext = SupportStatementContextFactory.MakeAgentInstanceContext();

            _factory.SetViewParameters(null, TestViewSupport.ToExprListMD(new Object[] { 100, "Price" }));
            _factory.Attach(SupportEventTypeFactory.CreateBeanType(typeof(SupportMarketDataBean)), SupportStatementContextFactory.MakeContext(), null, null);
            Assert.IsFalse(_factory.CanReuse(new FirstElementView(null), agentInstanceContext));
            Assert.IsTrue(_factory.CanReuse(new SortWindowView(_factory, SupportExprNodeFactory.MakeIdentNodesMD("Price"), new ExprEvaluator[0], new bool[] { false }, 100, null, false, null), agentInstanceContext));
            Assert.IsFalse(_factory.CanReuse(new SortWindowView(_factory, SupportExprNodeFactory.MakeIdentNodesMD("Volume"), new ExprEvaluator[0], new bool[] { true }, 100, null, false, null), agentInstanceContext));
            Assert.IsFalse(_factory.CanReuse(new SortWindowView(_factory, SupportExprNodeFactory.MakeIdentNodesMD("Price"), new ExprEvaluator[0], new bool[] { false }, 99, null, false, null), agentInstanceContext));
            Assert.IsFalse(_factory.CanReuse(new SortWindowView(_factory, SupportExprNodeFactory.MakeIdentNodesMD("Symbol"), new ExprEvaluator[0], new bool[] { false }, 100, null, false, null), agentInstanceContext));

            _factory.SetViewParameters(null, TestViewSupport.ToExprListMD(new Object[] { 100, "Price", "Volume" }));
            _factory.Attach(SupportEventTypeFactory.CreateBeanType(typeof(SupportMarketDataBean)), SupportStatementContextFactory.MakeContext(), null, null);
            Assert.IsTrue(_factory.CanReuse(new SortWindowView(_factory, SupportExprNodeFactory.MakeIdentNodesMD("Price", "Volume"), new ExprEvaluator[0], new bool[] { false, false }, 100, null, false, null), agentInstanceContext));
            Assert.IsFalse(_factory.CanReuse(new SortWindowView(_factory, SupportExprNodeFactory.MakeIdentNodesMD("Price", "Symbol"), new ExprEvaluator[0], new bool[] { true, false }, 100, null, false, null), agentInstanceContext));
        }
Example #22
0
        public void TestMatch()
        {
            SupportStreamImpl    stream               = new SupportStreamImpl(TEST_CLASS, 10);
            IList <ViewFactory>  viewFactories        = SupportViewSpecFactory.MakeFactoryListOne(stream.EventType);
            AgentInstanceContext agentInstanceContext = SupportStatementContextFactory.MakeAgentInstanceContext();

            // No views under stream, no matches
            Pair <Viewable, IList <View> > result = ViewServiceHelper.MatchExistingViews(stream, viewFactories, agentInstanceContext);

            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, agentInstanceContext);

            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, agentInstanceContext);

            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, agentInstanceContext);

            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, agentInstanceContext);
            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, agentInstanceContext);

            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, agentInstanceContext);

            Assert.AreEqual(lastElementView, result.First);
            Assert.AreEqual(0, viewFactories.Count);
        }