public override void Run(EPServiceProvider epService)
        {
            string methodName = ".testPerfPropertyAccess";

            string joinStatement = "select * from " +
                                   typeof(SupportBeanCombinedProps).FullName + "#length(1)" +
                                   " where indexed[0].Mapped('a').value = 'dummy'";

            EPStatement joinView       = epService.EPAdministrator.CreateEPL(joinStatement);
            var         updateListener = new SupportUpdateListener();

            joinView.Events += updateListener.Update;

            // Send events for each stream
            SupportBeanCombinedProps theEvent = SupportBeanCombinedProps.MakeDefaultBean();

            Log.Info(methodName + " Sending events");

            long startTime = DateTimeHelper.CurrentTimeMillis;

            for (int i = 0; i < 10000; i++)
            {
                SendEvent(epService, theEvent);
            }
            Log.Info(methodName + " Done sending events");

            long endTime = DateTimeHelper.CurrentTimeMillis;

            Log.Info(methodName + " delta=" + (endTime - startTime));

            // Stays at 250, below 500ms
            Assert.IsTrue((endTime - startTime) < 1000);
        }
        public void TestRegularJoin()
        {
            SupportBeanCombinedProps combined = SupportBeanCombinedProps.MakeDefaultBean();
            SupportBeanComplexProps  complex  = SupportBeanComplexProps.MakeDefaultBean();

            Assert.AreEqual("0ma0", combined.GetIndexed(0).GetMapped("0ma").Value);

            String viewExpr = "select nested.nested, s1.Indexed[0], nested.Indexed[1] from " +
                              typeof(SupportBeanComplexProps).FullName + "#length(3) nested, " +
                              typeof(SupportBeanCombinedProps).FullName + "#length(3) s1" +
                              " where Mapped('keyOne') = Indexed[2].Mapped('2ma').value and" +
                              " Indexed[0].Mapped('0ma').value = '0ma0'";

            EPStatement testView = epService.EPAdministrator.CreateEPL(viewExpr);

            testListener     = new SupportUpdateListener();
            testView.Events += testListener.Update;

            epService.EPRuntime.SendEvent(combined);
            epService.EPRuntime.SendEvent(complex);

            EventBean theEvent = testListener.GetAndResetLastNewData()[0];

            Assert.AreSame(complex.Nested, theEvent.Get("nested.nested"));
            Assert.AreSame(combined.GetIndexed(0), theEvent.Get("s1.Indexed[0]"));
            Assert.AreEqual(complex.GetIndexed(1), theEvent.Get("nested.Indexed[1]"));
        }
        public void TestOuterJoin()
        {
            String viewExpr = "select * from " +
                              typeof(SupportBeanComplexProps).FullName + "#length(3) s0" +
                              " left outer join " +
                              typeof(SupportBeanCombinedProps).FullName + "#length(3) s1" +
                              " on Mapped('keyOne') = Indexed[2].Mapped('2ma').value";

            EPStatement testView = epService.EPAdministrator.CreateEPL(viewExpr);

            testListener     = new SupportUpdateListener();
            testView.Events += testListener.Update;

            SupportBeanCombinedProps combined = SupportBeanCombinedProps.MakeDefaultBean();

            epService.EPRuntime.SendEvent(combined);
            SupportBeanComplexProps complex = SupportBeanComplexProps.MakeDefaultBean();

            epService.EPRuntime.SendEvent(complex);

            // double check that outer join criteria match
            Assert.AreEqual(complex.GetMapped("keyOne"), combined.GetIndexed(2).GetMapped("2ma").Value);

            EventBean theEvent = testListener.GetAndResetLastNewData()[0];

            Assert.AreEqual("Simple", theEvent.Get("s0.SimpleProperty"));
            Assert.AreSame(complex, theEvent.Get("s0"));
            Assert.AreSame(combined, theEvent.Get("s1"));
        }
