Exemple #1
0
            public void Run(RegressionEnvironment env)
            {
                var fields = "g,ge".SplitCsv();
                var epl    = "@Name('s0') select " +
                             "LongBoxed > any ({1, 2}, IntArr, IntCol) as g, " +
                             "LongBoxed >= any ({1, 2}, IntArr, IntCol) as ge " +
                             "from SupportBeanArrayCollMap";

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

                var arrayBean = new SupportBeanArrayCollMap(new[] { 1, 2 });

                arrayBean.IntCol    = Arrays.AsList(1, 2);
                arrayBean.LongBoxed = 1L;
                env.SendEventBean(arrayBean);
                EPAssertionUtil.AssertProps(env.Listener("s0").AssertOneGetNewAndReset(), fields, false, true);

                arrayBean.LongBoxed = 2L;
                env.SendEventBean(arrayBean);
                EPAssertionUtil.AssertProps(env.Listener("s0").AssertOneGetNewAndReset(), fields, true, true);

                arrayBean           = new SupportBeanArrayCollMap(new[] { 2, 2 });
                arrayBean.IntCol    = Arrays.AsList(2, 1);
                arrayBean.LongBoxed = 1L;
                env.SendEventBean(arrayBean);
                EPAssertionUtil.AssertProps(env.Listener("s0").AssertOneGetNewAndReset(), fields, false, true);

                arrayBean           = new SupportBeanArrayCollMap(new[] { 1, 1 });
                arrayBean.IntCol    = Arrays.AsList(1, 1);
                arrayBean.LongBoxed = 0L;
                env.SendEventBean(arrayBean);
                EPAssertionUtil.AssertProps(env.Listener("s0").AssertOneGetNewAndReset(), fields, false, false);

                env.UndeployAll();
            }
Exemple #2
0
        private void RunAssertionInWildcard(EPServiceProvider epService)
        {
            epService.EPAdministrator.Configuration.AddEventType("ArrayBean", typeof(SupportBeanArrayCollMap));
            string stmtText = "select s0.anyObject in (select * from S1#length(1000)) as value from ArrayBean s0";

            EPStatement stmt     = epService.EPAdministrator.CreateEPL(stmtText);
            var         listener = new SupportUpdateListener();

            stmt.Events += listener.Update;

            var s1        = new SupportBean_S1(100);
            var arrayBean = new SupportBeanArrayCollMap(s1);

            epService.EPRuntime.SendEvent(s1);
            epService.EPRuntime.SendEvent(arrayBean);
            Assert.AreEqual(true, listener.AssertOneGetNewAndReset().Get("value"));

            var s2 = new SupportBean_S2(100);

            arrayBean.AnyObject = s2;
            epService.EPRuntime.SendEvent(s2);
            epService.EPRuntime.SendEvent(arrayBean);
            Assert.AreEqual(false, listener.AssertOneGetNewAndReset().Get("value"));

            stmt.Dispose();
        }
Exemple #3
0
        public void TestRelationalOpAnyArray()
        {
            String[] fields   = "g,ge".Split(',');
            String   stmtText = "select " +
                                "LongBoxed > any ({1, 2}, intArr, intCol) as g, " +
                                "LongBoxed >= any ({1, 2}, intArr, intCol) as ge " +
                                "from ArrayBean";
            EPStatement stmt = _epService.EPAdministrator.CreateEPL(stmtText);

            stmt.Events += _listener.Update;

            SupportBeanArrayCollMap arrayBean = new SupportBeanArrayCollMap(new int[] { 1, 2 });

            arrayBean.IntCol    = new[] { 1, 2 };
            arrayBean.LongBoxed = 1L;
            _epService.EPRuntime.SendEvent(arrayBean);
            EPAssertionUtil.AssertProps(_listener.AssertOneGetNewAndReset(), fields, new Object[] { false, true });

            arrayBean.LongBoxed = 2L;
            _epService.EPRuntime.SendEvent(arrayBean);
            EPAssertionUtil.AssertProps(_listener.AssertOneGetNewAndReset(), fields, new Object[] { true, true });

            arrayBean           = new SupportBeanArrayCollMap(new int[] { 2, 2 });
            arrayBean.IntCol    = new[] { 2, 1 };
            arrayBean.LongBoxed = 1L;
            _epService.EPRuntime.SendEvent(arrayBean);
            EPAssertionUtil.AssertProps(_listener.AssertOneGetNewAndReset(), fields, new Object[] { false, true });

            arrayBean           = new SupportBeanArrayCollMap(new int[] { 1, 1 });
            arrayBean.IntCol    = new[] { 1, 1 };
            arrayBean.LongBoxed = 0L;
            _epService.EPRuntime.SendEvent(arrayBean);
            EPAssertionUtil.AssertProps(_listener.AssertOneGetNewAndReset(), fields, new Object[] { false, false });
        }
