X-Git-Url: https://git.teslayout.com/public/public/public/?a=blobdiff_plain;f=example%2Fdiameter%2Flauncher%2Ftesting%2FTestCase.hpp;h=b55abd75cc3d804ad9f10dd459125821ded6e099;hb=61f1340da3cae5159d2e3bc14fc47c6d4bf9453e;hp=a3c48f0ead730d50389dacbf5011f8391d25df99;hpb=4c3f0a4d7e4db76996404d80c6f939548fca656f;p=anna.git diff --git a/example/diameter/launcher/testing/TestCase.hpp b/example/diameter/launcher/testing/TestCase.hpp index a3c48f0..b55abd7 100644 --- a/example/diameter/launcher/testing/TestCase.hpp +++ b/example/diameter/launcher/testing/TestCase.hpp @@ -12,6 +12,7 @@ // Standard #include #include +#include // Project #include @@ -30,7 +31,7 @@ namespace anna { } } -class RealmNode; +class OriginHost; class TestCase { @@ -56,7 +57,7 @@ public: anna::xml::Node* asXML(anna::xml::Node* parent) const throw(); }; - TestCase(unsigned int id) : a_id(id), a_state(State::Initialized), a_startTime(0) { /*a_stepsIt = a_steps.end()*/;} + TestCase(unsigned int id); ~TestCase(); struct State { enum _v { Initialized, InProgress, Failed, Success }; }; @@ -69,16 +70,30 @@ public: bool inProgress() const throw() { return (getState() == State::InProgress); } bool hasSameCondition(const TestCondition &condition) const throw(); + // Interactivity: + void makeInteractive(bool yes = true) throw() { a_interactiveAmount = (yes ? 0:-1); } + void addInteractiveAmount(unsigned int amount) throw() { + if (a_interactiveAmount == -1) makeInteractive(); + if (amount == 0) return; + a_interactiveAmount += amount; + process(); + } + int interactiveAmount() const throw() { return a_interactiveAmount; } + void interactiveExecution() throw() { a_interactiveAmount --; } + // Step type & information void addTimeout(const anna::Millisecond &timeout) throw(anna::RuntimeException); - void addSendxml2e(const anna::DataBlock &db, RealmNode *realm, int stepNumber) throw(anna::RuntimeException); - void addSendxml2c(const anna::DataBlock &db, RealmNode *realm, int stepNumber) throw(anna::RuntimeException); + void addSendxml2e(const anna::DataBlock &db, OriginHost *host, int stepNumber) throw(anna::RuntimeException); + void addSendxml2c(const anna::DataBlock &db, OriginHost *host, int stepNumber) throw(anna::RuntimeException); void addDelay(const anna::Millisecond &delay) throw(anna::RuntimeException); void addWait(bool fromEntity, - const std::string &code, const std::string &bitR, const std::string &resultCode, const std::string &sessionId, - const std::string &hopByHop, const std::string &msisdn, const std::string &imsi, const std::string &serviceContextId) throw(anna::RuntimeException); + const std::string &code, const std::string &bitR, const std::string &hopByHop, const std::string &applicationId, + const std::string &sessionId, const std::string &resultCode, + const std::string &msisdn, const std::string &imsi, const std::string &serviceContextId) throw(anna::RuntimeException); void addWaitAnswer(bool fromEntity, int stepNumber) throw(anna::RuntimeException); void addWaitRegexp(bool fromEntity, const std::string ®exp) throw(anna::RuntimeException); + void addCommand(const std::string &cmd) throw(anna::RuntimeException); + // Process: void nextStep() throw() { a_stepsIt++; } @@ -94,6 +109,8 @@ public: //helpers int steps() const throw() { return a_steps.size(); } + void addStep(TestStep *step) throw() { a_steps.push_back(step); } + TestStepWait *searchNextWaitConditionFulfilled(const anna::DataBlock &message, bool waitFromEntity) throw(); // When a message arrives, we identify the test case by mean the Session-Id. Then, from the current step iterator (included), // we search for a fulfilling condition for that message. The first found, is 'completed' and then breaks the search. @@ -112,6 +129,7 @@ private: State::_v a_state; anna::Millisecond a_startTime; DebugSummary a_debugSummary; // used when a test case has failed, uncovered message conditions, and any other hint. + int a_interactiveAmount; friend class TestStep; };