コード例 #1
0
        public void Map(TypeNameRegistry typeNameRegistry)
        {
            foreach (var actionType in actionTypes.Values)
            {
                typeNameRegistry.Map(actionType.Type, actionType.Type.Name);
            }

            var eventTypes = typeof(EnrichedEvent).Assembly.GetTypes().Where(x => typeof(EnrichedEvent).IsAssignableFrom(x) && !x.IsAbstract);

            var addedTypes = new HashSet <Type>();

            foreach (var type in eventTypes)
            {
                if (addedTypes.Add(type))
                {
                    typeNameRegistry.Map(type, type.Name);
                }
            }

            var triggerTypes = typeof(RuleTrigger).Assembly.GetTypes().Where(x => typeof(RuleTrigger).IsAssignableFrom(x) && !x.IsAbstract);

            foreach (var type in triggerTypes)
            {
                if (addedTypes.Add(type))
                {
                    typeNameRegistry.Map(type, type.Name);
                }
            }
        }
コード例 #2
0
ファイル: RuleRegistry.cs プロジェクト: yashodhank/squidex
        public static TypeNameRegistry MapRules(this TypeNameRegistry typeNameRegistry)
        {
            var eventTypes = typeof(EnrichedEvent).Assembly.GetTypes().Where(x => typeof(EnrichedEvent).IsAssignableFrom(x) && !x.IsAbstract);

            var addedTypes = new HashSet <Type>();

            foreach (var type in eventTypes)
            {
                if (addedTypes.Add(type))
                {
                    typeNameRegistry.Map(type, type.Name);
                }
            }

            var triggerTypes = typeof(RuleTrigger).Assembly.GetTypes().Where(x => typeof(RuleTrigger).IsAssignableFrom(x) && !x.IsAbstract);

            foreach (var type in triggerTypes)
            {
                if (addedTypes.Add(type))
                {
                    typeNameRegistry.Map(type, type.Name);
                }
            }

            return(typeNameRegistry);
        }
コード例 #3
0
        public DefaultEventDataFormatterTests()
        {
            serializerSettings.Converters.Add(new PropertiesBagConverter <EnvelopeHeaders>());

            typeNameRegistry.Map(typeof(MyEvent), "Event");
            typeNameRegistry.Map(typeof(MyOldEvent), "OldEvent");

            sut = new DefaultEventDataFormatter(typeNameRegistry, JsonSerializer.Create(serializerSettings));
        }
コード例 #4
0
ファイル: Serializers.cs プロジェクト: hathanhhung/squidex
        static Serializers()
        {
            TypeNameRegistry.Map(typeof(SquidexEvent).GetTypeInfo().Assembly);
            TypeNameRegistry.Map(typeof(NoopEvent).GetTypeInfo().Assembly);

            ConfigureJson(SerializerSettings, TypeNameHandling.Auto);

            JsonConvert.DefaultSettings = () => SerializerSettings;
        }
コード例 #5
0
        public EventDataFormatterTests()
        {
            serializerSettings.Converters.Add(new PropertiesBagConverter());

            typeNameRegistry.Map(typeof(MyEvent), "Event");
            typeNameRegistry.Map(typeof(MyOldEvent), "OldEvent");

            sut = new EventDataFormatter(typeNameRegistry, serializerSettings);
        }
コード例 #6
0
        public RuleServiceTests()
        {
            typeNameRegistry.Map(typeof(ContentCreated));
            typeNameRegistry.Map(typeof(WebhookAction));

            A.CallTo(() => ruleActionHandler.ActionType)
            .Returns(typeof(WebhookAction));

            A.CallTo(() => ruleTriggerHandler.TriggerType)
            .Returns(typeof(ContentChangedTrigger));

            sut = new RuleService(new[] { ruleTriggerHandler }, new[] { ruleActionHandler }, clock, typeNameRegistry);
        }
コード例 #7
0
 public static void RegisterTypes(TypeNameRegistry typeNameRegistry)
 {
     foreach (var actionType in ActionTypes.Values)
     {
         typeNameRegistry.Map(actionType.Type, actionType.Type.Name);
     }
 }
コード例 #8
0
ファイル: FieldRegistry.cs プロジェクト: kikkoi/squidex
 private void RegisterField(Type type)
 {
     if (supportedFields.Add(type))
     {
         typeNameRegistry.Map(type);
     }
 }
コード例 #9
0
        public RuleServiceTests()
        {
            typeNameRegistry.Map(typeof(ContentCreated));
            typeNameRegistry.Map(typeof(WebhookAction));

            A.CallTo(() => eventEnricher.EnrichAsync(A <Envelope <AppEvent> > .Ignored))
            .Returns(new EnrichedContentEvent());

            A.CallTo(() => ruleActionHandler.ActionType)
            .Returns(typeof(WebhookAction));

            A.CallTo(() => ruleTriggerHandler.TriggerType)
            .Returns(typeof(ContentChangedTrigger));

            sut = new RuleService(new[] { ruleTriggerHandler }, new[] { ruleActionHandler }, eventEnricher, clock, typeNameRegistry);
        }
コード例 #10
0
        private static TypeNameRegistry CreateTypeNameRegistry()
        {
            var result = new TypeNameRegistry();

            result.Map(typeof(MyEvent));

            return(result);
        }
