Exemplo n.º 1
0
 public void Run(RegressionEnvironment env)
 {
     foreach (var rep in EventRepresentationChoiceExtensions.Values())
     {
         TryAssertionVariantStream(env, rep);
     }
 }
Exemplo n.º 2
0
 public void Run(RegressionEnvironment env)
 {
     var milestone = new AtomicLong();
     foreach (var rep in EventRepresentationChoiceExtensions.Values()) {
         TryAssertionScoringUseCase(env, rep, milestone);
     }
 }
Exemplo n.º 3
0
 public void Run(RegressionEnvironment env)
 {
     TryAssertionFragment(env, EventRepresentationChoice.JSON);
     foreach (var rep in EventRepresentationChoiceExtensions.Values())
     {
         TryAssertionFragment(env, rep);
     }
 }
Exemplo n.º 4
0
 public void Run(RegressionEnvironment env)
 {
     // TBD: remove this case
     TryAssertionSubselect(env, EventRepresentationChoice.JSON);
     foreach (var rep in EventRepresentationChoiceExtensions.Values()) {
         TryAssertionSubselect(env, rep);
     }
 }
Exemplo n.º 5
0
        public static IList<RegressionExecution> WithEventTypeColumnDef(IList<RegressionExecution> execs = null)
        {
            execs = execs ?? new List<RegressionExecution>();
            foreach (var rep in EventRepresentationChoiceExtensions.Values()) {
                execs.Add(new InfraEventTypeColumnDef(rep));
            }

            return execs;
        }
        public static IList<RegressionExecution> WithDispatchBackQueue(IList<RegressionExecution> execs = null)
        {
            execs = execs ?? new List<RegressionExecution>();
            foreach (var rep in EventRepresentationChoiceExtensions.Values()) {
                execs.Add(new InfraDispatchBackQueue(rep));
            }

            return execs;
        }
 public void Run(RegressionEnvironment env)
 {
     foreach (var rep in EventRepresentationChoiceExtensions.Values())
     {
         if (rep.IsMapEvent() || rep.IsObjectArrayEvent())
         {
             TryAssertionInheritance(env, rep);
         }
     }
 }
Exemplo n.º 8
0
            public void Run(RegressionEnvironment env)
            {
                foreach (EventRepresentationChoice rep in EventRepresentationChoiceExtensions.Values()) {
                    if (rep.IsJsonProvidedClassEvent()) { // assertion uses inheritance of types
                        continue;
                    }

                    TryAssertionNamedWindow(env, rep);
                }
            }
Exemplo n.º 9
0
        private void SendSchemaEvent(EPServiceProvider epService, object prop, string key)
        {
            var theEvent = new Dictionary <string, object>();

            theEvent.Put("prop", prop);
            theEvent.Put("key", key);

            if (EventRepresentationChoiceExtensions.GetEngineDefault(epService).IsObjectArrayEvent())
            {
                epService.EPRuntime.SendEvent(theEvent, "MyDynoPropSchema");
            }
            else
            {
                epService.EPRuntime.SendEvent(theEvent, "MyDynoPropSchema");
            }
        }
