91 lines
2.6 KiB
C++
91 lines
2.6 KiB
C++
/*
|
|
* File: MaintanceApplication.h
|
|
* Author: stubbfel
|
|
*
|
|
* Created on June 29, 2013
|
|
*/
|
|
#ifndef MAINTANCEAPPLICATION_H
|
|
#define MAINTANCEAPPLICATION_H
|
|
|
|
#include "app/Application.h"
|
|
#include "StreamMessage.h"
|
|
#include "simutils/statistics/VectorStatisticRecorder.h"
|
|
|
|
namespace ubeeme {
|
|
namespace moversight {
|
|
|
|
class Dispatcher;
|
|
class Moversight;
|
|
class Invitation;
|
|
|
|
/**
|
|
* @class MaintanceApplication
|
|
* @brief test app for testing maintancement
|
|
* @ingroup Moversight
|
|
* @author stubbfel
|
|
*/
|
|
class MaintanceApplication : public Application {
|
|
public:
|
|
MaintanceApplication(Moversight & m);
|
|
virtual ~MaintanceApplication();
|
|
|
|
virtual void initialise();
|
|
virtual void finalise();
|
|
|
|
void startTestCase(unsigned int i);
|
|
|
|
void leaveGroup();
|
|
|
|
void receiveUnicastMessage(UnicastMessage & data, PeerID sender);
|
|
|
|
// Event handling
|
|
virtual void handleEvent(const JoinRequestEvent & e);
|
|
virtual void handleEvent(const PeerJoinedEvent & e);
|
|
virtual void handleEvent(const PeerLeftEvent & e);
|
|
virtual void handleEvent(const LocalPeerUpdatedEvent & e);
|
|
virtual void handleEvent(const GroupClosedEvent & e);
|
|
virtual void handleEvent(const MulticastMessageDroppedEvent & e);
|
|
|
|
void receiveGroupData(const GroupData & dat, const PeerID sender);
|
|
|
|
private:
|
|
void testCase00();
|
|
void testCase01();
|
|
void testCase02();
|
|
void testCase03();
|
|
void testCase04();
|
|
void testCase05();
|
|
void testCase06();
|
|
void invitePeer(TransportAddress & ta);
|
|
void defaultBehav();
|
|
void defaultBehav2();
|
|
void coordinateBehav();
|
|
void sendKickMessage(PeerID pId);
|
|
PeerID createFakeID(unsigned int value);
|
|
|
|
ByteArray peerIDToByte(PeerID pId);
|
|
PeerID byteToPeerID(ByteArray array);
|
|
|
|
void meassuringRTT(PeerID peerId, const GroupData & dat);
|
|
|
|
int moduleIndex;
|
|
bool inGroup;
|
|
bool emptyCommandList;
|
|
int joinRate;
|
|
int leaveRate;
|
|
std::string commandsFileName;
|
|
bool stopTest;
|
|
bool nextCommand;
|
|
List<std::string> commands;
|
|
VectorStatisticRecorder RTTStat;
|
|
|
|
static const unsigned int INITIAL_FAKEID = 1000;
|
|
static const unsigned int MS_TO_INT_FACTOR = 1000;
|
|
|
|
};
|
|
}
|
|
}
|
|
|
|
#endif /* MAINTANCEAPPLICATION_H*/
|
|
|