changed integ tests to use another port for ipc.
This commit is contained in:
parent
5f0402d47b
commit
eca240eec7
|
@ -27,6 +27,19 @@ CEvent::Type CIpcClient::s_messageReceivedEvent = CEvent::kUnknown;
|
||||||
CIpcClient::CIpcClient() :
|
CIpcClient::CIpcClient() :
|
||||||
m_serverAddress(CNetworkAddress(IPC_HOST, IPC_PORT)),
|
m_serverAddress(CNetworkAddress(IPC_HOST, IPC_PORT)),
|
||||||
m_server(nullptr)
|
m_server(nullptr)
|
||||||
|
{
|
||||||
|
init();
|
||||||
|
}
|
||||||
|
|
||||||
|
CIpcClient::CIpcClient(int port) :
|
||||||
|
m_serverAddress(CNetworkAddress(IPC_HOST, port)),
|
||||||
|
m_server(nullptr)
|
||||||
|
{
|
||||||
|
init();
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
CIpcClient::init()
|
||||||
{
|
{
|
||||||
m_serverAddress.resolve();
|
m_serverAddress.resolve();
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,6 +30,7 @@ class CIpcMessage;
|
||||||
class CIpcClient {
|
class CIpcClient {
|
||||||
public:
|
public:
|
||||||
CIpcClient();
|
CIpcClient();
|
||||||
|
CIpcClient(int port);
|
||||||
virtual ~CIpcClient();
|
virtual ~CIpcClient();
|
||||||
|
|
||||||
//! @name manipulators
|
//! @name manipulators
|
||||||
|
@ -55,6 +56,7 @@ public:
|
||||||
//@}
|
//@}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
void init();
|
||||||
void handleConnected(const CEvent&, void*);
|
void handleConnected(const CEvent&, void*);
|
||||||
void handleMessageReceived(const CEvent&, void*);
|
void handleMessageReceived(const CEvent&, void*);
|
||||||
|
|
||||||
|
|
|
@ -31,6 +31,18 @@ CEvent::Type CIpcServer::s_messageReceivedEvent = CEvent::kUnknown;
|
||||||
|
|
||||||
CIpcServer::CIpcServer() :
|
CIpcServer::CIpcServer() :
|
||||||
m_address(CNetworkAddress(IPC_HOST, IPC_PORT))
|
m_address(CNetworkAddress(IPC_HOST, IPC_PORT))
|
||||||
|
{
|
||||||
|
init();
|
||||||
|
}
|
||||||
|
|
||||||
|
CIpcServer::CIpcServer(int port) :
|
||||||
|
m_address(CNetworkAddress(IPC_HOST, port))
|
||||||
|
{
|
||||||
|
init();
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
CIpcServer::init()
|
||||||
{
|
{
|
||||||
m_clientsMutex = ARCH->newMutex();
|
m_clientsMutex = ARCH->newMutex();
|
||||||
m_address.resolve();
|
m_address.resolve();
|
||||||
|
|
|
@ -37,6 +37,7 @@ and allows the daemon and client/server to send log data to the GUI.
|
||||||
class CIpcServer {
|
class CIpcServer {
|
||||||
public:
|
public:
|
||||||
CIpcServer();
|
CIpcServer();
|
||||||
|
CIpcServer(int port);
|
||||||
virtual ~CIpcServer();
|
virtual ~CIpcServer();
|
||||||
|
|
||||||
//! @name manipulators
|
//! @name manipulators
|
||||||
|
@ -64,6 +65,7 @@ public:
|
||||||
//@}
|
//@}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
void init();
|
||||||
void handleClientConnecting(const CEvent&, void*);
|
void handleClientConnecting(const CEvent&, void*);
|
||||||
void handleClientDisconnected(const CEvent&, void*);
|
void handleClientDisconnected(const CEvent&, void*);
|
||||||
void handleMessageReceived(const CEvent&, void*);
|
void handleMessageReceived(const CEvent&, void*);
|
||||||
|
|
|
@ -36,6 +36,8 @@
|
||||||
#include "CIpcMessage.h"
|
#include "CIpcMessage.h"
|
||||||
#include "CSimpleEventQueueBuffer.h"
|
#include "CSimpleEventQueueBuffer.h"
|
||||||
|
|
||||||
|
#define TEST_IPC_PORT 24802
|
||||||
|
|
||||||
class CIpcTests : public ::testing::Test
|
class CIpcTests : public ::testing::Test
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
@ -71,7 +73,7 @@ public:
|
||||||
|
|
||||||
TEST_F(CIpcTests, connectToServer)
|
TEST_F(CIpcTests, connectToServer)
|
||||||
{
|
{
|
||||||
CIpcServer server;
|
CIpcServer server(TEST_IPC_PORT);
|
||||||
server.listen();
|
server.listen();
|
||||||
m_connectToServer_server = &server;
|
m_connectToServer_server = &server;
|
||||||
|
|
||||||
|
@ -79,8 +81,8 @@ TEST_F(CIpcTests, connectToServer)
|
||||||
CIpcServer::getMessageReceivedEvent(), &server,
|
CIpcServer::getMessageReceivedEvent(), &server,
|
||||||
new TMethodEventJob<CIpcTests>(
|
new TMethodEventJob<CIpcTests>(
|
||||||
this, &CIpcTests::connectToServer_handleMessageReceived));
|
this, &CIpcTests::connectToServer_handleMessageReceived));
|
||||||
|
|
||||||
CIpcClient client;
|
CIpcClient client(TEST_IPC_PORT);
|
||||||
client.connect();
|
client.connect();
|
||||||
|
|
||||||
initQuitTimeout(2);
|
initQuitTimeout(2);
|
||||||
|
@ -94,7 +96,7 @@ TEST_F(CIpcTests, connectToServer)
|
||||||
|
|
||||||
TEST_F(CIpcTests, sendMessageToServer)
|
TEST_F(CIpcTests, sendMessageToServer)
|
||||||
{
|
{
|
||||||
CIpcServer server;
|
CIpcServer server(TEST_IPC_PORT);
|
||||||
server.listen();
|
server.listen();
|
||||||
|
|
||||||
// event handler sends "test" command to server.
|
// event handler sends "test" command to server.
|
||||||
|
@ -107,8 +109,8 @@ TEST_F(CIpcTests, sendMessageToServer)
|
||||||
CIpcServer::getMessageReceivedEvent(), &server,
|
CIpcServer::getMessageReceivedEvent(), &server,
|
||||||
new TMethodEventJob<CIpcTests>(
|
new TMethodEventJob<CIpcTests>(
|
||||||
this, &CIpcTests::sendMessageToServer_handleMessageReceived));
|
this, &CIpcTests::sendMessageToServer_handleMessageReceived));
|
||||||
|
|
||||||
CIpcClient client;
|
CIpcClient client(TEST_IPC_PORT);
|
||||||
client.connect();
|
client.connect();
|
||||||
m_sendMessageToServer_client = &client;
|
m_sendMessageToServer_client = &client;
|
||||||
|
|
||||||
|
@ -123,7 +125,7 @@ TEST_F(CIpcTests, sendMessageToServer)
|
||||||
|
|
||||||
TEST_F(CIpcTests, sendMessageToClient)
|
TEST_F(CIpcTests, sendMessageToClient)
|
||||||
{
|
{
|
||||||
CIpcServer server;
|
CIpcServer server(TEST_IPC_PORT);
|
||||||
server.listen();
|
server.listen();
|
||||||
m_sendMessageToClient_server = &server;
|
m_sendMessageToClient_server = &server;
|
||||||
|
|
||||||
|
@ -133,7 +135,7 @@ TEST_F(CIpcTests, sendMessageToClient)
|
||||||
new TMethodEventJob<CIpcTests>(
|
new TMethodEventJob<CIpcTests>(
|
||||||
this, &CIpcTests::sendMessageToClient_handleClientConnected));
|
this, &CIpcTests::sendMessageToClient_handleClientConnected));
|
||||||
|
|
||||||
CIpcClient client;
|
CIpcClient client(TEST_IPC_PORT);
|
||||||
client.connect();
|
client.connect();
|
||||||
|
|
||||||
m_events.adoptHandler(
|
m_events.adoptHandler(
|
||||||
|
|
Loading…
Reference in New Issue