public void Run(RegressionEnvironment env)
            {
                SendTimer(env, 0);

                var epl = "@Name('s0') select irstream max(Price) as maxVol" +
                          " from SupportMarketDataBean#sort(1,Volume desc) as S0, " +
                          "SupportBean#keepall as S1 where S1.TheString=S0.Symbol " +
                          "output every 1.0d seconds";
                env.CompileDeploy(epl).AddListener("s0");

                env.SendEventBean(new SupportBean("JOIN_KEY", -1));

                SendEvent(env, "JOIN_KEY", 1d);
                SendEvent(env, "JOIN_KEY", 2d);
                env.Listener("s0").Reset();

                // moves all events out of the window,
                SendTimer(env, 1000); // newdata is 2 eventa, old data is the same 2 events, therefore the sum is null
                var result = env.Listener("s0").DataListsFlattened;
                Assert.AreEqual(2, result.First.Length);
                Assert.AreEqual(1.0, result.First[0].Get("maxVol"));
                Assert.AreEqual(2.0, result.First[1].Get("maxVol"));
                Assert.AreEqual(2, result.Second.Length);
                Assert.AreEqual(null, result.Second[0].Get("maxVol"));
                Assert.AreEqual(1.0, result.Second[1].Get("maxVol"));

                // statement object model test
                var model = env.EplToModel(epl);
                env.CopyMayFail(model);
                Assert.AreEqual(epl, model.ToEPL());

                env.UndeployAll();
            }
Beispiel #2
0
            public void Run(RegressionEnvironment env)
            {
                var subquery = new EPStatementObjectModel();
                subquery.SelectClause = SelectClause.CreateWildcard();
                subquery.FromClause = FromClause.Create(
                    FilterStream.Create("SupportBean_S1").AddView("length", Expressions.Constant(1000)));

                var model = new EPStatementObjectModel();
                model.SelectClause = SelectClause.Create("Id");
                model.FromClause = FromClause.Create(FilterStream.Create("SupportBean_S0"));
                model.WhereClause = Expressions.Not(Expressions.SubqueryExists(subquery));
                model = env.CopyMayFail(model);

                var stmtText =
                    "select Id from SupportBean_S0 where not exists (select * from SupportBean_S1#length(1000))";
                Assert.AreEqual(stmtText, model.ToEPL());

                model.Annotations = Collections.SingletonList(AnnotationPart.NameAnnotation("s0"));
                env.CompileDeploy(model).AddListener("s0");

                env.SendEventBean(new SupportBean_S0(2));
                Assert.AreEqual(2, env.Listener("s0").AssertOneGetNewAndReset().Get("Id"));

                env.SendEventBean(new SupportBean_S1(-1));
                env.SendEventBean(new SupportBean_S0(1));
                Assert.IsFalse(env.Listener("s0").IsInvoked);

                env.SendEventBean(new SupportBean_S1(-2));
                env.SendEventBean(new SupportBean_S0(3));
                Assert.IsFalse(env.Listener("s0").IsInvoked);

                env.UndeployAll();
            }
Beispiel #3
0
            public void Run(RegressionEnvironment env)
            {
                var model = new EPStatementObjectModel();
                model.SelectClause = SelectClause.Create("Symbol", "Volume").Add(Expressions.Sum("Price"), "mySum");
                model.FromClause = FromClause.Create(
                    FilterStream.Create(typeof(SupportMarketDataBean).Name)
                        .AddView(View.Create("length", Expressions.Constant(20))));
                model.GroupByClause = GroupByClause.Create("Symbol");
                model.OutputLimitClause = OutputLimitClause.Create(6);
                model.OrderByClause = OrderByClause.Create(Expressions.Sum("Price")).Add("Symbol", false);
                model = env.CopyMayFail(model);

                var epl = "select Symbol, Volume, sum(Price) as mySum from " +
                          "SupportMarketDataBean#length(20) " +
                          "group by Symbol " +
                          "output every 6 events " +
                          "order by sum(Price), Symbol";
                Assert.AreEqual(epl, model.ToEPL());

                model.Annotations = Collections.SingletonList(AnnotationPart.NameAnnotation("s0"));
                env.CompileDeploy(model).AddListener("s0");

                TryAssertionDefault(env);

                env.UndeployAll();
            }
        private static void TryString(
            RegressionEnvironment env,
            EPStatementObjectModel model,
            string epl,
            string[] input,
            bool?[] result)
        {
            var compiled = env.Compile(model, new CompilerArguments(env.Configuration));
            Assert.AreEqual(epl, model.ToEPL());

            var objectmodel = env.EplToModel(epl);
            objectmodel = env.CopyMayFail(objectmodel);
            Assert.AreEqual(epl, objectmodel.ToEPL());

            env.Deploy(compiled).AddListener("s0");

            Assert.AreEqual(typeof(bool?), env.Statement("s0").EventType.GetPropertyType("result"));

            for (var i = 0; i < input.Length; i++) {
                SendSupportBeanEvent(env, input[i]);
                var theEvent = env.Listener("s0").AssertOneGetNewAndReset();
                Assert.AreEqual(result[i], theEvent.Get("result"), "Wrong result for " + input[i]);
            }

            env.UndeployAll();
        }
            public void Run(RegressionEnvironment env)
            {
                var caseExpr = "@Name('s0') select TheString in (\"a\",\"b\",\"c\") as result from " +
                               typeof(SupportBean).Name;
                var model = new EPStatementObjectModel();
                model.Annotations = Collections.SingletonList(AnnotationPart.NameAnnotation("s0"));
                model.SelectClause = SelectClause.Create().Add(Expressions.In("TheString", "a", "b", "c"), "result");
                model.FromClause = FromClause.Create(FilterStream.Create(typeof(SupportBean).Name));

                TryString(
                    env,
                    model,
                    caseExpr,
                    new[] {"0", "a", "b", "c", "d", null},
                    new bool?[] {false, true, true, true, false, null});

                model = new EPStatementObjectModel();
                model.Annotations = Collections.SingletonList(AnnotationPart.NameAnnotation("s0"));
                model.SelectClause = SelectClause.Create().Add(Expressions.NotIn("TheString", "a", "b", "c"), "result");
                model.FromClause = FromClause.Create(FilterStream.Create(typeof(SupportBean).Name));
                env.CopyMayFail(model);

                TryString(
                    env,
                    "TheString not in ('a', 'b', 'c')",
                    new[] {"0", "a", "b", "c", "d", null},
                    new bool?[] {true, false, false, false, true, null});
            }
Beispiel #6
0
            public void Run(RegressionEnvironment env)
            {
                var stmtText = "@Name('s0') select S0.Id as idS0, S1.Id as idS1 " +
                               "from pattern [every S0=SupportBean_S0" +
                               " or every S1=SupportBean_S1] " +
                               "where S0.Id is not null and S0.Id<100 or S1.Id is not null and S1.Id>=100";
                var model = env.EplToModel(stmtText);
                model = env.CopyMayFail(model);

                var reverse = model.ToEPL();
                Assert.AreEqual(stmtText, reverse);

                model.Annotations = Collections.SingletonList(AnnotationPart.NameAnnotation("s0"));
                env.CompileDeploy(model).AddListener("s0");

                SendEventS0(env, 1);
                AssertEventIds(env, 1, null);

                SendEventS0(env, 101);
                Assert.IsFalse(env.Listener("s0").IsInvoked);

                SendEventS1(env, 1);
                Assert.IsFalse(env.Listener("s0").IsInvoked);

                SendEventS1(env, 100);
                AssertEventIds(env, null, 100);

                env.UndeployAll();
            }
Beispiel #7
0
            public void Run(RegressionEnvironment env)
            {
                var model = new EPStatementObjectModel();
                model.SelectClause = SelectClause.CreateWildcard()
                    .Add(Expressions.Concat("MyString", "MyString"), "concat");
                model.FromClause =
                    FromClause.Create(
                        FilterStream.Create("SupportBeanSimple")
                            .AddView(View.Create("length", Expressions.Constant(5))));
                model = env.CopyMayFail(model);

                var text = "select *, MyString||MyString as concat from SupportBeanSimple#length(5)";
                Assert.AreEqual(text, model.ToEPL());
                model.Annotations = Collections.SingletonList(AnnotationPart.NameAnnotation("s0"));
                env.CompileDeploy(model).AddListener("s0");

                AssertSimple(env);

                CollectionAssert.AreEquivalent(
                    new EventPropertyDescriptor[] {
                        new EventPropertyDescriptor("MyString", typeof(string), typeof(char), false, false, true, false, false),
                        new EventPropertyDescriptor("MyInt", typeof(int), null, false, false, false, false, false),
                        new EventPropertyDescriptor("concat", typeof(string), typeof(char), false, false, true, false, false)
                    },
                    env.Statement("s0").EventType.PropertyDescriptors);

                env.UndeployAll();
            }
Beispiel #8
0
            public void Run(RegressionEnvironment env)
            {
                var model = new EPStatementObjectModel();
                model.SelectClause = SelectClause.CreateWildcard();
                var fromClause = FromClause.Create(
                    FilterStream.Create("SupportBean_A", "streamA")
                        .AddView(View.Create("length", Expressions.Constant(3))),
                    FilterStream.Create("SupportBean_B", "streamB")
                        .AddView(View.Create("length", Expressions.Constant(3))),
                    FilterStream.Create("SupportBean_C", "streamC")
                        .AddView(View.Create("length", Expressions.Constant(3))));
                model.FromClause = fromClause;
                model.WhereClause = Expressions.And(
                    Expressions.EqProperty("streamA.Id", "streamB.Id"),
                    Expressions.EqProperty("streamB.Id", "streamC.Id"),
                    Expressions.EqProperty("streamA.Id", "streamC.Id"));
                model = env.CopyMayFail(model);

                var epl = "select * from " +
                          "SupportBean_A#length(3) as streamA, " +
                          "SupportBean_B#length(3) as streamB, " +
                          "SupportBean_C#length(3) as streamC " +
                          "where streamA.Id=streamB.Id " +
                          "and streamB.Id=streamC.Id " +
                          "and streamA.Id=streamC.Id";
                Assert.AreEqual(epl, model.ToEPL());

                model.Annotations = Collections.SingletonList(AnnotationPart.NameAnnotation("s0"));
                env.CompileDeploy(model).AddListener("s0").Milestone(0);

                RunJoinUniquePerId(env);

                env.UndeployAll();
            }
            public void Run(RegressionEnvironment env)
            {
                var stmtText = "select rstream * from SupportBean#length(3)";
                var model = new EPStatementObjectModel();
                model.SelectClause = SelectClause.CreateWildcard(StreamSelector.RSTREAM_ONLY);
                var fromClause = FromClause.Create(
                    FilterStream.Create("SupportBean").AddView(View.Create("length", Expressions.Constant(3))));
                model.FromClause = fromClause;
                model = env.CopyMayFail(model);

                Assert.AreEqual(stmtText, model.ToEPL());
                model.Annotations = Collections.SingletonList(AnnotationPart.NameAnnotation("s0"));
                env.CompileDeploy(model).AddListener("s0");

                var theEvent = SendEvent(env, "a", 2);
                Assert.IsFalse(env.Listener("s0").IsInvoked);

                SendEvents(env, new[] {"a", "b"});
                Assert.IsFalse(env.Listener("s0").IsInvoked);

                SendEvent(env, "d", 2);
                Assert.AreSame(theEvent, env.Listener("s0").LastNewData[0].Underlying); // receive 'a' as new data
                Assert.IsNull(env.Listener("s0").LastOldData); // receive no more old data

                env.UndeployAll();
            }
Beispiel #10
0
            public void Run(RegressionEnvironment env)
            {
                var model = new EPStatementObjectModel();
                model.SelectClause = SelectClause.Create("Symbol")
                    .Add(Expressions.Median("Price"), "myMedian")
                    .Add(Expressions.MedianDistinct("Price"), "myDistMedian")
                    .Add(Expressions.Stddev("Price"), "myStdev")
                    .Add(Expressions.Avedev("Price"), "myAvedev")
                    .SetStreamSelector(StreamSelector.RSTREAM_ISTREAM_BOTH);

                var fromClause = FromClause.Create(
                    FilterStream
                        .Create(typeof(SupportBeanString).Name, "one")
                        .AddView(View.Create("length", Expressions.Constant(100))),
                    FilterStream
                        .Create(typeof(SupportMarketDataBean).Name, "two")
                        .AddView(View.Create("length", Expressions.Constant(5))));
                model.FromClause = fromClause;
                model.WhereClause = Expressions.And()
                    .Add(
                        Expressions.Or()
                            .Add(Expressions.Eq("Symbol", "DELL"))
                            .Add(Expressions.Eq("Symbol", "IBM"))
                            .Add(Expressions.Eq("Symbol", "GE"))
                    )
                    .Add(Expressions.EqProperty("one.TheString", "two.Symbol"));
                model.GroupByClause = GroupByClause.Create("Symbol");
                model = env.CopyMayFail(model);

                var epl = "select irstream Symbol, " +
                          "median(Price) as myMedian, " +
                          "median(distinct Price) as myDistMedian, " +
                          "stddev(Price) as myStdev, " +
                          "avedev(Price) as myAvedev " +
                          "from SupportBeanString#length(100) as one, " +
                          "SupportMarketDataBean#length(5) as two " +
                          "where (Symbol=\"DELL\" or Symbol=\"IBM\" or Symbol=\"GE\") " +
                          "and one.TheString=two.Symbol " +
                          "group by Symbol";
                Assert.AreEqual(epl, model.ToEPL());

                model.Annotations = Collections.SingletonList(AnnotationPart.NameAnnotation("s0"));
                env.CompileDeploy(model).AddListener("s0");

                env.SendEventBean(new SupportBeanString(SYMBOL_DELL));
                env.SendEventBean(new SupportBeanString(SYMBOL_IBM));
                env.SendEventBean(new SupportBeanString("AAA"));

                TryAssertionStmt(env, new AtomicLong());

                env.UndeployAll();
            }
Beispiel #11
0
            public void Run(RegressionEnvironment env)
            {
                var model = new EPStatementObjectModel();
                model.SelectClause = SelectClause.Create()
                    .AddWithAsProvidedName("S0.Id", "idS0")
                    .AddWithAsProvidedName("S1.Id", "idS1");
                PatternExpr pattern = Patterns.Or()
                    .Add(Patterns.EveryFilter("SupportBean_S0", "S0"))
                    .Add(
                        Patterns.EveryFilter("SupportBean_S1", "S1")
                    );
                model.FromClause = FromClause.Create(PatternStream.Create(pattern));
                model.WhereClause = Expressions.Or()
                    .Add(
                        Expressions.And()
                            .Add(Expressions.IsNotNull("S0.Id"))
                            .Add(Expressions.Lt("S0.Id", 100))
                    )
                    .Add(
                        Expressions.And()
                            .Add(Expressions.IsNotNull("S1.Id"))
                            .Add(Expressions.Ge("S1.Id", 100))
                    );
                model = env.CopyMayFail(model);

                var reverse = model.ToEPL();
                var stmtText = "select S0.Id as idS0, S1.Id as idS1 " +
                               "from pattern [every S0=SupportBean_S0" +
                               " or every S1=SupportBean_S1] " +
                               "where S0.Id is not null and S0.Id<100 or S1.Id is not null and S1.Id>=100";
                Assert.AreEqual(stmtText, reverse);

                model.Annotations = Collections.SingletonList(AnnotationPart.NameAnnotation("s0"));
                env.CompileDeploy(model).AddListener("s0");

                SendEventS0(env, 1);
                AssertEventIds(env, 1, null);

                SendEventS0(env, 101);
                Assert.IsFalse(env.Listener("s0").IsInvoked);

                SendEventS1(env, 1);
                Assert.IsFalse(env.Listener("s0").IsInvoked);

                SendEventS1(env, 100);
                AssertEventIds(env, null, 100);

                env.UndeployAll();
            }
Beispiel #12
0
            public void Run(RegressionEnvironment env)
            {
                var stmtText = "@Name('s0') select " +
                               ALL_FIELDS +
                               " from " +
                               " sql:MyDBWithRetain ['select " +
                               ALL_FIELDS +
                               " from mytesttable where ${IntPrimitive} = mytesttable.myBigint'] as S0," +
                               "SupportBean#time_batch(10 sec) as S1";

                var model = env.EplToModel(stmtText);
                env.CopyMayFail(model);
                env.CompileDeploy(model).AddListener("s0");
                RuntestTimeBatch(env);
            }
Beispiel #13
0
 public void Run(RegressionEnvironment env)
 {
     var model = new EPStatementObjectModel();
     model.SelectClause = SelectClause.Create(new[] {"S0.Id", " S0.P00", " S0.P01", " S1.Id", " S1.P10", " S1.P11"});
     var fromClause = FromClause.Create(
         FilterStream.Create(typeof(SupportBean_S0).Name, "S0").AddView("keepall"),
         FilterStream.Create(typeof(SupportBean_S1).Name, "S1").AddView("keepall"));
     fromClause.Add(OuterJoinQualifier.Create("S0.P00", OuterJoinType.LEFT, "S1.P10").Add("S1.P11", "S0.P01"));
     model.FromClause = fromClause;
     model = env.CopyMayFail(model);
     var stmtText =
         "select S0.Id, S0.P00, S0.P01, S1.Id, S1.P10, S1.P11 from SupportBean_S0#keepall as S0 left outer join SupportBean_S1#keepall as S1 on S0.P00 = S1.P10 and S1.P11 = S0.P01";
     Assert.AreEqual(stmtText, model.ToEPL());
     model.Annotations = Collections.SingletonList(AnnotationPart.NameAnnotation("s0"));
     env.CompileDeploy(model).AddListener("s0");
     AssertMultiColumnLeft(env);
     var modelReverse = env.EplToModel(stmtText);
     Assert.AreEqual(stmtText, modelReverse.ToEPL());
     env.UndeployAll();
 }
Beispiel #14
0
            public void Run(RegressionEnvironment env)
            {
                var subquery = new EPStatementObjectModel();
                subquery.SelectClause = SelectClause.Create().Add(Expressions.Prior(0, "Id"));
                subquery.FromClause = FromClause.Create(
                    FilterStream.Create("SupportBean_S1").AddView("length", Expressions.Constant(1000)));

                var model = new EPStatementObjectModel();
                model.SelectClause = SelectClause.Create().Add(Expressions.Subquery(subquery), "IdS1");
                model.FromClause = FromClause.Create(FilterStream.Create("SupportBean_S0"));
                model = env.CopyMayFail(model);

                var stmtText =
                    "select (select prior(0,Id) from SupportBean_S1#length(1000)) as IdS1 from SupportBean_S0";
                Assert.AreEqual(stmtText, model.ToEPL());

                model.Annotations = Collections.SingletonList(AnnotationPart.NameAnnotation("s0"));
                env.CompileDeploy(model).AddListener("s0");
                RunUnfilteredStreamPrior(env);
                env.UndeployAll();
            }
Beispiel #15
0
            public void Run(RegressionEnvironment env)
            {
                var model = new EPStatementObjectModel();
                model.SelectClause = SelectClause.Create()
                    .Add(Expressions.StaticMethod<BitWriter>("Write", 7), "value");
                model.FromClause = FromClause.Create(
                    FilterStream.Create("SupportMarketDataBean").AddView("length", Expressions.Constant(5)));
                model = env.CopyMayFail(model);
                model.Annotations = Collections.SingletonList(AnnotationPart.NameAnnotation("s0"));

                var bitWriter = typeof(BitWriter).CleanName();
                var statementText = $"@Name('s0') select {bitWriter}.Write(7) as value" + STREAM_MDB_LEN5;

                Assert.AreEqual(statementText.Trim(), model.ToEPL());
                env.CompileDeploy(model).AddListener("s0");

                SendEvent(env, "IBM", 10d, 4L);
                Assert.AreEqual(BitWriter.Write(7), env.Listener("s0").AssertOneGetNewAndReset().Get("value"));

                env.UndeployAll();
            }
Beispiel #16
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);
            }
            public void Run(RegressionEnvironment env)
            {
                var stmtText = "select rstream * from SupportBean#length(3)";
                var model = env.EplToModel(stmtText);
                model = env.CopyMayFail(model);

                Assert.AreEqual(stmtText, model.ToEPL());
                model.Annotations = Collections.SingletonList(AnnotationPart.NameAnnotation("s0"));
                env.CompileDeploy(model).AddListener("s0");

                var theEvent = SendEvent(env, "a", 2);
                Assert.IsFalse(env.Listener("s0").IsInvoked);

                SendEvents(env, new[] {"a", "b"});
                Assert.IsFalse(env.Listener("s0").IsInvoked);

                SendEvent(env, "d", 2);
                Assert.AreSame(theEvent, env.Listener("s0").LastNewData[0].Underlying); // receive 'a' as new data
                Assert.IsNull(env.Listener("s0").LastOldData); // receive no more old data

                env.UndeployAll();
            }
