示例#1
0
        public static ClientConfiguration BuildClientConfiguration(ClusterConfiguration clusterConfig)
        {
            var config = new ClientConfiguration();

            config.TraceFilePattern = clusterConfig.Defaults.TraceFilePattern;
            config.TraceToConsole   = DefaultTraceToConsole;
            switch (clusterConfig.Globals.LivenessType)
            {
            case GlobalConfiguration.LivenessProviderType.AzureTable:
                config.GatewayProvider = ClientConfiguration.GatewayProviderType.AzureTable;
                break;

            case GlobalConfiguration.LivenessProviderType.SqlServer:
                config.GatewayProvider = ClientConfiguration.GatewayProviderType.SqlServer;
                break;

            case GlobalConfiguration.LivenessProviderType.ZooKeeper:
                config.GatewayProvider = ClientConfiguration.GatewayProviderType.ZooKeeper;
                break;

            case GlobalConfiguration.LivenessProviderType.Custom:
                config.GatewayProvider = ClientConfiguration.GatewayProviderType.Custom;
                config.CustomGatewayProviderAssemblyName = clusterConfig.Globals.MembershipTableAssembly;
                break;

            case GlobalConfiguration.LivenessProviderType.NotSpecified:
            case GlobalConfiguration.LivenessProviderType.MembershipTableGrain:
            default:
                config.GatewayProvider = ClientConfiguration.GatewayProviderType.Config;
                var primaryProxyEndpoint = clusterConfig.Overrides[Silo.PrimarySiloName].ProxyGatewayEndpoint;
                if (primaryProxyEndpoint != null)
                {
                    config.Gateways.Add(primaryProxyEndpoint);
                }
                foreach (var nodeConfiguration in clusterConfig.Overrides.Values.Where(x => x.SiloName != Silo.PrimarySiloName && x.ProxyGatewayEndpoint != null))
                {
                    config.Gateways.Add(nodeConfiguration.ProxyGatewayEndpoint);
                }
                break;
            }

            config.DataConnectionString = clusterConfig.Globals.DataConnectionString;
            config.PropagateActivityId  = clusterConfig.Defaults.PropagateActivityId;
            config.DeploymentId         = clusterConfig.Globals.DeploymentId;
            if (Debugger.IsAttached)
            {
                // Test is running inside debugger - Make timeout ~= infinite
                config.ResponseTimeout = TimeSpan.FromMilliseconds(1000000);
            }
            else
            {
                config.ResponseTimeout = clusterConfig.Globals.ResponseTimeout;
            }

            config.LargeMessageWarningThreshold = clusterConfig.Defaults.LargeMessageWarningThreshold;

            // TODO: copy test environment config from globals instead of from constants
            config.AdjustForTestEnvironment();
            return(config);
        }
示例#2
0
        public static ClientConfiguration BuildClientConfiguration(ClusterConfiguration clusterConfig)
        {
            var config = new ClientConfiguration {
                GatewayProvider = ClientConfiguration.GatewayProviderType.Config
            };

            config.TraceFilePattern = clusterConfig.Defaults.TraceFilePattern;
            config.TraceToConsole   = DefaultTraceToConsole;
            config.Gateways.Add(clusterConfig.Overrides[Silo.PrimarySiloName].ProxyGatewayEndpoint);
            foreach (var nodeConfiguration in clusterConfig.Overrides.Values.Where(x => x.SiloName != Silo.PrimarySiloName))
            {
                config.Gateways.Add(nodeConfiguration.ProxyGatewayEndpoint);
            }

            config.PropagateActivityId = clusterConfig.Defaults.PropagateActivityId;
            config.DeploymentId        = clusterConfig.Globals.DeploymentId;
            if (Debugger.IsAttached)
            {
                // Test is running inside debugger - Make timeout ~= infinite
                config.ResponseTimeout = TimeSpan.FromMilliseconds(1000000);
            }
            else
            {
                config.ResponseTimeout = clusterConfig.Globals.ResponseTimeout;
            }

            config.LargeMessageWarningThreshold = clusterConfig.Defaults.LargeMessageWarningThreshold;

            // TODO: copy test environment config from globals instead of from constants
            config.AdjustForTestEnvironment();
            return(config);
        }
示例#3
0
        public void AdjustForTest(ClientConfiguration config, TestingClientOptions options)
        {
            if (options.AdjustConfig != null)
            {
                options.AdjustConfig(config);
            }

            config.AdjustForTestEnvironment();
        }
