| 10 | using namespace icinga; |
| 11 | |
| 12 | String 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 |
no test coverage detected