Exemple #1
0
        public void Run(RegressionEnvironment env)
        {
            var statementText = "@Name('s0') select IntPrimitive, explicitFInt, explicitMGetInt, explicitMReadInt " +
                                " from MyLegacyTwo#length(5)";
            env.CompileDeploy(statementText).AddListener("s0");

            var eventType = env.Statement("s0").EventType;

            var theEvent = new SupportLegacyBeanInt(10);
            env.SendEventBean(theEvent, "MyLegacyTwo");

            foreach (var name in new[] {"IntPrimitive", "explicitFInt", "explicitMGetInt", "explicitMReadInt"}) {
                Assert.AreEqual(typeof(int?), eventType.GetPropertyType(name));
                Assert.AreEqual(10, env.Listener("s0").LastNewData[0].Get(name));
            }

            env.UndeployAll();
        }
Exemple #2
0
        public void TryNativeBeanAccessor(CodeGenerationEnum codeGeneration)
        {
            var config    = SupportConfigFactory.GetConfiguration();
            var legacyDef = new ConfigurationEventTypeLegacy();

            legacyDef.AccessorStyle  = AccessorStyleEnum.NATIVE;
            legacyDef.CodeGeneration = codeGeneration;
            legacyDef.AddFieldProperty("explicitFInt", "fieldIntPrimitive");
            legacyDef.AddMethodProperty("explicitMGetInt", "GetIntPrimitive");
            legacyDef.AddMethodProperty("explicitMReadInt", "ReadIntPrimitive");
            config.AddEventType("MyLegacyEvent", typeof(SupportLegacyBeanInt).FullName, legacyDef);

            _epService = EPServiceProviderManager.GetDefaultProvider(config);
            _epService.Initialize();
            if (InstrumentationHelper.ENABLED)
            {
                InstrumentationHelper.StartTest(_epService, GetType(), GetType().FullName);
            }

            var statementText = "select IntPrimitive, explicitFInt, explicitMGetInt, explicitMReadInt " +
                                " from MyLegacyEvent#length(5)";

            var statement = _epService.EPAdministrator.CreateEPL(statementText);
            var listener  = new SupportUpdateListener();

            statement.Events += listener.Update;
            var eventType = statement.EventType;

            var theEvent = new SupportLegacyBeanInt(10);

            _epService.EPRuntime.SendEvent(theEvent);

            foreach (var name in new String[] { "IntPrimitive", "explicitFInt", "explicitMGetInt", "explicitMReadInt" })
            {
                Assert.AreEqual(typeof(int), eventType.GetPropertyType(name));
                Assert.AreEqual(10, listener.LastNewData[0].Get(name));
            }

            if (InstrumentationHelper.ENABLED)
            {
                InstrumentationHelper.EndTest();
            }
            _epService.Dispose();
        }
        public override void Run(EPServiceProvider epService)
        {
            string statementText = "select IntPrimitive, explicitFInt, explicitMGetInt, explicitMReadInt " +
                                   " from MyLegacyEvent#length(5)";

            EPStatement statement = epService.EPAdministrator.CreateEPL(statementText);
            var         listener  = new SupportUpdateListener();

            statement.Events += listener.Update;
            EventType eventType = statement.EventType;

            var theEvent = new SupportLegacyBeanInt(10);

            epService.EPRuntime.SendEvent(theEvent);

            foreach (string name in new string[] { "IntPrimitive", "explicitFInt", "explicitMGetInt", "explicitMReadInt" })
            {
                Assert.AreEqual(typeof(int), eventType.GetPropertyType(name));
                Assert.AreEqual(10, listener.LastNewData[0].Get(name));
            }
        }