public BusConfiguration GetConfiguration(RunDescriptor runDescriptor, EndpointConfiguration endpointConfiguration, IConfigurationSource configSource, Action <BusConfiguration> configurationBuilderCustomization) { endpointConfiguration.AddressOfAuditQueue = Address.Parse("audit"); ServicePointManager.DefaultConnectionLimit = 100; var settings = runDescriptor.Settings; NServiceBus.Logging.LogManager.Use <NLogFactory>(); SetupLogging(endpointConfiguration); var transportToUse = AcceptanceTest.GetTransportIntegrationFromEnvironmentVar(); var types = GetTypesScopedByTestClass(transportToUse, endpointConfiguration).Concat(new[] { typeof(RegisterWrappers), typeof(SessionCopInBehavior), typeof(SessionCopInBehaviorForMainPipe), typeof(TraceIncomingBehavior), typeof(TraceOutgoingBehavior) }); var builder = new BusConfiguration(); builder.DisableFeature <AutoSubscribe>(); builder.UsePersistence <InMemoryPersistence>(); builder.EndpointName(endpointConfiguration.EndpointName); builder.TypesToScan(types); builder.CustomConfigurationSource(configSource); builder.EnableInstallers(); builder.Conventions().DefiningEventsAs(t => typeof(IEvent).IsAssignableFrom(t) || IsExternalContract(t)); builder.DefineTransport(transportToUse); builder.RegisterComponents(r => { r.RegisterSingleton(runDescriptor.ScenarioContext.GetType(), runDescriptor.ScenarioContext); r.RegisterSingleton(typeof(ScenarioContext), runDescriptor.ScenarioContext); }); builder.RegisterComponents(r => { builder.GetSettings().Set("SC.ConfigureComponent", r); }); builder.Pipeline.Register <SessionCopInBehavior.Registration>(); builder.Pipeline.Register <SessionCopInBehaviorForMainPipe.Registration>(); builder.Pipeline.Register <TraceIncomingBehavior.Registration>(); builder.Pipeline.Register <TraceOutgoingBehavior.Registration>(); var serializer = settings.GetOrNull("Serializer"); if (serializer != null) { builder.UseSerialization(Type.GetType(serializer)); } builder.GetSettings().SetDefault("ScaleOut.UseSingleBrokerQueue", true); builder.GetSettings().Set("SC.ScenarioContext", runDescriptor.ScenarioContext); configurationBuilderCustomization(builder); return(builder); }
private async Task <string> CreateAcceptanceTestAsync(AcceptanceTest acceptanceTest) { var response = await client.PostAsJsonAsync("api/AcceptanceTest", acceptanceTest).ConfigureAwait(false); var result = await CheckResponse(response).ConfigureAwait(false); var acceptanceTestId = await response.Content.ReadAsStringAsync().ConfigureAwait(false); return(acceptanceTestId.Substring(1, acceptanceTestId.Length - 2)); }
public Configure GetConfiguration(RunDescriptor runDescriptor, EndpointConfiguration endpointConfiguration, IConfigurationSource configSource) { var settings = runDescriptor.Settings; var types = GetTypesToUse(endpointConfiguration); var transportToUse = AcceptanceTest.GetTransportIntegrationFromEnvironmentVar(); SetupLogging(endpointConfiguration); Configure.Features.Enable <Sagas>(); Configure.ScaleOut(_ => _.UseSingleBrokerQueue()); AddMoreConfig(); var config = Configure.With(types) .DefiningEventsAs(t => typeof(IEvent).IsAssignableFrom(t) || IsExternalContract(t)) .DefineEndpointName(endpointConfiguration.EndpointName) .CustomConfigurationSource(configSource) .DefineBuilder(settings.GetOrNull("Builder")); SetSerializer(config); config .DefineTransport(transportToUse) .InMemorySagaPersister(); if (transportToUse == null || transportToUse is MsmqTransportIntegration || transportToUse is SqlServerTransportIntegration || transportToUse is RabbitMqTransportIntegration) { config.UseInMemoryTimeoutPersister(); } if (transportToUse == null || transportToUse is MsmqTransportIntegration || transportToUse is SqlServerTransportIntegration) { config.InMemorySubscriptionStorage(); } config.InMemorySagaPersister(); return(config.UnicastBus()); }
public bool UpdateAcceptanceTest(string acceptanceTestId, AcceptanceTest acceptanceTest) { return(UpdateAcceptanceTestAsync(acceptanceTestId, acceptanceTest).GetAwaiter().GetResult()); }
public string CreateAcceptanceTest(AcceptanceTest acceptanceTest) { return(CreateAcceptanceTestAsync(acceptanceTest).GetAwaiter().GetResult()); }