コード例 #1
0
        public void TestInvalid()
        {
            try
            {
                var configuration = SupportConfigFactory.GetConfiguration();
                configuration.AddEventType("MyInvalidEvent", new String[] { "p00" }, new Object[] { typeof(int), typeof(String) });
                Assert.Fail();
            }
            catch (ConfigurationException ex)
            {
                Assert.AreEqual("Number of property names and property types do not match, found 1 property names and 2 property types", ex.Message);
            }

            TryInvalid("select XXX from MyObjectArrayEvent.win:length(5)");
            TryInvalid("select myString * 2 from MyObjectArrayEvent.win:length(5)");
            TryInvalid("select String.Trim(myInt) from MyObjectArrayEvent.win:length(5)");

            var invalidOAConfig = new ConfigurationEventTypeObjectArray();

            invalidOAConfig.SuperTypes = new HashSet <String>()
            {
                "A", "B"
            };
            var invalidOANames = new String[] { "p00" };
            var invalidOATypes = new Object[] { typeof(int) };

            try
            {
                var configuration = SupportConfigFactory.GetConfiguration();
                configuration.AddEventType("MyInvalidEventTwo", invalidOANames, invalidOATypes, invalidOAConfig);
                Assert.Fail();
            }
            catch (ConfigurationException ex)
            {
                Assert.AreEqual("Object-array event types only allow a single supertype", ex.Message);
            }

            try {
                _epService.EPAdministrator.Configuration.AddEventType("MyInvalidOA", invalidOANames, invalidOATypes, invalidOAConfig);
                Assert.Fail();
            }
            catch (ConfigurationException ex)
            {
                Assert.AreEqual("Object-array event types only allow a single supertype", ex.Message);
            }

            try {
                _epService.EPAdministrator.CreateEPL("create objectarray schema InvalidOA () inherits A, B");
                Assert.Fail();
            }
            catch (EPStatementException ex) {
                Assert.AreEqual("Error starting statement: Object-array event types only allow a single supertype [create objectarray schema InvalidOA () inherits A, B]", ex.Message);
            }
        }
コード例 #2
0
        private void RunAssertionInvalid(EPServiceProvider epService)
        {
            try {
                Configuration configuration = SupportConfigFactory.GetConfiguration();
                configuration.AddEventType("MyInvalidEvent", new[] { "p00" }, new object[] { typeof(int), typeof(string) });
                Assert.Fail();
            } catch (ConfigurationException ex) {
                Assert.AreEqual("Number of property names and property types do not match, found 1 property names and 2 property types", ex.Message);
            }

            TryInvalid(epService, "select XXX from MyObjectArrayEvent#length(5)");
            TryInvalid(epService, "select myString * 2 from MyObjectArrayEvent#length(5)");
            TryInvalid(epService, "select String.Trim(myInt) from MyObjectArrayEvent#length(5)");

            var invalidOAConfig = new ConfigurationEventTypeObjectArray();

            invalidOAConfig.SuperTypes = new HashSet <string>(Collections.List("A", "B"));
            var invalidOANames = new[] { "p00" };
            var invalidOATypes = new object[] { typeof(int) };

            try {
                Configuration configuration = SupportConfigFactory.GetConfiguration();
                configuration.AddEventType("MyInvalidEventTwo", invalidOANames, invalidOATypes, invalidOAConfig);
                Assert.Fail();
            } catch (ConfigurationException ex) {
                Assert.AreEqual("Object-array event types only allow a single supertype", ex.Message);
            }

            try {
                epService.EPAdministrator.Configuration.AddEventType("MyInvalidOA", invalidOANames, invalidOATypes, invalidOAConfig);
                Assert.Fail();
            } catch (ConfigurationException ex) {
                Assert.AreEqual("Object-array event types only allow a single supertype", ex.Message);
            }

            try {
                epService.EPAdministrator.CreateEPL("create objectarray schema InvalidOA () inherits A, B");
                Assert.Fail();
            } catch (EPStatementException ex) {
                Assert.AreEqual("Error starting statement: Object-array event types only allow a single supertype [create objectarray schema InvalidOA () inherits A, B]", ex.Message);
            }

            epService.EPAdministrator.DestroyAllStatements();
        }
コード例 #3
0
        private void AddOAEventTypes()
        {
            _epService.EPAdministrator.Configuration.AddEventType("OA_Type_Root", new string[0], new object[0]);

            var array_1 = new ConfigurationEventTypeObjectArray();

            array_1.SuperTypes = Collections.SingletonList("OA_Type_Root");
            _epService.EPAdministrator.Configuration.AddEventType("OA_Type_1", new string[0], new object[0], array_1);

            var array_2 = new ConfigurationEventTypeObjectArray();

            array_2.SuperTypes = Collections.SingletonList("OA_Type_Root");
            _epService.EPAdministrator.Configuration.AddEventType("OA_Type_2", new string[0], new object[0], array_2);

            var array_2_1 = new ConfigurationEventTypeObjectArray();

            array_2_1.SuperTypes = Collections.SingletonList("OA_Type_2");
            _epService.EPAdministrator.Configuration.AddEventType("OA_Type_2_1", new string[0], new object[0], array_2_1);
        }
コード例 #4
0
ファイル: ObjectArrayEventType.cs プロジェクト: ikvm/nesper
 public ObjectArrayEventType(EventTypeMetadata metadata, String eventTypeName, int eventTypeId, EventAdapterService eventAdapterService, IDictionary <String, Object> propertyTypes, ConfigurationEventTypeObjectArray typeDef, EventType[] optionalSuperTypes, ICollection <EventType> optionalDeepSupertypes)
     : base(metadata, eventTypeName, eventTypeId, eventAdapterService, propertyTypes, optionalSuperTypes, optionalDeepSupertypes, typeDef, GetGetterFactory(eventTypeName, propertyTypes, optionalSuperTypes))
 {
 }
コード例 #5
0
        public void AddEventType(String eventTypeName, String[] propertyNames, Object[] propertyTypes, ConfigurationEventTypeObjectArray optionalConfiguration)
        {
            CheckTableExists(eventTypeName);

            try
            {
                LinkedHashMap <String, Object> propertyTypesMap = EventTypeUtility.ValidateObjectArrayDef(propertyNames,
                                                                                                          propertyTypes);
                IDictionary <String, Object> compiledProperties =
                    EventTypeUtility.CompileMapTypeProperties(propertyTypesMap, _eventAdapterService);
                _eventAdapterService.AddNestableObjectArrayType(eventTypeName, compiledProperties, optionalConfiguration,
                                                                false, true, true, false, false, false, null);
            }
            catch (EventAdapterException t)
            {
                throw new ConfigurationException(t.Message, t);
            }
        }