예제 #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
        public void TestOp()
        {
            var events       = EventCollectionFactory.GetEventSetOne(0, 1000);
            var testCaseList = new CaseList();

            var testCase = new EventExpressionCase("a=A -> (every b=B) while(b.Id != 'B2')");

            testCase.Add("B1", "a", events.GetEvent("A1"), "b", events.GetEvent("B1"));
            testCaseList.AddTest(testCase);

            testCase = new EventExpressionCase("a=A -> (every b=B) while(b.Id != 'B3')");
            testCase.Add("B1", "a", events.GetEvent("A1"), "b", events.GetEvent("B1"));
            testCase.Add("B2", "a", events.GetEvent("A1"), "b", events.GetEvent("B2"));
            testCaseList.AddTest(testCase);

            testCase = new EventExpressionCase("(every b=B) while(b.Id != 'B3')");
            testCase.Add("B1", "b", events.GetEvent("B1"));
            testCase.Add("B2", "b", events.GetEvent("B2"));
            testCaseList.AddTest(testCase);

            String text = "select * from pattern [(every b=" + EVENT_B_CLASS + ") while (b.Id!=\"B3\")]";

            var model = new EPStatementObjectModel();

            model.SelectClause = SelectClause.CreateWildcard();
            model = (EPStatementObjectModel)SerializableObjectCopier.Copy(model);
            Expression  guardExpr      = Expressions.Neq("b.Id", "B3");
            PatternExpr every          = Patterns.Every(Patterns.Filter(Filter.Create(EVENT_B_CLASS), "b"));
            PatternExpr patternGuarded = Patterns.WhileGuard(every, guardExpr);

            model.FromClause = FromClause.Create(PatternStream.Create(patternGuarded));
            Assert.AreEqual(text, model.ToEPL());
            testCase = new EventExpressionCase(model);
            testCase.Add("B1", "b", events.GetEvent("B1"));
            testCase.Add("B2", "b", events.GetEvent("B2"));
            testCaseList.AddTest(testCase);

            testCase = new EventExpressionCase("(every b=B) while(b.Id != 'B1')");
            testCaseList.AddTest(testCase);

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

            util.RunTest();
        }
예제 #3
0
            public void Run(RegressionEnvironment env)
            {
                var events = EventCollectionFactory.GetEventSetOne(0, 1000);
                var testCaseList = new CaseList();
                EventExpressionCase testCase = null;

                testCase = new EventExpressionCase("a=SupportBean_A -> (every b=SupportBean_B) while(b.Id != 'B2')");
                testCase.Add("B1", "a", events.GetEvent("A1"), "b", events.GetEvent("B1"));
                testCaseList.AddTest(testCase);

                testCase = new EventExpressionCase("a=SupportBean_A -> (every b=SupportBean_B) while(b.Id != 'B3')");
                testCase.Add("B1", "a", events.GetEvent("A1"), "b", events.GetEvent("B1"));
                testCase.Add("B2", "a", events.GetEvent("A1"), "b", events.GetEvent("B2"));
                testCaseList.AddTest(testCase);

                testCase = new EventExpressionCase("(every b=SupportBean_B) while(b.Id != 'B3')");
                testCase.Add("B1", "b", events.GetEvent("B1"));
                testCase.Add("B2", "b", events.GetEvent("B2"));
                testCaseList.AddTest(testCase);

                var text = "select * from pattern [(every b=SupportBean_B) while (b.Id!=\"B3\")]";
                var model = new EPStatementObjectModel();
                model.SelectClause = SelectClause.CreateWildcard();
                model = env.CopyMayFail(model);
                Expression guardExpr = Expressions.Neq("b.Id", "B3");
                PatternExpr every = Patterns.Every(Patterns.Filter(Filter.Create("SupportBean_B"), "b"));
                PatternExpr patternGuarded = Patterns.WhileGuard(every, guardExpr);
                model.FromClause = FromClause.Create(PatternStream.Create(patternGuarded));
                Assert.AreEqual(text, model.ToEPL());
                testCase = new EventExpressionCase(model);
                testCase.Add("B1", "b", events.GetEvent("B1"));
                testCase.Add("B2", "b", events.GetEvent("B2"));
                testCaseList.AddTest(testCase);

                testCase = new EventExpressionCase("(every b=SupportBean_B) while(b.Id != 'B1')");
                testCaseList.AddTest(testCase);

                var util = new PatternTestHarness(events, testCaseList, GetType());
                util.RunTest(env);
            }
예제 #4
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();
        }
예제 #5
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();
            }
        public void Run(RegressionEnvironment env)
        {
            var events = EventCollectionFactory.GetEventSetOne(0, 1000);
            var testCaseList = new CaseList();
            EventExpressionCase testCase;

            testCase = new EventExpressionCase("b=SupportBean_B(Id='B1') where timer:withinmax(2 sec,100)");
            testCaseList.AddTest(testCase);

            testCase = new EventExpressionCase("b=SupportBean_B(Id='B1') where timer:withinmax(2001 msec,1)");
            testCase.Add("B1", "b", events.GetEvent("B1"));
            testCaseList.AddTest(testCase);

            testCase = new EventExpressionCase("b=SupportBean_B(Id='B1') where timer:withinmax(1999 msec,10)");
            testCaseList.AddTest(testCase);

            var text = "select * from pattern [b=SupportBean_B(Id='B3') where timer:withinmax(10.001d,1)]";
            var model = new EPStatementObjectModel();
            model.SelectClause = SelectClause.CreateWildcard();
            model = env.CopyMayFail(model);
            Expression filter = Expressions.Eq("Id", "B3");
            PatternExpr pattern = Patterns.TimerWithinMax(
                10.001,
                1,
                Patterns.Filter(Filter.Create("SupportBean_B", filter), "b"));
            model.FromClause = FromClause.Create(PatternStream.Create(pattern));
            Assert.AreEqual(text, model.ToEPL().Replace("\"", "'"));
            testCase = new EventExpressionCase(model);
            testCase.Add("B3", "b", events.GetEvent("B3"));
            testCaseList.AddTest(testCase);

            testCase = new EventExpressionCase("(every b=SupportBean_B) where timer:withinmax(4.001, 0)");
            testCaseList.AddTest(testCase);

            testCase = new EventExpressionCase("(every b=SupportBean_B) where timer:withinmax(4.001, 1)");
            testCase.Add("B1", "b", events.GetEvent("B1"));
            testCaseList.AddTest(testCase);

            testCase = new EventExpressionCase("(every b=SupportBean_B) where timer:withinmax(4.001, 2)");
            testCase.Add("B1", "b", events.GetEvent("B1"));
            testCase.Add("B2", "b", events.GetEvent("B2"));
            testCaseList.AddTest(testCase);

            testCase = new EventExpressionCase("every b=SupportBean_B where timer:withinmax(2.001, 4)");
            testCase.Add("B1", "b", events.GetEvent("B1"));
            testCase.Add("B2", "b", events.GetEvent("B2"));
            testCase.Add("B3", "b", events.GetEvent("B3"));
            testCaseList.AddTest(testCase);

            // Note how every restarts the max
            testCase = new EventExpressionCase("every (b=SupportBean_B where timer:withinmax(2001 msec, 2))");
            testCase.Add("B1", "b", events.GetEvent("B1"));
            testCase.Add("B2", "b", events.GetEvent("B2"));
            testCase.Add("B3", "b", events.GetEvent("B3"));
            testCaseList.AddTest(testCase);

            testCase = new EventExpressionCase("every (b=SupportBean_B where timer:withinmax(2001 msec, 3))");
            testCase.Add("B1", "b", events.GetEvent("B1"));
            testCase.Add("B2", "b", events.GetEvent("B2"));
            testCase.Add("B3", "b", events.GetEvent("B3"));
            testCaseList.AddTest(testCase);

            testCase = new EventExpressionCase("every (b=SupportBean_B where timer:withinmax(2001 msec, 1))");
            testCase.Add("B1", "b", events.GetEvent("B1"));
            testCase.Add("B2", "b", events.GetEvent("B2"));
            testCase.Add("B3", "b", events.GetEvent("B3"));
            testCaseList.AddTest(testCase);

            testCase = new EventExpressionCase("every (b=SupportBean_B where timer:withinmax(2001 msec, 0))");
            testCaseList.AddTest(testCase);

            testCase = new EventExpressionCase(
                "every b=SupportBean_B -> d=SupportBean_D where timer:withinmax(4000 msec, 1)");
            testCase.Add("D1", "b", events.GetEvent("B2"), "d", events.GetEvent("D1"));
            testCase.Add("D3", "b", events.GetEvent("B3"), "d", events.GetEvent("D3"));
            testCaseList.AddTest(testCase);

            testCase = new EventExpressionCase(
                "every b=SupportBean_B() -> every d=SupportBean_D where timer:withinmax(4000 msec, 1)");
            testCase.Add("D1", "b", events.GetEvent("B1"), "d", events.GetEvent("D1"));
            testCase.Add("D1", "b", events.GetEvent("B2"), "d", events.GetEvent("D1"));
            testCase.Add("D2", "b", events.GetEvent("B1"), "d", events.GetEvent("D2"));
            testCase.Add("D2", "b", events.GetEvent("B2"), "d", events.GetEvent("D2"));
            testCase.Add("D3", "b", events.GetEvent("B1"), "d", events.GetEvent("D3"));
            testCase.Add("D3", "b", events.GetEvent("B2"), "d", events.GetEvent("D3"));
            testCase.Add("D3", "b", events.GetEvent("B3"), "d", events.GetEvent("D3"));
            testCaseList.AddTest(testCase);

            testCase = new EventExpressionCase(
                "every b=SupportBean_B() -> (every d=SupportBean_D) where timer:withinmax(1 day, 3)");
            testCase.Add("D1", "b", events.GetEvent("B1"), "d", events.GetEvent("D1"));
            testCase.Add("D1", "b", events.GetEvent("B2"), "d", events.GetEvent("D1"));
            testCase.Add("D2", "b", events.GetEvent("B1"), "d", events.GetEvent("D2"));
            testCase.Add("D2", "b", events.GetEvent("B2"), "d", events.GetEvent("D2"));
            testCase.Add("D3", "b", events.GetEvent("B1"), "d", events.GetEvent("D3"));
            testCase.Add("D3", "b", events.GetEvent("B2"), "d", events.GetEvent("D3"));
            testCase.Add("D3", "b", events.GetEvent("B3"), "d", events.GetEvent("D3"));
            testCaseList.AddTest(testCase);

            testCase = new EventExpressionCase(
                "every b=SupportBean_B() -> (every d=SupportBean_D) where timer:withinmax(1 day, 2)");
            testCase.Add("D1", "b", events.GetEvent("B1"), "d", events.GetEvent("D1"));
            testCase.Add("D1", "b", events.GetEvent("B2"), "d", events.GetEvent("D1"));
            testCase.Add("D2", "b", events.GetEvent("B1"), "d", events.GetEvent("D2"));
            testCase.Add("D2", "b", events.GetEvent("B2"), "d", events.GetEvent("D2"));
            testCase.Add("D3", "b", events.GetEvent("B3"), "d", events.GetEvent("D3"));
            testCaseList.AddTest(testCase);

            testCase = new EventExpressionCase(
                "every b=SupportBean_B() -> (every d=SupportBean_D) where timer:withinmax(1 day, 1)");
            testCase.Add("D1", "b", events.GetEvent("B1"), "d", events.GetEvent("D1"));
            testCase.Add("D1", "b", events.GetEvent("B2"), "d", events.GetEvent("D1"));
            testCase.Add("D3", "b", events.GetEvent("B3"), "d", events.GetEvent("D3"));
            testCaseList.AddTest(testCase);

            var util = new PatternTestHarness(events, testCaseList, GetType());
            util.RunTest(env);
        }