Exemple #4
0
        public void TestEqualsAnyArray()
        {
            String[] fields   = "e,ne".Split(',');
            String   stmtText = "select " +
                                "LongBoxed = any ({1, 1}, intArr, longCol) as e, " +
                                "LongBoxed != any ({1, 1}, intArr, longCol) as ne " +
                                "from ArrayBean";
            EPStatement stmt = _epService.EPAdministrator.CreateEPL(stmtText);

            stmt.Events += _listener.Update;

            SupportBeanArrayCollMap arrayBean = new SupportBeanArrayCollMap(new int[] { 1, 1 });

            arrayBean.LongCol = new List <long?>()
            {
                1L, 1L
            };
            arrayBean.LongBoxed = 1L;
            _epService.EPRuntime.SendEvent(arrayBean);
            EPAssertionUtil.AssertProps(_listener.AssertOneGetNewAndReset(), fields, new Object[] { true, false });

            arrayBean.IntArr = new int[] { 1, 1, 0 };
            _epService.EPRuntime.SendEvent(arrayBean);
            EPAssertionUtil.AssertProps(_listener.AssertOneGetNewAndReset(), fields, new Object[] { true, true });

            arrayBean.LongBoxed = 2L;
            _epService.EPRuntime.SendEvent(arrayBean);
            EPAssertionUtil.AssertProps(_listener.AssertOneGetNewAndReset(), fields, new Object[] { false, true });
        }
        private void RunAssertionEqualsAnyArray(EPServiceProvider epService)
        {
            string[] fields   = "e,ne".Split(',');
            string   stmtText = "select " +
                                "LongBoxed = any ({1, 1}, intArr, longCol) as e, " +
                                "LongBoxed != any ({1, 1}, intArr, longCol) as ne " +
                                "from ArrayBean";
            EPStatement stmt     = epService.EPAdministrator.CreateEPL(stmtText);
            var         listener = new SupportUpdateListener();

            stmt.Events += listener.Update;

            var arrayBean = new SupportBeanArrayCollMap(new int[] { 1, 1 });

            arrayBean.LongCol   = Collections.List <long?>(1L, 1L);
            arrayBean.LongBoxed = 1L;
            epService.EPRuntime.SendEvent(arrayBean);
            EPAssertionUtil.AssertProps(listener.AssertOneGetNewAndReset(), fields, new object[] { true, false });

            arrayBean.IntArr = new int[] { 1, 1, 0 };
            epService.EPRuntime.SendEvent(arrayBean);
            EPAssertionUtil.AssertProps(listener.AssertOneGetNewAndReset(), fields, new object[] { true, true });

            arrayBean.LongBoxed = 2L;
            epService.EPRuntime.SendEvent(arrayBean);
            EPAssertionUtil.AssertProps(listener.AssertOneGetNewAndReset(), fields, new object[] { false, true });

            stmt.Dispose();
        }
Exemple #6
0
            private SupportBeanArrayCollMap MakeBean()
            {
                var arrayBean = new SupportBeanArrayCollMap(new[] { 1, 2 });

                arrayBean.IntCol    = Arrays.AsList(1, 2);
                arrayBean.LongBoxed = 3L;
                return(arrayBean);
            }
Exemple #7
0
            private SupportBeanArrayCollMap MakeArrayBean()
            {
                var arrayBean = new SupportBeanArrayCollMap(new[] { 1, 1 });

                arrayBean.LongCol   = Arrays.AsList(1L, 1L);
                arrayBean.LongBoxed = 1L;
                return(arrayBean);
            }
