private void RunAssertionUserDefined(EPServiceProvider epService)
        {
            var listener      = new SupportUpdateListener();
            var className     = typeof(SupportStaticMethodLib).FullName;
            var statementText = "select " + className + ".StaticMethod(2)" + STREAM_MDB_LEN5;
            var stmt          = epService.EPAdministrator.CreateEPL(statementText);

            stmt.Events += listener.Update;
            Assert.AreEqual(2, AssertStatementAndGetProperty(epService, listener, true, className + ".StaticMethod(2)")[0]);
            stmt.Dispose();

            // try context passed
            SupportStaticMethodLib.GetMethodInvocationContexts().Clear();
            statementText = "@Name('S0') select " + className + ".StaticMethodWithContext(2)" + STREAM_MDB_LEN5;
            stmt          = epService.EPAdministrator.CreateEPL(statementText);
            stmt.Events  += listener.Update;
            Assert.AreEqual(2, AssertStatementAndGetProperty(epService, listener, true, className + ".StaticMethodWithContext(2)")[0]);
            EPLMethodInvocationContext first = SupportStaticMethodLib.GetMethodInvocationContexts()[0];

            Assert.AreEqual("S0", first.StatementName);
            Assert.AreEqual(epService.URI, first.EngineURI);
            Assert.AreEqual(-1, first.ContextPartitionId);
            Assert.AreEqual("StaticMethodWithContext", first.FunctionName);
            stmt.Dispose();
        }
Esempio n. 2
0
        public void TestUserDefined()
        {
            var className = typeof(SupportStaticMethodLib).FullName;

            _statementText = "select " + className + ".StaticMethod(2)" + _stream;
            Assert.AreEqual(2, CreateStatementAndGetProperty(true, className + ".StaticMethod(2)")[0]);

            // try context passed
            SupportStaticMethodLib.GetMethodInvocationContexts().Clear();
            _statementText = "@Name('S0') select " + className + ".StaticMethodWithContext(2)" + _stream;
            Assert.AreEqual(2, CreateStatementAndGetProperty(true, className + ".StaticMethodWithContext(2)")[0]);
            var first = SupportStaticMethodLib.GetMethodInvocationContexts()[0];

            Assert.AreEqual("S0", first.StatementName);
            Assert.AreEqual(_epService.URI, first.EngineURI);
            Assert.AreEqual(-1, first.ContextPartitionId);
            Assert.AreEqual("StaticMethodWithContext", first.FunctionName);
        }