Exemplo n.º 1
0
            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();
            }