Exemplo n.º 10
0
        public void Run(RegressionEnvironment env)
        {
            foreach (var rep in EventRepresentationChoiceExtensions.Values()) {
                RunAssertionCreateStream(env, rep);
            }

            foreach (var rep in EventRepresentationChoiceExtensions.Values()) {
                RunAssertionCreateStreamTwo(env, rep);
            }

            foreach (var rep in EventRepresentationChoiceExtensions.Values()) {
                RunAssertPopulateFromNamedWindow(env, rep);
            }

            RunAssertionObjectArrPropertyReorder(env);
        }
        private void CreateSendEvent(EPServiceProvider engine, string typeName, string company, double value, double total)
        {
            var map = new LinkedHashMap <string, Object>();

            map.Put("company", company);
            map.Put("value", value);
            map.Put("total", total);
            if (EventRepresentationChoiceExtensions.GetEngineDefault(engine).IsObjectArrayEvent())
            {
                engine.EPRuntime.SendEvent(map.Values.ToArray(), typeName);
            }
            else
            {
                engine.EPRuntime.SendEvent(map, typeName);
            }
        }
        private void SendWindow(EPServiceProvider epService, string col0, long col1, string col2)
        {
            var theEvent = new LinkedHashMap <string, Object>();

            theEvent.Put("col0", col0);
            theEvent.Put("col1", col1);
            theEvent.Put("col2", col2);
            if (EventRepresentationChoiceExtensions.GetEngineDefault(epService).IsObjectArrayEvent())
            {
                epService.EPRuntime.SendEvent(theEvent.Values.ToArray(), "WindowSchema");
            }
            else
            {
                epService.EPRuntime.SendEvent(theEvent, "WindowSchema");
            }
        }
Exemplo n.º 13
0
        private void SendSchemaEvent(Object prop, String key)
        {
            IDictionary <String, Object> theEvent = new Dictionary <String, Object>();

            theEvent["prop"] = prop;
            theEvent["key"]  = key;

            if (EventRepresentationChoiceExtensions.GetEngineDefault(_epService).IsObjectArrayEvent())
            {
                _epService.EPRuntime.SendEvent(theEvent, "MySchema");
            }
            else
            {
                _epService.EPRuntime.SendEvent(theEvent, "MySchema");
            }
        }
        private void SendEvent(EPServiceProvider epService, string e0, int e1, string e2)
        {
            var theEvent = new LinkedHashMap <string, Object>();

            theEvent.Put("e0", e0);
            theEvent.Put("e1", e1);
            theEvent.Put("e2", e2);
            if (EventRepresentationChoiceExtensions.GetEngineDefault(epService).IsObjectArrayEvent())
            {
                epService.EPRuntime.SendEvent(theEvent.Values.ToArray(), "EventSchema");
            }
            else
            {
                epService.EPRuntime.SendEvent(theEvent, "EventSchema");
            }
        }
Exemplo n.º 15
0
        private void SendEvent(String e0, int e1, String e2)
        {
            var theEvent = new LinkedHashMap <String, Object>();

            theEvent["e0"] = e0;
            theEvent["e1"] = e1;
            theEvent["e2"] = e2;

            if (EventRepresentationChoiceExtensions.GetEngineDefault(_epService).IsObjectArrayEvent())
            {
                _epService.EPRuntime.SendEvent(theEvent.Values.ToArray(), "EventSchema");
            }
            else
            {
                _epService.EPRuntime.SendEvent(theEvent, "EventSchema");
            }
        }
 private static void SendEvent(
     RegressionEnvironment env,
     string e0,
     int e1,
     string e2)
 {
     IDictionary<string, object> theEvent = new LinkedHashMap<string, object>();
     theEvent.Put("e0", e0);
     theEvent.Put("e1", e1);
     theEvent.Put("e2", e2);
     if (EventRepresentationChoiceExtensions.GetEngineDefault(env.Configuration).IsObjectArrayEvent()) {
         env.SendEventObjectArray(theEvent.Values.ToArray(), "EventSchema");
     }
     else {
         env.SendEventMap(theEvent, "EventSchema");
     }
 }
Exemplo n.º 17
0
 private static void CreateSendEvent(
     RegressionEnvironment env,
     string typeName,
     string company,
     double value,
     double total)
 {
     IDictionary<string, object> map = new LinkedHashMap<string, object>();
     map.Put("company", company);
     map.Put("value", value);
     map.Put("total", total);
     if (EventRepresentationChoiceExtensions.GetEngineDefault(env.Configuration).IsObjectArrayEvent()) {
         env.SendEventObjectArray(map.Values.ToArray(), typeName);
     }
     else {
         env.SendEventMap(map, typeName);
     }
 }
