X-Git-Url: https://git.teslayout.com/public/public/public/?a=blobdiff_plain;ds=sidebyside;f=example%2Fdiameter%2Flauncher%2Ftesting%2FTestStep.hpp;h=1cb062d4c5521fe78d5f3b2238efdcddf7fd71d5;hb=cbbe8862e2d4f395e61c1939fbbabf9e7f92fa2b;hp=3473c544458af5b7f122b3a18db96a0bc5ed9a5f;hpb=2921c651c9945cefec0715167201596aaa079e8d;p=anna.git diff --git a/example/diameter/launcher/testing/TestStep.hpp b/example/diameter/launcher/testing/TestStep.hpp index 3473c54..1cb062d 100644 --- a/example/diameter/launcher/testing/TestStep.hpp +++ b/example/diameter/launcher/testing/TestStep.hpp @@ -12,6 +12,7 @@ // Standard #include #include +#include // Project #include @@ -21,6 +22,8 @@ #include + + namespace anna { class Millisecond; @@ -53,7 +56,7 @@ class TestStep { 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); } @@ -175,7 +178,7 @@ class TestStepWait : public TestStep { anna::diameter::comm::ServerSession *a_serverSession; public: - TestStepWait(TestCase *testCase) : TestStep(testCase) { a_type = Type::Wait; a_clientSession = NULL; a_serverSession = NULL; } + TestStepWait(TestCase *testCase) : TestStep(testCase), a_message(true) { a_type = Type::Wait; a_clientSession = NULL; a_serverSession = NULL; } ~TestStepWait() {;} // setter & getters @@ -201,4 +204,44 @@ class TestStepWait : public TestStep { }; +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