public virtual void SetupManagementClientForJobTests() { // Update HDInsight Management properties for Job. var cluster1 = new Cluster { Id = "/subscriptions/" + Guid.NewGuid() + "/resourceGroups/" + ResourceGroupName + "/providers/Microsoft.HDInsight/clusters/" + ClusterName, Name = ClusterName, Location = Location, Properties = new ClusterGetProperties { ClusterVersion = "3.2", ClusterState = "Running", ClusterDefinition = new ClusterDefinition { ClusterType = ClusterType }, QuotaInfo = new QuotaInfo { CoresUsed = 24 }, OperatingSystemType = OSType.Windows, ConnectivityEndpoints = new List <ConnectivityEndpoint> { new ConnectivityEndpoint { Location = ClusterName, Name = "HTTPS" } } } }; var listresponse = new ClusterListResponse { Clusters = new[] { cluster1 } }; hdinsightManagementMock.Setup(c => c.ListClusters()) .Returns(listresponse) .Verifiable(); hdinsightManagementMock.Setup(c => c.GetCluster(It.IsAny <string>(), It.IsAny <string>())) .Returns(new List <Cluster> { cluster1 }) .Verifiable(); var configurationResponse = new Dictionary <string, string>(); configurationResponse.Add("fs.defaultFS", "wasb://[email protected]"); configurationResponse.Add("fs.azure.account.key.xyz.blob.core.windows.net", "tempkey"); hdinsightManagementMock.Setup(c => c.GetClusterConfigurations(It.IsAny <string>(), It.IsAny <string>(), It.IsAny <string>())) .Returns(configurationResponse) .Verifiable(); }
public virtual void SetupManagementClientForJobTests() { // Update HDInsight Management properties for Job. var cluster1 = new Cluster { Id = "/subscriptions/" + Guid.NewGuid() + "/resourceGroups/" + ResourceGroupName + "/providers/Microsoft.HDInsight/clusters/" + ClusterName, Name = ClusterName, Location = Location, Properties = new ClusterGetProperties { ClusterVersion = "3.2", ClusterState = "Running", ClusterDefinition = new ClusterDefinition { ClusterType = ClusterType }, QuotaInfo = new QuotaInfo { CoresUsed = 24 }, OperatingSystemType = OSType.Windows, ConnectivityEndpoints = new List<ConnectivityEndpoint> { new ConnectivityEndpoint { Location = ClusterName, Name = "HTTPS" } } } }; var listresponse = new ClusterListResponse { Clusters = new[] { cluster1 } }; hdinsightManagementMock.Setup(c => c.ListClusters()) .Returns(listresponse) .Verifiable(); hdinsightManagementMock.Setup(c => c.GetCluster(It.IsAny<string>(), It.IsAny<string>())) .Returns(new List<Cluster> { cluster1 }) .Verifiable(); var configurationResponse = new Dictionary<string, string>(); hdinsightManagementMock.Setup(c => c.GetClusterConfigurations(It.IsAny<string>(), It.IsAny<string>(), It.IsAny<string>())) .Returns(configurationResponse) .Verifiable(); }
public void CanListHDInsightClustersInRG() { cmdlet.ResourceGroupName = ResourceGroupName; var cluster1 = new Cluster { Id = "id", Name = ClusterName + "1", Location = Location, Properties = new ClusterGetProperties { ClusterVersion = "3.1", ClusterState = "Running", ClusterDefinition = new ClusterDefinition { ClusterType = ClusterType }, QuotaInfo = new QuotaInfo { CoresUsed = 24 }, OperatingSystemType = OSType.Windows } }; var cluster2 = new Cluster { Id = "id", Name = ClusterName + "2", Location = Location, Properties = new ClusterGetProperties { ClusterVersion = "3.1", ClusterState = "Running", ClusterDefinition = new ClusterDefinition { ClusterType = ClusterType }, QuotaInfo = new QuotaInfo { CoresUsed = 24 }, OperatingSystemType = OSType.Windows } }; var listresponse = new ClusterListResponse { Clusters = new[] { cluster1, cluster2 } }; hdinsightManagementMock.Setup(c => c.ListClusters(ResourceGroupName)) .Returns(listresponse) .Verifiable(); hdinsightManagementMock.Setup(c => c.GetCluster(It.IsAny <string>(), It.IsAny <string>())) .CallBase() .Verifiable(); cmdlet.ExecuteCmdlet(); commandRuntimeMock.VerifyAll(); commandRuntimeMock.Verify( f => f.WriteObject( It.Is <List <AzureHDInsightCluster> >( list => list.Count == 2 && list.Any(c => c.Name == cluster1.Name) && list.Any(c => c.Name == cluster2.Name)), true), Times.Once); }
public void CanListHDInsightClustersInRG() { cmdlet.ResourceGroupName = ResourceGroupName; var cluster1 = new Cluster { Id = "id", Name = ClusterName + "1", Location = Location, Properties = new ClusterGetProperties { ClusterVersion = "3.1", ClusterState = "Running", ClusterDefinition = new ClusterDefinition { ClusterType = ClusterType }, QuotaInfo = new QuotaInfo { CoresUsed = 24 }, OperatingSystemType = OSType.Windows } }; var cluster2 = new Cluster { Id = "id", Name = ClusterName + "2", Location = Location, Properties = new ClusterGetProperties { ClusterVersion = "3.1", ClusterState = "Running", ClusterDefinition = new ClusterDefinition { ClusterType = ClusterType }, QuotaInfo = new QuotaInfo { CoresUsed = 24 }, OperatingSystemType = OSType.Windows } }; var listresponse = new ClusterListResponse {Clusters = new[] {cluster1, cluster2}}; hdinsightManagementMock.Setup(c => c.ListClusters(ResourceGroupName)) .Returns(listresponse) .Verifiable(); hdinsightManagementMock.Setup(c => c.GetCluster(It.IsAny<string>(), It.IsAny<string>())) .CallBase() .Verifiable(); cmdlet.ExecuteCmdlet(); commandRuntimeMock.VerifyAll(); commandRuntimeMock.Verify( f => f.WriteObject( It.Is<List<AzureHDInsightCluster>>( list => list.Count == 2 && list.Any(c => c.Name == cluster1.Name) && list.Any(c => c.Name == cluster2.Name)), true), Times.Once); }