private void RunAssertionBeacon(EPServiceProvider epService) { epService.EPAdministrator.CreateEPL("create objectarray schema MyEventBeacon(p0 string, p1 long)"); EPStatement stmt = epService.EPAdministrator.CreateEPL("select * from MyEventBeacon"); var listener = new SupportUpdateListener(); stmt.Events += listener.Update; epService.EPAdministrator.CreateEPL("create dataflow MyDataFlowOne " + "" + "BeaconSource -> BeaconStream<MyEventBeacon> {" + " iterations : 3," + " p0 : 'abc'," + " p1 : 1," + "}" + "EventBusSink(BeaconStream) {}"); epService.EPRuntime.DataFlowRuntime.Instantiate("MyDataFlowOne", null).Start(); listener.WaitForInvocation(3000, 3); EventBean[] events = listener.GetNewDataListFlattened(); for (int i = 0; i < 3; i++) { Assert.AreEqual("abc", events[i].Get("p0")); long val = (long)events[i].Get("p1"); Assert.IsTrue(val > 0 && val < 10); } epService.EPAdministrator.DestroyAllStatements(); }
private void RunAssertionSendEventDynamicType(EPServiceProvider epService) { 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)"); var listener = new SupportUpdateListener(); epService.EPAdministrator.CreateEPL("select * from MyEventOne").Events += listener.Update; var listenerTwo = new SupportUpdateListener(); epService.EPAdministrator.CreateEPL("select * from MyEventTwo").Events += listenerTwo.Update; epService.EPAdministrator.CreateEPL("create dataflow MyDataFlow " + "MyObjectArrayGraphSource -> OutStream<?> {}" + "EventBusSink(OutStream) {" + " collector : {" + " class: '" + typeof(MyTransformToEventBus).FullName + "'" + " }" + "}"); var source = new MyObjectArrayGraphSource(Collections.List( new object[] { "type1", 100, "abc" }, new object[] { "type2", "GE", -1 } ).GetEnumerator()); var 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 }); epService.EPAdministrator.DestroyAllStatements(); }