< Summary

Class:Microsoft.Azure.HDInsight.Job.HDInsightJobClient
Assembly:Microsoft.Azure.HDInsight.Job
File(s):C:\Git\azure-sdk-for-net\sdk\hdinsight\Microsoft.Azure.HDInsight.Job\src\Customizations\HDInsightJobManagementClient.Config.cs
C:\Git\azure-sdk-for-net\sdk\hdinsight\Microsoft.Azure.HDInsight.Job\src\Customizations\HDInsightJobManagementClient.Customization.cs
C:\Git\azure-sdk-for-net\sdk\hdinsight\Microsoft.Azure.HDInsight.Job\src\Generated\HDInsightJobClient.cs
Covered lines:76
Uncovered lines:19
Coverable lines:95
Total lines:362
Line coverage:80% (76 of 95)
Covered branches:8
Total branches:20
Branch coverage:40% (8 of 20)

Metrics

MethodCyclomatic complexity Line coverage Branch coverage
.cctor()-100%100%
get_HDInsightRetryPolicy()-100%100%
.ctor(...)-100%75%
.ctor(...)-100%50%
CustomInitialize()-100%100%
get_BaseUri()-100%100%
get_SerializationSettings()-100%100%
get_DeserializationSettings()-100%100%
get_Credentials()-100%100%
get_Endpoint()-100%100%
get_Username()-100%100%
get_AcceptLanguage()-100%100%
get_LongRunningOperationRetryTimeout()-0%100%
get_GenerateClientRequestId()-100%100%
get_Job()-100%100%
.ctor(...)-100%100%
.ctor(...)-100%100%
.ctor(...)-0%100%
.ctor(...)-85.71%75%
.ctor(...)-0%0%
.ctor(...)-0%0%
Initialize()-100%100%

File(s)

C:\Git\azure-sdk-for-net\sdk\hdinsight\Microsoft.Azure.HDInsight.Job\src\Customizations\HDInsightJobManagementClient.Config.cs

#LineLine coverage
 1// Copyright (c) Microsoft Corporation. All rights reserved.
 2// Licensed under the MIT License. See License.txt in the project root for
 3// license information.
 4
 5namespace Microsoft.Azure.HDInsight.Job
 6{
 7    using Microsoft.Rest;
 8    using System;
 9
 10    public partial class HDInsightJobClient : ServiceClient<HDInsightJobClient>, IHDInsightJobClient
 11    {
 212        private static readonly TimeSpan MinBackOff = TimeSpan.FromMinutes(0);
 213        private static readonly TimeSpan MaxBackOff = TimeSpan.FromMinutes(8);
 14        private const int RetryCount = 5;
 215        private static readonly TimeSpan DeltaBackOff = TimeSpan.FromMinutes(1);
 16
 17        /// <summary>
 18        /// The default poll interval to get job status for the HDInsight Job Management Client.
 19        /// </summary>
 220        public static readonly TimeSpan DefaultPollInterval = TimeSpan.FromSeconds(30);
 21    }
 22}

C:\Git\azure-sdk-for-net\sdk\hdinsight\Microsoft.Azure.HDInsight.Job\src\Customizations\HDInsightJobManagementClient.Customization.cs

