public void Run(RegressionEnvironment env)
            {
                var epl =
                    "@Name('create') create context MyContext start SupportBean(TheString=$X) as sb end after 1 year;\n" +
                    "@Name('s0') context MyContext select count(*) as cnt from SupportBean;\n";
                var idOne = env.DeployGetId(env.Compile(epl.Replace("$X", "'A'")));
                var idTwo = env.DeployGetId(env.Compile(epl.Replace("$X", "'B'")));

                AssertContextNoRow(env, idOne);
                AssertContextNoRow(env, idTwo);

                env.SendEventBean(new SupportBean("B", 0));

                AssertContextNoRow(env, idOne);
                AssertContext(env, idTwo, 1);

                env.SendEventBean(new SupportBean("A", 0));
                env.SendEventBean(new SupportBean("A", 0));

                AssertContext(env, idOne, 2);
                AssertContext(env, idTwo, 3);

                env.Undeploy(idOne);

                env.SendEventBean(new SupportBean("X", 0));
                AssertContext(env, idTwo, 4);

                env.Undeploy(idTwo);
            }
            public void Run(RegressionEnvironment env)
            {
                var eplOne = "create schema MySchema as (col1 string);\n" +
                             "insert into MySchema select TheString as col1 from SupportBean;\n" +
                             "@Name('s0') select count(*) as c0 from MySchema;\n";
                var idOne = env.DeployGetId(env.Compile(eplOne));

                var eplTwo = "create schema MySchema as (totalme int);\n" +
                             "insert into MySchema select IntPrimitive as totalme from SupportBean;\n" +
                             "@Name('s0') select sum(totalme) as c0 from MySchema;\n";
                var idTwo = env.DeployGetId(env.Compile(eplTwo));

                AssertSelect(env, idOne, 0L);
                AssertSelect(env, idTwo, null);

                env.SendEventBean(new SupportBean("E1", 10));

                AssertSelect(env, idOne, 1L);
                AssertSelect(env, idTwo, 10);

                env.SendEventBean(new SupportBean("E2", 20));

                AssertSelect(env, idOne, 2L);
                AssertSelect(env, idTwo, 30);

                env.Undeploy(idOne);
                Assert.IsNull(env.Runtime.DeploymentService.GetStatement(idOne, "s0"));

                env.SendEventBean(new SupportBean("E3", 30));

                AssertSelect(env, idTwo, 60);

                env.Undeploy(idTwo);
            }
            public void Run(RegressionEnvironment env)
            {
                var epl = "@Name('create') create variable int myvar = $X;\n" +
                          "on pattern[every timer:interval(10)] set myvar = myvar + 1;\n";
                env.AdvanceTime(0);
                var idOne = env.DeployGetId(env.Compile(epl.Replace("$X", "10")));
                var idTwo = env.DeployGetId(env.Compile(epl.Replace("$X", "20")));

                AssertVariable(env, idOne, 10);
                AssertVariable(env, idTwo, 20);

                env.AdvanceTime(10000);

                AssertVariable(env, idOne, 11);
                AssertVariable(env, idTwo, 21);

                env.Undeploy(idOne);

                env.AdvanceTime(20000);

                Assert.IsNull(env.Runtime.DeploymentService.GetStatement(idOne, "create"));
                AssertVariable(env, idTwo, 22);

                env.Undeploy(idTwo);
                Assert.IsNull(env.Runtime.DeploymentService.GetStatement(idTwo, "create"));
            }
            public void Run(RegressionEnvironment env)
            {
                var eplOne = "create expression my_expression { 1 } ;\n" +
                             "@Name('s0') select my_expression as c0 from SupportBean#lastevent;\n";
                var idOne = env.DeployGetId(env.Compile(eplOne));

                var eplTwo = "create expression my_expression { 2 } ;\n" +
                             "@Name('s0') select my_expression as c0 from SupportBean#lastevent;\n";
                var idTwo = env.DeployGetId(env.Compile(eplTwo));
                env.SendEventBean(new SupportBean());

                AssertSelect(env, idOne, 1);
                AssertSelect(env, idTwo, 2);

                env.Undeploy(idOne);
                Assert.IsNull(env.Runtime.DeploymentService.GetStatement(idOne, "s0"));

                AssertSelect(env, idTwo, 2);

                env.Undeploy(idTwo);
            }
            public void Run(RegressionEnvironment env)
            {
                var eplInfra = namedWindow
                    ? "@Name('create') create window MyInfra#keepall as (col1 string, myIdent string);\n"
                    : "@Name('create') create table MyInfra(col1 string primary key, myIdent string);\n";
                var epl = eplInfra +
                          "insert into MyInfra select TheString as col1, $X as myIdent from SupportBean;\n";
                var idOne = env.DeployGetId(env.Compile(epl.Replace("$X", "'A'")));
                var idTwo = env.DeployGetId(env.Compile(epl.Replace("$X", "'B'")));

                env.SendEventBean(new SupportBean("E1", 0));
                env.SendEventBean(new SupportBean("E2", 0));
                AssertRowsNamedWindow(env, idOne, "A");
                AssertRowsNamedWindow(env, idTwo, "B");

                env.Undeploy(idOne);
                AssertRowsNamedWindow(env, idTwo, "B");
                Assert.IsNull(env.Runtime.DeploymentService.GetStatement(idOne, "create"));

                env.Undeploy(idTwo);
                Assert.IsNull(env.Runtime.DeploymentService.GetStatement(idTwo, "create"));
            }