public static ITransportIntegration GetTransportIntegrationFromEnvironmentVar() { ITransportIntegration transportToUse = null; var transportToUseString = Environment.GetEnvironmentVariable("ServiceControl.AcceptanceTests.Transport"); if (transportToUseString != null) { transportToUse = (ITransportIntegration)Activator.CreateInstance(Type.GetType(typeof(MsmqTransportIntegration).FullName.Replace("Msmq", transportToUseString)) ?? typeof(MsmqTransportIntegration)); } if (transportToUse == null) { transportToUse = new MsmqTransportIntegration(); } var connectionString = Environment.GetEnvironmentVariable("ServiceControl.AcceptanceTests.ConnectionString"); if (!string.IsNullOrWhiteSpace(connectionString)) { transportToUse.ConnectionString = connectionString; } return(transportToUse); }
public ServiceControlComponentBehavior(ITransportIntegration transportToUse, Action <Settings> setSettings, Action <string, Settings> setInstanceSettings, Action <EndpointConfiguration> customConfiguration, Action <string, EndpointConfiguration> customInstanceConfiguration) { this.customInstanceConfiguration = customInstanceConfiguration; this.customConfiguration = customConfiguration; this.setSettings = setSettings; this.setInstanceSettings = setInstanceSettings; transportIntegration = transportToUse; }
public ServiceControlComponentRunner(ITransportIntegration transportToUse, Action <EndpointConfiguration> customEndpointConfiguration, Action <EndpointConfiguration> customAuditEndpointConfiguration, Action <Settings> customServiceControlSettings, Action <ServiceControl.Audit.Infrastructure.Settings.Settings> customServiceControlAuditSettings) { this.customServiceControlSettings = customServiceControlSettings; this.customServiceControlAuditSettings = customServiceControlAuditSettings; this.customAuditEndpointConfiguration = customAuditEndpointConfiguration; this.customEndpointConfiguration = customEndpointConfiguration; this.transportToUse = transportToUse; }
public static Configure DefineTransport(this Configure config, ITransportIntegration transport) { if (transport == null) { return config.UseTransport<Msmq>(); } return config.UseTransport(transport.Type, () => transport.ConnectionString); }
public ServiceControlComponentRunner(string[] instanceNames, ITransportIntegration transportToUse, Action <Settings> setSettings, Action <string, Settings> setInstanceSettings, Action <EndpointConfiguration> customConfiguration, Action <string, EndpointConfiguration> customInstanceConfiguration) { this.instanceNames = instanceNames; this.transportToUse = transportToUse; this.customConfiguration = customConfiguration; this.setSettings = setSettings; this.setInstanceSettings = setInstanceSettings; this.customInstanceConfiguration = customInstanceConfiguration; }
public static Configure DefineTransport(this Configure config, ITransportIntegration transport) { if (transport == null) { return(config.UseTransport <Msmq>()); } return(config.UseTransport(transport.Type, () => transport.ConnectionString)); }
public static void DefineTransport(this BusConfiguration config, ITransportIntegration transport) { var transportDefinitionType = transport.Type; var connectionString = transport.ConnectionString; if (connectionString == null) { config.UseTransport(transportDefinitionType); return; } config.UseTransport(transportDefinitionType).ConnectionString(connectionString); }
public void Setup() { port = FindAvailablePort(33333); SetSettings = _ => { }; CustomConfiguration = _ => { }; transportToUse = GetTransportIntegrationFromEnvironmentVar(); Console.Out.WriteLine($"Using transport {transportToUse.Name}"); Console.Out.WriteLine($"Using port {port}"); Conventions.EndpointNamingConvention = t => { var baseNs = typeof(AcceptanceTest).Namespace; var testName = GetType().Name; return(t.FullName.Replace($"{baseNs}.", string.Empty).Replace($"{testName}+", string.Empty)); }; ravenPath = Path.Combine(Path.GetTempPath(), Path.GetRandomFileName()); }
public void Setup() { SetSettings = _ => { }; SetInstanceSettings = (i, s) => { }; CustomConfiguration = _ => { }; CustomInstanceConfiguration = (i, c) => { }; transportToUse = GetTransportIntegrationFromEnvironmentVar(); Console.Out.WriteLine($"Using transport {transportToUse.Name}"); AssertTransportNotExplicitlyIgnored(); Conventions.EndpointNamingConvention = t => { var baseNs = typeof(AcceptanceTest).Namespace; var testName = GetType().Name; return(t.FullName.Replace($"{baseNs}.", string.Empty).Replace($"{testName}+", string.Empty)); }; }
public static Configure DefineTransport(this Configure config, ITransportIntegration transport) { var transportDefinitionType = typeof(Msmq); string connectionString = null; if (transport != null) { transportDefinitionType = transport.Type; connectionString = transport.ConnectionString; } Action action = transport.OnEndpointShutdown; SettingsHolder.Set("CleanupTransport", action); if (connectionString == null) { return config.UseTransport(transportDefinitionType); } return config.UseTransport(transportDefinitionType, () => connectionString); }
private static IEnumerable <Type> GetTypesScopedByTestClass(ITransportIntegration transportToUse) { var assemblies = new AssemblyScanner().GetScannableAssemblies(); var types = assemblies.Assemblies //exclude all test types by default .Where(a => a != Assembly.GetExecutingAssembly()) .Where(a => { if (a == transportToUse.Type.Assembly) { return(true); } return(!a.GetName().Name.Contains("Transports")); }) .Where(a => !a.GetName().Name.StartsWith("ServiceControl.Plugin")) .SelectMany(a => a.GetTypes()); types = types.Union(GetNestedTypeRecursive(transportToUse.GetType())); return(types); }
static IEnumerable <Type> GetTypesScopedByTestClass(ITransportIntegration transportToUse, EndpointConfiguration endpointConfiguration) { var assemblies = new AssemblyScanner().GetScannableAssemblies(); var types = assemblies.Assemblies //exclude all test types by default .Where(a => a != Assembly.GetExecutingAssembly()) .Where(a => { if (a == transportToUse.Type.Assembly) { return(true); } return(!a.GetName().Name.Contains("Transports")); }) .Where(a => !a.GetName().Name.StartsWith("ServiceControl.Plugin")) .Where(a => a.GetName().Name != "ServiceControl") .SelectMany(a => a.GetTypes()); types = types.Union(GetNestedTypeRecursive(transportToUse.GetType(), null)); var extraConfigForEndpoint = Type.GetType($"{transportToUse.GetType().Namespace}.{transportToUse.Name}.CustomConfigForEndpoints", false); if (extraConfigForEndpoint != null) { types = types.Union(new [] { extraConfigForEndpoint }); } types = types.Union(GetNestedTypeRecursive(endpointConfiguration.BuilderType.DeclaringType, endpointConfiguration.BuilderType)); types = types.Union(endpointConfiguration.TypesToInclude); var typesScopedByTestClass = types.ToList(); return(typesScopedByTestClass); }
public ServiceControlComponentRunner(ITransportIntegration transportToUse, Action <Settings> setSettings, Action <EndpointConfiguration> customConfiguration) { this.transportToUse = transportToUse; this.customConfiguration = customConfiguration; this.setSettings = setSettings; }