public void TestAllTypes() { DefaultSupportGraphEventUtil.AddTypeConfiguration(_epService); RunAssertionAllTypes("MyXMLEvent", DefaultSupportGraphEventUtil.XMLEvents); RunAssertionAllTypes("MyOAEvent", DefaultSupportGraphEventUtil.OAEvents); RunAssertionAllTypes("MyMapEvent", DefaultSupportGraphEventUtil.MapEvents); RunAssertionAllTypes("MyEvent", DefaultSupportGraphEventUtil.PONOEvents); // invalid: output stream SupportDataFlowAssertionUtil.TryInvalidInstantiate(_epService, "DF1", "create dataflow DF1 EventBusSink -> s1 {}", "Failed to instantiate data flow 'DF1': Failed initialization for operator 'EventBusSink': EventBusSink operator does not provide an output stream"); _epService.EPAdministrator.CreateEPL("create schema SampleSchema(tagId string, locX double, locY double)"); String docSmple = "create dataflow MyDataFlow\n" + "BeaconSource -> instream<SampleSchema> {} // produces sample stream to\n" + "//demonstrate below\n" + "// Send SampleSchema events produced by beacon to the event bus.\n" + "EventBusSink(instream) {}\n" + "\n" + "// Send SampleSchema events produced by beacon to the event bus.\n" + "// With collector that performs transformation.\n" + "EventBusSink(instream) {\n" + "collector : {\n" + "class : '" + typeof(MyTransformToEventBus).FullName + "'\n" + "}\n" + "}"; _epService.EPAdministrator.CreateEPL(docSmple); _epService.EPRuntime.DataFlowRuntime.Instantiate("MyDataFlow"); }
public void TestAllTypes() { DefaultSupportGraphEventUtil.AddTypeConfiguration(_epService); RunAssertionAllTypes("MyXMLEvent", DefaultSupportGraphEventUtil.XMLEvents); RunAssertionAllTypes("MyOAEvent", DefaultSupportGraphEventUtil.OAEvents); RunAssertionAllTypes("MyMapEvent", DefaultSupportGraphEventUtil.MapEvents); RunAssertionAllTypes("MyEvent", DefaultSupportGraphEventUtil.PONOEvents); }
private void RunAssertionAllTypes(EPServiceProvider epService) { DefaultSupportGraphEventUtil.AddTypeConfiguration((EPServiceProviderSPI)epService); RunAssertionAllTypes(epService, "MyXMLEvent", DefaultSupportGraphEventUtil.XMLEvents); RunAssertionAllTypes(epService, "MyOAEvent", DefaultSupportGraphEventUtil.OAEvents); RunAssertionAllTypes(epService, "MyMapEvent", DefaultSupportGraphEventUtil.MapEvents); RunAssertionAllTypes(epService, "MyEvent", DefaultSupportGraphEventUtil.PonoEvents); }
public void SetUp() { var configuration = new Configuration(SupportContainer.Reset()); configuration.Runtime.Threading.IsInternalTimerEnabled = false; configuration.Common.AddImportNamespace(typeof(FileSinkFactory)); configuration.Common.AddImportNamespace(typeof(DefaultSupportSourceOpForge)); DefaultSupportGraphEventUtil.AddTypeConfiguration(configuration); runtime = EPRuntimeProvider.GetDefaultRuntime(configuration); runtime.Initialize(); }
private static void Configure(Configuration configuration) { foreach (var clazz in new[] { typeof(SupportBean), typeof(SupportBean_A), typeof(SupportBean_B), typeof(SupportBean_S0), typeof(SupportBean_S1), typeof(SupportBean_S2) }) { configuration.Common.AddEventType(clazz.Name, clazz); } configuration.Common.AddEventType( "MyOAEventType", new[] {"p0", "p1"}, new object[] {typeof(string), typeof(int)}); var legacy = new ConfigurationCommonEventTypeBean(); configuration.Common.AddEventType("MyLegacyEvent", typeof(EPLDataflowOpBeaconSource.MyLegacyEvent), legacy); configuration.Common.AddEventType( "MyEventNoDefaultCtor", typeof(EPLDataflowOpBeaconSource.MyEventNoDefaultCtor)); configuration.Compiler.AddPlugInSingleRowFunction( "generateTagId", typeof(EPLDataflowOpBeaconSource), "GenerateTagId"); DefaultSupportGraphEventUtil.AddTypeConfiguration(configuration); configuration.Common.AddImportType(typeof(Randomizer)); configuration.Common.AddImportNamespace(typeof(DefaultSupportSourceOp)); configuration.Common.AddImportNamespace(typeof(DefaultSupportCaptureOp)); configuration.Common.AddImportType(typeof(EPLDataflowCustomProperties.MyOperatorOneForge)); configuration.Common.AddImportType(typeof(EPLDataflowCustomProperties.MyOperatorTwoForge)); configuration.Common.AddImportType(typeof(EPLDataflowAPIOpLifecycle.SupportGraphSourceForge)); configuration.Common.AddImportType(typeof(EPLDataflowAPIOpLifecycle.SupportOperatorForge)); configuration.Common.AddImportType(typeof(EPLDataflowAPIExceptions.MyExceptionOpForge)); configuration.Common.AddImportType(typeof(EPLDataflowAPIOpLifecycle.MyCaptureOutputPortOpForge)); configuration.Common.AddImportType(typeof(EPLDataflowExampleRollingTopWords)); configuration.Common.AddImportType(typeof(EPLDataflowInputOutputVariations.MyFactorialOp)); configuration.Common.AddImportType(typeof(EPLDataflowInputOutputVariations.MyCustomOp)); configuration.Common.AddImportType(typeof(EPLDataflowInvalidGraph.MyInvalidOpForge)); configuration.Common.AddImportType(typeof(EPLDataflowInvalidGraph.MyTestOp)); configuration.Common.AddImportType(typeof(EPLDataflowInvalidGraph.MySBInputOp)); configuration.Common.AddImportType(typeof(EPLDataflowTypes.MySupportBeanOutputOp)); configuration.Common.AddImportType(typeof(EPLDataflowTypes.MyMapOutputOp)); configuration.Common.AddImportType(typeof(MyLineFeedSource)); configuration.Common.AddImportType(typeof(EPLDataflowAPIInstantiationOptions.MyOpForge)); configuration.Common.AddImportNamespace(typeof(MyObjectArrayGraphSource)); configuration.Common.AddImportNamespace(typeof(MyTokenizerCounter)); configuration.Common.AddImportType(typeof(SupportBean)); }
public void TestAllTypes() { DefaultSupportGraphEventUtil.AddTypeConfiguration(_epService); RunAssertionAllTypes("MyXMLEvent", DefaultSupportGraphEventUtil.XMLEvents); RunAssertionAllTypes("MyOAEvent", DefaultSupportGraphEventUtil.OAEvents); RunAssertionAllTypes("MyMapEvent", DefaultSupportGraphEventUtil.MapEvents); RunAssertionAllTypes("MyEvent", DefaultSupportGraphEventUtil.PONOEvents); // test doc sample String epl = "create dataflow MyDataFlow\n" + " create schema SampleSchema(tagId string, locX double),\t// sample type\n" + " BeaconSource -> samplestream<SampleSchema> {}\n" + " \n" + " // Filter all events that have a tag id of '001'\n" + " Filter(samplestream) -> tags_001 {\n" + " filter : tagId = '001' \n" + " }\n" + " \n" + " // Filter all events that have a tag id of '001', putting all other tags into the second stream\n" + " Filter(samplestream) -> tags_001, tags_other {\n" + " filter : tagId = '001' \n" + " }"; _epService.EPAdministrator.CreateEPL(epl); _epService.EPRuntime.DataFlowRuntime.Instantiate("MyDataFlow"); // test two streams DefaultSupportCaptureOpStatic.Instances.Clear(); String graph = "create dataflow MyFilter\n" + "Emitter -> sb<SupportBean> {name : 'e1'}\n" + "Filter(sb) -> out.ok, out.fail {filter: TheString = 'x'}\n" + "DefaultSupportCaptureOpStatic(out.ok) {}" + "DefaultSupportCaptureOpStatic(out.fail) {}"; _epService.EPAdministrator.CreateEPL(graph); EPDataFlowInstance instance = _epService.EPRuntime.DataFlowRuntime.Instantiate("MyFilter"); EPDataFlowInstanceCaptive captive = instance.StartCaptive(); captive.Emitters.Get("e1").Submit(new SupportBean("x", 10)); captive.Emitters.Get("e1").Submit(new SupportBean("y", 11)); Assert.AreEqual(10, ((SupportBean)DefaultSupportCaptureOpStatic.Instances[0].GetCurrent()[0]).IntPrimitive); Assert.AreEqual(11, ((SupportBean)DefaultSupportCaptureOpStatic.Instances[1].GetCurrent()[0]).IntPrimitive); DefaultSupportCaptureOpStatic.Instances.Clear(); }
private void RunAssertionAllTypes(EPServiceProvider epService) { DefaultSupportGraphEventUtil.AddTypeConfiguration((EPServiceProviderSPI)epService); RunAssertionAllTypes(epService, "MyMapEvent", DefaultSupportGraphEventUtil.MapEventsSendable); RunAssertionAllTypes(epService, "MyXMLEvent", DefaultSupportGraphEventUtil.XMLEventsSendable); RunAssertionAllTypes(epService, "MyOAEvent", DefaultSupportGraphEventUtil.OAEventsSendable); RunAssertionAllTypes(epService, "MyEvent", DefaultSupportGraphEventUtil.PonoEventsSendable); // invalid: no output stream SupportDataFlowAssertionUtil.TryInvalidInstantiate(epService, "DF1", "create dataflow DF1 EventBusSource {}", "Failed to instantiate data flow 'DF1': Failed initialization for operator 'EventBusSource': EventBusSource operator requires one output stream but produces 0 streams"); // invalid: type not found SupportDataFlowAssertionUtil.TryInvalidInstantiate(epService, "DF1", "create dataflow DF1 EventBusSource -> ABC {}", "Failed to instantiate data flow 'DF1': Failed initialization for operator 'EventBusSource': EventBusSource operator requires an event type declated for the output stream"); // test doc samples epService.EPAdministrator.CreateEPL("create schema SampleSchema(tagId string, locX double, locY double)"); string epl = "create dataflow MyDataFlow\n" + "\n" + " // Receive all SampleSchema events from the event bus.\n" + " // No transformation.\n" + " EventBusSource -> stream.one<SampleSchema> {}\n" + " \n" + " // Receive all SampleSchema events with tag id '001' from the event bus.\n" + " // No transformation.\n" + " EventBusSource -> stream.one<SampleSchema> {\n" + " filter : tagId = '001'\n" + " }\n" + "\n" + " // Receive all SampleSchema events from the event bus.\n" + " // With collector that performs transformation.\n" + " EventBusSource -> stream.two<SampleSchema> {\n" + " collector : {\n" + " class : '" + typeof(MyDummyCollector).FullName + "'\n" + " },\n" + " }"; epService.EPAdministrator.CreateEPL(epl); epService.EPRuntime.DataFlowRuntime.Instantiate("MyDataFlow"); epService.EPAdministrator.DestroyAllStatements(); }
private void RunAssertionAllTypes(EPServiceProvider epService) { DefaultSupportGraphEventUtil.AddTypeConfiguration((EPServiceProviderSPI)epService); RunAssertionStatementNameExists(epService, "MyMapEvent", DefaultSupportGraphEventUtil.MapEvents); RunAssertionStatementNameExists(epService, "MyOAEvent", DefaultSupportGraphEventUtil.OAEvents); RunAssertionStatementNameExists(epService, "MyEvent", DefaultSupportGraphEventUtil.PonoEvents); RunAssertionStatementNameExists(epService, "MyXMLEvent", DefaultSupportGraphEventUtil.XMLEvents); // test doc samples string epl = "create dataflow MyDataFlow\n" + " create schema SampleSchema(tagId string, locX double),\t// sample type\t\t\t\n" + "\t\t\t\n" + " // Consider only the statement named MySelectStatement when it Exists.\n" + " EPStatementSource -> stream.one<eventbean<?>> {\n" + " statementName : 'MySelectStatement'\n" + " }\n" + " \n" + " // Consider all statements that match the filter object provided.\n" + " EPStatementSource -> stream.two<eventbean<?>> {\n" + " statementFilter : {\n" + " class : '" + typeof(MyFilter).FullName + "'\n" + " }\n" + " }\n" + " \n" + " // Consider all statements that match the filter object provided.\n" + " // With collector that performs transformation.\n" + " EPStatementSource -> stream.two<SampleSchema> {\n" + " collector : {\n" + " class : '" + typeof(MyCollector).FullName + "'\n" + " },\n" + " statementFilter : {\n" + " class : '" + typeof(MyFilter).FullName + "'\n" + " }\n" + " }"; epService.EPAdministrator.CreateEPL(epl); epService.EPRuntime.DataFlowRuntime.Instantiate("MyDataFlow"); epService.EPAdministrator.DestroyAllStatements(); }