Пример #1
0
        private BatchManagementClient GetBatchManagementClient(MockContext context)
        {
            if (HttpMockServer.Mode == HttpRecorderMode.Record)
            {
                BatchAccount       = Environment.GetEnvironmentVariable(ScenarioTestHelpers.BatchAccountName);
                BatchAccountKey    = Environment.GetEnvironmentVariable(ScenarioTestHelpers.BatchAccountKey);
                BatchAccountUrl    = Environment.GetEnvironmentVariable(ScenarioTestHelpers.BatchAccountEndpoint);
                BatchResourceGroup = Environment.GetEnvironmentVariable(ScenarioTestHelpers.BatchAccountResourceGroup);

                HttpMockServer.Variables[ScenarioTestHelpers.BatchAccountName]          = BatchAccount;
                HttpMockServer.Variables[ScenarioTestHelpers.BatchAccountEndpoint]      = BatchAccountUrl;
                HttpMockServer.Variables[ScenarioTestHelpers.BatchAccountResourceGroup] = BatchResourceGroup;
            }
            else if (HttpMockServer.Mode == HttpRecorderMode.Playback)
            {
                BatchAccount    = HttpMockServer.Variables[ScenarioTestHelpers.BatchAccountName];
                BatchAccountKey = "00000000000000000000000000000000000000000000000000000000000000000000000000000000000000==";
                BatchAccountUrl = HttpMockServer.Variables[ScenarioTestHelpers.BatchAccountEndpoint];

                if (HttpMockServer.Variables.ContainsKey(ScenarioTestHelpers.BatchAccountResourceGroup))
                {
                    BatchResourceGroup = HttpMockServer.Variables[ScenarioTestHelpers.BatchAccountResourceGroup];
                }
            }

            return(context.GetServiceClient <BatchManagementClient>(TestEnvironmentFactory.GetTestEnvironment()));
        }
Пример #2
0
 private void SetupManagementClients(MockContext context)
 {
     _helper.SetupManagementClients(
         context.GetServiceClient <ContainerRegistryManagementClient>(TestEnvironmentFactory.GetTestEnvironment()),
         context.GetServiceClient <ResourceManagementClient>(TestEnvironmentFactory.GetTestEnvironment()),
         context.GetServiceClient <InternalResourceManagementClient>(TestEnvironmentFactory.GetTestEnvironment()));
 }
        protected DataBoxManagementClient GetDataPipelineManagementClient(MockContext context)
        {
            var testEnv = TestEnvironmentFactory.GetTestEnvironment();

            //testEnv.SubscriptionId = "05b5dd1c-793d-41de-be9f-6f9ed142f695";
            return(context.GetServiceClient <DataBoxManagementClient>(testEnv));
        }
        private static ResourceManagementClient GetResourceManagementClient(MockContext context)
        {
#if NETSTANDARD
            return(context.GetServiceClient <ResourceManagementClient>(TestEnvironmentFactory.GetTestEnvironment()));
#else
            return(TestBase.GetServiceClient <ResourceManagementClient>(new CSMTestEnvironmentFactory()));
#endif
        }
Пример #5
0
        protected NetworkManagementClient GetNetworkClient(MockContext context)
        {
            NetworkManagementClient client =
                context.GetServiceClient <NetworkManagementClient>(
                    TestEnvironmentFactory.GetTestEnvironment());

            return(client);
        }
Пример #6
0
        private static void SetDataLakeStoreFileSystemManagementClient(MockContext context)
        {
            var currentEnvironment = TestEnvironmentFactory.GetTestEnvironment();

            AdlsClientFactory.IsTest = true;
            AdlsClientFactory.CustomDelegatingHAndler = ((AdlMockContext)context).GetDelegatingHAndlersForDataPlane(currentEnvironment, new AdlMockDelegatingHandler());
            AdlsClientFactory.MockCredentials         = currentEnvironment.TokenInfo[TokenAudience.Management];
        }
Пример #7
0
        private static DataLakeAnalyticsCatalogManagementClient GetDataLakeAnalyticsCatalogManagementClient(MockContext context)
        {
            var currentEnvironment = TestEnvironmentFactory.GetTestEnvironment();
            var toReturn           = context.GetServiceClient <DataLakeAnalyticsCatalogManagementClient>(currentEnvironment, true);

            toReturn.AdlaCatalogDnsSuffix =
                currentEnvironment.Endpoints.DataLakeAnalyticsJobAndCatalogServiceUri.OriginalString.Replace("https://", "");
            return(toReturn);
        }
