+ if(param3 == "") throw anna::RuntimeException(anna::functions::asString("Missing xml file for '%s' command in test id operation", param2.c_str()), ANNA_FILE_LOCATION);
+
+ // Get xml content from file:
+ std::string regexp;
+ if(!getContentFromFile(param3, regexp))
+ throw anna::RuntimeException("Error reading xml content from file provided", ANNA_FILE_LOCATION);
+
+ // optional 'full':
+ if(param4 != "strict") {
+
+ // TODO: use this from gcc4.9.0: http://stackoverflow.com/questions/8060025/is-this-c11-regex-error-me-or-the-compiler
+/*
+ std::string s_from = "hop-by-hop-id=\"[0-9]+\" end-to-end-id=\"[0-9]+\"";
+ std::string s_to = s_from;
+ std::string s_from2 = "avp name=\"Origin-State-Id\" data=\"[0-9]+\"";
+ std::string s_to2 = s_from2;
+
+ try {
+ regexp = std::regex_replace (regexp, std::regex(s_from), s_to);
+ regexp = std::regex_replace (regexp, std::regex(s_from2), s_to2);
+ }
+ catch (const std::regex_error& e) {
+ throw anna::RuntimeException(e.what(), ANNA_FILE_LOCATION);
+ }
+
+*/
+ std::string::size_type pos, pos_1, pos_2;
+
+ pos = regexp.find("hop-by-hop-id=", 0u);
+ pos = regexp.find("\"", pos);
+ pos_1 = pos;
+ pos = regexp.find("\"", pos+1);
+ pos_2 = pos;
+ regexp.replace(pos_1 + 1, pos_2 - pos_1 - 1, "[0-9]+");
+
+ pos = regexp.find("end-to-end-id=", 0u);
+ pos = regexp.find("\"", pos);
+ pos_1 = pos;
+ pos = regexp.find("\"", pos+1);
+ pos_2 = pos;
+ regexp.replace(pos_1 + 1, pos_2 - pos_1 - 1, "[0-9]+");
+
+ pos = regexp.find("Origin-State-Id", 0u);
+ pos = regexp.find("\"", pos);
+ pos = regexp.find("\"", pos+1);
+ pos_1 = pos;
+ pos = regexp.find("\"", pos+1);
+ pos_2 = pos;
+ regexp.replace(pos_1 + 1, pos_2 - pos_1 - 1, "[0-9]+");
+
+ //regexp.insert(0, "^");
+ //regexp += "$";
+ }
+
+ bool fromEntity = (param2.substr(4,2) == "fe");
+ testManager.getTestCase(id)->addWaitRegexpXml(fromEntity, regexp);
+ }
+ else if (param2 == "sh-command") {
+ // Allow pipes in command:
+ //if (numParams > 4)
+ // throw anna::RuntimeException("Wrong body content format on HTTP Request. Use 'help' management command to see more information.", ANNA_FILE_LOCATION);
+ if(param3 == "") throw anna::RuntimeException("Missing script/executable command-line for 'sh-command' in test id operation", ANNA_FILE_LOCATION);
+ std::string token = "|sh-command|";
+ std::string command = operation.substr(operation.find(token) + token.size());
+ testManager.getTestCase(id)->addCommand(command); // creates / reuses