public long GetProcessorL4Cache(IServerConnectionService connectionService) { var command = commandProvider.GetCommand(nameof(GetProcessorL4Cache)); command.ThrowError = true; var result = connectionService.ExecuteCommand(command); return(long.Parse(result.Result)); }
public ulong GetTotalSwap(IServerConnectionService connectionService) { var command = commandProvider.GetCommand(nameof(GetTotalSwap)); command.ThrowError = true; var result = connectionService.ExecuteCommand(command); return(ulong.Parse(result.Result)); }
public int GetCpuNumber(IServerConnectionService connectionService) { var command = commandProvider.GetCommand(nameof(GetCpuNumber)); command.ThrowError = true; var result = connectionService.ExecuteCommand(command); return(int.Parse(result.Result)); }
public string GetProcessorType(IServerConnectionService connectionService) { var command = commandProvider.GetCommand(nameof(GetProcessorType)); command.ThrowError = true; var result = connectionService.ExecuteCommand(command); return(result.Result); }
public string GetOperatingSystemVersion(IServerConnectionService connectionService) { var command = commandProvider.GetCommand(nameof(GetOperatingSystemVersion)); command.ThrowError = true; var result = connectionService.ExecuteCommand(command); return(result.Result); }
public bool GetIsVirtual(IServerConnectionService connectionService) { var command = commandProvider.GetCommand(nameof(GetIsVirtual)); command.ThrowError = true; var result = connectionService.ExecuteCommand(command); return(!string.IsNullOrEmpty(result.Result)); }
public IPAddress GetIPAddress(IServerConnectionService connectionService) { var command = commandProvider.GetCommand(nameof(GetIPAddress)); command.ThrowError = true; var result = connectionService.ExecuteCommand(command); return(IPAddress.Parse(result.Result)); }
public ClientTestUpdater(string serverId, int serverPort) { _serverConnectionService = new ServerConnectionService(serverId, serverPort); _subjectFileService = new SubjectFileService(ConfigContainer.GetConfig <ClientConfig>().SaveFolder); _platoonFileService = new PlatoonFileService(ConfigContainer.GetConfig <ClientConfig>().SaveFolder); var config = ConfigContainer.GetConfig <ClientConfig>(); _clientTestFileService = new ClientTestFileService(config.TestFolder, config.ImageFolder); }
public ulong GetUsedMemory(IServerConnectionService connectionService) { var command = commandProvider.GetCommand(nameof(GetUsedMemory)); if (string.IsNullOrEmpty(command.Text)) { return(GetTotalMemory(connectionService) - GetFreeMemory(connectionService)); } command.ThrowError = true; var result = connectionService.ExecuteCommand(command); return(ulong.Parse(result.Result)); }
public static void Initialize(TestContext testContext) { Environment.CurrentDirectory += "\\..\\..\\..\\"; var builder = new ConfigurationBuilder() .AddJsonFile("appsettings.powershell.json", optional: true, reloadOnChange: true); var serviceCollection = new ServiceCollection() .Configure <InfraWatcherOption>(builder.Build()) .AddScoped <ICommandProvider, DefaultCommandProvider>() .AddScoped <IServerInfoService, ServerInfoService>() .AddScoped <IServerMemoryService, ServerMemoryService>() .AddScoped <IServerOperatingSystemService, ServerOperatingSystemService>() .AddScoped <IServerProcessorService, ServerProcessorService>() .AddScoped <IServerConnectionService, PowerShellConnectionService>(); var serviceProvider = serviceCollection .BuildServiceProvider(); ServerConnectionService = serviceProvider.GetService <IServerConnectionService>(); ServerConnectionService.Connect(ServerConnection); ServerInfoService = serviceProvider.GetService <IServerInfoService>(); }