예제 #1
0
/*!

\brief Constructor.
\param[in] AppName String containing unit test name.
\param[in] argc Number of arguments in argv
\param[in] argv Array of char arrays containing the command line arguments.

*/
dmz::Test::Test (const String &AppName, int argc, char *argv[]) :
      obs (rt.get_context ()),
      config ("global"),
      log ("", rt.get_context ()),
      error (False) {

   const String LogLevelEnvStr (get_env ("DMZ_TEST_LOG_LEVEL"));
   LogLevelEnum level (LogLevelWarn);
   if (LogLevelEnvStr) { level = string_to_log_level (LogLevelEnvStr); }
   obs.set_level (level);

   log.out
      << "-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-" << endl
      << "Running " << AppName << " unit test." << endl
      << "-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-" << endl;

   CommandLine cl (argc, argv);
   CommandLineConfig clconfig;

   if (!clconfig.process_command_line (cl, config)) {

      log.error << "Unable to process command line: " << clconfig.get_error () << endl;
      error = True;
   }
}
예제 #2
0
/*!

\brief Process the command line.
\details Loads all XML configuration files specified by the command line.
\param[in] CL CommandLine object to process.
\return Returns dmz::True if command line was successfully processed. Returns
dmz::False if there was an error parsing the XML configuration files.

*/
dmz::Boolean
dmz::Application::process_command_line (const CommandLine &CL) {

   CommandLineConfig clconfig;

   if (!clconfig.process_command_line (CL, _state.global, &(_state.log))) {

      _state.errorMsg.flush () << "Unable to process command line: "
         << clconfig.get_error ();

      _state.log.error << _state.errorMsg << endl;

      _state.error = True;
   }

   if (!_state.error) { _state.cache.configure (_state.global); }

//   format_config_to_xml (global, _state.log.debug, True);

   return !_state.error;
}