Exemple #8
0
            private static SupportBeanArrayCollMap Make()
            {
                var s1        = new SupportBean_S1(100);
                var arrayBean = new SupportBeanArrayCollMap(s1);

                arrayBean.ObjectArr = new object[] { null, "a", false, s1 };
                return(arrayBean);
            }
        private void RunAssertionRelationalOpAllArray(EPServiceProvider epService)
        {
            string[] fields   = "g,ge".Split(',');
            string   stmtText = "select " +
                                "LongBoxed>all({1,2},intArr,intCol) as g, " +
                                "LongBoxed>=all({1,2},intArr,intCol) as ge " +
                                "from ArrayBean";
            EPStatement stmt     = epService.EPAdministrator.CreateEPL(stmtText);
            var         listener = new SupportUpdateListener();

            stmt.Events += listener.Update;

            var arrayBean = new SupportBeanArrayCollMap(new int[] { 1, 2 });

            arrayBean.IntCol    = Collections.List(1, 2);
            arrayBean.LongBoxed = 3L;
            epService.EPRuntime.SendEvent(arrayBean);
            EPAssertionUtil.AssertProps(listener.AssertOneGetNewAndReset(), fields, new object[] { true, true });

            arrayBean.LongBoxed = 2L;
            epService.EPRuntime.SendEvent(arrayBean);
            EPAssertionUtil.AssertProps(listener.AssertOneGetNewAndReset(), fields, new object[] { false, true });

            arrayBean           = new SupportBeanArrayCollMap(new int[] { 1, 3 });
            arrayBean.IntCol    = Collections.List(1, 2);
            arrayBean.LongBoxed = 3L;
            epService.EPRuntime.SendEvent(arrayBean);
            EPAssertionUtil.AssertProps(listener.AssertOneGetNewAndReset(), fields, new object[] { false, true });

            arrayBean           = new SupportBeanArrayCollMap(new int[] { 1, 2 });
            arrayBean.IntCol    = Collections.List(1, 3);
            arrayBean.LongBoxed = 3L;
            epService.EPRuntime.SendEvent(arrayBean);
            EPAssertionUtil.AssertProps(listener.AssertOneGetNewAndReset(), fields, new object[] { false, true });

            // test OM
            stmt.Dispose();
            EPStatementObjectModel model = epService.EPAdministrator.CompileEPL(stmtText);

            Assert.AreEqual(stmtText.Replace("<>", "!="), model.ToEPL());
            stmt         = epService.EPAdministrator.Create(model);
            stmt.Events += listener.Update;

            arrayBean           = new SupportBeanArrayCollMap(new int[] { 1, 2 });
            arrayBean.IntCol    = Collections.List(1, 2);
            arrayBean.LongBoxed = 3L;
            epService.EPRuntime.SendEvent(arrayBean);
            EPAssertionUtil.AssertProps(listener.AssertOneGetNewAndReset(), fields, new object[] { true, true });

            stmt.Dispose();
        }
Exemple #10
0
            public void Run(RegressionEnvironment env)
            {
                var fields       = "g,ge".SplitCsv();
                var eplReference = new Atomic <string>();
                var builder      = new SupportEvalBuilder("SupportBeanArrayCollMap")
                                   .WithExpressions(fields, "LongBoxed>all({1,2},IntArr,IntCol)", "LongBoxed>=all({1,2},IntArr,IntCol)")
                                   .WithStatementConsumer(stmt => eplReference.Set(stmt.GetProperty(StatementProperty.EPL).ToString()));

                var arrayBean = MakeBean();

                arrayBean.IntCol    = Arrays.AsList(1, 2);
                arrayBean.LongBoxed = 3L;
                builder.WithAssertion(arrayBean).Expect(fields, true, true);

                arrayBean           = MakeBean();
                arrayBean.LongBoxed = 2L;
                env.SendEventBean(arrayBean);
                builder.WithAssertion(arrayBean).Expect(fields, false, true);

                arrayBean           = new SupportBeanArrayCollMap(new[] { 1, 3 });
                arrayBean.IntCol    = Arrays.AsList(1, 2);
                arrayBean.LongBoxed = 3L;
                env.SendEventBean(arrayBean);
                builder.WithAssertion(arrayBean).Expect(fields, false, true);

                arrayBean           = new SupportBeanArrayCollMap(new[] { 1, 2 });
                arrayBean.IntCol    = Arrays.AsList(1, 3);
                arrayBean.LongBoxed = 3L;
                env.SendEventBean(arrayBean);
                builder.WithAssertion(arrayBean).Expect(fields, false, true);

                builder.Run(env);
                env.UndeployAll();

                // test OM
                var epl   = eplReference.Get();
                var model = env.EplToModel(epl);

                Assert.AreEqual(epl.Replace("<>", "!="), model.ToEPL());
                env.CompileDeploy(model).AddListener("s0");

                arrayBean           = new SupportBeanArrayCollMap(new[] { 1, 2 });
                arrayBean.IntCol    = Arrays.AsList(1, 2);
                arrayBean.LongBoxed = 3L;
                env.SendEventBean(arrayBean);
                EPAssertionUtil.AssertProps(env.Listener("s0").AssertOneGetNewAndReset(), fields, true, true);

                env.UndeployAll();
            }
