Exemplo n.º 1
0
        private void RunAssertionAllTypes(String typeName, Object[] events)
        {
            String graph = "create dataflow MySelect\n" +
                           "DefaultSupportSourceOp -> instream.with.dot<" + typeName + ">{}\n" +
                           "Filter(instream.with.dot) -> outstream.dot {filter: myString = 'two'}\n" +
                           "DefaultSupportCaptureOp(outstream.dot) {}";
            EPStatement stmtGraph = _epService.EPAdministrator.CreateEPL(graph);

            DefaultSupportSourceOp         source  = new DefaultSupportSourceOp(events);
            DefaultSupportCaptureOp        capture = new DefaultSupportCaptureOp(2);
            EPDataFlowInstantiationOptions options = new EPDataFlowInstantiationOptions();

            options.SetDataFlowInstanceUserObject("myuserobject");
            options.SetDataFlowInstanceId("myinstanceid");

            options.OperatorProvider(new DefaultSupportGraphOpProvider(source, capture));
            EPDataFlowInstance instance = _epService.EPRuntime.DataFlowRuntime.Instantiate("MySelect", options);

            Assert.AreEqual("myuserobject", instance.UserObject);
            Assert.AreEqual("myinstanceid", instance.InstanceId);

            instance.Run();

            Object[] result = capture.GetAndReset()[0].ToArray();
            Assert.AreEqual(1, result.Length);
            Assert.AreSame(events[1], result[0]);

            instance.Cancel();

            stmtGraph.Dispose();
        }