示例#4
0
        /// <summary> Modify the ClientConfiguration to the test environment </summary>
        /// <param name="config">The client configuration to modify</param>
        /// <param name="options">the TestingClientOptions to modify</param>
        public static void AdjustForTest(ClientConfiguration config, TestingClientOptions options)
        {
            if (options.AdjustConfig != null)
            {
                options.AdjustConfig(config);
            }

            config.AdjustForTestEnvironment(TestClusterOptions.FallbackOptions.DefaultExtendedConfiguration["DataConnectionString"]);
        }
示例#5
0
        /// <summary>
        /// Build the client configuration based on the cluster configuration. If a debugger is attached,
        /// the response timeout will be overridden to 1000000ms
        /// </summary>
        /// <param name="clusterConfig">The reference cluster configuration.</param>
        /// <returns>THe builded client configuration</returns>
        public static ClientConfiguration BuildClientConfiguration(ClusterConfiguration clusterConfig)
        {
            var config = new ClientConfiguration();

            config.TraceFilePattern = clusterConfig.Defaults.TraceFilePattern;
            switch (clusterConfig.Globals.LivenessType)
            {
            case GlobalConfiguration.LivenessProviderType.AzureTable:
                config.GatewayProvider = ClientConfiguration.GatewayProviderType.AzureTable;
                break;

            case GlobalConfiguration.LivenessProviderType.SqlServer:
                config.GatewayProvider = ClientConfiguration.GatewayProviderType.SqlServer;
                break;

            case GlobalConfiguration.LivenessProviderType.ZooKeeper:
                config.GatewayProvider = ClientConfiguration.GatewayProviderType.ZooKeeper;
                break;

            case GlobalConfiguration.LivenessProviderType.Custom:
                config.GatewayProvider = ClientConfiguration.GatewayProviderType.Custom;
                config.CustomGatewayProviderAssemblyName = clusterConfig.Globals.MembershipTableAssembly;
                break;

            case GlobalConfiguration.LivenessProviderType.NotSpecified:
            case GlobalConfiguration.LivenessProviderType.MembershipTableGrain:
            default:
                config.GatewayProvider = ClientConfiguration.GatewayProviderType.Config;
                var primaryProxyEndpoint = clusterConfig.Overrides[Silo.PrimarySiloName].ProxyGatewayEndpoint;
                if (primaryProxyEndpoint != null)
                {
                    config.Gateways.Add(primaryProxyEndpoint);
                }
                foreach (var nodeConfiguration in clusterConfig.Overrides.Values.Where(x => x.SiloName != Silo.PrimarySiloName && x.ProxyGatewayEndpoint != null))
                {
                    config.Gateways.Add(nodeConfiguration.ProxyGatewayEndpoint);
                }
                break;
            }

            config.DataConnectionString = clusterConfig.Globals.DataConnectionString;
            config.AdoInvariant         = clusterConfig.Globals.AdoInvariant;
            config.DeploymentId         = clusterConfig.Globals.DeploymentId;
            config.PropagateActivityId  = clusterConfig.Defaults.PropagateActivityId;
            // If a debugger is attached, override the timeout setting
            config.ResponseTimeout = Debugger.IsAttached
                ? TimeSpan.FromMilliseconds(1000000)
                : clusterConfig.Globals.ResponseTimeout;

            config.AdjustForTestEnvironment(clusterConfig.Globals.DataConnectionString);
            return(config);
        }