Пример #8
0
        private DataLakeStoreFileSystemManagementClient GetDataLakeStoreFileSystemManagementClient(MockContext context)
        {
            var currentEnvironment = TestEnvironmentFactory.GetTestEnvironment();
            var toReturn           = context.GetServiceClient <DataLakeStoreFileSystemManagementClient>(currentEnvironment, true);

            toReturn.AdlsFileSystemDnsSuffix =
                currentEnvironment.Endpoints.DataLakeStoreServiceUri.OriginalString.Replace("https://", "");
            return(toReturn);
        }
Пример #9
0
 private void SetDataLakeStoreFileSystemManagementClient()
 {
     var currentEnvironment = TestEnvironmentFactory.GetTestEnvironment();
     AdlsClientFactory.IsTest = true;
     if (HttpMockServer.GetCurrentMode() == HttpRecorderMode.Record)
     {
         AdlsClientFactory.MockCredentials = currentEnvironment.TokenInfo[TokenAudience.Management];
     }
 }
Пример #10
0
        private static GraphRbacManagementClient GetGraphRbacManagementClient(MockContext context)
        {
            var    environment = TestEnvironmentFactory.GetTestEnvironment();
            string tenantId    = null;

            var client = context.GetGraphServiceClient <GraphRbacManagementClient>(environment);

            client.TenantID = tenantId;

            return(client);
        }
Пример #11
0
        private void SetupManagementClients(MockContext context)
        {
            ResourceManagementClient      = GetResourceManagementClient(context);
            SubscriptionClient            = GetSubscriptionClient(context);
            AuthorizationManagementClient = GetAuthorizationManagementClient(context);
            GraphClient = GetGraphClient(context);
            ManagementGroupsApiClient = GetManagementGroupsApiClient(context);
            FeatureClient             = GetFeatureClient(context);
            var testEnvironment = TestEnvironmentFactory.GetTestEnvironment();
            var credentials     = testEnvironment.TokenInfo[TokenAudience.Management];

            HttpClientHelperFactory.Instance = new TestHttpClientHelperFactory(credentials);

            _helper.SetupManagementClients(ResourceManagementClient,
                                           SubscriptionClient,
                                           AuthorizationManagementClient,
                                           GraphClient,
                                           FeatureClient,
                                           ManagementGroupsApiClient);
        }
Пример #12
0
        private GraphRbacManagementClient GetGraphClient(MockContext context)
        {
            var    environment = TestEnvironmentFactory.GetTestEnvironment();
            string tenantId    = null;

            if (HttpMockServer.Mode == HttpRecorderMode.Record)
            {
                tenantId   = environment.Tenant;
                UserDomain = String.IsNullOrEmpty(environment.UserName) ? String.Empty : environment.UserName.Split(new[] { "@" }, StringSplitOptions.RemoveEmptyEntries).Last();

                HttpMockServer.Variables[TenantIdKey] = tenantId;
                HttpMockServer.Variables[DomainKey]   = UserDomain;
            }
            else if (HttpMockServer.Mode == HttpRecorderMode.Playback)
            {
                if (HttpMockServer.Variables.ContainsKey(TenantIdKey))
                {
                    tenantId = HttpMockServer.Variables[TenantIdKey];
                }
                if (HttpMockServer.Variables.ContainsKey(DomainKey))
                {
                    UserDomain = HttpMockServer.Variables[DomainKey];
                }
                if (HttpMockServer.Variables.ContainsKey(SubscriptionIdKey))
                {
                    AzureRmProfileProvider.Instance.Profile.DefaultContext.Subscription.Id = HttpMockServer.Variables[SubscriptionIdKey];
                }
            }

            var client = context.GetGraphServiceClient <GraphRbacManagementClient>(environment);

            client.TenantID = tenantId;
            if (AzureRmProfileProvider.Instance != null &&
                AzureRmProfileProvider.Instance.Profile != null &&
                AzureRmProfileProvider.Instance.Profile.DefaultContext != null &&
                AzureRmProfileProvider.Instance.Profile.DefaultContext.Tenant != null)
            {
                AzureRmProfileProvider.Instance.Profile.DefaultContext.Tenant.Id = client.TenantID;
            }
            return(client);
        }
 private static KeyVaultManagementClient GetKeyVaultManagementClient(MockContext context)
 {
     return(context.GetServiceClient <KeyVaultManagementClient>(TestEnvironmentFactory.GetTestEnvironment()));
 }
 private static ResourceManagementClientInternal GetResourceManagementClientInternal(MockContext context)
 {
     return(context.GetServiceClient <ResourceManagementClientInternal>(TestEnvironmentFactory.GetTestEnvironment()));
 }