Beispiel #4
0
            public void Run(RegressionEnvironment env)
            {
                var epl = "@Name('s0') select " +
                          "(abc).GetArray().size() as size, " +
                          "(abc).GetArray().get(0).GetNestLevOneVal() as get0 " +
                          "from SupportBeanCombinedProps as abc";

                env.CompileDeploy(epl).AddListener("s0");

                var bean = SupportBeanCombinedProps.MakeDefaultBean();
                var rows = new[] {
                    new object[] { "size", typeof(int?) },
                    new object[] { "get0", typeof(string) },
                };

                for (var i = 0; i < rows.Length; i++)
                {
                    var prop = env.Statement("s0").EventType.PropertyDescriptors[i];
                    Assert.AreEqual(rows[i][0], prop.PropertyName);
                    Assert.AreEqual(rows[i][1], prop.PropertyType);
                }

                env.SendEventBean(bean);
                EPAssertionUtil.AssertProps(
                    env.Listener("s0").AssertOneGetNewAndReset(),
                    "size,get0".SplitCsv(),
                    bean.Array.Length,
                    bean.Array[0].NestLevOneVal);

                env.UndeployAll();
            }
Beispiel #5
0
        private IDictionary <string, Object> GetTestData()
        {
            IDictionary <string, Object> levelThree = ExecEventMap.MakeMap(new object[][] {
                new object[] { "simpleThree", 4000L },
                new object[] { "objectThree", new SupportBean_B("B1") },
            });

            IDictionary <string, Object> levelTwo = ExecEventMap.MakeMap(new object[][] {
                new object[] { "simpleTwo", 300 },
                new object[] { "objectTwo", SupportBeanCombinedProps.MakeDefaultBean() },
                new object[] { "nodefmapTwo", ExecEventMap.MakeMap(new object[][] { new object[] { "key3", "val3" } }) },
                new object[] { "mapTwo", levelThree },
            });

            IDictionary <string, Object> levelOne = ExecEventMap.MakeMap(new object[][] {
                new object[] { "simpleOne", 10 },
                new object[] { "objectOne", SupportBeanComplexProps.MakeDefaultBean() },
                new object[] { "nodefmapOne", ExecEventMap.MakeMap(new object[][] { new object[] { "key2", "val2" } }) },
                new object[] { "mapOne", levelTwo }
            });

            IDictionary <string, Object> levelZero = ExecEventMap.MakeMap(new object[][] {
                new object[] { "simple", "abc" },
                new object[] { "object", new SupportBean_A("A1") },
                new object[] { "nodefmap", ExecEventMap.MakeMap(new object[][] { new object[] { "key1", "val1" } }) },
                new object[] { "map", levelOne }
            });

            return(levelZero);
        }
Beispiel #6
0
        private void RunAssertionRegularJoin(EPServiceProvider epService)
        {
            SupportBeanCombinedProps combined = SupportBeanCombinedProps.MakeDefaultBean();
            SupportBeanComplexProps  complex  = SupportBeanComplexProps.MakeDefaultBean();

            Assert.AreEqual("0ma0", combined.GetIndexed(0).GetMapped("0ma").Value);

            string epl = "select nested.nested, s1.indexed[0], nested.indexed[1] from " +
                         typeof(SupportBeanComplexProps).FullName + "#length(3) nested, " +
                         typeof(SupportBeanCombinedProps).FullName + "#length(3) s1" +
                         " where Mapped('keyOne') = indexed[2].Mapped('2ma').value and" +
                         " indexed[0].Mapped('0ma').value = '0ma0'";

            EPStatement stmt         = epService.EPAdministrator.CreateEPL(epl);
            var         testListener = new SupportUpdateListener();

            stmt.Events += testListener.Update;

            epService.EPRuntime.SendEvent(combined);
            epService.EPRuntime.SendEvent(complex);

            EventBean theEvent = testListener.GetAndResetLastNewData()[0];

            Assert.AreSame(complex.Nested, theEvent.Get("nested.nested"));
            Assert.AreSame(combined.GetIndexed(0), theEvent.Get("s1.indexed[0]"));
            Assert.AreEqual(complex.GetIndexed(1), theEvent.Get("nested.indexed[1]"));

            stmt.Dispose();
        }
