예제 #1
0
 private Object[][] GetAndResetNewEvents()
 {
     EventBean[] newEvents = updateListener.LastNewData;
     Assert.NotNull(newEvents, "no events received");
     updateListener.Reset();
     return(ArrayHandlingUtil.GetUnderlyingEvents(newEvents, new[] { "s0", "s1", "s2" }));
 }
예제 #2
0
 private object[][] GetAndResetNewEvents(SupportUpdateListener listener)
 {
     EventBean[] newEvents = listener.LastNewData;
     Assert.IsNotNull(newEvents, "no events received");
     listener.Reset();
     return(ArrayHandlingUtil.GetUnderlyingEvents(newEvents, new string[] { "s0", "s1", "s2" }));
 }
예제 #3
0
 private static object[][] GetAndResetNewEvents(RegressionEnvironment env)
 {
     var newEvents = env.Listener("s0").LastNewData;
     Assert.IsNotNull(newEvents, "no events received");
     env.Listener("s0").Reset();
     return ArrayHandlingUtil.GetUnderlyingEvents(newEvents, new[] {"S0", "S1", "S2"});
 }
예제 #4
0
 private object[][] GetAndResetNewEvents()
 {
     EventBean[] newEvents = _updateListener.LastNewData;
     _updateListener.Reset();
     return(ArrayHandlingUtil.GetUnderlyingEvents(
                newEvents, new string[]
     {
         "s0",
         "s1",
         "s2"
     }));
 }
        public void Run(RegressionEnvironment env)
        {
            var path = new RegressionPath();
            env.AdvanceTime(0);
            env.CompileDeploy("@Name('0') create schema StatementMetric as " + typeof(StatementMetric).FullName);
            env.CompileDeploy("@Name('A') create window MyWindow#lastevent as select * from SupportBean", path);
            env.CompileDeploy("@Name('B1') insert into MyWindow select * from SupportBean", path);
            env.CompileDeploy("@Name('B2') insert into MyWindow select * from SupportBean", path);
            env.CompileDeploy("@Name('C') select sum(IntPrimitive) from MyWindow", path);
            env.CompileDeploy("@Name('D') select sum(w1.IntPrimitive) from MyWindow w1, MyWindow w2", path);

            var appModuleTwo = "@Name('W') create window SupportBeanWindow#keepall as SupportBean;" +
                               "" +
                               "@Name('M') on SupportBean oe\n" +
                               "  merge SupportBeanWindow Pw\n" +
                               "  where Pw.TheString = oe.TheString\n" +
                               "  when not matched \n" +
                               "    then insert select *\n" +
                               "  when matched and oe.IntPrimitive=1\n" +
                               "    then delete\n" +
                               "  when matched\n" +
                               "    then update set Pw.IntPrimitive = oe.IntPrimitive";
            env.CompileDeploy(appModuleTwo, path);

            env.CompileDeploy("@Name('X') select * from " + typeof(StatementMetric).FullName).AddListener("X");
            var fields = new [] { "StatementName","NumInput" };
            
            env.SendEventBean(new SupportBean("E1", 1));
            env.AdvanceTime(1000);
            var received = ArrayHandlingUtil.Reorder("StatementName", env.Listener("X").NewDataListFlattened);
            foreach (var theEvent in received) {
                Log.Info(theEvent.Get("StatementName") + " = " + theEvent.Get("NumInput"));
            }

            EPAssertionUtil.AssertPropsPerRow(
                received,
                fields,
                new[] {
                    new object[] {"A", 2L},
                    new object[] {"B1", 1L},
                    new object[] {"B2", 1L},
                    new object[] {"C", 2L},
                    new object[] {"D", 2L},
                    new object[] {"M", 1L},
                    new object[] {"W", 1L}
                });

            env.UndeployAll();
        }
