public static void TestRunSetup() { // Sets the simulator var runManager = ServiceLocator.Instance.Locate<IServiceLocationSimulationManager>(); ServiceLocator.Instance.Locate<ILogger>().AddWriter(new ConsoleLogWriter(Severity.None, Verbosity.Diagnostic)); runManager.RegisterType<IAsvValidatorClientFactory, AsvValidatorSimulatorClientFactory>(); runManager.RegisterType<IHDInsightManagementRestClientFactory, HDInsightManagementRestSimulatorClientFactory>(); runManager.RegisterType<IRdfeServiceRestClientFactory, RdfeServiceRestSimulatorClientFactory>(); runManager.RegisterType<IAzureHDInsightClusterConfigurationAccessorFactory, AzureHDInsightClusterConfigurationAccessorSimulatorFactory>(); runManager.RegisterInstance<IWabStorageAbstractionFactory>(StorageAccountSimulatorFactory.Instance); runManager.RegisterType<IRemoteHadoopJobSubmissionPocoClientFactory, HadoopJobSubmissionPocoSimulatorClientFactory>(); runManager.RegisterType<IHDInsightJobSubmissionPocoClientFactory, HadoopJobSubmissionPocoSimulatorClientFactory>(); runManager.RegisterType<ISubscriptionRegistrationClientFactory, SubscriptionRegistrationSimulatorClientFactory>(); var testManager = new IntegrationTestManager(); if (!testManager.RunAzureTests()) { Assert.Inconclusive("Azure tests are not configured on this machine."); } IntegrationTestBase.TestCredentials = testManager.GetCredentials("default"); if (IntegrationTestBase.TestCredentials == null) { Assert.Inconclusive("No entry was found in the credential config file for the specified test configuration."); } // Sets the certificate var defaultCertificate = new X509Certificate2(IntegrationTestBase.TestCredentials.Certificate); // Sets the test static properties IntegrationTestBase.ClusterPrefix = string.Format("CLITest-{0}", Environment.GetEnvironmentVariable("computername") ?? "unknown"); // Sets the credential objects var tempCredentials = new HDInsightCertificateCredential() { SubscriptionId = TestCredentials.SubscriptionId, Certificate = defaultCertificate, Endpoint = new Uri(TestCredentials.Endpoint) }; IntegrationTestBase.validCredentials = ServiceLocator.Instance .Locate<IHDInsightSubscriptionCredentialsFactory>() .Create(tempCredentials); tempCredentials = new HDInsightCertificateCredential() { SubscriptionId = Guid.NewGuid(), Certificate = defaultCertificate }; IntegrationTestBase.invalidSubscriptionId = ServiceLocator.Instance .Locate<IHDInsightSubscriptionCredentialsFactory>() .Create(tempCredentials); tempCredentials = new HDInsightCertificateCredential() { SubscriptionId = TestCredentials.SubscriptionId, Certificate = new X509Certificate2(TestCredentials.InvalidCertificate), Endpoint = new Uri(TestCredentials.Endpoint) }; IntegrationTestBase.invalidCertificate = ServiceLocator.Instance .Locate<IHDInsightSubscriptionCredentialsFactory>() .Create(tempCredentials); // Prepares the environment IntegrationTestBase.CleanUpClusters(); }
public static void TestRunSetup() { // Sets the simulator var runManager = ServiceLocator.Instance.Locate <IServiceLocationSimulationManager>(); ServiceLocator.Instance.Locate <ILogger>().AddWriter(new ConsoleLogWriter(Severity.None, Verbosity.Diagnostic)); runManager.RegisterType <IAsvValidatorClientFactory, AsvValidatorSimulatorClientFactory>(); runManager.RegisterType <IHDInsightManagementRestClientFactory, HDInsightManagementRestSimulatorClientFactory>(); runManager.RegisterType <IRdfeServiceRestClientFactory, RdfeServiceRestSimulatorClientFactory>(); runManager.RegisterType <IAzureHDInsightClusterConfigurationAccessorFactory, AzureHDInsightClusterConfigurationAccessorSimulatorFactory>(); runManager.RegisterInstance <IWabStorageAbstractionFactory>(StorageAccountSimulatorFactory.Instance); runManager.RegisterType <IRemoteHadoopJobSubmissionPocoClientFactory, HadoopJobSubmissionPocoSimulatorClientFactory>(); runManager.RegisterType <IHDInsightJobSubmissionPocoClientFactory, HadoopJobSubmissionPocoSimulatorClientFactory>(); runManager.RegisterType <ISubscriptionRegistrationClientFactory, SubscriptionRegistrationSimulatorClientFactory>(); var testManager = new IntegrationTestManager(); if (!testManager.RunAzureTests()) { Assert.Inconclusive("Azure tests are not configured on this machine."); } IntegrationTestBase.TestCredentials = testManager.GetCredentials("default"); if (IntegrationTestBase.TestCredentials == null) { Assert.Inconclusive("No entry was found in the credential config file for the specified test configuration."); } // Sets the certificate var defaultCertificate = new X509Certificate2(IntegrationTestBase.TestCredentials.Certificate); // Sets the test static properties IntegrationTestBase.ClusterPrefix = string.Format("CLITest-{0}", Environment.GetEnvironmentVariable("computername") ?? "unknown"); // Sets the credential objects var tempCredentials = new HDInsightCertificateCredential() { SubscriptionId = TestCredentials.SubscriptionId, Certificate = defaultCertificate, Endpoint = new Uri(TestCredentials.Endpoint) }; IntegrationTestBase.validCredentials = ServiceLocator.Instance .Locate <IHDInsightSubscriptionCredentialsFactory>() .Create(tempCredentials); tempCredentials = new HDInsightCertificateCredential() { SubscriptionId = Guid.NewGuid(), Certificate = defaultCertificate }; IntegrationTestBase.invalidSubscriptionId = ServiceLocator.Instance .Locate <IHDInsightSubscriptionCredentialsFactory>() .Create(tempCredentials); tempCredentials = new HDInsightCertificateCredential() { SubscriptionId = TestCredentials.SubscriptionId, Certificate = new X509Certificate2(TestCredentials.InvalidCertificate), Endpoint = new Uri(TestCredentials.Endpoint) }; IntegrationTestBase.invalidCertificate = ServiceLocator.Instance .Locate <IHDInsightSubscriptionCredentialsFactory>() .Create(tempCredentials); // Prepares the environment IntegrationTestBase.CleanUpClusters(); }