public void Run(RegressionEnvironment env)
            {
                var path = new RegressionPath();
                env.CompileDeploy("create schema SomeType ()", path);
                env.CompileDeploy(
                    "@Name('flow') create dataflow MyDataFlowOne MyOp -> outstream<SomeType> {propOne:'abc', propThree:'xyz'}",
                    path);

                var options = new EPDataFlowInstantiationOptions();
                var myParameterProvider = new MyParameterProvider(Collections.SingletonDataMap("propTwo", "def"));
                options.WithParameterProvider(myParameterProvider);

                env.Runtime.DataFlowService.Instantiate(env.DeploymentId("flow"), "MyDataFlowOne", options);
                var myOp = MyOp.GetAndClearInstances()[0];
                Assert.AreEqual("abc", myOp.PropOne);
                Assert.AreEqual("def", myOp.PropTwo);

                Assert.AreEqual(3, myParameterProvider.contextMap.Count);
                Assert.IsNotNull(myParameterProvider.contextMap.Get("propOne"));

                var context = myParameterProvider.contextMap.Get("propTwo");
                Assert.AreEqual("propTwo", context.ParameterName);
                Assert.AreEqual("MyOp", context.OperatorName);
                Assert.AreSame(myOp.Factory, context.Factory);
                Assert.AreEqual(0, context.OperatorNum);
                Assert.AreEqual("MyDataFlowOne", context.DataFlowName);

                context = myParameterProvider.contextMap.Get("propThree");
                Assert.AreEqual("propThree", context.ParameterName);
                Assert.AreEqual("MyOp", context.OperatorName);
                Assert.AreSame(myOp.Factory, context.Factory);
                Assert.AreEqual(0, context.OperatorNum);

                env.UndeployAll();
            }
Exemple #2
0
            public void Run(RegressionEnvironment env)
            {
                // one statement exists before the data flow
                env.CompileDeploy("select Id from SupportBean_B");

                env.CompileDeploy(
                    "@Name('flow') create dataflow MyDataFlowOne " +
                    "create schema AllObjects as System.Object," +
                    "EPStatementSource -> thedata<AllObjects> {} " +
                    "DefaultSupportCaptureOp(thedata) {}");

                var captureOp = new DefaultSupportCaptureOp(env.Container.LockManager());
                var options = new EPDataFlowInstantiationOptions();
                var myFilter = new MyFilter();
                options.WithParameterProvider(
                    new DefaultSupportGraphParamProvider(
                        Collections.SingletonMap<string, object>("statementFilter", myFilter)));
                options.WithOperatorProvider(new DefaultSupportGraphOpProvider(captureOp));
                var df = env.Runtime.DataFlowService.Instantiate(env.DeploymentId("flow"), "MyDataFlowOne", options);
                df.Start();

                env.SendEventBean(new SupportBean_B("B1"));
                captureOp.WaitForInvocation(200, 1);
                EPAssertionUtil.AssertProps(
                    env.Container,
                    captureOp.GetCurrentAndReset()[0],
                    new [] { "Id" },
                    new object[] {"B1"});

                env.CompileDeploy("select TheString, IntPrimitive from SupportBean");
                env.SendEventBean(new SupportBean("E1", 1));
                captureOp.WaitForInvocation(200, 1);
                EPAssertionUtil.AssertProps(
                    env.Container,
                    captureOp.GetCurrentAndReset()[0],
                    new [] { "TheString","IntPrimitive" },
                    new object[] {"E1", 1});

                env.CompileDeploy("@Name('s2') select Id from SupportBean_A");
                env.SendEventBean(new SupportBean_A("A1"));
                captureOp.WaitForInvocation(200, 1);
                EPAssertionUtil.AssertProps(
                    env.Container,
                    captureOp.GetCurrentAndReset()[0],
                    new [] { "Id" },
                    new object[] {"A1"});

                env.UndeployModuleContaining("s2");

                env.SendEventBean(new SupportBean_A("A2"));
                Sleep(50);
                Assert.AreEqual(0, captureOp.Current.Length);

                env.CompileDeploy("@Name('s2') select Id from SupportBean_A");

                env.SendEventBean(new SupportBean_A("A3"));
                captureOp.WaitForInvocation(200, 1);
                EPAssertionUtil.AssertProps(
                    env.Container,
                    captureOp.GetCurrentAndReset()[0],
                    new [] { "Id" },
                    new object[] {"A3"});

                env.SendEventBean(new SupportBean_B("B2"));
                captureOp.WaitForInvocation(200, 1);
                EPAssertionUtil.AssertProps(
                    env.Container,
                    captureOp.GetCurrentAndReset()[0],
                    new [] { "Id" },
                    new object[] {"B2"});

                df.Cancel();

                env.SendEventBean(new SupportBean("E1", 1));
                env.SendEventBean(new SupportBean_A("A1"));
                env.SendEventBean(new SupportBean_B("B3"));
                Assert.AreEqual(0, captureOp.Current.Length);

                env.UndeployAll();
            }