예제 #7
0
        public void TestOp()
        {
            EventCollection     events       = EventCollectionFactory.GetEventSetOne(0, 1000);
            CaseList            testCaseList = new CaseList();
            EventExpressionCase testCase     = null;

            testCase = new EventExpressionCase("b=" + EVENT_B_CLASS + "(Id=\"B1\") where timer:within(2 sec)");
            testCaseList.AddTest(testCase);

            testCase = new EventExpressionCase("b=" + EVENT_B_CLASS + "(Id=\"B1\") where timer:within(2001 msec)");
            testCase.Add("B1", "b", events.GetEvent("B1"));
            testCaseList.AddTest(testCase);

            testCase = new EventExpressionCase("b=" + EVENT_B_CLASS + "(Id=\"B1\") where timer:within(1999 msec)");
            testCaseList.AddTest(testCase);

            String text = "select * from pattern [b=" + EVENT_B_CLASS + "(Id=\"B3\") where timer:within(10.001)]";
            EPStatementObjectModel model = new EPStatementObjectModel();

            model.SelectClause = SelectClause.CreateWildcard();
            model = (EPStatementObjectModel)SerializableObjectCopier.Copy(model);
            Expression  filter  = Expressions.Eq("Id", "B3");
            PatternExpr pattern = Patterns.TimerWithin(10.001, Patterns.Filter(Filter.Create(EVENT_B_CLASS, filter), "b"));

            model.FromClause = FromClause.Create(PatternStream.Create(pattern));
            Assert.AreEqual(text, model.ToEPL());
            testCase = new EventExpressionCase(model);
            testCase.Add("B3", "b", events.GetEvent("B3"));
            testCaseList.AddTest(testCase);

            testCase = new EventExpressionCase("b=" + EVENT_B_CLASS + "(Id=\"B3\") where timer:within(10001 msec)");
            testCase.Add("B3", "b", events.GetEvent("B3"));
            testCaseList.AddTest(testCase);

            testCase = new EventExpressionCase("b=" + EVENT_B_CLASS + "(Id=\"B3\") where timer:within(10 sec)");
            testCaseList.AddTest(testCase);

            testCase = new EventExpressionCase("b=" + EVENT_B_CLASS + "(Id=\"B3\") where timer:within(9.999)");
            testCaseList.AddTest(testCase);

            testCase = new EventExpressionCase("(every b=" + EVENT_B_CLASS + ") where timer:within(2.001)");
            testCase.Add("B1", "b", events.GetEvent("B1"));
            testCaseList.AddTest(testCase);

            testCase = new EventExpressionCase("(every b=" + EVENT_B_CLASS + ") where timer:within(4.001)");
            testCase.Add("B1", "b", events.GetEvent("B1"));
            testCase.Add("B2", "b", events.GetEvent("B2"));
            testCaseList.AddTest(testCase);

            testCase = new EventExpressionCase("every b=" + EVENT_B_CLASS + " where timer:within(2.001)");
            testCase.Add("B1", "b", events.GetEvent("B1"));
            testCase.Add("B2", "b", events.GetEvent("B2"));
            testCase.Add("B3", "b", events.GetEvent("B3"));
            testCaseList.AddTest(testCase);

            testCase = new EventExpressionCase("every (b=" + EVENT_B_CLASS + " where timer:within(2001 msec))");
            testCase.Add("B1", "b", events.GetEvent("B1"));
            testCase.Add("B2", "b", events.GetEvent("B2"));
            testCase.Add("B3", "b", events.GetEvent("B3"));
            testCaseList.AddTest(testCase);

            testCase = new EventExpressionCase("every ((every b=" + EVENT_B_CLASS + ") where timer:within(2.001))");
            testCase.Add("B1", "b", events.GetEvent("B1"));
            testCase.Add("B2", "b", events.GetEvent("B2"));
            testCase.Add("B2", "b", events.GetEvent("B2"));
            testCase.Add("B3", "b", events.GetEvent("B3"));
            testCase.Add("B3", "b", events.GetEvent("B3"));
            testCase.Add("B3", "b", events.GetEvent("B3"));
            testCase.Add("B3", "b", events.GetEvent("B3"));
            testCaseList.AddTest(testCase);

            testCase = new EventExpressionCase("every ((every b=" + EVENT_B_CLASS + ") where timer:within(6.001))");
            testCase.Add("B1", "b", events.GetEvent("B1"));
            testCase.Add("B2", "b", events.GetEvent("B2"));
            testCase.Add("B2", "b", events.GetEvent("B2"));
            testCase.Add("B3", "b", events.GetEvent("B3"));
            testCase.Add("B3", "b", events.GetEvent("B3"));
            testCase.Add("B3", "b", events.GetEvent("B3"));
            testCase.Add("B3", "b", events.GetEvent("B3"));
            testCaseList.AddTest(testCase);

            testCase = new EventExpressionCase("(every b=" + EVENT_B_CLASS + ") where timer:within(11.001)");
            testCase.Add("B1", "b", events.GetEvent("B1"));
            testCase.Add("B2", "b", events.GetEvent("B2"));
            testCase.Add("B3", "b", events.GetEvent("B3"));
            testCaseList.AddTest(testCase);

            testCase = new EventExpressionCase("(every b=" + EVENT_B_CLASS + ") where timer:within(4001 milliseconds)");
            testCase.Add("B1", "b", events.GetEvent("B1"));
            testCase.Add("B2", "b", events.GetEvent("B2"));
            testCaseList.AddTest(testCase);

            testCase = new EventExpressionCase("every (b=" + EVENT_B_CLASS + ") where timer:within(6.001)");
            testCase.Add("B1", "b", events.GetEvent("B1"));
            testCase.Add("B2", "b", events.GetEvent("B2"));
            testCase.Add("B3", "b", events.GetEvent("B3"));
            testCaseList.AddTest(testCase);

            testCase = new EventExpressionCase("b=" + EVENT_B_CLASS + " -> d=" + EVENT_D_CLASS + " where timer:within(4001 milliseconds)");
            testCase.Add("D1", "b", events.GetEvent("B1"), "d", events.GetEvent("D1"));
            testCaseList.AddTest(testCase);

            testCase = new EventExpressionCase("b=" + EVENT_B_CLASS + "() -> d=" + EVENT_D_CLASS + "() where timer:within(4 sec)");
            testCaseList.AddTest(testCase);

            testCase = new EventExpressionCase("every (b=" + EVENT_B_CLASS + "() where timer:within (4.001) and d=" + EVENT_D_CLASS + "() where timer:within(6.001))");
            testCase.Add("D1", "b", events.GetEvent("B1"), "d", events.GetEvent("D1"));
            testCase.Add("B3", "b", events.GetEvent("B3"), "d", events.GetEvent("D2"));
            testCaseList.AddTest(testCase);

            testCase = new EventExpressionCase("b=" + EVENT_B_CLASS + "() where timer:within (2001 msec) and d=" + EVENT_D_CLASS + "() where timer:within(6001 msec)");
            testCase.Add("D1", "b", events.GetEvent("B1"), "d", events.GetEvent("D1"));
            testCaseList.AddTest(testCase);

            testCase = new EventExpressionCase("b=" + EVENT_B_CLASS + "() where timer:within (2001 msec) and d=" + EVENT_D_CLASS + "() where timer:within(6000 msec)");
            testCaseList.AddTest(testCase);

            testCase = new EventExpressionCase("b=" + EVENT_B_CLASS + "() where timer:within (2000 msec) and d=" + EVENT_D_CLASS + "() where timer:within(6001 msec)");
            testCaseList.AddTest(testCase);

            testCase = new EventExpressionCase("every b=" + EVENT_B_CLASS + " -> d=" + EVENT_D_CLASS + " where timer:within(4000 msec)");
            testCase.Add("D1", "b", events.GetEvent("B2"), "d", events.GetEvent("D1"));
            testCase.Add("D3", "b", events.GetEvent("B3"), "d", events.GetEvent("D3"));
            testCaseList.AddTest(testCase);

            testCase = new EventExpressionCase("every b=" + EVENT_B_CLASS + "() -> every d=" + EVENT_D_CLASS + " where timer:within(4000 msec)");
            testCase.Add("D1", "b", events.GetEvent("B1"), "d", events.GetEvent("D1"));
            testCase.Add("D1", "b", events.GetEvent("B2"), "d", events.GetEvent("D1"));
            testCase.Add("D2", "b", events.GetEvent("B1"), "d", events.GetEvent("D2"));
            testCase.Add("D2", "b", events.GetEvent("B2"), "d", events.GetEvent("D2"));
            testCase.Add("D3", "b", events.GetEvent("B1"), "d", events.GetEvent("D3"));
            testCase.Add("D3", "b", events.GetEvent("B2"), "d", events.GetEvent("D3"));
            testCase.Add("D3", "b", events.GetEvent("B3"), "d", events.GetEvent("D3"));
            testCaseList.AddTest(testCase);

            testCase = new EventExpressionCase("b=" + EVENT_B_CLASS + "() -> d=" + EVENT_D_CLASS + "() where timer:within(3999 msec)");
            testCaseList.AddTest(testCase);

            testCase = new EventExpressionCase("every b=" + EVENT_B_CLASS + "() -> (every d=" + EVENT_D_CLASS + ") where timer:within(2001 msec)");
            testCase.Add("D1", "b", events.GetEvent("B2"), "d", events.GetEvent("D1"));
            testCase.Add("D3", "b", events.GetEvent("B3"), "d", events.GetEvent("D3"));
            testCaseList.AddTest(testCase);

            testCase = new EventExpressionCase("every (b=" + EVENT_B_CLASS + "() -> d=" + EVENT_D_CLASS + "()) where timer:within(6001 msec)");
            testCase.Add("D1", "b", events.GetEvent("B1"), "d", events.GetEvent("D1"));
            testCase.Add("D3", "b", events.GetEvent("B3"), "d", events.GetEvent("D3"));
            testCaseList.AddTest(testCase);

            testCase = new EventExpressionCase("b=" + EVENT_B_CLASS + "() where timer:within (2000 msec) or d=" + EVENT_D_CLASS + "() where timer:within(6000 msec)");
            testCaseList.AddTest(testCase);

            testCase = new EventExpressionCase("(b=" + EVENT_B_CLASS + "() where timer:within (2000 msec) or d=" + EVENT_D_CLASS + "() where timer:within(6000 msec)) where timer:within (1999 msec)");
            testCaseList.AddTest(testCase);

            testCase = new EventExpressionCase("every (b=" + EVENT_B_CLASS + "() where timer:within (2001 msec) and d=" + EVENT_D_CLASS + "() where timer:within(6001 msec))");
            testCase.Add("D1", "b", events.GetEvent("B1"), "d", events.GetEvent("D1"));
            testCase.Add("B3", "b", events.GetEvent("B3"), "d", events.GetEvent("D2"));
            testCaseList.AddTest(testCase);

            testCase = new EventExpressionCase("b=" + EVENT_B_CLASS + "() where timer:within (2001 msec) or d=" + EVENT_D_CLASS + "() where timer:within(6001 msec)");
            testCase.Add("B1", "b", events.GetEvent("B1"));
            testCaseList.AddTest(testCase);

            testCase = new EventExpressionCase("b=" + EVENT_B_CLASS + "() where timer:within (2000 msec) or d=" + EVENT_D_CLASS + "() where timer:within(6001 msec)");
            testCase.Add("D1", "d", events.GetEvent("D1"));
            testCaseList.AddTest(testCase);

            testCase = new EventExpressionCase("every b=" + EVENT_B_CLASS + "() where timer:within (2001 msec) and every d=" + EVENT_D_CLASS + "() where timer:within(6001 msec)");
            testCase.Add("D1", "b", events.GetEvent("B1"), "d", events.GetEvent("D1"));
            testCase.Add("D1", "b", events.GetEvent("B2"), "d", events.GetEvent("D1"));
            testCase.Add("D2", "b", events.GetEvent("B1"), "d", events.GetEvent("D2"));
            testCase.Add("D2", "b", events.GetEvent("B2"), "d", events.GetEvent("D2"));
            testCase.Add("B3", "b", events.GetEvent("B3"), "d", events.GetEvent("D1"));
            testCase.Add("B3", "b", events.GetEvent("B3"), "d", events.GetEvent("D2"));
            testCase.Add("D3", "b", events.GetEvent("B1"), "d", events.GetEvent("D3"));
            testCase.Add("D3", "b", events.GetEvent("B2"), "d", events.GetEvent("D3"));
            testCase.Add("D3", "b", events.GetEvent("B3"), "d", events.GetEvent("D3"));
            testCaseList.AddTest(testCase);

            testCase = new EventExpressionCase("(every b=" + EVENT_B_CLASS + ") where timer:within (2000 msec) and every d=" + EVENT_D_CLASS + "() where timer:within(6001 msec)");
            testCaseList.AddTest(testCase);

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

            util.RunTest();
        }
