9#include "data_stream_check_value.h"
58 std::stringstream socketFileName;
60 p_mock.setFileName(socketFileName.str());
67 p_mock.setIsRecord(isMockRecord);
79 check_stream_assert(
p_mock.checkCurrentValue(
"PMockSocketFile::sendMsg", msg));
94 p_mock.getCurrentValue(msg);
95 if(msg.size() == 0lu){
177 return (
const DataStreamIter)msg.data();
194 mockMsg.resize(dataSize);
203 size_t dataSize(mockMsg.size());
bool phoenix_createMockBackend(PMockSocketFile &mock, const PSocketParam &socketParam, const std::string &prefix, const PMockParamFile &extraParam)
Create a mock backend file.
PMockParamFile Param
Define the type of extra parameters which can be used to create a Socket used by the PAbstractSocketM...
static void msgToMock(DataStreamMsg &mockMsg, const Message &msg)
Copy current backend message data into mock message.
static void msgResize(Message &msg, size_t sizeMsg)
Resize a message.
DataStreamMsg Message
Define the type of message used by the PAbstractSocketManager.
bool createServerSocket(Socket &socket, const PSocketParam &socketParam, const Param ¶m)
Create a client socket.
static const DataStreamIter msgData(const Message &msg)
Get the data of a message.
virtual ~PMockBackendFile()
Destructor of PMockBackendFile.
static Param client()
Create param for a client socket.
PMockSocketFile Socket
Define the socket of the backend used by the PAbstractSocketManager.
bool createClientSocket(Socket &socket, const PSocketParam &socketParam, const Param ¶m)
Create a client socket.
static size_t msgSize(const Message &msg)
Get the size of a message.
static void mockToMsg(Message &msg, DataStreamMsg &mockMsg)
Copy mock message data into current backend message.
PMockBackendFile()
Default constructor of PMockBackendFile.
static Param server()
Create param for a server socket.
Example of a mock socket with vector of messages.
PRecvStatus::PRecvStatus recvMsg(Message &msg, PRecvFlag::PRecvFlag flag)
Recieved data with the socket.
void setMockPrefix(const std::string &mockPrefix)
Set the mock prefix (where to find/save it)
Param p_extraParam
Extra parameters of the socket.
bool createClientSocket(const PSocketParam &socketParam, const Param &extraParam)
Initialise a client socket.
PMockParamFile Param
Define the type of extra parameters which can be used to create a Socket used by the PAbstractSocketM...
void setIsMockRecord(bool isMockRecord)
Set the mock prefix (where to find/save it)
PSocketParam p_socketParam
Parameters of the socket.
bool isConnected() const
Say if the PMockSocketFile is connected.
PMockSocketFile()
Default constructor of hte PMockSocketFile.
bool createServerSocket(const PSocketParam &socketParam, const Param &extraParam)
Initialise a server socket.
void close()
Close the PMockSocketFile.
PSendStatus::PSendStatus sendMsg(const Message &msg, PSendFlag::PSendFlag flag)
Specialisation to send a Message with the socket.
PGenericFileMock< DataStreamMsg > p_mock
Mock handler.
virtual ~PMockSocketFile()
Default destructor of hte PMockSocketFile.
DataStreamMsg Message
Define the type of message used by the PAbstractSocketManager.
PRecvFlag
describe the receiving flag of the Socket
PRecvStatus
describe the result of the recv
PSendFlag
describe the sending flag of the Socket
PSendStatus
describe the result of the send
Set of parameters to be passed to create a socket with mock backend.
Parameters to create a socket.