/// <summary> /// Initializes a new instance of CmRestTest. /// </summary> /// <param name="cmUrl">The URL of the chassis manager, including port information.</param> /// <param name="username">The username used to send web requests.</param> /// <param name="password">The password corresponding to the username.</param> /// <param name="loggers">Loggers for the test. If it is null, default loggers will be used.</param> public CmRestTest(string cmUrl, string username, string password, string testDomainUser, string testDomainName, IEnumerable <ILogger> loggers = null) { if (string.IsNullOrWhiteSpace(cmUrl)) { throw new ArgumentNullException("cmUrl"); } var uri = new Uri(cmUrl); NetworkCredential cre = !string.IsNullOrWhiteSpace(username) ? new NetworkCredential(username, password) : null; var testEnvironmentSetting = new Dictionary <string, string>(); testEnvironmentSetting.Add("CMURL", cmUrl); testEnvironmentSetting.Add("AdminUserName", username); testEnvironmentSetting.Add("DefaultPassword", password); testEnvironmentSetting.Add("LabDomainTestUser", testDomainUser); testEnvironmentSetting.Add("LabDomainName", testDomainName); // Logging still occur on the Main Channel this.Initialize(uri, cre, loggers); // Test channel collection this.InitializeRestChannelCollection(uri, username, password); if (this.channel != null) { this.bladeCommands = new BladeCommands(this.channel); this.serialCommands = new SerialConsoleCommands(this.channel); } if (this.channel != null && this.restChannelContexts != null) { this.chassisCommands = new ChassisCommands(this.channel, this.restChannelContexts); this.usrMgmntCmnds = new UserManagementCommands(this.channel, this.restChannelContexts, testEnvironmentSetting); this.powerCmnds = new PowerCommands(this.channel, this.restChannelContexts, testEnvironmentSetting); this.acSocketPowerCmnds = new AcSocketPowerCommands(this.channel, this.restChannelContexts); this.nextBootCmnds = new NextBootCommands(this.channel, this.restChannelContexts); this.bladeCommands = new BladeCommands(this.channel, this.restChannelContexts); this.assetManagementCommands = new AssetManagementCommands(this.channel, this.restChannelContexts, testEnvironmentSetting); this.logCommands = new LogCommands(this.channel, this.restChannelContexts, testEnvironmentSetting); this.psuFirmwareCommands = new PsuFirmwareCommands(this.channel, this.restChannelContexts, testEnvironmentSetting); this.serialCommands = new SerialConsoleCommands(this.channel, this.restChannelContexts); this.bladeMezzCommands = new BladeMezzCommands(this.channel, this.restChannelContexts); } else { throw new Exception("Channel not created upon Initialization"); } }
/// <summary> /// Initializes a new instance of CmRestTest. /// </summary> /// <param name="cmUrl">The URL of the chassis manager, including port information.</param> /// <param name="username">The username used to send web requests.</param> /// <param name="password">The password corresponding to the username.</param> /// <param name="loggers">Loggers for the test. If it is null, default loggers will be used.</param> public CmRestTest(string cmUrl, string username, string password, string testDomainUser, string testDomainName, IEnumerable<ILogger> loggers = null) { if (string.IsNullOrWhiteSpace(cmUrl)) { throw new ArgumentNullException("cmUrl"); } var uri = new Uri(cmUrl); NetworkCredential cre = !string.IsNullOrWhiteSpace(username) ? new NetworkCredential(username, password) : null; var testEnvironmentSetting = new Dictionary<string, string>(); testEnvironmentSetting.Add("CMURL", cmUrl); testEnvironmentSetting.Add("AdminUserName", username); testEnvironmentSetting.Add("DefaultPassword", password); testEnvironmentSetting.Add("LabDomainTestUser", testDomainUser); testEnvironmentSetting.Add("LabDomainName", testDomainName); // Logging still occur on the Main Channel this.Initialize(uri, cre, loggers); // Test channel collection this.InitializeRestChannelCollection(uri, username, password); if (this.channel != null) { this.bladeCommands = new BladeCommands(this.channel); this.serialCommands = new SerialConsoleCommands(this.channel); } if (this.channel != null && this.restChannelContexts != null) { this.chassisCommands = new ChassisCommands(this.channel, this.restChannelContexts); this.usrMgmntCmnds = new UserManagementCommands(this.channel, this.restChannelContexts, testEnvironmentSetting); this.powerCmnds = new PowerCommands(this.channel, this.restChannelContexts, testEnvironmentSetting); this.acSocketPowerCmnds = new AcSocketPowerCommands(this.channel, this.restChannelContexts); this.nextBootCmnds = new NextBootCommands(this.channel, this.restChannelContexts); this.bladeCommands = new BladeCommands(this.channel, this.restChannelContexts); this.assetManagementCommands = new AssetManagementCommands(this.channel, this.restChannelContexts, testEnvironmentSetting); this.logCommands = new LogCommands(this.channel, this.restChannelContexts, testEnvironmentSetting); } else { throw new Exception("Channel not created upon Initialization"); } }