예제 #8
0
        public void TestOp()
        {
            EventCollection     events       = EventCollectionFactory.GetEventSetOne(0, 1000);
            CaseList            testCaseList = new CaseList();
            EventExpressionCase testCase;

            testCase = new EventExpressionCase("b=" + EVENT_B_CLASS + " and every d=" + EVENT_D_CLASS);
            testCase.Add("D1", "b", events.GetEvent("B1"), "d", events.GetEvent("D1"));
            testCase.Add("D2", "b", events.GetEvent("B1"), "d", events.GetEvent("D2"));
            testCase.Add("D3", "b", events.GetEvent("B1"), "d", events.GetEvent("D3"));
            testCaseList.AddTest(testCase);

            testCase = new EventExpressionCase("every b=" + EVENT_B_CLASS + " and d=" + EVENT_D_CLASS);
            testCase.Add("D1", "b", events.GetEvent("B1"), "d", events.GetEvent("D1"));
            testCase.Add("D1", "b", events.GetEvent("B2"), "d", events.GetEvent("D1"));
            testCase.Add("B3", "b", events.GetEvent("B3"), "d", events.GetEvent("D1"));
            testCaseList.AddTest(testCase);

            testCase = new EventExpressionCase("b=" + EVENT_B_CLASS + " and d=" + EVENT_D_CLASS);
            testCase.Add("D1", "b", events.GetEvent("B1"), "d", events.GetEvent("D1"));
            testCaseList.AddTest(testCase);

            testCase = new EventExpressionCase("every(b=" + EVENT_B_CLASS + " and d=" + EVENT_D_CLASS + ")");
            testCase.Add("D1", "b", events.GetEvent("B1"), "d", events.GetEvent("D1"));
            testCase.Add("B3", "b", events.GetEvent("B3"), "d", events.GetEvent("D2"));
            testCaseList.AddTest(testCase);

            EPStatementObjectModel model = new EPStatementObjectModel();

            model.SelectClause = SelectClause.CreateWildcard();
            PatternExpr pattern = Patterns.Every(Patterns.And(Patterns.Filter(EVENT_B_CLASS, "b"), Patterns.Filter(EVENT_D_CLASS, "d")));

            model.FromClause = FromClause.Create(PatternStream.Create(pattern));
            model            = (EPStatementObjectModel)SerializableObjectCopier.Copy(model);
            Assert.AreEqual("select * from pattern [every (b=" + EVENT_B_CLASS + " and d=" + EVENT_D_CLASS + ")]", model.ToEPL());
            testCase = new EventExpressionCase(model);
            testCase.Add("D1", "b", events.GetEvent("B1"), "d", events.GetEvent("D1"));
            testCase.Add("B3", "b", events.GetEvent("B3"), "d", events.GetEvent("D2"));
            testCaseList.AddTest(testCase);

            testCase = new EventExpressionCase("every( b=" + EVENT_B_CLASS + " and every d=" + EVENT_D_CLASS + ")");
            testCase.Add("D1", "b", events.GetEvent("B1"), "d", events.GetEvent("D1"));
            testCase.Add("D2", "b", events.GetEvent("B1"), "d", events.GetEvent("D2"));
            testCase.Add("B3", "b", events.GetEvent("B3"), "d", events.GetEvent("D2"));
            testCase.Add("D3", "b", events.GetEvent("B1"), "d", events.GetEvent("D3"));
            testCase.Add("D3", "b", events.GetEvent("B3"), "d", events.GetEvent("D3"));
            testCase.Add("D3", "b", events.GetEvent("B3"), "d", events.GetEvent("D3"));
            testCaseList.AddTest(testCase);

            testCase = new EventExpressionCase("every b=" + EVENT_B_CLASS + " and every d=" + EVENT_D_CLASS);
            testCase.Add("D1", "b", events.GetEvent("B1"), "d", events.GetEvent("D1"));
            testCase.Add("D1", "b", events.GetEvent("B2"), "d", events.GetEvent("D1"));
            testCase.Add("D2", "b", events.GetEvent("B1"), "d", events.GetEvent("D2"));
            testCase.Add("D2", "b", events.GetEvent("B2"), "d", events.GetEvent("D2"));
            testCase.Add("B3", "b", events.GetEvent("B3"), "d", events.GetEvent("D1"));
            testCase.Add("B3", "b", events.GetEvent("B3"), "d", events.GetEvent("D2"));
            testCase.Add("D3", "b", events.GetEvent("B1"), "d", events.GetEvent("D3"));
            testCase.Add("D3", "b", events.GetEvent("B2"), "d", events.GetEvent("D3"));
            testCase.Add("D3", "b", events.GetEvent("B3"), "d", events.GetEvent("D3"));
            testCaseList.AddTest(testCase);

            testCase = new EventExpressionCase("every( every b=" + EVENT_B_CLASS + " and d=" + EVENT_D_CLASS + ")");
            testCase.Add("D1", "b", events.GetEvent("B1"), "d", events.GetEvent("D1"));
            testCase.Add("D1", "b", events.GetEvent("B2"), "d", events.GetEvent("D1"));
            testCase.Add("B3", "b", events.GetEvent("B3"), "d", events.GetEvent("D1"));
            testCase.Add("B3", "b", events.GetEvent("B3"), "d", events.GetEvent("D2"));
            testCase.Add("B3", "b", events.GetEvent("B3"), "d", events.GetEvent("D2"));
            testCaseList.AddTest(testCase);

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

            testCase = new EventExpressionCase("every( every b=" + EVENT_B_CLASS + " and every d=" + EVENT_D_CLASS + ")");
            testCase.Add("D1", "b", events.GetEvent("B1"), "d", events.GetEvent("D1"));
            testCase.Add("D1", "b", events.GetEvent("B2"), "d", events.GetEvent("D1"));
            testCase.Add("D2", "b", events.GetEvent("B1"), "d", events.GetEvent("D2"));
            testCase.Add("D2", "b", events.GetEvent("B2"), "d", events.GetEvent("D2"));
            testCase.Add("B3", "b", events.GetEvent("B3"), "d", events.GetEvent("D1"));
            for (int i = 0; i < 3; i++)
            {
                testCase.Add("B3", "b", events.GetEvent("B3"), "d", events.GetEvent("D2"));
            }
            testCase.Add("D3", "b", events.GetEvent("B1"), "d", events.GetEvent("D3"));
            testCase.Add("D3", "b", events.GetEvent("B2"), "d", events.GetEvent("D3"));
            for (int i = 0; i < 5; i++)
            {
                testCase.Add("D3", "b", events.GetEvent("B3"), "d", events.GetEvent("D3"));
            }
            testCaseList.AddTest(testCase);

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

            testCase = new EventExpressionCase("every a=" + EVENT_A_CLASS + " and every d=" + EVENT_D_CLASS + " and b=" + EVENT_B_CLASS);
            testCase.Add("D1", "b", events.GetEvent("B1"), "d", events.GetEvent("D1"), "a", events.GetEvent("A1"));
            testCase.Add("D1", "b", events.GetEvent("B1"), "d", events.GetEvent("D1"), "a", events.GetEvent("A2"));
            testCase.Add("D2", "b", events.GetEvent("B1"), "d", events.GetEvent("D2"), "a", events.GetEvent("A1"));
            testCase.Add("D2", "b", events.GetEvent("B1"), "d", events.GetEvent("D2"), "a", events.GetEvent("A2"));
            testCase.Add("D3", "b", events.GetEvent("B1"), "d", events.GetEvent("D3"), "a", events.GetEvent("A1"));
            testCase.Add("D3", "b", events.GetEvent("B1"), "d", events.GetEvent("D3"), "a", events.GetEvent("A2"));
            testCaseList.AddTest(testCase);

            testCase = new EventExpressionCase("b=" + EVENT_B_CLASS + " and b=" + EVENT_B_CLASS);
            testCase.Add("B1", "b", events.GetEvent("B1"), "b", events.GetEvent("B1"));
            testCaseList.AddTest(testCase);

            testCase = new EventExpressionCase("every a=" + EVENT_A_CLASS + " and every d=" + EVENT_D_CLASS + " and every b=" + EVENT_B_CLASS);
            testCase.Add("D1", "b", events.GetEvent("B1"), "d", events.GetEvent("D1"), "a", events.GetEvent("A1"));
            testCase.Add("D1", "b", events.GetEvent("B1"), "d", events.GetEvent("D1"), "a", events.GetEvent("A2"));
            testCase.Add("D1", "b", events.GetEvent("B2"), "d", events.GetEvent("D1"), "a", events.GetEvent("A1"));
            testCase.Add("D1", "b", events.GetEvent("B2"), "d", events.GetEvent("D1"), "a", events.GetEvent("A2"));
            testCase.Add("D2", "b", events.GetEvent("B1"), "d", events.GetEvent("D2"), "a", events.GetEvent("A1"));
            testCase.Add("D2", "b", events.GetEvent("B1"), "d", events.GetEvent("D2"), "a", events.GetEvent("A2"));
            testCase.Add("D2", "b", events.GetEvent("B2"), "d", events.GetEvent("D2"), "a", events.GetEvent("A1"));
            testCase.Add("D2", "b", events.GetEvent("B2"), "d", events.GetEvent("D2"), "a", events.GetEvent("A2"));
            testCase.Add("B3", "b", events.GetEvent("B3"), "d", events.GetEvent("D1"), "a", events.GetEvent("A1"));
            testCase.Add("B3", "b", events.GetEvent("B3"), "d", events.GetEvent("D1"), "a", events.GetEvent("A2"));
            testCase.Add("B3", "b", events.GetEvent("B3"), "d", events.GetEvent("D2"), "a", events.GetEvent("A1"));
            testCase.Add("B3", "b", events.GetEvent("B3"), "d", events.GetEvent("D2"), "a", events.GetEvent("A2"));
            testCase.Add("D3", "b", events.GetEvent("B1"), "d", events.GetEvent("D3"), "a", events.GetEvent("A1"));
            testCase.Add("D3", "b", events.GetEvent("B1"), "d", events.GetEvent("D3"), "a", events.GetEvent("A2"));
            testCase.Add("D3", "b", events.GetEvent("B2"), "d", events.GetEvent("D3"), "a", events.GetEvent("A1"));
            testCase.Add("D3", "b", events.GetEvent("B2"), "d", events.GetEvent("D3"), "a", events.GetEvent("A2"));
            testCase.Add("D3", "b", events.GetEvent("B3"), "d", events.GetEvent("D3"), "a", events.GetEvent("A1"));
            testCase.Add("D3", "b", events.GetEvent("B3"), "d", events.GetEvent("D3"), "a", events.GetEvent("A2"));
            testCaseList.AddTest(testCase);

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

            testCase = new EventExpressionCase("every (b=" + EVENT_B_CLASS + " and b=" + EVENT_B_CLASS + ")");
            testCase.Add("B1", "b", events.GetEvent("B1"), "b", events.GetEvent("B1"));
            testCase.Add("B2", "b", events.GetEvent("B2"), "b", events.GetEvent("B2"));
            testCase.Add("B3", "b", events.GetEvent("B3"), "b", events.GetEvent("B3"));
            testCaseList.AddTest(testCase);

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

            util.RunTest();
        }
