From: Eduardo Ramos Testillano Date: Wed, 2 Mar 2016 07:26:40 +0000 (+0100) Subject: Fixes X-Git-Tag: REFACTORING_TESTING_LIBRARY~23 X-Git-Url: https://git.teslayout.com/public/public/public/?p=anna.git;a=commitdiff_plain;h=d33231f088c5ff6a137d63285c91536ac3598bf4 Fixes --- diff --git a/example/diameter/launcher/Launcher.cpp b/example/diameter/launcher/Launcher.cpp index 9517372..2e5b52b 100644 --- a/example/diameter/launcher/Launcher.cpp +++ b/example/diameter/launcher/Launcher.cpp @@ -1479,7 +1479,7 @@ std::string Launcher::help() const throw() { void Launcher::eventOperation(const std::string &operation, std::string &response_content) throw(anna::RuntimeException) { LOGMETHOD(anna::TraceMethod tm("Launcher", "eventOperation", ANNA_FILE_LOCATION)); if (operation == "") return; // ignore - LOGDEBUG(anna::Logger::debug(operation, ANNA_FILE_LOCATION)); + LOGDEBUG(anna::Logger::debug(anna::functions::asString("Operation: %s", operation.c_str()), ANNA_FILE_LOCATION)); // Default response: response_content = "Operation processed with exception: "; diff --git a/example/diameter/launcher/resources/scripts/operation_signal.sh b/example/diameter/launcher/resources/scripts/operation_signal.sh index 04684bd..eb0eb8e 100755 --- a/example/diameter/launcher/resources/scripts/operation_signal.sh +++ b/example/diameter/launcher/resources/scripts/operation_signal.sh @@ -16,20 +16,17 @@ _exit() { usage() { echo - echo "Usage: $0 [-h|--help] [-t|--timeout ] [-f|--file] [-p|--ping] " + echo "Usage: $0 [-h|--help] [-t|--timeout ] [-f|--file ] [-p|--ping] [operation] " echo - echo " -h|--help: this usage help." - echo " -t|--timeout: timeout for operation in seconds." - echo " Defaults to $TIMEOUT__dflt seconds if not provided." - echo - echo " -f|--file: the parameter 'data' will be interpreted as a file" - echo " with one operation per line. If missing, it will be" - echo " a single operation string." - echo - echo " -p|--ping: Check the target process id." - echo " Returns 1 (dead) or 0 (alive)." - echo - echo " data: operation string or file with several operations." + echo " -h|--help: this usage help." + echo " -t|--timeout : timeout for operation in seconds." + echo " Defaults to $TIMEOUT__dflt seconds if not provided." + echo " -f|--file : file with one operation per line." + echo " -p|--ping: Check the target process id." + echo " Returns 1 (dead) or 0 (alive)." + echo " operation: quoted operation string. Will be ignored if file" + echo " option is present. It is a positional argument" + echo " (the last one) when present." echo echo " For example:" echo " $0 help" @@ -42,11 +39,12 @@ usage() { parse_arguments() { is_file= timeout=$TIMEOUT__dflt - data= + file= + operation= ping= while [ $# -gt 0 ]; do - case $1 in + case "$1" in -h|--help) usage ;; @@ -59,9 +57,9 @@ parse_arguments() { -f|--file) is_file=yes - data=$2 - [ -z "$data" ] && _exit "Missing file" - [ ! -f "$data" ] && _exit "Can't found provided file '$data'." + file="$2" + [ -z "$file" ] && _exit "Missing file" + [ ! -f "$file" ] && _exit "Can't found provided file '$file'." shift ;; @@ -72,13 +70,14 @@ parse_arguments() { *) first=$(echo $1 | cut -c1) [ "$first" = "-" ] && _exit "Unsupported script option: $1. Type '$SCR_BN -h' (or --help) to print the available options." - data=$1 + operation="$@" + break ;; esac shift done - [ -z "$ping" -a -z "$data" ] && _exit "Missing data value" + [ -z "$is_file" -a -z "$operation" -a -z "$ping" ] && _exit "Missing operation or file with operations" } # $1: pid to check @@ -108,9 +107,9 @@ res=$? # Send operation: if [ -n "$is_file" ] then - cp $data sigusr2.in + cp $file sigusr2.in else - echo $data > sigusr2.in + echo $operation > sigusr2.in fi 0>sigusr2.out check_pid $PID diff --git a/example/diameter/launcher/testing/TestManager.cpp b/example/diameter/launcher/testing/TestManager.cpp index fbee74d..cf768ab 100644 --- a/example/diameter/launcher/testing/TestManager.cpp +++ b/example/diameter/launcher/testing/TestManager.cpp @@ -419,7 +419,8 @@ void TestManager::receiveMessage(const anna::DataBlock &message, OriginHost *hos std::string sessionId, subscriberId; TestCase *tc; tc = getTestCaseFromSessionId(message, sessionId); - if (!tc) getTestCaseFromSubscriberId(message, subscriberId); + if (!tc) + tc = getTestCaseFromSubscriberId(message, subscriberId); if (!tc) { LOGWARNING(anna::Logger::warning(anna::comm::functions::asText("Cannot identify the Test Case for the message received from server: ", message), ANNA_FILE_LOCATION)); // this should not appear return; @@ -464,7 +465,8 @@ void TestManager::receiveMessage(const anna::DataBlock &message, OriginHost *hos std::string sessionId, subscriberId; TestCase *tc; tc = getTestCaseFromSessionId(message, sessionId); - if (!tc) getTestCaseFromSubscriberId(message, subscriberId); + if (!tc) + tc = getTestCaseFromSubscriberId(message, subscriberId); if (!tc) { LOGWARNING(anna::Logger::warning(anna::comm::functions::asText("Cannot identify the Test Case for the message received from client: ", message), ANNA_FILE_LOCATION)); // this should not appear return;