private void miEditEvent_Click(object sender, RoutedEventArgs e) { ContextMenu cm = ((MenuItem)sender).Parent as ContextMenu; ListBoxItem lbi = cm.PlacementTarget as ListBoxItem; if (lbi == null) { return; } Guid targetGuid = (lbi.DataContext as IEvent).GUID; EventCollection ec = EventCollection.GetDataBase(); if (ec == null) { throw new Exception("Event database is not avalible."); } IEvent evnt = ec.GetEvent(targetGuid); WindowEventSetting winEventSetting = new WindowEventSetting(); winEventSetting.Owner = Calendar.Owner; winEventSetting.UpdateEvent += OnRecievingUpdatedEvent; winEventSetting.WindowStartupLocation = WindowStartupLocation.CenterScreen; winEventSetting.ShowEventSetting(evnt, DisplayMode.Edit); winEventSetting.Show(); }
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 RunAssertionOp(EPServiceProvider epService) { EventCollection events = EventCollectionFactory.GetEventSetOne(0, 1000); var testCaseList = new CaseList(); EventExpressionCase testCase = null; 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(epService.Container, 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, this.GetType()); util.RunTest(epService); }
private void miShowInfo_Click(object sender, RoutedEventArgs e) { ContextMenu cm = ((MenuItem)sender).Parent as ContextMenu; ListBoxItem lbi = cm.PlacementTarget as ListBoxItem; if (lbi == null) { return; } Guid targetGuid = (lbi.DataContext as IEvent).GUID; EventCollection ec = EventCollection.GetDataBase(); if (ec == null) { throw new Exception("Event database is not avalible."); } IEvent evnt = ec.GetEvent(targetGuid); DayContentSelectionEvent(evnt, SelectedDayContentActions.ShowInfo); }
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(); }
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(); }
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 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=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(); }
private void RunAssertionNumeric(EPServiceProvider epService) { string @event = typeof(SupportBean_N).FullName; EventCollection events = EventCollectionFactory.GetSetThreeExternalClock(0, 1000); var testCaseList = new CaseList(); EventExpressionCase testCase; 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); var util = new PatternTestHarness(events, testCaseList, 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 Event GetEvent(int id) { return(_events.GetEvent(id)); }
public override void Run(EPServiceProvider epService) { EventCollection events = EventCollectionFactory.GetEventSetOne(0, 1000); var testCaseList = new CaseList(); EventExpressionCase testCase; testCase = new EventExpressionCase("(b=" + EVENT_B_CLASS + " -> d=" + EVENT_D_CLASS + ") " + " and " + "(a=" + EVENT_A_CLASS + " -> e=" + EVENT_E_CLASS + ")" ); testCase.Add("E1", "b", events.GetEvent("B1"), "d", events.GetEvent("D1"), "a", events.GetEvent("A1"), "e", events.GetEvent("E1")); testCaseList.AddTest(testCase); testCase = new EventExpressionCase("b=" + EVENT_B_CLASS + " -> (d=" + EVENT_D_CLASS + "() or a=" + EVENT_A_CLASS + ")"); testCase.Add("A2", "b", events.GetEvent("B1"), "a", events.GetEvent("A2")); testCaseList.AddTest(testCase); var model = new EPStatementObjectModel(); model.SelectClause = SelectClause.CreateWildcard(); PatternExpr pattern = Patterns.FollowedBy( Patterns.Filter(EVENT_B_CLASS, "b"), Patterns.Or(Patterns.Filter(EVENT_D_CLASS, "d"), Patterns.Filter(EVENT_A_CLASS, "a"))); model.FromClause = FromClause.Create(PatternStream.Create(pattern)); model = (EPStatementObjectModel)SerializableObjectCopier.Copy(epService.Container, model); string text = "select * from pattern [b=" + EVENT_B_CLASS + " -> d=" + EVENT_D_CLASS + " or a=" + EVENT_A_CLASS + "]"; Assert.AreEqual(text, model.ToEPL()); testCase = new EventExpressionCase(model); testCase.Add("A2", "b", events.GetEvent("B1"), "a", events.GetEvent("A2")); testCaseList.AddTest(testCase); testCase = new EventExpressionCase("b=" + EVENT_B_CLASS + "() -> (" + "(d=" + EVENT_D_CLASS + "() -> a=" + EVENT_A_CLASS + "())" + " or " + "(a=" + EVENT_A_CLASS + "() -> e=" + EVENT_E_CLASS + "()))" ); testCase.Add("E1", "b", events.GetEvent("B1"), "a", events.GetEvent("A2"), "e", events.GetEvent("E1")); testCaseList.AddTest(testCase); testCase = new EventExpressionCase("b=" + EVENT_B_CLASS + "() and d=" + EVENT_D_CLASS + "() or a=" + EVENT_A_CLASS); testCase.Add("A1", "a", events.GetEvent("A1")); testCaseList.AddTest(testCase); testCase = new EventExpressionCase("(b=" + EVENT_B_CLASS + "() -> d=" + EVENT_D_CLASS + "()) or a=" + EVENT_A_CLASS); testCase.Add("A1", "a", events.GetEvent("A1")); testCaseList.AddTest(testCase); testCase = new EventExpressionCase("(b=" + EVENT_B_CLASS + "() and " + "d=" + EVENT_D_CLASS + "()) or " + "a=" + EVENT_A_CLASS); testCase.Add("A1", "a", events.GetEvent("A1")); testCaseList.AddTest(testCase); var util = new PatternTestHarness(events, testCaseList, this.GetType()); util.RunTest(epService); }
public override void Run(EPServiceProvider epService) { EventCollection events = EventCollectionFactory.GetEventSetOne(0, 1000); var testCaseList = new CaseList(); EventExpressionCase testCase; testCase = new EventExpressionCase("b=" + EVENT_B_CLASS + "(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); string 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(epService.Container, model); Expression filter = Expressions.Eq("id", "B3"); PatternExpr 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, this.GetType()); util.RunTest(epService); }
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(); }
private void RunAssertionOp(EPServiceProvider epService) { EventCollection events = EventCollectionFactory.GetEventSetOne(0, 1000); var 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); var util = new PatternTestHarness(events, testCaseList, this.GetType()); util.RunTest(epService); }
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(); }
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 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 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); }
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); }
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); }