예제 #9
0
        public void TestOp()
        {
            var events       = EventCollectionFactory.GetEventSetOne(0, 1000);
            var testCaseList = new CaseList();

            var testCase = new EventExpressionCase("b=" + EVENT_B_CLASS + "(Id=\"B1\") where timer:withinmax(2 sec,100)");

            testCaseList.AddTest(testCase);

            testCase = new EventExpressionCase("b=" + EVENT_B_CLASS + "(Id=\"B1\") where timer:withinmax(2001 msec,1)");
            testCase.Add("B1", "b", events.GetEvent("B1"));
            testCaseList.AddTest(testCase);

            testCase = new EventExpressionCase("b=" + EVENT_B_CLASS + "(Id=\"B1\") where timer:withinmax(1999 msec,10)");
            testCaseList.AddTest(testCase);

            var text  = "select * from pattern [b=" + EVENT_B_CLASS + "(Id=\"B3\") where timer:withinmax(10.001,1)]";
            var model = new EPStatementObjectModel();

            model.SelectClause = SelectClause.CreateWildcard();
            model = (EPStatementObjectModel)SerializableObjectCopier.Copy(model);

            var filter  = Expressions.Eq("Id", "B3");
            var pattern = Patterns.TimerWithinMax(10.001, 1, Patterns.Filter(Filter.Create(EVENT_B_CLASS, filter), "b"));

            model.FromClause = FromClause.Create(PatternStream.Create(pattern));
            Assert.AreEqual(text, model.ToEPL());
            testCase = new EventExpressionCase(model);
            testCase.Add("B3", "b", events.GetEvent("B3"));
            testCaseList.AddTest(testCase);

            testCase = new EventExpressionCase("(every b=" + EVENT_B_CLASS + ") where timer:withinmax(4.001, 0)");
            testCaseList.AddTest(testCase);

            testCase = new EventExpressionCase("(every b=" + EVENT_B_CLASS + ") where timer:withinmax(4.001, 1)");
            testCase.Add("B1", "b", events.GetEvent("B1"));
            testCaseList.AddTest(testCase);

            testCase = new EventExpressionCase("(every b=" + EVENT_B_CLASS + ") where timer:withinmax(4.001, 2)");
            testCase.Add("B1", "b", events.GetEvent("B1"));
            testCase.Add("B2", "b", events.GetEvent("B2"));
            testCaseList.AddTest(testCase);

            testCase = new EventExpressionCase("every b=" + EVENT_B_CLASS + " where timer:withinmax(2.001, 4)");
            testCase.Add("B1", "b", events.GetEvent("B1"));
            testCase.Add("B2", "b", events.GetEvent("B2"));
            testCase.Add("B3", "b", events.GetEvent("B3"));
            testCaseList.AddTest(testCase);

            // Note how every restarts the max
            testCase = new EventExpressionCase("every (b=" + EVENT_B_CLASS + " where timer:withinmax(2001 msec, 2))");
            testCase.Add("B1", "b", events.GetEvent("B1"));
            testCase.Add("B2", "b", events.GetEvent("B2"));
            testCase.Add("B3", "b", events.GetEvent("B3"));
            testCaseList.AddTest(testCase);

            testCase = new EventExpressionCase("every (b=" + EVENT_B_CLASS + " where timer:withinmax(2001 msec, 3))");
            testCase.Add("B1", "b", events.GetEvent("B1"));
            testCase.Add("B2", "b", events.GetEvent("B2"));
            testCase.Add("B3", "b", events.GetEvent("B3"));
            testCaseList.AddTest(testCase);

            testCase = new EventExpressionCase("every (b=" + EVENT_B_CLASS + " where timer:withinmax(2001 msec, 1))");
            testCase.Add("B1", "b", events.GetEvent("B1"));
            testCase.Add("B2", "b", events.GetEvent("B2"));
            testCase.Add("B3", "b", events.GetEvent("B3"));
            testCaseList.AddTest(testCase);

            testCase = new EventExpressionCase("every (b=" + EVENT_B_CLASS + " where timer:withinmax(2001 msec, 0))");
            testCaseList.AddTest(testCase);

            testCase = new EventExpressionCase("every b=" + EVENT_B_CLASS + " -> d=" + EVENT_D_CLASS + " where timer:withinmax(4000 msec, 1)");
            testCase.Add("D1", "b", events.GetEvent("B2"), "d", events.GetEvent("D1"));
            testCase.Add("D3", "b", events.GetEvent("B3"), "d", events.GetEvent("D3"));
            testCaseList.AddTest(testCase);

            testCase = new EventExpressionCase("every b=" + EVENT_B_CLASS + "() -> every d=" + EVENT_D_CLASS + " where timer:withinmax(4000 msec, 1)");
            testCase.Add("D1", "b", events.GetEvent("B1"), "d", events.GetEvent("D1"));
            testCase.Add("D1", "b", events.GetEvent("B2"), "d", events.GetEvent("D1"));
            testCase.Add("D2", "b", events.GetEvent("B1"), "d", events.GetEvent("D2"));
            testCase.Add("D2", "b", events.GetEvent("B2"), "d", events.GetEvent("D2"));
            testCase.Add("D3", "b", events.GetEvent("B1"), "d", events.GetEvent("D3"));
            testCase.Add("D3", "b", events.GetEvent("B2"), "d", events.GetEvent("D3"));
            testCase.Add("D3", "b", events.GetEvent("B3"), "d", events.GetEvent("D3"));
            testCaseList.AddTest(testCase);

            testCase = new EventExpressionCase("every b=" + EVENT_B_CLASS + "() -> (every d=" + EVENT_D_CLASS + ") where timer:withinmax(1 day, 3)");
            testCase.Add("D1", "b", events.GetEvent("B1"), "d", events.GetEvent("D1"));
            testCase.Add("D1", "b", events.GetEvent("B2"), "d", events.GetEvent("D1"));
            testCase.Add("D2", "b", events.GetEvent("B1"), "d", events.GetEvent("D2"));
            testCase.Add("D2", "b", events.GetEvent("B2"), "d", events.GetEvent("D2"));
            testCase.Add("D3", "b", events.GetEvent("B1"), "d", events.GetEvent("D3"));
            testCase.Add("D3", "b", events.GetEvent("B2"), "d", events.GetEvent("D3"));
            testCase.Add("D3", "b", events.GetEvent("B3"), "d", events.GetEvent("D3"));
            testCaseList.AddTest(testCase);

            testCase = new EventExpressionCase("every b=" + EVENT_B_CLASS + "() -> (every d=" + EVENT_D_CLASS + ") where timer:withinmax(1 day, 2)");
            testCase.Add("D1", "b", events.GetEvent("B1"), "d", events.GetEvent("D1"));
            testCase.Add("D1", "b", events.GetEvent("B2"), "d", events.GetEvent("D1"));
            testCase.Add("D2", "b", events.GetEvent("B1"), "d", events.GetEvent("D2"));
            testCase.Add("D2", "b", events.GetEvent("B2"), "d", events.GetEvent("D2"));
            testCase.Add("D3", "b", events.GetEvent("B3"), "d", events.GetEvent("D3"));
            testCaseList.AddTest(testCase);

            testCase = new EventExpressionCase("every b=" + EVENT_B_CLASS + "() -> (every d=" + EVENT_D_CLASS + ") where timer:withinmax(1 day, 1)");
            testCase.Add("D1", "b", events.GetEvent("B1"), "d", events.GetEvent("D1"));
            testCase.Add("D1", "b", events.GetEvent("B2"), "d", events.GetEvent("D1"));
            testCase.Add("D3", "b", events.GetEvent("B3"), "d", events.GetEvent("D3"));
            testCaseList.AddTest(testCase);

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

            util.RunTest();
        }
