public void Run(RegressionEnvironment env) { var epl = "@Name('s0') select" + " cast(item?, " + typeof(SupportMarkerInterface).FullName + ") as t0, " + " cast(item?, " + typeof(ISupportA).FullName + ") as t1, " + " cast(item?, " + typeof(ISupportBaseAB).FullName + ") as t2, " + " cast(item?, " + typeof(ISupportBaseABImpl).FullName + ") as t3, " + " cast(item?, " + typeof(ISupportC).FullName + ") as t4, " + " cast(item?, " + typeof(ISupportD).FullName + ") as t5, " + " cast(item?, " + typeof(ISupportAImplSuperG).FullName + ") as t6, " + " cast(item?, " + typeof(ISupportAImplSuperGImplPlus).FullName + ") as t7 " + " from SupportBeanDynRoot"; env.CompileDeploy(epl).AddListener("s0"); var type = env.Statement("s0").EventType; Assert.AreEqual(typeof(SupportMarkerInterface), type.GetPropertyType("t0")); Assert.AreEqual(typeof(ISupportA), type.GetPropertyType("t1")); Assert.AreEqual(typeof(ISupportBaseAB), type.GetPropertyType("t2")); Assert.AreEqual(typeof(ISupportBaseABImpl), type.GetPropertyType("t3")); Assert.AreEqual(typeof(ISupportC), type.GetPropertyType("t4")); Assert.AreEqual(typeof(ISupportD), type.GetPropertyType("t5")); Assert.AreEqual(typeof(ISupportAImplSuperG), type.GetPropertyType("t6")); Assert.AreEqual(typeof(ISupportAImplSuperGImplPlus), type.GetPropertyType("t7")); object bean = new SupportBeanDynRoot("abc"); env.SendEventBean(new SupportBeanDynRoot(bean)); var theEvent = env.Listener("s0").AssertOneGetNewAndReset(); AssertResults(theEvent, new[] { bean, null, null, null, null, null, null, null }); bean = new ISupportDImpl("", "", ""); env.SendEventBean(new SupportBeanDynRoot(bean)); theEvent = env.Listener("s0").AssertOneGetNewAndReset(); AssertResults(theEvent, new[] { null, null, null, null, null, bean, null, null }); bean = new ISupportBCImpl("", "", ""); env.SendEventBean(new SupportBeanDynRoot(bean)); theEvent = env.Listener("s0").AssertOneGetNewAndReset(); AssertResults(theEvent, new[] { null, null, bean, null, bean, null, null, null }); bean = new ISupportAImplSuperGImplPlus(); env.SendEventBean(new SupportBeanDynRoot(bean)); theEvent = env.Listener("s0").AssertOneGetNewAndReset(); AssertResults(theEvent, new[] { null, bean, bean, null, bean, null, bean, bean }); bean = new ISupportBaseABImpl(""); env.SendEventBean(new SupportBeanDynRoot(bean)); theEvent = env.Listener("s0").AssertOneGetNewAndReset(); AssertResults(theEvent, new[] { null, null, bean, bean, null, null, null, null }); env.UndeployAll(); }
private void RunAssertionCastInterface(EPServiceProvider epService) { var caseExpr = "select cast(item?, " + typeof(SupportMarkerInterface).FullName + ") as t0, " + " cast(item?, " + typeof(ISupportA).FullName + ") as t1, " + " cast(item?, " + typeof(ISupportBaseAB).FullName + ") as t2, " + " cast(item?, " + typeof(ISupportBaseABImpl).FullName + ") as t3, " + " cast(item?, " + typeof(ISupportC).FullName + ") as t4, " + " cast(item?, " + typeof(ISupportD).FullName + ") as t5, " + " cast(item?, " + typeof(ISupportAImplSuperG).FullName + ") as t6, " + " cast(item?, " + typeof(ISupportAImplSuperGImplPlus).FullName + ") as t7 " + " from " + typeof(SupportMarkerInterface).FullName; var selectTestCase = epService.EPAdministrator.CreateEPL(caseExpr); var listener = new SupportUpdateListener(); selectTestCase.Events += listener.Update; Assert.AreEqual(typeof(SupportMarkerInterface), selectTestCase.EventType.GetPropertyType("t0")); Assert.AreEqual(typeof(ISupportA), selectTestCase.EventType.GetPropertyType("t1")); Assert.AreEqual(typeof(ISupportBaseAB), selectTestCase.EventType.GetPropertyType("t2")); Assert.AreEqual(typeof(ISupportBaseABImpl), selectTestCase.EventType.GetPropertyType("t3")); Assert.AreEqual(typeof(ISupportC), selectTestCase.EventType.GetPropertyType("t4")); Assert.AreEqual(typeof(ISupportD), selectTestCase.EventType.GetPropertyType("t5")); Assert.AreEqual(typeof(ISupportAImplSuperG), selectTestCase.EventType.GetPropertyType("t6")); Assert.AreEqual(typeof(ISupportAImplSuperGImplPlus), selectTestCase.EventType.GetPropertyType("t7")); object bean = new SupportBeanDynRoot("abc"); epService.EPRuntime.SendEvent(new SupportBeanDynRoot(bean)); var theEvent = listener.AssertOneGetNewAndReset(); AssertResults(theEvent, new object[] { bean, null, null, null, null, null, null, null }); bean = new ISupportDImpl("", "", ""); epService.EPRuntime.SendEvent(new SupportBeanDynRoot(bean)); theEvent = listener.AssertOneGetNewAndReset(); AssertResults(theEvent, new object[] { null, null, null, null, null, bean, null, null }); bean = new ISupportBCImpl("", "", ""); epService.EPRuntime.SendEvent(new SupportBeanDynRoot(bean)); theEvent = listener.AssertOneGetNewAndReset(); AssertResults(theEvent, new object[] { null, null, bean, null, bean, null, null, null }); bean = new ISupportAImplSuperGImplPlus(); epService.EPRuntime.SendEvent(new SupportBeanDynRoot(bean)); theEvent = listener.AssertOneGetNewAndReset(); AssertResults(theEvent, new object[] { null, bean, bean, null, bean, null, bean, bean }); bean = new ISupportBaseABImpl(""); epService.EPRuntime.SendEvent(new SupportBeanDynRoot(bean)); theEvent = listener.AssertOneGetNewAndReset(); AssertResults(theEvent, new object[] { null, null, bean, bean, null, null, null, null }); selectTestCase.Dispose(); }
/// <summary> /// ISupportBaseAB ISupportA ISupportB ISupportABCImpl /// </summary> /// <unknown>@return</unknown> private static LinkedHashMap <String, Object> MakeTestDataInterfaces() { LinkedHashMap <String, Object> testData = new LinkedHashMap <String, Object>(); testData["e1"] = new ISupportCImpl("C1"); testData["e2"] = new ISupportABCImpl("A1", "B1", "BaseB", "C1"); testData["e3"] = new ISupportAImpl("A1", "BaseAB"); testData["e4"] = new ISupportBImpl("B1", "BaseAB"); testData["e5"] = new ISupportDImpl("D1", "BaseD", "BaseDBase"); testData["e6"] = new ISupportBCImpl("B2", "BaseAB2", "C2"); testData["e7"] = new ISupportBaseABImpl("BaseAB3"); testData["e8"] = new SupportOverrideOneA("OA1", "O1", "OBase"); testData["e9"] = new SupportOverrideOneB("OB1", "O2", "OBase"); testData["e10"] = new SupportOverrideOne("O3", "OBase"); testData["e11"] = new SupportOverrideBase("OBase"); testData["e12"] = new ISupportAImplSuperGImplPlus("G1", "A3", "BaseAB4", "B4", "C2"); testData["e13"] = new ISupportAImplSuperGImpl("G2", "A14", "BaseAB5"); return(testData); }
public void TestInterfaceProperty() { // Assert implementations have full set of properties ISupportDImpl theEvent = new ISupportDImpl("D", "BaseD", "BaseDBase"); EventType typeBean = _beanEventTypeFactory.CreateBeanType(theEvent.GetType().FullName, theEvent.GetType(), true, true, true); EventBean bean = new BeanEventBean(theEvent, typeBean); Assert.AreEqual("D", bean.Get("D")); Assert.AreEqual("BaseD", bean.Get("BaseD")); Assert.AreEqual("BaseDBase", bean.Get("BaseDBase")); Assert.AreEqual(3, bean.EventType.PropertyNames.Length); EPAssertionUtil.AssertEqualsAnyOrder(bean.EventType.PropertyNames, new[] { "D", "BaseD", "BaseDBase" }); // Assert intermediate interfaces have full set of fields EventType interfaceType = _beanEventTypeFactory.CreateBeanType("d", typeof(ISupportD), true, true, true); EPAssertionUtil.AssertEqualsAnyOrder(interfaceType.PropertyNames, new[] { "D", "BaseD", "BaseDBase" }); }