Exemple #1
0
        private void RunAssertion(CaseEnum caseEnum, String uniqueFields, String whereClause, bool unique, IndexAssertionEventSend assertion)
        {
            String eplUnique = INDEX_CALLBACK_HOOK +
                               "select * from ";

            if (caseEnum == CaseEnum.UNIDIRECTIONAL || caseEnum == CaseEnum.UNIDIRECTIONAL_3STREAM)
            {
                eplUnique += "SSB1 as ssb1 unidirectional ";
            }
            else
            {
                eplUnique += "SSB1#lastevent as ssb1 ";
            }
            eplUnique += ", SSB2#unique(" + uniqueFields + ") as ssb2 ";
            if (caseEnum == CaseEnum.UNIDIRECTIONAL_3STREAM || caseEnum == CaseEnum.MULTIDIRECTIONAL_3STREAM)
            {
                eplUnique += ", SupportBean#lastevent ";
            }
            eplUnique += whereClause;

            EPStatement stmtUnique = _epService.EPAdministrator.CreateEPL(eplUnique);

            stmtUnique.Events += _listener.Update;

            SupportQueryPlanIndexHook.AssertJoinOneStreamAndReset(unique);

            _epService.EPRuntime.SendEvent(new SupportBean("JOINEVENT", 1));
            assertion.Invoke();

            stmtUnique.Dispose();
        }
Exemple #2
0
        private static void TryAssertion(
            RegressionEnvironment env,
            bool disableImplicitUniqueIdx,
            string uniqueFields,
            string whereClause,
            string backingTable,
            IndexAssertionEventSend assertion)
        {
            SupportQueryPlanIndexHook.Reset();
            var eplUnique = "@Name('s0')" +
                            INDEX_CALLBACK_HOOK +
                            "select S1 as c0, " +
                            "(select S2 from SupportSimpleBeanTwo#unique(" +
                            uniqueFields +
                            ") as ssb2 " +
                            whereClause +
                            ") as c1 " +
                            "from SupportSimpleBeanOne as ssb1";
            if (disableImplicitUniqueIdx) {
                eplUnique = "@Hint('DISABLE_UNIQUE_IMPLICIT_IDX')" + eplUnique;
            }

            env.CompileDeploy(eplUnique).AddListener("s0");

            SupportQueryPlanIndexHook.AssertSubqueryBackingAndReset(SUBQUERY_NUM_FIRST, null, backingTable);

            assertion.Invoke();

            env.UndeployAll();
        }
        private void TryAssertionVirtualDW(
            RegressionEnvironment env,
            CaseEnum caseEnum,
            string uniqueFields,
            string whereClause,
            bool unique,
            IndexAssertionEventSend assertion)
        {
            SupportQueryPlanIndexHook.Reset();
            SupportVirtualDWForge.UniqueKeys = new HashSet<string>(Arrays.AsList(uniqueFields.SplitCsv()));

            var path = new RegressionPath();
            env.CompileDeploy("create window MyVDW.test:vdw() as SupportBean", path);
            var window = (SupportVirtualDW) GetFromContext(env, "/virtualdw/MyVDW");
            var supportBean = new SupportBean("S1", 101);
            supportBean.DoublePrimitive = 102;
            supportBean.LongPrimitive = 103;
            window.Data = Collections.SingletonSet<object>(supportBean);

            var eplUnique = IndexBackingTableInfo.INDEX_CALLBACK_HOOK +
                            "@Name('s0') select * from ";

            if (caseEnum == CaseEnum.UNIDIRECTIONAL) {
                eplUnique += "SupportSimpleBeanOne as ssb1 unidirectional ";
            }
            else {
                eplUnique += "SupportSimpleBeanOne#lastevent as ssb1 ";
            }

            eplUnique += ", MyVDW as vdw ";
            eplUnique += whereClause;

            env.CompileDeploy(eplUnique, path).AddListener("s0");

            // assert query plan
            SupportQueryPlanIndexHook.AssertJoinOneStreamAndReset(unique);

            // run assertion
            assertion.Invoke();

            env.UndeployAll();
            SupportVirtualDWForge.UniqueKeys = null;
        }
Exemple #4
0
        private void RunAssertion(bool disableImplicitUniqueIdx, String uniqueFields, String whereClause, String backingTable, IndexAssertionEventSend assertion)
        {
            String eplUnique = INDEX_CALLBACK_HOOK + "select s1 as c0, " +
                               "(select s2 from SSB2.std:unique(" + uniqueFields + ") as ssb2 " + whereClause + ") as c1 " +
                               "from SSB1 as ssb1";

            if (disableImplicitUniqueIdx)
            {
                eplUnique = "@Hint('DISABLE_UNIQUE_IMPLICIT_IDX')" + eplUnique;
            }
            EPStatement stmtUnique = _epService.EPAdministrator.CreateEPL(eplUnique);

            stmtUnique.Events += _listener.Update;

            SupportQueryPlanIndexHook.AssertSubqueryBackingAndReset(0, null, backingTable);

            assertion.Invoke();

            stmtUnique.Dispose();
        }
