MCPcopy Create free account
hub / github.com/Icinga/icinga2 / LivestatusQueryHelper

Function LivestatusQueryHelper

test/livestatus.cpp:12–43  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

10using namespace icinga;
11
12String LivestatusQueryHelper(const std::vector<String>& lines)
13{
14 LivestatusQuery::Ptr query = new LivestatusQuery(lines, "");
15
16 std::stringstream stream;
17 StdioStream::Ptr sstream = new StdioStream(&stream, false);
18
19 query->Execute(new StoppableWaitGroup(), sstream);
20
21 String output;
22 String result;
23
24 StreamReadContext src;
25 for (;;) {
26 StreamReadStatus srs = sstream->ReadLine(&result, src);
27
28 if (srs == StatusEof)
29 break;
30
31 if (srs != StatusNewItem)
32 continue;
33
34 if (result.GetLength() > 0)
35 output += result + "\n";
36 else
37 break;
38 }
39
40 BOOST_TEST_MESSAGE("Query Result: " + output);
41
42 return output;
43}
44
45//____________________________________________________________________________//
46

Callers 1

BOOST_AUTO_TEST_CASEFunction · 0.85

Calls 3

ExecuteMethod · 0.45
ReadLineMethod · 0.45
GetLengthMethod · 0.45

Tested by

no test coverage detected