public void TestSendEventDynamicType() { _epService.EPAdministrator.CreateEPL("create objectarray schema MyEventOne(type string, p0 int, p1 string)"); _epService.EPAdministrator.CreateEPL("create objectarray schema MyEventTwo(type string, f0 string, f1 int)"); _epService.EPAdministrator.CreateEPL("select * from MyEventOne").Events += _listener.Update; _epService.EPAdministrator.CreateEPL("select * from MyEventTwo").Events += _listenerTwo.Update; _epService.EPAdministrator.CreateEPL("create dataflow MyDataFlow " + "MyObjectArrayGraphSource -> OutStream<?> {}" + "EventBusSink(OutStream) {" + " collector : {" + " class: '" + typeof(MyTransformToEventBus).FullName + "'" + " }" + "}"); MyObjectArrayGraphSource source = new MyObjectArrayGraphSource(Collections.List( new Object[] { "type1", 100, "abc" }, new Object[] { "type2", "GE", -1 } ).GetEnumerator()); EPDataFlowInstantiationOptions options = new EPDataFlowInstantiationOptions() .OperatorProvider(new DefaultSupportGraphOpProvider(source)); _epService.EPRuntime.DataFlowRuntime.Instantiate("MyDataFlow", options).Start(); _listener.WaitForInvocation(3000, 1); _listenerTwo.WaitForInvocation(3000, 1); EPAssertionUtil.AssertProps(_listener.AssertOneGetNewAndReset(), "p0,p1".Split(','), new Object[] { 100, "abc" }); EPAssertionUtil.AssertProps(_listenerTwo.AssertOneGetNewAndReset(), "f0,f1".Split(','), new Object[] { "GE", -1 }); }
private void RunAssertion(EPServiceProvider epService) { var future = new DefaultSupportCaptureOp(1, SupportContainer.Instance.LockManager()); var source = new MyObjectArrayGraphSource(Collections.List( new object[] { "trade", "GE", 100d, 1000L, null, null }, // vwap = 100, minPrice=100 new object[] { "quote", "GE", null, null, 99.5d, 2000L } // ).GetEnumerator()); var options = new EPDataFlowInstantiationOptions() .OperatorProvider(new DefaultSupportGraphOpProvider(future, source)); epService.EPRuntime.DataFlowRuntime.Instantiate("VWAPSample", options).Start(); object[] received = future.GetValue(5, TimeUnit.SECONDS); Assert.AreEqual(1, received.Length); EPAssertionUtil.AssertProps( epService.Container, received[0], "index".Split(','), new object[] { 2000 * Math.Exp(100 - 99.5) }); }
private void RunAssertion() { var future = new DefaultSupportCaptureOp(1); var source = new MyObjectArrayGraphSource(Collections.List( new Object[] { "trade", "GE", 100d, 1000L, null, null }, // vwap = 100, minPrice=100 new Object[] { "quote", "GE", null, null, 99.5d, 2000L } // ).GetEnumerator()); var options = new EPDataFlowInstantiationOptions() .OperatorProvider(new DefaultSupportGraphOpProvider(future, source)); _epService.EPRuntime.DataFlowRuntime.Instantiate("VWAPSample", options).Start(); var received = future.GetValue(TimeSpan.FromSeconds(5)); Assert.AreEqual(1, received.Length); EPAssertionUtil.AssertProps(received[0], "index".Split(','), new Object[] { 2000 * Math.Exp(100 - 99.5) }); }