public void Run(Configuration configuration) { idCounter = new AtomicLong(0); executorService = Executors.NewCachedThreadPool(); noActionUpdateListener = new NoActionUpdateListener(); configuration.Runtime.Threading.IsInternalTimerEnabled = true; configuration.Common.AddEventType(typeof(SupportBean)); configuration.Runtime.Threading.InsertIntoDispatchLocking = Locking.SUSPEND; var runtime = EPRuntimeProvider.GetRuntime(GetType().Name, configuration); runtime.Initialize(); epRuntime = runtime.EventService; var path = new RegressionPath(); var epl = "insert into Stream1 select count(*) as cnt from SupportBean#time(7 sec)"; var compiled = SupportCompileDeployUtil.Compile(epl, configuration, path); path.Add(compiled); SupportCompileDeployUtil.Deploy(compiled, runtime); epl = epl + " output every 10 seconds"; compiled = SupportCompileDeployUtil.Compile(epl, configuration, path); SupportCompileDeployUtil.DeployAddListener(compiled, "insert", noActionUpdateListener, runtime); var sendTickEventRunnable = new SendEventRunnable(this, 10000); Start(sendTickEventRunnable, 4); // Adjust here for long-running test SupportCompileDeployUtil.ThreadSleep(3000); sendTickEventRunnable.Shutdown = true; executorService.Shutdown(); SupportCompileDeployUtil.ExecutorAwait(executorService, 1, TimeUnit.SECONDS); runtime.Destroy(); }
private void RunAssertion() { _idCounter = new AtomicLong(0); _executorService = Executors.NewCachedThreadPool(); _noActionUpdateListener = new NoActionUpdateListener(); var epConfig = new Configuration(SupportContainer.Instance); epConfig.AddEventType <SupportBean>(); epConfig.EngineDefaults.Threading.InsertIntoDispatchLocking = ConfigurationEngineDefaults.ThreadingConfig.Locking.SUSPEND; EPServiceProvider epServiceProvider = EPServiceProviderManager.GetProvider( SupportContainer.Instance, this.GetType().Name, epConfig); epServiceProvider.Initialize(); _epAdministrator = epServiceProvider.EPAdministrator; _epRuntime = epServiceProvider.EPRuntime; _epAdministrator.StartAllStatements(); string epl = "insert into Stream1 select count(*) as cnt from SupportBean#time(7 sec)"; CreateEPL(epl, _noActionUpdateListener.Update); epl = epl + " output every 10 seconds"; CreateEPL(epl, _noActionUpdateListener.Update); var sendTickEventRunnable = new SendEventRunnable(10000, SendEvent); Start(sendTickEventRunnable, 4); // Adjust here for long-running test Thread.Sleep(3000); _executorService.Shutdown(); _executorService.AwaitTermination(1, TimeUnit.SECONDS); }