mirror of
https://gitlab.isc.org/isc-projects/kea
synced 2025-09-02 06:55:16 +00:00
[trac3664] Cleanup
Cleanup spaces and such to meet coding specs Remove testing artifacts Update man page documenation
This commit is contained in:
@@ -44,18 +44,18 @@
|
|||||||
<refsynopsisdiv>
|
<refsynopsisdiv>
|
||||||
<cmdsynopsis>
|
<cmdsynopsis>
|
||||||
<command>kea-lfc</command>
|
<command>kea-lfc</command>
|
||||||
|
<arg><option>-4|-6</option></arg>
|
||||||
|
<arg><option>-c <replaceable class="parameter">config-file</replaceable></option></arg>
|
||||||
|
<arg><option>-p <replaceable class="parameter">previous-file</replaceable></option></arg>
|
||||||
|
<arg><option>-i <replaceable class="parameter">copy-file</replaceable></option></arg>
|
||||||
|
<arg><option>-o <replaceable class="parameter">output-file</replaceable></option></arg>
|
||||||
|
<arg><option>-f <replaceable class="parameter">finish-file</replaceable></option></arg>
|
||||||
<arg><option>-v</option></arg>
|
<arg><option>-v</option></arg>
|
||||||
|
<arg><option>-V</option></arg>
|
||||||
|
<arg><option>-d</option></arg>
|
||||||
</cmdsynopsis>
|
</cmdsynopsis>
|
||||||
</refsynopsisdiv>
|
</refsynopsisdiv>
|
||||||
|
|
||||||
<refsynopsisdiv>
|
|
||||||
<cmdsynopsis>
|
|
||||||
<command>kea-lfc</command>
|
|
||||||
<arg><option>-s</option></arg>
|
|
||||||
</cmdsynopsis>
|
|
||||||
</refsynopsisdiv>
|
|
||||||
|
|
||||||
|
|
||||||
<refsect1>
|
<refsect1>
|
||||||
<title>DESCRIPTION</title>
|
<title>DESCRIPTION</title>
|
||||||
<para>
|
<para>
|
||||||
@@ -76,13 +76,34 @@
|
|||||||
<variablelist>
|
<variablelist>
|
||||||
|
|
||||||
<varlistentry>
|
<varlistentry>
|
||||||
<term><option>-v</option></term>
|
<term><option>-d</option></term>
|
||||||
<listitem><para>
|
<listitem><para>
|
||||||
Verbose mode sets the logging level to debug. This is primarily
|
Verbose mode sets the logging level to debug. This is primarily
|
||||||
for development purposes in stand-alone mode.
|
for development purposes in stand-alone mode.
|
||||||
</para></listitem>
|
</para></listitem>
|
||||||
</varlistentry>
|
</varlistentry>
|
||||||
|
|
||||||
|
<varlistentry>
|
||||||
|
<term><option>-v</option></term>
|
||||||
|
<listitem><para>
|
||||||
|
version causes the version stamp to be printed.
|
||||||
|
</para></listitem>
|
||||||
|
</varlistentry>
|
||||||
|
|
||||||
|
<varlistentry>
|
||||||
|
<term><option>-V</option></term>
|
||||||
|
<listitem><para>
|
||||||
|
Version causes a longer form of the version stamp to be printed.
|
||||||
|
</para></listitem>
|
||||||
|
</varlistentry>
|
||||||
|
|
||||||
|
<varlistentry>
|
||||||
|
<term><option>-4 | -6</option></term>
|
||||||
|
<listitem><para>
|
||||||
|
The protocol version of the lease files, must be one of 4 or 6.
|
||||||
|
</para></listitem>
|
||||||
|
</varlistentry>
|
||||||
|
|
||||||
<varlistentry>
|
<varlistentry>
|
||||||
<term><option>-c</option></term>
|
<term><option>-c</option></term>
|
||||||
<listitem><para>
|
<listitem><para>
|
||||||
@@ -91,6 +112,47 @@
|
|||||||
</para></listitem>
|
</para></listitem>
|
||||||
</varlistentry>
|
</varlistentry>
|
||||||
|
|
||||||
|
<varlistentry>
|
||||||
|
<term><option>-p</option></term>
|
||||||
|
<listitem><para>
|
||||||
|
Previous lease file - When LFC starts this is the result of any previous
|
||||||
|
run of LFC.
|
||||||
|
</para></listitem>
|
||||||
|
</varlistentry>
|
||||||
|
|
||||||
|
<varlistentry>
|
||||||
|
<term><option>-i</option></term>
|
||||||
|
<listitem><para>
|
||||||
|
Input or copy of lease file - Before the DHCP serves invokes LFC it will move
|
||||||
|
the current lease file to this file and then call LFC with the new file.
|
||||||
|
</para></listitem>
|
||||||
|
</varlistentry>
|
||||||
|
|
||||||
|
<varlistentry>
|
||||||
|
<term><option>-o</option></term>
|
||||||
|
<listitem><para>
|
||||||
|
Output lease file - The temporary file LFC should use to write the leases.
|
||||||
|
Upon completion this file will be moved to the finish file (see below).
|
||||||
|
</para></listitem>
|
||||||
|
</varlistentry>
|
||||||
|
|
||||||
|
<varlistentry>
|
||||||
|
<term><option>-f</option></term>
|
||||||
|
<listitem><para>
|
||||||
|
Finish or completion file - Another temporary file LFC uses for bookkeeping.
|
||||||
|
When LFC completes writing the output file it moves it to this file name.
|
||||||
|
After LFC finishes deleting the other files (previous and input) it moves
|
||||||
|
this file to previous lease file.
|
||||||
|
</para></listitem>
|
||||||
|
</varlistentry>
|
||||||
|
|
||||||
|
<varlistentry>
|
||||||
|
<term><option>-c</option></term>
|
||||||
|
<listitem><para>
|
||||||
|
|
||||||
|
</para></listitem>
|
||||||
|
</varlistentry>
|
||||||
|
|
||||||
</variablelist>
|
</variablelist>
|
||||||
</refsect1>
|
</refsect1>
|
||||||
|
|
||||||
|
@@ -12,11 +12,11 @@
|
|||||||
// OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
// OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
||||||
// PERFORMANCE OF THIS SOFTWARE.
|
// PERFORMANCE OF THIS SOFTWARE.
|
||||||
|
|
||||||
#include <config.h>
|
|
||||||
#include <lfc/lfc.h>
|
#include <lfc/lfc.h>
|
||||||
#include <exceptions/exceptions.h>
|
#include <exceptions/exceptions.h>
|
||||||
#include <log/logger_support.h>
|
#include <log/logger_support.h>
|
||||||
#include <log/logger_manager.h>
|
#include <log/logger_manager.h>
|
||||||
|
#include <config.h>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
@@ -33,12 +33,10 @@ const char* lfcController::lfc_bin_name_ = "kea-lfc";
|
|||||||
|
|
||||||
lfcController::lfcController()
|
lfcController::lfcController()
|
||||||
: protocol_version_(0), verbose_(false), config_file_(""), previous_file_(""),
|
: protocol_version_(0), verbose_(false), config_file_(""), previous_file_(""),
|
||||||
copy_file_(""), output_file_(""), finish_file_(""), pid_file_("./test_pid") {
|
copy_file_(""), output_file_(""), finish_file_(""), pid_file_("") {
|
||||||
std::cerr << "created lfc" << std::endl;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
lfcController::~lfcController() {
|
lfcController::~lfcController() {
|
||||||
std::cerr << "destroyed lfc" << std::endl;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@@ -49,85 +47,82 @@ lfcController::launch(int argc, char* argv[], const bool test_mode) {
|
|||||||
usage(ex.what());
|
usage(ex.what());
|
||||||
throw; // rethrow it
|
throw; // rethrow it
|
||||||
}
|
}
|
||||||
|
|
||||||
std::cerr << "launched lfc" << std::endl;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
lfcController::parseArgs(int argc, char* argv[])
|
lfcController::parseArgs(int argc, char* argv[]) {
|
||||||
{
|
|
||||||
int ch;
|
int ch;
|
||||||
|
|
||||||
while ((ch = getopt(argc, argv, "46dvVp:i:o:c:f:")) != -1) {
|
while ((ch = getopt(argc, argv, "46dvVp:i:o:c:f:")) != -1) {
|
||||||
switch (ch) {
|
switch (ch) {
|
||||||
case '4':
|
case '4':
|
||||||
// Process DHCPv4 lease files.
|
// Process DHCPv4 lease files.
|
||||||
protocol_version_ = 4;
|
protocol_version_ = 4;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case '6':
|
case '6':
|
||||||
// Process DHCPv6 lease files.
|
// Process DHCPv6 lease files.
|
||||||
protocol_version_ = 6;
|
protocol_version_ = 6;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'v':
|
case 'v':
|
||||||
// Print just Kea vesion and exit.
|
// Print just Kea vesion and exit.
|
||||||
std::cout << getVersion(false) << std::endl;
|
std::cout << getVersion(false) << std::endl;
|
||||||
exit(EXIT_SUCCESS);
|
exit(EXIT_SUCCESS);
|
||||||
|
|
||||||
case 'V':
|
case 'V':
|
||||||
// Print extended Kea vesion and exit.
|
// Print extended Kea vesion and exit.
|
||||||
std::cout << getVersion(true) << std::endl;
|
std::cout << getVersion(true) << std::endl;
|
||||||
exit(EXIT_SUCCESS);
|
exit(EXIT_SUCCESS);
|
||||||
|
|
||||||
case 'd':
|
case 'd':
|
||||||
// Verbose output.
|
// Verbose output.
|
||||||
verbose_ = true;
|
verbose_ = true;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'p':
|
case 'p':
|
||||||
// Previous file name.
|
// Previous file name.
|
||||||
if (optarg == NULL) {
|
if (optarg == NULL) {
|
||||||
isc_throw(InvalidUsage, "Previous file name missing");
|
isc_throw(InvalidUsage, "Previous file name missing");
|
||||||
}
|
}
|
||||||
previous_file_ = optarg;
|
previous_file_ = optarg;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'i':
|
|
||||||
// Copy file name.
|
|
||||||
if (optarg == NULL) {
|
|
||||||
isc_throw(InvalidUsage, "Copy file name missing");
|
|
||||||
}
|
|
||||||
copy_file_ = optarg;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 'o':
|
case 'i':
|
||||||
// Output file name.
|
// Copy file name.
|
||||||
if (optarg == NULL) {
|
if (optarg == NULL) {
|
||||||
isc_throw(InvalidUsage, "Output file name missing");
|
isc_throw(InvalidUsage, "Copy file name missing");
|
||||||
}
|
}
|
||||||
output_file_ = optarg;
|
copy_file_ = optarg;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'f':
|
case 'o':
|
||||||
// Output file name.
|
// Output file name.
|
||||||
if (optarg == NULL) {
|
if (optarg == NULL) {
|
||||||
isc_throw(InvalidUsage, "Finish file name missing");
|
isc_throw(InvalidUsage, "Output file name missing");
|
||||||
}
|
}
|
||||||
finish_file_ = optarg;
|
output_file_ = optarg;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'c':
|
case 'f':
|
||||||
// Previous file name.
|
// Output file name.
|
||||||
if (optarg == NULL) {
|
if (optarg == NULL) {
|
||||||
isc_throw(InvalidUsage, "Configuration file name missing");
|
isc_throw(InvalidUsage, "Finish file name missing");
|
||||||
}
|
}
|
||||||
config_file_ = optarg;
|
finish_file_ = optarg;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
case 'c':
|
||||||
usage("");
|
// Previous file name.
|
||||||
}
|
if (optarg == NULL) {
|
||||||
|
isc_throw(InvalidUsage, "Configuration file name missing");
|
||||||
|
}
|
||||||
|
config_file_ = optarg;
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
usage("");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check for extraneous parameters.
|
// Check for extraneous parameters.
|
||||||
@@ -140,57 +135,39 @@ lfcController::parseArgs(int argc, char* argv[])
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (previous_file_.empty()) {
|
if (previous_file_.empty()) {
|
||||||
isc_throw(InvalidUsage, "Previous file not specified");
|
isc_throw(InvalidUsage, "Previous file not specified");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (copy_file_.empty()) {
|
if (copy_file_.empty()) {
|
||||||
isc_throw(InvalidUsage, "Copy file not specified");
|
isc_throw(InvalidUsage, "Copy file not specified");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (output_file_.empty()) {
|
if (output_file_.empty()) {
|
||||||
isc_throw(InvalidUsage, "Output file not specified");
|
isc_throw(InvalidUsage, "Output file not specified");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (finish_file_.empty()) {
|
if (finish_file_.empty()) {
|
||||||
isc_throw(InvalidUsage, "Finish file not specified");
|
isc_throw(InvalidUsage, "Finish file not specified");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (config_file_.empty()) {
|
if (config_file_.empty()) {
|
||||||
isc_throw(InvalidUsage, "Config file not specified");
|
isc_throw(InvalidUsage, "Config file not specified");
|
||||||
}
|
}
|
||||||
|
|
||||||
// If verbose is set echo the input information
|
// If verbose is set echo the input information
|
||||||
if (verbose_ == true) {
|
if (verbose_ == true) {
|
||||||
std::cerr << "Protocol version: " << protocol_version_ << std::endl
|
std::cerr << "Protocol version: " << protocol_version_ << std::endl
|
||||||
<< "Previous lease file: " << previous_file_ << std::endl
|
<< "Previous lease file: " << previous_file_ << std::endl
|
||||||
<< "Copy lease file: " << copy_file_ << std::endl
|
<< "Copy lease file: " << copy_file_ << std::endl
|
||||||
<< "Output lease file: " << output_file_ << std::endl
|
<< "Output lease file: " << output_file_ << std::endl
|
||||||
<< "Finishn file: " << finish_file_ << std::endl
|
<< "Finishn file: " << finish_file_ << std::endl
|
||||||
<< "Config file: " << config_file_ << std::endl
|
<< "Config file: " << config_file_ << std::endl
|
||||||
<< "PID file: " << pid_file_ << std::endl;
|
<< "PID file: " << pid_file_ << std::endl;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
|
||||||
lfcController::pidCheck(const std::string & pid_file)
|
|
||||||
{
|
|
||||||
return (false);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool
|
|
||||||
lfcController::pidWrite(const std::string & pid_file)
|
|
||||||
{
|
|
||||||
return (true);
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
void
|
||||||
lfcController::pidDelete(const std::string & pid_file)
|
lfcController::usage(const std::string& text) {
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
lfcController::usage(const std::string & text)
|
|
||||||
{
|
|
||||||
if (text != "") {
|
if (text != "") {
|
||||||
std::cerr << "Usage error: " << text << std::endl;
|
std::cerr << "Usage error: " << text << std::endl;
|
||||||
}
|
}
|
||||||
|
@@ -16,7 +16,6 @@
|
|||||||
#define LFC_H
|
#define LFC_H
|
||||||
|
|
||||||
#include <boost/shared_ptr.hpp>
|
#include <boost/shared_ptr.hpp>
|
||||||
|
|
||||||
#include <exceptions/exceptions.h>
|
#include <exceptions/exceptions.h>
|
||||||
|
|
||||||
namespace isc {
|
namespace isc {
|
||||||
@@ -53,9 +52,9 @@ public:
|
|||||||
///
|
///
|
||||||
/// 1. parse command line arguments
|
/// 1. parse command line arguments
|
||||||
/// 2. verifies that it is the only instance
|
/// 2. verifies that it is the only instance
|
||||||
/// 3. creates pid file
|
/// 3. creates pid file (TBD)
|
||||||
/// .... TBD
|
/// .... TBD
|
||||||
/// 4. remove pid file
|
/// 4. remove pid file (TBD)
|
||||||
/// 5. exit to the caller
|
/// 5. exit to the caller
|
||||||
void launch(int argc, char* argv[], const bool test_mode);
|
void launch(int argc, char* argv[], const bool test_mode);
|
||||||
|
|
||||||
@@ -63,21 +62,6 @@ public:
|
|||||||
/// step taken after the process has been launched.
|
/// step taken after the process has been launched.
|
||||||
void parseArgs(int argc, char* argv[]);
|
void parseArgs(int argc, char* argv[]);
|
||||||
|
|
||||||
/// @brief Use the pid file to determine if there is another instance
|
|
||||||
///
|
|
||||||
/// @param pid_file is the name of the file which holds the pid to check
|
|
||||||
/// returns true if there is a process with that pid
|
|
||||||
bool pidCheck(const std::string & pid_file);
|
|
||||||
|
|
||||||
/// @brief Extract the pid and Write it out to the pid file
|
|
||||||
///
|
|
||||||
/// @param pid_file is the name of the file in which to write the pid
|
|
||||||
/// returns true if the write was successful
|
|
||||||
bool pidWrite(const std::string & pid_file);
|
|
||||||
|
|
||||||
/// @brief Get rid of the pid file we created earlier
|
|
||||||
void pidDelete(const std::string & pid_file);
|
|
||||||
|
|
||||||
/// @brief Prints the program usage text to std error.
|
/// @brief Prints the program usage text to std error.
|
||||||
///
|
///
|
||||||
/// @param text is a string message which will preceded the usage text.
|
/// @param text is a string message which will preceded the usage text.
|
||||||
@@ -157,4 +141,3 @@ private:
|
|||||||
}; // namespace isc
|
}; // namespace isc
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@@ -12,12 +12,11 @@
|
|||||||
// OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
// OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
||||||
// PERFORMANCE OF THIS SOFTWARE.
|
// PERFORMANCE OF THIS SOFTWARE.
|
||||||
|
|
||||||
#include <config.h>
|
|
||||||
#include <lfc/lfc.h>
|
#include <lfc/lfc.h>
|
||||||
#include <exceptions/exceptions.h>
|
#include <exceptions/exceptions.h>
|
||||||
#include <log/logger_support.h>
|
#include <log/logger_support.h>
|
||||||
#include <log/logger_manager.h>
|
#include <log/logger_manager.h>
|
||||||
|
#include <config.h>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
|
||||||
using namespace isc::lfc;
|
using namespace isc::lfc;
|
||||||
|
@@ -12,9 +12,9 @@
|
|||||||
// OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
// OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
||||||
// PERFORMANCE OF THIS SOFTWARE.
|
// PERFORMANCE OF THIS SOFTWARE.
|
||||||
|
|
||||||
|
#include <lfc/lfc.h>
|
||||||
#include <log/logger_support.h>
|
#include <log/logger_support.h>
|
||||||
#include <gtest/gtest.h>
|
#include <gtest/gtest.h>
|
||||||
#include <lfc/lfc.h>
|
|
||||||
|
|
||||||
using namespace isc::lfc;
|
using namespace isc::lfc;
|
||||||
using namespace std;
|
using namespace std;
|
||||||
@@ -23,14 +23,13 @@ TEST(lfcControllerTest, initialValues) {
|
|||||||
lfcController lfcController;
|
lfcController lfcController;
|
||||||
|
|
||||||
// Verify that we start with everything empty
|
// Verify that we start with everything empty
|
||||||
EXPECT_TRUE(lfcController.getProtocolVersion() == 0);
|
EXPECT_EQ(lfcController.getProtocolVersion(), 0);
|
||||||
EXPECT_TRUE(lfcController.getConfigFile() == "");
|
EXPECT_EQ(lfcController.getConfigFile(), "");
|
||||||
EXPECT_TRUE(lfcController.getPreviousFile() == "");
|
EXPECT_EQ(lfcController.getPreviousFile(), "");
|
||||||
EXPECT_TRUE(lfcController.getCopyFile() == "");
|
EXPECT_EQ(lfcController.getCopyFile(), "");
|
||||||
EXPECT_TRUE(lfcController.getOutputFile() == "");
|
EXPECT_EQ(lfcController.getOutputFile(), "");
|
||||||
EXPECT_TRUE(lfcController.getFinishFile() == "");
|
EXPECT_EQ(lfcController.getFinishFile(), "");
|
||||||
// Currently defaulting pid file for testing
|
EXPECT_EQ(lfcController.getPidFile(), "");
|
||||||
// EXPECT_TRUE(lfcController.getPidFile() == "");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(lfcControllerTest, fullCommandLine) {
|
TEST(lfcControllerTest, fullCommandLine) {
|
||||||
@@ -38,28 +37,28 @@ TEST(lfcControllerTest, fullCommandLine) {
|
|||||||
|
|
||||||
// Verify that standard options can be parsed without error
|
// Verify that standard options can be parsed without error
|
||||||
char* argv[] = { const_cast<char*>("progName"),
|
char* argv[] = { const_cast<char*>("progName"),
|
||||||
const_cast<char*>("-4"),
|
const_cast<char*>("-4"),
|
||||||
const_cast<char*>("-p"),
|
const_cast<char*>("-p"),
|
||||||
const_cast<char*>("previous"),
|
const_cast<char*>("previous"),
|
||||||
const_cast<char*>("-i"),
|
const_cast<char*>("-i"),
|
||||||
const_cast<char*>("copy"),
|
const_cast<char*>("copy"),
|
||||||
const_cast<char*>("-o"),
|
const_cast<char*>("-o"),
|
||||||
const_cast<char*>("output"),
|
const_cast<char*>("output"),
|
||||||
const_cast<char*>("-c"),
|
const_cast<char*>("-c"),
|
||||||
const_cast<char*>("config"),
|
const_cast<char*>("config"),
|
||||||
const_cast<char*>("-f"),
|
const_cast<char*>("-f"),
|
||||||
const_cast<char*>("finish") };
|
const_cast<char*>("finish") };
|
||||||
int argc = 12;
|
int argc = 12;
|
||||||
|
|
||||||
EXPECT_NO_THROW(lfcController.parseArgs(argc, argv));
|
EXPECT_NO_THROW(lfcController.parseArgs(argc, argv));
|
||||||
|
|
||||||
// The parsed data
|
// The parsed data
|
||||||
EXPECT_TRUE(lfcController.getProtocolVersion() == 4);
|
EXPECT_EQ(lfcController.getProtocolVersion(), 4);
|
||||||
EXPECT_TRUE(lfcController.getConfigFile() == "config");
|
EXPECT_EQ(lfcController.getConfigFile(), "config");
|
||||||
EXPECT_TRUE(lfcController.getPreviousFile() == "previous");
|
EXPECT_EQ(lfcController.getPreviousFile(), "previous");
|
||||||
EXPECT_TRUE(lfcController.getCopyFile() == "copy");
|
EXPECT_EQ(lfcController.getCopyFile(), "copy");
|
||||||
EXPECT_TRUE(lfcController.getOutputFile() == "output");
|
EXPECT_EQ(lfcController.getOutputFile(), "output");
|
||||||
EXPECT_TRUE(lfcController.getFinishFile() == "finish");
|
EXPECT_EQ(lfcController.getFinishFile(), "finish");
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(lfcControllerTest, notEnoughData) {
|
TEST(lfcControllerTest, notEnoughData) {
|
||||||
@@ -68,17 +67,17 @@ TEST(lfcControllerTest, notEnoughData) {
|
|||||||
// The standard options we shall test what happens
|
// The standard options we shall test what happens
|
||||||
// if we don't include all of them
|
// if we don't include all of them
|
||||||
char* argv[] = { const_cast<char*>("progName"),
|
char* argv[] = { const_cast<char*>("progName"),
|
||||||
const_cast<char*>("-4"),
|
const_cast<char*>("-4"),
|
||||||
const_cast<char*>("-p"),
|
const_cast<char*>("-p"),
|
||||||
const_cast<char*>("previous"),
|
const_cast<char*>("previous"),
|
||||||
const_cast<char*>("-i"),
|
const_cast<char*>("-i"),
|
||||||
const_cast<char*>("copy"),
|
const_cast<char*>("copy"),
|
||||||
const_cast<char*>("-o"),
|
const_cast<char*>("-o"),
|
||||||
const_cast<char*>("output"),
|
const_cast<char*>("output"),
|
||||||
const_cast<char*>("-c"),
|
const_cast<char*>("-c"),
|
||||||
const_cast<char*>("config"),
|
const_cast<char*>("config"),
|
||||||
const_cast<char*>("-f"),
|
const_cast<char*>("-f"),
|
||||||
const_cast<char*>("finish") };
|
const_cast<char*>("finish") };
|
||||||
int argc = 1;
|
int argc = 1;
|
||||||
|
|
||||||
EXPECT_THROW(lfcController.parseArgs(argc, argv), InvalidUsage);
|
EXPECT_THROW(lfcController.parseArgs(argc, argv), InvalidUsage);
|
||||||
@@ -121,20 +120,20 @@ TEST(lfcControllerTest, tooMuchData) {
|
|||||||
// The standard options plus some others
|
// The standard options plus some others
|
||||||
|
|
||||||
char* argv[] = { const_cast<char*>("progName"),
|
char* argv[] = { const_cast<char*>("progName"),
|
||||||
const_cast<char*>("-4"),
|
const_cast<char*>("-4"),
|
||||||
const_cast<char*>("-p"),
|
const_cast<char*>("-p"),
|
||||||
const_cast<char*>("previous"),
|
const_cast<char*>("previous"),
|
||||||
const_cast<char*>("-i"),
|
const_cast<char*>("-i"),
|
||||||
const_cast<char*>("copy"),
|
const_cast<char*>("copy"),
|
||||||
const_cast<char*>("-o"),
|
const_cast<char*>("-o"),
|
||||||
const_cast<char*>("output"),
|
const_cast<char*>("output"),
|
||||||
const_cast<char*>("-c"),
|
const_cast<char*>("-c"),
|
||||||
const_cast<char*>("config"),
|
const_cast<char*>("config"),
|
||||||
const_cast<char*>("-f"),
|
const_cast<char*>("-f"),
|
||||||
const_cast<char*>("finish"),
|
const_cast<char*>("finish"),
|
||||||
const_cast<char*>("some"),
|
const_cast<char*>("some"),
|
||||||
const_cast<char*>("other"),
|
const_cast<char*>("other"),
|
||||||
const_cast<char*>("args"),
|
const_cast<char*>("args"),
|
||||||
};
|
};
|
||||||
int argc = 15;
|
int argc = 15;
|
||||||
|
|
||||||
@@ -147,12 +146,11 @@ TEST(lfcControllerTest, someBadData) {
|
|||||||
// The standard options plus some others
|
// The standard options plus some others
|
||||||
|
|
||||||
char* argv[] = { const_cast<char*>("progName"),
|
char* argv[] = { const_cast<char*>("progName"),
|
||||||
const_cast<char*>("some"),
|
const_cast<char*>("some"),
|
||||||
const_cast<char*>("bad"),
|
const_cast<char*>("bad"),
|
||||||
const_cast<char*>("args"),
|
const_cast<char*>("args"),
|
||||||
};
|
};
|
||||||
int argc = 4;
|
int argc = 4;
|
||||||
|
|
||||||
EXPECT_THROW(lfcController.parseArgs(argc, argv), InvalidUsage);
|
EXPECT_THROW(lfcController.parseArgs(argc, argv), InvalidUsage);
|
||||||
}
|
}
|
||||||
//-4 -p previous -i copy -o output -c config -f finish -d
|
|
||||||
|
Reference in New Issue
Block a user