Exemplo n.º 1
0
        private async Task RemoveProvidersAndVerify(ICollection <string> streamProviderNames)
        {
            mgmtGrain = GrainClient.GrainFactory.GetGrain <IManagementGrain>(0);
            ICollection <string> names = await fixture.HostedCluster.Primary.TestHook.GetStreamProviderNames();

            int Count = names.Count;

            foreach (string name in streamProviderNames)
            {
                if (fixture.HostedCluster.ClusterConfiguration.Globals.ProviderConfigurations[ProviderCategoryConfiguration.STREAM_PROVIDER_CATEGORY_NAME].Providers.ContainsKey(name))
                {
                    fixture.HostedCluster.ClusterConfiguration.Globals.ProviderConfigurations[ProviderCategoryConfiguration.STREAM_PROVIDER_CATEGORY_NAME].Providers.Remove(name);
                }
            }

            SiloAddress[] address = new SiloAddress[1];
            address[0] = fixture.HostedCluster.Primary.SiloAddress;
            await mgmtGrain.UpdateStreamProviders(address, fixture.HostedCluster.ClusterConfiguration.Globals.ProviderConfigurations);

            names = await fixture.HostedCluster.Primary.TestHook.GetStreamProviderNames();

            ICollection <string> allSiloProviderNames = await fixture.HostedCluster.Primary.TestHook.GetAllSiloProviderNames();

            Assert.Equal(Count - names.Count, streamProviderNames.Count);
            Assert.Equal(allSiloProviderNames.Count, names.Count);
            foreach (String name in streamProviderNames)
            {
                Assert.DoesNotContain(name, names);;
            }
            foreach (String name in streamProviderNames)
            {
                Assert.DoesNotContain(name, allSiloProviderNames);
            }
        }
        private async Task RemoveProvidersAndVerify(List <string> streamProviderNames)
        {
            mgmtGrain = GrainClient.GrainFactory.GetGrain <IManagementGrain>(RuntimeInterfaceConstants.SYSTEM_MANAGEMENT_ID);
            List <string> names = fixture.HostedCluster.Primary.Silo.TestHook.GetStreamProviderNames().ToList();
            int           Count = names.Count;

            foreach (string name in streamProviderNames)
            {
                if (fixture.HostedCluster.ClusterConfiguration.Globals.ProviderConfigurations[ProviderCategoryConfiguration.STREAM_PROVIDER_CATEGORY_NAME].Providers.ContainsKey(name))
                {
                    fixture.HostedCluster.ClusterConfiguration.Globals.ProviderConfigurations[ProviderCategoryConfiguration.STREAM_PROVIDER_CATEGORY_NAME].Providers.Remove(name);
                }
            }

            SiloAddress[] address = new SiloAddress[1];
            address[0] = fixture.HostedCluster.Primary.Silo.SiloAddress;
            await mgmtGrain.UpdateStreamProviders(address, fixture.HostedCluster.ClusterConfiguration.Globals.ProviderConfigurations);

            names = fixture.HostedCluster.Primary.Silo.TestHook.GetStreamProviderNames().ToList();
            List <string> allSiloProviderNames = fixture.HostedCluster.Primary.Silo.TestHook.GetAllSiloProviderNames().ToList();

            Assert.Equal(Count - names.Count, streamProviderNames.Count);
            Assert.Equal(allSiloProviderNames.Count, names.Count);
            foreach (String name in streamProviderNames)
            {
                Assert.Equal(names.Contains(name), false);
            }
            foreach (String name in streamProviderNames)
            {
                Assert.Equal(allSiloProviderNames.Contains(name), false);
            }
        }
Exemplo n.º 3
0
        private async Task AddProvidersAndVerify(ICollection <string> streamProviderNames)
        {
            mgmtGrain = GrainClient.GrainFactory.GetGrain <IManagementGrain>(0);
            ICollection <string> names = await fixture.HostedCluster.Primary.TestHook.GetStreamProviderNames();

            IDictionary <string, bool> hasNewProvider = new Dictionary <string, bool>();

            int count = names.Count;

            SiloAddress[] address = new SiloAddress[1];
            address[0] = fixture.HostedCluster.Primary.SiloAddress;
            await mgmtGrain.UpdateStreamProviders(address, fixture.HostedCluster.ClusterConfiguration.Globals.ProviderConfigurations);

            names = await fixture.HostedCluster.Primary.TestHook.GetStreamProviderNames();

            ICollection <string> allSiloProviderNames = await fixture.HostedCluster.Primary.TestHook.GetAllSiloProviderNames();

            Assert.Equal(names.Count - count, streamProviderNames.Count);
            Assert.Equal(allSiloProviderNames.Count, names.Count);
            foreach (string name in names)
            {
                if (streamProviderNames.Contains(name))
                {
                    Assert.DoesNotContain(name, hasNewProvider.Keys);
                    hasNewProvider[name] = true;
                }
            }

            Assert.Equal(hasNewProvider.Count, streamProviderNames.Count);

            hasNewProvider.Clear();
            foreach (String name in allSiloProviderNames)
            {
                if (streamProviderNames.Contains(name))
                {
                    Assert.DoesNotContain(name, hasNewProvider.Keys);
                    hasNewProvider[name] = true;
                }
            }
            Assert.Equal(hasNewProvider.Count, streamProviderNames.Count);
        }
        private async Task AddProvidersAndVerify(List <string> streamProviderNames)
        {
            mgmtGrain = GrainClient.GrainFactory.GetGrain <IManagementGrain>(RuntimeInterfaceConstants.SYSTEM_MANAGEMENT_ID);
            List <string> names = fixture.HostedCluster.Primary.Silo.TestHook.GetStreamProviderNames().ToList();

            IDictionary <string, bool> hasNewProvider = new Dictionary <string, bool>();

            int Count = names.Count;

            SiloAddress[] address = new SiloAddress[1];
            address[0] = fixture.HostedCluster.Primary.Silo.SiloAddress;
            await mgmtGrain.UpdateStreamProviders(address, fixture.HostedCluster.ClusterConfiguration.Globals.ProviderConfigurations);

            names = fixture.HostedCluster.Primary.Silo.TestHook.GetStreamProviderNames().ToList();
            List <string> allSiloProviderNames = fixture.HostedCluster.Primary.Silo.TestHook.GetAllSiloProviderNames().ToList();

            Assert.Equal(names.Count - Count, streamProviderNames.Count);
            Assert.Equal(allSiloProviderNames.Count, names.Count);
            foreach (string name in names)
            {
                if (streamProviderNames.Contains(name))
                {
                    Assert.Equal(hasNewProvider.ContainsKey(name), false);
                    hasNewProvider[name] = true;
                }
            }

            Assert.Equal(hasNewProvider.Count, streamProviderNames.Count);

            hasNewProvider.Clear();
            foreach (String name in allSiloProviderNames)
            {
                if (streamProviderNames.Contains(name))
                {
                    Assert.Equal(hasNewProvider.ContainsKey(name), false);
                    hasNewProvider[name] = true;
                }
            }
            Assert.Equal(hasNewProvider.Count, streamProviderNames.Count);
        }