Пример #15
0
 private static Management.Internal.Resources.ResourceManagementClient GetResourceManagementClient(MockContext context)
 {
     return(context.GetServiceClient <Management.Internal.Resources.ResourceManagementClient>(TestEnvironmentFactory.GetTestEnvironment()));
 }
Пример #16
0
 private static InsightsManagementClient GetInsightsManagementClient(MockContext context)
 {
     return(context.GetServiceClient <InsightsManagementClient>(TestEnvironmentFactory.GetTestEnvironment()));
 }
Пример #17
0
 private Microsoft.Azure.Management.Internal.Resources.ResourceManagementClient GetNewResourceManagementClient(MockContext context)
 {
     return(context.GetServiceClient <Microsoft.Azure.Management.Internal.Resources.ResourceManagementClient>(TestEnvironmentFactory.GetTestEnvironment()));
 }
 private ResourceManagementClient GetResourceManagementClient(MockContext context)
 {
     return(context.GetServiceClient <ResourceManagementClient>(TestEnvironmentFactory.GetTestEnvironment()));
 }
Пример #19
0
        protected void SetupManagementClients(MockContext context)
        {
            ResourceManagementClient = context.GetServiceClient <ResourceManagementClient>(TestEnvironmentFactory.GetTestEnvironment());
            ManagedServicesClient    = context.GetServiceClient <ManagedServicesClient>(TestEnvironmentFactory.GetTestEnvironment());

            _helper.SetupManagementClients(
                ResourceManagementClient,
                ManagedServicesClient);
        }
Пример #20
0
 private static BillingManagementClient GetBillingManagementClient(MockContext context)
 {
     return(context.GetServiceClient <BillingManagementClient>(TestEnvironmentFactory.GetTestEnvironment()));
 }
Пример #21
0
 private static AuthorizationManagementClient GetAuthorizationManagementClient(MockContext context)
 {
     return(context.GetServiceClient <AuthorizationManagementClient>(TestEnvironmentFactory.GetTestEnvironment()));
 }
Пример #22
0
 private AnalysisServicesManagementClient GetAnalysisServicesManagementClient(MockContext context)
 {
     return(context.GetServiceClient <AnalysisServicesManagementClient>(TestEnvironmentFactory.GetTestEnvironment()));
 }
Пример #23
0
 private DataLakeStoreAccountManagementClient GetDataLakeStoreAccountManagementClient(MockContext context)
 {
     return(context.GetServiceClient <DataLakeStoreAccountManagementClient>(TestEnvironmentFactory.GetTestEnvironment()));
 }
 /// <summary>
 /// Creates WebSiteManagementClient instance  based on mode setting
 /// </summary>
 /// <param name="context">Mock undocontext</param>
 /// <returns>WebSiteManagementClient instance</returns>
 private WebSiteManagementClient GetWebsiteManagementClient(MockContext context)
 {
     return(context.GetServiceClient <WebSiteManagementClient>(TestEnvironmentFactory.GetTestEnvironment()));
 }
 private static NetworkManagementClientInternal GetNetworkManagementClientInternal(MockContext context)
 {
     return(context.GetServiceClient <NetworkManagementClientInternal>(TestEnvironmentFactory.GetTestEnvironment()));
 }
Пример #26
0
 private static AzureRestClient GetAzureRestClient(MockContext context)
 {
     return(context.GetServiceClient <AzureRestClient>(TestEnvironmentFactory.GetTestEnvironment()));
 }
 private static ComputeManagementClient GetComputeManagementClient(MockContext context)
 {
     return(context.GetServiceClient <ComputeManagementClient>(TestEnvironmentFactory.GetTestEnvironment()));
 }
Пример #28
0
 private PowerBIDedicatedManagementClient GetPowerBIEmbeddedCapacityManagementClient(MockContext context)
 {
     return(context.GetServiceClient <PowerBIDedicatedManagementClient>(TestEnvironmentFactory.GetTestEnvironment()));
 }
 private ServiceBusManagementClient GetServiceBusManagementClient(MockContext context)
 {
     return(context.GetServiceClient <ServiceBusManagementClient>(TestEnvironmentFactory.GetTestEnvironment()));
 }
Пример #30
0
 private GraphRbacManagementClient GetGraphRbacManagementClient(MockContext context)
 {
     return(context.GetGraphServiceClient <GraphRbacManagementClient>(TestEnvironmentFactory.GetTestEnvironment()));
 }