admin.setPolicies(cp, expectedResult);
}
-void restartCynara()
-{
- ServiceManager serviceManager(CynaraTestConsts::SERVICE);
- serviceManager.restartService();
-}
-
void getAgentRequest(Agent &agent, AgentRequest &request, Client &client,
int expectedResult = CYNARA_API_SUCCESS,
Timeout::ExpectMode expectTimeoutMode = Timeout::ExpectMode::TIMEOUT)
};
Timeout::callAndWait(testTimeLimit, Timeout::ExpectMode::TIMEOUT,
- restartCynara, hangOnGetRequest);
+ restartCynaraServiceAndSockets, hangOnGetRequest);
}
void tcag06_check_with_unregistered_agent_func()
auto testTimeLimit = std::chrono::seconds(5);
Timeout::callAndWait(testTimeLimit, Timeout::ExpectMode::FINISHED,
- restartCynara, getAgentRequest, std::ref(agent), std::ref(agentRequest),
- std::ref(client), CYNARA_API_SUCCESS, Timeout::ExpectMode::TIMEOUT);
+ restartCynaraServiceAndSockets, getAgentRequest,
+ std::ref(agent), std::ref(agentRequest), std::ref(client),
+ CYNARA_API_SUCCESS, Timeout::ExpectMode::TIMEOUT);
agentRequest.assertAction(data.m_client, data.m_user, data.m_privilege);
agent.putResponse(AgentResponse::createAllow(agentRequest.id()));
auto testTimeLimit = std::chrono::seconds(5);
Timeout::callAndWait(testTimeLimit, Timeout::ExpectMode::FINISHED,
- restartCynara, getAgentRequest, std::ref(agent), std::ref(agentRequest),
- std::ref(client), CYNARA_API_SUCCESS, Timeout::ExpectMode::TIMEOUT);
+ restartCynaraServiceAndSockets, getAgentRequest,
+ std::ref(agent), std::ref(agentRequest), std::ref(client),
+ CYNARA_API_SUCCESS, Timeout::ExpectMode::TIMEOUT);
agentRequest.assertAction(data.m_client, data.m_user, data.m_privilege);
agent.putResponse(AgentResponse::createAllow(agentRequest.id() + 1));
client.process(CYNARA_API_SUCCESS, Client::TimeoutExpectation::EXPECT_TIMEOUT, 2);
auto testTimeLimit = std::chrono::seconds(5);
Timeout::callAndWait(testTimeLimit, Timeout::ExpectMode::FINISHED,
- restartCynara, getAgentRequest, std::ref(agent), std::ref(agentRequest),
- std::ref(client), CYNARA_API_SUCCESS, Timeout::ExpectMode::TIMEOUT);
+ restartCynaraServiceAndSockets, getAgentRequest,
+ std::ref(agent), std::ref(agentRequest), std::ref(client),
+ CYNARA_API_SUCCESS, Timeout::ExpectMode::TIMEOUT);
agentRequest.assertAction(data.m_client, data.m_user, data.m_privilege);
agent.putResponse(AgentResponse::createAllow(agentRequest.id() + 1));
client.process(CYNARA_API_SUCCESS, Client::TimeoutExpectation::EXPECT_TIMEOUT, 2);
auto testTimeLimit = std::chrono::seconds(5);
Timeout::callAndWait(testTimeLimit, Timeout::ExpectMode::FINISHED,
- restartCynara, getAgentRequest, std::ref(agent), std::ref(agentRequest),
- std::ref(client), CYNARA_API_SUCCESS, Timeout::ExpectMode::TIMEOUT);
+ restartCynaraServiceAndSockets, getAgentRequest,
+ std::ref(agent), std::ref(agentRequest), std::ref(client),
+ CYNARA_API_SUCCESS, Timeout::ExpectMode::TIMEOUT);
agentRequest.assertAction(data.m_client, data.m_user, data.m_privilege);
client.cancel(id);
Timeout::callAndWait(testTimeLimit, Timeout::ExpectMode::FINISHED,
- restartCynara, getAgentRequest, std::ref(agent), std::ref(agentRequest),
- std::ref(client), CYNARA_API_SUCCESS, Timeout::ExpectMode::TIMEOUT);
+ restartCynaraServiceAndSockets, getAgentRequest,
+ std::ref(agent), std::ref(agentRequest), std::ref(client),
+ CYNARA_API_SUCCESS, Timeout::ExpectMode::TIMEOUT);
agentRequest.assertCancel();
agent.putResponse(AgentResponse::createCancel(id));
client.process(CYNARA_API_SUCCESS, Client::TimeoutExpectation::EXPECT_NO_TIMEOUT, 2);
auto testTimeLimit = std::chrono::seconds(5);
Timeout::callAndWait(testTimeLimit, Timeout::ExpectMode::FINISHED,
- restartCynara, getAgentRequest, std::ref(agent), std::ref(agentRequest),
- std::ref(client), CYNARA_API_SUCCESS, Timeout::ExpectMode::TIMEOUT);
+ restartCynaraServiceAndSockets, getAgentRequest,
+ std::ref(agent), std::ref(agentRequest), std::ref(client),
+ CYNARA_API_SUCCESS, Timeout::ExpectMode::TIMEOUT);
agentRequest.assertAction(data.m_client, data.m_user, data.m_privilege);
agent.putResponse(AgentResponse::createCancel(id));
client.cancel(id);
// we do not expect getting the cancel request in the agent
Timeout::callAndWait(testTimeLimit, Timeout::ExpectMode::TIMEOUT,
- restartCynara, getAgentRequest, std::ref(agent), std::ref(agentRequest),
- std::ref(client), CYNARA_API_SERVICE_NOT_AVAILABLE, Timeout::ExpectMode::TIMEOUT);
+ restartCynaraServiceAndSockets, getAgentRequest,
+ std::ref(agent), std::ref(agentRequest), std::ref(client),
+ CYNARA_API_SERVICE_NOT_AVAILABLE, Timeout::ExpectMode::TIMEOUT);
client.process(CYNARA_API_SUCCESS, Client::TimeoutExpectation::EXPECT_NO_TIMEOUT, 2);
}
auto testTimeLimit = std::chrono::seconds(5);
Timeout::callAndWait(testTimeLimit, Timeout::ExpectMode::FINISHED,
- restartCynara, getAgentRequest, std::ref(agent), std::ref(agentRequest1),
- std::ref(client), CYNARA_API_SUCCESS, Timeout::ExpectMode::TIMEOUT);
+ restartCynaraServiceAndSockets, getAgentRequest,
+ std::ref(agent), std::ref(agentRequest1), std::ref(client),
+ CYNARA_API_SUCCESS, Timeout::ExpectMode::TIMEOUT);
Timeout::callAndWait(testTimeLimit, Timeout::ExpectMode::FINISHED,
- restartCynara, getAgentRequest, std::ref(agent), std::ref(agentRequest2),
- std::ref(client), CYNARA_API_SUCCESS, Timeout::ExpectMode::IGNORE);
+ restartCynaraServiceAndSockets, getAgentRequest,
+ std::ref(agent), std::ref(agentRequest2), std::ref(client),
+ CYNARA_API_SUCCESS, Timeout::ExpectMode::IGNORE);
client.cancel(id2);
client.assertStatus(READWRITE);
Timeout::callAndWait(testTimeLimit, Timeout::ExpectMode::FINISHED,
- restartCynara, getAgentRequest, std::ref(agent), std::ref(agentRequest3),
- std::ref(client), CYNARA_API_SUCCESS, Timeout::ExpectMode::TIMEOUT);
+ restartCynaraServiceAndSockets, getAgentRequest,
+ std::ref(agent), std::ref(agentRequest3), std::ref(client),
+ CYNARA_API_SUCCESS, Timeout::ExpectMode::TIMEOUT);
agentRequest1.assertAction(data1.m_client, data1.m_user, data1.m_privilege);
agentRequest2.assertAction(data2.m_client, data2.m_user, data2.m_privilege);
agentRequest3.assertCancel();
client.createRequest(data, ids[i], callbackData);
client.assertStatus(READWRITE);
auto testTimeLimit = std::chrono::seconds(5);
- Timeout::callAndWait(testTimeLimit, Timeout::ExpectMode::FINISHED, restartCynara,
- getAgentRequest, std::ref(agent), std::ref(agentRequests[i]),
- std::ref(client), CYNARA_API_SUCCESS, Timeout::ExpectMode::TIMEOUT);
+ Timeout::callAndWait(testTimeLimit, Timeout::ExpectMode::FINISHED,
+ restartCynaraServiceAndSockets, getAgentRequest,
+ std::ref(agent), std::ref(agentRequests[i]), std::ref(client),
+ CYNARA_API_SUCCESS, Timeout::ExpectMode::TIMEOUT);
agentRequests[i].assertAction(data.m_client, data.m_user, data.m_privilege);
};
for (int i = numberOfRequests - 1; i >= 0; i--) {
client.createRequest(data, id, callbackData);
client.assertStatus(READWRITE);
Timeout::callAndWait(testTimeLimit, Timeout::ExpectMode::FINISHED,
- restartCynara, getAgentRequest, std::ref(agent),
- std::ref(agentRequest), std::ref(client),
+ restartCynaraServiceAndSockets, getAgentRequest,
+ std::ref(agent), std::ref(agentRequest), std::ref(client),
CYNARA_API_SUCCESS, Timeout::ExpectMode::TIMEOUT);
};
auto getAgentRequestWrap = [&agent, &agentRequest]() {
agent.getRequest(agentRequest, CYNARA_API_SUCCESS);
};
Timeout::callAndWait(testTimeLimit, Timeout::ExpectMode::FINISHED,
- restartCynara, getAgentRequestWrap);
+ restartCynaraServiceAndSockets, getAgentRequestWrap);
agentRequest.assertCancel();
}
{
Agent agent;
auto testTimeLimit = std::chrono::seconds(5);
- Timeout::callAndWait(testTimeLimit, Timeout::ExpectMode::FINISHED, restartCynara,
- getAgentRequest, std::ref(agent), std::ref(agentRequest),
- std::ref(client), CYNARA_API_SUCCESS, Timeout::ExpectMode::TIMEOUT);
+ Timeout::callAndWait(testTimeLimit, Timeout::ExpectMode::FINISHED,
+ restartCynaraServiceAndSockets, getAgentRequest,
+ std::ref(agent), std::ref(agentRequest), std::ref(client),
+ CYNARA_API_SUCCESS, Timeout::ExpectMode::TIMEOUT);
};
client.process(CYNARA_API_SUCCESS, Client::TimeoutExpectation::EXPECT_NO_TIMEOUT, 2);
}
{
std::string testNo("08");
int subtest = 1;
- ServiceManager serviceManager(CynaraTestConsts::SERVICE);
cynara_check_id id;
RequestEntity callbackData = {RequestFunction(),
CYNARA_API_ACCESS_DENIED,
client.createRequest({testNo, subtest}, id, callbackData);
client.assertStatus(READWRITE);
- serviceManager.restartService();
+ restartCynaraServiceAndSockets();
client.process();
client.assertStatus(READ);
{
std::string testNo("08");
int subtest = 2;
- ServiceManager serviceManager(CynaraTestConsts::SERVICE);
cynara_check_id id;
RequestEntity callbackData = {RequestFunction(),
CYNARA_API_ACCESS_DENIED,
client.createRequest({testNo, subtest}, id, callbackData);
client.assertStatus(READWRITE);
- serviceManager.restartService();
+ restartCynaraServiceAndSockets();
client.process();
client.assertStatus(READ);
- serviceManager.restartService();
+ restartCynaraServiceAndSockets();
client.process();
client.process(CYNARA_API_SUCCESS, Client::IGNORE_TIMEOUT);
std::string testNo("08");
int subtest = 2;
cynara_check_id id;
- RequestEntity callbackData = {[&](){
- ServiceManager serviceManager(CynaraTestConsts::SERVICE);
- serviceManager.restartService();
- },
+ RequestEntity callbackData = {restartCynaraServiceAndSockets,
CYNARA_API_ACCESS_DENIED,
CYNARA_CALL_CAUSE_ANSWER};
Client client;
{
std::string testNo("09");
int subtest = 1;
- ServiceManager serviceManager(CynaraTestConsts::SERVICE);
cynara_check_id id;
RequestEntity callbackData = {RequestFunction(),
CYNARA_API_ACCESS_DENIED,
client.process();
client.assertStatus(READ);
- serviceManager.restartService();
+ restartCynaraServiceAndSockets();
client.cancel(id);
client.assertStatus(READWRITE);
{
std::string testNo("09");
int subtest = 2;
- ServiceManager serviceManager(CynaraTestConsts::SERVICE);
cynara_check_id id;
RequestEntity callbackData = {RequestFunction(),
CYNARA_API_ACCESS_DENIED,
client.cancel(id);
client.assertStatus(READWRITE);
- serviceManager.restartService();
+ restartCynaraServiceAndSockets();
//handle reconnect
client.process();
CYNARA_CALL_CAUSE_ANSWER};
RequestEntity callbackData = {[&](){
- ServiceManager serviceManager(CynaraTestConsts::SERVICE);
- serviceManager.restartService();
+ restartCynaraServiceAndSockets();
client.createRequest({testNo}, id2, callbackData2);
},
CYNARA_API_ACCESS_DENIED,