Example #1
0
        public void TestCaseInsensitive()
        {
            Configuration configuration = SupportConfigFactory.GetConfiguration();

            configuration.EngineDefaults.EventMetaConfig.ClassPropertyResolutionStyle =
                PropertyResolutionStyle.CASE_INSENSITIVE;
            _epService = EPServiceProviderManager.GetDefaultProvider(configuration);
            _epService.Initialize();
            if (InstrumentationHelper.ENABLED)
            {
                InstrumentationHelper.StartTest(_epService, GetType(), GetType().FullName);
            }

            EPStatement stmt = _epService.EPAdministrator.CreateEPL(
                "select MYPROPERTY, myproperty, myProperty, MyProperty from "
                + typeof(SupportBeanDupProperty).FullName);
            SupportUpdateListener listener = new SupportUpdateListener();

            stmt.Events += listener.Update;

            var uevent = new SupportBeanDupProperty("lowercamel", "uppercamel", "upper", "lower");

            _epService.EPRuntime.SendEvent(uevent);

            EventBean result = listener.AssertOneGetNewAndReset();

            Assert.AreEqual(result.EventType.PropertyNames.Length, 4);
            Assert.AreEqual(result.Get("MYPROPERTY"), "upper");
            Assert.AreEqual(result.Get("MyProperty"), "uppercamel");
            Assert.AreEqual(result.Get("myProperty"), "lowercamel");
            Assert.AreEqual(result.Get("myproperty"), "lower");


            stmt = _epService.EPAdministrator.CreateEPL(
                "select " + "NESTED.NESTEDVALUE as val1, "
                + "ARRAYPROPERTY[0] as val2, " + "MAPPED('keyOne') as val3, "
                + "INDEXED[0] as val4 " + " from "
                + typeof(SupportBeanComplexProps).FullName);
            stmt.Events += listener.Update;
            _epService.EPRuntime.SendEvent(
                SupportBeanComplexProps.MakeDefaultBean());
            EventBean theEvent = listener.AssertOneGetNewAndReset();

            Assert.AreEqual("NestedValue", theEvent.Get("val1"));
            Assert.AreEqual(10, theEvent.Get("val2"));
            Assert.AreEqual("valueOne", theEvent.Get("val3"));
            Assert.AreEqual(1, theEvent.Get("val4"));

            if (InstrumentationHelper.ENABLED)
            {
                InstrumentationHelper.EndTest();
            }
        }
Example #2
0
        public void TestCaseSensitive()
        {
            Configuration configuration = SupportConfigFactory.GetConfiguration();

            configuration.EngineDefaults.EventMetaConfig.ClassPropertyResolutionStyle =
                PropertyResolutionStyle.CASE_SENSITIVE;

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

            var stmt     = _epService.EPAdministrator.CreateEPL("select MYPROPERTY, myproperty, myProperty from " + typeof(SupportBeanDupProperty).FullName);
            var listener = new SupportUpdateListener();

            stmt.Events += listener.Update;

            var uevent = new SupportBeanDupProperty("lowercamel", "uppercamel", "upper", "lower");

            _epService.EPRuntime.SendEvent(uevent);
            EventBean result = listener.AssertOneGetNewAndReset();

            Assert.AreEqual(uevent.MYPROPERTY, result.Get("MYPROPERTY"));
            Assert.AreEqual(uevent.myproperty, result.Get("myproperty"));
            Assert.AreEqual(uevent.myProperty, result.Get("myProperty"));

            try {
                _epService.EPAdministrator.CreateEPL(
                    "select MyProPerty from " + typeof(SupportBeanDupProperty).FullName);
                Assert.Fail();
            } catch (EPException ex) {// expected
            }

            if (InstrumentationHelper.ENABLED)
            {
                InstrumentationHelper.EndTest();
            }
        }