示例#1
0
        private void RunAssertionOM(EPServiceProvider epService)
        {
            var model = new EPStatementObjectModel();

            model.CreateVariable = CreateVariableClause.Create("long", "var1OM", null);
            epService.EPAdministrator.Create(model);
            Assert.AreEqual("create variable long var1OM", model.ToEPL());

            model = new EPStatementObjectModel();
            model.CreateVariable = CreateVariableClause.Create("string", "var2OM", Expressions.Constant("abc"));
            epService.EPAdministrator.Create(model);
            Assert.AreEqual("create variable string var2OM = \"abc\"", model.ToEPL());

            string      stmtTextSelect = "select var1OM, var2OM from " + typeof(SupportBean).FullName;
            EPStatement stmtSelect     = epService.EPAdministrator.CreateEPL(stmtTextSelect);
            var         listener       = new SupportUpdateListener();

            stmtSelect.Events += listener.Update;

            var fieldsVar = new string[] { "var1OM", "var2OM" };

            SendSupportBean(epService, "E1", 10);
            EPAssertionUtil.AssertProps(listener.AssertOneGetNewAndReset(), fieldsVar, new object[] { null, "abc" });

            SupportModelHelper.CompileCreate(epService, "create variable double[] arrdouble = {1.0d,2.0d}");

            stmtSelect.Dispose();
        }
示例#2
0
            public void Run(RegressionEnvironment env)
            {
                var path = new RegressionPath();
                var model = new EPStatementObjectModel();
                model.CreateVariable = CreateVariableClause.Create("long", "var1OMCreate", null);
                env.CompileDeploy(model, path);
                Assert.AreEqual("create variable long var1OMCreate", model.ToEPL());

                model = new EPStatementObjectModel();
                model.CreateVariable = CreateVariableClause.Create(
                    "string",
                    "var2OMCreate",
                    Expressions.Constant("abc"));
                env.CompileDeploy(model, path);
                Assert.AreEqual("create variable string var2OMCreate = \"abc\"", model.ToEPL());

                var stmtTextSelect = "@Name('s0') select var1OMCreate, var2OMCreate from SupportBean";
                env.CompileDeploy(stmtTextSelect, path).AddListener("s0");

                string[] fieldsVar = {"var1OMCreate", "var2OMCreate"};
                SendSupportBean(env, "E1", 10);
                EPAssertionUtil.AssertProps(
                    env.Listener("s0").AssertOneGetNewAndReset(),
                    fieldsVar,
                    new object[] {null, "abc"});

                env.CompileDeploy("create variable double[] arrdouble = {1.0d,2.0d}");

                env.UndeployAll();
            }
        /// <summary>
        /// Creates the variable.
        /// </summary>
        /// <param name="serviceProvider">The service provider.</param>
        /// <param name="variableName">Name of the variable.</param>
        /// <param name="variableType">Type of the variable.</param>
        /// <param name="assignment">The assignment.</param>
        public static void CreateVariable(this EPServiceProvider serviceProvider,
                                          string variableName,
                                          string variableType,
                                          System.Linq.Expressions.Expression <Func <object> > assignment)
        {
            var objectModel = new EPStatementObjectModel();

            objectModel.CreateVariable = CreateVariableClause.Create(variableType, variableName);
            objectModel.CreateVariable.OptionalAssignment = LinqToSoda.LinqToSodaExpression(assignment);
            serviceProvider.EPAdministrator.Create(objectModel);
        }
示例#4
0
        public void TestOM()
        {
            var model = new EPStatementObjectModel();

            model.CreateVariable = CreateVariableClause.Create("long", "var1", null);
            _epService.EPAdministrator.Create(model);
            Assert.AreEqual("create variable long var1", model.ToEPL());

            model = new EPStatementObjectModel();
            model.CreateVariable = CreateVariableClause.Create("string", "var2", Expressions.Constant("abc"));
            _epService.EPAdministrator.Create(model);
            Assert.AreEqual("create variable string var2 = \"abc\"", model.ToEPL());

            String      stmtTextSelect = "select var1, var2 from " + typeof(SupportBean).FullName;
            EPStatement stmtSelect     = _epService.EPAdministrator.CreateEPL(stmtTextSelect);

            stmtSelect.Events += _listener.Update;

            String[] fieldsVar = new String[] { "var1", "var2" };
            SendSupportBean("E1", 10);
            EPAssertionUtil.AssertProps(_listener.AssertOneGetNewAndReset(), fieldsVar, new Object[] { null, "abc" });

            SupportModelHelper.CompileCreate(_epService, "create variable double[] arrdouble = {1.0d,2.0d}");
        }