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 TestWriteCSV() { RunAssertion("MyXMLEvent", DefaultSupportGraphEventUtil.GetXMLEvents(), true); RunAssertion("MyOAEvent", DefaultSupportGraphEventUtil.GetOAEvents(), true); RunAssertion("MyMapEvent", DefaultSupportGraphEventUtil.GetMapEvents(), false); RunAssertion("MyDefaultSupportGraphEvent", DefaultSupportGraphEventUtil.GetPONOEvents(), true); CompileDeploy(runtime, "@public @buseventtype create json schema MyJsonEvent(MyDouble double, MyInt int, MyString string)"); RunAssertion("MyJsonEvent", DefaultSupportGraphEventUtil.GetJsonEvents(), true); }
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 Run(RegressionEnvironment env) { RunAssertionAllTypes( env, DefaultSupportGraphEventUtil.EVENTTYPENAME, DefaultSupportGraphEventUtil.GetPONOEventsSendable()); RunAssertionAllTypes(env, "MyMapEvent", DefaultSupportGraphEventUtil.GetMapEventsSendable()); RunAssertionAllTypes(env, "MyXMLEvent", DefaultSupportGraphEventUtil.GetXMLEventsSendable()); RunAssertionAllTypes(env, "MyOAEvent", DefaultSupportGraphEventUtil.GetOAEventsSendable()); // invalid: no output stream TryInvalidCompile( env, "create dataflow DF1 EventBusSource {}", "Failed to obtain operator 'EventBusSource': EventBusSource operator requires one output stream but produces 0 streams"); // invalid: type not found TryInvalidCompile( env, "create dataflow DF1 EventBusSource -> ABC {}", "Failed to obtain operator 'EventBusSource': EventBusSource operator requires an event type declated for the output stream"); // test doc samples var path = new RegressionPath(); env.CompileDeploy("create schema SampleSchema(tagId string, locX double, locY double)", path); var epl = "@Name('flow') 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).MaskTypeName() + "'\n" + " },\n" + " }"; env.CompileDeploy(epl, path); env.Runtime.DataFlowService.Instantiate(env.DeploymentId("flow"), "MyDataFlow"); env.UndeployAll(); }
public void Run(RegressionEnvironment env) { if (env.IsHA) { return; } RunAssertionAllTypes( env, DefaultSupportGraphEventUtil.EVENTTYPENAME, DefaultSupportGraphEventUtil.GetPONOEvents()); RunAssertionAllTypes(env, "MyXMLEvent", DefaultSupportGraphEventUtil.GetXMLEvents()); RunAssertionAllTypes(env, "MyOAEvent", DefaultSupportGraphEventUtil.GetOAEvents()); RunAssertionAllTypes(env, "MyMapEvent", DefaultSupportGraphEventUtil.GetMapEvents()); }
public void Run(RegressionEnvironment env) { RunAssertionStatementNameExists( env, DefaultSupportGraphEventUtil.EVENTTYPENAME, DefaultSupportGraphEventUtil.GetPONOEvents()); RunAssertionStatementNameExists(env, "MyMapEvent", DefaultSupportGraphEventUtil.GetMapEvents()); RunAssertionStatementNameExists(env, "MyOAEvent", DefaultSupportGraphEventUtil.GetOAEvents()); RunAssertionStatementNameExists(env, "MyXMLEvent", DefaultSupportGraphEventUtil.GetXMLEvents()); // test doc samples var epl = "@Name('flow') 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" + " statementDeploymentId : 'MyDeploymentABC',\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).MaskTypeName() + "'\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).MaskTypeName() + "'\n" + " },\n" + " statementFilter : {\n" + " class : '" + typeof(MyFilter).MaskTypeName() + "'\n" + " }\n" + " }"; env.CompileDeploy(epl); env.Runtime.DataFlowService.Instantiate(env.DeploymentId("flow"), "MyDataFlow"); env.UndeployAll(); }
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(); }
public void Run(RegressionEnvironment env) { RunAssertionAllTypes(env, "MyXMLEvent", DefaultSupportGraphEventUtil.GetXMLEvents()); RunAssertionAllTypes(env, "MyOAEvent", DefaultSupportGraphEventUtil.GetOAEvents()); RunAssertionAllTypes(env, "MyMapEvent", DefaultSupportGraphEventUtil.GetMapEvents()); RunAssertionAllTypes( env, DefaultSupportGraphEventUtil.EVENTTYPENAME, DefaultSupportGraphEventUtil.GetPONOEvents()); // invalid: output stream TryInvalidCompile( env, "create dataflow DF1 EventBusSink -> s1 {}", "Failed to obtain operator 'EventBusSink': EventBusSink operator does not provide an output stream"); var path = new RegressionPath(); env.CompileDeploy("create schema SampleSchema(tagId string, locX double, locY double)", path); var docSmple = "@Name('s0') 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).MaskTypeName() + "'\n" + "}\n" + "}"; env.CompileDeploy(docSmple, path); env.Runtime.DataFlowService.Instantiate(env.DeploymentId("s0"), "MyDataFlow"); env.UndeployAll(); }
public void Run(RegressionEnvironment env) { RunAssertionAllTypes( env, DefaultSupportGraphEventUtil.EVENTTYPENAME, DefaultSupportGraphEventUtil.GetPONOEvents()); RunAssertionAllTypes( env, "MyXMLEvent", DefaultSupportGraphEventUtil.GetXMLEvents()); RunAssertionAllTypes( env, "MyOAEvent", DefaultSupportGraphEventUtil.GetOAEvents()); RunAssertionAllTypes( env, "MyMapEvent", DefaultSupportGraphEventUtil.GetMapEvents()); // test doc sample var epl = "@Name('flow') 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" + " }"; env.CompileDeploy(epl); env.Runtime.DataFlowService.Instantiate(env.DeploymentId("flow"), "MyDataFlow"); env.UndeployAll(); // test two streams DefaultSupportCaptureOpStatic<object>.GetInstances().Clear(); var graph = "@Name('flow') 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) {}"; env.CompileDeploy(graph); var instance = env.Runtime.DataFlowService.Instantiate(env.DeploymentId("flow"), "MyFilter"); var captive = instance.StartCaptive(); captive.Emitters.Get("e1").Submit(new SupportBean("x", 10)); captive.Emitters.Get("e1").Submit(new SupportBean("y", 11)); var instances = DefaultSupportCaptureOpStatic<object>.GetInstances(); Assert.That(instances, Has.Count.EqualTo(2)); Assert.AreEqual(10, ((SupportBean) instances[0].Current[0]).IntPrimitive); Assert.AreEqual(11, ((SupportBean) instances[1].Current[0]).IntPrimitive); DefaultSupportCaptureOpStatic<object>.GetInstances().Clear(); env.UndeployAll(); }