]> git.localhorst.tv Git - blank.git/blob - tst/integration/TestServer.hpp
first test for actual program binary
[blank.git] / tst / integration / TestServer.hpp
1 #ifndef BLANK_TEST_INTEGRATION_TESTSERVER_HPP_
2 #define BLANK_TEST_INTEGRATION_TESTSERVER_HPP_
3
4 #include "app/Process.hpp"
5 #include "io/filesystem.hpp"
6 #include "io/LineBuffer.hpp"
7 #include "net/tcp.hpp"
8
9
10 namespace blank {
11 namespace test {
12
13 class TestServer {
14
15 public:
16         TestServer();
17         ~TestServer();
18
19 public:
20         /// wait until server writes given line to stdout
21         void WaitOutputLine(const std::string &line);
22
23         /// wait for given message on the command service
24         void WaitCommandMessage(const std::string &line);
25         /// wait for given error on the command service
26         void WaitCommandError(const std::string &line);
27         /// wait for given broadcast on the command service
28         void WaitCommandBroadcast(const std::string &line);
29         /// wait for given line on the command service
30         void WaitCommandLine(const std::string &line);
31
32         /// send command line to server
33         void SendCommand(const std::string &);
34
35 private:
36         TempDir dir;
37         Process proc;
38         tcp::Socket conn;
39         size_t head;
40         LineBuffer<BUFSIZ> serv_buf;
41         LineBuffer<BUFSIZ> sock_buf;
42
43 };
44
45 }
46 }
47
48 #endif