public async Task <EndpointConfiguration> GetConfiguration(RunDescriptor runDescriptor, EndpointCustomizationConfiguration endpointConfiguration, Action <EndpointConfiguration> configurationBuilderCustomization) { var types = endpointConfiguration.GetTypesScopedByTestClass(); var configuration = new EndpointConfiguration(endpointConfiguration.EndpointName); configuration.TypesToIncludeInScan(types); configuration.EnableInstallers(); var recoverability = configuration.Recoverability(); recoverability.Delayed(delayed => delayed.NumberOfRetries(0)); recoverability.Immediate(immediate => immediate.NumberOfRetries(0)); configuration.SendFailedMessagesTo("error"); var transportConfiguration = new ConfigureEndpointAcceptanceTestingTransport(useNativePubSub, true); await transportConfiguration.Configure(endpointConfiguration.EndpointName, configuration, runDescriptor.Settings, endpointConfiguration.PublisherMetadata); runDescriptor.OnTestCompleted(_ => transportConfiguration.Cleanup()); configuration.RegisterComponentsAndInheritanceHierarchy(runDescriptor); var persistenceConfiguration = new ConfigureEndpointAcceptanceTestingPersistence(); await persistenceConfiguration.Configure(endpointConfiguration.EndpointName, configuration, runDescriptor.Settings, endpointConfiguration.PublisherMetadata); runDescriptor.OnTestCompleted(_ => persistenceConfiguration.Cleanup()); configurationBuilderCustomization(configuration); return(configuration); }
public static async Task DefinePersistence(this EndpointConfiguration config, RunDescriptor runDescriptor, EndpointCustomizationConfiguration endpointCustomizationConfiguration) { var persistenceConfiguration = new ConfigureEndpointInMemoryPersistence(); await persistenceConfiguration.Configure(endpointCustomizationConfiguration.EndpointName, config, runDescriptor.Settings, endpointCustomizationConfiguration.PublisherMetadata); runDescriptor.OnTestCompleted(_ => persistenceConfiguration.Cleanup()); }
public static async Task DefinePersistence(this EndpointConfiguration config, RunDescriptor runDescriptor, EndpointCustomizationConfiguration endpointCustomizationConfiguration) { var persistenceConfiguration = TestSuiteConstraints.Current.CreatePersistenceConfiguration(); await persistenceConfiguration.Configure(endpointCustomizationConfiguration.EndpointName, config, runDescriptor.Settings, endpointCustomizationConfiguration.PublisherMetadata); runDescriptor.OnTestCompleted(_ => persistenceConfiguration.Cleanup()); }
public static async Task DefinePersistence(this EndpointConfiguration config, RunDescriptor runDescriptor, EndpointCustomizationConfiguration endpointCustomizationConfiguration) { var persistenceConfiguration = new ConfigureEndpointAcceptanceTestingPersistence(); await persistenceConfiguration.Configure(config); runDescriptor.OnTestCompleted(_ => persistenceConfiguration.Cleanup()); }
public async Task <EndpointConfiguration> GetConfiguration(RunDescriptor runDescriptor, EndpointCustomizationConfiguration endpointCustomizationConfiguration, Action <EndpointConfiguration> configurationBuilderCustomization) { var endpointConfiguration = new EndpointConfiguration(endpointCustomizationConfiguration.EndpointName); endpointConfiguration.TypesToIncludeInScan(endpointCustomizationConfiguration.GetTypesScopedByTestClass()); endpointConfiguration.Recoverability() .Delayed(delayed => delayed.NumberOfRetries(0)) .Immediate(immediate => immediate.NumberOfRetries(0)); var storageDir = Path.Combine(NServiceBusAcceptanceTest.StorageRootDir, TestContext.CurrentContext.Test.ID); endpointConfiguration.EnableInstallers(); endpointConfiguration.UseTransport <LearningTransport>() .StorageDirectory(storageDir); if (ConfigureStorage) { var persistenceConfiguration = GatewayTestSuiteConstraints.Current.CreatePersistenceConfiguration(); await persistenceConfiguration.Configure(endpointCustomizationConfiguration.EndpointName, endpointConfiguration, runDescriptor.Settings).ConfigureAwait(false); runDescriptor.OnTestCompleted(_ => persistenceConfiguration.Cleanup()); } endpointConfiguration.RegisterComponentsAndInheritanceHierarchy(runDescriptor); configurationBuilderCustomization(endpointConfiguration); return(endpointConfiguration); }
public static async Task DefineTransport(this EndpointConfiguration config, RunDescriptor runDescriptor, EndpointCustomizationConfiguration endpointCustomizationConfiguration) { var transportConfiguration = new ConfigureEndpointLearningTransport(); await transportConfiguration.Configure(endpointCustomizationConfiguration.EndpointName, config, runDescriptor.Settings, endpointCustomizationConfiguration.PublisherMetadata); runDescriptor.OnTestCompleted(_ => transportConfiguration.Cleanup()); }
public Task <EndpointConfiguration> GetConfiguration(RunDescriptor runDescriptor, EndpointCustomizationConfiguration endpointConfiguration, Action <EndpointConfiguration> configurationBuilderCustomization) { var builder = new EndpointConfiguration(endpointConfiguration.EndpointName); var types = GetTypesScopedByTestClass(endpointConfiguration); builder.TypesToIncludeInScan(types); var transportIntegration = NServiceBusAcceptanceTest.TransportIntegration; transportIntegration.Configure(endpointConfiguration.EndpointName, builder); builder.Recoverability().Delayed(delayedRetries => delayedRetries.NumberOfRetries(0)); builder.Recoverability().Immediate(immediateRetries => immediateRetries.NumberOfRetries(0)); builder.RegisterComponents(r => { RegisterInheritanceHierarchyOfContextOnContainer(runDescriptor, r); }); builder.UseSerialization <NewtonsoftSerializer>(); builder.SendFailedMessagesTo("error"); builder.UsePersistence <InMemoryPersistence>(); builder.EnableInstallers(); configurationBuilderCustomization(builder); runDescriptor.OnTestCompleted(_ => transportIntegration.Cleanup()); return(Task.FromResult(builder)); }
public static async Task DefineTransport(this EndpointConfiguration config, RunDescriptor runDescriptor, EndpointCustomizationConfiguration endpointCustomizationConfiguration) { if (config.GetSettings().HasSetting <TransportDefinition>()) { return; } var transportConfiguration = new ConfigureEndpointLearningTransport(); await transportConfiguration.Configure(config); runDescriptor.OnTestCompleted(_ => transportConfiguration.Cleanup()); }
public Task <EndpointConfiguration> GetConfiguration(RunDescriptor runDescriptor, EndpointCustomizationConfiguration endpointConfiguration, Action <EndpointConfiguration> configurationBuilderCustomization) { var types = endpointConfiguration.GetTypesScopedByTestClass(); var typesToInclude = new List <Type>(types); var configuration = new EndpointConfiguration(endpointConfiguration.EndpointName); configuration.LimitMessageProcessingConcurrencyTo(1); configuration.TypesToIncludeInScan(typesToInclude); configuration.EnableInstallers(); configuration.UseContainer(new AcceptanceTestingContainer()); configuration.DisableFeature <TimeoutManager>(); var recoverability = configuration.Recoverability(); recoverability.Delayed(delayed => delayed.NumberOfRetries(0)); recoverability.Immediate(immediate => immediate.NumberOfRetries(0)); configuration.SendFailedMessagesTo("error"); var storageDir = StorageUtils.GetAcceptanceTestingTransportStorageDirectory(); var transportConfig = configuration.UseTransport <AcceptanceTestTransport>(); transportConfig.FailDispatchOnce(); transportConfig.StorageDirectory(storageDir); configuration.RegisterComponentsAndInheritanceHierarchy(runDescriptor); configurationBuilderCustomization(configuration); runDescriptor.OnTestCompleted(summary => { if (Directory.Exists(storageDir)) { Directory.Delete(storageDir, true); } return(Task.FromResult(0)); }); return(Task.FromResult(configuration)); }
public override Task <EndpointConfiguration> GetConfiguration(RunDescriptor runDescriptor, EndpointCustomizationConfiguration endpointCustomizationConfiguration, Action <EndpointConfiguration> configurationBuilderCustomization) { return(base.GetConfiguration(runDescriptor, endpointCustomizationConfiguration, configuration => { var endpointName = endpointCustomizationConfiguration.CustomEndpointName ?? configuration.GetSettings().EndpointName(); var deduplicationConfiguration = GatewayTestSuiteConstraints.Current.ConfigureDeduplicationStorage( endpointName, configuration, runDescriptor.Settings) .GetAwaiter().GetResult(); var gatewaySettings = configuration.Gateway(deduplicationConfiguration); configuration.GetSettings().Set(gatewaySettings); runDescriptor.OnTestCompleted(_ => GatewayTestSuiteConstraints.Current.Cleanup()); configurationBuilderCustomization(configuration); })); }
#pragma warning disable CS0618 public Task <EndpointConfiguration> GetConfiguration(RunDescriptor runDescriptor, EndpointCustomizationConfiguration endpointConfiguration, IConfigurationSource configSource, Action <EndpointConfiguration> configurationBuilderCustomization) #pragma warning restore CS0618 { var types = endpointConfiguration.GetTypesScopedByTestClass().ToList(); types.AddRange(ExtraTypesToInclude()); var configuration = new EndpointConfiguration(endpointConfiguration.EndpointName); configuration.TypesToIncludeInScan(types); configuration.CustomConfigurationSource(configSource); configuration.EnableInstallers(); var transportConfig = configuration.UseTransport <MsmqTransport>(); var routingConfig = transportConfig.Routing(); foreach (var publisher in endpointConfiguration.PublisherMetadata.Publishers) { foreach (var eventType in publisher.Events) { routingConfig.RegisterPublisher(eventType, publisher.PublisherName); } } ApplyConfig(configuration); var queueBindings = configuration.GetSettings().Get <QueueBindings>(); runDescriptor.OnTestCompleted(_ => DeleteQueues(queueBindings)); configuration.RegisterComponentsAndInheritanceHierarchy(runDescriptor); configuration.UsePersistence <InMemoryPersistence>(); configuration.GetSettings().SetDefault("ScaleOut.UseSingleBrokerQueue", true); configurationBuilderCustomization(configuration); return(Task.FromResult(configuration)); }