コード例 #1
0
        private static ADeployment MapMediaServicesAccounts(MediaServicesAccountConfig configMediaServicesAccount)
        {
            var mediaService = MdCache.Instance.GetAs <MediaService>(
                MediaService.GetCacheKey(configMediaServicesAccount.Id)
                );

            if (null == mediaService)
            {
                return(null);
            }

            var deployment = new ADeployment();

            deployment.Id          = configMediaServicesAccount.Id;
            deployment.AccountName = configMediaServicesAccount.AccountName;
            deployment.Location    = configMediaServicesAccount.MetaData.Location;

            deployment.Channels = mediaService.Channels
                                  .Denull()
                                  .Select(mch => MapMediaChannel(configMediaServicesAccount, mediaService, mch))
                                  .ToList();

            return(deployment);
        }
コード例 #2
0
            public void ContentConfigToInformationTest2()
            {
                const string  msaId  = "msa-id-1";
                ContentConfig config = new ContentConfig
                {
                    DashboardTitle   = "Title",
                    ContentProviders = new List <ContentProviderConfig>
                    {
                        new ContentProviderConfig
                        {
                            Id = "id1",
                            MediaServicesSets = new List <MediaServicesSetConfig>
                            {
                                new MediaServicesSetConfig
                                {
                                    MediaServicesAccounts = new List <MediaServicesAccountConfig>
                                    {
                                        new MediaServicesAccountConfig
                                        {
                                            Id       = msaId,
                                            MetaData = new MediaServicesMetaDataConfig
                                            {
                                                AzureSubscriptionId = "azuresubid",
                                                Location            = "Amsterdam"
                                            }
                                        }
                                    },
                                    DataStorageConnections = new List <AzureDataConfig>
                                    {
                                        new AzureDataConfig
                                        {
                                            AcctName       = "accoutName1",
                                            AzureServer    = "azure-db1-server-name",
                                            InitialCatalog = "azure-db1-name",
                                            UserName       = "******",
                                            Password       = "******"
                                        },
                                        new AzureDataConfig
                                        {
                                            AcctName       = "accoutName2",
                                            AzureServer    = "azure-db2-server-name",
                                            InitialCatalog = "azure-db2-name",
                                            UserName       = "******",
                                            Password       = "******"
                                        }
                                    }
                                }
                            }
                        }
                    }
                };

                MediaService mediaService = new MediaService
                {
                    Id   = msaId,
                    Name = "Name1"
                };

                MdCache.Instance.SetAs(MediaService.GetCacheKey(msaId), mediaService);

                Information info = ContentConfigToInformation.Map(config);

                Assert.NotNull(info);
                Assert.AreEqual(1, info.ContentProviders.Count);
                Assert.AreEqual(1, info.ContentProviders[0].MediaPipelines.Count);
                Assert.AreEqual(1, info.ContentProviders[0].MediaPipelines[0].Deployments.Count);
                Assert.AreEqual(msaId, info.ContentProviders[0].MediaPipelines[0].Deployments[0].Id);

                List <AzureDataConfig> dbConns = config.ContentProviders[0].MediaServicesSets[0].DataStorageConnections;

                Assert.IsNotNull(dbConns);
                Assert.IsNotEmpty(dbConns);
                Assert.AreEqual(2, dbConns.Count);
                Assert.AreNotSame(dbConns[0], dbConns[1]);
            }