Exemplo n.º 1
0
        public void SetUp()
        {
            _eventService = SupportEventAdapterService.Service;
            EventType underlyingEventTypeSimple   = _eventService.AddBeanType("UnderlyingSimpleBean", typeof(SupportBeanSimple), true, true, true);
            EventType underlyingEventTypeCombined = _eventService.AddBeanType("UnderlyingCombinedBean", typeof(SupportBeanCombinedProps), true, true, true);

            IDictionary <String, Object> typeMap = new Dictionary <String, Object>();

            typeMap["string"] = typeof(string);
            typeMap["int"]    = typeof(int);

            EventTypeMetadata meta = EventTypeMetadata.CreateWrapper("test", true, false, false);

            _eventTypeSimple      = new WrapperEventType(meta, "mytype", 1, underlyingEventTypeSimple, typeMap, _eventService);
            _eventTypeCombined    = new WrapperEventType(meta, "mytype", 1, underlyingEventTypeCombined, typeMap, _eventService);
            _properties           = new Dictionary <String, Object>();
            _properties["string"] = "xx";
            _properties["int"]    = 11;

            EventBean wrappedSimple = _eventService.AdapterForObject(new SupportBeanSimple("EventString", 0));

            _eventBeanSimple = _eventService.AdapterForTypedWrapper(wrappedSimple, _properties, _eventTypeSimple);

            EventBean wrappedCombined = _eventService.AdapterForObject(SupportBeanCombinedProps.MakeDefaultBean());

            _eventBeanCombined = _eventService.AdapterForTypedWrapper(wrappedCombined, _properties, _eventTypeCombined);
        }
Exemplo n.º 2
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);
            }
        }
 /// <summary>
 /// Ctor.
 /// </summary>
 /// <param name="eventAdapterService">for dynamic event type creation</param>
 /// <param name="metadata">event type metadata</param>
 /// <param name="eventTypeId">The event type id.</param>
 /// <param name="underlyngType">is the underlying type returned by the event type</param>
 protected BaseConfigurableEventType(EventAdapterService eventAdapterService, EventTypeMetadata metadata, int eventTypeId, Type underlyngType)
 {
     _iLock               = LockManager.CreateLock(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
     _eventTypeId         = eventTypeId;
     _eventAdapterService = eventAdapterService;
     _metadata            = metadata;
     _underlyngType       = underlyngType;
 }
Exemplo n.º 4
0
        public void SetUp()
        {
            _underlyingEventTypeOne         = new BeanEventType(null, 1, typeof(SupportBeanSimple), SupportEventAdapterService.Service, null);
            _underlyingEventTypeTwo         = new BeanEventType(null, 1, typeof(SupportBean_A), SupportEventAdapterService.Service, null);
            _properties                     = new Dictionary <String, Object>();
            _properties["additionalString"] = typeof(string);
            _properties["AdditionalInt"]    = typeof(int);
            _eventAdapterService            = SupportEventAdapterService.Service;
            EventTypeMetadata meta = EventTypeMetadata.CreateWrapper("test", true, false, false);

            _eventType = new WrapperEventType(meta, "mytype", 1, _underlyingEventTypeOne, _properties, _eventAdapterService);
        }
Exemplo n.º 5
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);
        }
Exemplo n.º 6
0
        public void TestEquals()
        {
            IDictionary <String, Object> otherProperties = new Dictionary <String, Object>(_properties);
            EventTypeMetadata            meta            = EventTypeMetadata.CreateWrapper("test", true, false, false);
            EventTypeSPI otherType = new WrapperEventType(meta, "mytype", 1, _underlyingEventTypeOne, otherProperties, _eventAdapterService);

            Assert.IsTrue(_eventType.EqualsCompareType(otherType));
            Assert.IsTrue(otherType.EqualsCompareType(_eventType));

            otherType = new WrapperEventType(meta, "mytype", 1, _underlyingEventTypeTwo, otherProperties, _eventAdapterService);
            Assert.IsFalse(_eventType.EqualsCompareType(otherType));
            Assert.IsFalse(otherType.EqualsCompareType(_eventType));

            otherProperties["anotherProperty"] = typeof(int);
            otherType = new WrapperEventType(meta, "mytype", 1, _underlyingEventTypeOne, otherProperties, _eventAdapterService);
            Assert.IsFalse(_eventType.EqualsCompareType(otherType));
            Assert.IsFalse(otherType.EqualsCompareType(_eventType));

            otherType = (EventTypeSPI)_underlyingEventTypeOne;
            Assert.IsFalse(_eventType.EqualsCompareType(otherType));
            Assert.IsFalse(otherType.EqualsCompareType(_eventType));
        }
Exemplo n.º 7
0
        /// <summary>
        /// Constructor takes a type name, map of property names and types, for use with nestable Map events.
        /// </summary>
        /// <param name="metadata">event type metadata</param>
        /// <param name="typeName">is the event type name used to distinquish map types that have the same property types,empty string for anonymous maps, or for insert-into statements generating map events the stream name</param>
        /// <param name="eventTypeId">The event type id.</param>
        /// <param name="eventAdapterService">is required for access to objects properties within map values</param>
        /// <param name="propertyTypes">is pairs of property name and type</param>
        /// <param name="optionalSuperTypes">the supertypes to this type if any, or null if there are no supertypes</param>
        /// <param name="optionalDeepSupertypes">the deep supertypes to this type if any, or null if there are no deep supertypes</param>
        /// <param name="typeConfig">The type config.</param>
        /// <param name="getterFactory">The getter factory.</param>
        protected BaseNestableEventType(
            EventTypeMetadata metadata,
            String typeName,
            int eventTypeId,
            EventAdapterService eventAdapterService,
            IDictionary <String, Object> propertyTypes,
            EventType[] optionalSuperTypes,
            ICollection <EventType> optionalDeepSupertypes,
            ConfigurationEventTypeWithSupertype typeConfig,
            EventTypeNestableGetterFactory getterFactory)
        {
            _metadata           = metadata;
            _eventTypeId        = eventTypeId;
            _typeName           = typeName;
            EventAdapterService = eventAdapterService;
            GetterFactory       = getterFactory;

            _optionalSuperTypes     = optionalSuperTypes;
            _optionalDeepSupertypes = optionalDeepSupertypes ?? Collections.GetEmptySet <EventType>();

            // determine property set and prepare getters
            var propertySet = EventTypeUtility.GetNestableProperties(
                propertyTypes, eventAdapterService, getterFactory, optionalSuperTypes);

            NestableTypes        = propertySet.NestableTypes;
            _propertyNames       = propertySet.PropertyNameArray;
            _propertyItems       = propertySet.PropertyItems;
            _propertyDescriptors = propertySet.PropertyDescriptors.ToArray();

            var desc = EventTypeUtility.ValidatedDetermineTimestampProps(
                this, typeConfig == null ? null : typeConfig.StartTimestampPropertyName,
                typeConfig == null ? null : typeConfig.EndTimestampPropertyName, optionalSuperTypes);

            _startTimestampPropertyName = desc.Start;
            _endTimestampPropertyName   = desc.End;
        }