예제 #1
0
        public async Task ValidateConfiguration_IncorrectKey()
        {
            var serviceRuntime = new TestServiceRuntimeWrapper();

            serviceRuntime.DeploymentId = "bar";
            serviceRuntime.Settings["DataConnectionString"] = "DefaultEndpointsProtocol=https;AccountName=orleanstest;AccountKey=IncorrectKey";
            serviceRuntime.InstanceName = "name";

            var config = AzureSilo.DefaultConfiguration(serviceRuntime);

            config.AddMemoryStorageProvider();

            AzureSilo orleansAzureSilo = new AzureSilo(serviceRuntime, this.loggerFactory);
            bool      ok = await orleansAzureSilo.ValidateConfiguration(config);

            Assert.False(ok);
        }
예제 #2
0
        public async Task ValidateConfiguration_InvalidConnectionString()
        {
            var serviceRuntime = new TestServiceRuntimeWrapper
            {
                DeploymentId = "bar"
            };

            serviceRuntime.Settings["DataConnectionString"] = "InvalidConnectionString";
            serviceRuntime.InstanceName = "name";

            var config = AzureSilo.DefaultConfiguration(serviceRuntime);

            AzureSilo orleansAzureSilo = new AzureSilo(serviceRuntime, this.loggerFactory);
            bool      ok = await orleansAzureSilo.ValidateConfiguration(config);

            Assert.False(ok);
        }
예제 #3
0
        private async Task ValidateConfigurationAtStartup(string connectionString)
        {
            var serviceRuntime = new TestServiceRuntimeWrapper
            {
                DeploymentId = "foo"
            };

            serviceRuntime.Settings["DataConnectionString"] = connectionString;
            serviceRuntime.InstanceName = "name";

            var config = AzureSilo.DefaultConfiguration(serviceRuntime);

            AzureSilo orleansAzureSilo = new AzureSilo(serviceRuntime, this.loggerFactory);
            bool      ok = await orleansAzureSilo.ValidateConfiguration(config);

            Assert.True(ok);
        }
예제 #4
0
        public async void ValidateConfiguration_InvalidConnectionString()
        {
            var serviceRuntime = new TestServiceRuntimeWrapper();

            serviceRuntime.DeploymentId = "bar";
            serviceRuntime.Settings["DataConnectionString"] = "InvalidConnectionString";
            serviceRuntime.InstanceName = "name";

            var config = AzureSilo.DefaultConfiguration(serviceRuntime);

            config.AddMemoryStorageProvider();

            AzureSilo orleansAzureSilo = new AzureSilo(serviceRuntime);
            bool      ok = await orleansAzureSilo.ValidateConfiguration(config);

            Assert.False(ok);
        }
예제 #5
0
        public async Task ValidateConfiguration_Startup()
        {
            Skip.IfNot(StorageEmulator.TryStart(), "This test explicitly requires the Azure Storage emulator to run");

            var serviceRuntime = new TestServiceRuntimeWrapper();

            serviceRuntime.DeploymentId = "foo";
            serviceRuntime.Settings["DataConnectionString"] = "UseDevelopmentStorage=true";
            serviceRuntime.InstanceName = "name";

            var config = AzureSilo.DefaultConfiguration(serviceRuntime);

            config.AddMemoryStorageProvider();

            AzureSilo orleansAzureSilo = new AzureSilo(serviceRuntime, this.loggerFactory);
            bool      ok = await orleansAzureSilo.ValidateConfiguration(config);

            Assert.True(ok);
        }
예제 #6
0
        public override bool OnStart()
        {
            Trace.WriteLine("OrleansAzureSilos-OnStart called", "Information");
            Trace.WriteLine("OrleansAzureSilos-OnStart Initializing config", "Information");

            // Set the maximum number of concurrent connections
            ServicePointManager.DefaultConnectionLimit = 12;

            // For information on handling configuration changes see the MSDN topic at http://go.microsoft.com/fwlink/?LinkId=166357.
            RoleEnvironment.Changing += RoleEnvironmentChanging;
            SetupEnvironmentChangeHandlers();

            var config = AzureSilo.DefaultConfiguration();

            config.AddMemoryStorageProvider();

            // First example of how to configure an existing provider
            Example_ConfigureNewStorageProvider(config);
            Example_ConfigureExistingStorageProvider(config);
            Example_ConfigureNewBootstrapProvider(config);

            // It is IMPORTANT to start the silo not in OnStart but in Run.
            // Azure may not have the firewalls open yet (on the remote silos) at the OnStart phase.
            // Just validate that the configuration is OK (for example, that the storage used in membership is accessible)
            var  silo = new AzureSilo();
            bool ok   = silo.ValidateConfiguration(config).Result;

            Trace.WriteLine("OrleansAzureSilos-OnStart called silo.ValidateConfiguration ok=" + ok, "Information");

            if (ok)
            {
                this.orleansAzureSilo     = silo;
                this.clusterConfiguration = config;

                ok = base.OnStart();
                Trace.WriteLine("OrleansAzureSilos-OnStart called base.OnStart ok=" + ok, "Information");
            }

            return(ok);
        }