#LineLine coverage
 1// Copyright (c) Microsoft Corporation. All rights reserved.
 2// Licensed under the MIT License. See License.txt in the project root for
 3// license information.
 4
 5namespace Microsoft.Azure.HDInsight.Job
 6{
 7    using System;
 8    using System.Globalization;
 9    using System.Net.Http;
 10    using Microsoft.Rest;
 11    using Microsoft.Rest.TransientFaultHandling;
 12
 13    /// <summary>
 14    /// The HDInsight job client manages jobs against HDInsight clusters.
 15    /// </summary>
 16    public partial class HDInsightJobClient : ServiceClient<HDInsightJobClient>, IHDInsightJobClient
 17    {
 18        /// <summary>
 19        /// Gets the recommended Retry Policy for the HDInsight Job Management Client.
 20        /// </summary>
 21        public static RetryPolicy HDInsightRetryPolicy
 22        {
 23            get
 24            {
 825                return new RetryPolicy<HttpStatusCodeErrorDetectionStrategy>(
 826                    RetryCount, MinBackOff,
 827                    MaxBackOff, DeltaBackOff);
 28            }
 29        }
 30
 31        /// <summary>
 32        /// Initializes a new instance of the HDInsightJobClient
 33        /// class.
 34        /// <param name='credentials'>
 35        /// Required. Basic authentication credentials for job submission.
 36        /// </param>
 37        /// </summary>
 38        /// <param name='clusterDnsName'>
 39        /// Required. The cluster dns name against which the job management is
 40        /// to be performed.
 41        /// </param>
 42        /// <param name='userName'>
 43        /// Required. The user name used for running job.
 44        /// </param>
 45        /// <param name='retryPolicy'>
 46        /// Optional. Retry Policy for Http Transient errors.
 47        /// </param>
 48        public HDInsightJobClient(string endpoint, BasicAuthenticationCredentials credentials, RetryPolicy retryPolicy =
 849            : this(credentials)
 50        {
 851            if (retryPolicy == null)
 52            {
 53                // If No retry policy is provided then use default retry policy
 854                retryPolicy = HDInsightJobClient.HDInsightRetryPolicy;
 55            }
 56
 857            this.Endpoint = endpoint ?? throw new ArgumentNullException("endpoint");
 858            this.Username = CultureInfo.CurrentCulture.TextInfo.ToLower(credentials.UserName);
 859            this.SetRetryPolicy(retryPolicy);
 860        }
 61
 62        /// <summary>
 63        /// Initializes a new instance of the HDInsightJobClient
 64        /// class.
 65        /// </summary>
 66        /// <param name='clusterDnsName'>
 67        /// Required. The cluster dns name against which the job management is
 68        /// to be performed.
 69        /// </param>
 70        /// <param name='credentials'>
 71        /// Required. Basic authentication credentials for job submission.
 72        /// </param>
 73        /// <param name='httpClient'>
 74        /// The Http client
 75        /// </param>
 76        public HDInsightJobClient(string endpoint, BasicAuthenticationCredentials credentials, HttpClient httpClient, bo
 277            : this(httpClient, disposeHttpClient)
 78        {
 279            this.Endpoint = endpoint ?? throw new ArgumentNullException("endpoint");
 280            this.Credentials = credentials ?? throw new ArgumentNullException("credentials");
 81
 282            this.Credentials.InitializeServiceClient(this);
 283            this.Username = CultureInfo.CurrentCulture.TextInfo.ToLower(credentials.UserName);
 284        }
 85
 86        /// <summary>
 87        /// An optional partial-method to perform custom initialization.
 88        /// </summary>
 89        partial void CustomInitialize()
 90        {
 91            // Having Http client time same as MaxBackOff seems to be not sufficient. This is still
 92            // raising TaskCancellation Exception. Setting value MaxBackOff + 2 mins for HDinsight
 93            // gateway time and having 1 min extra buffer.
 5894            this.HttpClient.Timeout = MaxBackOff.Add(TimeSpan.FromMinutes(3));
 5895        }
 96    }
 97}

C:\Git\azure-sdk-for-net\sdk\hdinsight\Microsoft.Azure.HDInsight.Job\src\Generated\HDInsightJobClient.cs

#LineLine coverage
 1// <auto-generated>
 2// Copyright (c) Microsoft Corporation. All rights reserved.
 3// Licensed under the MIT License. See License.txt in the project root for
 4// license information.
 5//
 6// Code generated by Microsoft (R) AutoRest Code Generator.
 7// Changes may cause incorrect behavior and will be lost if the code is
 8// regenerated.
 9// </auto-generated>
 10
 11namespace Microsoft.Azure.HDInsight.Job
 12{
 13    using Microsoft.Rest;
 14    using Microsoft.Rest.Azure;
 15    using Microsoft.Rest.Serialization;
 16    using Models;
 17    using Newtonsoft.Json;
 18    using System.Collections;
 19    using System.Collections.Generic;
 20    using System.Linq;
 21    using System.Net;
 22    using System.Net.Http;
 23
 24    /// <summary>
 25    /// The HDInsight Job Client.
 26    /// </summary>
 27    public partial class HDInsightJobClient : ServiceClient<HDInsightJobClient>, IHDInsightJobClient, IAzureClient
 28    {
 29        /// <summary>
 30        /// The base URI of the service.
 31        /// </summary>
 61432        internal string BaseUri {get; set;}
 33
 34        /// <summary>
 35        /// Gets or sets json serialization settings.
 36        /// </summary>
 12437        public JsonSerializerSettings SerializationSettings { get; private set; }
 38
 39        /// <summary>
 40        /// Gets or sets json deserialization settings.
 41        /// </summary>
 67242        public JsonSerializerSettings DeserializationSettings { get; private set; }
 43
 44        /// <summary>
 45        /// Credentials needed for the client to connect to Azure.
 46        /// </summary>
 128447        public ServiceClientCredentials Credentials { get; private set; }
 48
 49        /// <summary>
 50        /// The cluster endpoint, for example https://clustername.azurehdinsight.net.
 51        /// </summary>
 117252        public string Endpoint { get; set; }
 53
 54        /// <summary>
 55        /// The user name used for running job.
 56        /// </summary>
 34657        public string Username { get; set; }
 58
 59        /// <summary>
 60        /// The preferred language for the response.
 61        /// </summary>
 117062        public string AcceptLanguage { get; set; }
 63
 64        /// <summary>
 65        /// The retry timeout in seconds for Long Running Operations. Default value is
 66        /// 30.
 67        /// </summary>
 068        public int? LongRunningOperationRetryTimeout { get; set; }
 69
 70        /// <summary>
 71        /// Whether a unique x-ms-client-request-id should be generated. When set to
 72        /// true a unique x-ms-client-request-id value is generated and included in
 73        /// each request. Default is true.
 74        /// </summary>
 117075        public bool? GenerateClientRequestId { get; set; }
 76
 77        /// <summary>
 78        /// Gets the IJobOperations.
 79        /// </summary>
 21080        public virtual IJobOperations Job { get; private set; }
 81
 82        /// <summary>
 83        /// Initializes a new instance of the HDInsightJobClient class.
 84        /// </summary>
 85        /// <param name='httpClient'>
 86        /// HttpClient to be used
 87        /// </param>
 88        /// <param name='disposeHttpClient'>
 89        /// True: will dispose the provided httpClient on calling HDInsightJobClient.Dispose(). False: will not dispose 
 290        protected HDInsightJobClient(HttpClient httpClient, bool disposeHttpClient) : base(httpClient, disposeHttpClient
 91        {
 292            Initialize();
 293        }
 94
 95        /// <summary>
 96        /// Initializes a new instance of the HDInsightJobClient class.
 97        /// </summary>
 98        /// <param name='handlers'>
 99        /// Optional. The delegating handlers to add to the http client pipeline.
 100        /// </param>
 56101        protected HDInsightJobClient(params DelegatingHandler[] handlers) : base(handlers)
 102        {
 56103            Initialize();
 56104        }
 105
 106        /// <summary>
 107        /// Initializes a new instance of the HDInsightJobClient class.
 108        /// </summary>
 109        /// <param name='rootHandler'>
 110        /// Optional. The http client handler used to handle http transport.
 111        /// </param>
 112        /// <param name='handlers'>
 113        /// Optional. The delegating handlers to add to the http client pipeline.
 114        /// </param>
 0115        protected HDInsightJobClient(HttpClientHandler rootHandler, params DelegatingHandler[] handlers) : base(rootHand
 116        {
 0117            Initialize();
 0118        }
 119
 120        /// <summary>
 121        /// Initializes a new instance of the HDInsightJobClient class.
 122        /// </summary>
 123        /// <param name='credentials'>
 124        /// Required. Credentials needed for the client to connect to Azure.
 125        /// </param>
 126        /// <param name='handlers'>
 127        /// Optional. The delegating handlers to add to the http client pipeline.
 128        /// </param>
 129        /// <exception cref="System.ArgumentNullException">
 130        /// Thrown when a required parameter is null
 131        /// </exception>
 56132        internal HDInsightJobClient(ServiceClientCredentials credentials, params DelegatingHandler[] handlers) : this(ha
 133        {
 56134            if (credentials == null)
 135            {
 0136                throw new System.ArgumentNullException("credentials");
 137            }
 56138            Credentials = credentials;
 56139            if (Credentials != null)
 140            {
 56141                Credentials.InitializeServiceClient(this);
 142            }
 56143        }
 144
 145        /// <summary>
 146        /// Initializes a new instance of the HDInsightJobClient class.
 147        /// </summary>
 148        /// <param name='credentials'>
 149        /// Required. Credentials needed for the client to connect to Azure.
 150        /// </param>
 151        /// <param name='httpClient'>
 152        /// HttpClient to be used
 153        /// </param>
 154        /// <param name='disposeHttpClient'>
 155        /// True: will dispose the provided httpClient on calling HDInsightJobClient.Dispose(). False: will not dispose 
 156        /// <exception cref="System.ArgumentNullException">
 157        /// Thrown when a required parameter is null
 158        /// </exception>
 0159        internal HDInsightJobClient(ServiceClientCredentials credentials, HttpClient httpClient, bool disposeHttpClient)
 160        {
 0161            if (credentials == null)
 162            {
 0163                throw new System.ArgumentNullException("credentials");
 164            }
 0165            Credentials = credentials;
 0166            if (Credentials != null)
 167            {
 0168                Credentials.InitializeServiceClient(this);
 169            }
 0170        }
 171
 172        /// <summary>
 173        /// Initializes a new instance of the HDInsightJobClient class.
 174        /// </summary>
 175        /// <param name='credentials'>
 176        /// Required. Credentials needed for the client to connect to Azure.
 177        /// </param>
 178        /// <param name='rootHandler'>
 179        /// Optional. The http client handler used to handle http transport.
 180        /// </param>
 181        /// <param name='handlers'>
 182        /// Optional. The delegating handlers to add to the http client pipeline.
 183        /// </param>
 184        /// <exception cref="System.ArgumentNullException">
 185        /// Thrown when a required parameter is null
 186        /// </exception>
 0187        internal HDInsightJobClient(ServiceClientCredentials credentials, HttpClientHandler rootHandler, params Delegati
 188        {
 0189            if (credentials == null)
 190            {
 0191                throw new System.ArgumentNullException("credentials");
 192            }
 0193            Credentials = credentials;
 0194            if (Credentials != null)
 195            {
 0196                Credentials.InitializeServiceClient(this);
 197            }
 0198        }
 199
 200        /// <summary>
 201        /// An optional partial-method to perform custom initialization.
 202        /// </summary>
 203        partial void CustomInitialize();
 204        /// <summary>
 205        /// Initializes client properties.
 206        /// </summary>
 207        private void Initialize()
 208        {
 58209            Job = new JobOperations(this);
 58210            BaseUri = "https://{endpoint}";
 58211            AcceptLanguage = "en-US";
 58212            LongRunningOperationRetryTimeout = 30;
 58213            GenerateClientRequestId = true;
 58214            SerializationSettings = new JsonSerializerSettings
 58215            {
 58216                Formatting = Newtonsoft.Json.Formatting.Indented,
 58217                DateFormatHandling = Newtonsoft.Json.DateFormatHandling.IsoDateFormat,
 58218                DateTimeZoneHandling = Newtonsoft.Json.DateTimeZoneHandling.Utc,
 58219                NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore,
 58220                ReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Serialize,
 58221                ContractResolver = new ReadOnlyJsonContractResolver(),
 58222                Converters = new List<JsonConverter>
 58223                    {
 58224                        new Iso8601TimeSpanConverter()
 58225                    }
 58226            };
 58227            DeserializationSettings = new JsonSerializerSettings
 58228            {
 58229                DateFormatHandling = Newtonsoft.Json.DateFormatHandling.IsoDateFormat,
 58230                DateTimeZoneHandling = Newtonsoft.Json.DateTimeZoneHandling.Utc,
 58231                NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore,
 58232                ReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Serialize,
 58233                ContractResolver = new ReadOnlyJsonContractResolver(),
 58234                Converters = new List<JsonConverter>
 58235                    {
 58236                        new Iso8601TimeSpanConverter()
 58237                    }
 58238            };
 58239            CustomInitialize();
 58240            DeserializationSettings.Converters.Add(new CloudErrorJsonConverter());
 58241        }
 242    }
 243}