示例#1
0
        /// <summary>
        /// Ctor.
        /// </summary>
        /// <param name="metadata">event type metadata</param>
        /// <param name="typeName">is the event type name</param>
        /// <param name="eventTypeId">The event type id.</param>
        /// <param name="eventType">is the event type of the wrapped events</param>
        /// <param name="properties">is the additional properties this wrapper adds</param>
        /// <param name="eventAdapterService">is the service for resolving unknown wrapped types</param>
        public WrapperEventType(EventTypeMetadata metadata,
                                String typeName,
                                int eventTypeId,
                                EventType eventType,
                                IDictionary <String, Object> properties,
                                EventAdapterService eventAdapterService)
        {
            CheckForRepeatedPropertyNames(eventType, properties);

            _metadata            = metadata;
            _underlyingEventType = eventType;
            EventTypeMetadata metadataMapType = EventTypeMetadata.CreateAnonymous(typeName);

            _underlyingMapType   = new MapEventType(metadataMapType, typeName, 0, eventAdapterService, properties, null, null, null);
            _isNoMapProperties   = properties.IsEmpty();
            _eventAdapterService = eventAdapterService;
            EventTypeId          = eventTypeId;
            _propertyGetterCache = new Dictionary <String, EventPropertyGetter>();

            UpdatePropertySet();

            if (metadata.TypeClass == TypeClass.NAMED_WINDOW)
            {
                StartTimestampPropertyName = eventType.StartTimestampPropertyName;
                EndTimestampPropertyName   = eventType.EndTimestampPropertyName;
                EventTypeUtility.ValidateTimestampProperties(this, StartTimestampPropertyName, EndTimestampPropertyName);
            }
        }
示例#2
0
        public void TestTypeUpdate()
        {
            IDictionary <String, Object> typeOne = new Dictionary <String, Object>();

            typeOne["field1"] = typeof(string);
            MapEventType      underlying = new MapEventType(EventTypeMetadata.CreateAnonymous("noname", ApplicationType.MAP), "noname", 1, _eventAdapterService, typeOne, null, null, null);
            EventTypeMetadata meta       = EventTypeMetadata.CreateWrapper("test", true, false, false);

            _eventType = new WrapperEventType(meta, "mytype", 1, underlying, _properties, _eventAdapterService);

            EPAssertionUtil.AssertEqualsAnyOrder(new[] { "additionalString", "AdditionalInt", "field1" }, _eventType.PropertyNames);
            underlying.AddAdditionalProperties(Collections.SingletonDataMap("field2", typeof(string)), _eventAdapterService);
            EPAssertionUtil.AssertEqualsAnyOrder(new[] { "additionalString", "AdditionalInt", "field1", "field2" }, _eventType.PropertyNames);
            Assert.AreEqual(4, _eventType.PropertyDescriptors.Count);
            Assert.AreEqual(typeof(string), _eventType.GetPropertyDescriptor("field2").PropertyType);
        }