/* * File: TestApplication.h * Author: jgaebler * * Created on April 20, 2011, 11:33 AM */ #ifndef TESTAPPLICATION_H #define TESTAPPLICATION_H #include "Application.h" #include "simutils/statistics/DurationStatisticRecorder.h" #include "simutils/statistics/VectorStatisticRecorder.h" namespace ubeeme { namespace moversight { class Dispatcher; class Moversight; class Invitation; /** * @class TestApplication * @brief Defines a small test application to test the moversight protocol. * * @ingroup Moversight * @author Jan Gäbler */ class TestApplication : public Application { public: TestApplication(Moversight & m); virtual ~TestApplication(); virtual void initialise(); virtual void finalise(); void startTestCase(unsigned int i); void receiveGroupData(const GroupData & data, const PeerID sender); // Event handling virtual void handleEvent(const JoinRequestEvent & e); virtual void handleEvent(const JoinConfirmEvent & e); virtual void handleEvent(const JoinRejectedEvent & e); virtual void handleEvent(const JoinAbortedEvent & e); virtual void handleEvent(const GroupCreatedEvent & e); virtual void handleEvent(const GroupClosedEvent & e); virtual void handleEvent(const PeerJoinedEvent & e); virtual void handleEvent(const PendingPeersEvent & e); virtual void handleEvent(const PeerReconnectedEvent & e); virtual void handleEvent(const PeerLeftEvent & e); virtual void handleEvent(const StartMeasuringEvent & e); virtual void handleEvent(const StopMeasuringEvent & e); private: void testCase00(); void testCase01(); void testCase02(); void testCase03(); void testCase04(); void testCase05(); void testCase06(); void testCase07(); void testCase08(); void testCase09(); void testCase10(); void testCase11(); void testCase12(); void testCase13(); void testCase14(); void testCase15(); void testCase16(); void testCase17(); void testCase18(); void testCase19(); void testCase20(); void testCase21(); void testCase22(); /* void testCase23(); void testCase24(); void testCase25(); void testCase26(); void testCase27(); void testCase28(); */ void invitePeer(TransportAddress & ta); void leaveGroup(); void sendData(); void createRoster(); TransportAddress getNewTransportAddress(int i); DurationStatisticRecorder joinDelayStat; DurationStatisticRecorder dtDelayStat; DurationStatisticRecorder leaveDelayStat; DurationStatisticRecorder rejoinSuccessDuration; VectorStatisticRecorder groupSizeStat; size_t waitCounter; size_t groupSize; size_t lastGroupSize; bool hasLeft; int numberOfPeers; int clusterSize; int numberOfMobilePeers; }; } } #endif /* TESTAPPLICATION_H */