parent
d636ece26a
commit
88eaea7bfa
|
@ -110,7 +110,7 @@ int main( int argc, char * argv[] )
|
|||
std::cout << "Verbosity is INFO." << std::endl;
|
||||
}
|
||||
|
||||
Logger slog = Logger( L_LEVEL, "Examplar" );
|
||||
Logger slog = Logger( L_LEVEL, "examplar" );
|
||||
|
||||
// A Plan is made up of Tasks, and a Suite is made up of Units.
|
||||
// A Plan declares what units are executed and a Suite declares the definitions of those units.
|
||||
|
|
|
@ -66,7 +66,7 @@ protected:
|
|||
/// TODO Expand to detect when a directory path is supplied for units_path or plan_path and import all Tasks and Units.
|
||||
///
|
||||
/// \param filename - The filename to load the configuration from.
|
||||
Conf::Conf( std::string filename, int LOG_LEVEL ): JSON_Loader( LOG_LEVEL ), slog( LOG_LEVEL, "examplar::test" )
|
||||
Conf::Conf( std::string filename, int LOG_LEVEL ): JSON_Loader( LOG_LEVEL ), slog( LOG_LEVEL, "e_conf" )
|
||||
{
|
||||
this->LOG_LEVEL = LOG_LEVEL;
|
||||
|
||||
|
@ -122,6 +122,18 @@ Conf::Conf( std::string filename, int LOG_LEVEL ): JSON_Loader( LOG_LEVEL ), slo
|
|||
throw ConfigLoadException("env_vars_file is not set in the config file supplied: " + filename);
|
||||
}
|
||||
|
||||
this->env_vars_file_literal = this->execution_context_literal + "/" + this->env_vars_file.asString();
|
||||
|
||||
if ( exists( this->env_vars_file_literal ) )
|
||||
{
|
||||
this->slog.log( E_DEBUG, "Environment variables file exists: '" + this->env_vars_file_literal + "'." );
|
||||
} else {
|
||||
this->slog.log( E_FATAL, "Variables file does not exist: '" + this->env_vars_file_literal + "'.");
|
||||
throw ConfigLoadException( "env_vars_file points to an incorrect path." );
|
||||
}
|
||||
|
||||
|
||||
|
||||
};
|
||||
|
||||
/// Conf::has_context_override - Specifies whether or not the override context function is enabled in the conf file.
|
||||
|
@ -148,5 +160,5 @@ void Conf::set_execution_context( std::string execution_context )
|
|||
|
||||
std::string Conf::get_env_vars_file()
|
||||
{
|
||||
return this->env_vars_file.asString();
|
||||
return this->env_vars_file_literal;
|
||||
}
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
#include "../low_level/JSON_Loader.h"
|
||||
#include <exception>
|
||||
#include "../../Logger/Logger.h"
|
||||
|
||||
#include "../misc/helpers.h"
|
||||
|
||||
#define STRINGIZE2(s) #s
|
||||
#define STRINGIZE(s) STRINGIZE2(s)
|
||||
|
@ -39,6 +39,8 @@ private:
|
|||
Json::Value config_version;
|
||||
Json::Value env_vars_file;
|
||||
|
||||
std::string env_vars_file_literal;
|
||||
|
||||
// flag to indicate if execution context should be overriden in config file
|
||||
// if set to true Examplar should use whats in the config file for current working directory
|
||||
// if set to false, Examplar should use the current working directory at time of execution
|
||||
|
|
|
@ -120,7 +120,7 @@ protected:
|
|||
/// Plan::Plan() - Constructor for Plan class. A Plan is a managed container for a Task vector. These tasks reference
|
||||
/// Units that are defined in the Units files (Suite). If Units are definitions, Tasks are selections of those
|
||||
/// definitions to execute, and if Units together form a Suite, Tasks together form a Plan.
|
||||
Plan::Plan( Conf * configuration, int LOG_LEVEL ): JSON_Loader( LOG_LEVEL ), slog( LOG_LEVEL, "examplar::plan" )
|
||||
Plan::Plan( Conf * configuration, int LOG_LEVEL ): JSON_Loader( LOG_LEVEL ), slog( LOG_LEVEL, "e_plan" )
|
||||
{
|
||||
this->configuration = configuration;
|
||||
this->LOG_LEVEL = LOG_LEVEL;
|
||||
|
|
|
@ -79,7 +79,7 @@ protected:
|
|||
/// human processes to allow modularly developed profiles of test suites. As inferred, Unit is expected to be one of
|
||||
/// the two types that are only instantiated once per application run, though it is designed to be used more than once
|
||||
/// if the implementor so desires.
|
||||
Suite::Suite( int LOG_LEVEL ): JSON_Loader( LOG_LEVEL ), slog( LOG_LEVEL, "examplar::suite" )
|
||||
Suite::Suite( int LOG_LEVEL ): JSON_Loader( LOG_LEVEL ), slog( LOG_LEVEL, "e_suite" )
|
||||
{
|
||||
this->LOG_LEVEL;
|
||||
}
|
||||
|
|
|
@ -80,7 +80,7 @@ protected:
|
|||
/// Task::Task() - Constructor for the Task class. The Task is the building block of a Plan indicating of which Unit to
|
||||
/// execute, and its dependencies on other units to have already been completed successfully.
|
||||
Task::Task( int LOG_LEVEL ):
|
||||
slog( LOG_LEVEL, "examplar::task" ),
|
||||
slog( LOG_LEVEL, "e_task" ),
|
||||
definition( LOG_LEVEL )
|
||||
{
|
||||
// it hasn't executed yet.
|
||||
|
@ -180,7 +180,7 @@ void Task::execute( Conf * configuration )
|
|||
|
||||
// get the name
|
||||
std::string task_name = this->definition.get_name();
|
||||
this->slog.log( E_DEBUG, "\tUsing unit: \"" + task_name + "\"." );
|
||||
this->slog.log( E_DEBUG, "Using unit: \"" + task_name + "\"." );
|
||||
// END PREWORK
|
||||
|
||||
// get the target execution command
|
||||
|
|
|
@ -48,7 +48,7 @@ class Unit_DataStructureException: public std::runtime_error { public:
|
|||
/// required, which is used as a flag to halt or continue if rectifier does not heal the system in such a way that
|
||||
/// target can run successfully.
|
||||
/// rectify, which is used as a flag to determine in the rectifier runs.
|
||||
Unit::Unit( int LOG_LEVEL ): JSON_Loader( LOG_LEVEL ), slog( LOG_LEVEL, "examplar::unit" )
|
||||
Unit::Unit( int LOG_LEVEL ): JSON_Loader( LOG_LEVEL ), slog( LOG_LEVEL, "e_unit" )
|
||||
{
|
||||
this->LOG_LEVEL;
|
||||
}
|
||||
|
|
|
@ -38,7 +38,7 @@ class JSON_Loader_InvalidJSON: public std::runtime_error { public:
|
|||
/// JSON_Loader::JSON_Loader - Constructor for JSON_Loader base class. Simply inits to an unpopulated state.
|
||||
///
|
||||
/// The JSON_Loader type is a base type. It is meant to provide the functionalities shared between Suite and Plan.
|
||||
JSON_Loader::JSON_Loader( int LOG_LEVEL ): slog( LOG_LEVEL, "examplar::json_loader" )
|
||||
JSON_Loader::JSON_Loader( int LOG_LEVEL ): slog( LOG_LEVEL, "e_json" )
|
||||
{
|
||||
this->populated = false;
|
||||
this->LOG_LEVEL = LOG_LEVEL;
|
||||
|
|
|
@ -4,5 +4,5 @@
|
|||
"units_path": "units/all_test.units",
|
||||
"plan_path": "plans/test.plan",
|
||||
"config_version": "3",
|
||||
"env_vars_file": "Examplar.variables"
|
||||
"env_vars_file": "examplar.variables"
|
||||
}
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
echo "This is output from loading the variables file."
|
|
@ -20,8 +20,8 @@
|
|||
"name": "A DEFINITION THAT IS NOT USED",
|
||||
"target": "/usr/bin/dialog --yesno test 50 50",
|
||||
"rectifier": "/usr/bin/false",
|
||||
"active": true,
|
||||
"required": true,
|
||||
"active": false,
|
||||
"required": false,
|
||||
"rectify": true
|
||||
},
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue