public void TestOp() { var events = EventCollectionFactory.GetEventSetOne(0, 1000); var testCaseList = new CaseList(); EventExpressionCase testCase = null; testCase = new EventExpressionCase("every b=" + EVENT_B_CLASS); 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); testCase.Add("B1", "b", events.GetEvent("B1")); testCaseList.AddTest(testCase); testCase = new EventExpressionCase("every (every (every b=" + EVENT_B_CLASS + "))"); testCase.Add("B1", "b", events.GetEvent("B1")); for (var i = 0; i < 3; i++) { testCase.Add("B2", "b", events.GetEvent("B2")); } for (var i = 0; i < 9; i++) { testCase.Add("B3", "b", events.GetEvent("B3")); } testCaseList.AddTest(testCase); testCase = new EventExpressionCase("every (every b=" + EVENT_B_CLASS + "())"); testCase.Add("B1", "b", events.GetEvent("B1")); testCase.Add("B2", "b", events.GetEvent("B2")); testCase.Add("B2", "b", events.GetEvent("B2")); for (var i = 0; i < 4; i++) { testCase.Add("B3", "b", events.GetEvent("B3")); } testCaseList.AddTest(testCase); testCase = new EventExpressionCase("every( every (every (every b=" + EVENT_B_CLASS + "())))"); testCase.Add("B1", "b", events.GetEvent("B1")); for (var i = 0; i < 4; i++) { testCase.Add("B2", "b", events.GetEvent("B2")); } for (var i = 0; i < 16; i++) { testCase.Add("B3", "b", events.GetEvent("B3")); } testCaseList.AddTest(testCase); var util = new PatternTestHarness(events, testCaseList, GetType(), GetType().FullName); util.RunTest(); }
private void RunAssertionOp(EPServiceProvider epService) { EventCollection events = EventCollectionFactory.GetEventSetOne(0, 1000); var testCaseList = new CaseList(); EventExpressionCase testCase; testCase = new EventExpressionCase("every b=" + EVENT_B_CLASS); 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); testCase.Add("B1", "b", events.GetEvent("B1")); testCaseList.AddTest(testCase); testCase = new EventExpressionCase("every (every (every b=" + EVENT_B_CLASS + "))"); testCase.Add("B1", "b", events.GetEvent("B1")); for (int i = 0; i < 3; i++) { testCase.Add("B2", "b", events.GetEvent("B2")); } for (int i = 0; i < 9; i++) { testCase.Add("B3", "b", events.GetEvent("B3")); } testCaseList.AddTest(testCase); testCase = new EventExpressionCase("every (every b=" + EVENT_B_CLASS + "())"); testCase.Add("B1", "b", events.GetEvent("B1")); testCase.Add("B2", "b", events.GetEvent("B2")); testCase.Add("B2", "b", events.GetEvent("B2")); for (int i = 0; i < 4; i++) { testCase.Add("B3", "b", events.GetEvent("B3")); } testCaseList.AddTest(testCase); testCase = new EventExpressionCase("Every( every (every (every b=" + EVENT_B_CLASS + "())))"); testCase.Add("B1", "b", events.GetEvent("B1")); for (int i = 0; i < 4; i++) { testCase.Add("B2", "b", events.GetEvent("B2")); } for (int i = 0; i < 16; i++) { testCase.Add("B3", "b", events.GetEvent("B3")); } testCaseList.AddTest(testCase); var util = new PatternTestHarness(events, testCaseList, this.GetType()); util.RunTest(epService); }
public void Run(RegressionEnvironment env) { var events = EventCollectionFactory.GetEventSetOne(0, 1000); var testCaseList = new CaseList(); EventExpressionCase testCase; testCase = new EventExpressionCase("every b=SupportBean_B"); 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"); testCase.Add("B1", "b", events.GetEvent("B1")); testCaseList.AddTest(testCase); testCase = new EventExpressionCase("every (every (every b=SupportBean_B))"); testCase.Add("B1", "b", events.GetEvent("B1")); for (var i = 0; i < 3; i++) { testCase.Add("B2", "b", events.GetEvent("B2")); } for (var i = 0; i < 9; i++) { testCase.Add("B3", "b", events.GetEvent("B3")); } testCaseList.AddTest(testCase); testCase = new EventExpressionCase("every (every b=SupportBean_B())"); testCase.Add("B1", "b", events.GetEvent("B1")); testCase.Add("B2", "b", events.GetEvent("B2")); testCase.Add("B2", "b", events.GetEvent("B2")); for (var i = 0; i < 4; i++) { testCase.Add("B3", "b", events.GetEvent("B3")); } testCaseList.AddTest(testCase); testCase = new EventExpressionCase("every( every (every (every b=SupportBean_B())))"); testCase.Add("B1", "b", events.GetEvent("B1")); for (var i = 0; i < 4; i++) { testCase.Add("B2", "b", events.GetEvent("B2")); } for (var i = 0; i < 16; i++) { testCase.Add("B3", "b", events.GetEvent("B3")); } testCaseList.AddTest(testCase); var util = new PatternTestHarness(events, testCaseList, GetType()); util.RunTest(env); }
public void Run(RegressionEnvironment env) { var events = EventCollectionFactory.GetSetTwoExternalClock(0, 1000); var results = new CaseList(); var desc = new EventExpressionCase("every a=SupportBean_A() and not a1=SupportBean_A(Id='A4')"); desc.Add("B1", "a", events.GetEvent("B1")); desc.Add("B2", "a", events.GetEvent("B2")); desc.Add("B3", "a", events.GetEvent("B3")); results.AddTest(desc); var util = new PatternTestHarness(events, results, GetType()); util.RunTest(env); }
private void AddAll(EventExpressionCase desc) { desc.Add("A1"); desc.Add("B1"); desc.Add("C1"); desc.Add("B2"); desc.Add("A2"); desc.Add("D1"); desc.Add("E1"); desc.Add("F1"); desc.Add("D2"); desc.Add("B3"); desc.Add("G1"); desc.Add("D3"); }
public void TestUniformEvents() { var events = EventCollectionFactory.GetSetTwoExternalClock(0, 1000); var results = new CaseList(); EventExpressionCase desc = null; desc = new EventExpressionCase("every a=" + EVENT_A_CLASS + "() and not a1=" + EVENT_A_CLASS + "(id=\"A4\")"); desc.Add("B1", "a", events.GetEvent("B1")); desc.Add("B2", "a", events.GetEvent("B2")); desc.Add("B3", "a", events.GetEvent("B3")); results.AddTest(desc); var util = new PatternTestHarness(events, results, GetType(), GetType().FullName); util.RunTest(); }
private void RunAssertionUniformEvents(EPServiceProvider epService) { EventCollection events = EventCollectionFactory.GetSetTwoExternalClock(0, 1000); var results = new CaseList(); var desc = new EventExpressionCase("every a=" + EVENT_A_CLASS + "() and not a1=" + EVENT_A_CLASS + "(id=\"A4\")"); desc.Add("B1", "a", events.GetEvent("B1")); desc.Add("B2", "a", events.GetEvent("B2")); desc.Add("B3", "a", events.GetEvent("B3")); results.AddTest(desc); var util = new PatternTestHarness(events, results, this.GetType()); util.RunTest(epService); }
private void RunAssertionObjectId(EPServiceProvider epService) { string @event = typeof(SupportBean_S0).FullName; EventCollection events = EventCollectionFactory.GetSetFourExternalClock(0, 1000); var testCaseList = new CaseList(); EventExpressionCase testCase; testCase = new EventExpressionCase("X1=" + @event + "() -> X2=" + @event + "(p00=X1.p00)"); testCaseList.AddTest(testCase); testCase = new EventExpressionCase("X1=" + @event + "(p00='B') -> X2=" + @event + "(p00=X1.p00)"); testCase.Add("e6", "X1", events.GetEvent("e2"), "X2", events.GetEvent("e6")); testCaseList.AddTest(testCase); testCase = new EventExpressionCase("X1=" + @event + "(p00='B') -> every X2=" + @event + "(p00=X1.p00)"); testCase.Add("e6", "X1", events.GetEvent("e2"), "X2", events.GetEvent("e6")); testCase.Add("e11", "X1", events.GetEvent("e2"), "X2", events.GetEvent("e11")); testCaseList.AddTest(testCase); testCase = new EventExpressionCase("every X1=" + @event + "(p00='B') -> every X2=" + @event + "(p00=X1.p00)"); testCase.Add("e6", "X1", events.GetEvent("e2"), "X2", events.GetEvent("e6")); testCase.Add("e11", "X1", events.GetEvent("e2"), "X2", events.GetEvent("e11")); testCase.Add("e11", "X1", events.GetEvent("e6"), "X2", events.GetEvent("e11")); testCaseList.AddTest(testCase); testCase = new EventExpressionCase("every X1=" + @event + "() -> X2=" + @event + "(p00=X1.p00)"); testCase.Add("e6", "X1", events.GetEvent("e2"), "X2", events.GetEvent("e6")); testCase.Add("e8", "X1", events.GetEvent("e3"), "X2", events.GetEvent("e8")); testCase.Add("e10", "X1", events.GetEvent("e9"), "X2", events.GetEvent("e10")); testCase.Add("e11", "X1", events.GetEvent("e6"), "X2", events.GetEvent("e11")); testCase.Add("e12", "X1", events.GetEvent("e7"), "X2", events.GetEvent("e12")); testCaseList.AddTest(testCase); testCase = new EventExpressionCase("every X1=" + @event + "() -> every X2=" + @event + "(p00=X1.p00)"); testCase.Add("e6", "X1", events.GetEvent("e2"), "X2", events.GetEvent("e6")); testCase.Add("e8", "X1", events.GetEvent("e3"), "X2", events.GetEvent("e8")); testCase.Add("e10", "X1", events.GetEvent("e9"), "X2", events.GetEvent("e10")); testCase.Add("e11", "X1", events.GetEvent("e2"), "X2", events.GetEvent("e11")); testCase.Add("e11", "X1", events.GetEvent("e6"), "X2", events.GetEvent("e11")); testCase.Add("e12", "X1", events.GetEvent("e7"), "X2", events.GetEvent("e12")); testCaseList.AddTest(testCase); var util = new PatternTestHarness(events, testCaseList, this.GetType()); util.RunTest(epService); }
public void TestObjectId() { string EVENT = typeof(SupportBean_S0).FullName; EventCollection events = EventCollectionFactory.GetSetFourExternalClock(0, 1000); CaseList testCaseList = new CaseList(); EventExpressionCase testCase = null; testCase = new EventExpressionCase("X1=" + EVENT + "() -> X2=" + EVENT + "(p00=X1.P00)"); testCaseList.AddTest(testCase); testCase = new EventExpressionCase("X1=" + EVENT + "(p00='B') -> X2=" + EVENT + "(p00=X1.P00)"); testCase.Add("e6", "X1", events.GetEvent("e2"), "X2", events.GetEvent("e6")); testCaseList.AddTest(testCase); testCase = new EventExpressionCase("X1=" + EVENT + "(p00='B') -> every X2=" + EVENT + "(p00=X1.P00)"); testCase.Add("e6", "X1", events.GetEvent("e2"), "X2", events.GetEvent("e6")); testCase.Add("e11", "X1", events.GetEvent("e2"), "X2", events.GetEvent("e11")); testCaseList.AddTest(testCase); testCase = new EventExpressionCase("every X1=" + EVENT + "(p00='B') -> every X2=" + EVENT + "(p00=X1.P00)"); testCase.Add("e6", "X1", events.GetEvent("e2"), "X2", events.GetEvent("e6")); testCase.Add("e11", "X1", events.GetEvent("e2"), "X2", events.GetEvent("e11")); testCase.Add("e11", "X1", events.GetEvent("e6"), "X2", events.GetEvent("e11")); testCaseList.AddTest(testCase); testCase = new EventExpressionCase("every X1=" + EVENT + "() -> X2=" + EVENT + "(p00=X1.P00)"); testCase.Add("e6", "X1", events.GetEvent("e2"), "X2", events.GetEvent("e6")); testCase.Add("e8", "X1", events.GetEvent("e3"), "X2", events.GetEvent("e8")); testCase.Add("e10", "X1", events.GetEvent("e9"), "X2", events.GetEvent("e10")); testCase.Add("e11", "X1", events.GetEvent("e6"), "X2", events.GetEvent("e11")); testCase.Add("e12", "X1", events.GetEvent("e7"), "X2", events.GetEvent("e12")); testCaseList.AddTest(testCase); testCase = new EventExpressionCase("every X1=" + EVENT + "() -> every X2=" + EVENT + "(p00=X1.P00)"); testCase.Add("e6", "X1", events.GetEvent("e2"), "X2", events.GetEvent("e6")); testCase.Add("e8", "X1", events.GetEvent("e3"), "X2", events.GetEvent("e8")); testCase.Add("e10", "X1", events.GetEvent("e9"), "X2", events.GetEvent("e10")); testCase.Add("e11", "X1", events.GetEvent("e2"), "X2", events.GetEvent("e11")); testCase.Add("e11", "X1", events.GetEvent("e6"), "X2", events.GetEvent("e11")); testCase.Add("e12", "X1", events.GetEvent("e7"), "X2", events.GetEvent("e12")); testCaseList.AddTest(testCase); PatternTestHarness util = new PatternTestHarness(events, testCaseList, GetType(), GetType().FullName); util.RunTest(); }
public void Run(RegressionEnvironment env) { var events = EventCollectionFactory.GetSetFourExternalClock(0, 1000); var testCaseList = new CaseList(); EventExpressionCase testCase; testCase = new EventExpressionCase("X1=SupportBean_S0() -> X2=SupportBean_S0(P00=X1.P00)"); testCaseList.AddTest(testCase); testCase = new EventExpressionCase("X1=SupportBean_S0(P00='B') -> X2=SupportBean_S0(P00=X1.P00)"); testCase.Add("e6", "X1", events.GetEvent("e2"), "X2", events.GetEvent("e6")); testCaseList.AddTest(testCase); testCase = new EventExpressionCase("X1=SupportBean_S0(P00='B') -> every X2=SupportBean_S0(P00=X1.P00)"); testCase.Add("e6", "X1", events.GetEvent("e2"), "X2", events.GetEvent("e6")); testCase.Add("e11", "X1", events.GetEvent("e2"), "X2", events.GetEvent("e11")); testCaseList.AddTest(testCase); testCase = new EventExpressionCase( "every X1=SupportBean_S0(P00='B') -> every X2=SupportBean_S0(P00=X1.P00)"); testCase.Add("e6", "X1", events.GetEvent("e2"), "X2", events.GetEvent("e6")); testCase.Add("e11", "X1", events.GetEvent("e2"), "X2", events.GetEvent("e11")); testCase.Add("e11", "X1", events.GetEvent("e6"), "X2", events.GetEvent("e11")); testCaseList.AddTest(testCase); testCase = new EventExpressionCase("every X1=SupportBean_S0() -> X2=SupportBean_S0(P00=X1.P00)"); testCase.Add("e6", "X1", events.GetEvent("e2"), "X2", events.GetEvent("e6")); testCase.Add("e8", "X1", events.GetEvent("e3"), "X2", events.GetEvent("e8")); testCase.Add("e10", "X1", events.GetEvent("e9"), "X2", events.GetEvent("e10")); testCase.Add("e11", "X1", events.GetEvent("e6"), "X2", events.GetEvent("e11")); testCase.Add("e12", "X1", events.GetEvent("e7"), "X2", events.GetEvent("e12")); testCaseList.AddTest(testCase); testCase = new EventExpressionCase("every X1=SupportBean_S0() -> every X2=SupportBean_S0(P00=X1.P00)"); testCase.Add("e6", "X1", events.GetEvent("e2"), "X2", events.GetEvent("e6")); testCase.Add("e8", "X1", events.GetEvent("e3"), "X2", events.GetEvent("e8")); testCase.Add("e10", "X1", events.GetEvent("e9"), "X2", events.GetEvent("e10")); testCase.Add("e11", "X1", events.GetEvent("e2"), "X2", events.GetEvent("e11")); testCase.Add("e11", "X1", events.GetEvent("e6"), "X2", events.GetEvent("e11")); testCase.Add("e12", "X1", events.GetEvent("e7"), "X2", events.GetEvent("e12")); testCaseList.AddTest(testCase); var util = new PatternTestHarness(events, testCaseList, GetType()); util.RunTest(env); }
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(); }
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 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); }
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(); }
public void TestOp() { EventCollection events = EventCollectionFactory.GetEventSetOne(0, 1000); CaseList testCaseList = new CaseList(); EventExpressionCase testCase; testCase = new EventExpressionCase( "a=" + EVENT_A_CLASS + " or a=" + EVENT_A_CLASS); testCase.Add("A1", "a", events.GetEvent("A1")); testCaseList.AddTest(testCase); testCase = new EventExpressionCase( "a=" + EVENT_A_CLASS + " or b=" + EVENT_B_CLASS + " or c=" + EVENT_C_CLASS); testCase.Add("A1", "a", events.GetEvent("A1")); testCaseList.AddTest(testCase); testCase = new EventExpressionCase( "every b=" + EVENT_B_CLASS + " or every d=" + EVENT_D_CLASS); testCase.Add("B1", "b", events.GetEvent("B1")); testCase.Add("B2", "b", events.GetEvent("B2")); testCase.Add("D1", "d", events.GetEvent("D1")); testCase.Add("D2", "d", events.GetEvent("D2")); testCase.Add("B3", "b", events.GetEvent("B3")); testCase.Add("D3", "d", events.GetEvent("D3")); testCaseList.AddTest(testCase); testCase = new EventExpressionCase( "a=" + EVENT_A_CLASS + " or b=" + EVENT_B_CLASS); testCase.Add("A1", "a", events.GetEvent("A1")); testCaseList.AddTest(testCase); testCase = new EventExpressionCase( "a=" + EVENT_A_CLASS + " or every b=" + EVENT_B_CLASS); testCase.Add("A1", "a", events.GetEvent("A1")); testCaseList.AddTest(testCase); testCase = new EventExpressionCase( "every a=" + EVENT_A_CLASS + " or d=" + EVENT_D_CLASS); testCase.Add("A1", "a", events.GetEvent("A1")); testCase.Add("A2", "a", events.GetEvent("A2")); testCase.Add("D1", "d", events.GetEvent("D1")); testCaseList.AddTest(testCase); testCase = new EventExpressionCase( "every (every b=" + EVENT_B_CLASS + "() or d=" + EVENT_D_CLASS + "())"); testCase.Add("B1", "b", events.GetEvent("B1")); testCase.Add("B2", "b", events.GetEvent("B2")); testCase.Add("B2", "b", events.GetEvent("B2")); for (int i = 0; i < 4; i++) { testCase.Add("D1", "d", events.GetEvent("D1")); } for (int i = 0; i < 4; i++) { testCase.Add("D2", "d", events.GetEvent("D2")); } for (int i = 0; i < 4; i++) { testCase.Add("B3", "b", events.GetEvent("B3")); } for (int i = 0; i < 8; i++) { testCase.Add("D3", "d", events.GetEvent("D3")); } testCaseList.AddTest(testCase); testCase = new EventExpressionCase( "every (b=" + EVENT_B_CLASS + "() or every d=" + EVENT_D_CLASS + "())"); testCase.Add("B1", "b", events.GetEvent("B1")); testCase.Add("B2", "b", events.GetEvent("B2")); testCase.Add("D1", "d", events.GetEvent("D1")); testCase.Add("D2", "d", events.GetEvent("D2")); testCase.Add("D2", "d", events.GetEvent("D2")); for (int i = 0; i < 4; i++) { testCase.Add("B3", "b", events.GetEvent("B3")); } for (int i = 0; i < 4; i++) { testCase.Add("D3", "d", events.GetEvent("D3")); } testCaseList.AddTest(testCase); testCase = new EventExpressionCase( "every (every d=" + EVENT_D_CLASS + "() or every b=" + EVENT_B_CLASS + "())"); testCase.Add("B1", "b", events.GetEvent("B1")); testCase.Add("B2", "b", events.GetEvent("B2")); testCase.Add("B2", "b", events.GetEvent("B2")); for (int i = 0; i < 4; i++) { testCase.Add("D1", "d", events.GetEvent("D1")); } for (int i = 0; i < 8; i++) { testCase.Add("D2", "d", events.GetEvent("D2")); } for (int i = 0; i < 16; i++) { testCase.Add("B3", "b", events.GetEvent("B3")); } for (int i = 0; i < 32; i++) { testCase.Add("D3", "d", events.GetEvent("D3")); } testCaseList.AddTest(testCase); PatternTestHarness util = new PatternTestHarness(events, testCaseList, GetType(), GetType().FullName); util.RunTest(); }
public void TestOp() { EventCollection events = EventCollectionFactory.GetEventSetOne(0, 1000); CaseList testCaseList = new CaseList(); EventExpressionCase testCase; testCase = new EventExpressionCase("a=A(id='A2') until D"); testCase.Add("D1", "a[0]", events.GetEvent("A2")); testCaseList.AddTest(testCase); testCase = new EventExpressionCase("a=A until D"); testCase.Add("D1", "a[0]", events.GetEvent("A1"), "a[1]", events.GetEvent("A2")); testCaseList.AddTest(testCase); testCase = new EventExpressionCase("b=B until a=A"); testCase.Add("A1", "b[0]", null, "a", events.GetEvent("A1")); testCaseList.AddTest(testCase); testCase = new EventExpressionCase("b=B until D(id='D3')"); testCase.Add("D3", "b[0]", events.GetEvent("B1"), "b[1]", events.GetEvent("B2"), "b[2]", events.GetEvent("B3")); testCaseList.AddTest(testCase); testCase = new EventExpressionCase("(a=A or b=B) until d=D(id='D3')"); testCase.Add("D3", new Object[][] { new Object[] { "a[0]", events.GetEvent("A1") }, new Object[] { "a[1]", events.GetEvent("A2") }, new Object[] { "b[0]", events.GetEvent("B1") }, new Object[] { "b[1]", events.GetEvent("B2") }, new Object[] { "b[2]", events.GetEvent("B3") }, new Object[] { "d", events.GetEvent("D3") } }); testCaseList.AddTest(testCase); testCase = new EventExpressionCase("(a=A or b=B) until (g=G or d=D)"); testCase.Add("D1", new Object[][] { new Object[] { "a[0]", events.GetEvent("A1") }, new Object[] { "a[1]", events.GetEvent("A2") }, new Object[] { "b[0]", events.GetEvent("B1") }, new Object[] { "b[1]", events.GetEvent("B2") }, new Object[] { "d", events.GetEvent("D1") } }); testCaseList.AddTest(testCase); testCase = new EventExpressionCase("(d=D) until a=A(id='A1')"); testCase.Add("A1"); testCaseList.AddTest(testCase); testCase = new EventExpressionCase("a=A until G(id='GX')"); testCaseList.AddTest(testCase); testCase = new EventExpressionCase("[2] a=A"); testCase.Add("A2", "a[0]", events.GetEvent("A1"), "a[1]", events.GetEvent("A2")); testCaseList.AddTest(testCase); testCase = new EventExpressionCase("[2:2] a=A"); testCase.Add("A2", "a[0]", events.GetEvent("A1"), "a[1]", events.GetEvent("A2")); testCaseList.AddTest(testCase); testCase = new EventExpressionCase("[1] a=A"); testCase.Add("A1", "a[0]", events.GetEvent("A1")); testCaseList.AddTest(testCase); testCase = new EventExpressionCase("[1:1] a=A"); testCase.Add("A1", "a[0]", events.GetEvent("A1")); testCaseList.AddTest(testCase); testCase = new EventExpressionCase("[3] a=A"); testCaseList.AddTest(testCase); testCase = new EventExpressionCase("[3] b=B"); testCase.Add("B3", "b[0]", events.GetEvent("B1"), "b[1]", events.GetEvent("B2"), "b[2]", events.GetEvent("B3")); testCaseList.AddTest(testCase); testCase = new EventExpressionCase("[4] (a=A or b=B)"); testCase.Add("A2", "b[0]", events.GetEvent("B1"), "b[1]", events.GetEvent("B2"), "a[0]", events.GetEvent("A1"), "a[1]", events.GetEvent("A2")); testCaseList.AddTest(testCase); // the until ends the matching returning permanently false testCase = new EventExpressionCase("[2] b=B until a=A(id='A1')"); testCaseList.AddTest(testCase); testCase = new EventExpressionCase("[2] b=B until c=C"); testCaseList.AddTest(testCase); testCase = new EventExpressionCase("[2:2] b=B until g=G(id='G1')"); testCase.Add("B2", "b[0]", events.GetEvent("B1"), "b[1]", events.GetEvent("B2")); testCaseList.AddTest(testCase); testCase = new EventExpressionCase("[:4] b=B until g=G(id='G1')"); testCase.Add("G1", "b[0]", events.GetEvent("B1"), "b[1]", events.GetEvent("B2"), "b[2]", events.GetEvent("B3"), "g", events.GetEvent("G1")); testCaseList.AddTest(testCase); testCase = new EventExpressionCase("[:3] b=B until g=G(id='G1')"); testCase.Add("G1", "b[0]", events.GetEvent("B1"), "b[1]", events.GetEvent("B2"), "b[2]", events.GetEvent("B3"), "g", events.GetEvent("G1")); testCaseList.AddTest(testCase); testCase = new EventExpressionCase("[:2] b=B until g=G(id='G1')"); testCase.Add("G1", "b[0]", events.GetEvent("B1"), "b[1]", events.GetEvent("B2"), "g", events.GetEvent("G1")); testCaseList.AddTest(testCase); testCase = new EventExpressionCase("[:1] b=B until g=G(id='G1')"); testCase.Add("G1", "b[0]", events.GetEvent("B1"), "g", events.GetEvent("G1")); testCaseList.AddTest(testCase); testCase = new EventExpressionCase("[:1] b=B until a=A(id='A1')"); testCase.Add("A1", "b[0]", null, "a", events.GetEvent("A1")); testCaseList.AddTest(testCase); testCase = new EventExpressionCase("[1:] b=B until g=G(id='G1')"); testCase.Add("G1", "b[0]", events.GetEvent("B1"), "b[1]", events.GetEvent("B2"), "b[2]", events.GetEvent("B3"), "g", events.GetEvent("G1")); testCaseList.AddTest(testCase); testCase = new EventExpressionCase("[1:] b=B until a=A"); testCaseList.AddTest(testCase); testCase = new EventExpressionCase("[2:] b=B until a=A(id='A2')"); testCase.Add("A2", "b[0]", events.GetEvent("B1"), "b[1]", events.GetEvent("B2"), "a", events.GetEvent("A2")); testCaseList.AddTest(testCase); testCase = new EventExpressionCase("[2:] b=B until c=C"); testCaseList.AddTest(testCase); // same event triggering both clauses, until always wins, match does not count testCase = new EventExpressionCase("[2:] b=B until e=B(id='B2')"); testCaseList.AddTest(testCase); // same event triggering both clauses, until always wins, match does not count testCase = new EventExpressionCase("[1:] b=B until e=B(id='B1')"); testCaseList.AddTest(testCase); testCase = new EventExpressionCase("[1:2] b=B until a=A(id='A2')"); testCase.Add("A2", "b[0]", events.GetEvent("B1"), "b[1]", events.GetEvent("B2"), "b[2]", null, "a", events.GetEvent("A2")); testCaseList.AddTest(testCase); testCase = new EventExpressionCase("[1:3] b=B until G"); testCase.Add("G1", "b[0]", events.GetEvent("B1"), "b[1]", events.GetEvent("B2"), "b[2]", events.GetEvent("B3"), "b[3]", null); testCaseList.AddTest(testCase); testCase = new EventExpressionCase("[1:2] b=B until G"); testCase.Add("G1", "b[0]", events.GetEvent("B1"), "b[1]", events.GetEvent("B2"), "b[2]", null); testCaseList.AddTest(testCase); testCase = new EventExpressionCase("[1:10] b=B until F"); testCase.Add("F1", "b[0]", events.GetEvent("B1"), "b[1]", events.GetEvent("B2"), "b[2]", null); testCaseList.AddTest(testCase); testCase = new EventExpressionCase("[1:10] b=B until C"); testCase.Add("C1", "b[0]", events.GetEvent("B1"), "b[1]", null); testCaseList.AddTest(testCase); testCase = new EventExpressionCase("[0:1] b=B until C"); testCase.Add("C1", "b[0]", events.GetEvent("B1"), "b[1]", null); testCaseList.AddTest(testCase); testCase = new EventExpressionCase("c=C -> [2] b=B -> d=D"); testCase.Add("D3", "c", events.GetEvent("C1"), "b[0]", events.GetEvent("B2"), "b[1]", events.GetEvent("B3"), "d", events.GetEvent("D3")); testCaseList.AddTest(testCase); testCase = new EventExpressionCase("[3] d=D or [3] b=B"); testCase.Add("B3", "b[0]", events.GetEvent("B1"), "b[1]", events.GetEvent("B2"), "b[2]", events.GetEvent("B3")); testCaseList.AddTest(testCase); testCase = new EventExpressionCase("[3] d=D or [4] b=B"); testCase.Add("D3", "d[0]", events.GetEvent("D1"), "d[1]", events.GetEvent("D2"), "d[2]", events.GetEvent("D3")); testCaseList.AddTest(testCase); testCase = new EventExpressionCase("[2] d=D and [2] b=B"); testCase.Add("D2", "d[0]", events.GetEvent("D1"), "d[1]", events.GetEvent("D2"), "b[0]", events.GetEvent("B1"), "b[1]", events.GetEvent("B2")); testCaseList.AddTest(testCase); testCase = new EventExpressionCase("d=D until timer:interval(7 sec)"); testCase.Add("E1", "d[0]", events.GetEvent("D1"), "d[1]", null, "d[2]", null); testCaseList.AddTest(testCase); testCase = new EventExpressionCase("every (d=D until b=B)"); testCase.Add("B1", "d[0]", null, "b", events.GetEvent("B1")); testCase.Add("B2", "d[0]", null, "b", events.GetEvent("B2")); testCase.Add("B3", "d[0]", events.GetEvent("D1"), "d[1]", events.GetEvent("D2"), "d[2]", null, "b", events.GetEvent("B3")); testCaseList.AddTest(testCase); // note precendence: every is higher then until testCase = new EventExpressionCase("every d=D until b=B"); testCase.Add("B1", "d[0]", null, "b", events.GetEvent("B1")); testCaseList.AddTest(testCase); testCase = new EventExpressionCase("(every d=D) until b=B"); testCase.Add("B1", "d[0]", null, "b", events.GetEvent("B1")); testCaseList.AddTest(testCase); testCase = new EventExpressionCase("a=A until (every (timer:interval(6 sec) and not A))"); testCase.Add("G1", "a[0]", events.GetEvent("A1"), "a[1]", events.GetEvent("A2")); testCaseList.AddTest(testCase); testCase = new EventExpressionCase("A until (every (timer:interval(7 sec) and not A))"); testCase.Add("D3"); testCaseList.AddTest(testCase); testCase = new EventExpressionCase("[2] (a=A or b=B)"); testCase.Add("B1", "a[0]", events.GetEvent("A1"), "b[0]", events.GetEvent("B1"), "b[1]", null); testCaseList.AddTest(testCase); testCase = new EventExpressionCase("every [2] a=A"); testCase.Add("A2", new Object[][] { new Object[] { "a[0]", events.GetEvent("A1") }, new Object[] { "a[1]", events.GetEvent("A2") }, }); testCaseList.AddTest(testCase); testCase = new EventExpressionCase("every [2] a=A until d=D"); // every has Precedence; ESPER-339 testCase.Add("D1", new Object[][] { new Object[] { "a[0]", events.GetEvent("A1") }, new Object[] { "a[1]", events.GetEvent("A2") }, new Object[] { "d", events.GetEvent("D1") }, }); testCaseList.AddTest(testCase); testCase = new EventExpressionCase("[3] (a=A or b=B)"); testCase.Add("B2", "a[0]", events.GetEvent("A1"), "b[0]", events.GetEvent("B1"), "b[1]", events.GetEvent("B2")); testCaseList.AddTest(testCase); testCase = new EventExpressionCase("(a=A until b=B) until c=C"); testCase.Add("C1", "a[0]", events.GetEvent("A1"), "b[0]", events.GetEvent("B1"), "c", events.GetEvent("C1")); testCaseList.AddTest(testCase); testCase = new EventExpressionCase("(a=A until b=B) until g=G"); testCase.Add("G1", new Object[][] { new Object[] { "a[0]", events.GetEvent("A1") }, new Object[] { "b[0]", events.GetEvent("B1") }, new Object[] { "a[1]", events.GetEvent("A2") }, new Object[] { "b[1]", events.GetEvent("B2") }, new Object[] { "b[2]", events.GetEvent("B3") }, new Object[] { "g", events.GetEvent("G1") } }); testCaseList.AddTest(testCase); testCase = new EventExpressionCase("B until not B"); testCaseList.AddTest(testCase); PatternTestHarness util = new PatternTestHarness(events, testCaseList, GetType(), GetType().FullName); util.RunTest(); }
public void TestOp() { EventCollection events = EventCollectionFactory.GetEventSetOne(0, 1000); CaseList 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); String text = "select * from pattern [timer:interval(1.999)]"; EPStatementObjectModel model = new EPStatementObjectModel(); model.SelectClause = SelectClause.CreateWildcard(); PatternExpr pattern = Patterns.TimerInterval(1.999d); model.FromClause = FromClause.Create(PatternStream.Create(pattern)); model = (EPStatementObjectModel)SerializableObjectCopier.Copy(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=" + EVENT_B_CLASS); testCase.Add("B2", "b", events.GetEvent("B2")); testCaseList.AddTest(testCase); testCase = new EventExpressionCase("timer:interval(4 sec) -> b=" + EVENT_B_CLASS); testCase.Add("B2", "b", events.GetEvent("B2")); testCaseList.AddTest(testCase); testCase = new EventExpressionCase("timer:interval(4.001 sec) -> b=" + EVENT_B_CLASS); testCase.Add("B3", "b", events.GetEvent("B3")); testCaseList.AddTest(testCase); testCase = new EventExpressionCase("timer:interval(0) -> b=" + EVENT_B_CLASS); testCase.Add("B1", "b", events.GetEvent("B1")); testCaseList.AddTest(testCase); // Try with an followed-by as a second argument testCase = new EventExpressionCase("b=" + EVENT_B_CLASS + " -> timer:interval(0.001)"); testCase.Add("C1", "b", events.GetEvent("B1")); testCaseList.AddTest(testCase); testCase = new EventExpressionCase("b=" + EVENT_B_CLASS + " -> timer:interval(0)"); testCase.Add("B1", "b", events.GetEvent("B1")); testCaseList.AddTest(testCase); testCase = new EventExpressionCase("b=" + EVENT_B_CLASS + " -> timer:interval(1 sec)"); testCase.Add("C1", "b", events.GetEvent("B1")); testCaseList.AddTest(testCase); testCase = new EventExpressionCase("b=" + EVENT_B_CLASS + " -> 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=" + EVENT_B_CLASS + "() -> timer:interval(6.000) -> d=" + EVENT_D_CLASS); testCase.Add("D2", "b", events.GetEvent("B1"), "d", events.GetEvent("D2")); testCaseList.AddTest(testCase); testCase = new EventExpressionCase("every (b=" + EVENT_B_CLASS + "() -> timer:interval(2.001) -> 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 + "() -> timer:interval(2.000) -> d=" + EVENT_D_CLASS + "())"); 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=" + EVENT_B_CLASS + "() or timer:interval(1.001)"); testCase.Add("B1"); testCaseList.AddTest(testCase); testCase = new EventExpressionCase("b=" + EVENT_B_CLASS + "() or timer:interval(2.001)"); testCase.Add("B1", "b", events.GetEvent("B1")); testCaseList.AddTest(testCase); testCase = new EventExpressionCase("b=" + EVENT_B_CLASS + "(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=" + EVENT_G_CLASS); testCase.Add("G1", "g", events.GetEvent("G1")); testCaseList.AddTest(testCase); // Try with an "and" testCase = new EventExpressionCase("b=" + EVENT_B_CLASS + "() and timer:interval(4000 msec)"); testCase.Add("B2", "b", events.GetEvent("B1")); testCaseList.AddTest(testCase); testCase = new EventExpressionCase("b=" + EVENT_B_CLASS + "() and timer:interval(4001 msec)"); testCase.Add("A2", "b", events.GetEvent("B1")); testCaseList.AddTest(testCase); testCase = new EventExpressionCase("timer:interval(9999999 msec) and b=" + EVENT_B_CLASS); testCaseList.AddTest(testCase); testCase = new EventExpressionCase("timer:interval(1 msec) and b=" + EVENT_B_CLASS + "(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 PatternTestHarness util = new PatternTestHarness(events, testCaseList, GetType(), GetType().FullName); util.RunTest(); }
public void TestOp() { var dateTime = MakeDateTime(2005, 3, 9, 8, 0, 0, 0); var startTime = dateTime.TimeInMillis(); // Start a 2004-12-09 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=" + EVENT_B_CLASS + "(id='B3') -> timer:at(20, 9, *, *, *, *)"); testCaseList.AddTest(testCase); testCase = new EventExpressionCase("b=" + EVENT_B_CLASS + "(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=" + EVENT_D_CLASS); testCase.Add("D1", "d", testData.GetEvent("D1")); testCaseList.AddTest(testCase); testCase = new EventExpressionCase("timer:at(*, 9, *, *, *, 59) -> d=" + EVENT_D_CLASS); testCase.Add("D2", "d", testData.GetEvent("D2")); testCaseList.AddTest(testCase); testCase = new EventExpressionCase("timer:at(22, 8, *, *, *) -> b=" + EVENT_B_CLASS + "(id='B3') -> timer:at(55, *, *, *, *)"); testCase.Add("D3", "b", testData.GetEvent("B3")); testCaseList.AddTest(testCase); testCase = new EventExpressionCase("timer:at(40, *, *, *, *, 1) and b=" + EVENT_B_CLASS); testCase.Add("A2", "b", testData.GetEvent("B1")); testCaseList.AddTest(testCase); testCase = new EventExpressionCase("timer:at(40, 9, *, *, *, 1) or d=" + EVENT_D_CLASS + "(id=\"D3\")"); testCase.Add("G1"); testCaseList.AddTest(testCase); testCase = new EventExpressionCase("timer:at(22, 8, *, *, *) -> b=" + EVENT_B_CLASS + "() -> 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=" + EVENT_B_CLASS); testCase.Add("A2", "b", testData.GetEvent("B1")); testCaseList.AddTest(testCase); const string text = "select * from pattern [timer:at(10,8,*,*,*,*)]"; var model = new EPStatementObjectModel(); model.SelectClause = SelectClause.CreateWildcard(); var pattern = Patterns.TimerAt(10, 8, null, null, null, null); model.FromClause = FromClause.Create(PatternStream.Create(pattern)); model = (EPStatementObjectModel)SerializableObjectCopier.Copy(model); Assert.AreEqual(text, model.ToEPL()); testCase = new EventExpressionCase(model); testCase.Add("A1"); testCaseList.AddTest(testCase); // As of release 1.6 this no longer updates listeners when the statement is started. // The reason is that the dispatch view only gets attached after a pattern started, // therefore ZeroDepthEventStream looses the event. There should be no use case requiring this: // // testCase = new EventExpressionCase("not timer:at(22, 8, *, *, *, 1)"); // testCase.Add(EventCollection.ON_START_EVENT_ID); // testCaseList.AddTest(testCase); // Run all tests var util = new PatternTestHarness(testData, testCaseList, GetType(), GetType().FullName); util.RunTest(); }
public void Run(RegressionEnvironment env) { var events = EventCollectionFactory.GetSetThreeExternalClock(0, 1000); var testCaseList = new CaseList(); EventExpressionCase testCase; testCase = new EventExpressionCase( "na=SupportBean_N -> nb=SupportBean_N(DoublePrimitive = na.DoublePrimitive)"); testCase.Add("N6", "na", events.GetEvent("N1"), "nb", events.GetEvent("N6")); testCaseList.AddTest(testCase); testCase = new EventExpressionCase( "na=SupportBean_N(IntPrimitive=87) -> nb=SupportBean_N(IntPrimitive > na.IntPrimitive)"); testCase.Add("N8", "na", events.GetEvent("N3"), "nb", events.GetEvent("N8")); testCaseList.AddTest(testCase); testCase = new EventExpressionCase( "na=SupportBean_N(IntPrimitive=87) -> nb=SupportBean_N(IntPrimitive < na.IntPrimitive)"); testCase.Add("N4", "na", events.GetEvent("N3"), "nb", events.GetEvent("N4")); testCaseList.AddTest(testCase); testCase = new EventExpressionCase( "na=SupportBean_N(IntPrimitive=66) -> every nb=SupportBean_N(IntPrimitive >= na.IntPrimitive)"); testCase.Add("N3", "na", events.GetEvent("N2"), "nb", events.GetEvent("N3")); testCase.Add("N4", "na", events.GetEvent("N2"), "nb", events.GetEvent("N4")); testCase.Add("N8", "na", events.GetEvent("N2"), "nb", events.GetEvent("N8")); testCaseList.AddTest(testCase); testCase = new EventExpressionCase( "na=SupportBean_N(BoolBoxed=false) -> every nb=SupportBean_N(BoolPrimitive = na.BoolPrimitive)"); testCase.Add("N4", "na", events.GetEvent("N2"), "nb", events.GetEvent("N4")); testCase.Add("N5", "na", events.GetEvent("N2"), "nb", events.GetEvent("N5")); testCase.Add("N8", "na", events.GetEvent("N2"), "nb", events.GetEvent("N8")); testCaseList.AddTest(testCase); testCase = new EventExpressionCase( "every na=SupportBean_N -> every nb=SupportBean_N(IntPrimitive=na.IntPrimitive)"); testCaseList.AddTest(testCase); testCase = new EventExpressionCase( "every na=SupportBean_N() -> every nb=SupportBean_N(DoublePrimitive=na.DoublePrimitive)"); testCase.Add("N5", "na", events.GetEvent("N2"), "nb", events.GetEvent("N5")); testCase.Add("N6", "na", events.GetEvent("N1"), "nb", events.GetEvent("N6")); testCaseList.AddTest(testCase); testCase = new EventExpressionCase( "every na=SupportBean_N(BoolBoxed=false) -> every nb=SupportBean_N(BoolBoxed=na.BoolBoxed)"); testCase.Add("N5", "na", events.GetEvent("N2"), "nb", events.GetEvent("N5")); testCase.Add("N8", "na", events.GetEvent("N2"), "nb", events.GetEvent("N8")); testCase.Add("N8", "na", events.GetEvent("N5"), "nb", events.GetEvent("N8")); testCaseList.AddTest(testCase); testCase = new EventExpressionCase( "na=SupportBean_N(BoolBoxed=false) -> nb=SupportBean_N(IntPrimitive<na.IntPrimitive)" + " -> nc=SupportBean_N(IntPrimitive > nb.IntPrimitive)"); testCase.Add( "N6", "na", events.GetEvent("N2"), "nb", events.GetEvent("N5"), "nc", events.GetEvent("N6")); testCaseList.AddTest(testCase); testCase = new EventExpressionCase( "na=SupportBean_N(IntPrimitive=86) -> nb=SupportBean_N(IntPrimitive<na.IntPrimitive)" + " -> nc=SupportBean_N(IntPrimitive > na.IntPrimitive)"); testCase.Add( "N8", "na", events.GetEvent("N4"), "nb", events.GetEvent("N5"), "nc", events.GetEvent("N8")); testCaseList.AddTest(testCase); testCase = new EventExpressionCase( "na=SupportBean_N(IntPrimitive=86) -> (nb=SupportBean_N(IntPrimitive<na.IntPrimitive)" + " or nc=SupportBean_N(IntPrimitive > na.IntPrimitive))"); testCase.Add("N5", "na", events.GetEvent("N4"), "nb", events.GetEvent("N5"), "nc", null); testCaseList.AddTest(testCase); testCase = new EventExpressionCase( "na=SupportBean_N(IntPrimitive=86) -> (nb=SupportBean_N(IntPrimitive>na.IntPrimitive)" + " or nc=SupportBean_N(IntBoxed < na.IntBoxed))"); testCase.Add("N8", "na", events.GetEvent("N4"), "nb", events.GetEvent("N8"), "nc", null); testCaseList.AddTest(testCase); testCase = new EventExpressionCase( "na=SupportBean_N(IntPrimitive=86) -> (nb=SupportBean_N(IntPrimitive>na.IntPrimitive)" + " and nc=SupportBean_N(IntBoxed < na.IntBoxed))"); testCaseList.AddTest(testCase); testCase = new EventExpressionCase( "na=SupportBean_N() -> every nb=SupportBean_N(DoublePrimitive in [0:na.DoublePrimitive])"); testCase.Add("N4", "na", events.GetEvent("N1"), "nb", events.GetEvent("N4")); testCase.Add("N6", "na", events.GetEvent("N1"), "nb", events.GetEvent("N6")); testCase.Add("N7", "na", events.GetEvent("N1"), "nb", events.GetEvent("N7")); testCaseList.AddTest(testCase); testCase = new EventExpressionCase( "na=SupportBean_N() -> every nb=SupportBean_N(DoublePrimitive in (0:na.DoublePrimitive))"); testCase.Add("N4", "na", events.GetEvent("N1"), "nb", events.GetEvent("N4")); testCase.Add("N7", "na", events.GetEvent("N1"), "nb", events.GetEvent("N7")); testCaseList.AddTest(testCase); testCase = new EventExpressionCase( "na=SupportBean_N() -> every nb=SupportBean_N(IntPrimitive in (na.IntPrimitive:na.DoublePrimitive))"); testCase.Add("N7", "na", events.GetEvent("N1"), "nb", events.GetEvent("N7")); testCaseList.AddTest(testCase); testCase = new EventExpressionCase( "na=SupportBean_N() -> every nb=SupportBean_N(IntPrimitive in (na.IntPrimitive:60))"); testCase.Add("N6", "na", events.GetEvent("N1"), "nb", events.GetEvent("N6")); testCase.Add("N7", "na", events.GetEvent("N1"), "nb", events.GetEvent("N7")); 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; testCase = new EventExpressionCase("b=SupportBean_B -> (d=SupportBean_D or not d=SupportBean_D)"); testCase.Add("B1", "b", events.GetEvent("B1"), "d", null); testCase.Add("D1", "b", events.GetEvent("B1"), "d", events.GetEvent("D1")); testCaseList.AddTest(testCase); testCase = new EventExpressionCase("b=SupportBean_B -[1000]> (d=SupportBean_D or not d=SupportBean_D)"); testCase.Add("B1", "b", events.GetEvent("B1"), "d", null); testCase.Add("D1", "b", events.GetEvent("B1"), "d", events.GetEvent("D1")); testCaseList.AddTest(testCase); testCase = new EventExpressionCase("b=SupportBean_B -> 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("b=SupportBean_B -> d=SupportBean_D"); testCase.Add("D1", "b", events.GetEvent("B1"), "d", events.GetEvent("D1")); testCaseList.AddTest(testCase); testCase = new EventExpressionCase("b=SupportBean_B -> not d=SupportBean_D"); testCase.Add("B1", "b", events.GetEvent("B1")); testCaseList.AddTest(testCase); testCase = new EventExpressionCase("b=SupportBean_B -[1000]> not d=SupportBean_D"); testCase.Add("B1", "b", events.GetEvent("B1")); testCaseList.AddTest(testCase); testCase = new EventExpressionCase("every b=SupportBean_B -> 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("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 -> 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("D3", "b", events.GetEvent("B3"), "d", events.GetEvent("D3")); testCaseList.AddTest(testCase); testCase = new EventExpressionCase("every b=SupportBean_B -[10]> 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("D3", "b", events.GetEvent("B3"), "d", events.GetEvent("D3")); testCaseList.AddTest(testCase); testCase = new EventExpressionCase("every (b=SupportBean_B -> 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")); 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 (a_1=SupportBean_A() -> b=SupportBean_B -> a_2=SupportBean_A)"); testCase.Add( "A2", "a_1", events.GetEvent("A1"), "b", events.GetEvent("B1"), "a_2", events.GetEvent("A2")); testCaseList.AddTest(testCase); testCase = new EventExpressionCase("c=SupportBean_C() -> d=SupportBean_D -> a=SupportBean_A"); testCaseList.AddTest(testCase); testCase = new EventExpressionCase( "every (a_1=SupportBean_A() -> b=SupportBean_B() -> a_2=SupportBean_A())"); testCase.Add( "A2", "a_1", events.GetEvent("A1"), "b", events.GetEvent("B1"), "a_2", events.GetEvent("A2")); testCaseList.AddTest(testCase); testCase = new EventExpressionCase( "every (a_1=SupportBean_A() -[10]> b=SupportBean_B() -[10]> a_2=SupportBean_A())"); testCase.Add( "A2", "a_1", events.GetEvent("A1"), "b", events.GetEvent("B1"), "a_2", events.GetEvent("A2")); testCaseList.AddTest(testCase); testCase = new EventExpressionCase("every ( every a=SupportBean_A -> every b=SupportBean_B)"); testCase.Add("B1", "a", events.GetEvent("A1"), "b", events.GetEvent("B1")); testCase.Add("B2", "a", events.GetEvent("A1"), "b", events.GetEvent("B2")); testCase.Add("B3", "a", events.GetEvent("A1"), "b", events.GetEvent("B3")); testCase.Add("B3", "a", events.GetEvent("A2"), "b", events.GetEvent("B3")); testCase.Add("B3", "a", events.GetEvent("A2"), "b", events.GetEvent("B3")); testCase.Add("B3", "a", events.GetEvent("A2"), "b", events.GetEvent("B3")); testCaseList.AddTest(testCase); testCase = new EventExpressionCase("every (a=SupportBean_A() -> every b=SupportBean_B())"); testCase.Add("B1", "a", events.GetEvent("A1"), "b", events.GetEvent("B1")); testCase.Add("B2", "a", events.GetEvent("A1"), "b", events.GetEvent("B2")); testCase.Add("B3", "a", events.GetEvent("A1"), "b", events.GetEvent("B3")); testCase.Add("B3", "a", events.GetEvent("A2"), "b", events.GetEvent("B3")); testCase.Add("B3", "a", events.GetEvent("A2"), "b", events.GetEvent("B3")); 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; // 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); }
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(); }
public void TestOp() { EventCollection events = EventCollectionFactory.GetEventSetOne(0, 1000); var testCaseList = new CaseList(); var testCase = new EventExpressionCase("b=" + EVENT_B_CLASS + " -> (d=" + EVENT_D_CLASS + " or not d=" + EVENT_D_CLASS + ")"); testCase.Add("B1", "b", events.GetEvent("B1"), "d", null); testCase.Add("D1", "b", events.GetEvent("B1"), "d", events.GetEvent("D1")); testCaseList.AddTest(testCase); testCase = new EventExpressionCase("b=" + EVENT_B_CLASS + " -[1000]> (d=" + EVENT_D_CLASS + " or not d=" + EVENT_D_CLASS + ")"); testCase.Add("B1", "b", events.GetEvent("B1"), "d", null); testCase.Add("D1", "b", events.GetEvent("B1"), "d", events.GetEvent("D1")); testCaseList.AddTest(testCase); testCase = new EventExpressionCase("b=" + EVENT_B_CLASS + " -> 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("b=" + EVENT_B_CLASS + " -> d=" + EVENT_D_CLASS); testCase.Add("D1", "b", events.GetEvent("B1"), "d", events.GetEvent("D1")); testCaseList.AddTest(testCase); testCase = new EventExpressionCase("b=" + EVENT_B_CLASS + " -> not d=" + EVENT_D_CLASS); testCase.Add("B1", "b", events.GetEvent("B1")); testCaseList.AddTest(testCase); testCase = new EventExpressionCase("b=" + EVENT_B_CLASS + " -[1000]> not d=" + EVENT_D_CLASS); testCase.Add("B1", "b", events.GetEvent("B1")); testCaseList.AddTest(testCase); testCase = new EventExpressionCase("every b=" + EVENT_B_CLASS + " -> 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("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 + " -> 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("D3", "b", events.GetEvent("B3"), "d", events.GetEvent("D3")); testCaseList.AddTest(testCase); testCase = new EventExpressionCase("every b=" + EVENT_B_CLASS + " -[10]> 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("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 + ")"); 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")); 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 (a_1=" + EVENT_A_CLASS + "() -> b=" + EVENT_B_CLASS + " -> a_2=" + EVENT_A_CLASS + ")"); testCase.Add("A2", "a_1", events.GetEvent("A1"), "b", events.GetEvent("B1"), "a_2", events.GetEvent("A2")); testCaseList.AddTest(testCase); testCase = new EventExpressionCase("c=" + EVENT_C_CLASS + "() -> d=" + EVENT_D_CLASS + " -> a=" + EVENT_A_CLASS); testCaseList.AddTest(testCase); testCase = new EventExpressionCase("every (a_1=" + EVENT_A_CLASS + "() -> b=" + EVENT_B_CLASS + "() -> a_2=" + EVENT_A_CLASS + "())"); testCase.Add("A2", "a_1", events.GetEvent("A1"), "b", events.GetEvent("B1"), "a_2", events.GetEvent("A2")); testCaseList.AddTest(testCase); testCase = new EventExpressionCase("every (a_1=" + EVENT_A_CLASS + "() -[10]> b=" + EVENT_B_CLASS + "() -[10]> a_2=" + EVENT_A_CLASS + "())"); testCase.Add("A2", "a_1", events.GetEvent("A1"), "b", events.GetEvent("B1"), "a_2", events.GetEvent("A2")); testCaseList.AddTest(testCase); testCase = new EventExpressionCase("every ( every a=" + EVENT_A_CLASS + " -> every b=" + EVENT_B_CLASS + ")"); testCase.Add("B1", "a", events.GetEvent("A1"), "b", events.GetEvent("B1")); testCase.Add("B2", "a", events.GetEvent("A1"), "b", events.GetEvent("B2")); testCase.Add("B3", "a", events.GetEvent("A1"), "b", events.GetEvent("B3")); testCase.Add("B3", "a", events.GetEvent("A2"), "b", events.GetEvent("B3")); testCase.Add("B3", "a", events.GetEvent("A2"), "b", events.GetEvent("B3")); testCase.Add("B3", "a", events.GetEvent("A2"), "b", events.GetEvent("B3")); testCaseList.AddTest(testCase); testCase = new EventExpressionCase("every (a=" + EVENT_A_CLASS + "() -> every b=" + EVENT_B_CLASS + "())"); testCase.Add("B1", "a", events.GetEvent("A1"), "b", events.GetEvent("B1")); testCase.Add("B2", "a", events.GetEvent("A1"), "b", events.GetEvent("B2")); testCase.Add("B3", "a", events.GetEvent("A1"), "b", events.GetEvent("B3")); testCase.Add("B3", "a", events.GetEvent("A2"), "b", events.GetEvent("B3")); testCase.Add("B3", "a", events.GetEvent("A2"), "b", events.GetEvent("B3")); testCaseList.AddTest(testCase); var util = new PatternTestHarness(events, testCaseList, GetType(), GetType().FullName); util.RunTest(); }
public void TestInterfacedEvents() { EventCollection events = EventCollectionFactory.GetSetFiveInterfaces(); CaseList testCaseList = new CaseList(); EventExpressionCase testCase = null; testCase = new EventExpressionCase("c=" + INTERFACE_C); testCase.Add("e1", "c", events.GetEvent("e1")); testCaseList.AddTest(testCase); testCase = new EventExpressionCase("baseab=" + INTERFACE_BASE_AB); testCase.Add("e2", "baseab", events.GetEvent("e2")); testCaseList.AddTest(testCase); testCase = new EventExpressionCase("every a=" + INTERFACE_A); testCase.Add("e2", "a", events.GetEvent("e2")); testCase.Add("e3", "a", events.GetEvent("e3")); testCase.Add("e12", "a", events.GetEvent("e12")); testCase.Add("e13", "a", events.GetEvent("e13")); testCaseList.AddTest(testCase); testCase = new EventExpressionCase("every a=" + INTERFACE_B); testCase.Add("e2", "a", events.GetEvent("e2")); testCase.Add("e4", "a", events.GetEvent("e4")); testCase.Add("e6", "a", events.GetEvent("e6")); testCase.Add("e12", "a", events.GetEvent("e12")); testCaseList.AddTest(testCase); testCase = new EventExpressionCase("every a=" + INTERFACE_B + "(B='B1')"); testCase.Add("e2", "a", events.GetEvent("e2")); testCase.Add("e4", "a", events.GetEvent("e4")); testCaseList.AddTest(testCase); testCase = new EventExpressionCase("every a=" + INTERFACE_A + "(A='A3')"); testCase.Add("e12", "a", events.GetEvent("e12")); testCaseList.AddTest(testCase); testCase = new EventExpressionCase("every a=" + INTERFACE_C + "(C='C2')"); testCase.Add("e6", "a", events.GetEvent("e6")); testCase.Add("e12", "a", events.GetEvent("e12")); testCaseList.AddTest(testCase); testCase = new EventExpressionCase("every a=" + INTERFACE_C + "(C='C1')"); testCase.Add("e1", "a", events.GetEvent("e1")); testCase.Add("e2", "a", events.GetEvent("e2")); testCaseList.AddTest(testCase); testCase = new EventExpressionCase("every a=" + INTERFACE_D + "(D='D1')"); testCase.Add("e5", "a", events.GetEvent("e5")); testCaseList.AddTest(testCase); testCase = new EventExpressionCase("every a=" + INTERFACE_BASE_D + "(BaseD='BaseD')"); testCase.Add("e5", "a", events.GetEvent("e5")); testCaseList.AddTest(testCase); testCase = new EventExpressionCase("every a=" + INTERFACE_BASE_D_BASE + "(BaseDBase='BaseDBase')"); testCase.Add("e5", "a", events.GetEvent("e5")); testCaseList.AddTest(testCase); testCase = new EventExpressionCase("every a=" + INTERFACE_D + "(D='D1', BaseD='BaseD', BaseDBase='BaseDBase')"); testCase.Add("e5", "a", events.GetEvent("e5")); testCaseList.AddTest(testCase); testCase = new EventExpressionCase("every a=" + INTERFACE_BASE_D + "(BaseD='BaseD', BaseDBase='BaseDBase')"); testCase.Add("e5", "a", events.GetEvent("e5")); testCaseList.AddTest(testCase); testCase = new EventExpressionCase("every a=" + SUPER_G); testCase.Add("e12", "a", events.GetEvent("e12")); testCase.Add("e13", "a", events.GetEvent("e13")); testCaseList.AddTest(testCase); testCase = new EventExpressionCase("every a=" + SUPER_G + "(G='G1')"); testCase.Add("e12", "a", events.GetEvent("e12")); testCaseList.AddTest(testCase); testCase = new EventExpressionCase("every a=" + SUPER_G + "(BaseAB='BaseAB5')"); testCase.Add("e13", "a", events.GetEvent("e13")); testCaseList.AddTest(testCase); testCase = new EventExpressionCase("every a=" + SUPER_G + "(BaseAB='BaseAB4', G='G1', A='A3')"); testCase.Add("e12", "a", events.GetEvent("e12")); testCaseList.AddTest(testCase); testCase = new EventExpressionCase("every a=" + SUPER_G_IMPL + "(BaseAB='BaseAB4', G='G1', A='A3', B='B4', C='C2')"); testCase.Add("e12", "a", events.GetEvent("e12")); testCaseList.AddTest(testCase); testCase = new EventExpressionCase("every a=" + OVERRIDE_BASE); testCase.Add("e8", "a", events.GetEvent("e8")); testCase.Add("e9", "a", events.GetEvent("e9")); testCase.Add("e10", "a", events.GetEvent("e10")); testCase.Add("e11", "a", events.GetEvent("e11")); testCaseList.AddTest(testCase); testCase = new EventExpressionCase("every a=" + OVERRIDE_ONE); testCase.Add("e8", "a", events.GetEvent("e8")); testCase.Add("e9", "a", events.GetEvent("e9")); testCase.Add("e10", "a", events.GetEvent("e10")); testCaseList.AddTest(testCase); testCase = new EventExpressionCase("every a=" + OVERRIDE_ONEA); testCase.Add("e8", "a", events.GetEvent("e8")); testCaseList.AddTest(testCase); testCase = new EventExpressionCase("every a=" + OVERRIDE_ONEB); testCase.Add("e9", "a", events.GetEvent("e9")); testCaseList.AddTest(testCase); testCase = new EventExpressionCase("every a=" + OVERRIDE_BASE + "(Val='OB1')"); testCase.Add("e9", "a", events.GetEvent("e9")); testCaseList.AddTest(testCase); testCase = new EventExpressionCase("every a=" + OVERRIDE_BASE + "(Val='O3')"); testCase.Add("e10", "a", events.GetEvent("e10")); testCaseList.AddTest(testCase); testCase = new EventExpressionCase("every a=" + OVERRIDE_BASE + "(Val='OBase')"); testCase.Add("e11", "a", events.GetEvent("e11")); testCaseList.AddTest(testCase); testCase = new EventExpressionCase("every a=" + OVERRIDE_BASE + "(Val='O2')"); testCaseList.AddTest(testCase); testCase = new EventExpressionCase("every a=" + OVERRIDE_ONE + "(Val='OA1')"); testCase.Add("e8", "a", events.GetEvent("e8")); testCaseList.AddTest(testCase); testCase = new EventExpressionCase("every a=" + OVERRIDE_ONE + "(Val='O3')"); testCase.Add("e10", "a", events.GetEvent("e10")); testCaseList.AddTest(testCase); PatternTestHarness util = new PatternTestHarness(events, testCaseList, GetType(), GetType().FullName); util.RunTest(); }
private void RunAssertionComplexProperties(EPServiceProvider epService) { EventCollection events = EventCollectionFactory.GetSetSixComplexProperties(); var testCaseList = new CaseList(); EventExpressionCase testCase; testCase = new EventExpressionCase("s=" + EVENT_COMPLEX + "(Mapped('keyOne') = 'valueOne')"); testCase.Add("e1", "s", events.GetEvent("e1")); testCaseList.AddTest(testCase); testCase = new EventExpressionCase("s=" + EVENT_COMPLEX + "(Indexed[1] = 2)"); testCase.Add("e1", "s", events.GetEvent("e1")); testCaseList.AddTest(testCase); testCase = new EventExpressionCase("s=" + EVENT_COMPLEX + "(Indexed[0] = 2)"); testCaseList.AddTest(testCase); testCase = new EventExpressionCase("s=" + EVENT_COMPLEX + "(ArrayProperty[1] = 20)"); testCase.Add("e1", "s", events.GetEvent("e1")); testCaseList.AddTest(testCase); testCase = new EventExpressionCase("s=" + EVENT_COMPLEX + "(ArrayProperty[1] in (10:30))"); testCase.Add("e1", "s", events.GetEvent("e1")); testCaseList.AddTest(testCase); testCase = new EventExpressionCase("s=" + EVENT_COMPLEX + "(ArrayProperty[2] = 20)"); testCaseList.AddTest(testCase); testCase = new EventExpressionCase("s=" + EVENT_COMPLEX + "(Nested.NestedValue = 'NestedValue')"); testCase.Add("e1", "s", events.GetEvent("e1")); testCaseList.AddTest(testCase); testCase = new EventExpressionCase("s=" + EVENT_COMPLEX + "(Nested.NestedValue = 'dummy')"); testCaseList.AddTest(testCase); testCase = new EventExpressionCase("s=" + EVENT_COMPLEX + "(Nested.NestedNested.NestedNestedValue = 'NestedNestedValue')"); testCase.Add("e1", "s", events.GetEvent("e1")); testCaseList.AddTest(testCase); testCase = new EventExpressionCase("s=" + EVENT_COMPLEX + "(Nested.NestedNested.NestedNestedValue = 'x')"); testCaseList.AddTest(testCase); testCase = new EventExpressionCase("s=" + EVENT_NESTED + "(Indexed[1].Mapped('1mb').Value = '1ma1')"); testCase.Add("e2", "s", events.GetEvent("e2")); testCaseList.AddTest(testCase); testCase = new EventExpressionCase("s=" + EVENT_NESTED + "(Indexed[0].Mapped('1ma').Value = 'x')"); testCaseList.AddTest(testCase); testCase = new EventExpressionCase("s=" + EVENT_NESTED + "(Array[0].Mapped('0ma').Value = '0ma0')"); testCase.Add("e2", "s", events.GetEvent("e2")); testCaseList.AddTest(testCase); testCase = new EventExpressionCase("s=" + EVENT_NESTED + "(Array[2].Mapped('x').Value = 'x')"); testCaseList.AddTest(testCase); testCase = new EventExpressionCase("s=" + EVENT_NESTED + "(Array[879787].Mapped('x').Value = 'x')"); testCaseList.AddTest(testCase); testCase = new EventExpressionCase("s=" + EVENT_NESTED + "(Array[0].Mapped('xxx').Value = 'x')"); testCaseList.AddTest(testCase); var util = new PatternTestHarness(events, testCaseList, this.GetType()); util.RunTest(epService); }
public override void Run(EPServiceProvider epService) { EventCollection events = EventCollectionFactory.GetSetFiveInterfaces(); var testCaseList = new CaseList(); EventExpressionCase testCase = null; testCase = new EventExpressionCase("c=" + INTERFACE_C); testCase.Add("e1", "c", events.GetEvent("e1")); testCaseList.AddTest(testCase); testCase = new EventExpressionCase("baseab=" + INTERFACE_BASE_AB); testCase.Add("e2", "baseab", events.GetEvent("e2")); testCaseList.AddTest(testCase); testCase = new EventExpressionCase("every a=" + INTERFACE_A); testCase.Add("e2", "a", events.GetEvent("e2")); testCase.Add("e3", "a", events.GetEvent("e3")); testCase.Add("e12", "a", events.GetEvent("e12")); testCase.Add("e13", "a", events.GetEvent("e13")); testCaseList.AddTest(testCase); testCase = new EventExpressionCase("every a=" + INTERFACE_B); testCase.Add("e2", "a", events.GetEvent("e2")); testCase.Add("e4", "a", events.GetEvent("e4")); testCase.Add("e6", "a", events.GetEvent("e6")); testCase.Add("e12", "a", events.GetEvent("e12")); testCaseList.AddTest(testCase); testCase = new EventExpressionCase("every a=" + INTERFACE_B + "(b='B1')"); testCase.Add("e2", "a", events.GetEvent("e2")); testCase.Add("e4", "a", events.GetEvent("e4")); testCaseList.AddTest(testCase); testCase = new EventExpressionCase("every a=" + INTERFACE_A + "(a='A3')"); testCase.Add("e12", "a", events.GetEvent("e12")); testCaseList.AddTest(testCase); testCase = new EventExpressionCase("every a=" + INTERFACE_C + "(c='C2')"); testCase.Add("e6", "a", events.GetEvent("e6")); testCase.Add("e12", "a", events.GetEvent("e12")); testCaseList.AddTest(testCase); testCase = new EventExpressionCase("every a=" + INTERFACE_C + "(c='C1')"); testCase.Add("e1", "a", events.GetEvent("e1")); testCase.Add("e2", "a", events.GetEvent("e2")); testCaseList.AddTest(testCase); testCase = new EventExpressionCase("every a=" + INTERFACE_D + "(d='D1')"); testCase.Add("e5", "a", events.GetEvent("e5")); testCaseList.AddTest(testCase); testCase = new EventExpressionCase("every a=" + INTERFACE_BASE_D + "(baseD='BaseD')"); testCase.Add("e5", "a", events.GetEvent("e5")); testCaseList.AddTest(testCase); testCase = new EventExpressionCase("every a=" + INTERFACE_BASE_D_BASE + "(baseDBase='BaseDBase')"); testCase.Add("e5", "a", events.GetEvent("e5")); testCaseList.AddTest(testCase); testCase = new EventExpressionCase("every a=" + INTERFACE_D + "(d='D1', baseD='BaseD', baseDBase='BaseDBase')"); testCase.Add("e5", "a", events.GetEvent("e5")); testCaseList.AddTest(testCase); testCase = new EventExpressionCase("every a=" + INTERFACE_BASE_D + "(baseD='BaseD', baseDBase='BaseDBase')"); testCase.Add("e5", "a", events.GetEvent("e5")); testCaseList.AddTest(testCase); testCase = new EventExpressionCase("every a=" + SUPER_G); testCase.Add("e12", "a", events.GetEvent("e12")); testCase.Add("e13", "a", events.GetEvent("e13")); testCaseList.AddTest(testCase); testCase = new EventExpressionCase("every a=" + SUPER_G + "(g='G1')"); testCase.Add("e12", "a", events.GetEvent("e12")); testCaseList.AddTest(testCase); testCase = new EventExpressionCase("every a=" + SUPER_G + "(baseAB='BaseAB5')"); testCase.Add("e13", "a", events.GetEvent("e13")); testCaseList.AddTest(testCase); testCase = new EventExpressionCase("every a=" + SUPER_G + "(baseAB='BaseAB4', g='G1', a='A3')"); testCase.Add("e12", "a", events.GetEvent("e12")); testCaseList.AddTest(testCase); testCase = new EventExpressionCase("every a=" + SUPER_G_IMPL + "(baseAB='BaseAB4', g='G1', a='A3', b='B4', c='C2')"); testCase.Add("e12", "a", events.GetEvent("e12")); testCaseList.AddTest(testCase); testCase = new EventExpressionCase("every a=" + OVERRIDE_BASE); testCase.Add("e8", "a", events.GetEvent("e8")); testCase.Add("e9", "a", events.GetEvent("e9")); testCase.Add("e10", "a", events.GetEvent("e10")); testCase.Add("e11", "a", events.GetEvent("e11")); testCaseList.AddTest(testCase); testCase = new EventExpressionCase("every a=" + OVERRIDE_ONE); testCase.Add("e8", "a", events.GetEvent("e8")); testCase.Add("e9", "a", events.GetEvent("e9")); testCase.Add("e10", "a", events.GetEvent("e10")); testCaseList.AddTest(testCase); testCase = new EventExpressionCase("every a=" + OVERRIDE_ONEA); testCase.Add("e8", "a", events.GetEvent("e8")); testCaseList.AddTest(testCase); testCase = new EventExpressionCase("every a=" + OVERRIDE_ONEB); testCase.Add("e9", "a", events.GetEvent("e9")); testCaseList.AddTest(testCase); testCase = new EventExpressionCase("every a=" + OVERRIDE_BASE + "(val='OB1')"); testCase.Add("e9", "a", events.GetEvent("e9")); testCaseList.AddTest(testCase); testCase = new EventExpressionCase("every a=" + OVERRIDE_BASE + "(val='O3')"); testCase.Add("e10", "a", events.GetEvent("e10")); testCaseList.AddTest(testCase); testCase = new EventExpressionCase("every a=" + OVERRIDE_BASE + "(val='OBase')"); testCase.Add("e11", "a", events.GetEvent("e11")); testCaseList.AddTest(testCase); testCase = new EventExpressionCase("every a=" + OVERRIDE_BASE + "(val='O2')"); testCaseList.AddTest(testCase); testCase = new EventExpressionCase("every a=" + OVERRIDE_ONE + "(val='OA1')"); testCase.Add("e8", "a", events.GetEvent("e8")); testCaseList.AddTest(testCase); testCase = new EventExpressionCase("every a=" + OVERRIDE_ONE + "(val='O3')"); testCase.Add("e10", "a", events.GetEvent("e10")); testCaseList.AddTest(testCase); var util = new PatternTestHarness(events, testCaseList, this.GetType()); util.RunTest(epService); }
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(); }
private void RunAssertionOp(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 + " or not d=" + EVENT_D_CLASS + ")"); testCase.Add("B1", "b", events.GetEvent("B1"), "d", null); testCase.Add("D1", "b", events.GetEvent("B1"), "d", events.GetEvent("D1")); testCaseList.AddTest(testCase); testCase = new EventExpressionCase("b=" + EVENT_B_CLASS + " -[1000]> (d=" + EVENT_D_CLASS + " or not d=" + EVENT_D_CLASS + ")"); testCase.Add("B1", "b", events.GetEvent("B1"), "d", null); testCase.Add("D1", "b", events.GetEvent("B1"), "d", events.GetEvent("D1")); testCaseList.AddTest(testCase); testCase = new EventExpressionCase("b=" + EVENT_B_CLASS + " -> 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("b=" + EVENT_B_CLASS + " -> d=" + EVENT_D_CLASS); testCase.Add("D1", "b", events.GetEvent("B1"), "d", events.GetEvent("D1")); testCaseList.AddTest(testCase); testCase = new EventExpressionCase("b=" + EVENT_B_CLASS + " -> not d=" + EVENT_D_CLASS); testCase.Add("B1", "b", events.GetEvent("B1")); testCaseList.AddTest(testCase); testCase = new EventExpressionCase("b=" + EVENT_B_CLASS + " -[1000]> not d=" + EVENT_D_CLASS); testCase.Add("B1", "b", events.GetEvent("B1")); testCaseList.AddTest(testCase); testCase = new EventExpressionCase("every b=" + EVENT_B_CLASS + " -> 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("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 + " -> 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("D3", "b", events.GetEvent("B3"), "d", events.GetEvent("D3")); testCaseList.AddTest(testCase); testCase = new EventExpressionCase("every b=" + EVENT_B_CLASS + " -[10]> 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("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 + ")"); 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")); 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 (a_1=" + EVENT_A_CLASS + "() -> b=" + EVENT_B_CLASS + " -> a_2=" + EVENT_A_CLASS + ")"); testCase.Add("A2", "a_1", events.GetEvent("A1"), "b", events.GetEvent("B1"), "a_2", events.GetEvent("A2")); testCaseList.AddTest(testCase); testCase = new EventExpressionCase("c=" + EVENT_C_CLASS + "() -> d=" + EVENT_D_CLASS + " -> a=" + EVENT_A_CLASS); testCaseList.AddTest(testCase); testCase = new EventExpressionCase("every (a_1=" + EVENT_A_CLASS + "() -> b=" + EVENT_B_CLASS + "() -> a_2=" + EVENT_A_CLASS + "())"); testCase.Add("A2", "a_1", events.GetEvent("A1"), "b", events.GetEvent("B1"), "a_2", events.GetEvent("A2")); testCaseList.AddTest(testCase); testCase = new EventExpressionCase("every (a_1=" + EVENT_A_CLASS + "() -[10]> b=" + EVENT_B_CLASS + "() -[10]> a_2=" + EVENT_A_CLASS + "())"); testCase.Add("A2", "a_1", events.GetEvent("A1"), "b", events.GetEvent("B1"), "a_2", events.GetEvent("A2")); testCaseList.AddTest(testCase); testCase = new EventExpressionCase("every ( every a=" + EVENT_A_CLASS + " -> every b=" + EVENT_B_CLASS + ")"); testCase.Add("B1", "a", events.GetEvent("A1"), "b", events.GetEvent("B1")); testCase.Add("B2", "a", events.GetEvent("A1"), "b", events.GetEvent("B2")); testCase.Add("B3", "a", events.GetEvent("A1"), "b", events.GetEvent("B3")); testCase.Add("B3", "a", events.GetEvent("A2"), "b", events.GetEvent("B3")); testCase.Add("B3", "a", events.GetEvent("A2"), "b", events.GetEvent("B3")); testCase.Add("B3", "a", events.GetEvent("A2"), "b", events.GetEvent("B3")); testCaseList.AddTest(testCase); testCase = new EventExpressionCase("every (a=" + EVENT_A_CLASS + "() -> every b=" + EVENT_B_CLASS + "())"); testCase.Add("B1", "a", events.GetEvent("A1"), "b", events.GetEvent("B1")); testCase.Add("B2", "a", events.GetEvent("A1"), "b", events.GetEvent("B2")); testCase.Add("B3", "a", events.GetEvent("A1"), "b", events.GetEvent("B3")); testCase.Add("B3", "a", events.GetEvent("A2"), "b", events.GetEvent("B3")); testCase.Add("B3", "a", events.GetEvent("A2"), "b", events.GetEvent("B3")); testCaseList.AddTest(testCase); var util = new PatternTestHarness(events, testCaseList, this.GetType()); util.RunTest(epService); }
private void RunAssertionOp(EPServiceProvider epService) { EventCollection events = EventCollectionFactory.GetEventSetOne(0, 1000); var testCaseList = new CaseList(); EventExpressionCase testCase; testCase = new EventExpressionCase("b=" + EVENT_B_CLASS + " and not d=" + EVENT_D_CLASS); testCase.Add("B1", "b", events.GetEvent("B1")); testCaseList.AddTest(testCase); string text = "select * from pattern [every b=" + EVENT_B_CLASS + " and not g=" + EVENT_G_CLASS + "]"; var model = new EPStatementObjectModel(); model.SelectClause = SelectClause.CreateWildcard(); PatternExpr pattern = Patterns.And() .Add(Patterns.EveryFilter(EVENT_B_CLASS, "b")) .Add(Patterns.NotFilter(EVENT_G_CLASS, "g")); model.FromClause = FromClause.Create(PatternStream.Create(pattern)); model = (EPStatementObjectModel)SerializableObjectCopier.Copy(epService.Container, 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=" + EVENT_B_CLASS + " and not g=" + EVENT_G_CLASS); 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 + " and not d=" + EVENT_D_CLASS); testCase.Add("B1", "b", events.GetEvent("B1")); testCase.Add("B2", "b", events.GetEvent("B2")); testCaseList.AddTest(testCase); testCase = new EventExpressionCase("b=" + EVENT_B_CLASS + " and not a=" + EVENT_A_CLASS + "(id='A1')"); testCaseList.AddTest(testCase); testCase = new EventExpressionCase("b=" + EVENT_B_CLASS + " and not a2=" + EVENT_A_CLASS + "(id='A2')"); testCase.Add("B1", "b", events.GetEvent("B1")); testCaseList.AddTest(testCase); testCase = new EventExpressionCase("every (b=" + EVENT_B_CLASS + " and not b3=" + EVENT_B_CLASS + "(id='B3'))"); 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 + " or not " + EVENT_D_CLASS + "())"); testCaseList.AddTest(testCase); testCase = new EventExpressionCase("every (every b=" + EVENT_B_CLASS + " and not " + EVENT_B_CLASS + "(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=" + EVENT_B_CLASS + " and not " + EVENT_B_CLASS + "(id='B2'))"); testCase.Add("B1", "b", events.GetEvent("B1")); testCase.Add("B3", "b", events.GetEvent("B3")); testCaseList.AddTest(testCase); testCase = new EventExpressionCase("(b=" + EVENT_B_CLASS + " -> d=" + EVENT_D_CLASS + ") and " + " not " + EVENT_A_CLASS); testCaseList.AddTest(testCase); testCase = new EventExpressionCase("(b=" + EVENT_B_CLASS + " -> d=" + EVENT_D_CLASS + ") and " + " not " + EVENT_G_CLASS); testCase.Add("D1", "b", events.GetEvent("B1"), "d", events.GetEvent("D1")); testCaseList.AddTest(testCase); testCase = new EventExpressionCase("every (b=" + EVENT_B_CLASS + " -> d=" + EVENT_D_CLASS + ") and " + " not " + EVENT_G_CLASS); testCase.Add("D1", "b", events.GetEvent("B1"), "d", events.GetEvent("D1")); testCaseList.AddTest(testCase); testCase = new EventExpressionCase("every (b=" + EVENT_B_CLASS + " -> d=" + EVENT_D_CLASS + ") and " + " not " + EVENT_G_CLASS + "(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, this.GetType()); util.RunTest(epService); }
public void TestNumeric() { string EVENT = typeof(SupportBean_N).FullName; EventCollection events = EventCollectionFactory.GetSetThreeExternalClock(0, 1000); CaseList testCaseList = new CaseList(); EventExpressionCase testCase = null; testCase = new EventExpressionCase("na=" + EVENT + " -> nb=" + EVENT + "(DoublePrimitive = na.DoublePrimitive)"); testCase.Add("N6", "na", events.GetEvent("N1"), "nb", events.GetEvent("N6")); testCaseList.AddTest(testCase); testCase = new EventExpressionCase("na=" + EVENT + "(IntPrimitive=87) -> nb=" + EVENT + "(IntPrimitive > na.IntPrimitive)"); testCase.Add("N8", "na", events.GetEvent("N3"), "nb", events.GetEvent("N8")); testCaseList.AddTest(testCase); testCase = new EventExpressionCase("na=" + EVENT + "(IntPrimitive=87) -> nb=" + EVENT + "(IntPrimitive < na.IntPrimitive)"); testCase.Add("N4", "na", events.GetEvent("N3"), "nb", events.GetEvent("N4")); testCaseList.AddTest(testCase); testCase = new EventExpressionCase("na=" + EVENT + "(IntPrimitive=66) -> every nb=" + EVENT + "(IntPrimitive >= na.IntPrimitive)"); testCase.Add("N3", "na", events.GetEvent("N2"), "nb", events.GetEvent("N3")); testCase.Add("N4", "na", events.GetEvent("N2"), "nb", events.GetEvent("N4")); testCase.Add("N8", "na", events.GetEvent("N2"), "nb", events.GetEvent("N8")); testCaseList.AddTest(testCase); testCase = new EventExpressionCase("na=" + EVENT + "(BoolBoxed=false) -> every nb=" + EVENT + "(BoolPrimitive = na.BoolPrimitive)"); testCase.Add("N4", "na", events.GetEvent("N2"), "nb", events.GetEvent("N4")); testCase.Add("N5", "na", events.GetEvent("N2"), "nb", events.GetEvent("N5")); testCase.Add("N8", "na", events.GetEvent("N2"), "nb", events.GetEvent("N8")); testCaseList.AddTest(testCase); testCase = new EventExpressionCase("every na=" + EVENT + " -> every nb=" + EVENT + "(IntPrimitive=na.IntPrimitive)"); testCaseList.AddTest(testCase); testCase = new EventExpressionCase("every na=" + EVENT + "() -> every nb=" + EVENT + "(DoublePrimitive=na.DoublePrimitive)"); testCase.Add("N5", "na", events.GetEvent("N2"), "nb", events.GetEvent("N5")); testCase.Add("N6", "na", events.GetEvent("N1"), "nb", events.GetEvent("N6")); testCaseList.AddTest(testCase); testCase = new EventExpressionCase("every na=" + EVENT + "(BoolBoxed=false) -> every nb=" + EVENT + "(BoolBoxed=na.BoolBoxed)"); testCase.Add("N5", "na", events.GetEvent("N2"), "nb", events.GetEvent("N5")); testCase.Add("N8", "na", events.GetEvent("N2"), "nb", events.GetEvent("N8")); testCase.Add("N8", "na", events.GetEvent("N5"), "nb", events.GetEvent("N8")); testCaseList.AddTest(testCase); testCase = new EventExpressionCase("na=" + EVENT + "(BoolBoxed=false) -> nb=" + EVENT + "(IntPrimitive<na.IntPrimitive)" + " -> nc=" + EVENT + "(IntPrimitive > nb.IntPrimitive)"); testCase.Add("N6", "na", events.GetEvent("N2"), "nb", events.GetEvent("N5"), "nc", events.GetEvent("N6")); testCaseList.AddTest(testCase); testCase = new EventExpressionCase("na=" + EVENT + "(IntPrimitive=86) -> nb=" + EVENT + "(IntPrimitive<na.IntPrimitive)" + " -> nc=" + EVENT + "(IntPrimitive > na.IntPrimitive)"); testCase.Add("N8", "na", events.GetEvent("N4"), "nb", events.GetEvent("N5"), "nc", events.GetEvent("N8")); testCaseList.AddTest(testCase); testCase = new EventExpressionCase("na=" + EVENT + "(IntPrimitive=86) -> (nb=" + EVENT + "(IntPrimitive<na.IntPrimitive)" + " or nc=" + EVENT + "(IntPrimitive > na.IntPrimitive))"); testCase.Add("N5", "na", events.GetEvent("N4"), "nb", events.GetEvent("N5"), "nc", null); testCaseList.AddTest(testCase); testCase = new EventExpressionCase("na=" + EVENT + "(IntPrimitive=86) -> (nb=" + EVENT + "(IntPrimitive>na.IntPrimitive)" + " or nc=" + EVENT + "(IntBoxed < na.IntBoxed))"); testCase.Add("N8", "na", events.GetEvent("N4"), "nb", events.GetEvent("N8"), "nc", null); testCaseList.AddTest(testCase); testCase = new EventExpressionCase("na=" + EVENT + "(IntPrimitive=86) -> (nb=" + EVENT + "(IntPrimitive>na.IntPrimitive)" + " and nc=" + EVENT + "(IntBoxed < na.IntBoxed))"); testCaseList.AddTest(testCase); testCase = new EventExpressionCase("na=" + EVENT + "() -> every nb=" + EVENT + "(DoublePrimitive in [0:na.DoublePrimitive])"); testCase.Add("N4", "na", events.GetEvent("N1"), "nb", events.GetEvent("N4")); testCase.Add("N6", "na", events.GetEvent("N1"), "nb", events.GetEvent("N6")); testCase.Add("N7", "na", events.GetEvent("N1"), "nb", events.GetEvent("N7")); testCaseList.AddTest(testCase); testCase = new EventExpressionCase("na=" + EVENT + "() -> every nb=" + EVENT + "(DoublePrimitive in (0:na.DoublePrimitive))"); testCase.Add("N4", "na", events.GetEvent("N1"), "nb", events.GetEvent("N4")); testCase.Add("N7", "na", events.GetEvent("N1"), "nb", events.GetEvent("N7")); testCaseList.AddTest(testCase); testCase = new EventExpressionCase("na=" + EVENT + "() -> every nb=" + EVENT + "(IntPrimitive in (na.IntPrimitive:na.DoublePrimitive))"); testCase.Add("N7", "na", events.GetEvent("N1"), "nb", events.GetEvent("N7")); testCaseList.AddTest(testCase); testCase = new EventExpressionCase("na=" + EVENT + "() -> every nb=" + EVENT + "(IntPrimitive in (na.IntPrimitive:60))"); testCase.Add("N6", "na", events.GetEvent("N1"), "nb", events.GetEvent("N6")); testCase.Add("N7", "na", events.GetEvent("N1"), "nb", events.GetEvent("N7")); testCaseList.AddTest(testCase); PatternTestHarness util = new PatternTestHarness(events, testCaseList, GetType(), GetType().FullName); util.RunTest(); }