private static int GetIndexCount(
     RegressionEnvironment env,
     string statementName,
     string windowName)
 {
     return SupportInfraUtil.GetIndexCountNoContext(env, true, statementName, windowName);
 }
Beispiel #2
0
 private static int GetIndexCount(
     RegressionEnvironment env,
     bool namedWindow,
     string infraStmtName,
     string infraName)
 {
     return SupportInfraUtil.GetIndexCountNoContext(env, namedWindow, infraStmtName, infraName);
 }
Beispiel #3
0
            public void Run(RegressionEnvironment env)
            {
                var path = new RegressionPath();
                var stmtTextCreateOne = namedWindow
                    ? "@Name('create') create window MyInfraONR#keepall as (f1 string, f2 int)"
                    : "@Name('create') create table MyInfraONR as (f1 string primary key, f2 int primary key)";
                env.CompileDeploy(stmtTextCreateOne, path);
                env.CompileDeploy(
                    "insert into MyInfraONR(f1, f2) select TheString, IntPrimitive from SupportBean",
                    path);
                env.CompileDeploy("@Name('indexOne') create index MyInfraONRIndex1 on MyInfraONR(f2)", path);
                var fields = new [] { "f1","f2" };

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

                env.CompileDeploy(
                        "@Name('s0') on SupportBean_S0 S0 select nw.f1 as f1, nw.f2 as f2 from MyInfraONR nw where nw.f2 = S0.Id",
                        path)
                    .AddListener("s0");
                Assert.AreEqual(namedWindow ? 1 : 2, GetIndexCount(env, namedWindow, "create", "MyInfraONR"));

                env.SendEventBean(new SupportBean_S0(1));
                EPAssertionUtil.AssertProps(
                    env.Listener("s0").AssertOneGetNewAndReset(),
                    fields,
                    new object[] {"E1", 1});

                // create second identical statement
                env.CompileDeploy(
                    "@Name('stmtTwo') on SupportBean_S0 S0 select nw.f1 as f1, nw.f2 as f2 from MyInfraONR nw where nw.f2 = S0.Id",
                    path);
                Assert.AreEqual(namedWindow ? 1 : 2, GetIndexCount(env, namedWindow, "create", "MyInfraONR"));

                env.UndeployModuleContaining("s0");
                Assert.AreEqual(namedWindow ? 1 : 2, GetIndexCount(env, namedWindow, "create", "MyInfraONR"));

                env.UndeployModuleContaining("stmtTwo");
                Assert.AreEqual(namedWindow ? 1 : 2, GetIndexCount(env, namedWindow, "create", "MyInfraONR"));

                env.UndeployModuleContaining("indexOne");

                // two-key index order test
                env.CompileDeploy("@Name('cw') create window MyInfraFour#keepall as SupportBean", path);
                env.CompileDeploy("create index Idx1 on MyInfraFour (TheString, IntPrimitive)", path);
                env.CompileDeploy(
                    "on SupportBean sb select * from MyInfraFour w where w.TheString = sb.TheString and w.IntPrimitive = sb.IntPrimitive",
                    path);
                env.CompileDeploy(
                    "on SupportBean sb select * from MyInfraFour w where w.IntPrimitive = sb.IntPrimitive and w.TheString = sb.TheString",
                    path);
                Assert.AreEqual(1, SupportInfraUtil.GetIndexCountNoContext(env, true, "cw", "MyInfraFour"));

                env.UndeployAll();
            }
Beispiel #4
0
 private static int GetIndexCount(RegressionEnvironment env)
 {
     return SupportInfraUtil.GetIndexCountNoContext(env, true, "create", "MyWindow");
 }