예제 #6
0
        public override void Run(EPServiceProvider epService)
        {
            epService.EPRuntime.SendEvent(new CurrentTimeEvent(0));
            epService.EPAdministrator.CreateEPL("@Name('0') create schema StatementMetric as " + typeof(StatementMetric).FullName);
            epService.EPAdministrator.CreateEPL("@Name('A') create window MyWindow#lastevent as select * from SupportBean");
            epService.EPAdministrator.CreateEPL("@Name('B1') insert into MyWindow select * from SupportBean");
            epService.EPAdministrator.CreateEPL("@Name('B2') insert into MyWindow select * from SupportBean");
            epService.EPAdministrator.CreateEPL("@Name('C') select sum(IntPrimitive) from MyWindow");
            epService.EPAdministrator.CreateEPL("@Name('D') select sum(w1.IntPrimitive) from MyWindow w1, MyWindow w2");

            string appModuleTwo = "@Name('W') create window SupportBeanWindow#keepall as SupportBean;" +
                                  "" +
                                  "@Name('M') on SupportBean oe\n" +
                                  "  merge SupportBeanWindow pw\n" +
                                  "  where pw.TheString = oe.TheString\n" +
                                  "  when not matched \n" +
                                  "    then insert select *\n" +
                                  "  when matched and oe.IntPrimitive=1\n" +
                                  "    then delete\n" +
                                  "  when matched\n" +
                                  "    then update set pw.IntPrimitive = oe.IntPrimitive";

            epService.EPAdministrator.DeploymentAdmin.ParseDeploy(appModuleTwo, null, null, null);

            EPStatement stmt     = epService.EPAdministrator.CreateEPL("@Name('X') select * from StatementMetric");
            var         listener = new SupportUpdateListener();

            stmt.Events += listener.Update;
            string[] fields = "statementName,numInput".Split(',');

            epService.EPRuntime.SendEvent(new SupportBean("E1", 1));
            epService.EPRuntime.SendEvent(new CurrentTimeEvent(1000));
            EventBean[] received = ArrayHandlingUtil.Reorder("statementName", listener.GetNewDataListFlattened());
            foreach (EventBean theEvent in received)
            {
                Log.Info(theEvent.Get("statementName") + " = " + theEvent.Get("numInput"));
            }
            EPAssertionUtil.AssertPropsPerRow(received, fields, new object[][] { new object[] { "A", 2L }, new object[] { "B1", 1L }, new object[] { "B2", 1L }, new object[] { "C", 2L }, new object[] { "D", 2L }, new object[] { "M", 1L }, new object[] { "W", 1L } });

            /* Comment-in for printout.
             * for (int i = 0; i < received.Length; i++) {
             *  EventBean @event = received[i];
             *  Log.Info(@event.Get("statementName") + " " + @event.Get("wallTime") + " " + @event.Get("numInput"));
             * }
             */
        }
예제 #7
0
        public void TestNamedWindowAndViewShare()
        {
            _epService = EPServiceProviderManager.GetDefaultProvider(GetConfig(-1, 1000, false));
            _epService.Initialize();
            if (InstrumentationHelper.ENABLED)
            {
                InstrumentationHelper.StartTest(_epService, GetType(), GetType().FullName);
            }

            _epService.EPRuntime.SendEvent(new CurrentTimeEvent(0));
            _epService.EPAdministrator.CreateEPL("@Name('0') create schema StatementMetric as " + typeof(StatementMetric).FullName);
            _epService.EPAdministrator.CreateEPL("@Name('A') create window MyWindow.std:lastevent() as select * from SupportBean");
            _epService.EPAdministrator.CreateEPL("@Name('B1') insert into MyWindow select * from SupportBean");
            _epService.EPAdministrator.CreateEPL("@Name('B2') insert into MyWindow select * from SupportBean");
            _epService.EPAdministrator.CreateEPL("@Name('C') select sum(IntPrimitive) from MyWindow");
            _epService.EPAdministrator.CreateEPL("@Name('D') select sum(w1.IntPrimitive) from MyWindow w1, MyWindow w2");

            String appModuleTwo =
                "@Name('W') create window SupportBeanWindow.win:keepall() as SupportBean;" +
                "" +
                "@Name('M') on SupportBean oe\n" +
                "  merge SupportBeanWindow pw\n" +
                "  where pw.TheString = oe.TheString\n" +
                "  when not matched \n" +
                "    then insert select *\n" +
                "  when matched and oe.IntPrimitive=1\n" +
                "    then delete\n" +
                "  when matched\n" +
                "    then Update set pw.IntPrimitive = oe.IntPrimitive";

            _epService.EPAdministrator.DeploymentAdmin.ParseDeploy(appModuleTwo, null, null, null);

            EPStatement stmt = _epService.EPAdministrator.CreateEPL("@Name('X') select * from StatementMetric");

            stmt.Events += _listener.Update;
            String[] fields = "StatementName,numInput".Split(',');

            _epService.EPRuntime.SendEvent(new SupportBean("E1", 1));
            _epService.EPRuntime.SendEvent(new CurrentTimeEvent(1000));
            EventBean[] received = ArrayHandlingUtil.Reorder("StatementName", _listener.GetNewDataListFlattened());

            received.ToList().ForEach(
                theEvent => Debug.WriteLine(theEvent.Get("StatementName") + " = " + theEvent.Get("numInput")));

            EPAssertionUtil.AssertPropsPerRow(
                received, fields,
                new Object[][]
            {
                new Object[] { "A", 2L },
                new Object[] { "B1", 1L },
                new Object[] { "B2", 1L },
                new Object[] { "C", 2L },
                new Object[] { "D", 2L },
                new Object[] { "M", 1L },
                new Object[] { "W", 1L }
            });

            if (InstrumentationHelper.ENABLED)
            {
                InstrumentationHelper.EndTest();
            }
        }
예제 #8
0
 private static object[][] GetAndResetNewEvents(RegressionEnvironment env)
 {
     var newEvents = env.Listener("s0").LastNewData;
     env.Listener("s0").Reset();
     return ArrayHandlingUtil.GetUnderlyingEvents(newEvents, new[] {"S0", "S1", "S2", "S3", "S4"});
 }
예제 #9
0
 private object[][] GetAndResetNewEvents(SupportUpdateListener listener)
 {
     EventBean[] newEvents = listener.LastNewData;
     listener.Reset();
     return(ArrayHandlingUtil.GetUnderlyingEvents(newEvents, new string[] { "s0", "s1", "s2", "s3", "s4", "s5" }));
 }