MXS-1461 Modify some mock-classes
This commit is contained in:
@ -43,6 +43,11 @@ public:
|
|||||||
const char* zHost);
|
const char* zHost);
|
||||||
~Dcb();
|
~Dcb();
|
||||||
|
|
||||||
|
private:
|
||||||
|
int32_t write(GWBUF* pData);
|
||||||
|
|
||||||
|
static int32_t write(DCB* pDcb, GWBUF* pData);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::string m_user;
|
std::string m_user;
|
||||||
std::string m_host;
|
std::string m_host;
|
||||||
|
@ -14,6 +14,7 @@
|
|||||||
|
|
||||||
#include "mock.hh"
|
#include "mock.hh"
|
||||||
#include <maxscale/session.h>
|
#include <maxscale/session.h>
|
||||||
|
#include <maxscale/protocol/mysql.h>
|
||||||
#include "dcb.hh"
|
#include "dcb.hh"
|
||||||
|
|
||||||
namespace maxscale
|
namespace maxscale
|
||||||
@ -43,7 +44,8 @@ public:
|
|||||||
~Session();
|
~Session();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Dcb m_client_dcb;
|
Dcb m_client_dcb;
|
||||||
|
MYSQL_session m_mysql_session;
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -73,7 +73,6 @@ bool BufferBackend::idle(const RouterSession* pSession) const
|
|||||||
bool rv = true;
|
bool rv = true;
|
||||||
|
|
||||||
SessionResponses::const_iterator i = m_session_responses.find(pSession);
|
SessionResponses::const_iterator i = m_session_responses.find(pSession);
|
||||||
ss_dassert(i != m_session_responses.end());
|
|
||||||
|
|
||||||
if (i != m_session_responses.end())
|
if (i != m_session_responses.end())
|
||||||
{
|
{
|
||||||
|
@ -47,12 +47,27 @@ Dcb::Dcb(MXS_SESSION* pSession,
|
|||||||
pDcb->session = pSession;
|
pDcb->session = pSession;
|
||||||
pDcb->remote = const_cast<char*>(zHost);
|
pDcb->remote = const_cast<char*>(zHost);
|
||||||
pDcb->user = const_cast<char*>(zUser);
|
pDcb->user = const_cast<char*>(zUser);
|
||||||
|
|
||||||
|
pDcb->func.write = &Dcb::write;
|
||||||
}
|
}
|
||||||
|
|
||||||
Dcb::~Dcb()
|
Dcb::~Dcb()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int32_t Dcb::write(GWBUF* pData)
|
||||||
|
{
|
||||||
|
// TODO: Should be routed somewhere
|
||||||
|
gwbuf_free(pData);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
//static
|
||||||
|
int32_t Dcb::write(DCB* pDcb, GWBUF* pData)
|
||||||
|
{
|
||||||
|
return static_cast<Dcb*>(pDcb)->write(pData);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -32,6 +32,12 @@ Session::Session(const char* zUser,
|
|||||||
pSession->ses_chk_tail = CHK_NUM_SESSION;
|
pSession->ses_chk_tail = CHK_NUM_SESSION;
|
||||||
|
|
||||||
pSession->client_dcb = &m_client_dcb;
|
pSession->client_dcb = &m_client_dcb;
|
||||||
|
|
||||||
|
memset(&m_mysql_session, 0, sizeof(m_mysql_session));
|
||||||
|
|
||||||
|
strcpy(m_mysql_session.db, "dummy");
|
||||||
|
|
||||||
|
m_client_dcb.data = &m_mysql_session;
|
||||||
}
|
}
|
||||||
|
|
||||||
Session::~Session()
|
Session::~Session()
|
||||||
|
Reference in New Issue
Block a user