]> git.localhorst.tv Git - blank.git/blobdiff - tst/integration/TestServer.hpp
first test for actual program binary
[blank.git] / tst / integration / TestServer.hpp
diff --git a/tst/integration/TestServer.hpp b/tst/integration/TestServer.hpp
new file mode 100644 (file)
index 0000000..9ac31d7
--- /dev/null
@@ -0,0 +1,48 @@
+#ifndef BLANK_TEST_INTEGRATION_TESTSERVER_HPP_
+#define BLANK_TEST_INTEGRATION_TESTSERVER_HPP_
+
+#include "app/Process.hpp"
+#include "io/filesystem.hpp"
+#include "io/LineBuffer.hpp"
+#include "net/tcp.hpp"
+
+
+namespace blank {
+namespace test {
+
+class TestServer {
+
+public:
+       TestServer();
+       ~TestServer();
+
+public:
+       /// wait until server writes given line to stdout
+       void WaitOutputLine(const std::string &line);
+
+       /// wait for given message on the command service
+       void WaitCommandMessage(const std::string &line);
+       /// wait for given error on the command service
+       void WaitCommandError(const std::string &line);
+       /// wait for given broadcast on the command service
+       void WaitCommandBroadcast(const std::string &line);
+       /// wait for given line on the command service
+       void WaitCommandLine(const std::string &line);
+
+       /// send command line to server
+       void SendCommand(const std::string &);
+
+private:
+       TempDir dir;
+       Process proc;
+       tcp::Socket conn;
+       size_t head;
+       LineBuffer<BUFSIZ> serv_buf;
+       LineBuffer<BUFSIZ> sock_buf;
+
+};
+
+}
+}
+
+#endif