예제 #10
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);
        }
예제 #11
0
            public void Run(RegressionEnvironment env)
            {
                var events                   = EventCollectionFactory.GetEventSetOne(0, 1000);
                var testCaseList             = new CaseList();
                EventExpressionCase testCase = null;

                testCase = new EventExpressionCase("b=SupportBean_B(Id='B1') where timer:within(2 sec)");
                testCaseList.AddTest(testCase);

                testCase = new EventExpressionCase("b=SupportBean_B(Id='B1') where timer:within(2001 msec)");
                testCase.Add("B1", "b", events.GetEvent("B1"));
                testCaseList.AddTest(testCase);

                testCase = new EventExpressionCase("b=SupportBean_B(Id='B1') where timer:within(1999 msec)");
                testCaseList.AddTest(testCase);

                var text  = "select * from pattern [b=SupportBean_B(Id=\"B3\") where timer:within(10.001d)]";
                var model = new EPStatementObjectModel();

                model.SetSelect(SelectClause.CreateWildcard());
                model = env.CopyMayFail(model);
                Expression  filter  = Expressions.Eq("Id", "B3");
                PatternExpr pattern = Patterns.TimerWithin(
                    10.001,
                    Patterns.Filter(Filter.Create("SupportBean_B", filter), "b"));

                model.SetFrom(FromClause.Create(PatternStream.Create(pattern)));
                Assert.AreEqual(text, model.ToEPL());
                testCase = new EventExpressionCase(model);
                testCase.Add("B3", "b", events.GetEvent("B3"));
                testCaseList.AddTest(testCase);

                testCase = new EventExpressionCase("b=SupportBean_B(Id='B3') where timer:within(10001 msec)");
                testCase.Add("B3", "b", events.GetEvent("B3"));
                testCaseList.AddTest(testCase);

                testCase = new EventExpressionCase("b=SupportBean_B(Id='B3') where timer:within(10 sec)");
                testCaseList.AddTest(testCase);

                testCase = new EventExpressionCase("b=SupportBean_B(Id='B3') where timer:within(9.999)");
                testCaseList.AddTest(testCase);

                testCase = new EventExpressionCase("(every b=SupportBean_B) where timer:within(2.001)");
                testCase.Add("B1", "b", events.GetEvent("B1"));
                testCaseList.AddTest(testCase);

                testCase = new EventExpressionCase("(every b=SupportBean_B) where timer:within(4.001)");
                testCase.Add("B1", "b", events.GetEvent("B1"));
                testCase.Add("B2", "b", events.GetEvent("B2"));
                testCaseList.AddTest(testCase);

                testCase = new EventExpressionCase("every b=SupportBean_B where timer:within(2.001)");
                testCase.Add("B1", "b", events.GetEvent("B1"));
                testCase.Add("B2", "b", events.GetEvent("B2"));
                testCase.Add("B3", "b", events.GetEvent("B3"));
                testCaseList.AddTest(testCase);

                testCase = new EventExpressionCase("every (b=SupportBean_B where timer:within(2001 msec))");
                testCase.Add("B1", "b", events.GetEvent("B1"));
                testCase.Add("B2", "b", events.GetEvent("B2"));
                testCase.Add("B3", "b", events.GetEvent("B3"));
                testCaseList.AddTest(testCase);

                testCase = new EventExpressionCase("every ((every b=SupportBean_B) where timer:within(2.001))");
                testCase.Add("B1", "b", events.GetEvent("B1"));
                testCase.Add("B2", "b", events.GetEvent("B2"));
                testCase.Add("B2", "b", events.GetEvent("B2"));
                testCase.Add("B3", "b", events.GetEvent("B3"));
                testCase.Add("B3", "b", events.GetEvent("B3"));
                testCase.Add("B3", "b", events.GetEvent("B3"));
                testCase.Add("B3", "b", events.GetEvent("B3"));
                testCaseList.AddTest(testCase);

                testCase = new EventExpressionCase("every ((every b=SupportBean_B) where timer:within(6.001))");
                testCase.Add("B1", "b", events.GetEvent("B1"));
                testCase.Add("B2", "b", events.GetEvent("B2"));
                testCase.Add("B2", "b", events.GetEvent("B2"));
                testCase.Add("B3", "b", events.GetEvent("B3"));
                testCase.Add("B3", "b", events.GetEvent("B3"));
                testCase.Add("B3", "b", events.GetEvent("B3"));
                testCase.Add("B3", "b", events.GetEvent("B3"));
                testCaseList.AddTest(testCase);

                testCase = new EventExpressionCase("(every b=SupportBean_B) where timer:within(11.001)");
                testCase.Add("B1", "b", events.GetEvent("B1"));
                testCase.Add("B2", "b", events.GetEvent("B2"));
                testCase.Add("B3", "b", events.GetEvent("B3"));
                testCaseList.AddTest(testCase);

                testCase = new EventExpressionCase("(every b=SupportBean_B) where timer:within(4001 milliseconds)");
                testCase.Add("B1", "b", events.GetEvent("B1"));
                testCase.Add("B2", "b", events.GetEvent("B2"));
                testCaseList.AddTest(testCase);

                testCase = new EventExpressionCase("every (b=SupportBean_B) where timer:within(6.001)");
                testCase.Add("B1", "b", events.GetEvent("B1"));
                testCase.Add("B2", "b", events.GetEvent("B2"));
                testCase.Add("B3", "b", events.GetEvent("B3"));
                testCaseList.AddTest(testCase);

                testCase = new EventExpressionCase(
                    "b=SupportBean_B -> d=SupportBean_D where timer:within(4001 milliseconds)");
                testCase.Add("D1", "b", events.GetEvent("B1"), "d", events.GetEvent("D1"));
                testCaseList.AddTest(testCase);

                testCase = new EventExpressionCase("b=SupportBean_B() -> d=SupportBean_D() where timer:within(4 sec)");
                testCaseList.AddTest(testCase);

                testCase = new EventExpressionCase(
                    "every (b=SupportBean_B() where timer:within (4.001) and d=SupportBean_D() where timer:within(6.001))");
                testCase.Add("D1", "b", events.GetEvent("B1"), "d", events.GetEvent("D1"));
                testCase.Add("B3", "b", events.GetEvent("B3"), "d", events.GetEvent("D2"));
                testCaseList.AddTest(testCase);

                testCase = new EventExpressionCase(
                    "b=SupportBean_B() where timer:within (2001 msec) and d=SupportBean_D() where timer:within(6001 msec)");
                testCase.Add("D1", "b", events.GetEvent("B1"), "d", events.GetEvent("D1"));
                testCaseList.AddTest(testCase);

                testCase = new EventExpressionCase(
                    "b=SupportBean_B() where timer:within (2001 msec) and d=SupportBean_D() where timer:within(6000 msec)");
                testCaseList.AddTest(testCase);

                testCase = new EventExpressionCase(
                    "b=SupportBean_B() where timer:within (2000 msec) and d=SupportBean_D() where timer:within(6001 msec)");
                testCaseList.AddTest(testCase);

                testCase = new EventExpressionCase(
                    "every b=SupportBean_B -> d=SupportBean_D where timer:within(4000 msec)");
                testCase.Add("D1", "b", events.GetEvent("B2"), "d", events.GetEvent("D1"));
                testCase.Add("D3", "b", events.GetEvent("B3"), "d", events.GetEvent("D3"));
                testCaseList.AddTest(testCase);

                testCase = new EventExpressionCase(
                    "every b=SupportBean_B() -> every d=SupportBean_D where timer:within(4000 msec)");
                testCase.Add("D1", "b", events.GetEvent("B1"), "d", events.GetEvent("D1"));
                testCase.Add("D1", "b", events.GetEvent("B2"), "d", events.GetEvent("D1"));
                testCase.Add("D2", "b", events.GetEvent("B1"), "d", events.GetEvent("D2"));
                testCase.Add("D2", "b", events.GetEvent("B2"), "d", events.GetEvent("D2"));
                testCase.Add("D3", "b", events.GetEvent("B1"), "d", events.GetEvent("D3"));
                testCase.Add("D3", "b", events.GetEvent("B2"), "d", events.GetEvent("D3"));
                testCase.Add("D3", "b", events.GetEvent("B3"), "d", events.GetEvent("D3"));
                testCaseList.AddTest(testCase);

                testCase = new EventExpressionCase(
                    "b=SupportBean_B() -> d=SupportBean_D() where timer:within(3999 msec)");
                testCaseList.AddTest(testCase);

                testCase = new EventExpressionCase(
                    "every b=SupportBean_B() -> (every d=SupportBean_D) where timer:within(2001 msec)");
                testCase.Add("D1", "b", events.GetEvent("B2"), "d", events.GetEvent("D1"));
                testCase.Add("D3", "b", events.GetEvent("B3"), "d", events.GetEvent("D3"));
                testCaseList.AddTest(testCase);

                testCase = new EventExpressionCase(
                    "every (b=SupportBean_B() -> d=SupportBean_D()) where timer:within(6001 msec)");
                testCase.Add("D1", "b", events.GetEvent("B1"), "d", events.GetEvent("D1"));
                testCase.Add("D3", "b", events.GetEvent("B3"), "d", events.GetEvent("D3"));
                testCaseList.AddTest(testCase);

                testCase = new EventExpressionCase(
                    "b=SupportBean_B() where timer:within (2000 msec) or d=SupportBean_D() where timer:within(6000 msec)");
                testCaseList.AddTest(testCase);

                testCase = new EventExpressionCase(
                    "(b=SupportBean_B() where timer:within (2000 msec) or d=SupportBean_D() where timer:within(6000 msec)) where timer:within (1999 msec)");
                testCaseList.AddTest(testCase);

                testCase = new EventExpressionCase(
                    "every (b=SupportBean_B() where timer:within (2001 msec) and d=SupportBean_D() where timer:within(6001 msec))");
                testCase.Add("D1", "b", events.GetEvent("B1"), "d", events.GetEvent("D1"));
                testCase.Add("B3", "b", events.GetEvent("B3"), "d", events.GetEvent("D2"));
                testCaseList.AddTest(testCase);

                testCase = new EventExpressionCase(
                    "b=SupportBean_B() where timer:within (2001 msec) or d=SupportBean_D() where timer:within(6001 msec)");
                testCase.Add("B1", "b", events.GetEvent("B1"));
                testCaseList.AddTest(testCase);

                testCase = new EventExpressionCase(
                    "b=SupportBean_B() where timer:within (2000 msec) or d=SupportBean_D() where timer:within(6001 msec)");
                testCase.Add("D1", "d", events.GetEvent("D1"));
                testCaseList.AddTest(testCase);

                testCase = new EventExpressionCase(
                    "every b=SupportBean_B() where timer:within (2001 msec) and every d=SupportBean_D() where timer:within(6001 msec)");
                testCase.Add("D1", "b", events.GetEvent("B1"), "d", events.GetEvent("D1"));
                testCase.Add("D1", "b", events.GetEvent("B2"), "d", events.GetEvent("D1"));
                testCase.Add("D2", "b", events.GetEvent("B1"), "d", events.GetEvent("D2"));
                testCase.Add("D2", "b", events.GetEvent("B2"), "d", events.GetEvent("D2"));
                testCase.Add("B3", "b", events.GetEvent("B3"), "d", events.GetEvent("D1"));
                testCase.Add("B3", "b", events.GetEvent("B3"), "d", events.GetEvent("D2"));
                testCase.Add("D3", "b", events.GetEvent("B1"), "d", events.GetEvent("D3"));
                testCase.Add("D3", "b", events.GetEvent("B2"), "d", events.GetEvent("D3"));
                testCase.Add("D3", "b", events.GetEvent("B3"), "d", events.GetEvent("D3"));
                testCaseList.AddTest(testCase);

                testCase = new EventExpressionCase(
                    "(every b=SupportBean_B) where timer:within (2000 msec) and every d=SupportBean_D() where timer:within(6001 msec)");
                testCaseList.AddTest(testCase);

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

                util.RunTest(env);
            }
