public AzureHDInsightJobSubmissionClientSimulator(
     IJobSubmissionClientCredential credential, AzureHDInsightClusterManagementClientSimulator.SimulatorClusterContainer cluster)
 {
     this.credentials = credential;
     this.cluster     = cluster;
     this.logger      = new Logger();
     this.InitializeSimulator();
 }
 public AzureHDInsightJobSubmissionClientSimulator(
     IJobSubmissionClientCredential credential, AzureHDInsightClusterManagementClientSimulator.SimulatorClusterContainer cluster)
 {
     this.credentials = credential;
     this.cluster = cluster;
     this.logger = new Logger();
     this.InitializeSimulator();
 }
Example #3
0
        public IJobSubmissionClient Create(IJobSubmissionClientCredential credentials)
        {
            var    asBasic        = credentials as BasicAuthCredential;
            var    asSubscription = credentials as JobSubmissionCertificateCredential;
            string clusterName    = string.Empty;

            if (asBasic != null)
            {
                clusterName = asBasic.Server.Host.Split('.').First();
            }
            else if (asSubscription != null)
            {
                clusterName = asSubscription.Cluster;
            }
            else
            {
                throw new NotSupportedException("Credential type :" + credentials.GetType().Name + ": is not supported");
            }

            string clusterUri = GatewayUriResolver.GetGatewayUri(clusterName).AbsoluteUri.ToUpperInvariant();

            if (!jobSubmissionClients.ContainsKey(clusterUri))
            {
                AzureHDInsightClusterManagementClientSimulator.SimulatorClusterContainer cluster =
                    AzureHDInsightClusterManagementClientSimulator.GetClusterInternal(clusterName);
                var jobClient = new AzureHDInsightJobSubmissionClientSimulator(credentials, cluster);
                jobSubmissionClients.Add(clusterUri, jobClient);
            }

            return(jobSubmissionClients[clusterUri]);
        }