Exemplo n.º 18
0
 private static void SendWindow(
     RegressionEnvironment env,
     string col0,
     long col1,
     string col2)
 {
     var theEvent = new Dictionary<string, object>();
     theEvent.Put("col0", col0);
     theEvent.Put("col1", col1);
     theEvent.Put("col2", col2);
     if (EventRepresentationChoiceExtensions.GetEngineDefault(env.Configuration).IsObjectArrayEvent())
     {
         env.SendEventObjectArray(theEvent.Values.ToArray(), "WindowSchema");
     }
     else
     {
         env.SendEventMap(theEvent, "WindowSchema");
     }
 }
Exemplo n.º 19
0
            public void Run(RegressionEnvironment env)
            {
                var compiled = env.CompileWBusPublicType("create schema OrderEvent(Price double)");
                env.Deploy(compiled);
                var path = new RegressionPath();
                path.Add(compiled);

                var epl = "@Name('All-Order-Events') @Audit('stream,property') select Price from OrderEvent";
                env.CompileDeploy(epl, path).AddListener("All-Order-Events");

                if (EventRepresentationChoiceExtensions.GetEngineDefault(env.Configuration).IsObjectArrayEvent()) {
                    env.SendEventObjectArray(new object[] {100d}, "OrderEvent");
                }
                else {
                    env.SendEventMap(Collections.SingletonDataMap("Price", 100d), "OrderEvent");
                }

                env.UndeployAll();
            }
Exemplo n.º 20
0
        private void RunAssertionDocSample(EPServiceProvider epService)
        {
            EPStatement stmt = epService.EPAdministrator.CreateEPL("create schema OrderEvent(price double)");

            string epl      = "@Name('All-Order-Events') @Audit('stream,property') select price from OrderEvent";
            var    listener = new SupportUpdateListener();

            epService.EPAdministrator.CreateEPL(epl).Events += listener.Update;

            if (EventRepresentationChoiceExtensions.GetEngineDefault(epService).IsObjectArrayEvent())
            {
                epService.EPRuntime.SendEvent(new object[] { 100d }, "OrderEvent");
            }
            else
            {
                epService.EPRuntime.SendEvent(Collections.SingletonDataMap("price", 100d), "OrderEvent");
            }

            stmt.Dispose();
        }
Exemplo n.º 21
0
            public void Run(RegressionEnvironment env)
            {
                foreach (var rep in EventRepresentationChoiceExtensions.Values()) {
                    TryAssertionCreateSchemaModelAfter(env, rep);
                }

                // test model-after for PONO with inheritance
                var path = new RegressionPath();
                env.CompileDeploy("create window ParentWindow#keepall as select * from SupportBeanAtoFBase", path);
                env.CompileDeploy("insert into ParentWindow select * from SupportBeanAtoFBase", path);
                env.CompileDeploy("create window ChildWindow#keepall as select * from SupportBean_A", path);
                env.CompileDeploy("insert into ChildWindow select * from SupportBean_A", path);

                var parentQuery = "@Name('s0') select parent from ParentWindow as parent";
                env.CompileDeploy(parentQuery, path).AddListener("s0");

                env.SendEventBean(new SupportBean_A("E1"));
                Assert.AreEqual(1, env.Listener("s0").NewDataListFlattened.Length);

                env.UndeployAll();
            }
Exemplo n.º 22
0
        public void TestDocSample()
        {
            try {
                _epService.EPAdministrator.CreateEPL("create schema OrderEvent(price double)");

                var epl = "@Name('All-Order-Events') @Audit('stream,property') select price from OrderEvent";
                _epService.EPAdministrator.CreateEPL(epl).Events += _listener.Update;

                if (EventRepresentationChoiceExtensions.GetEngineDefault(_epService).IsObjectArrayEvent())
                {
                    _epService.EPRuntime.SendEvent(new Object[] { 100d }, "OrderEvent");
                }
                else
                {
                    _epService.EPRuntime.SendEvent(Collections.SingletonDataMap("price", 100d), "OrderEvent");
                }
            } catch (Exception e) {
                Console.WriteLine("Exception caught: {0}", e.GetType());
                throw;
            }
        }
