private void RunAssertionBeanNav( RegressionEnvironment env, string typename, FunctionSendEvent send, object underlyingComplete) { var stmtText = "@Name('s0') select * from " + typename; env.CompileDeploy(stmtText).AddListener("s0"); send.Invoke(env, underlyingComplete, typename); var @event = env.Listener("s0").AssertOneGetNewAndReset(); SupportEventTypeAssertionUtil.AssertConsistency(@event); env.UndeployAll(); }
public void Run(RegressionEnvironment env) { var path = new RegressionPath(); var fields = new[] {"key", "thesum"}; env.CompileDeploy("create table varagg as (key string primary key, thesum sum(int))", path); env.CompileDeploy( "into table varagg select sum(IntPrimitive) as thesum from SupportBean group by TheString", path); env.CompileDeploy("@Name('s0') select varagg[P00].thesum as value from SupportBean_S0", path) .AddListener("s0"); env.CompileDeploy("@Name('sdf') on SupportBean_S1(Id = 1) delete from varagg where key = P10", path) .AddListener("sdf"); env.CompileDeploy("@Name('sda') on SupportBean_S1(Id = 2) delete from varagg", path).AddListener("sda"); object[][] expectedType = { new object[] {"key", typeof(string)}, new object[] {"thesum", typeof(int?)} }; SupportEventTypeAssertionUtil.AssertEventTypeProperties( expectedType, env.Statement("sda").EventType, SupportEventTypeAssertionEnum.NAME, SupportEventTypeAssertionEnum.TYPE); env.SendEventBean(new SupportBean("G1", 10)); AssertValues(env, "G1,G2", new int?[] {10, null}); env.SendEventBean(new SupportBean("G2", 20)); AssertValues(env, "G1,G2", new int?[] {10, 20}); env.SendEventBean(new SupportBean_S1(1, "G1")); AssertValues(env, "G1,G2", new int?[] {null, 20}); EPAssertionUtil.AssertProps( env.Listener("sdf").AssertOneGetNewAndReset(), fields, new object[] {"G1", 10}); env.Milestone(0); env.SendEventBean(new SupportBean_S1(2, null)); AssertValues(env, "G1,G2", new int?[] {null, null}); EPAssertionUtil.AssertProps( env.Listener("sda").AssertOneGetNewAndReset(), fields, new object[] {"G2", 20}); env.UndeployAll(); }
private static void RunAssertion( RegressionEnvironment env, String eventTypeNameNested, String eventTypeNameABC, RegressionPath path) { // try array property in select env.CompileDeploy("@Name('s0') select * from " + eventTypeNameNested + "#lastevent", path).AddListener("s0"); CollectionAssert.AreEquivalent( new EventPropertyDescriptor[] { new EventPropertyDescriptor("prop3", typeof(int?[]), typeof(int?), false, false, true, false, false) }, env.Statement("s0").EventType.PropertyDescriptors); SupportEventTypeAssertionUtil.AssertConsistency(env.Statement("s0").EventType); EventSender sender = env.EventService.GetEventSender(eventTypeNameNested); sender.SendEvent( SupportXML.GetDocument( "<nested2><prop3>2</prop3><prop3></prop3><prop3>4</prop3></nested2>")); var theEvent = env.GetEnumerator("s0").Advance(); var theValues = theEvent.Get("prop3").Unwrap<object>(true); EPAssertionUtil.AssertEqualsExactOrder( theValues, new object[] {2, null, 4}); SupportEventTypeAssertionUtil.AssertConsistency(theEvent); env.UndeployModuleContaining("s0"); // try array property nested env.CompileDeploy("@Name('s0') select nested3.* from " + eventTypeNameABC + "#lastevent", path); SupportXML.SendDefaultEvent(env.EventService, "test", eventTypeNameABC); var stmtSelectResult = env.GetEnumerator("s0").Advance(); SupportEventTypeAssertionUtil.AssertConsistency(stmtSelectResult); Assert.AreEqual(typeof(string[]), stmtSelectResult.EventType.GetPropertyType("nested4[2].prop5")); Assert.AreEqual("SAMPLE_V8", stmtSelectResult.Get("nested4[0].prop5[1]")); EPAssertionUtil.AssertEqualsExactOrder( (string[]) stmtSelectResult.Get("nested4[2].prop5"), new object[] {"SAMPLE_V10", "SAMPLE_V11"}); var fragmentNested4 = (EventBean) stmtSelectResult.GetFragment("nested4[2]"); EPAssertionUtil.AssertEqualsExactOrder( (string[]) fragmentNested4.Get("prop5"), new object[] {"SAMPLE_V10", "SAMPLE_V11"}); Assert.AreEqual("SAMPLE_V11", fragmentNested4.Get("prop5[1]")); SupportEventTypeAssertionUtil.AssertConsistency(fragmentNested4); env.UndeployAll(); }
public void TestWrapperFragmentWithMap() { IDictionary <string, object> typeLev0 = new Dictionary <string, object>(); typeLev0.Put("p1id", typeof(int)); _epService.EPAdministrator.Configuration.AddEventType("TypeLev0", typeLev0); IDictionary <string, object> mapOuter = new Dictionary <string, object>(); mapOuter.Put("p0simple", "TypeLev0"); mapOuter.Put("p0bean", typeof(SupportBeanComplexProps)); _epService.EPAdministrator.Configuration.AddEventType("TypeRoot", mapOuter); var stmt = _epService.EPAdministrator.CreateEPL("select *, p0simple.p1id + 1 as plusone, p0bean as mybean from TypeRoot"); stmt.AddListener(_listener); 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 _epService.EPRuntime.SendEvent(dataRoot, "TypeRoot"); var eventBean = _listener.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")); }
public override void Run(EPServiceProvider epService) { foreach (var clazz in new[] {typeof(SupportBean), typeof(SupportBean_S0), typeof(MyUpdateEvent)}) { epService.EPAdministrator.Configuration.AddEventType(clazz); } var listenerUpdate = new SupportUpdateListener(); var fields = "keyOne,keyTwo,p0".Split(','); epService.EPAdministrator.CreateEPL( "create table varagg as (" + "keyOne string primary key, keyTwo int primary key, p0 long)"); epService.EPAdministrator.CreateEPL( "on SupportBean merge varagg where TheString = keyOne and " + "IntPrimitive = keyTwo when not matched then insert select TheString as keyOne, IntPrimitive as keyTwo, 1 as p0"); var listener = new SupportUpdateListener(); epService.EPAdministrator.CreateEPL("select varagg[p00, id].p0 as value from SupportBean_S0") .Events += listener.Update; var stmtUpdate = epService.EPAdministrator.CreateEPL( "on MyUpdateEvent update varagg set p0 = newValue " + "where k1 = keyOne and k2 = keyTwo"); stmtUpdate.Events += listenerUpdate.Update; var expectedType = new[] { new object[] {"keyOne", typeof(string)}, new object[] {"keyTwo", typeof(int)}, new object[] {"p0", typeof(long)} }; SupportEventTypeAssertionUtil.AssertEventTypeProperties( expectedType, stmtUpdate.EventType, SupportEventTypeAssertionEnum.NAME, SupportEventTypeAssertionEnum.TYPE); epService.EPRuntime.SendEvent(new SupportBean("G1", 10)); AssertValues(epService, listener, new[] {new object[] {"G1", 10}}, new[] {1L}); epService.EPRuntime.SendEvent(new MyUpdateEvent("G1", 10, 2)); AssertValues(epService, listener, new[] {new object[] {"G1", 10}}, new[] {2L}); EPAssertionUtil.AssertProps(listenerUpdate.LastNewData[0], fields, new object[] {"G1", 10, 2L}); EPAssertionUtil.AssertProps( listenerUpdate.GetAndResetLastOldData()[0], fields, new object[] {"G1", 10, 1L}); // try property method invocation epService.EPAdministrator.CreateEPL("create table MyTableSuppBean as (sb SupportBean)"); epService.EPAdministrator.CreateEPL( "on SupportBean_S0 update MyTableSuppBean sb set sb.set_LongPrimitive(10)"); }
private void RunAssertionBeanNav(string typename, FunctionSendEvent send, object underlyingComplete) { var stmtText = "select * from " + typename; var stmt = _epService.EPAdministrator.CreateEPL(stmtText); var listener = new SupportUpdateListener(); stmt.AddListener(listener); send.Invoke(_epService, underlyingComplete); var @event = listener.AssertOneGetNewAndReset(); SupportEventTypeAssertionUtil.AssertConsistency(@event); stmt.Dispose(); }
public void Run(RegressionEnvironment env) { string epl = "@public @buseventtype create json schema JsonEvent (c0 Object[]);\n" + "@Name('s0') select * from JsonEvent#keepall;\n"; env.CompileDeploy(epl).AddListener("s0"); object[][] namesAndTypes = new object[][] { new object[] {"c0", typeof(object[])} }; SupportEventTypeAssertionUtil.AssertEventTypeProperties( namesAndTypes, env.Statement("s0").EventType, SupportEventTypeAssertionEnum.NAME, SupportEventTypeAssertionEnum.TYPE); SendAssertColumn(env, "{}", null); SendAssertColumn(env, "{\"c0\": []}", new object[0]); SendAssertColumn(env, "{\"c0\": [1.0]}", new object[] {1.0d}); SendAssertColumn(env, "{\"c0\": [null]}", new object[] {null}); SendAssertColumn(env, "{\"c0\": [true]}", new object[] {true}); SendAssertColumn(env, "{\"c0\": [false]}", new object[] {false}); SendAssertColumn(env, "{\"c0\": [\"abc\"]}", new object[] {"abc"}); SendAssertColumn(env, "{\"c0\": [[\"abc\"]]}", new object[][] {new object[] {"abc"}}); SendAssertColumn(env, "{\"c0\": [[]]}", new object[] {new object[0]}); SendAssertColumn(env, "{\"c0\": [[\"abc\", 2]]}", new object[][] {new object[] {"abc", 2}}); SendAssertColumn(env, "{\"c0\": [[[\"abc\"], [5.0]]]}", new object[][][] {new object[][] {new object[] {"abc"}, new object[] {5d}}}); SendAssertColumn(env, "{\"c0\": [{\"c1\": 10}]}", new object[] {Collections.SingletonMap("c1", 10)}); SendAssertColumn(env, "{\"c0\": [{\"c1\": 10, \"c2\": \"abc\"}]}", new object[] {CollectionUtil.BuildMap("c1", 10, "c2", "abc")}); env.Milestone(0); IEnumerator<EventBean> it = env.Statement("s0").GetEnumerator(); AssertColumn(it.Advance(), null); AssertColumn(it.Advance(), new object[0]); AssertColumn(it.Advance(), new object[] {1.0d}); AssertColumn(it.Advance(), new object[] {null}); AssertColumn(it.Advance(), new object[] {true}); AssertColumn(it.Advance(), new object[] {false}); AssertColumn(it.Advance(), new object[] {"abc"}); AssertColumn(it.Advance(), new object[][] {new object[] {"abc"}}); AssertColumn(it.Advance(), new object[] {new object[0]}); AssertColumn(it.Advance(), new object[][] {new object[] {"abc", 2}}); AssertColumn(it.Advance(), new object[][][] {new object[][] {new object[] {"abc"}, new object[] {5d}}}); AssertColumn(it.Advance(), new object[] {Collections.SingletonMap("c1", 10)}); AssertColumn(it.Advance(), new object[] {CollectionUtil.BuildMap("c1", 10, "c2", "abc")}); env.UndeployAll(); }
public void TestNoSchemaXPathGetter() { var configuration = SupportConfigFactory.GetConfiguration(); var desc = new ConfigurationEventTypeXMLDOM(); desc.RootElementName = "simpleEvent"; desc.IsXPathPropertyExpr = true; configuration.AddEventType("MyEvent", desc); _epService = EPServiceProviderManager.GetDefaultProvider(configuration); _epService.Initialize(); if (InstrumentationHelper.ENABLED) { InstrumentationHelper.StartTest(_epService, this.GetType(), this.GetType().FullName); } var stmtText = "select type?,dyn[1]?,nested.nes2?,map('a')?,other? from MyEvent"; var stmt = _epService.EPAdministrator.CreateEPL(stmtText); stmt.AddListener(_listener); EPAssertionUtil.AssertEqualsAnyOrder( new EventPropertyDescriptor[] { new EventPropertyDescriptor("type?", typeof(XmlNode), null, false, false, false, false, false), new EventPropertyDescriptor("dyn[1]?", typeof(XmlNode), null, false, false, false, false, false), new EventPropertyDescriptor("nested.nes2?", typeof(XmlNode), null, false, false, false, false, false), new EventPropertyDescriptor("map('a')?", typeof(XmlNode), null, false, false, false, false, false), new EventPropertyDescriptor("other?", typeof(XmlNode), null, false, false, false, false, false), }, stmt.EventType.PropertyDescriptors); SupportEventTypeAssertionUtil.AssertConsistency(stmt.EventType); var root = SupportXML.SendEvent(_epService.EPRuntime, NOSCHEMA_XML); var theEvent = _listener.AssertOneGetNewAndReset(); Assert.AreSame(root.DocumentElement.ChildNodes.Item(0), theEvent.Get("type?")); Assert.AreSame(root.DocumentElement.ChildNodes.Item(2), theEvent.Get("dyn[1]?")); Assert.AreSame(root.DocumentElement.ChildNodes.Item(3).ChildNodes.Item(0), theEvent.Get("nested.nes2?")); Assert.AreSame(root.DocumentElement.ChildNodes.Item(4), theEvent.Get("map('a')?")); Assert.IsNull(theEvent.Get("other?")); SupportEventTypeAssertionUtil.AssertConsistency(theEvent); if (InstrumentationHelper.ENABLED) { InstrumentationHelper.EndTest(); } }
public void Run(RegressionEnvironment env) { string epl = "@public @buseventtype create json schema JsonEvent (c0 Object[]);\n" + "@Name('s0') select * from JsonEvent#keepall;\n"; env.CompileDeploy(epl).AddListener("s0"); object[][] namesAndTypes = new object[][] { new object[] { "c0", typeof(object[]) } }; SupportEventTypeAssertionUtil.AssertEventTypeProperties( namesAndTypes, env.Statement("s0").EventType, SupportEventTypeAssertionEnum.NAME, SupportEventTypeAssertionEnum.TYPE); string[] jsons = new string[] { "{\"c0\": []}", "{\"c0\": [1.0]}", "{\"c0\": [null]}", "{\"c0\": [true]}", "{\"c0\": [false]}", "{\"c0\": [\"abc\"]}", "{\"c0\": [[\"abc\"]]}", "{\"c0\": [[]]}", "{\"c0\": [[\"abc\", 2]]}", "{\"c0\": [[[\"abc\"], [5.0]]]}", "{\"c0\": [{\"c1\": 10}]}", "{\"c0\": [{\"c1\": 10, \"c2\": \"abc\"}]}", }; foreach (string json in jsons) { SendAssert(env, json); } env.Milestone(0); using (IEnumerator <EventBean> it = env.Statement("s0").GetEnumerator()) { foreach (string json in jsons) { AssertJsonWrite(json, it.Advance()); } } env.UndeployAll(); }
public void Run(RegressionEnvironment env) { // test scalar-collection only var fieldsScalarColl = "c2,c3".SplitCsv(); var eplScalarColl = "@Name('s0') select " + "sc(TheString) as c0, " + "sc(IntPrimitive) as c1, " + "sc(TheString).allOf(v => v = 'E1') as c2, " + "sc(IntPrimitive).allOf(v => v = 1) as c3 " + "from SupportBean"; env.CompileDeploy(eplScalarColl).AddListener("s0"); var expectedScalarColl = new[] { new object[] { "c0", typeof(ICollection <object>), null, null }, new object[] { "c1", typeof(ICollection <object>), null, null }, new object[] { "c2", typeof(bool?), null, null }, new object[] { "c3", typeof(bool?), null, null }, }; SupportEventTypeAssertionUtil.AssertEventTypeProperties( expectedScalarColl, env.Statement("s0").EventType, SupportEventTypeAssertionEnumExtensions.GetSetWithFragment()); env.SendEventBean(new SupportBean("E1", 1)); EPAssertionUtil.AssertEqualsExactOrder( new object[] { "E1" }, env.Listener("s0").AssertOneGetNew().Get("c0").Unwrap <object>()); EPAssertionUtil.AssertEqualsExactOrder( new object[] { 1 }, env.Listener("s0").AssertOneGetNew().Get("c1").Unwrap <object>()); EPAssertionUtil.AssertProps(env.Listener("s0").AssertOneGetNewAndReset(), fieldsScalarColl, new object[] { true, true }); env.SendEventBean(new SupportBean("E2", 2)); EPAssertionUtil.AssertEqualsExactOrder( new object[] { "E1", "E2" }, env.Listener("s0").AssertOneGetNew().Get("c0").Unwrap <object>()); EPAssertionUtil.AssertEqualsExactOrder( new object[] { 1, 2 }, env.Listener("s0").AssertOneGetNew().Get("c1").Unwrap <object>()); EPAssertionUtil.AssertProps(env.Listener("s0").AssertOneGetNewAndReset(), fieldsScalarColl, new object[] { false, false }); env.UndeployAll(); }
private void RunAssertionBeanNav(string typename, FunctionSendEvent4Int send) { var epl = "select * from " + typename; var statement = _epService.EPAdministrator.CreateEPL(epl); var listener = new SupportUpdateListener(); statement.AddListener(listener); send.Invoke(_epService, 1, 2, 3, 4); var @event = listener.AssertOneGetNewAndReset(); EPAssertionUtil.AssertProps(@event, "l1.lvl1,l1.l2.lvl2,l1.l2.l3.lvl3,l1.l2.l3.l4.lvl4".SplitCsv(), new object[] { 1, 2, 3, 4 }); SupportEventTypeAssertionUtil.AssertConsistency(@event); SupportEventTypeAssertionUtil.AssertFragments(@event, typename.Equals(BEAN_TYPENAME), false, "l1,l1.l2,l1.l2.l3,l1.l2.l3.l4"); RunAssertionEventInvalidProp(@event); statement.Dispose(); }
private void RunAssertionTypeValidProp( RegressionEnvironment env, string typeName, FunctionSendEvent4Int send, Type nestedClass, string fragmentTypeName) { var eventType = env.Runtime.EventTypeService.GetEventTypePreconfigured(typeName); var expectedType = new object[][] { new object[] { "L1", nestedClass, fragmentTypeName, false } }; SupportEventTypeAssertionUtil.AssertEventTypeProperties(expectedType, eventType, SupportEventTypeAssertionEnumExtensions.GetSetWithFragment()); EPAssertionUtil.AssertEqualsAnyOrder(new string[] { "L1" }, eventType.PropertyNames); foreach (var prop in Arrays.AsList("L1", "L1.Lvl1", "L1.L2", "L1.L2.Lvl2")) { Assert.IsNotNull(eventType.GetGetter(prop)); Assert.IsTrue(eventType.IsProperty(prop)); } Assert.AreEqual(nestedClass, eventType.GetPropertyType("L1")); foreach (var prop in Arrays.AsList("L1.Lvl1", "L1.L2.Lvl2", "L1.L2.L3.Lvl3")) { Assert.AreEqual(typeof(int?), eventType.GetPropertyType(prop).GetBoxedType()); } var lvl1Fragment = eventType.GetFragmentType("L1"); Assert.IsFalse(lvl1Fragment.IsIndexed); var isNative = typeName.Equals(BEAN_TYPENAME) || typeName.Equals(JSONPROVIDED_TYPENAME); Assert.AreEqual(isNative, lvl1Fragment.IsNative); Assert.AreEqual(fragmentTypeName, lvl1Fragment.FragmentType.Name); var lvl2Fragment = eventType.GetFragmentType("L1.L2"); Assert.IsFalse(lvl2Fragment.IsIndexed); Assert.AreEqual(isNative, lvl2Fragment.IsNative); Assert.AreEqual(new EventPropertyDescriptor("L1", nestedClass, null, false, false, false, false, true), eventType.GetPropertyDescriptor("L1")); }
public void Run(RegressionEnvironment env) { string epl = "@public @buseventtype create json schema JsonEvent (c0 BigInteger, c1 BigDecimal," + "c2 BigInteger[], c3 BigDecimal[], c4 BigInteger[][], c5 BigDecimal[][]);\n" + "@Name('s0') select * from JsonEvent#keepall;\n"; env.CompileDeploy(epl).AddListener("s0"); object[][] namesAndTypes = new object[][] { new object[] {"c0", typeof(BigInteger?)}, new object[] {"c1", typeof(decimal?)}, new object[] {"c2", typeof(BigInteger?[])}, new object[] {"c3", typeof(decimal?[])}, new object[] {"c4", typeof(BigInteger?[][])}, new object[] {"c5", typeof(decimal?[][])} }; SupportEventTypeAssertionUtil.AssertEventTypeProperties( namesAndTypes, env.Statement("s0").EventType, SupportEventTypeAssertionEnum.NAME, SupportEventTypeAssertionEnum.TYPE); string json = "{\"c0\": 123456789123456789123456789, \"c1\": 123456789123456789123456789.1," + "\"c2\": [123456789123456789123456789], \"c3\": [123456789123456789123456789.1]," + "\"c4\": [[123456789123456789123456789]], \"c5\": [[123456789123456789123456789.1]]" + "}"; env.SendEventJson(json, "JsonEvent"); AssertFilled(env.Listener("s0").AssertOneGetNewAndReset()); json = "{}"; env.SendEventJson(json, "JsonEvent"); AssertUnfilled(env.Listener("s0").AssertOneGetNewAndReset()); json = "{\"c0\": null, \"c1\": null, \"c2\": null, \"c3\": null, \"c4\": null, \"c5\": null}"; env.SendEventJson(json, "JsonEvent"); AssertUnfilled(env.Listener("s0").AssertOneGetNewAndReset()); env.Milestone(0); IEnumerator<EventBean> it = env.Statement("s0").GetEnumerator(); AssertFilled(it.Advance()); AssertUnfilled(it.Advance()); AssertUnfilled(it.Advance()); env.UndeployAll(); }
private void RunAssertionObjectArrayFragmentObjectArrayNested(EPServiceProvider epService) { epService.EPAdministrator.Configuration.AddEventType("GoalLev0", new string[] { "p1id" }, new object[] { typeof(int) }); epService.EPAdministrator.Configuration.AddEventType("GoalRoot", new string[] { "p0simple", "p0array" }, new object[] { "GoalLev0", "GoalLev0[]" }); var stmt = epService.EPAdministrator.CreateEPL("select * from GoalRoot"); var listener = new SupportUpdateListener(); stmt.Events += listener.Update; Assert.AreEqual(typeof(object[]), stmt.EventType.UnderlyingType); epService.EPRuntime.SendEvent(new object[] { new object[] { 10 }, new object[] { new object[] { 20 }, new object[] { 21 } } }, "GoalRoot"); var eventBean = listener.AssertOneGetNewAndReset(); // Log.Info(SupportEventTypeAssertionUtil.Print(eventBean)); comment me in var eventType = eventBean.EventType; SupportEventTypeAssertionUtil.AssertConsistency(eventType); // resolve property via fragment Assert.IsTrue(eventType.GetPropertyDescriptor("p0simple").IsFragment); Assert.IsTrue(eventType.GetPropertyDescriptor("p0array").IsFragment); var innerSimpleEvent = (EventBean)eventBean.GetFragment("p0simple"); Assert.AreEqual(10, innerSimpleEvent.Get("p1id")); var innerArrayAllEvent = (EventBean[])eventBean.GetFragment("p0array"); Assert.AreEqual(20, innerArrayAllEvent[0].Get("p1id")); var innerArrayElementEvent = (EventBean)eventBean.GetFragment("p0array[0]"); Assert.AreEqual(20, innerArrayElementEvent.Get("p1id")); // resolve property via getter Assert.AreEqual(10, eventBean.Get("p0simple.p1id")); Assert.AreEqual(21, eventBean.Get("p0array[1].p1id")); Assert.IsNull(eventType.GetFragmentType("p0array.p1id")); Assert.IsNull(eventType.GetFragmentType("p0array[0].p1id")); stmt.Dispose(); }
private static void RunAssertion( RegressionEnvironment env, String eventTypeName, RegressionPath path) { var stmtSelectWild = "@Name('s0') select * from " + eventTypeName; env.CompileDeploy(stmtSelectWild, path).AddListener("s0"); var type = env.Statement("s0").EventType; SupportEventTypeAssertionUtil.AssertConsistency(type); object[][] types = { new object[] {"attrNonPositiveInteger", typeof(int?)}, new object[] {"attrNonNegativeInteger", typeof(int?)}, new object[] {"attrNegativeInteger", typeof(int?)}, new object[] {"attrPositiveInteger", typeof(int?)}, new object[] {"attrLong", typeof(long?)}, new object[] {"attrUnsignedLong", typeof(ulong?)}, new object[] {"attrInt", typeof(int?)}, new object[] {"attrUnsignedInt", typeof(uint?)}, new object[] {"attrDecimal", typeof(double?)}, new object[] {"attrInteger", typeof(int?)}, new object[] {"attrFloat", typeof(float?)}, new object[] {"attrDouble", typeof(double?)}, new object[] {"attrString", typeof(string)}, new object[] {"attrShort", typeof(short?)}, new object[] {"attrUnsignedShort", typeof(ushort?)}, new object[] {"attrByte", typeof(byte?)}, new object[] {"attrUnsignedByte", typeof(byte?)}, new object[] {"attrBoolean", typeof(bool?)}, new object[] {"attrDateTime", typeof(string)}, new object[] {"attrDate", typeof(string)}, new object[] {"attrTime", typeof(string)} }; for (var i = 0; i < types.Length; i++) { var name = types[i][0].ToString(); var desc = type.GetPropertyDescriptor(name); var expected = (Type) types[i][1]; Assert.AreEqual(expected, desc.PropertyType, "Failed for " + name); } env.UndeployAll(); }
public void TestFragments() { var nestedTypeFragment = eventTypeComplex.GetFragmentType("Nested"); var nestedType = nestedTypeFragment.FragmentType; Assert.AreEqual(typeof(SupportBeanComplexProps.SupportBeanSpecialGetterNested).FullName, nestedType.Name); Assert.AreEqual(typeof(SupportBeanComplexProps.SupportBeanSpecialGetterNested), nestedType.UnderlyingType); Assert.AreEqual(typeof(string), nestedType.GetPropertyType("NestedValue")); Assert.IsNull(eventTypeComplex.GetFragmentType("Indexed[0]")); nestedTypeFragment = eventTypeNested.GetFragmentType("Indexed[0]"); nestedType = nestedTypeFragment.FragmentType; Assert.IsFalse(nestedTypeFragment.IsIndexed); Assert.AreEqual(typeof(SupportBeanCombinedProps.NestedLevOne).FullName, nestedType.Name); Assert.AreEqual(typeof(IDictionary <string, SupportBeanCombinedProps.NestedLevTwo>), nestedType.GetPropertyType("Mapprop")); SupportEventTypeAssertionUtil.AssertConsistency(eventTypeComplex); SupportEventTypeAssertionUtil.AssertConsistency(eventTypeNested); }
private void RunAssertionTypeValidProp( EPServiceProvider epService, string typeName, ExecEventInfraPropertyNestedSimple.FunctionSendEvent4Int send, Type nestedClass, string fragmentTypeName) { var eventType = epService.EPAdministrator.Configuration.GetEventType(typeName); var arrayType = nestedClass == typeof(object[]) ? nestedClass : TypeHelper.GetArrayType(nestedClass); var expectedType = new[] { new object[] { "l1", arrayType, fragmentTypeName, true } }; SupportEventTypeAssertionUtil.AssertEventTypeProperties( expectedType, eventType, SupportEventTypeAssertionEnumExtensions.GetSetWithFragment()); EPAssertionUtil.AssertEqualsAnyOrder(new[] { "l1" }, eventType.PropertyNames); foreach (var prop in Collections.List("l1[0]", "l1[0].lvl1", "l1[0].l2", "l1[0].l2[0]", "l1[0].l2[0].lvl2")) { Assert.IsNotNull(eventType.GetGetter(prop)); Assert.IsTrue(eventType.IsProperty(prop)); } Assert.AreEqual(arrayType, eventType.GetPropertyType("l1")); foreach (var prop in Collections.List("l1[0].lvl1", "l1[0].l2[0].lvl2", "l1[0].l2[0].l3[0].lvl3")) { Assert.AreEqual(typeof(int?), TypeHelper.GetBoxedType(eventType.GetPropertyType(prop))); } var lvl1Fragment = eventType.GetFragmentType("l1"); Assert.IsTrue(lvl1Fragment.IsIndexed); Assert.AreEqual(send == FBEAN, lvl1Fragment.IsNative); Assert.AreEqual(fragmentTypeName, lvl1Fragment.FragmentType.Name); var lvl2Fragment = eventType.GetFragmentType("l1[0].l2"); Assert.IsTrue(lvl2Fragment.IsIndexed); Assert.AreEqual(send == FBEAN, lvl2Fragment.IsNative); Assert.AreEqual( new EventPropertyDescriptor("l1", arrayType, nestedClass, false, false, true, false, true), eventType.GetPropertyDescriptor("l1")); }
public void Run(RegressionEnvironment env) { string epl = "@public @buseventtype create json schema JsonEvent (c0 SupportEnum, c1 SupportEnum[], c2 SupportEnum[][]);\n" + "@Name('s0') select * from JsonEvent#keepall;\n"; env.CompileDeploy(epl).AddListener("s0"); object[][] namesAndTypes = new object[][] { new object[] {"c0", typeof(SupportEnum)}, new object[] {"c1", typeof(SupportEnum[])}, new object[] {"c2", typeof(SupportEnum[][])} }; SupportEventTypeAssertionUtil.AssertEventTypeProperties( namesAndTypes, env.Statement("s0").EventType, SupportEventTypeAssertionEnum.NAME, SupportEventTypeAssertionEnum.TYPE); string json = "{\"c0\": \"ENUM_VALUE_2\", \"c1\": [\"ENUM_VALUE_2\", \"ENUM_VALUE_1\"], \"c2\": [[\"ENUM_VALUE_2\"], [\"ENUM_VALUE_1\", \"ENUM_VALUE_3\"]]}"; env.SendEventJson(json, "JsonEvent"); AssertFilled(env.Listener("s0").AssertOneGetNewAndReset()); json = "{}"; env.SendEventJson(json, "JsonEvent"); AssertUnfilled(env.Listener("s0").AssertOneGetNewAndReset()); json = "{\"c0\": null, \"c1\": null, \"c2\": null}"; env.SendEventJson(json, "JsonEvent"); AssertUnfilled(env.Listener("s0").AssertOneGetNewAndReset()); json = "{\"c1\": [], \"c2\": [[]]}"; env.SendEventJson(json, "JsonEvent"); AssertEmptyArray(env.Listener("s0").AssertOneGetNewAndReset()); env.Milestone(0); IEnumerator<EventBean> it = env.Statement("s0").GetEnumerator(); AssertFilled(it.Advance()); AssertUnfilled(it.Advance()); AssertUnfilled(it.Advance()); AssertEmptyArray(it.Advance()); env.UndeployAll(); }
public void Run(RegressionEnvironment env) { env.CompileDeploy("@Name('s0') select * from GoalRoot").AddListener("s0"); Assert.AreEqual(typeof(object[]), env.Statement("s0").EventType.UnderlyingType); env.SendEventObjectArray( new object[] { new object[] {10}, new object[] { new object[] {20}, new object[] {21} } }, "GoalRoot"); 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.IsTrue(eventType.GetPropertyDescriptor("p0array").IsFragment); var innerSimpleEvent = (EventBean) eventBean.GetFragment("p0simple"); Assert.AreEqual(10, innerSimpleEvent.Get("p1id")); var innerArrayAllEvent = (EventBean[]) eventBean.GetFragment("p0array"); Assert.AreEqual(20, innerArrayAllEvent[0].Get("p1id")); var innerArrayElementEvent = (EventBean) eventBean.GetFragment("p0array[0]"); Assert.AreEqual(20, innerArrayElementEvent.Get("p1id")); // resolve property via getter Assert.AreEqual(10, eventBean.Get("p0simple.p1id")); Assert.AreEqual(21, eventBean.Get("p0array[1].p1id")); Assert.IsNull(eventType.GetFragmentType("p0array.p1id")); Assert.IsNull(eventType.GetFragmentType("p0array[0].p1id")); env.UndeployAll(); }
public void Run(RegressionEnvironment env) { var fieldsScalarArray = "c0,c1,c2,c3".SplitCsv(); var eplScalarArray = "@Name('s0') select " + "sa(TheString) as c0, " + "sa(IntPrimitive) as c1, " + "sa(TheString).allOf(v => v = 'E1') as c2, " + "sa(IntPrimitive).allOf(v => v = 1) as c3 " + "from SupportBean"; env.CompileDeploy(eplScalarArray).AddListener("s0"); var expectedScalarArray = new [] { new object[] { "c0", typeof(string[]), null, null }, new object[] { "c1", typeof(int?[]), null, null }, new object[] { "c2", typeof(bool?), null, null }, new object[] { "c3", typeof(bool?), null, null }, }; SupportEventTypeAssertionUtil.AssertEventTypeProperties( expectedScalarArray, env.Statement("s0").EventType, SupportEventTypeAssertionEnumExtensions.GetSetWithFragment()); env.SendEventBean(new SupportBean("E1", 1)); EPAssertionUtil.AssertProps( env.Listener("s0").AssertOneGetNewAndReset(), fieldsScalarArray, new object[] { new[] { "E1" }, new int?[] { 1 }, true, true }); env.SendEventBean(new SupportBean("E2", 2)); EPAssertionUtil.AssertProps( env.Listener("s0").AssertOneGetNewAndReset(), fieldsScalarArray, new object[] { new[] { "E1", "E2" }, new int?[] { 1, 2 }, false, false }); env.UndeployAll(); }
private static void RunAssertion( RegressionEnvironment env, String eventTypeName, RegressionPath path) { var stmtText = "@Name('s0') select type?,dyn[1]?,nested.nes2?,map('a')?,other? from " + eventTypeName; env.CompileDeploy(stmtText, path).AddListener("s0"); CollectionAssert.AreEquivalent( new EventPropertyDescriptor[] { new EventPropertyDescriptor("type?", typeof(XmlNode), null, false, false, false, false, false), new EventPropertyDescriptor("dyn[1]?", typeof(XmlNode), null, false, false, false, false, false), new EventPropertyDescriptor( "nested.nes2?", typeof(XmlNode), null, false, false, false, false, false), new EventPropertyDescriptor("map('a')?", typeof(XmlNode), null, false, false, false, false, false), new EventPropertyDescriptor("other?", typeof(XmlNode), null, false, false, false, false, false) }, env.Statement("s0").EventType.PropertyDescriptors); SupportEventTypeAssertionUtil.AssertConsistency(env.Statement("s0").EventType); var root = SupportXML.SendXMLEvent( env, EventXMLNoSchemaPropertyDynamicDOMGetter.NOSCHEMA_XML, eventTypeName); var theEvent = env.Listener("s0").AssertOneGetNewAndReset(); Assert.AreEqual(root.DocumentElement.ChildNodes.Item(0), theEvent.Get("type?")); Assert.AreEqual(root.DocumentElement.ChildNodes.Item(2), theEvent.Get("dyn[1]?")); Assert.AreEqual(root.DocumentElement.ChildNodes.Item(3).ChildNodes.Item(0), theEvent.Get("nested.nes2?")); Assert.AreEqual(root.DocumentElement.ChildNodes.Item(4), theEvent.Get("map('a')?")); Assert.IsNull(theEvent.Get("other?")); SupportEventTypeAssertionUtil.AssertConsistency(theEvent); env.UndeployAll(); }
public void TestObjectArrayFragmentObjectArrayNested() { _epService.EPAdministrator.Configuration.AddEventType("TypeLev0", new string[] { "p1id" }, new object[] { typeof(int) }); _epService.EPAdministrator.Configuration.AddEventType("TypeRoot", new string[] { "p0simple", "p0array" }, new object[] { "TypeLev0", "TypeLev0[]" }); var stmt = _epService.EPAdministrator.CreateEPL("select * from TypeRoot"); stmt.AddListener(_listener); Assert.AreEqual(typeof(object[]), stmt.EventType.UnderlyingType); _epService.EPRuntime.SendEvent(new object[] { new object[] { 10 }, new object[] { new object[] { 20 }, new object[] { 21 } } }, "TypeRoot"); var eventBean = _listener.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.IsTrue(eventType.GetPropertyDescriptor("p0array").IsFragment); var innerSimpleEvent = (EventBean)eventBean.GetFragment("p0simple"); Assert.AreEqual(10, innerSimpleEvent.Get("p1id")); var innerArrayAllEvent = (EventBean[])eventBean.GetFragment("p0array"); Assert.AreEqual(20, innerArrayAllEvent[0].Get("p1id")); var innerArrayElementEvent = (EventBean)eventBean.GetFragment("p0array[0]"); Assert.AreEqual(20, innerArrayElementEvent.Get("p1id")); // resolve property via getter Assert.AreEqual(10, eventBean.Get("p0simple.p1id")); Assert.AreEqual(21, eventBean.Get("p0array[1].p1id")); Assert.IsNull(eventType.GetFragmentType("p0array.p1id")); Assert.IsNull(eventType.GetFragmentType("p0array[0].p1id")); }
private void RunAssertionMapSimpleTypes(EPServiceProvider epService) { var mapOuter = new Dictionary <string, Object>(); mapOuter.Put("p0int", typeof(int)); mapOuter.Put("p0intarray", typeof(int[])); mapOuter.Put("p0map", typeof(Map)); epService.EPAdministrator.Configuration.AddEventType("MSTypeOne", mapOuter); var listener = new SupportUpdateListener(); var stmt = epService.EPAdministrator.CreateEPL("select * from MSTypeOne"); stmt.Events += listener.Update; var dataInner = new Dictionary <string, Object>(); dataInner.Put("p1someval", "A"); var dataRoot = new Dictionary <string, Object>(); dataRoot.Put("p0simple", 99); dataRoot.Put("p0array", new int[] { 101, 102 }); dataRoot.Put("p0map", dataInner); // send event epService.EPRuntime.SendEvent(dataRoot, "MSTypeOne"); var eventBean = listener.AssertOneGetNewAndReset(); //Log.Info(SupportEventTypeAssertionUtil.Print(eventBean)); //comment me in var eventType = eventBean.EventType; SupportEventTypeAssertionUtil.AssertConsistency(eventType); // resolve property via fragment Assert.IsNull(eventType.GetFragmentType("p0int")); Assert.IsNull(eventType.GetFragmentType("p0intarray")); Assert.IsNull(eventBean.GetFragment("p0map?")); Assert.IsNull(eventBean.GetFragment("p0intarray[0]?")); Assert.IsNull(eventBean.GetFragment("p0map('a')?")); stmt.Dispose(); }
public void Run(RegressionEnvironment env) { // note class not a fragment env.CompileDeploy("@Name('s0') insert into MyNestedStream select nested1 from TestXMLSchemaTypeTXG"); CollectionAssert.AreEquivalent( new EventPropertyDescriptor[] { new EventPropertyDescriptor("nested1", typeof(XmlNode), null, false, false, false, false, false) }, env.Statement("s0").EventType.PropertyDescriptors); SupportEventTypeAssertionUtil.AssertConsistency(env.Statement("s0").EventType); var type = env.Runtime.EventTypeService.GetEventTypePreconfigured("TestXMLSchemaTypeTXG"); SupportEventTypeAssertionUtil.AssertConsistency(type); Assert.IsNull(type.GetFragmentType("nested1")); Assert.IsNull(type.GetFragmentType("nested1.Nested2")); SupportXML.SendDefaultEvent(env.EventService, "ABC", "TestXMLSchemaTypeTXG"); SupportEventTypeAssertionUtil.AssertConsistency(env.GetEnumerator("s0").Advance()); env.UndeployAll(); }
public override void Run(EPServiceProvider epService) { string stmtSelectWild = "select * from TestTypesEvent"; EPStatement wildStmt = epService.EPAdministrator.CreateEPL(stmtSelectWild); EventType type = wildStmt.EventType; SupportEventTypeAssertionUtil.AssertConsistency(type); var types = new object[][] { new object[] { "attrNonPositiveInteger", typeof(int?) }, new object[] { "attrNonNegativeInteger", typeof(int?) }, new object[] { "attrNegativeInteger", typeof(int?) }, new object[] { "attrPositiveInteger", typeof(int?) }, new object[] { "attrLong", typeof(long?) }, new object[] { "attrUnsignedLong", typeof(ulong?) }, new object[] { "attrInt", typeof(int?) }, new object[] { "attrUnsignedInt", typeof(uint?) }, new object[] { "attrDecimal", typeof(double?) }, new object[] { "attrInteger", typeof(int?) }, new object[] { "attrFloat", typeof(float?) }, new object[] { "attrDouble", typeof(double?) }, new object[] { "attrString", typeof(string) }, new object[] { "attrShort", typeof(short?) }, new object[] { "attrUnsignedShort", typeof(ushort?) }, new object[] { "attrByte", typeof(byte?) }, new object[] { "attrUnsignedByte", typeof(byte?) }, new object[] { "attrBoolean", typeof(bool?) }, new object[] { "attrDateTime", typeof(string) }, new object[] { "attrDate", typeof(string) }, new object[] { "attrTime", typeof(string) } }; for (int i = 0; i < types.Length; i++) { string name = types[i][0].ToString(); EventPropertyDescriptor desc = type.GetPropertyDescriptor(name); Type expected = (Type)types[i][1]; Assert.AreEqual(expected, desc.PropertyType, "Failed for " + name); } }
public void Run(RegressionEnvironment env) { var fieldsEnumEvent = "c0,c1,c2".SplitCsv(); var eplEnumEvent = "@Name('s0') select " + "ee() as c0, " + "ee().allOf(v => v.TheString = 'E1') as c1, " + "ee().allOf(v => v.IntPrimitive = 1) as c2 " + "from SupportBean"; env.CompileDeploy(eplEnumEvent).AddListener("s0"); var expectedEnumEvent = new[] { new object[] { "c0", typeof(SupportBean[]), typeof(SupportBean).FullName, true }, new object[] { "c1", typeof(bool?), null, null }, new object[] { "c2", typeof(bool?), null, null } }; SupportEventTypeAssertionUtil.AssertEventTypeProperties( expectedEnumEvent, env.Statement("s0").EventType, SupportEventTypeAssertionEnumExtensions.GetSetWithFragment()); var eventEnumOne = new SupportBean("E1", 1); env.SendEventBean(eventEnumOne); EPAssertionUtil.AssertProps( env.Listener("s0").AssertOneGetNewAndReset(), fieldsEnumEvent, new object[] { new[] { eventEnumOne }, true, true }); var eventEnumTwo = new SupportBean("E2", 2); env.SendEventBean(eventEnumTwo); EPAssertionUtil.AssertProps( env.Listener("s0").AssertOneGetNewAndReset(), fieldsEnumEvent, new object[] { new[] { eventEnumOne, eventEnumTwo }, false, false }); env.UndeployAll(); }
private void RunAssertionMapFragmentMapUnnamed(EPServiceProvider epService) { var typeLev0 = new Dictionary <string, Object>(); typeLev0.Put("p1id", typeof(int)); var mapOuter = new Dictionary <string, Object>(); mapOuter.Put("p0simple", typeLev0); epService.EPAdministrator.Configuration.AddEventType("FlywheelRoot", mapOuter); var stmt = epService.EPAdministrator.CreateEPL("select * from FlywheelRoot"); var listener = new SupportUpdateListener(); stmt.Events += listener.Update; var dataInner = new Dictionary <string, Object>(); dataInner.Put("p1id", 10); var dataRoot = new Dictionary <string, Object>(); dataRoot.Put("p0simple", dataInner); // send event epService.EPRuntime.SendEvent(dataRoot, "FlywheelRoot"); var eventBean = listener.AssertOneGetNewAndReset(); // Log.Info(SupportEventTypeAssertionUtil.Print(eventBean)); comment me in var eventType = eventBean.EventType; SupportEventTypeAssertionUtil.AssertConsistency(eventType); Assert.IsFalse(eventType.GetPropertyDescriptor("p0simple").IsFragment); Assert.IsNull(eventBean.GetFragment("p0simple")); // resolve property via getter Assert.AreEqual(10, eventBean.Get("p0simple.p1id")); stmt.Dispose(); }
public void TestGetComplexProperty() { var eventCombined = SupportBeanCombinedProps.MakeDefaultBean(); var eventBean = SupportEventBeanFactory.CreateObject(supportEventTypeFactory, eventCombined); Assert.AreEqual("0ma0", eventBean.Get("Indexed[0].Mapped('0ma').Value")); Assert.AreEqual(typeof(string), eventBean.EventType.GetPropertyType("Indexed[0].Mapped('0ma').Value")); Assert.IsNotNull(eventBean.EventType.GetGetter("Indexed[0].Mapped('0ma').Value")); Assert.AreEqual("0ma1", eventBean.Get("Indexed[0].Mapped('0mb').Value")); Assert.AreEqual("1ma0", eventBean.Get("Indexed[1].Mapped('1ma').Value")); Assert.AreEqual("1ma1", eventBean.Get("Indexed[1].Mapped('1mb').Value")); Assert.AreEqual("0ma0", eventBean.Get("Array[0].Mapped('0ma').Value")); Assert.AreEqual("1ma1", eventBean.Get("Array[1].Mapped('1mb').Value")); Assert.AreEqual("0ma0", eventBean.Get("Array[0].Mapprop('0ma').Value")); Assert.AreEqual("1ma1", eventBean.Get("Array[1].Mapprop('1mb').Value")); TryInvalidGet(eventBean, "dummy"); TryInvalidGet(eventBean, "dummy[1]"); TryInvalidGet(eventBean, "dummy('dd')"); TryInvalidGet(eventBean, "dummy.dummy1"); // indexed getter TryInvalidGetFragment(eventBean, "Indexed"); Assert.AreEqual( typeof(SupportBeanCombinedProps.NestedLevOne), ((EventBean) eventBean.GetFragment("Indexed[0]")).EventType.UnderlyingType); Assert.AreEqual("abc", ((EventBean) eventBean.GetFragment("Array[0]")).Get("NestLevOneVal")); Assert.AreEqual("abc", eventBean.GetFragment("Array[2]?").AsEventBean().Get("NestLevOneVal")); Assert.IsNull(eventBean.GetFragment("Array[3]?")); Assert.IsNull(eventBean.GetFragment("Array[4]?")); Assert.IsNull(eventBean.GetFragment("Array[5]?")); var eventText = SupportEventTypeAssertionUtil.Print(eventBean); //System.out.println(eventText); var eventComplex = SupportBeanComplexProps.MakeDefaultBean(); eventBean = SupportEventBeanFactory.CreateObject(supportEventTypeFactory, eventComplex); Assert.AreEqual("NestedValue", ((EventBean) eventBean.GetFragment("Nested")).Get("NestedValue")); }
public void Run(RegressionEnvironment env) { env.CompileDeploy("@Name('s0') select * from HomerunRoot").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("p0array", new[] {dataInner, dataInner}); // send event env.SendEventMap(dataRoot, "HomerunRoot"); 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.IsTrue(eventType.GetPropertyDescriptor("p0array").IsFragment); var innerSimpleEvent = (EventBean) eventBean.GetFragment("p0simple"); Assert.AreEqual(10, innerSimpleEvent.Get("p1id")); var innerArrayAllEvent = (EventBean[]) eventBean.GetFragment("p0array"); Assert.AreEqual(10, innerArrayAllEvent[0].Get("p1id")); var innerArrayElementEvent = (EventBean) eventBean.GetFragment("p0array[0]"); Assert.AreEqual(10, innerArrayElementEvent.Get("p1id")); // resolve property via getter Assert.AreEqual(10, eventBean.Get("p0simple.p1id")); Assert.AreEqual(10, eventBean.Get("p0array[1].p1id")); Assert.IsNull(eventType.GetFragmentType("p0array.p1id")); Assert.IsNull(eventType.GetFragmentType("p0array[0].p1id")); env.UndeployAll(); }
private void RunAssertionSelectNested( RegressionEnvironment env, string typename, FunctionSendEvent4Int send, RegressionPath path) { var epl = "@Name('s0') select " + "L1.Lvl1 as c0, " + "exists(L1.Lvl1) as exists_c0, " + "L1.L2.Lvl2 as c1, " + "exists(L1.L2.Lvl2) as exists_c1, " + "L1.L2.L3.Lvl3 as c2, " + "exists(L1.L2.L3.Lvl3) as exists_c2, " + "L1.L2.L3.L4.Lvl4 as c3, " + "exists(L1.L2.L3.L4.Lvl4) as exists_c3 " + "from " + typename; env.CompileDeploy(epl, path).AddListener("s0"); var fields = "c0,exists_c0,c1,exists_c1,c2,exists_c2,c3,exists_c3".SplitCsv(); var eventType = env.Statement("s0").EventType; foreach (var property in fields) { Assert.AreEqual(property.StartsWith("exists") ? typeof(bool?) : typeof(int?), eventType.GetPropertyType(property).GetBoxedType()); } send.Invoke(typename, env, 1, 2, 3, 4); var @event = env.Listener("s0").AssertOneGetNewAndReset(); EPAssertionUtil.AssertProps(@event, fields, new object[] { 1, true, 2, true, 3, true, 4, true }); SupportEventTypeAssertionUtil.AssertConsistency(@event); send.Invoke(typename, env, 10, 5, 50, 400); EPAssertionUtil.AssertProps(env.Listener("s0").AssertOneGetNewAndReset(), fields, new object[] { 10, true, 5, true, 50, true, 400, true }); env.UndeployModuleContaining("s0"); }