/* * конфигурация команд клиента */ private static CommandArray <ClientData> ConfigureCommands() { CommandArray <ClientData> res = new CommandArray <ClientData>(); res.AddCommand((c) => { ICommand cmd = new CommandStress(); c.Name = "stress"; c.Execute = (ClientData[] arguments) => { cmd.Execute(arguments[0]); }; }); res.AddCommand((c) => { ICommand cmd = new CommandLoad(); c.Name = "load"; c.Execute = (ClientData[] arguments) => { cmd.Execute(arguments[0]); }; }); res.AddCommand((c) => { ICommand cmd = new CommandPerformance(); c.Name = "performance"; c.Execute = (ClientData[] arguments) => { cmd.Execute(arguments[0]); }; }); return(res); }
/* * создание управляющих сервером команд */ private static void ConfigureCommands() { commands = new CommandArray <ClientData>(); commands.AddCommand((c) => { //добавляет клиента и записывает как его найти IServerCommand cmd = new CommandAddClient(dataHolder); c.Name = "AddClient"; c.Execute = (ClientData[] arguments) => { cmd.Execute(arguments[0]); }; }); commands.AddCommand((c) => { //фильтрует клиентов по имени и группе IServerCommand cmd = new CommandClients(dataHolder); c.Name = "clients"; c.Execute = (ClientData[] arguments) => { cmd.Execute(arguments[0]); }; }); commands.AddCommand((c) => { //проводит стресс тестирование IServerCommand cmd = new CommandStressTest(dataHolder); c.Name = "stress"; c.Execute = (ClientData[] arguments) => { cmd.Execute(arguments[0]); }; }); commands.AddCommand((c) => {//проводит нагрузочное тестирование IServerCommand cmd = new CommandLoadTest(dataHolder); c.Name = "load"; c.Execute = (ClientData[] arguments) => { cmd.Execute(arguments[0]); }; }); commands.AddCommand((c) => {//проводит тестирование производительности IServerCommand cmd = new CommandPerformance(dataHolder); c.Name = "performance"; c.Execute = (ClientData[] arguments) => { cmd.Execute(arguments[0]); }; }); }