public void Read_CompleteOutbound_MessageTypeSet() { var reader = new ConfigurationReader(_serviceProvider) .Read(ConfigFileHelper.GetConfigSection("outbound.complete")); reader.Outbound.First().MessageType.Should().Be(typeof(IIntegrationEvent)); }
public void Read_CompleteOutbound_ConnectorTypeSet() { var reader = new ConfigurationReader(_serviceProvider) .Read(ConfigFileHelper.GetConfigSection("outbound.complete")); reader.Outbound.Skip(1).First().ConnectorType.Should().Be(typeof(DeferredOutboundConnector)); }
public void Read_CompleteInbound_ErrorPoliciesAdded() { var reader = new ConfigurationReader(_serviceProvider) .Read(ConfigFileHelper.GetConfigSection("inbound.complete")); reader.Inbound.First().ErrorPolicies.Should().HaveCount(2); }
public void ReadAndApply_SimpleOutbound_OutboundAdded() { new ConfigurationReader(_serviceProvider) .Read(ConfigFileHelper.GetConfigSection("outbound.simplest")) .Apply(_builder); _builder.ReceivedWithAnyArgs(1).AddOutbound(null, null, null); }
public void Read_SimpleOutbound_DefaultMessageType() { var reader = new ConfigurationReader(_serviceProvider) .Read(ConfigFileHelper.GetConfigSection("outbound.simplest")); reader.Outbound.First().MessageType.Should().Be(typeof(object)); }
public void Read_SimplestInbound_EndpointAdded() { var reader = new ConfigurationReader(_serviceProvider) .Read(ConfigFileHelper.GetConfigSection("inbound.simplest")); reader.Inbound.Count.Should().Be(2); reader.Inbound.First().Endpoint.Should().NotBeNull(); }
public void Read_CompleteInbound_EndpointNamesSet() { var reader = new ConfigurationReader(_serviceProvider) .Read(ConfigFileHelper.GetConfigSection("inbound.complete")); var endpoint = (KafkaConsumerEndpoint)reader.Inbound.Skip(1).First().Endpoint; endpoint.Names.Should().BeEquivalentTo("inbound-endpoint1", "inbound-endpoint2"); }
public void Read_CompleteInbound_EndpointSubPropertySet() { var reader = new ConfigurationReader(_serviceProvider) .Read(ConfigFileHelper.GetConfigSection("inbound.complete")); var endpoint = (KafkaConsumerEndpoint)reader.Inbound.First().Endpoint; endpoint.Configuration.AutoOffsetReset.Should().Be(AutoOffsetReset.Earliest); }
public void Read_CompleteOutbound_CustomSerializerSet() { var reader = new ConfigurationReader(_serviceProvider) .Read(ConfigFileHelper.GetConfigSection("outbound.complete")); var endpoint = reader.Outbound.First().Endpoint; endpoint.Serializer.Should().BeOfType <FakeSerializer>(); }
public void Read_SimplestInbound_DefaultSerializer() { var reader = new ConfigurationReader(_serviceProvider) .Read(ConfigFileHelper.GetConfigSection("inbound.simplest")); var endpoint = reader.Inbound.First().Endpoint; endpoint.Serializer.Should().NotBeNull(); }
public void Read_SimplestInbound_EndpointNameSet() { var reader = new ConfigurationReader(_serviceProvider) .Read(ConfigFileHelper.GetConfigSection("inbound.simplest")); var endpoint = reader.Inbound.Skip(1).First().Endpoint; endpoint.Name.Should().Be("inbound-endpoint2"); }
public void Read_CompleteInbound_SettingsBatchSet() { var reader = new ConfigurationReader(_serviceProvider) .Read(ConfigFileHelper.GetConfigSection("inbound.complete")); var batchSettings = reader.Inbound.First().Settings.Batch; batchSettings.Should().NotBeNull(); }
public void Read_SimplestOutbound_ChunkSizeSet() { var reader = new ConfigurationReader(_serviceProvider) .Read(ConfigFileHelper.GetConfigSection("outbound.complete")); var endpoint = (KafkaProducerEndpoint)reader.Outbound.First().Endpoint; endpoint.Chunk.Size.Should().Be(100000); }
public void Read_SimplestInbound_CorrectEndpointType() { var reader = new ConfigurationReader(_serviceProvider) .Read(ConfigFileHelper.GetConfigSection("inbound.simplest")); var endpoint = reader.Inbound.First().Endpoint; endpoint.Should().BeOfType <KafkaConsumerEndpoint>(); }
public void Read_CompleteOutbound_CustomSerializerPropertySet() { var reader = new ConfigurationReader(_serviceProvider) .Read(ConfigFileHelper.GetConfigSection("outbound.complete")); var serializer = (FakeSerializer)reader.Outbound.First().Endpoint.Serializer; serializer.Settings.Mode.Should().Be(4); }
public void Read_SimplestOutbound_DefaultChunkSize() { var reader = new ConfigurationReader(_serviceProvider) .Read(ConfigFileHelper.GetConfigSection("outbound.simplest")); var endpoint = (KafkaProducerEndpoint)reader.Outbound.First().Endpoint; endpoint.Chunk.Size.Should().Be(int.MaxValue); }
public void Read_CompleteInbound_SettingsConsumersSet() { var reader = new ConfigurationReader(_serviceProvider) .Read(ConfigFileHelper.GetConfigSection("inbound.complete")); var settings = reader.Inbound.First().Settings; settings.Consumers.Should().Be(3); }
public void Read_CompleteOutbound_EndpointSubPropertySet() { var reader = new ConfigurationReader(_serviceProvider) .Read(ConfigFileHelper.GetConfigSection("outbound.complete")); var endpoint = (KafkaProducerEndpoint)reader.Outbound.First().Endpoint; endpoint.Configuration.EnableBackgroundPoll.Should().BeFalse(); }
public void Read_CompleteInbound_SettingsBatchPropertiesSet() { var reader = new ConfigurationReader(_serviceProvider) .Read(ConfigFileHelper.GetConfigSection("inbound.complete")); var batchSettings = reader.Inbound.First().Settings.Batch; batchSettings.Size.Should().Be(5); batchSettings.MaxWaitTime.Should().Be(TimeSpan.FromMilliseconds(2500)); }
public void Read_CompleteInbound_ErrorPolicyMaxFailedAttemptsSet() { var reader = new ConfigurationReader(_serviceProvider) .Read(ConfigFileHelper.GetConfigSection("inbound.complete")); var policy = reader.Inbound.First().ErrorPolicies.First(); policy.CanHandle(new InboundMessage(null, new[] { new MessageHeader(MessageHeader.FailedAttemptsKey, "3") }, null, null, true), new ArgumentException()).Should().BeTrue(); policy.CanHandle(new InboundMessage(null, new[] { new MessageHeader(MessageHeader.FailedAttemptsKey, "6") }, null, null, true), new ArgumentException()).Should().BeFalse(); }
public void Read_CompleteInbound_ErrorPolicyConstructorParameterSet() { var reader = new ConfigurationReader(_serviceProvider) .Read(ConfigFileHelper.GetConfigSection("inbound.complete")); var policy = (RetryErrorPolicy)reader.Inbound.First().ErrorPolicies.First(); ((TimeSpan)policy.GetType().GetField("_delayIncrement", BindingFlags.NonPublic | BindingFlags.Instance) .GetValue(policy)).Should().Be(TimeSpan.FromMinutes(5)); }
public void Read_CompleteInbound_ErrorPolicyExcludeSet() { var reader = new ConfigurationReader(_serviceProvider) .Read(ConfigFileHelper.GetConfigSection("inbound.complete")); var policy = reader.Inbound.First().ErrorPolicies.First(); policy.CanHandle(new InboundMessage(null, null, null, null, true), new ArgumentException()).Should().BeTrue(); policy.CanHandle(new InboundMessage(null, null, null, null, true), new ArgumentNullException()).Should().BeFalse(); }
public void Read_CompleteOutbound_DefaultSerializerPropertiesSet() { var reader = new ConfigurationReader(_serviceProvider) .Read(ConfigFileHelper.GetConfigSection("outbound.complete")); var serializer = (JsonMessageSerializer)reader.Outbound.Skip(1).First().Endpoint.Serializer; serializer.Encoding.Should().Be(MessageEncoding.Unicode); serializer.Settings.Formatting.Should().Be(Formatting.Indented); }
public void ReadAndApply_CompleteOutbound_AddOutboundWithCorrectTypes() { new ConfigurationReader(_serviceProvider) .Read(ConfigFileHelper.GetConfigSection("outbound.complete")) .Apply(_builder); _builder.Received(1).AddOutbound( typeof(IIntegrationEvent), Arg.Any <KafkaProducerEndpoint>(), null); _builder.Received(1).AddOutbound( typeof(IIntegrationCommand), Arg.Any <KafkaProducerEndpoint>(), typeof(DeferredOutboundConnector)); }
public void ReadAndApply_CompleteInbound_AddInboundWithCorrectTypes() { new ConfigurationReader(_serviceProvider) .Read(ConfigFileHelper.GetConfigSection("inbound.complete")) .Apply(_builder); // TODO: Should check policies in first call _builder.Received(1).AddInbound( Arg.Any <KafkaConsumerEndpoint>(), null, Arg.Any <Func <ErrorPolicyBuilder, IErrorPolicy> >(), Arg.Any <InboundConnectorSettings>()); _builder.Received(1).AddInbound( Arg.Any <KafkaConsumerEndpoint>(), typeof(LoggedInboundConnector), Arg.Is <Func <ErrorPolicyBuilder, IErrorPolicy> >(f => f.Invoke(null) == null)); }