Beispiel #18
0
            public void Run(RegressionEnvironment env)
            {
                var model = new EPStatementObjectModel();
                model.SelectClause = SelectClause.Create()
                    .SetStreamSelector(StreamSelector.RSTREAM_ISTREAM_BOTH)
                    .Add("Symbol")
                    .Add(Expressions.CountStar(), "countAll")
                    .Add(Expressions.CountDistinct("Volume"), "countDistVol")
                    .Add(Expressions.Count("Volume"), "countVol");
                model.FromClause = FromClause
                    .Create(
                        FilterStream.Create(typeof(SupportMarketDataBean).Name)
                            .AddView("length", Expressions.Constant(3)));
                model.WhereClause = Expressions.Or()
                    .Add(Expressions.Eq("Symbol", "DELL"))
                    .Add(Expressions.Eq("Symbol", "IBM"))
                    .Add(Expressions.Eq("Symbol", "GE"));
                model.GroupByClause = GroupByClause.Create("Symbol");
                model = env.CopyMayFail(model);

                var epl = "select irstream Symbol, " +
                          "count(*) as countAll, " +
                          "count(distinct Volume) as countDistVol, " +
                          "count(Volume) as countVol" +
                          " from " +
                          typeof(SupportMarketDataBean).Name +
                          "#length(3) " +
                          "where Symbol=\"DELL\" or Symbol=\"IBM\" or Symbol=\"GE\" " +
                          "group by Symbol";
                Assert.That(model.ToEPL(), Is.EqualTo(epl));

                model.Annotations = Collections.SingletonList(AnnotationPart.NameAnnotation("s0"));
                env.CompileDeploy(model).AddListener("s0");

                TryAssertionCount(env);

                env.UndeployAll();
            }
            public void Run(RegressionEnvironment env)
            {
                var model = new EPStatementObjectModel();
                model.SelectClause = SelectClause.Create("Symbol", "Price")
                    .SetStreamSelector(StreamSelector.RSTREAM_ISTREAM_BOTH)
                    .Add(Expressions.Avg("Price"), "avgPrice");
                model.FromClause = FromClause.Create(
                    FilterStream.Create(typeof(SupportMarketDataBean).Name).AddView("length", Expressions.Constant(5)));
                model.HavingClause = Expressions.Lt(Expressions.Property("Price"), Expressions.Avg("Price"));
                model = env.CopyMayFail(model);

                var epl = "select irstream Symbol, Price, avg(Price) as avgPrice " +
                          "from SupportMarketDataBean#length(5) " +
                          "having Price<avg(Price)";
                Assert.AreEqual(epl, model.ToEPL());

                model.Annotations = Collections.SingletonList(AnnotationPart.NameAnnotation("s0"));
                env.CompileDeploy(model).AddListener("s0");

                TryAssertion(env);

                env.UndeployAll();
            }
Beispiel #20
0
            public void Run(RegressionEnvironment env)
            {
                var model = new EPStatementObjectModel();
                model.SelectClause = SelectClause.CreateWildcard();
                var fromClause = FromClause.Create(
                    FilterStream.Create("SupportBean_S0", "S0").AddView("keepall"),
                    FilterStream.Create("SupportBean_S1", "S1").AddView("keepall"),
                    FilterStream.Create("SupportBean_S2", "S2").AddView("keepall"));
                fromClause.Add(OuterJoinQualifier.Create("S0.P00", OuterJoinType.LEFT, "S1.P10"));
                fromClause.Add(OuterJoinQualifier.Create("S0.P00", OuterJoinType.LEFT, "S2.P20"));
                model.FromClause = fromClause;
                model = env.CopyMayFail(model);

                Assert.AreEqual(
                    "select * from SupportBean_S0#keepall as S0 " +
                    "left outer join SupportBean_S1#keepall as S1 on S0.P00 = S1.P10 " +
                    "left outer join SupportBean_S2#keepall as S2 on S0.P00 = S2.P20",
                    model.ToEPL());

                model.Annotations = Collections.SingletonList(AnnotationPart.NameAnnotation("s0"));
                env.CompileDeploy(model).AddListener("s0");

                TryAssertion(env);
            }
Beispiel #21
0
            public void Run(RegressionEnvironment env)
            {
                var fields = ALL_FIELDS.SplitCsv();
                var sql = "select " + ALL_FIELDS + " from mytesttable where ${IntPrimitive} = mytesttable.myBigint";

                var model = new EPStatementObjectModel();
                model.SelectClause = SelectClause.Create(fields);
                var fromClause = FromClause.Create(
                    SQLStream.Create("MyDBWithRetain", sql, "s0"),
                    FilterStream.Create(typeof(SupportBean).Name, "s1")
                        .AddView(
                            View.Create("time_batch", Expressions.Constant(10))
                        ));
                model.FromClause = fromClause;
                env.CopyMayFail(model);
                Assert.AreEqual(
                    "select myBigint, myint, myvarchar, mychar, mybool, mynumeric, mydecimal, mydouble, myreal from sql:MyDBWithRetain[\"select myBigint, myint, myvarchar, mychar, mybool, mynumeric, mydecimal, mydouble, myreal from mytesttable where ${IntPrimitive} = mytesttable.myBigint\"] as S0, " +
                    "SupportBean#time_batch(10) as S1",
                    model.ToEPL());

                model.Annotations = Collections.SingletonList(AnnotationPart.NameAnnotation("s0"));
                env.CompileDeploy(model).AddListener("s0");
                RuntestTimeBatch(env);
            }
Beispiel #22
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();
            }
