public override void Run(EPServiceProvider epService)
        {
            string statementText = "select " +
                                   "explicitFNested.fieldNestedClassValue as fnested, " +
                                   "explicitMNested.ReadNestedClassValue as mnested" +
                                   " from MyLegacyEvent#length(5)";

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

            statement.Events += listener.Update;

            EventType eventType = statement.EventType;

            Assert.AreEqual(typeof(string), eventType.GetPropertyType("fnested"));
            Assert.AreEqual(typeof(string), eventType.GetPropertyType("mnested"));

            SupportLegacyBean legacyBean = ExecEventBeanPublicAccessors.MakeSampleEvent();

            epService.EPRuntime.SendEvent(legacyBean);

            Assert.AreEqual(legacyBean.fieldNested.ReadNestedValue(), listener.LastNewData[0].Get("fnested"));
            Assert.AreEqual(legacyBean.fieldNested.ReadNestedValue(), listener.LastNewData[0].Get("mnested"));

            try {
                // invalid statement, JavaBean-style getters not exposed
                statementText = "select IntPrimitive from MySupportBean#length(5)";
                epService.EPAdministrator.CreateEPL(statementText);
            } catch (EPStatementException) {
                // expected
            }
        }
Пример #2
0
        public void SetUp()
        {
            _container = SupportContainer.Reset();
            SupportLegacyBean testEvent = new SupportLegacyBean("a");

            _unitTestBean = SupportEventBeanFactory.CreateObject(testEvent);
        }
Пример #3
0
        public void TestAccessorStyleGlobalPublic()
        {
            Configuration configuration = SupportConfigFactory.GetConfiguration();

            configuration.EngineDefaults.EventMeta.DefaultAccessorStyle = AccessorStyleEnum.PUBLIC;
            configuration.AddEventType("SupportLegacyBean", typeof(SupportLegacyBean));
            epService = EPServiceProviderManager.GetDefaultProvider(configuration);
            epService.Initialize();
            if (InstrumentationHelper.ENABLED)
            {
                InstrumentationHelper.StartTest(epService, this.GetType(), this.GetType().FullName);
            }

            EPStatement           stmt     = epService.EPAdministrator.CreateEPL("select fieldLegacyVal from SupportLegacyBean");
            SupportUpdateListener listener = new SupportUpdateListener();

            stmt.AddListener(listener);

            SupportLegacyBean theEvent = new SupportLegacyBean("E1");

            theEvent.fieldLegacyVal = "val1";
            epService.EPRuntime.SendEvent(theEvent);
            Assert.AreEqual("val1", listener.AssertOneGetNewAndReset().Get("fieldLegacyVal"));

            if (InstrumentationHelper.ENABLED)
            {
                InstrumentationHelper.EndTest();
            }
        }
Пример #4
0
        public void SetUp()
        {
            var mappedProperty = new Dictionary <String, String>();

            mappedProperty["key1"] = "value1";
            mappedProperty["key2"] = "value2";
            _legacyBean            = new SupportLegacyBean("leg", new String[] { "a", "b" }, mappedProperty, "nest");
        }
Пример #5
0
        public void SetUp()
        {
            _bean  = new SupportLegacyBean(new[] { "a", "b" });
            _event = SupportEventBeanFactory.CreateObject(_bean);

            _getter            = MakeGetter(0);
            _getterOutOfBounds = MakeGetter(int.MaxValue);
        }
        public void SetUp()
        {
            bean     = new SupportLegacyBean(new string[] { "a", "b" });
            theEvent = SupportEventBeanFactory.CreateObject(supportEventTypeFactory, bean);

            getter            = MakeGetter(0);
            getterOutOfBounds = MakeGetter(Int32.MaxValue);
        }
Пример #7
0
        public void SetUp()
        {
            IDictionary <string, string> mappedProperty = new Dictionary <string, string>();

            mappedProperty.Put("key1", "value1");
            mappedProperty.Put("key2", "value2");
            _legacyBean = new SupportLegacyBean("leg", new string[] { "a", "b" }, mappedProperty, "nest");
        }
        public void Run(RegressionEnvironment env)
        {
            env.CompileDeploy("@Name('s0') select fieldLegacyVal from SupportLegacyBean").AddListener("s0");

            var theEvent = new SupportLegacyBean("E1");
            theEvent.fieldLegacyVal = "val1";
            env.SendEventBean(theEvent);
            Assert.AreEqual("val1", env.Listener("s0").AssertOneGetNewAndReset().Get("fieldLegacyVal"));

            env.UndeployAll();
        }
        public override void Run(EPServiceProvider epService)
        {
            EPStatement stmt     = epService.EPAdministrator.CreateEPL("select fieldLegacyVal from SupportLegacyBean");
            var         listener = new SupportUpdateListener();

            stmt.Events += listener.Update;

            var theEvent = new SupportLegacyBean("E1");

            theEvent.fieldLegacyVal = "val1";
            epService.EPRuntime.SendEvent(theEvent);
            Assert.AreEqual("val1", listener.AssertOneGetNewAndReset().Get("fieldLegacyVal"));
        }