Exemple #11
0
        public void TestRelationalOpAllArray()
        {
            String[] fields   = "g,ge".Split(',');
            String   stmtText = "select " +
                                "LongBoxed>all ({1,2},intArr,intCol) as g, " +
                                "LongBoxed>=all ({1,2},intArr,intCol) as ge " +
                                "from ArrayBean";
            EPStatement stmt = _epService.EPAdministrator.CreateEPL(stmtText);

            stmt.Events += _listener.Update;

            SupportBeanArrayCollMap arrayBean = new SupportBeanArrayCollMap(new int[] { 1, 2 });

            arrayBean.IntCol    = new int[] { 1, 2 };
            arrayBean.LongBoxed = 3L;
            _epService.EPRuntime.SendEvent(arrayBean);
            EPAssertionUtil.AssertProps(_listener.AssertOneGetNewAndReset(), fields, new Object[] { true, true });

            arrayBean.LongBoxed = 2L;
            _epService.EPRuntime.SendEvent(arrayBean);
            EPAssertionUtil.AssertProps(_listener.AssertOneGetNewAndReset(), fields, new Object[] { false, true });

            arrayBean           = new SupportBeanArrayCollMap(new int[] { 1, 3 });
            arrayBean.IntCol    = new[] { 1, 2 };
            arrayBean.LongBoxed = 3L;
            _epService.EPRuntime.SendEvent(arrayBean);
            EPAssertionUtil.AssertProps(_listener.AssertOneGetNewAndReset(), fields, new Object[] { false, true });

            arrayBean           = new SupportBeanArrayCollMap(new int[] { 1, 2 });
            arrayBean.IntCol    = new[] { 1, 3 };
            arrayBean.LongBoxed = 3L;
            _epService.EPRuntime.SendEvent(arrayBean);
            EPAssertionUtil.AssertProps(_listener.AssertOneGetNewAndReset(), fields, new Object[] { false, true });

            // test OM
            stmt.Dispose();
            EPStatementObjectModel model = _epService.EPAdministrator.CompileEPL(stmtText);

            Assert.AreEqual(stmtText.Replace("<>", "!="), model.ToEPL());
            stmt         = _epService.EPAdministrator.Create(model);
            stmt.Events += _listener.Update;

            arrayBean           = new SupportBeanArrayCollMap(new int[] { 1, 2 });
            arrayBean.IntCol    = new[] { 1, 2 };
            arrayBean.LongBoxed = 3L;
            _epService.EPRuntime.SendEvent(arrayBean);
            EPAssertionUtil.AssertProps(_listener.AssertOneGetNewAndReset(), fields, new Object[] { true, true });
        }
            public void Run(RegressionEnvironment env)
            {
                var epl = "@Name('stmt1') select S0.AnyObject in (ObjectArr) as value from SupportBeanArrayCollMap S0";

                env.CompileDeploy(epl).AddListener("stmt1");

                var s1 = new SupportBean_S1(100);
                var arrayBean = new SupportBeanArrayCollMap(s1);
                arrayBean.ObjectArr = new object[] {null, "a", false, s1};
                env.SendEventBean(arrayBean);
                Assert.AreEqual(true, env.Listener("stmt1").AssertOneGetNewAndReset().Get("value"));

                arrayBean.AnyObject = null;
                env.SendEventBean(arrayBean);
                Assert.IsNull(env.Listener("stmt1").AssertOneGetNewAndReset().Get("value"));

                env.UndeployAll();
            }
