#include "testPresetHandler.hpp" CPPUNIT_TEST_SUITE_REGISTRATION (testPresetHandler); void testPresetHandler::setUp (void) { cliHandle = new CLIHandler(); outputHandle = new outputHandler(); int ac = 6; char *av[] = {"--verbose", "--mode=\"7-mode\"", "--nodes=10.72.57.222", "--preset-file=\"perfstat.preset\"", "--sshprivatekey-file=\"myperf\"", "--SSH"} ; cliHandle->collectCLIOptions(ac, av, outputHandle); //load the user defined preset file presetHandle.loadPresetFile(cliHandle, outputHandle); } void testPresetHandler::tearDown(void) { delete cliHandle; delete outputHandle; } void testPresetHandler::testUserPresetFile(void) { vecPresetStats = presetHandle.getAllPrestatsCommands(); //We have 2 prestat commands in the template preset file CPPUNIT_ASSERT_EQUAL (int(vecPresetStats.size()),2); vecPresetStats = presetHandle.getAllPoststatsCommands(); //We have 2 poststat commands in the template preset file CPPUNIT_ASSERT_EQUAL (int(vecPresetStats.size()),2); vecPresetStats = presetHandle.getAllParallelCommands(); //We have 2 parallel commands in the template preset file CPPUNIT_ASSERT_EQUAL (int(vecPresetStats.size()),2); } void testPresetHandler::testGetCommandBySection(void) { //get all the prestat commands dedicated to filers aka NODE vecPresetStats = presetHandle.getCommandsBySection("PRESTATS","NODE"); //there are total number of prestat commands for NODE CPPUNIT_ASSERT_EQUAL (int(vecPresetStats.size()),1); //get all the prestat commands for the host vecPresetStats = presetHandle.getCommandsBySection("POSTSTATS","HOST"); //there are total number of prestat commands for host is 49 CPPUNIT_ASSERT_EQUAL (int(vecPresetStats.size()),1); } void testPresetHandler::testGetCommandByKey(void) { //get all the prestat 'CONFIG' type commands for NODE vecPresetStats = presetHandle.getPrestatsCommands("TYPE", "CONFIG", "NODE"); //There are total number of CONFIG prestat commands for NODE CPPUNIT_ASSERT_EQUAL (int(vecPresetStats.size()),1); //get all the prestat 'CONFIG' type commands for HOST vecPresetStats = presetHandle.getPrestatsCommands("TYPE", "CONFIG", "HOST"); //There are total number of CONFIG prestat commands for HOST CPPUNIT_ASSERT_EQUAL (int(vecPresetStats.size()),1); }