Beispiel #23
0
            public void Run(RegressionEnvironment env)
            {
                var subquery = new EPStatementObjectModel();
                subquery.SelectClause = SelectClause.CreateWildcard();
                subquery.FromClause =
                    FromClause.Create(
                        FilterStream.Create("SupportBean_S1")
                            .AddView(View.Create("length", Expressions.Constant(1000))));

                var model = new EPStatementObjectModel();
                model.FromClause = FromClause.Create(FilterStream.Create("SupportBean_S0"));
                model.SelectClause = SelectClause.Create().Add(Expressions.SubqueryExists(subquery), "value");
                model = env.CopyMayFail(model);

                var stmtText = "select exists (select * from SupportBean_S1#length(1000)) as value from SupportBean_S0";
                Assert.AreEqual(stmtText, model.ToEPL());

                model.Annotations = Collections.SingletonList(AnnotationPart.NameAnnotation("s0"));
                env.CompileDeploy(model).AddListener("s0");

                RunTestExistsInSelect(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);
        }
Beispiel #25
0
            public void Run(RegressionEnvironment env)
            {
                var events       = EventCollectionFactory.GetEventSetOne(0, 1000);
                var testCaseList = new CaseList();
                EventExpressionCase testCase;

                // The wait is done when 2 seconds passed
                testCase = new EventExpressionCase("timer:interval(1999 msec)");
                testCase.Add("B1");
                testCaseList.AddTest(testCase);

                var text  = "select * from pattern [timer:interval(1.999d)]";
                var model = new EPStatementObjectModel();

                model.SetSelect(SelectClause.CreateWildcard());
                PatternExpr pattern = Patterns.TimerInterval(1.999d);

                model.SetFrom(FromClause.Create(PatternStream.Create(pattern)));
                model = env.CopyMayFail(model);
                Assert.AreEqual(text, model.ToEPL());
                testCase = new EventExpressionCase(model);
                testCase.Add("B1");
                testCaseList.AddTest(testCase);

                testCase = new EventExpressionCase("timer:interval(2 sec)");
                testCase.Add("B1");
                testCaseList.AddTest(testCase);

                // 3 seconds (>2001 microseconds) passed
                testCase = new EventExpressionCase("timer:interval(2.001)");
                testCase.Add("C1");
                testCaseList.AddTest(testCase);

                testCase = new EventExpressionCase("timer:interval(2999 milliseconds)");
                testCase.Add("C1");
                testCaseList.AddTest(testCase);

                testCase = new EventExpressionCase("timer:interval(3 seconds)");
                testCase.Add("C1");
                testCaseList.AddTest(testCase);

                testCase = new EventExpressionCase("timer:interval(3.001 seconds)");
                testCase.Add("B2");
                testCaseList.AddTest(testCase);

                // Try with an all ... repeated timer every 3 seconds
                testCase = new EventExpressionCase("every timer:interval(3.001 sec)");
                testCase.Add("B2");
                testCase.Add("F1");
                testCase.Add("D3");
                testCaseList.AddTest(testCase);

                testCase = new EventExpressionCase("every timer:interval(5000 msec)");
                testCase.Add("A2");
                testCase.Add("B3");
                testCaseList.AddTest(testCase);

                testCase = new EventExpressionCase("timer:interval(3.999 second) -> b=SupportBean_B");
                testCase.Add("B2", "b", events.GetEvent("B2"));
                testCaseList.AddTest(testCase);

                testCase = new EventExpressionCase("timer:interval(4 sec) -> b=SupportBean_B");
                testCase.Add("B2", "b", events.GetEvent("B2"));
                testCaseList.AddTest(testCase);

                testCase = new EventExpressionCase("timer:interval(4.001 sec) -> b=SupportBean_B");
                testCase.Add("B3", "b", events.GetEvent("B3"));
                testCaseList.AddTest(testCase);

                testCase = new EventExpressionCase("timer:interval(0) -> b=SupportBean_B");
                testCase.Add("B1", "b", events.GetEvent("B1"));
                testCaseList.AddTest(testCase);

                // Try with an followed-by as a second argument
                testCase = new EventExpressionCase("b=SupportBean_B -> timer:interval(0.001)");
                testCase.Add("C1", "b", events.GetEvent("B1"));
                testCaseList.AddTest(testCase);

                testCase = new EventExpressionCase("b=SupportBean_B -> timer:interval(0)");
                testCase.Add("B1", "b", events.GetEvent("B1"));
                testCaseList.AddTest(testCase);

                testCase = new EventExpressionCase("b=SupportBean_B -> timer:interval(1 sec)");
                testCase.Add("C1", "b", events.GetEvent("B1"));
                testCaseList.AddTest(testCase);

                testCase = new EventExpressionCase("b=SupportBean_B -> timer:interval(1.001)");
                testCase.Add("B2", "b", events.GetEvent("B1"));
                testCaseList.AddTest(testCase);

                // Try in a 3-way followed by
                testCase = new EventExpressionCase("b=SupportBean_B() -> timer:interval(6.000) -> d=SupportBean_D");
                testCase.Add("D2", "b", events.GetEvent("B1"), "d", events.GetEvent("D2"));
                testCaseList.AddTest(testCase);

                testCase = new EventExpressionCase(
                    "every (b=SupportBean_B() -> timer:interval(2.001) -> d=SupportBean_D())");
                testCase.Add("D1", "b", events.GetEvent("B1"), "d", events.GetEvent("D1"));
                testCaseList.AddTest(testCase);

                testCase = new EventExpressionCase(
                    "every (b=SupportBean_B() -> timer:interval(2.000) -> d=SupportBean_D())");
                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);

                // Try with an "or"
                testCase = new EventExpressionCase("b=SupportBean_B() or timer:interval(1.001)");
                testCase.Add("B1");
                testCaseList.AddTest(testCase);

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

                testCase = new EventExpressionCase("b=SupportBean_B(Id='B3') or timer:interval(8.500)");
                testCase.Add("D2");
                testCaseList.AddTest(testCase);

                testCase = new EventExpressionCase("timer:interval(8.500) or timer:interval(7.500)");
                testCase.Add("F1");
                testCaseList.AddTest(testCase);

                testCase = new EventExpressionCase("timer:interval(999999 msec) or g=SupportBean_G");
                testCase.Add("G1", "g", events.GetEvent("G1"));
                testCaseList.AddTest(testCase);

                // Try with an "and"
                testCase = new EventExpressionCase("b=SupportBean_B() and timer:interval(4000 msec)");
                testCase.Add("B2", "b", events.GetEvent("B1"));
                testCaseList.AddTest(testCase);

                testCase = new EventExpressionCase("b=SupportBean_B() and timer:interval(4001 msec)");
                testCase.Add("A2", "b", events.GetEvent("B1"));
                testCaseList.AddTest(testCase);

                testCase = new EventExpressionCase("timer:interval(9999999 msec) and b=SupportBean_B");
                testCaseList.AddTest(testCase);

                testCase = new EventExpressionCase("timer:interval(1 msec) and b=SupportBean_B(Id='B2')");
                testCase.Add("B2", "b", events.GetEvent("B2"));
                testCaseList.AddTest(testCase);

                // Try with an "within"
                testCase = new EventExpressionCase("timer:interval(3.000) where timer:within(2.000)");
                testCaseList.AddTest(testCase);

                testCase = new EventExpressionCase("timer:interval(3.000) where timer:within (3.000)");
                testCaseList.AddTest(testCase);

                // Run all tests
                var util = new PatternTestHarness(events, testCaseList, GetType());

                util.RunTest(env);
            }
Beispiel #26
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);
        }
Beispiel #27
0
            public void Run(RegressionEnvironment env)
            {
                var dateTimeEx = DateTimeEx.GetInstance(TimeZoneInfo.Utc);

                dateTimeEx.Set(2005, 3, 9, 8);
                dateTimeEx.SetMillis(0);
                var startTime = dateTimeEx.UtcMillis;

                // Start a 2004-12-9 8:00:00am and send events every 10 minutes
                // "A1"    8:10
                // "B1"    8:20
                // "C1"    8:30
                // "B2"    8:40
                // "A2"    8:50
                // "D1"    9:00
                // "E1"    9:10
                // "F1"    9:20
                // "D2"    9:30
                // "B3"    9:40
                // "G1"    9:50
                // "D3"   10:00

                var testData                 = EventCollectionFactory.GetEventSetOne(startTime, 1000 * 60 * 10);
                var testCaseList             = new CaseList();
                EventExpressionCase testCase = null;

                testCase = new EventExpressionCase("timer:at(10, 8, *, *, *)");
                testCase.Add("A1");
                testCaseList.AddTest(testCase);

                testCase = new EventExpressionCase("timer:at(10, 8, *, *, *, 1)");
                testCase.Add("B1");
                testCaseList.AddTest(testCase);

                testCase = new EventExpressionCase("timer:at(5, 8, *, *, *)");
                testCase.Add("A1");
                testCaseList.AddTest(testCase);

                testCase = new EventExpressionCase("timer:at(10, 8, *, *, *, *)");
                testCase.Add("A1");
                testCaseList.AddTest(testCase);

                testCase = new EventExpressionCase("timer:at(25, 9, *, *, *)");
                testCase.Add("D2");
                testCaseList.AddTest(testCase);

                testCase = new EventExpressionCase("timer:at(11, 8, *, *, *)");
                testCase.Add("B1");
                testCaseList.AddTest(testCase);

                testCase = new EventExpressionCase("timer:at(19, 8, *, *, *, 59)");
                testCase.Add("B1");
                testCaseList.AddTest(testCase);

                testCase = new EventExpressionCase("every timer:at(* / 5, *, *, *, *, *)");
                AddAll(testCase);
                testCaseList.AddTest(testCase);

                testCase = new EventExpressionCase("every timer:at(*, *, *, *, *, * / 10)");
                AddAll(testCase);
                testCaseList.AddTest(testCase);

                testCase = new EventExpressionCase("timer:at(20, 8, *, *, *, 20)");
                testCase.Add("C1");
                testCaseList.AddTest(testCase);

                testCase = new EventExpressionCase("every timer:at(*, *, *, *, *)");
                AddAll(testCase);
                testCaseList.AddTest(testCase);

                testCase = new EventExpressionCase("every timer:at(*, *, *, *, *, *)");
                AddAll(testCase);
                testCaseList.AddTest(testCase);

                testCase = new EventExpressionCase("every timer:at(* / 9, *, *, *, *, *)");
                AddAll(testCase);
                testCaseList.AddTest(testCase);

                testCase = new EventExpressionCase("every timer:at(* / 10, *, *, *, *, *)");
                AddAll(testCase);
                testCaseList.AddTest(testCase);

                testCase = new EventExpressionCase("every timer:at(* / 30, *, *, *, *)");
                testCase.Add("C1");
                testCase.Add("D1");
                testCase.Add("D2");
                testCase.Add("D3");
                testCaseList.AddTest(testCase);

                testCase = new EventExpressionCase("timer:at(10, 9, *, *, *, 10) or timer:at(30, 9, *, *, *, *)");
                testCase.Add("F1");
                testCaseList.AddTest(testCase);

                testCase = new EventExpressionCase("b=SupportBean_B(Id='B3') -> timer:at(20, 9, *, *, *, *)");
                testCaseList.AddTest(testCase);

                testCase = new EventExpressionCase("b=SupportBean_B(Id='B3') -> timer:at(45, 9, *, *, *, *)");
                testCase.Add("G1", "b", testData.GetEvent("B3"));
                testCaseList.AddTest(testCase);

                testCase = new EventExpressionCase("timer:at(59, 8, *, *, *, 59) -> d=SupportBean_D");
                testCase.Add("D1", "d", testData.GetEvent("D1"));
                testCaseList.AddTest(testCase);

                testCase = new EventExpressionCase("timer:at(*, 9, *, *, *, 59) -> d=SupportBean_D");
                testCase.Add("D2", "d", testData.GetEvent("D2"));
                testCaseList.AddTest(testCase);

                testCase = new EventExpressionCase(
                    "timer:at(22, 8, *, *, *) -> b=SupportBean_B(Id='B3') -> timer:at(55, *, *, *, *)");
                testCase.Add("D3", "b", testData.GetEvent("B3"));
                testCaseList.AddTest(testCase);

                testCase = new EventExpressionCase("timer:at(40, *, *, *, *, 1) and b=SupportBean_B");
                testCase.Add("A2", "b", testData.GetEvent("B1"));
                testCaseList.AddTest(testCase);

                testCase = new EventExpressionCase("timer:at(40, 9, *, *, *, 1) or d=SupportBean_D(Id='D3')");
                testCase.Add("G1");
                testCaseList.AddTest(testCase);

                testCase = new EventExpressionCase(
                    "timer:at(22, 8, *, *, *) -> b=SupportBean_B() -> timer:at(55, 8, *, *, *)");
                testCase.Add("D1", "b", testData.GetEvent("B2"));
                testCaseList.AddTest(testCase);

                testCase = new EventExpressionCase("timer:at(22, 8, *, *, *, 1) where timer:within(1 second)");
                testCaseList.AddTest(testCase);

                testCase = new EventExpressionCase("timer:at(22, 8, *, *, *, 1) where timer:within(31 minutes)");
                testCase.Add("C1");
                testCaseList.AddTest(testCase);

                testCase = new EventExpressionCase("timer:at(*, 9, *, *, *) and timer:at(55, *, *, *, *)");
                testCase.Add("D1");
                testCaseList.AddTest(testCase);

                testCase = new EventExpressionCase("timer:at(40, 8, *, *, *, 1) and b=SupportBean_B");
                testCase.Add("A2", "b", testData.GetEvent("B1"));
                testCaseList.AddTest(testCase);

                var text  = "select * from pattern [timer:at(10,8,*,*,*,*)]";
                var model = new EPStatementObjectModel();

                model.SelectClause = SelectClause.CreateWildcard();
                PatternExpr pattern = Patterns.TimerAt(10, 8, null, null, null, null);

                model.FromClause = FromClause.Create(PatternStream.Create(pattern));
                model            = env.CopyMayFail(model);
                Assert.AreEqual(text, model.ToEPL());
                testCase = new EventExpressionCase(model);
                testCase.Add("A1");
                testCaseList.AddTest(testCase);

                // Run all tests
                var util = new PatternTestHarness(testData, testCaseList, GetType());

                util.RunTest(env);
            }