Beispiel #7
0
        public void TestGetComplexProperty()
        {
            var eventCombined = SupportBeanCombinedProps.MakeDefaultBean();
            var eventBean = SupportEventBeanFactory.CreateObject(supportEventTypeFactory, eventCombined);

            Assert.AreEqual("0ma0", eventBean.Get("Indexed[0].Mapped('0ma').Value"));
            Assert.AreEqual(typeof(string), eventBean.EventType.GetPropertyType("Indexed[0].Mapped('0ma').Value"));
            Assert.IsNotNull(eventBean.EventType.GetGetter("Indexed[0].Mapped('0ma').Value"));
            Assert.AreEqual("0ma1", eventBean.Get("Indexed[0].Mapped('0mb').Value"));
            Assert.AreEqual("1ma0", eventBean.Get("Indexed[1].Mapped('1ma').Value"));
            Assert.AreEqual("1ma1", eventBean.Get("Indexed[1].Mapped('1mb').Value"));

            Assert.AreEqual("0ma0", eventBean.Get("Array[0].Mapped('0ma').Value"));
            Assert.AreEqual("1ma1", eventBean.Get("Array[1].Mapped('1mb').Value"));
            Assert.AreEqual("0ma0", eventBean.Get("Array[0].Mapprop('0ma').Value"));
            Assert.AreEqual("1ma1", eventBean.Get("Array[1].Mapprop('1mb').Value"));

            TryInvalidGet(eventBean, "dummy");
            TryInvalidGet(eventBean, "dummy[1]");
            TryInvalidGet(eventBean, "dummy('dd')");
            TryInvalidGet(eventBean, "dummy.dummy1");

            // indexed getter
            TryInvalidGetFragment(eventBean, "Indexed");
            
            Assert.That(eventBean.GetFragment("Indexed[0]").AsEventBean(), Is.Not.Null);
            Assert.That(eventBean.GetFragment("Indexed[0]").AsEventBean().EventType, Is.Not.Null);
            Assert.That(eventBean.GetFragment("Indexed[0]").AsEventBean().EventType.UnderlyingType,
                Is.EqualTo(typeof(SupportBeanCombinedProps.NestedLevOne)));
            
            Assert.That(eventBean.GetFragment("Array[0]"), Is.Not.Null);
            Assert.That(eventBean.GetFragment("Array[0]").AsEventBean(), Is.Not.Null);
            Assert.That(eventBean.GetFragment("Array[0]").AsEventBean().Get("NestLevOneVal"), Is.EqualTo("abc"));

            Assert.That(eventBean.GetFragment("Array[2]?"), Is.Not.Null);
            Assert.That(eventBean.GetFragment("Array[2]?").AsEventBean(), Is.Not.Null);
            Assert.That(eventBean.GetFragment("Array[2]?").AsEventBean().Get("NestLevOneVal"), Is.EqualTo("abc"));

            //Assert.AreEqual("abc", ((EventBean) eventBean.GetFragment("Array[0]")).Get("NestLevOneVal"));
            //Assert.AreEqual("abc", eventBean.GetFragment("Array[2]?").AsEventBean().Get("NestLevOneVal"));
            
            Assert.IsNull(eventBean.GetFragment("Array[3]?"));
            Assert.IsNull(eventBean.GetFragment("Array[4]?"));
            Assert.IsNull(eventBean.GetFragment("Array[5]?"));

            var eventText = SupportEventTypeAssertionUtil.Print(eventBean);
            //System.out.println(eventText);

            var eventComplex = SupportBeanComplexProps.MakeDefaultBean();
            eventBean = SupportEventBeanFactory.CreateObject(supportEventTypeFactory, eventComplex);
            Assert.AreEqual("NestedValue", ((EventBean) eventBean.GetFragment("Nested")).Get("NestedValue"));
        }
Beispiel #8
0
        public void SetUp()
        {
            _container = SupportContainer.Reset();

            EPServiceProviderManager.PurgeAllProviders();

            _eventTypeSimple  = new BeanEventType(_container, null, 0, typeof(SupportBeanSimple), _container.Resolve <EventAdapterService>(), null);
            _eventTypeComplex = new BeanEventType(_container, null, 0, typeof(SupportBeanComplexProps), _container.Resolve <EventAdapterService>(), null);
            _eventTypeNested  = new BeanEventType(_container, null, 0, typeof(SupportBeanCombinedProps), _container.Resolve <EventAdapterService>(), null);

            _objSimple   = new SupportBeanSimple("a", 20);
            _objComplex  = SupportBeanComplexProps.MakeDefaultBean();
            _objCombined = SupportBeanCombinedProps.MakeDefaultBean();

            _eventSimple  = new BeanEventBean(_objSimple, _eventTypeSimple);
            _eventComplex = new BeanEventBean(_objComplex, _eventTypeComplex);
            _eventNested  = new BeanEventBean(_objCombined, _eventTypeNested);
        }