public void TestFastCompleteNonBlocking() { // declare _epService.EPAdministrator.CreateEPL( "create dataflow MyDataFlowOne " + "BeaconSource -> BeaconStream {iterations : 1}" + "DefaultSupportCaptureOp(BeaconStream) {}"); // instantiate var future = new DefaultSupportCaptureOp(1); EPDataFlowInstantiationOptions options = new EPDataFlowInstantiationOptions().OperatorProvider(new DefaultSupportGraphOpProvider(future)); EPDataFlowInstance dfOne = _epService.EPRuntime.DataFlowRuntime.Instantiate("MyDataFlowOne", options); Assert.AreEqual("MyDataFlowOne", dfOne.DataFlowName); Assert.AreEqual(EPDataFlowState.INSTANTIATED, dfOne.State); Assert.IsFalse(future.IsDone()); // non-blocking run, spinning wait dfOne.Start(); long start = Environment.TickCount; while (dfOne.State != EPDataFlowState.COMPLETE) { if (Environment.TickCount - start > 1000) { Assert.Fail(); } } Assert.AreEqual(1, future.GetValue(TimeSpan.MaxValue).Length); // assert past-exec RunAssertionAfterExec(dfOne); }
private void RunAssertionFastCompleteNonBlocking(EPServiceProvider epService) { // declare epService.EPAdministrator.CreateEPL( "create dataflow MyDataFlowOne " + "BeaconSource -> BeaconStream {iterations : 1}" + "DefaultSupportCaptureOp(BeaconStream) {}"); // instantiate var future = new DefaultSupportCaptureOp(1, SupportContainer.Instance.LockManager()); var options = new EPDataFlowInstantiationOptions().OperatorProvider(new DefaultSupportGraphOpProvider(future)); var dfOne = epService.EPRuntime.DataFlowRuntime.Instantiate("MyDataFlowOne", options); Assert.AreEqual("MyDataFlowOne", dfOne.DataFlowName); Assert.AreEqual(EPDataFlowState.INSTANTIATED, dfOne.State); Assert.IsFalse(future.IsDone()); // non-blocking run, spinning wait dfOne.Start(); var start = PerformanceObserver.MilliTime; while (dfOne.State != EPDataFlowState.COMPLETE) { if (PerformanceObserver.MilliTime - start > 1000) { Assert.Fail(); } } Assert.AreEqual(1, future.GetValue(TimeSpan.Zero).Length); // assert past-exec TryAssertionAfterExec(dfOne); epService.EPAdministrator.DestroyAllStatements(); }
public void TestFastCompleteBlocking() { // declare _epService.EPAdministrator.CreateEPL( "create dataflow MyDataFlowOne " + "BeaconSource -> BeaconStream {iterations : 1}" + "DefaultSupportCaptureOp(BeaconStream) {}"); // instantiate var future = new DefaultSupportCaptureOp(1); EPDataFlowInstantiationOptions options = new EPDataFlowInstantiationOptions().OperatorProvider(new DefaultSupportGraphOpProvider(future)); EPDataFlowInstance dfOne = _epService.EPRuntime.DataFlowRuntime.Instantiate("MyDataFlowOne", options); Assert.AreEqual("MyDataFlowOne", dfOne.DataFlowName); Assert.AreEqual(EPDataFlowState.INSTANTIATED, dfOne.State); // has not run Thread.Sleep(1000); Assert.IsFalse(future.IsDone()); // blocking run dfOne.Run(); Assert.AreEqual(EPDataFlowState.COMPLETE, dfOne.State); Assert.AreEqual(1, future.GetValue(TimeSpan.MaxValue).Length); // assert past-exec RunAssertionAfterExec(dfOne); }
private void RunAssertionFastCompleteBlocking(EPServiceProvider epService) { // declare epService.EPAdministrator.CreateEPL( "create dataflow MyDataFlowOne " + "BeaconSource -> BeaconStream {iterations : 1}" + "DefaultSupportCaptureOp(BeaconStream) {}"); // instantiate var future = new DefaultSupportCaptureOp(1, SupportContainer.Instance.LockManager()); var options = new EPDataFlowInstantiationOptions().OperatorProvider(new DefaultSupportGraphOpProvider(future)); var dfOne = epService.EPRuntime.DataFlowRuntime.Instantiate("MyDataFlowOne", options); Assert.AreEqual("MyDataFlowOne", dfOne.DataFlowName); Assert.AreEqual(EPDataFlowState.INSTANTIATED, dfOne.State); // has not run Thread.Sleep(1000); Assert.IsFalse(future.IsDone()); // blocking run dfOne.Run(); Assert.AreEqual(EPDataFlowState.COMPLETE, dfOne.State); Assert.AreEqual(1, future.GetValue(TimeSpan.Zero).Length); // assert past-exec TryAssertionAfterExec(dfOne); epService.EPAdministrator.DestroyAllStatements(); }
public void Run(RegressionEnvironment env) { // declare env.CompileDeploy( "@Name('flow') create dataflow MyDataFlowOne " + "BeaconSource -> BeaconStream {iterations : 1}" + "DefaultSupportCaptureOp(BeaconStream) {}"); // instantiate var future = new DefaultSupportCaptureOp(1, env.Container.LockManager()); var options = new EPDataFlowInstantiationOptions().WithOperatorProvider( new DefaultSupportGraphOpProvider(future)); var dfOne = env.Runtime.DataFlowService.Instantiate(env.DeploymentId("flow"), "MyDataFlowOne", options); Assert.AreEqual("MyDataFlowOne", dfOne.DataFlowName); Assert.AreEqual(EPDataFlowState.INSTANTIATED, dfOne.State); Assert.IsFalse(future.IsDone()); // non-blocking run, spinning wait dfOne.Start(); var start = PerformanceObserver.MilliTime; while (dfOne.State != EPDataFlowState.COMPLETE) { if (PerformanceObserver.MilliTime - start > 1000) { Assert.Fail(); } } try { Assert.AreEqual(1, future.GetValueOrDefault().Length); } catch (Exception t) { throw new EPException(t); } // assert past-exec TryAssertionAfterExec(dfOne); env.UndeployAll(); }