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); } } }
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); }
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)); }
static Serializers() { TypeNameRegistry.Map(typeof(SquidexEvent).GetTypeInfo().Assembly); TypeNameRegistry.Map(typeof(NoopEvent).GetTypeInfo().Assembly); ConfigureJson(SerializerSettings, TypeNameHandling.Auto); JsonConvert.DefaultSettings = () => SerializerSettings; }
public EventDataFormatterTests() { serializerSettings.Converters.Add(new PropertiesBagConverter()); typeNameRegistry.Map(typeof(MyEvent), "Event"); typeNameRegistry.Map(typeof(MyOldEvent), "OldEvent"); sut = new EventDataFormatter(typeNameRegistry, serializerSettings); }
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); }
public static void RegisterTypes(TypeNameRegistry typeNameRegistry) { foreach (var actionType in ActionTypes.Values) { typeNameRegistry.Map(actionType.Type, actionType.Type.Name); } }
private void RegisterField(Type type) { if (supportedFields.Add(type)) { typeNameRegistry.Map(type); } }
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); }
private static TypeNameRegistry CreateTypeNameRegistry() { var result = new TypeNameRegistry(); result.Map(typeof(MyEvent)); return(result); }
public ActorRemoteTests() { registry.Map(typeof(SuccessMessage)); actors = new RemoteActors(new DefaultRemoteActorChannel(new InMemoryPubSub(), registry)); actors.Connect("my", actor); remoteActor = actors.Get("my"); }
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")); }
public static TypeNameRegistry MapRuleActions(this TypeNameRegistry typeNameRegistry) { foreach (var actionType in ActionTypes.Values) { typeNameRegistry.Map(actionType.Type, actionType.Type.Name); } return(typeNameRegistry); }
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); }
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; }
public WebhookEnqueuerTests() { A.CallTo(() => clock.GetCurrentInstant()).Returns(now); typeNameRegisty.Map(typeof(ContentCreated)); sut = new WebhookEnqueuer( typeNameRegisty, webhookEventRepository, webhookRepository, clock, new JsonSerializer()); }
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)); } } }
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"); }
public RecursiveDeleterTests() { typeNameRegistry.Map(typeof(AssetFolderDeleted)); sut = new RecursiveDeleter(commandBus, assetRepository, assetFolderRepository, typeNameRegistry, log); }
static Serializers() { TypeNameRegistry.Map(typeof(SquidexEvent).GetTypeInfo().Assembly); TypeNameRegistry.Map(typeof(NoopEvent).GetTypeInfo().Assembly); }
private void RegisterField <T>() { typeNameRegistry.Map(typeof(T)); fieldsByPropertyType[typeof(T)] = (id, name, partitioning, properties) => properties.CreateField(id, name, partitioning); }
public EventStoreFormatterTests() { serializerSettings.Converters.Add(new PropertiesBagConverter()); typeNameRegistry.Map(typeof(MyEvent), "Event"); }
public BackupReaderWriterTests() { typeNameRegistry.Map(typeof(MyEvent)); formatter = new DefaultEventDataFormatter(typeNameRegistry, serializer); }