public void Run(RegressionEnvironment env) { env.CompileDeploy( "@Name('s0') select *, p0simple.p1id + 1 as plusone, p0bean as mybean from WheatRoot"); env.AddListener("s0"); env.SendEventObjectArray( new object[] {new object[] {10}, SupportBeanComplexProps.MakeDefaultBean()}, "WheatRoot"); var eventBean = env.Listener("s0").AssertOneGetNewAndReset(); // System.out.println(SupportEventTypeAssertionUtil.print(eventBean)); comment me in var eventType = eventBean.EventType; SupportEventTypeAssertionUtil.AssertConsistency(eventType); // resolve property via fragment Assert.IsTrue(eventType.GetPropertyDescriptor("p0simple").IsFragment); Assert.AreEqual(11, eventBean.Get("plusone")); Assert.AreEqual(10, eventBean.Get("p0simple.p1id")); var innerSimpleEvent = (EventBean) eventBean.GetFragment("p0simple"); Assert.AreEqual(10, innerSimpleEvent.Get("p1id")); var innerBeanEvent = (EventBean) eventBean.GetFragment("mybean"); Assert.AreEqual("NestedNestedValue", innerBeanEvent.Get("Nested.NestedNested.NestedNestedValue")); Assert.AreEqual( "NestedNestedValue", ((EventBean) eventBean.GetFragment("mybean.Nested.NestedNested")).Get("NestedNestedValue")); env.UndeployAll(); }
public void Run(RegressionEnvironment env) { var textOne = "@Name('s0') select Symbol, S1.GetSimpleProperty() as Simpleprop, S1.MakeDefaultBean() as def from " + "SupportMarketDataBean#keepall as S0 " + "left outer join " + "SupportBeanComplexProps#keepall as S1 on S0.Symbol=S1.SimpleProperty"; env.CompileDeploy(textOne).AddListener("s0"); var eventA = new SupportMarketDataBean("ACME", 0, 0L, null); env.SendEventBean(eventA); var theEvent = env.Listener("s0").AssertOneGetNewAndReset(); EPAssertionUtil.AssertProps( theEvent, new[] {"Symbol", "Simpleprop"}, new object[] {"ACME", null}); Assert.IsNull(theEvent.Get("def")); var eventComplexProps = SupportBeanComplexProps.MakeDefaultBean(); eventComplexProps.SimpleProperty = "ACME"; env.SendEventBean(eventComplexProps); theEvent = env.Listener("s0").AssertOneGetNewAndReset(); EPAssertionUtil.AssertProps( theEvent, new[] {"Symbol", "Simpleprop"}, new object[] {"ACME", "ACME"}); Assert.IsNotNull(theEvent.Get("def")); env.UndeployAll(); }
public void Run(RegressionEnvironment env) { var epl = "@Name('s0') select " + "Nested.GetNestedValue(), " + "Nested.GetNestedNested().GetNestedNestedValue() " + "from SupportBeanComplexProps"; env.CompileDeploy(epl).AddListener("s0"); var bean = SupportBeanComplexProps.MakeDefaultBean(); var rows = new[] { new object[] { "Nested.GetNestedValue()", typeof(string) } }; for (var i = 0; i < rows.Length; i++) { var prop = env.Statement("s0").EventType.PropertyDescriptors[i]; Assert.AreEqual(rows[i][0], prop.PropertyName); Assert.AreEqual(rows[i][1], prop.PropertyType); } env.SendEventBean(bean); EPAssertionUtil.AssertProps( env.Listener("s0").AssertOneGetNewAndReset(), "Nested.GetNestedValue()".SplitCsv(), bean.Nested.NestedValue); env.UndeployAll(); }
public void Run(RegressionEnvironment env) { var epl = "@Name('s0') select " + "Mapped('keyOne') as a," + "Indexed[1] as b, " + "Nested.NestedNested.NestedNestedValue as c, " + "MapProperty, " + "ArrayProperty[0] " + " from SupportBeanComplexProps#length(3) " + " where Mapped('keyOne') = 'valueOne' and " + " Indexed[1] = 2 and " + " Nested.NestedNested.NestedNestedValue = 'NestedNestedValue'"; env.CompileDeployAddListenerMileZero(epl, "s0"); var eventObject = SupportBeanComplexProps.MakeDefaultBean(); env.SendEventBean(eventObject); var theEvent = env.Listener("s0").GetAndResetLastNewData()[0]; Assert.AreEqual(eventObject.GetMapped("keyOne"), theEvent.Get("a")); Assert.AreEqual(eventObject.GetIndexed(1), theEvent.Get("b")); Assert.AreEqual(eventObject.Nested.NestedNested.NestedNestedValue, theEvent.Get("c")); Assert.AreEqual(eventObject.MapProperty, theEvent.Get("MapProperty")); Assert.AreEqual(eventObject.ArrayProperty[0], theEvent.Get("ArrayProperty[0]")); eventObject.SetIndexed(1, int.MinValue); Assert.IsFalse(env.Listener("s0").IsInvoked); env.SendEventBean(eventObject); Assert.IsFalse(env.Listener("s0").IsInvoked); eventObject.SetIndexed(1, 2); env.SendEventBean(eventObject); Assert.IsTrue(env.Listener("s0").IsInvoked); env.UndeployAll(); }
public void Run(RegressionEnvironment env) { env.CompileDeploy("@Name('s0') select * from LocalTypeRoot").AddListener("s0"); Assert.AreEqual(typeof(object[]), env.Statement("s0").EventType.UnderlyingType); object[] dataInner = { new SupportBean("E1", 11), new[] {new SupportBean("A1", 21), new SupportBean("A2", 22)}, SupportBeanComplexProps.MakeDefaultBean(), new[] {SupportBeanComplexProps.MakeDefaultBean(), SupportBeanComplexProps.MakeDefaultBean()} }; object[] dataRoot = { dataInner, new object[] {dataInner, dataInner} }; // send event env.SendEventObjectArray(dataRoot, "LocalTypeRoot"); var eventBean = env.Listener("s0").AssertOneGetNewAndReset(); // System.out.println(SupportEventTypeAssertionUtil.print(eventBean)); comment me in var eventType = eventBean.EventType; SupportEventTypeAssertionUtil.AssertConsistency(eventType); Assert.AreEqual(11, ((EventBean) eventBean.GetFragment("p0simple.p1simple")).Get("IntPrimitive")); Assert.AreEqual("A2", ((EventBean) eventBean.GetFragment("p0simple.p1array[1]")).Get("TheString")); Assert.AreEqual( "Simple", ((EventBean) eventBean.GetFragment("p0simple.p1complex")).Get("SimpleProperty")); Assert.AreEqual( "Simple", ((EventBean) eventBean.GetFragment("p0simple.p1complexarray[0]")).Get("SimpleProperty")); Assert.AreEqual( "NestedValue", ((EventBean) eventBean.GetFragment("p0simple.p1complexarray[0].Nested")).Get("NestedValue")); Assert.AreEqual( "NestedNestedValue", ((EventBean) eventBean.GetFragment("p0simple.p1complexarray[0].Nested.NestedNested")).Get( "NestedNestedValue")); var assertEvent = (EventBean) eventBean.GetFragment("p0simple"); Assert.AreEqual("E1", assertEvent.Get("p1simple.TheString")); Assert.AreEqual(11, ((EventBean) assertEvent.GetFragment("p1simple")).Get("IntPrimitive")); Assert.AreEqual(22, ((EventBean) assertEvent.GetFragment("p1array[1]")).Get("IntPrimitive")); Assert.AreEqual( "NestedNestedValue", ((EventBean) assertEvent.GetFragment("p1complex.Nested.NestedNested")).Get("NestedNestedValue")); assertEvent = ((EventBean[]) eventBean.GetFragment("p0array"))[0]; Assert.AreEqual("E1", assertEvent.Get("p1simple.TheString")); Assert.AreEqual(11, ((EventBean) assertEvent.GetFragment("p1simple")).Get("IntPrimitive")); Assert.AreEqual(22, ((EventBean) assertEvent.GetFragment("p1array[1]")).Get("IntPrimitive")); assertEvent = (EventBean) eventBean.GetFragment("p0array[0]"); Assert.AreEqual("E1", assertEvent.Get("p1simple.TheString")); Assert.AreEqual(11, ((EventBean) assertEvent.GetFragment("p1simple")).Get("IntPrimitive")); Assert.AreEqual(22, ((EventBean) assertEvent.GetFragment("p1array[1]")).Get("IntPrimitive")); env.UndeployAll(); }
private static IDictionary<string, object> MakeTestDataComplexProps() { var testData = new Dictionary<string, object>(); testData.Put("e1", SupportBeanComplexProps.MakeDefaultBean()); testData.Put("e2", SupportBeanCombinedProps.MakeDefaultBean()); return testData; }
public void Run(RegressionEnvironment env) { env.CompileDeploy("@Name('s0') select * from SupportBeanComplexProps").AddListener("s0"); // assert nested fragments env.SendEventBean(SupportBeanComplexProps.MakeDefaultBean()); var eventBean = env.Listener("s0").AssertOneGetNewAndReset(); SupportEventTypeAssertionUtil.AssertConsistency(eventBean.EventType); //Console.WriteLine(SupportEventTypeAssertionUtil.print(eventBean)); Assert.IsTrue(eventBean.EventType.GetPropertyDescriptor("Nested").IsFragment); var eventNested = (EventBean) eventBean.GetFragment("Nested"); Assert.AreEqual("NestedValue", eventNested.Get("NestedValue")); eventNested = (EventBean) eventBean.GetFragment("Nested?"); Assert.AreEqual("NestedValue", eventNested.Get("NestedValue")); Assert.IsTrue(eventNested.EventType.GetPropertyDescriptor("NestedNested").IsFragment); Assert.AreEqual( "NestedNestedValue", ((EventBean) eventNested.GetFragment("NestedNested")).Get("NestedNestedValue")); Assert.AreEqual( "NestedNestedValue", ((EventBean) eventNested.GetFragment("NestedNested?")).Get("NestedNestedValue")); var nestedFragment = (EventBean) eventBean.GetFragment("Nested.NestedNested"); Assert.AreEqual("NestedNestedValue", nestedFragment.Get("NestedNestedValue")); env.UndeployAll(); // assert indexed fragments env.CompileDeploy("@Name('s0') select * from SupportBeanCombinedProps").AddListener("s0"); var eventObject = SupportBeanCombinedProps.MakeDefaultBean(); env.SendEventBean(eventObject); eventBean = env.Listener("s0").AssertOneGetNewAndReset(); SupportEventTypeAssertionUtil.AssertConsistency(eventBean.EventType); //System.out.println(SupportEventTypeAssertionUtil.print(eventBean)); Assert.IsTrue(eventBean.EventType.GetPropertyDescriptor("Array").IsFragment); Assert.IsTrue(eventBean.EventType.GetPropertyDescriptor("Array").IsIndexed); var eventArray = (EventBean[]) eventBean.GetFragment("Array"); Assert.AreEqual(3, eventArray.Length); var eventElement = eventArray[0]; Assert.AreSame( eventObject.Array[0].GetMapped("0ma"), eventElement.Get("Mapped('0ma')")); Assert.AreSame( eventObject.Array[0].GetMapped("0ma"), eventBean.GetFragment("Array[0]").AsEventBean().Get("Mapped('0ma')")); Assert.AreSame( eventObject.Array[0].GetMapped("0ma"), eventBean.GetFragment("Array[0]?").AsEventBean().Get("Mapped('0ma')")); env.UndeployAll(); }
public void Run(RegressionEnvironment env) { var path = new RegressionPath(); env.CompileDeploy("insert into MyStream select Nested from SupportBeanComplexProps", path); var epl = "@Name('s0') select Nested.NestedValue, Nested.NestedNested.NestedNestedValue from MyStream"; env.CompileDeploy(epl, path).AddListener("s0"); env.SendEventBean(SupportBeanComplexProps.MakeDefaultBean()); Assert.IsNotNull(env.Listener("s0").AssertOneGetNewAndReset()); env.UndeployAll(); }
public void Run(RegressionEnvironment env) { env.CompileDeploy("@Name('s0') select * from MMOuterMap").AddListener("s0"); IDictionary<string, object> dataInnerInner = new Dictionary<string, object>(); dataInnerInner.Put("p2id", 10); IDictionary<string, object> dataInner = new Dictionary<string, object>(); dataInner.Put("p1bean", new SupportBean("string1", 2000)); dataInner.Put("p1beanComplex", SupportBeanComplexProps.MakeDefaultBean()); dataInner.Put("p1beanArray", new[] {new SupportBean("string2", 1), new SupportBean("string3", 2)}); dataInner.Put("p1innerId", 50); dataInner.Put("p1innerMap", dataInnerInner); IDictionary<string, object> dataOuter = new Dictionary<string, object>(); dataOuter.Put("p0simple", dataInner); dataOuter.Put("p0array", new[] {dataInner, dataInner}); // send event env.SendEventMap(dataOuter, "MMOuterMap"); var eventBean = env.Listener("s0").AssertOneGetNewAndReset(); // System.out.println(SupportEventTypeAssertionUtil.print(eventBean)); comment me in var eventType = eventBean.EventType; SupportEventTypeAssertionUtil.AssertConsistency(eventType); // Fragment-to-simple Assert.IsTrue(eventType.GetPropertyDescriptor("p0simple").IsFragment); Assert.AreEqual( typeof(int?), eventType.GetFragmentType("p0simple").FragmentType.GetPropertyDescriptor("p1innerId").PropertyType); var p0simpleEvent = (EventBean) eventBean.GetFragment("p0simple"); Assert.AreEqual(50, p0simpleEvent.Get("p1innerId")); p0simpleEvent = (EventBean) eventBean.GetFragment("p0array[0]"); Assert.AreEqual(50, p0simpleEvent.Get("p1innerId")); // Fragment-to-bean var p0arrayEvents = (EventBean[]) eventBean.GetFragment("p0array"); Assert.AreSame(p0arrayEvents[0].EventType, p0simpleEvent.EventType); Assert.AreEqual("string1", eventBean.Get("p0array[0].p1bean.TheString")); Assert.AreEqual("string1", ((EventBean) eventBean.GetFragment("p0array[0].p1bean")).Get("TheString")); var innerOne = (EventBean) eventBean.GetFragment("p0array[0]"); Assert.AreEqual("string1", ((EventBean) innerOne.GetFragment("p1bean")).Get("TheString")); Assert.AreEqual("string1", innerOne.Get("p1bean.TheString")); innerOne = (EventBean) eventBean.GetFragment("p0simple"); Assert.AreEqual("string1", ((EventBean) innerOne.GetFragment("p1bean")).Get("TheString")); Assert.AreEqual("string1", innerOne.Get("p1bean.TheString")); env.UndeployAll(); }
public void Run(RegressionEnvironment env) { var epl = "@Name('s0') select exists(item?.id) as t0, " + " exists(item?.Id?) as t1, " + " exists(item?.Item.IntBoxed) as t2, " + " exists(item?.Indexed[0]?) as t3, " + " exists(item?.Mapped('keyOne')?) as t4, " + " exists(item?.Nested?) as t5, " + " exists(item?.Nested.NestedValue?) as t6, " + " exists(item?.Nested.NestedNested?) as t7, " + " exists(item?.Nested.NestedNested.NestedNestedValue?) as t8, " + " exists(item?.Nested.NestedNested.NestedNestedValue.Dummy?) as t9, " + " exists(item?.Nested.NestedNested.Dummy?) as t10 " + " from SupportMarkerInterface"; env.CompileDeploy(epl).AddListener("s0"); for (var i = 0; i < 11; i++) { Assert.AreEqual(typeof(bool?), env.Statement("s0").EventType.GetPropertyType("t" + i)); } // cannot exists if the inner is null env.SendEventBean(new SupportBeanDynRoot(null)); var theEvent = env.Listener("s0").AssertOneGetNewAndReset(); AssertResults(theEvent, new[] { false, false, false, false, false, false, false, false, false, false, false }); // try nested, indexed and mapped env.SendEventBean(new SupportBeanDynRoot(SupportBeanComplexProps.MakeDefaultBean())); theEvent = env.Listener("s0").AssertOneGetNewAndReset(); AssertResults(theEvent, new[] { false, false, false, true, true, true, true, true, true, false, false }); // try nested, indexed and mapped env.SendEventBean(new SupportBeanDynRoot(SupportBeanComplexProps.MakeDefaultBean())); theEvent = env.Listener("s0").AssertOneGetNewAndReset(); AssertResults(theEvent, new[] { false, false, false, true, true, true, true, true, true, false, false }); // try a boxed that returns null but does exists env.SendEventBean(new SupportBeanDynRoot(new SupportBeanDynRoot(new SupportBean()))); theEvent = env.Listener("s0").AssertOneGetNewAndReset(); AssertResults(theEvent, new[] { false, false, true, false, false, false, false, false, false, false, false }); env.SendEventBean(new SupportBeanDynRoot(new SupportBean_A("10"))); theEvent = env.Listener("s0").AssertOneGetNewAndReset(); AssertResults(theEvent, new[] { true, true, false, false, false, false, false, false, false, false, false }); env.UndeployAll(); }
public void Run(RegressionEnvironment env) { var epl = "@Name('s0') select 10 in (ArrayProperty) as result from SupportBeanComplexProps"; env.CompileDeploy(epl).AddListener("s0"); Assert.AreEqual(typeof(bool?), env.Statement("s0").EventType.GetPropertyType("result")); epl = "@Name('s1') select 5 in (ArrayProperty) as result from SupportBeanComplexProps"; env.CompileDeploy(epl).AddListener("s1"); env.Milestone(0); env.SendEventBean(SupportBeanComplexProps.MakeDefaultBean()); Assert.AreEqual(true, env.Listener("s0").AssertOneGetNewAndReset().Get("result")); Assert.AreEqual(false, env.Listener("s1").AssertOneGetNewAndReset().Get("result")); env.UndeployAll(); }
public void Run(RegressionEnvironment env) { var path = new RegressionPath(); var stmtTextOne = "insert into MyStreamComplex select Nested as inneritem from SupportBeanComplexProps"; env.CompileDeploy(stmtTextOne, path); var stmtTextTwo = "@Name('s0') select inneritem.NestedValue as result from MyStreamComplex"; env.CompileDeploy(stmtTextTwo, path).AddListener("s0"); env.SendEventBean(SupportBeanComplexProps.MakeDefaultBean()); EPAssertionUtil.AssertProps( env.Listener("s0").AssertOneGetNewAndReset(), new[] {"result"}, new object[] {"NestedValue"}); env.UndeployAll(); }
public void Run(RegressionEnvironment env) { var stmtText = "@Name('s0') select " + ALL_FIELDS + " from " + " sql:MyDBWithRetain ['select " + ALL_FIELDS + " from mytesttable where ${S1.ArrayProperty[0]} = mytesttable.myBigint'] as S0," + "SupportBeanComplexProps as S1"; // S1.ArrayProperty[0] returns 10 for that bean env.CompileDeploy(stmtText).AddListener("s0"); env.SendEventBean(SupportBeanComplexProps.MakeDefaultBean()); AssertReceived(env, 10, 100, "J", "P", true, null, 1000m, 10.2, 10.3); env.UndeployAll(); }
public void Run(RegressionEnvironment env) { var path = new RegressionPath(); var stmtOneText = "@Name('l1') insert into StreamA select Nested.* from SupportBeanComplexProps as S0"; env.CompileDeploy(stmtOneText, path).AddListener("l1"); Assert.AreEqual( typeof(SupportBeanComplexProps.SupportBeanSpecialGetterNested), env.Statement("l1").EventType.UnderlyingType); var stmtTwoText = "@Name('l2') select NestedValue from StreamA"; env.CompileDeploy(stmtTwoText, path).AddListener("l2"); Assert.AreEqual(typeof(string), env.Statement("l2").EventType.GetPropertyType("NestedValue")); env.SendEventBean(SupportBeanComplexProps.MakeDefaultBean()); Assert.AreEqual("NestedValue", env.Listener("l1").AssertOneGetNewAndReset().Get("NestedValue")); Assert.AreEqual("NestedValue", env.Listener("l2").AssertOneGetNewAndReset().Get("NestedValue")); env.UndeployAll(); env.UndeployAll(); }
public void Run(RegressionEnvironment env) { var epl = "@Name('s0') select " + "(ArrayProperty).size() as size, " + "(ArrayProperty).get(0) as get0, " + "(ArrayProperty).get(1) as get1, " + "(ArrayProperty).get(2) as get2, " + "(ArrayProperty).get(3) as get3 " + "from SupportBeanComplexProps"; env.CompileDeploy(epl).AddListener("s0"); var bean = SupportBeanComplexProps.MakeDefaultBean(); var rows = new[] { new object[] { "size", typeof(int?) }, new object[] { "get0", typeof(int?) }, new object[] { "get1", typeof(int?) }, new object[] { "get2", typeof(int?) }, new object[] { "get3", typeof(int?) } }; for (var i = 0; i < rows.Length; i++) { var prop = env.Statement("s0").EventType.PropertyDescriptors[i]; Assert.AreEqual(rows[i][0], prop.PropertyName, "failed for " + rows[i][0]); Assert.AreEqual(rows[i][1], prop.PropertyType, "failed for " + rows[i][0]); } env.SendEventBean(bean); EPAssertionUtil.AssertProps( env.Listener("s0").AssertOneGetNewAndReset(), "size,get0,get1,get2,get3".SplitCsv(), bean.ArrayProperty.Length, bean.ArrayProperty[0], bean.ArrayProperty[1], bean.ArrayProperty[2], null); env.UndeployAll(); }
public void Run(RegressionEnvironment env) { env.CompileDeploy("@Name('s0') select *, p0simple.p1id + 1 as plusone, p0bean as mybean from Frosty"); env.AddListener("s0"); IDictionary<string, object> dataInner = new Dictionary<string, object>(); dataInner.Put("p1id", 10); IDictionary<string, object> dataRoot = new Dictionary<string, object>(); dataRoot.Put("p0simple", dataInner); dataRoot.Put("p0bean", SupportBeanComplexProps.MakeDefaultBean()); // send event env.SendEventMap(dataRoot, "Frosty"); var eventBean = env.Listener("s0").AssertOneGetNewAndReset(); // Console.WriteLine(SupportEventTypeAssertionUtil.print(eventBean)); comment me in var eventType = eventBean.EventType; SupportEventTypeAssertionUtil.AssertConsistency(eventType); // resolve property via fragment Assert.IsTrue(eventType.GetPropertyDescriptor("p0simple").IsFragment); Assert.AreEqual(11, eventBean.Get("plusone")); Assert.AreEqual(10, eventBean.Get("p0simple.p1id")); var innerSimpleEvent = (EventBean) eventBean.GetFragment("p0simple"); Assert.AreEqual(10, innerSimpleEvent.Get("p1id")); var innerBeanEvent = (EventBean) eventBean.GetFragment("mybean"); Assert.AreEqual( "NestedNestedValue", innerBeanEvent.Get("Nested.NestedNested.NestedNestedValue")); Assert.AreEqual( "NestedNestedValue", ((EventBean) eventBean.GetFragment("mybean.Nested.NestedNested")).Get("NestedNestedValue")); env.UndeployAll(); }
public void Run(RegressionEnvironment env) { env.CompileDeploy("@Name('s0') select * from pattern[one=CashMapOne until two=CashMapTwo]") .AddListener("s0"); object[] dataInner = {2000}; object[] dataArray = { 1, new SupportBean("E1", 100), new[] {new SupportBean("E1", 100), new SupportBean("E2", 200)}, SupportBeanComplexProps.MakeDefaultBean(), new[] {SupportBeanComplexProps.MakeDefaultBean()}, dataInner, new object[] {dataInner, dataInner} }; // send event env.SendEventObjectArray(dataArray, "CashMapOne"); var dataArrayTwo = new object[dataArray.Length]; Array.Copy(dataArray, 0, dataArrayTwo, 0, dataArray.Length); dataArrayTwo[0] = 2; env.SendEventObjectArray(dataArrayTwo, "CashMapOne"); var dataArrayThree = new object[dataArray.Length]; Array.Copy(dataArray, 0, dataArrayThree, 0, dataArray.Length); dataArrayThree[0] = 3; env.SendEventObjectArray(dataArrayThree, "CashMapTwo"); var eventBean = env.Listener("s0").AssertOneGetNewAndReset(); // System.out.println(SupportEventTypeAssertionUtil.print(eventBean)); var eventType = eventBean.EventType; SupportEventTypeAssertionUtil.AssertConsistency(eventType); Assert.AreEqual(1, ((EventBean) eventBean.GetFragment("one[0]")).Get("id")); Assert.AreEqual(2, ((EventBean) eventBean.GetFragment("one[1]")).Get("id")); Assert.AreEqual(3, ((EventBean) eventBean.GetFragment("two")).Get("id")); Assert.AreEqual("E1", ((EventBean) eventBean.GetFragment("one[0].bean")).Get("TheString")); Assert.AreEqual("E1", ((EventBean) eventBean.GetFragment("one[1].bean")).Get("TheString")); Assert.AreEqual("E1", ((EventBean) eventBean.GetFragment("two.bean")).Get("TheString")); Assert.AreEqual("E2", ((EventBean) eventBean.GetFragment("one[0].beanarray[1]")).Get("TheString")); Assert.AreEqual("E2", ((EventBean) eventBean.GetFragment("two.beanarray[1]")).Get("TheString")); Assert.AreEqual( "NestedNestedValue", ((EventBean) eventBean.GetFragment("one[0].complex.Nested.NestedNested")).Get("NestedNestedValue")); Assert.AreEqual( "NestedNestedValue", ((EventBean) eventBean.GetFragment("two.complex.Nested.NestedNested")).Get("NestedNestedValue")); Assert.AreEqual( "NestedNestedValue", ((EventBean) eventBean.GetFragment("one[0].complexarray[0].Nested.NestedNested")).Get( "NestedNestedValue")); Assert.AreEqual( "NestedNestedValue", ((EventBean) eventBean.GetFragment("two.complexarray[0].Nested.NestedNested")).Get( "NestedNestedValue")); Assert.AreEqual(2000, ((EventBean) eventBean.GetFragment("one[0].map")).Get("p2id")); Assert.AreEqual(2000, ((EventBean) eventBean.GetFragment("two.map")).Get("p2id")); Assert.AreEqual(2000, ((EventBean) eventBean.GetFragment("one[0].maparray[1]")).Get("p2id")); Assert.AreEqual(2000, ((EventBean) eventBean.GetFragment("two.maparray[1]")).Get("p2id")); env.UndeployAll(); }
public void Run(RegressionEnvironment env) { env.CompileDeploy("@Name('s0') select * from pattern[one=GistMapOne until two=GistMapTwo]") .AddListener("s0"); IDictionary<string, object> dataInner = new Dictionary<string, object>(); dataInner.Put("p2id", 2000); IDictionary<string, object> dataMap = new Dictionary<string, object>(); dataMap.Put("id", 1); dataMap.Put("bean", new SupportBean("E1", 100)); dataMap.Put("beanarray", new[] {new SupportBean("E1", 100), new SupportBean("E2", 200)}); dataMap.Put("complex", SupportBeanComplexProps.MakeDefaultBean()); dataMap.Put("complexarray", new[] {SupportBeanComplexProps.MakeDefaultBean()}); dataMap.Put("map", dataInner); dataMap.Put("maparray", new[] {dataInner, dataInner}); // send event env.SendEventMap(dataMap, "GistMapOne"); IDictionary<string, object> dataMapTwo = new Dictionary<string, object>(dataMap); dataMapTwo.Put("id", 2); env.SendEventMap(dataMapTwo, "GistMapOne"); IDictionary<string, object> dataMapThree = new Dictionary<string, object>(dataMap); dataMapThree.Put("id", 3); env.SendEventMap(dataMapThree, "GistMapTwo"); var eventBean = env.Listener("s0").AssertOneGetNewAndReset(); // System.out.println(SupportEventTypeAssertionUtil.print(eventBean)); var eventType = eventBean.EventType; SupportEventTypeAssertionUtil.AssertConsistency(eventType); Assert.AreEqual(1, ((EventBean) eventBean.GetFragment("one[0]")).Get("id")); Assert.AreEqual(2, ((EventBean) eventBean.GetFragment("one[1]")).Get("id")); Assert.AreEqual(3, ((EventBean) eventBean.GetFragment("two")).Get("id")); Assert.AreEqual("E1", ((EventBean) eventBean.GetFragment("one[0].bean")).Get("TheString")); Assert.AreEqual("E1", ((EventBean) eventBean.GetFragment("one[1].bean")).Get("TheString")); Assert.AreEqual("E1", ((EventBean) eventBean.GetFragment("two.bean")).Get("TheString")); Assert.AreEqual("E2", ((EventBean) eventBean.GetFragment("one[0].beanarray[1]")).Get("TheString")); Assert.AreEqual("E2", ((EventBean) eventBean.GetFragment("two.beanarray[1]")).Get("TheString")); Assert.AreEqual( "NestedNestedValue", ((EventBean) eventBean.GetFragment("one[0].complex.Nested.NestedNested")).Get("NestedNestedValue")); Assert.AreEqual( "NestedNestedValue", ((EventBean) eventBean.GetFragment("two.complex.Nested.NestedNested")).Get("NestedNestedValue")); Assert.AreEqual( "NestedNestedValue", ((EventBean) eventBean.GetFragment("one[0].complexarray[0].Nested.NestedNested")).Get( "NestedNestedValue")); Assert.AreEqual( "NestedNestedValue", ((EventBean) eventBean.GetFragment("two.complexarray[0].Nested.NestedNested")).Get( "NestedNestedValue")); Assert.AreEqual(2000, ((EventBean) eventBean.GetFragment("one[0].map")).Get("p2id")); Assert.AreEqual(2000, ((EventBean) eventBean.GetFragment("two.map")).Get("p2id")); Assert.AreEqual(2000, ((EventBean) eventBean.GetFragment("one[0].maparray[1]")).Get("p2id")); Assert.AreEqual(2000, ((EventBean) eventBean.GetFragment("two.maparray[1]")).Get("p2id")); env.UndeployAll(); }
public void Run(RegressionEnvironment env) { var notExists = MultipleNotExists(6); // Bean var beanOne = SupportBeanComplexProps.MakeDefaultBean(); var n1v = beanOne.Nested.NestedValue; var n1nv = beanOne.Nested.NestedNested.NestedNestedValue; var beanTwo = SupportBeanComplexProps.MakeDefaultBean(); beanTwo.Nested.NestedValue = "nested1"; beanTwo.Nested.NestedNested.NestedNestedValue = "nested2"; Pair<object, object>[] beanTests = { new Pair<object, object>(new SupportBeanDynRoot(beanOne), AllExist(n1v, n1v, n1nv, n1nv, n1nv, n1nv)), new Pair<object, object>( new SupportBeanDynRoot(beanTwo), AllExist("nested1", "nested1", "nested2", "nested2", "nested2", "nested2")), new Pair<object, object>(new SupportBeanDynRoot("abc"), notExists) }; RunAssertion(env, "SupportBeanDynRoot", FBEAN, null, beanTests, typeof(object)); // Map IDictionary<string, object> mapOneL2 = new Dictionary<string, object>(); mapOneL2.Put("NestedNestedValue", 101); IDictionary<string, object> mapOneL1 = new Dictionary<string, object>(); mapOneL1.Put("NestedNested", mapOneL2); mapOneL1.Put("NestedValue", 100); IDictionary<string, object> mapOneL0 = new Dictionary<string, object>(); mapOneL0.Put("Nested", mapOneL1); var mapOne = Collections.SingletonDataMap("Item", mapOneL0); Pair<object, object>[] mapTests = { new Pair<object, object>(mapOne, AllExist(100, 100, 101, 101, 101, 101)), new Pair<object, object>(Collections.EmptyDataMap, notExists) }; RunAssertion(env, MAP_TYPENAME, FMAP, null, mapTests, typeof(object)); // Object-Array object[] oaOneL2 = {101}; object[] oaOneL1 = {oaOneL2, 100}; object[] oaOneL0 = {oaOneL1}; object[] oaOne = {oaOneL0}; Pair<object, object>[] oaTests = { new Pair<object, object>(oaOne, AllExist(100, 100, 101, 101, 101, 101)), new Pair<object, object>(new object[] {null}, notExists) }; RunAssertion(env, OA_TYPENAME, FOA, null, oaTests, typeof(object)); // XML Pair<object, object>[] xmlTests = { new Pair<object, object>( "<Item>\n" + "\t<Nested NestedValue=\"100\">\n" + "\t\t<NestedNested NestedNestedValue=\"101\">\n" + "\t\t</NestedNested>\n" + "\t</Nested>\n" + "</Item>\n", AllExist("100", "100", "101", "101", "101", "101")), new Pair<object, object>("<item/>", notExists) }; RunAssertion(env, XML_TYPENAME, FXML, xmlToValue, xmlTests, typeof(XmlNode)); // Avro var schema = AvroSchemaUtil.ResolveAvroSchema(env.Runtime.EventTypeService.GetEventTypePreconfigured(AVRO_TYPENAME)); var nestedSchema = AvroSchemaUtil.FindUnionRecordSchemaSingle( schema .GetField("Item") .Schema.AsRecordSchema() .GetField("Nested") .Schema); var nestedNestedSchema = AvroSchemaUtil.FindUnionRecordSchemaSingle( nestedSchema.GetField("NestedNested").Schema); var nestedNestedDatum = new GenericRecord(nestedNestedSchema.AsRecordSchema()); nestedNestedDatum.Put("NestedNestedValue", 101); var nestedDatum = new GenericRecord(nestedSchema.AsRecordSchema()); nestedDatum.Put("NestedValue", 100); nestedDatum.Put("NestedNested", nestedNestedDatum); var emptyDatum = new GenericRecord(SchemaBuilder.Record(AVRO_TYPENAME)); Pair<object, object>[] avroTests = { new Pair<object, object>(nestedDatum, AllExist(100, 100, 101, 101, 101, 101)), new Pair<object, object>(emptyDatum, notExists), new Pair<object, object>(null, notExists) }; RunAssertion(env, AVRO_TYPENAME, FAVRO, null, avroTests, typeof(object)); }