コード例 #11
0
        public ActorRemoteTests()
        {
            registry.Map(typeof(SuccessMessage));

            actors = new RemoteActors(new DefaultRemoteActorChannel(new InMemoryPubSub(), registry));
            actors.Connect("my", actor);

            remoteActor = actors.Get("my");
        }
コード例 #12
0
        public BackupReaderWriterTests()
        {
            typeNameRegistry.Map(typeof(MyEvent));

            formatter = new DefaultEventDataFormatter(typeNameRegistry, serializer);

            A.CallTo(() => streamNameResolver.WithNewId(A <string> ._, A <Func <string, string> > ._))
            .ReturnsLazily(new Func <string, Func <string, string>, string>((stream, idGenerator) => stream + "^2"));
        }
コード例 #13
0
        public static TypeNameRegistry MapRuleActions(this TypeNameRegistry typeNameRegistry)
        {
            foreach (var actionType in ActionTypes.Values)
            {
                typeNameRegistry.Map(actionType.Type, actionType.Type.Name);
            }

            return(typeNameRegistry);
        }
コード例 #14
0
        public RuleServiceTests()
        {
            typeNameRegistry.Map(typeof(ContentCreated));
            typeNameRegistry.Map(typeof(ValidAction), actionName);

            A.CallTo(() => clock.GetCurrentInstant())
            .Returns(SystemClock.Instance.GetCurrentInstant().WithoutMs());

            A.CallTo(() => ruleActionHandler.ActionType)
            .Returns(typeof(ValidAction));

            A.CallTo(() => ruleActionHandler.DataType)
            .Returns(typeof(ValidData));

            A.CallTo(() => ruleTriggerHandler.TriggerType)
            .Returns(typeof(ContentChangedTriggerV2));

            sut = new RuleService(new[] { ruleTriggerHandler }, new[] { ruleActionHandler }, eventEnricher, TestUtils.DefaultSerializer, clock, typeNameRegistry);
        }
コード例 #15
0
        private void Add <TFieldProperties>(FactoryFunction fieldFactory)
        {
            Guard.NotNull(fieldFactory, nameof(fieldFactory));

            typeNameRegistry.Map(typeof(TFieldProperties));

            var registered = new Registered(fieldFactory, typeof(TFieldProperties));

            fieldsByPropertyType[registered.PropertiesType] = registered;
        }
コード例 #16
0
        public WebhookEnqueuerTests()
        {
            A.CallTo(() => clock.GetCurrentInstant()).Returns(now);

            typeNameRegisty.Map(typeof(ContentCreated));

            sut = new WebhookEnqueuer(
                typeNameRegisty,
                webhookEventRepository,
                webhookRepository,
                clock, new JsonSerializer());
        }
コード例 #17
0
ファイル: FieldTypeProvider.cs プロジェクト: jrlost/squidex
        public void Map(TypeNameRegistry typeNameRegistry)
        {
            var types = typeof(FieldTypeProvider).Assembly.GetTypes().Where(x => typeof(FieldProperties).IsAssignableFrom(x) && !x.IsAbstract);

            var addedTypes = new HashSet <Type>();

            foreach (var type in types)
            {
                if (addedTypes.Add(type))
                {
                    typeNameRegistry.Map(type, type.TypeName(false, Suffix));
                    typeNameRegistry.MapObsolete(type, type.TypeName(false, SuffixOld));
                }
            }
        }
コード例 #18
0
        public static void Setup(TypeNameRegistry typeNameRegistry)
        {
            Guard.NotNull(typeNameRegistry, nameof(typeNameRegistry));

            var types = typeof(FieldRegistry).Assembly.GetTypes().Where(x => x.BaseType == typeof(FieldProperties));

            var supportedFields = new HashSet <Type>();

            foreach (var type in types)
            {
                if (supportedFields.Add(type))
                {
                    typeNameRegistry.Map(type);
                }
            }

            typeNameRegistry.MapObsolete(typeof(ReferencesFieldProperties), "References");
            typeNameRegistry.MapObsolete(typeof(DateTimeFieldProperties), "DateTime");
        }
コード例 #19
0
        public RecursiveDeleterTests()
        {
            typeNameRegistry.Map(typeof(AssetFolderDeleted));

            sut = new RecursiveDeleter(commandBus, assetRepository, assetFolderRepository, typeNameRegistry, log);
        }
コード例 #20
0
ファイル: Serializers.cs プロジェクト: florimm/squidex
 static Serializers()
 {
     TypeNameRegistry.Map(typeof(SquidexEvent).GetTypeInfo().Assembly);
     TypeNameRegistry.Map(typeof(NoopEvent).GetTypeInfo().Assembly);
 }
コード例 #21
0
        private void RegisterField <T>()
        {
            typeNameRegistry.Map(typeof(T));

            fieldsByPropertyType[typeof(T)] = (id, name, partitioning, properties) => properties.CreateField(id, name, partitioning);
        }
コード例 #22
0
        public EventStoreFormatterTests()
        {
            serializerSettings.Converters.Add(new PropertiesBagConverter());

            typeNameRegistry.Map(typeof(MyEvent), "Event");
        }
コード例 #23
0
        public BackupReaderWriterTests()
        {
            typeNameRegistry.Map(typeof(MyEvent));

            formatter = new DefaultEventDataFormatter(typeNameRegistry, serializer);
        }