summaryrefslogtreecommitdiff
path: root/src/test/service.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/test/service.h')
-rw-r--r--src/test/service.h35
1 files changed, 35 insertions, 0 deletions
diff --git a/src/test/service.h b/src/test/service.h
new file mode 100644
index 0000000..c693ce4
--- /dev/null
+++ b/src/test/service.h
@@ -0,0 +1,35 @@
+#pragma once
+
+#include <erebos/service.h>
+
+namespace erebos
+{
+
+class TestService : public Service
+{
+public:
+ using MessageWatcher = std::function<void( const Stored< Object > & )>;
+
+ class Config
+ {
+ public:
+ Config & onMessage( MessageWatcher );
+
+ private:
+ friend class TestService;
+ vector< MessageWatcher > watchers;
+ };
+
+ TestService( Config &&, const Server & );
+ virtual ~TestService();
+
+ UUID uuid() const override;
+ void handle( Context & ) override;
+
+ static void send( const Peer &, const Ref & );
+
+private:
+ const Config config;
+};
+
+}