Просмотр исходного кода

Begin testing correct generation of log files with date stamps.


git-svn-id: https://svn.microneil.com/svn/SNFUtility/trunk@24 aa37657e-1934-4a5f-aa6d-2d8eab27ff7c
master
adeniz 12 лет назад
Родитель
Сommit
287b6e24bb
3 измененных файлов: 60 добавлений и 37 удалений
  1. 42
    23
      Common/UtilityConfig.cpp
  2. 0
    1
      Common/UtilityConfig.hpp
  3. 18
    13
      SNFMilterConfig/SNFMilterConfigTests.txt

+ 42
- 23
Common/UtilityConfig.cpp Просмотреть файл

@@ -282,7 +282,11 @@ UtilityConfig::GetStatusSecondLogFileName(void) {
std::string FileName = CFGData.paths_log_path + CFGData.node_licenseid + ".status.second";
AppendDatestampToLogFileName(&FileName);
if (CFGData.Status_SecondReport_Append_OnOff) {
AppendDatestampToLogFileName(&FileName);
}
FileName += ".log";
@@ -301,7 +305,11 @@ UtilityConfig::GetStatusMinuteLogFileName(void) {
std::string FileName = CFGData.paths_log_path + CFGData.node_licenseid + ".status.minute";
AppendDatestampToLogFileName(&FileName);
if (CFGData.Status_MinuteReport_Append_OnOff) {
AppendDatestampToLogFileName(&FileName);
}
FileName += ".log";
@@ -319,34 +327,29 @@ void
UtilityConfig::AppendDatestampToLogFileName(std::string *FileBaseName) {
if (CFGData.Scan_XML_Rotate ||
CFGData.Status_MinuteReport_Append_OnOff ||
CFGData.Status_SecondReport_Append_OnOff) {
char TimestampBuffer[20];
tm *BrokenDownTime;
time_t Timestamp;
time(&Timestamp);
char TimestampBuffer[20];
tm *BrokenDownTime;
time_t Timestamp;
if (CFGData.Logs_Rotation_LocalTime_OnOff) {
time(&Timestamp);
BrokenDownTime = gmtime(&Timestamp);
if (CFGData.Logs_Rotation_LocalTime_OnOff) {
} else {
BrokenDownTime = gmtime(&Timestamp);
BrokenDownTime = localtime(&Timestamp);
} else {
}
BrokenDownTime = localtime(&Timestamp);
snprintf(TimestampBuffer, sizeof TimestampBuffer, "%04d%02d%02d",
BrokenDownTime->tm_year+1900,
BrokenDownTime->tm_mon+1,
BrokenDownTime->tm_mday);
}
*FileBaseName += ".";
*FileBaseName += TimestampBuffer;
snprintf(TimestampBuffer, sizeof TimestampBuffer, "%04d%02d%02d",
BrokenDownTime->tm_year+1900,
BrokenDownTime->tm_mon+1,
BrokenDownTime->tm_mday);
}
*FileBaseName += ".";
*FileBaseName += TimestampBuffer;
}
@@ -1453,7 +1456,23 @@ UtilityConfig::ProcessCommandLineItem(std::string OneInput) {
bool
UtilityConfig::CommandLineIsOkay() {
return (AuthenticationIsSpecified == LicenseIdIsSpecified);
std::string ConfigFile = GetConfigFileName();
bool NoCredentialSpecified = !(AuthenticationIsSpecified || LicenseIdIsSpecified);
int NumCommandsSpecified = 0;
if (UpdateCredentialsSpecified()) {
if (ConfigFile.length() > 0) {
return false;
}
NumCommandsSpecified++;
}
// AVD modified to here.
return true;
}

+ 0
- 1
Common/UtilityConfig.hpp Просмотреть файл

@@ -124,7 +124,6 @@ public:
//
void AppendDatestampToLogFileName(std::string *FileBaseName);
/// Get the identity file name.
//
// \returns the identity file name.

+ 18
- 13
SNFMilterConfig/SNFMilterConfigTests.txt Просмотреть файл

@@ -37,6 +37,11 @@ SNFMilterConfig takes no action.

Result: Pass.

CONFLICT-05: Run with -config=SNFMilter_second.xml -start. Verify
that help message is output, and that SNFMilterConfig takes no action.

Result: Pass.

Setup/Repair functionality
--------------------------

@@ -173,8 +178,8 @@ Start/stop functionality with XCI disabled, status.second enabled
-----------------------------------------------------------------

START_STOP_SEC-01: Install default configuration files, and ensure
that SNFMilter is stopped. Create a configuration file
SNFMilter_second.xml as follows:
that SNFMilter is stopped. Install configuration file
SNFMilter_second.xml with the following configuration:

1) Disable XCI.

@@ -184,23 +189,23 @@ SNFMilter_second.xml as follows:

Do the following, specifying the configuration file SNFMilter_second.xml:

1) Run "SNFMilterConfig -config=SNFMilter_second.xml -start", and verify that SNFMilter starts.
1) Run "SNFMilterConfig -start -v", and verify that SNFMilter
starts.

2) Run "SNFMilterConfig -config=SNFMilter_second.xml -start" again
and verify that SNFMilter is not started again.
2) Run "SNFMilterConfig -start -v" again and verify that SNFMilter
is not started again.

3) Run "SNFMilterConfig -config=SNFMilter_second.xml -stop" and
verify that SNFMilter stops.
3) Run "SNFMilterConfig -stop -v" and verify that SNFMilter stops.

4) Run "SNFMilterConfig -config=SNFMilter_second.xml -stop" again
and verify that SNFMilter is not stopped again.
4) Run "SNFMilterConfig -stop -v" again and verify that SNFMilter is
not stopped again.

Result: Pass
Result:

START_STOP_SEC-02: Repeat START_STOP_SEC-01 but with "-v" in the
START_STOP_SEC-02: Repeat START_STOP_SEC-01 but without "-v" in the
command-line.

Result: Pass
Result:

START_STOP_SEC-03: Configure as for START_STOP_SEC-01, and do the
following:
@@ -219,7 +224,7 @@ following:
5) Run SNFMilterConfig with "-stop -explain". Verify correct
output, and that SNFMilterConfig doesn't stop SNFMilter.

Result: Pass
Result:

Start/stop functionality with XCI and status.second enabled, append mode
------------------------------------------------------------------------

Загрузка…
Отмена
Сохранить