Beispiel #28
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);
            }
Beispiel #29
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 not d=SupportBean_D");
                testCase.Add("B1", "b", events.GetEvent("B1"));
                testCaseList.AddTest(testCase);

                var text = "select * from pattern [every b=SupportBean_B and not g=SupportBean_G]";
                var model = new EPStatementObjectModel();
                model.SelectClause = SelectClause.CreateWildcard();
                PatternExpr pattern = Patterns.And()
                    .Add(Patterns.EveryFilter("SupportBean_B", "b"))
                    .Add(Patterns.NotFilter("SupportBean_G", "g"));
                model.FromClause = FromClause.Create(PatternStream.Create(pattern));
                model = env.CopyMayFail(model);
                Assert.AreEqual(text, model.ToEPL());
                testCase = new EventExpressionCase(model);
                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 and not g=SupportBean_G");
                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 and not d=SupportBean_D");
                testCase.Add("B1", "b", events.GetEvent("B1"));
                testCase.Add("B2", "b", events.GetEvent("B2"));
                testCaseList.AddTest(testCase);

                testCase = new EventExpressionCase("b=SupportBean_B and not a=SupportBean_A(Id='A1')");
                testCaseList.AddTest(testCase);

                testCase = new EventExpressionCase("b=SupportBean_B and not a2=SupportBean_A(Id='A2')");
                testCase.Add("B1", "b", events.GetEvent("B1"));
                testCaseList.AddTest(testCase);

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

                testCase = new EventExpressionCase("every (b=SupportBean_B or not SupportBean_D())");
                testCaseList.AddTest(testCase);

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

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

                testCase = new EventExpressionCase(
                    "(b=SupportBean_B -> d=SupportBean_D) and " +
                    " not SupportBean_A");
                testCaseList.AddTest(testCase);

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

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

                testCase = new EventExpressionCase(
                    "every (b=SupportBean_B -> d=SupportBean_D) and " +
                    " not SupportBean_G(Id='x')");
                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);

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