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(); }