Пример #1
0
        public void TestIndexedValuePropOM()
        {
            var epService = EPServiceProviderManager.GetDefaultProvider(SupportConfigFactory.GetConfiguration());

            epService.Initialize();
            if (InstrumentationHelper.ENABLED)
            {
                InstrumentationHelper.StartTest(epService, GetType(), GetType().FullName);
            }

            var type = typeof(SupportBeanComplexProps).FullName;

            var model = new EPStatementObjectModel();

            model.SelectClause = SelectClause.CreateWildcard();
            PatternExpr pattern = Patterns.FollowedBy(Patterns.EveryFilter(type, "a"),
                                                      Patterns.Filter(Filter.Create(type, Expressions.EqProperty("Indexed[0]", "a.Indexed[0]")), "b"));

            model.FromClause = FromClause.Create(PatternStream.Create(pattern));
            model            = (EPStatementObjectModel)SerializableObjectCopier.Copy(model);

            var patternText = "select * from pattern [every a=" + type + " -> b=" + type + "(Indexed[0]=a.Indexed[0])]";

            Assert.AreEqual(patternText, model.ToEPL());

            var stmt = epService.EPAdministrator.Create(model);

            RunIndexedValueProp(epService, stmt);

            if (InstrumentationHelper.ENABLED)
            {
                InstrumentationHelper.EndTest();
            }
        }
Пример #2
0
        private void RunAssertionIndexedValuePropOM(EPServiceProvider epService)
        {
            string type = typeof(SupportBeanComplexProps).FullName;

            var model = new EPStatementObjectModel();

            model.SelectClause = SelectClause.CreateWildcard();
            PatternExpr pattern = Patterns.FollowedBy(Patterns.EveryFilter(type, "a"),
                                                      Patterns.Filter(Filter.Create(type, Expressions.EqProperty("Indexed[0]", "a.Indexed[0]")), "b"));

            model.FromClause = FromClause.Create(PatternStream.Create(pattern));
            model            = (EPStatementObjectModel)SerializableObjectCopier.Copy(epService.Container, model);

            string patternText = "select * from pattern [every a=" + type + " -> b=" + type + "(Indexed[0]=a.Indexed[0])]";

            Assert.AreEqual(patternText, model.ToEPL());

            EPStatement stmt = epService.EPAdministrator.Create(model);

            RunIndexedValueProp(epService, stmt);
            stmt.Dispose();
        }
Пример #3
0
            public void Run(RegressionEnvironment env)
            {
                var type = typeof(SupportBeanComplexProps).Name;

                var model = new EPStatementObjectModel();
                model.SelectClause = SelectClause.CreateWildcard();
                PatternExpr pattern = Patterns.FollowedBy(
                    Patterns.EveryFilter(type, "a"),
                    Patterns.Filter(Filter.Create(type, Expressions.EqProperty("Indexed[0]", "a.Indexed[0]")), "b"));
                model.FromClause = FromClause.Create(PatternStream.Create(pattern));
                model = env.CopyMayFail(model);

                var patternText = "select * from pattern [every a=" +
                                  type +
                                  " -> b=" +
                                  type +
                                  "(Indexed[0]=a.Indexed[0])]";
                Assert.AreEqual(patternText, model.ToEPL());

                model.Annotations = Collections.SingletonList(AnnotationPart.NameAnnotation("s0"));
                env.CompileDeploy(model).AddListener("s0");
                RunIndexedValueProp(env);
                env.UndeployAll();
            }