예제 #12
0
            public void Run(RegressionEnvironment env)
            {
                var events = EventCollectionFactory.GetEventSetOne(0, 1000);
                var testCaseList = new CaseList();
                EventExpressionCase testCase;

                testCase = new EventExpressionCase("b=SupportBean_B and d=SupportBean_D");
                testCase.Add("D1", "b", events.GetEvent("B1"), "d", events.GetEvent("D1"));
                testCaseList.AddTest(testCase);

                testCase = new EventExpressionCase("b=SupportBean_B and every d=SupportBean_D");
                testCase.Add("D1", "b", events.GetEvent("B1"), "d", events.GetEvent("D1"));
                testCase.Add("D2", "b", events.GetEvent("B1"), "d", events.GetEvent("D2"));
                testCase.Add("D3", "b", events.GetEvent("B1"), "d", events.GetEvent("D3"));
                testCaseList.AddTest(testCase);

                testCase = new EventExpressionCase("every b=SupportBean_B and d=SupportBean_D");
                testCase.Add("D1", "b", events.GetEvent("B1"), "d", events.GetEvent("D1"));
                testCase.Add("D1", "b", events.GetEvent("B2"), "d", events.GetEvent("D1"));
                testCase.Add("B3", "b", events.GetEvent("B3"), "d", events.GetEvent("D1"));
                testCaseList.AddTest(testCase);

                testCase = new EventExpressionCase("every(b=SupportBean_B and d=SupportBean_D" + ")");
                testCase.Add("D1", "b", events.GetEvent("B1"), "d", events.GetEvent("D1"));
                testCase.Add("B3", "b", events.GetEvent("B3"), "d", events.GetEvent("D2"));
                testCaseList.AddTest(testCase);

                var model = new EPStatementObjectModel();
                model.SelectClause = SelectClause.CreateWildcard();
                PatternExpr pattern = Patterns.Every(
                    Patterns.And(Patterns.Filter("SupportBean_B", "b"), Patterns.Filter("SupportBean_D", "d")));
                model.FromClause = FromClause.Create(PatternStream.Create(pattern));
                model = env.CopyMayFail(model);
                Assert.AreEqual(
                    "select * from pattern [every (b=SupportBean_B and d=SupportBean_D" + ")]",
                    model.ToEPL());
                testCase = new EventExpressionCase(model);
                testCase.Add("D1", "b", events.GetEvent("B1"), "d", events.GetEvent("D1"));
                testCase.Add("B3", "b", events.GetEvent("B3"), "d", events.GetEvent("D2"));
                testCaseList.AddTest(testCase);

                testCase = new EventExpressionCase("every( b=SupportBean_B and every d=SupportBean_D" + ")");
                testCase.Add("D1", "b", events.GetEvent("B1"), "d", events.GetEvent("D1"));
                testCase.Add("D2", "b", events.GetEvent("B1"), "d", events.GetEvent("D2"));
                testCase.Add("B3", "b", events.GetEvent("B3"), "d", events.GetEvent("D2"));
                testCase.Add("D3", "b", events.GetEvent("B1"), "d", events.GetEvent("D3"));
                testCase.Add("D3", "b", events.GetEvent("B3"), "d", events.GetEvent("D3"));
                testCase.Add("D3", "b", events.GetEvent("B3"), "d", events.GetEvent("D3"));
                testCaseList.AddTest(testCase);

                testCase = new EventExpressionCase("every b=SupportBean_B and every d=SupportBean_D");
                testCase.Add("D1", "b", events.GetEvent("B1"), "d", events.GetEvent("D1"));
                testCase.Add("D1", "b", events.GetEvent("B2"), "d", events.GetEvent("D1"));
                testCase.Add("D2", "b", events.GetEvent("B1"), "d", events.GetEvent("D2"));
                testCase.Add("D2", "b", events.GetEvent("B2"), "d", events.GetEvent("D2"));
                testCase.Add("B3", "b", events.GetEvent("B3"), "d", events.GetEvent("D1"));
                testCase.Add("B3", "b", events.GetEvent("B3"), "d", events.GetEvent("D2"));
                testCase.Add("D3", "b", events.GetEvent("B1"), "d", events.GetEvent("D3"));
                testCase.Add("D3", "b", events.GetEvent("B2"), "d", events.GetEvent("D3"));
                testCase.Add("D3", "b", events.GetEvent("B3"), "d", events.GetEvent("D3"));
                testCaseList.AddTest(testCase);

                testCase = new EventExpressionCase("every( every b=SupportBean_B and d=SupportBean_D" + ")");
                testCase.Add("D1", "b", events.GetEvent("B1"), "d", events.GetEvent("D1"));
                testCase.Add("D1", "b", events.GetEvent("B2"), "d", events.GetEvent("D1"));
                testCase.Add("B3", "b", events.GetEvent("B3"), "d", events.GetEvent("D1"));
                testCase.Add("B3", "b", events.GetEvent("B3"), "d", events.GetEvent("D2"));
                testCase.Add("B3", "b", events.GetEvent("B3"), "d", events.GetEvent("D2"));
                testCaseList.AddTest(testCase);

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

                testCase = new EventExpressionCase("every( every b=SupportBean_B and every d=SupportBean_D" + ")");
                testCase.Add("D1", "b", events.GetEvent("B1"), "d", events.GetEvent("D1"));
                testCase.Add("D1", "b", events.GetEvent("B2"), "d", events.GetEvent("D1"));
                testCase.Add("D2", "b", events.GetEvent("B1"), "d", events.GetEvent("D2"));
                testCase.Add("D2", "b", events.GetEvent("B2"), "d", events.GetEvent("D2"));
                testCase.Add("B3", "b", events.GetEvent("B3"), "d", events.GetEvent("D1"));
                for (var i = 0; i < 3; i++) {
                    testCase.Add("B3", "b", events.GetEvent("B3"), "d", events.GetEvent("D2"));
                }

                testCase.Add("D3", "b", events.GetEvent("B1"), "d", events.GetEvent("D3"));
                testCase.Add("D3", "b", events.GetEvent("B2"), "d", events.GetEvent("D3"));
                for (var i = 0; i < 5; i++) {
                    testCase.Add("D3", "b", events.GetEvent("B3"), "d", events.GetEvent("D3"));
                }

                testCaseList.AddTest(testCase);

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

                testCase = new EventExpressionCase(
                    "every a=SupportBean_A and every d=SupportBean_D" + " and b=SupportBean_B");
                testCase.Add("D1", "b", events.GetEvent("B1"), "d", events.GetEvent("D1"), "a", events.GetEvent("A1"));
                testCase.Add("D1", "b", events.GetEvent("B1"), "d", events.GetEvent("D1"), "a", events.GetEvent("A2"));
                testCase.Add("D2", "b", events.GetEvent("B1"), "d", events.GetEvent("D2"), "a", events.GetEvent("A1"));
                testCase.Add("D2", "b", events.GetEvent("B1"), "d", events.GetEvent("D2"), "a", events.GetEvent("A2"));
                testCase.Add("D3", "b", events.GetEvent("B1"), "d", events.GetEvent("D3"), "a", events.GetEvent("A1"));
                testCase.Add("D3", "b", events.GetEvent("B1"), "d", events.GetEvent("D3"), "a", events.GetEvent("A2"));
                testCaseList.AddTest(testCase);

                testCase = new EventExpressionCase("b=SupportBean_B and b=SupportBean_B");
                testCase.Add("B1", "b", events.GetEvent("B1"), "b", events.GetEvent("B1"));
                testCaseList.AddTest(testCase);

                testCase = new EventExpressionCase(
                    "every a=SupportBean_A and every d=SupportBean_D" + " and every b=SupportBean_B");
                testCase.Add("D1", "b", events.GetEvent("B1"), "d", events.GetEvent("D1"), "a", events.GetEvent("A1"));
                testCase.Add("D1", "b", events.GetEvent("B1"), "d", events.GetEvent("D1"), "a", events.GetEvent("A2"));
                testCase.Add("D1", "b", events.GetEvent("B2"), "d", events.GetEvent("D1"), "a", events.GetEvent("A1"));
                testCase.Add("D1", "b", events.GetEvent("B2"), "d", events.GetEvent("D1"), "a", events.GetEvent("A2"));
                testCase.Add("D2", "b", events.GetEvent("B1"), "d", events.GetEvent("D2"), "a", events.GetEvent("A1"));
                testCase.Add("D2", "b", events.GetEvent("B1"), "d", events.GetEvent("D2"), "a", events.GetEvent("A2"));
                testCase.Add("D2", "b", events.GetEvent("B2"), "d", events.GetEvent("D2"), "a", events.GetEvent("A1"));
                testCase.Add("D2", "b", events.GetEvent("B2"), "d", events.GetEvent("D2"), "a", events.GetEvent("A2"));
                testCase.Add("B3", "b", events.GetEvent("B3"), "d", events.GetEvent("D1"), "a", events.GetEvent("A1"));
                testCase.Add("B3", "b", events.GetEvent("B3"), "d", events.GetEvent("D1"), "a", events.GetEvent("A2"));
                testCase.Add("B3", "b", events.GetEvent("B3"), "d", events.GetEvent("D2"), "a", events.GetEvent("A1"));
                testCase.Add("B3", "b", events.GetEvent("B3"), "d", events.GetEvent("D2"), "a", events.GetEvent("A2"));
                testCase.Add("D3", "b", events.GetEvent("B1"), "d", events.GetEvent("D3"), "a", events.GetEvent("A1"));
                testCase.Add("D3", "b", events.GetEvent("B1"), "d", events.GetEvent("D3"), "a", events.GetEvent("A2"));
                testCase.Add("D3", "b", events.GetEvent("B2"), "d", events.GetEvent("D3"), "a", events.GetEvent("A1"));
                testCase.Add("D3", "b", events.GetEvent("B2"), "d", events.GetEvent("D3"), "a", events.GetEvent("A2"));
                testCase.Add("D3", "b", events.GetEvent("B3"), "d", events.GetEvent("D3"), "a", events.GetEvent("A1"));
                testCase.Add("D3", "b", events.GetEvent("B3"), "d", events.GetEvent("D3"), "a", events.GetEvent("A2"));
                testCaseList.AddTest(testCase);

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

                testCase = new EventExpressionCase("every (b=SupportBean_B and b=SupportBean_B)");
                testCase.Add("B1", "b", events.GetEvent("B1"), "b", events.GetEvent("B1"));
                testCase.Add("B2", "b", events.GetEvent("B2"), "b", events.GetEvent("B2"));
                testCase.Add("B3", "b", events.GetEvent("B3"), "b", events.GetEvent("B3"));
                testCaseList.AddTest(testCase);

                var util = new PatternTestHarness(events, testCaseList, GetType());
                util.RunTest(env);
            }
예제 #13
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);
        }