コード例 #1
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 AddPropertyValueView(
                SupportStatementContextFactory.MakeAgentInstanceViewFactoryContext(),
                new String[] { "Symbol" }, "IBM", mergeEventType);

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

            _childView = new SupportSchemaNeutralView();
            _myView.AddView(_childView);
        }
コード例 #2
0
        public void TestCopyView()
        {
            AddPropertyValueView copied = (AddPropertyValueView)_myView.CloneView();

            Assert.AreEqual(_myView.PropertyNames, copied.PropertyNames);
            Assert.AreEqual(_myView.PropertyValues, copied.PropertyValues);
        }
コード例 #3
0
ファイル: GroupByViewImpl.cs プロジェクト: ikvm/nesper
        private static void CopySubViews(
            ExprNode[] criteriaExpressions,
            String[] propertyNames,
            Object groupByValues,
            View originalView,
            View copyView,
            AgentInstanceViewFactoryChainContext agentInstanceContext)
        {
            foreach (var subView in originalView.Views)
            {
                // Determine if view is our merge view
                if (subView is MergeViewMarker)
                {
                    var mergeView = (MergeViewMarker)subView;
                    if (ExprNodeUtility.DeepEquals(mergeView.GroupFieldNames, criteriaExpressions))
                    {
                        // We found our merge view - install a new data merge view on top of it
                        var mergeDataView = new AddPropertyValueView(agentInstanceContext, propertyNames, groupByValues, mergeView.EventType);

                        // Add to the copied parent subview the view merge data view
                        copyView.AddView(mergeDataView);

                        // Add to the new merge data view the actual single merge view instance that clients may attached to
                        mergeDataView.AddView(mergeView);

                        // Add a parent view to the single merge view instance
                        mergeView.AddParentView(mergeDataView);

                        continue;
                    }
                }

                if (!(subView is CloneableView))
                {
                    throw new EPException("Unexpected error copying subview");
                }
                var cloneableView = (CloneableView)subView;
                var copiedChild   = cloneableView.CloneView();
                copyView.AddView(copiedChild);

                // Make the sub views for child
                CopySubViews(criteriaExpressions, propertyNames, groupByValues, subView, copiedChild, agentInstanceContext);
            }
        }
コード例 #4
0
        public void TestAddProperty()
        {
            IDictionary <String, Object> eventData = new Dictionary <String, Object>();

            eventData["STDDEV"] = 100;
            EventBean eventBean = SupportEventBeanFactory.CreateMapFromValues(eventData, _parentEventType);

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

            addProps["test"] = typeof(int);
            EventType newEventType = SupportEventAdapterService.Service.CreateAnonymousWrapperType("test", _parentEventType, addProps);
            EventBean newBean      = AddPropertyValueView.AddProperty(
                eventBean,
                new String[] { "test" },
                new MultiKeyUntyped(new Object[] { 2 }),
                newEventType,
                SupportEventAdapterService.Service);

            Assert.AreEqual(2, newBean.Get("test"));
            Assert.AreEqual(100, newBean.Get("STDDEV"));
        }
コード例 #5
0
ファイル: MergeView.cs プロジェクト: ikvm/nesper
 /// <summary>Add a parent data merge view. </summary>
 /// <param name="parentView">is the parent data merge view to add</param>
 public void AddParentView(AddPropertyValueView parentView)
 {
     _parentViews.Add(parentView);
 }