Exemple #13
0
            public void Run(RegressionEnvironment env)
            {
                var stmtText =
                    "@Name('s0') select S0.AnyObject in (select * from SupportBean_S1#length(1000)) as value from SupportBeanArrayCollMap S0";
                env.CompileDeployAddListenerMileZero(stmtText, "s0");

                var s1 = new SupportBean_S1(100);
                var arrayBean = new SupportBeanArrayCollMap(s1);
                env.SendEventBean(s1);
                env.SendEventBean(arrayBean);
                Assert.AreEqual(true, env.Listener("s0").AssertOneGetNewAndReset().Get("value"));

                var s2 = new SupportBean_S2(100);
                arrayBean.AnyObject = s2;
                env.SendEventBean(s2);
                env.SendEventBean(arrayBean);
                Assert.AreEqual(false, env.Listener("s0").AssertOneGetNewAndReset().Get("value"));

                env.UndeployAll();
            }
Exemple #14
0
        private void RunAssertionInObject(EPServiceProvider epService)
        {
            epService.EPAdministrator.Configuration.AddEventType("ArrayBean", typeof(SupportBeanArrayCollMap));
            var stmtText = "select s0.anyObject in (objectArr) as value from ArrayBean s0";

            var stmt     = epService.EPAdministrator.CreateEPL(stmtText);
            var listener = new SupportUpdateListener();

            stmt.Events += listener.Update;

            var s1        = new SupportBean_S1(100);
            var arrayBean = new SupportBeanArrayCollMap(s1);

            arrayBean.ObjectArr = new object[] { null, "a", false, s1 };
            epService.EPRuntime.SendEvent(arrayBean);
            Assert.AreEqual(true, listener.AssertOneGetNewAndReset().Get("value"));

            arrayBean.AnyObject = null;
            epService.EPRuntime.SendEvent(arrayBean);
            Assert.IsNull(listener.AssertOneGetNewAndReset().Get("value"));

            stmt.Dispose();
        }
Exemple #15
0
        public void TestInWildcard()
        {
            _epService.EPAdministrator.Configuration.AddEventType("ArrayBean", typeof(SupportBeanArrayCollMap));
            String stmtText = "select s0.anyObject in (select * from S1#length(1000)) as value from ArrayBean s0";

            EPStatement stmt = _epService.EPAdministrator.CreateEPL(stmtText);

            stmt.Events += _listener.Update;

            SupportBean_S1          s1        = new SupportBean_S1(100);
            SupportBeanArrayCollMap arrayBean = new SupportBeanArrayCollMap(s1);

            _epService.EPRuntime.SendEvent(s1);
            _epService.EPRuntime.SendEvent(arrayBean);
            Assert.AreEqual(true, _listener.AssertOneGetNewAndReset().Get("value"));

            SupportBean_S2 s2 = new SupportBean_S2(100);

            arrayBean.AnyObject = s2;
            _epService.EPRuntime.SendEvent(s2);
            _epService.EPRuntime.SendEvent(arrayBean);
            Assert.AreEqual(false, _listener.AssertOneGetNewAndReset().Get("value"));
        }
Exemple #16
0
        public void TestInObject()
        {
            _epService.EPAdministrator.Configuration.AddEventType(
                "ArrayBean", typeof(SupportBeanArrayCollMap));
            String stmtText = "select s0.anyObject in (objectArr) as value from ArrayBean s0";

            EPStatement stmt = _epService.EPAdministrator.CreateEPL(stmtText);

            stmt.Events += _listener.Update;

            var s1        = new SupportBean_S1(100);
            var arrayBean = new SupportBeanArrayCollMap(s1);

            arrayBean.ObjectArr = new Object[]
            {
                null, "a", false, s1
            };
            _epService.EPRuntime.SendEvent(arrayBean);
            Assert.AreEqual(true, _listener.AssertOneGetNewAndReset().Get("value"));

            arrayBean.AnyObject = null;
            _epService.EPRuntime.SendEvent(arrayBean);
            Assert.IsNull(_listener.AssertOneGetNewAndReset().Get("value"));
        }
Exemple #17
0
 private static void SendArrayCollMap(
     RegressionEnvironment env,
     SupportBeanArrayCollMap @event)
 {
     env.SendEventBean(@event);
 }