Exemple #5
0
        private void TryAssertionVirtualDW(EPServiceProvider epService, SupportUpdateListener listener, CaseEnum caseEnum, string uniqueFields, string whereClause, bool unique, IndexAssertionEventSend assertion)
        {
            SupportQueryPlanIndexHook.Reset();
            SupportVirtualDWFactory.UniqueKeys = new HashSet <string>(uniqueFields.Split(','));
            epService.EPAdministrator.CreateEPL("create window MyVDW.test:vdw() as SupportBean");
            SupportVirtualDW window = (SupportVirtualDW)GetFromContext(epService, "/virtualdw/MyVDW");
            var supportBean         = new SupportBean("S1", 101);

            supportBean.DoublePrimitive = 102;
            supportBean.LongPrimitive   = 103;
            window.Data = Collections.SingletonList <object>(supportBean);

            string eplUnique = INDEX_CALLBACK_HOOK +
                               "select * from ";

            if (caseEnum == CaseEnum.UNIDIRECTIONAL)
            {
                eplUnique += "SSB1 as ssb1 unidirectional ";
            }
            else
            {
                eplUnique += "SSB1#lastevent as ssb1 ";
            }
            eplUnique += ", MyVDW as vdw ";
            eplUnique += whereClause;

            EPStatement stmtUnique = epService.EPAdministrator.CreateEPL(eplUnique);

            stmtUnique.Events += listener.Update;

            // assert query plan
            SupportQueryPlanIndexHook.AssertJoinOneStreamAndReset(unique);

            // run assertion
            assertion.Invoke();

            epService.EPAdministrator.DestroyAllStatements();
            DestroyStmtsRemoveTypes(epService);
        }
        private void RunAssertionVirtualDw(CaseEnum caseEnum, String uniqueFields, String whereClause, bool unique, IndexAssertionEventSend assertion)
        {
            SupportVirtualDWFactory.UniqueKeys = new HashSet <String>(uniqueFields.SplitCsv());
            _epService.EPAdministrator.CreateEPL("create window MyVDW.test:vdw() as SupportBean");
            var window      = (SupportVirtualDW)GetFromContext("/virtualdw/MyVDW");
            var supportBean = new SupportBean("S1", 101);

            supportBean.DoublePrimitive = 102;
            supportBean.LongPrimitive   = 103;
            window.Data = supportBean.AsSingleton();

            var eplUnique = IndexBackingTableInfo.INDEX_CALLBACK_HOOK + "select * from ";

            if (caseEnum == CaseEnum.UNIDIRECTIONAL)
            {
                eplUnique += "SSB1 as ssb1 unidirectional ";
            }
            else
            {
                eplUnique += "SSB1.std:lastevent() as ssb1 ";
            }
            eplUnique += ", MyVDW as vdw ";
            eplUnique += whereClause;

            var stmtUnique = _epService.EPAdministrator.CreateEPL(eplUnique);

            stmtUnique.Events += _listener.Update;

            // assert query plan
            SupportQueryPlanIndexHook.AssertJoinOneStreamAndReset(unique);

            // run assertion
            assertion.Invoke();

            _epService.EPAdministrator.DestroyAllStatements();
        }
Exemple #7
0
        private void RunAssertion(
            RegressionEnvironment env,
            AtomicLong milestone,
            CaseEnum caseEnum,
            string uniqueFields,
            string whereClause,
            bool unique,
            IndexAssertionEventSend assertion)
        {
            SupportQueryPlanIndexHook.Reset();
            var eplUnique = IndexBackingTableInfo.INDEX_CALLBACK_HOOK +
                            "@Name('s0') select * from ";

            if (caseEnum == CaseEnum.UNIDIRECTIONAL || caseEnum == CaseEnum.UNIDIRECTIONAL_3STREAM) {
                eplUnique += "SupportSimpleBeanOne as ssb1 unidirectional ";
            }
            else {
                eplUnique += "SupportSimpleBeanOne#lastevent as ssb1 ";
            }

            eplUnique += ", SupportSimpleBeanTwo#unique(" + uniqueFields + ") as ssb2 ";
            if (caseEnum == CaseEnum.UNIDIRECTIONAL_3STREAM || caseEnum == CaseEnum.MULTIDIRECTIONAL_3STREAM) {
                eplUnique += ", SupportBean#lastevent ";
            }

            eplUnique += whereClause;

            env.CompileDeployAddListenerMile(eplUnique, "s0", milestone.GetAndIncrement());

            SupportQueryPlanIndexHook.AssertJoinOneStreamAndReset(unique);

            env.SendEventBean(new SupportBean("JOINEVENT", 1));
            assertion.Invoke();

            env.UndeployAll();
        }