private void RunAssertionMemoryRFIDEvent(EPServiceProvider epService) { epService.EPAdministrator.Configuration.AddEventType("LR", typeof(SupportRFIDEvent)); string expression = "select 'Tag May Be Broken' as alert, " + "tagMayBeBroken.mac, " + "tagMayBeBroken.zoneID " + "from pattern [" + "every tagMayBeBroken=LR -> (timer:interval(10 sec) and not LR(mac=tagMayBeBroken.mac))" + "]"; EPStatement statement = epService.EPAdministrator.CreateEPL(expression); var listener = new SupportUpdateListener(); statement.Events += listener.Update; for (int i = 0; i < 10; i++) { /* * if (i % 1000 == 0) * { * Log.Info(".testMemoryRFIDEvent now at " + i); * } */ var theEvent = new SupportRFIDEvent("a", "111"); epService.EPRuntime.SendEvent(theEvent); theEvent = new SupportRFIDEvent("a", "111"); epService.EPRuntime.SendEvent(theEvent); } statement.Dispose(); }
public void Run(RegressionEnvironment env) { // Every LR event with a zone of '1' activates a new sub-expression after // the followed-by operator. The sub-expression instance can end two different ways: // It ends when a LR for the same mac and a different exit-zone comes in, or // it ends when a LR for the same max and the same zone come in. The latter also starts the // sub-expression again. var expression = "@Name('s0') select * " + "from pattern [" + "every a=SupportRFIDEvent(ZoneID='1') -> (b=SupportRFIDEvent(Mac=a.Mac,ZoneID!='1') and not SupportRFIDEvent(Mac=a.Mac,ZoneID='1'))" + "]"; env.CompileDeploy(expression).AddListener("s0"); var theEvent = new SupportRFIDEvent("a", "1"); env.SendEventBean(theEvent); Assert.IsFalse(env.Listener("s0").IsInvoked); theEvent = new SupportRFIDEvent("a", "2"); env.SendEventBean(theEvent); Assert.AreEqual(theEvent, env.Listener("s0").AssertOneGetNewAndReset().Get("b")); theEvent = new SupportRFIDEvent("b", "1"); env.SendEventBean(theEvent); Assert.IsFalse(env.Listener("s0").IsInvoked); theEvent = new SupportRFIDEvent("b", "1"); env.SendEventBean(theEvent); Assert.IsFalse(env.Listener("s0").IsInvoked); theEvent = new SupportRFIDEvent("b", "2"); env.SendEventBean(theEvent); Assert.AreEqual(theEvent, env.Listener("s0").AssertOneGetNewAndReset().Get("b")); env.UndeployAll(); }
public void TestRFIDZoneExit() { Configuration config = SupportConfigFactory.GetConfiguration(); config.AddEventType("LR", typeof(SupportRFIDEvent).FullName); EPServiceProvider epService = EPServiceProviderManager.GetDefaultProvider(config); epService.Initialize(); if (InstrumentationHelper.ENABLED) { InstrumentationHelper.StartTest(epService, GetType(), GetType().FullName); } // Every LR event with a zone of '1' activates a new sub-expression after the followed-by // operator. The sub-expression instance can end two different ways: // It ends when a LR for the same mac and a different exit-zone comes in, or // it ends when a LR for the same max and the same zone come in. // // The latter also starts the sub-expression again. const string expression = "select * " + "from pattern [" + "every a=LR(zoneID='1') -> (b=LR(mac=a.mac,zoneID!='1') and not LR(mac=a.mac,zoneID='1'))" + "]"; EPStatement statement = epService.EPAdministrator.CreateEPL(expression); var listener = new SupportUpdateListener(); statement.Events += listener.Update; var theEvent = new SupportRFIDEvent("a", "1"); epService.EPRuntime.SendEvent(theEvent); Assert.IsFalse(listener.IsInvoked); theEvent = new SupportRFIDEvent("a", "2"); epService.EPRuntime.SendEvent(theEvent); Assert.AreEqual(theEvent, listener.AssertOneGetNewAndReset().Get("b")); theEvent = new SupportRFIDEvent("b", "1"); epService.EPRuntime.SendEvent(theEvent); Assert.IsFalse(listener.IsInvoked); theEvent = new SupportRFIDEvent("b", "1"); epService.EPRuntime.SendEvent(theEvent); Assert.IsFalse(listener.IsInvoked); theEvent = new SupportRFIDEvent("b", "2"); epService.EPRuntime.SendEvent(theEvent); Assert.AreEqual(theEvent, listener.AssertOneGetNewAndReset().Get("b")); if (InstrumentationHelper.ENABLED) { InstrumentationHelper.EndTest(); } }
public void TestMemoryRFIDEvent() { Configuration config = SupportConfigFactory.GetConfiguration(); config.AddEventType("LR", typeof(SupportRFIDEvent).FullName); EPServiceProvider epService = EPServiceProviderManager.GetDefaultProvider(config); epService.Initialize(); if (InstrumentationHelper.ENABLED) { InstrumentationHelper.StartTest(epService, GetType(), GetType().FullName); } const string expression = "select 'Tag May Be Broken' as alert, " + "tagMayBeBroken.mac, " + "tagMayBeBroken.zoneID " + "from pattern [" + "every tagMayBeBroken=LR -> (timer:interval(10 sec) and not LR(mac=tagMayBeBroken.mac))" + "]"; EPStatement statement = epService.EPAdministrator.CreateEPL(expression); var listener = new SupportUpdateListener(); statement.Events += listener.Update; for (int i = 0; i < 10; i++) { /* * if (i % 1000 == 0) * { * log.Info(".testMemoryRFIDEvent now at " + i); * } */ var theEvent = new SupportRFIDEvent("a", "111"); epService.EPRuntime.SendEvent(theEvent); theEvent = new SupportRFIDEvent("a", "111"); epService.EPRuntime.SendEvent(theEvent); } if (InstrumentationHelper.ENABLED) { InstrumentationHelper.EndTest(); } }
private void RunAssertionRFIDZoneEnter(EPServiceProvider epService) { epService.EPAdministrator.Configuration.AddEventType("LR", typeof(SupportRFIDEvent)); // Every LR event with a zone other then '1' activates a new sub-expression after // the followed-by operator. The sub-expression instance can end two different ways: // It ends when a LR for the same mac and the enter-zone comes in, or // it ends when a LR for the same max and the same zone come in. The latter also starts the // sub-expression again. string expression = "select * " + "from pattern [" + "every a=LR(zoneID!='1') -> (b=LR(mac=a.mac,zoneID='1') and not LR(mac=a.mac,zoneID=a.zoneID))" + "]"; EPStatement statement = epService.EPAdministrator.CreateEPL(expression); var listener = new SupportUpdateListener(); statement.Events += listener.Update; var theEvent = new SupportRFIDEvent("a", "2"); epService.EPRuntime.SendEvent(theEvent); Assert.IsFalse(listener.IsInvoked); theEvent = new SupportRFIDEvent("a", "1"); epService.EPRuntime.SendEvent(theEvent); Assert.AreEqual(theEvent, listener.AssertOneGetNewAndReset().Get("b")); theEvent = new SupportRFIDEvent("b", "2"); epService.EPRuntime.SendEvent(theEvent); Assert.IsFalse(listener.IsInvoked); theEvent = new SupportRFIDEvent("b", "2"); epService.EPRuntime.SendEvent(theEvent); Assert.IsFalse(listener.IsInvoked); theEvent = new SupportRFIDEvent("b", "1"); epService.EPRuntime.SendEvent(theEvent); Assert.AreEqual(theEvent, listener.AssertOneGetNewAndReset().Get("b")); statement.Dispose(); }
public void Run(RegressionEnvironment env) { var expression = "@Name('s0') select 'Tag May Be Broken' as alert, " + "tagMayBeBroken.Mac, " + "tagMayBeBroken.ZoneID " + "from pattern [" + "every tagMayBeBroken=SupportRFIDEvent -> (timer:interval(10 sec) and not SupportRFIDEvent(Mac=tagMayBeBroken.Mac))" + "]"; env.CompileDeploy(expression); env.AddListener("s0"); for (var i = 0; i < 10; i++) { var theEvent = new SupportRFIDEvent("a", "111"); env.SendEventBean(theEvent); theEvent = new SupportRFIDEvent("a", "111"); env.SendEventBean(theEvent); } env.UndeployAll(); }