Пример #4
0
        public override void Run(EPServiceProvider epService)
        {
            EventCollection     events       = EventCollectionFactory.GetEventSetOne(0, 1000);
            var                 testCaseList = new CaseList();
            EventExpressionCase testCase;

            testCase = new EventExpressionCase("(b=" + EVENT_B_CLASS + " -> d=" + EVENT_D_CLASS + ") " +
                                               " and " +
                                               "(a=" + EVENT_A_CLASS + " -> e=" + EVENT_E_CLASS + ")"
                                               );
            testCase.Add("E1", "b", events.GetEvent("B1"), "d", events.GetEvent("D1"), "a", events.GetEvent("A1"), "e", events.GetEvent("E1"));
            testCaseList.AddTest(testCase);

            testCase = new EventExpressionCase("b=" + EVENT_B_CLASS + " -> (d=" + EVENT_D_CLASS + "() or a=" + EVENT_A_CLASS + ")");
            testCase.Add("A2", "b", events.GetEvent("B1"), "a", events.GetEvent("A2"));
            testCaseList.AddTest(testCase);

            var model = new EPStatementObjectModel();

            model.SelectClause = SelectClause.CreateWildcard();
            PatternExpr pattern = Patterns.FollowedBy(
                Patterns.Filter(EVENT_B_CLASS, "b"),
                Patterns.Or(Patterns.Filter(EVENT_D_CLASS, "d"), Patterns.Filter(EVENT_A_CLASS, "a")));

            model.FromClause = FromClause.Create(PatternStream.Create(pattern));
            model            = (EPStatementObjectModel)SerializableObjectCopier.Copy(epService.Container, model);
            string text = "select * from pattern [b=" + EVENT_B_CLASS + " -> d=" + EVENT_D_CLASS + " or a=" + EVENT_A_CLASS + "]";

            Assert.AreEqual(text, model.ToEPL());
            testCase = new EventExpressionCase(model);
            testCase.Add("A2", "b", events.GetEvent("B1"), "a", events.GetEvent("A2"));
            testCaseList.AddTest(testCase);

            testCase = new EventExpressionCase("b=" + EVENT_B_CLASS + "() -> (" +
                                               "(d=" + EVENT_D_CLASS + "() -> a=" + EVENT_A_CLASS + "())" +
                                               " or " +
                                               "(a=" + EVENT_A_CLASS + "() -> e=" + EVENT_E_CLASS + "()))"
                                               );
            testCase.Add("E1", "b", events.GetEvent("B1"), "a", events.GetEvent("A2"), "e", events.GetEvent("E1"));
            testCaseList.AddTest(testCase);

            testCase = new EventExpressionCase("b=" + EVENT_B_CLASS + "() and d=" +
                                               EVENT_D_CLASS + "() or a=" +
                                               EVENT_A_CLASS);
            testCase.Add("A1", "a", events.GetEvent("A1"));
            testCaseList.AddTest(testCase);

            testCase = new EventExpressionCase("(b=" + EVENT_B_CLASS + "() -> d=" + EVENT_D_CLASS + "()) or a=" + EVENT_A_CLASS);
            testCase.Add("A1", "a", events.GetEvent("A1"));
            testCaseList.AddTest(testCase);

            testCase = new EventExpressionCase("(b=" + EVENT_B_CLASS + "() and " +
                                               "d=" + EVENT_D_CLASS + "()) or " +
                                               "a=" + EVENT_A_CLASS);
            testCase.Add("A1", "a", events.GetEvent("A1"));
            testCaseList.AddTest(testCase);

            var util = new PatternTestHarness(events, testCaseList, this.GetType());

            util.RunTest(epService);
        }
Пример #5
0
        public void Run(RegressionEnvironment env)
        {
            var events = EventCollectionFactory.GetEventSetOne(0, 1000);
            var testCaseList = new CaseList();
            EventExpressionCase testCase;

            testCase = new EventExpressionCase(
                "(b=SupportBean_B -> d=SupportBean_D) " +
                " and " +
                "(a=SupportBean_A -> e=SupportBean_E)"
            );
            testCase.Add(
                "E1",
                "b",
                events.GetEvent("B1"),
                "d",
                events.GetEvent("D1"),
                "a",
                events.GetEvent("A1"),
                "e",
                events.GetEvent("E1"));
            testCaseList.AddTest(testCase);

            testCase = new EventExpressionCase("b=SupportBean_B -> (d=SupportBean_D() or a=SupportBean_A)");
            testCase.Add("A2", "b", events.GetEvent("B1"), "a", events.GetEvent("A2"));
            testCaseList.AddTest(testCase);

            var model = new EPStatementObjectModel();
            model.SelectClause = SelectClause.CreateWildcard();
            PatternExpr pattern = Patterns.FollowedBy(
                Patterns.Filter("SupportBean_B", "b"),
                Patterns.Or(Patterns.Filter("SupportBean_D", "d"), Patterns.Filter("SupportBean_A", "a")));
            model.FromClause = FromClause.Create(PatternStream.Create(pattern));
            model = env.CopyMayFail(model);
            var text = "select * from pattern [b=SupportBean_B -> d=SupportBean_D or a=SupportBean_A]";
            Assert.AreEqual(text, model.ToEPL());
            testCase = new EventExpressionCase(model);
            testCase.Add("A2", "b", events.GetEvent("B1"), "a", events.GetEvent("A2"));
            testCaseList.AddTest(testCase);

            testCase = new EventExpressionCase(
                "b=SupportBean_B() -> (" +
                "(d=SupportBean_D() -> a=SupportBean_A())" +
                " or " +
                "(a=SupportBean_A() -> e=SupportBean_E()))"
            );
            testCase.Add("E1", "b", events.GetEvent("B1"), "a", events.GetEvent("A2"), "e", events.GetEvent("E1"));
            testCaseList.AddTest(testCase);

            testCase = new EventExpressionCase("b=SupportBean_B() and d=SupportBean_D or a=SupportBean_A");
            testCase.Add("A1", "a", events.GetEvent("A1"));
            testCaseList.AddTest(testCase);

            testCase = new EventExpressionCase("(b=SupportBean_B() -> d=SupportBean_D()) or a=SupportBean_A");
            testCase.Add("A1", "a", events.GetEvent("A1"));
            testCaseList.AddTest(testCase);

            testCase = new EventExpressionCase(
                "(b=SupportBean_B() and " +
                "d=SupportBean_D()) or " +
                "a=SupportBean_A");
            testCase.Add("A1", "a", events.GetEvent("A1"));
            testCaseList.AddTest(testCase);

            var util = new PatternTestHarness(events, testCaseList, GetType());
            util.RunTest(env);
        }