Exemplo n.º 23
0
        public void Run(RegressionEnvironment env)
        {
            foreach (var rep in EventRepresentationChoiceExtensions.Values()) {
                TryAssertionCreateSchema(env, rep);
            }

            // test Bean-type Date-type timestamps
            var typeName = typeof(SupportBean).FullName;
            var startA = "2002-05-30T09:00:00.000";
            var epl = 
                $"create schema SupportBeanXXX as {typeName} starttimestamp LongPrimitive endtimestamp LongBoxed;\n" +
                $"@Name('s0') select a.Get('month') as val0 from SupportBeanXXX a;\n";

            env.CompileDeployWBusPublicType(epl, new RegressionPath()).AddListener("s0");

            var theEvent = new SupportBean();
            theEvent.LongPrimitive = DateTimeParsingFunctions.ParseDefaultMSec(startA);
            env.EventService.SendEventBean(theEvent, "SupportBeanXXX");
            Assert.AreEqual(5, env.Listener("s0").AssertOneGetNewAndReset().Get("val0"));

            env.UndeployAll();
        }
Exemplo n.º 24
0
            public void Run(RegressionEnvironment env)
            {
                var path = new RegressionPath();
                var jsonSchemas =
                    "@public @buseventtype create json schema S0_JSON(Id String, P00 int);\n" +
                    "@public @buseventtype create json schema S1_JSON(Id String, P00 int);\n" +
                    "@public @buseventtype @JsonSchema(ClassName='" + typeof(MyLocalJsonProvidedS0).FullName + "') create json schema S0_JSONCLASSPROVIDED();\n" +
                    "@public @buseventtype @JsonSchema(ClassName='" + typeof(MyLocalJsonProvidedS1).FullName + "') create json schema S1_JSONCLASSPROVIDED();\n";
                env.CompileDeploy(jsonSchemas, path);

                var milestone = new AtomicLong();

                foreach (var rep in EventRepresentationChoiceExtensions.Values()) {
                    var s0Type = "S0_" + rep.GetName();
                    var s1Type = "S1_" + rep.GetName();
                    var eplOne = 
                        "select S0.Id as s0id, S1.Id as s1id, S0.P00 as s0p00, S1.P00 as s1p00 from "
                        + s0Type + "#keepall as S0, "
                        + s1Type + "#keepall as S1 "
                        + " where S0.Id = S1.Id";
                    TryJoinAssertion(env, eplOne, rep, "s0id,s1id,s0p00,s1p00", milestone, path, typeof(MyLocalJsonProvidedWFields));
                }

                foreach (var rep in EventRepresentationChoiceExtensions.Values()) {
                    var s0Type = "S0_" + rep.GetName();
                    var s1Type = "S1_" + rep.GetName();
                    var eplTwo = "select * from " +
                                 s0Type +
                                 "#keepall as s0, " +
                                 s1Type +
                                 "#keepall as s1 " +
                                 " where s0.Id = s1.Id";
                    TryJoinAssertion(env, eplTwo, rep, "s0.Id,s1.Id,s0.P00,s1.P00", milestone, path, typeof(MyLocalJsonProvidedWildcard));
                }

                env.UndeployAll();
            }
 public void Run(RegressionEnvironment env)
 {
     foreach (var rep in EventRepresentationChoiceExtensions.Values()) {
         RunAssertionEventBeanAnnotation(env, rep);
     }
 }