Пример #10
0
        public void SetUp()
        {
            SupportLegacyBean testEvent = new SupportLegacyBean("a");

            unitTestBean = SupportEventBeanFactory.CreateObject(testEvent);
        }
        public override void Run(EPServiceProvider epService)
        {
            var legacyDef = new ConfigurationEventTypeLegacy();

            legacyDef.AccessorStyle  = AccessorStyleEnum.PUBLIC;
            legacyDef.CodeGeneration = _codegen ? CodeGenerationEnum.ENABLED : CodeGenerationEnum.DISABLED;
            legacyDef.AddFieldProperty("explicitFSimple", "fieldLegacyVal");
            legacyDef.AddFieldProperty("explicitFIndexed", "fieldStringArray");
            legacyDef.AddFieldProperty("explicitFNested", "fieldNested");
            legacyDef.AddMethodProperty("explicitMSimple", "ReadLegacyBeanVal");
            legacyDef.AddMethodProperty("explicitMArray", "ReadStringArray");
            legacyDef.AddMethodProperty("explicitMIndexed", "ReadStringIndexed");
            legacyDef.AddMethodProperty("explicitMMapped", "ReadMapByKey");
            epService.EPAdministrator.Configuration.AddEventType <SupportLegacyBean>("MyLegacyEvent", legacyDef);

            legacyDef = new ConfigurationEventTypeLegacy();
            legacyDef.AccessorStyle  = AccessorStyleEnum.PUBLIC;
            legacyDef.CodeGeneration = CodeGenerationEnum.DISABLED;
            epService.EPAdministrator.Configuration.AddEventType <SupportLegacyBean.LegacyNested>("MyLegacyNestedEvent", legacyDef);

            // assert type metadata
            EventTypeSPI type = (EventTypeSPI)((EPServiceProviderSPI)epService).EventAdapterService.GetEventTypeByName("MyLegacyEvent");

            Assert.AreEqual(ApplicationType.CLASS, type.Metadata.OptionalApplicationType);
            Assert.AreEqual(1, type.Metadata.OptionalSecondaryNames.Count);
            Assert.AreEqual(typeof(SupportLegacyBean).Name, type.Metadata.OptionalSecondaryNames.First());
            Assert.AreEqual("MyLegacyEvent", type.Metadata.PrimaryName);
            Assert.AreEqual("MyLegacyEvent", type.Metadata.PublicName);
            Assert.AreEqual(TypeClass.APPLICATION, type.Metadata.TypeClass);
            Assert.AreEqual(true, type.Metadata.IsApplicationConfigured);
            Assert.AreEqual(false, type.Metadata.IsApplicationPreConfigured);
            Assert.AreEqual(false, type.Metadata.IsApplicationPreConfiguredStatic);

            string statementText = "select " +
                                   "fieldLegacyVal as fieldSimple," +
                                   "fieldStringArray as fieldArr," +
                                   "fieldStringArray[1] as fieldArrIndexed," +
                                   "fieldMapped as fieldMap," +
                                   "fieldNested as fieldNested," +
                                   "fieldNested.ReadNestedValue as fieldNestedVal," +
                                   "ReadLegacyBeanVal as simple," +
                                   "ReadLegacyNested as nestedObject," +
                                   "ReadLegacyNested.ReadNestedValue as nested," +
                                   "ReadStringArray[0] as array," +
                                   "ReadStringIndexed[1] as indexed," +
                                   "ReadMapByKey('key1') as mapped," +
                                   "ReadMap as mapItself," +
                                   "explicitFSimple, " +
                                   "explicitFIndexed[0], " +
                                   "explicitFNested, " +
                                   "explicitMSimple, " +
                                   "explicitMArray[0], " +
                                   "explicitMIndexed[1], " +
                                   "explicitMMapped('key2')" +
                                   " from MyLegacyEvent#length(5)";

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

            statement.Events += listener.Update;

            EventType eventType = statement.EventType;

            Assert.AreEqual(typeof(string), eventType.GetPropertyType("fieldSimple"));
            Assert.AreEqual(typeof(string[]), eventType.GetPropertyType("fieldArr"));
            Assert.AreEqual(typeof(string), eventType.GetPropertyType("fieldArrIndexed"));
            Assert.AreEqual(typeof(IDictionary <string, string>), eventType.GetPropertyType("fieldMap"));
            Assert.AreEqual(typeof(SupportLegacyBean.LegacyNested), eventType.GetPropertyType("fieldNested"));
            Assert.AreEqual(typeof(string), eventType.GetPropertyType("fieldNestedVal"));
            Assert.AreEqual(typeof(string), eventType.GetPropertyType("simple"));
            Assert.AreEqual(typeof(SupportLegacyBean.LegacyNested), eventType.GetPropertyType("nestedObject"));
            Assert.AreEqual(typeof(string), eventType.GetPropertyType("nested"));
            Assert.AreEqual(typeof(string), eventType.GetPropertyType("array"));
            Assert.AreEqual(typeof(string), eventType.GetPropertyType("indexed"));
            Assert.AreEqual(typeof(string), eventType.GetPropertyType("mapped"));
            Assert.AreEqual(typeof(string), eventType.GetPropertyType("explicitFSimple"));
            Assert.AreEqual(typeof(string), eventType.GetPropertyType("explicitFIndexed[0]"));
            Assert.AreEqual(typeof(SupportLegacyBean.LegacyNested), eventType.GetPropertyType("explicitFNested"));
            Assert.AreEqual(typeof(string), eventType.GetPropertyType("explicitMSimple"));
            Assert.AreEqual(typeof(string), eventType.GetPropertyType("explicitMArray[0]"));
            Assert.AreEqual(typeof(string), eventType.GetPropertyType("explicitMIndexed[1]"));
            Assert.AreEqual(typeof(string), eventType.GetPropertyType("explicitMMapped('key2')"));

            SupportLegacyBean legacyBean = MakeSampleEvent();

            epService.EPRuntime.SendEvent(legacyBean);

            Assert.AreEqual(legacyBean.fieldLegacyVal, listener.LastNewData[0].Get("fieldSimple"));
            Assert.AreEqual(legacyBean.fieldStringArray, listener.LastNewData[0].Get("fieldArr"));
            Assert.AreEqual(legacyBean.fieldStringArray[1], listener.LastNewData[0].Get("fieldArrIndexed"));
            Assert.AreEqual(legacyBean.fieldMapped, listener.LastNewData[0].Get("fieldMap"));
            Assert.AreEqual(legacyBean.fieldNested, listener.LastNewData[0].Get("fieldNested"));
            Assert.AreEqual(legacyBean.fieldNested.ReadNestedValue(), listener.LastNewData[0].Get("fieldNestedVal"));

            Assert.AreEqual(legacyBean.ReadLegacyBeanVal(), listener.LastNewData[0].Get("simple"));
            Assert.AreEqual(legacyBean.ReadLegacyNested(), listener.LastNewData[0].Get("nestedObject"));
            Assert.AreEqual(legacyBean.ReadLegacyNested().ReadNestedValue(), listener.LastNewData[0].Get("nested"));
            Assert.AreEqual(legacyBean.ReadStringIndexed(0), listener.LastNewData[0].Get("array"));
            Assert.AreEqual(legacyBean.ReadStringIndexed(1), listener.LastNewData[0].Get("indexed"));
            Assert.AreEqual(legacyBean.ReadMapByKey("key1"), listener.LastNewData[0].Get("mapped"));
            Assert.AreEqual(legacyBean.ReadMap(), listener.LastNewData[0].Get("mapItself"));

            Assert.AreEqual(legacyBean.ReadLegacyBeanVal(), listener.LastNewData[0].Get("explicitFSimple"));
            Assert.AreEqual(legacyBean.ReadLegacyBeanVal(), listener.LastNewData[0].Get("explicitMSimple"));
            Assert.AreEqual(legacyBean.ReadLegacyNested(), listener.LastNewData[0].Get("explicitFNested"));
            Assert.AreEqual(legacyBean.ReadStringIndexed(0), listener.LastNewData[0].Get("explicitFIndexed[0]"));
            Assert.AreEqual(legacyBean.ReadStringIndexed(0), listener.LastNewData[0].Get("explicitMArray[0]"));
            Assert.AreEqual(legacyBean.ReadStringIndexed(1), listener.LastNewData[0].Get("explicitMIndexed[1]"));
            Assert.AreEqual(legacyBean.ReadMapByKey("key2"), listener.LastNewData[0].Get("explicitMMapped('key2')"));

            EventTypeSPI stmtType = (EventTypeSPI)statement.EventType;

            Assert.AreEqual(ApplicationType.MAP, stmtType.Metadata.OptionalApplicationType);
            Assert.AreEqual(null, stmtType.Metadata.OptionalSecondaryNames);
            Assert.IsNotNull(stmtType.Metadata.PrimaryName);
            Assert.IsNotNull(stmtType.Metadata.PublicName);
            Assert.IsNotNull(stmtType.Name);
            Assert.AreEqual(TypeClass.ANONYMOUS, stmtType.Metadata.TypeClass);
            Assert.AreEqual(false, stmtType.Metadata.IsApplicationConfigured);
            Assert.AreEqual(false, stmtType.Metadata.IsApplicationPreConfigured);
            Assert.AreEqual(false, stmtType.Metadata.IsApplicationPreConfiguredStatic);
        }