示例#6
0
        public static ClientConfiguration BuildClientConfiguration(ClusterConfiguration clusterConfig)
        {
            var config = new ClientConfiguration();
            config.TraceFilePattern = clusterConfig.Defaults.TraceFilePattern;
            config.TraceToConsole = DefaultTraceToConsole;
            switch (clusterConfig.Globals.LivenessType)
            {
                case GlobalConfiguration.LivenessProviderType.AzureTable:
                    config.GatewayProvider = ClientConfiguration.GatewayProviderType.AzureTable;
                    break;
                case GlobalConfiguration.LivenessProviderType.SqlServer:
                    config.GatewayProvider = ClientConfiguration.GatewayProviderType.SqlServer;
                    break;
                case GlobalConfiguration.LivenessProviderType.ZooKeeper:
                    config.GatewayProvider = ClientConfiguration.GatewayProviderType.ZooKeeper;
                    break;
                case GlobalConfiguration.LivenessProviderType.Custom:
                    config.GatewayProvider = ClientConfiguration.GatewayProviderType.Custom;
                    config.CustomGatewayProviderAssemblyName = clusterConfig.Globals.MembershipTableAssembly;
                    break;
                case GlobalConfiguration.LivenessProviderType.NotSpecified:
                case GlobalConfiguration.LivenessProviderType.MembershipTableGrain:
                default:
                    config.GatewayProvider = ClientConfiguration.GatewayProviderType.Config;
                    var primaryProxyEndpoint = clusterConfig.Overrides[Silo.PrimarySiloName].ProxyGatewayEndpoint;
                    if (primaryProxyEndpoint != null)
                    {
                        config.Gateways.Add(primaryProxyEndpoint);
                    }
                    foreach (var nodeConfiguration in clusterConfig.Overrides.Values.Where(x => x.SiloName != Silo.PrimarySiloName && x.ProxyGatewayEndpoint != null))
                    {
                        config.Gateways.Add(nodeConfiguration.ProxyGatewayEndpoint);
                    }
                    break;
            }

            config.DataConnectionString = clusterConfig.Globals.DataConnectionString;
            config.PropagateActivityId = clusterConfig.Defaults.PropagateActivityId;
            config.DeploymentId = clusterConfig.Globals.DeploymentId;
            if (Debugger.IsAttached)
            {
                // Test is running inside debugger - Make timeout ~= infinite
                config.ResponseTimeout = TimeSpan.FromMilliseconds(1000000);
            }
            else
            {
                config.ResponseTimeout = clusterConfig.Globals.ResponseTimeout;
            }

            config.LargeMessageWarningThreshold = clusterConfig.Defaults.LargeMessageWarningThreshold;

            // TODO: copy test environment config from globals instead of from constants
            config.AdjustForTestEnvironment();
            return config;
        }
示例#7
0
        public static void AdjustForTest(ClientConfiguration config, TestingClientOptions options)
        {
            if (options.AdjustConfig != null) {
                options.AdjustConfig(config);
            }

            config.AdjustForTestEnvironment();
        }
示例#8
0
 public virtual void AdjustForTest(ClientConfiguration config)
 {
     config.AdjustForTestEnvironment();
 }
示例#9
0
        public static ClientConfiguration BuildClientConfiguration(ClusterConfiguration clusterConfig)
        {
            var config = new ClientConfiguration { GatewayProvider = ClientConfiguration.GatewayProviderType.Config };
            config.TraceFilePattern = clusterConfig.Defaults.TraceFilePattern;
            config.TraceToConsole = DefaultTraceToConsole;
            config.Gateways.Add(clusterConfig.Overrides[Silo.PrimarySiloName].ProxyGatewayEndpoint);
            foreach (var nodeConfiguration in clusterConfig.Overrides.Values.Where(x => x.SiloName != Silo.PrimarySiloName))
            {
                config.Gateways.Add(nodeConfiguration.ProxyGatewayEndpoint);
            }

            config.PropagateActivityId = clusterConfig.Defaults.PropagateActivityId;
            config.DeploymentId = clusterConfig.Globals.DeploymentId;
            if (Debugger.IsAttached)
            {
                // Test is running inside debugger - Make timeout ~= infinite
                config.ResponseTimeout = TimeSpan.FromMilliseconds(1000000);
            }
            else
            {
                config.ResponseTimeout = clusterConfig.Globals.ResponseTimeout;
            }

            config.LargeMessageWarningThreshold = clusterConfig.Defaults.LargeMessageWarningThreshold;

            // TODO: copy test environment config from globals instead of from constants
            config.AdjustForTestEnvironment();
            return config;
        }
示例#10
0
 public virtual void AdjustForTest(ClientConfiguration config)
 {
     config.AdjustForTestEnvironment();
 }
示例#11
0
        /// <summary> Modify the ClientConfiguration to the test environment </summary>
        /// <param name="config">The client configuration to modify</param>
        /// <param name="options">the TestingClientOptions to modify</param>
        public static void AdjustForTest(ClientConfiguration config, TestingClientOptions options)
        {
            if (options.AdjustConfig != null) {
                options.AdjustConfig(config);
            }

            config.AdjustForTestEnvironment(TestClusterOptions.FallbackOptions.DefaultExtendedConfiguration["DataConnectionString"]);
        }