// Standard
#include <string>
#include <vector>
+#include <thread>
// Project
#include <anna/core/DataBlock.hpp>
#include <TestCondition.hpp>
+
+
namespace anna {
class Millisecond;
class Node;
}
namespace diameter {
+ namespace codec {
+ class Message;
+ }
namespace comm {
class ClientSession;
class ServerSession;
void initialize(TestCase *testCase);
public:
- struct Type { enum _v { Unconfigured, Timeout, Sendxml2e, Sendxml2c, Delay, Wait }; };
+ struct Type { enum _v { Unconfigured, Timeout, Sendxml2e, Sendxml2c, Delay, Wait, Cmd }; };
static const char* asText(const Type::_v type) throw();
TestStep(TestCase *testCase) { initialize(testCase); }
// Message
anna::DataBlock a_message;
+ anna::diameter::codec::Message *a_messageCodec; // used as helper and for traffic logs
// Expired ?
bool a_expired; // a_endTimestamp will be the expiration reception timestamp
public:
- TestStepSendxml(TestCase *testCase) : TestStep(testCase), a_message(true), a_expired(false), a_realmNode(NULL), a_waitForRequestStepNumber(-1) {;}
+ TestStepSendxml(TestCase *testCase) : TestStep(testCase), a_message(true), a_messageCodec(NULL), a_expired(false), a_realmNode(NULL), a_waitForRequestStepNumber(-1) {;}
+ ~TestStepSendxml();
// setter & getters
void setRealmNode(RealmNode *realm) throw() { a_realmNode = realm; }
TestCondition a_condition;
anna::DataBlock a_message; // message which complies with condition
+ anna::diameter::codec::Message *a_messageCodec; // used as helper and for traffic logs
anna::diameter::comm::ClientSession *a_clientSession;
anna::diameter::comm::ServerSession *a_serverSession;
public:
- TestStepWait(TestCase *testCase) : TestStep(testCase) { a_type = Type::Wait; a_clientSession = NULL; a_serverSession = NULL; }
- ~TestStepWait() {;}
+ TestStepWait(TestCase *testCase) : TestStep(testCase), a_message(true), a_messageCodec(NULL) { a_type = Type::Wait; a_clientSession = NULL; a_serverSession = NULL; }
+ ~TestStepWait();
// setter & getters
void setCondition(bool fromEntity,
void setClientSession(anna::diameter::comm::ClientSession *cs) throw() { a_clientSession = cs; }
void setServerSession(anna::diameter::comm::ServerSession *ss) throw() { a_serverSession = ss; }
+ anna::diameter::comm::ClientSession *getClientSession() const throw() { return a_clientSession; }
+ anna::diameter::comm::ServerSession *getServerSession() const throw() { return a_serverSession; }
const TestCondition &getCondition() const throw() { return a_condition; }
//void setMsgDataBlock(const anna::DataBlock &db) throw() { a_message = db; }
};
+class TestStepCmd : public TestStep {
+
+ std::string a_script;
+ std::string a_parameters;
+ std::thread a_thread;
+ bool a_threadRunning;
+ bool a_threadDeprecated;
+ int a_resultCode;
+ std::string a_errorMsg;
+ //std::string a_output; // for POPEN
+
+ public:
+ TestStepCmd(TestCase *testCase) : TestStep(testCase), a_threadRunning(false), a_threadDeprecated(false), a_resultCode(-2)/*, a_output("")*/, a_errorMsg("") { a_type = Type::Cmd; }
+
+ // setter & getters
+ void setThreadRunning(bool running) throw() { a_threadRunning = running; }
+ //bool getThreadRunning() const throw() { return a_threadRunning; }
+ //void setThreadDeprecated(bool deprecated) throw() { a_threadDeprecated = deprecated; }
+ //bool getThreadDeprecated() const throw() { return a_threadDeprecated; }
+
+ void setResultCode(int rc) throw() { a_resultCode = rc; }
+ int getResultCode() const throw() { return a_resultCode; }
+ void setErrorMsg(const std::string &em) throw() { a_errorMsg = em; }
+ const std::string &getErrorMsg() const throw() { return a_errorMsg; }
+ //void appendOutput(const std::string &output) throw() { a_output += output; }
+ //const std::string &getOutput() const throw() { return a_output; }
+
+ void setScript(const std::string &script) throw() { a_script = script; }
+ const std::string &getScript() const throw() { return a_script; }
+ void setParameters(const std::string ¶ms) throw() { a_parameters = params; }
+ const std::string &getParameters() const throw() { return a_parameters; }
+
+ // virtuals
+ bool do_execute() throw();
+ void do_complete() throw();
+ void do_reset() throw();
+ anna::xml::Node* asXML(anna::xml::Node* parent) const throw();
+};
+
+
#endif