Exemplo n.º 26
0
        private static void Configure(Configuration configuration)
        {
            foreach (var clazz in new Type[] {
                typeof(SupportBean),
                typeof(OrderBean),
                typeof(BookDesc),
                typeof(SentenceEvent),
                typeof(SupportStringBeanWithArray),
                typeof(SupportBeanArrayCollMap),
                typeof(SupportObjectArrayEvent),
                typeof(SupportCollectionEvent),
                typeof(SupportResponseEvent),
                typeof(SupportAvroArrayEvent),
                typeof(SupportJsonArrayEvent)
            }) {
                configuration.Common.AddEventType(clazz);
            }

            var innerMapDef = Collections.SingletonDataMap("p", typeof(string));
            configuration.Common.AddEventType("MyInnerMap", innerMapDef);
            var outerMapDef = Collections.SingletonDataMap("i", "MyInnerMap[]");
            configuration.Common.AddEventType("MyOuterMap", outerMapDef);

            var funcs = new [] { "SplitSentence","SplitSentenceBean","SplitWord" };
            for (var i = 0; i < funcs.Length; i++) {
                foreach (var rep in EventRepresentationChoiceExtensions.Values()) {
                    string[] methods;
                    if (rep.IsObjectArrayEvent()) {
                        methods = new string[] {
                            "SplitSentenceMethodReturnObjectArray",
                            "SplitSentenceBeanMethodReturnObjectArray",
                            "SplitWordMethodReturnObjectArray"
                        };
                    }
                    else if (rep.IsMapEvent()) {
                        methods = new string[] {
                            "SplitSentenceMethodReturnMap",
                            "SplitSentenceBeanMethodReturnMap",
                            "SplitWordMethodReturnMap"
                        };
                    }
                    else if (rep.IsAvroEvent()) {
                        methods = new string[] {
                            "SplitSentenceMethodReturnAvro",
                            "SplitSentenceBeanMethodReturnAvro",
                            "SplitWordMethodReturnAvro"
                        };
                    }
                    else if (rep.IsJsonEvent() || rep.IsJsonProvidedClassEvent()) {
                        methods = new string[] {
                            "SplitSentenceMethodReturnJson",
                            "SplitSentenceBeanMethodReturnJson",
                            "SplitWordMethodReturnJson"
                        };
                    }
                    else {
                        throw new IllegalStateException("Unrecognized enum " + rep);
                    }

                    configuration.Compiler.AddPlugInSingleRowFunction(
                        funcs[i] + "_" + rep.GetName(),
                        typeof(EPLContainedEventSplitExpr),
                        methods[i]);
                }
            }

            var config = new ConfigurationCommonEventTypeXMLDOM();
            var resourceManager = configuration.ResourceManager;
            config.SchemaResource = resourceManager.ResolveResourceURL("regression/mediaOrderSchema.xsd").ToString();
            config.RootElementName = "MediaOrder";
            configuration.Common.AddEventType("MediaOrder", config);
            configuration.Common.AddEventType("Cancel", config);

            configuration.Compiler.ByteCode.AllowSubscriber = true;
            configuration.Compiler.AddPlugInSingleRowFunction(
                "invalidSentence",
                typeof(EPLContainedEventSplitExpr),
                "InvalidSentenceMethod");
            configuration.Compiler.AddPlugInSingleRowFunction(
                "mySplitUDFReturnEventBeanArray",
                typeof(EPLContainedEventSplitExpr),
                "MySplitUDFReturnEventBeanArray");
        }
Exemplo n.º 27
0
 public void Run(RegressionEnvironment env)
 {
     foreach (var rep in EventRepresentationChoiceExtensions.Values()) {
         RunTransposeMapAndObjectArray(env, rep);
     }
 }
Exemplo n.º 28
0
 public void Run(RegressionEnvironment env)
 {
     foreach (var rep in EventRepresentationChoiceExtensions.Values()) {
         TryAssertionInnerJoinLateStart(env, rep);
     }
 }
Exemplo n.º 29
0
 public void Run(RegressionEnvironment env)
 {
     foreach (var rep in EventRepresentationChoiceExtensions.Values()) {
         TryAssertionSplitPremptiveNamedWindow(env, rep);
     }
 }
Exemplo n.º 30
0
 public void Run(RegressionEnvironment env)
 {
     foreach (var rep in EventRepresentationChoiceExtensions.Values()) {
         TryAssertionWildcard(env, false, rep);
     }
 }