20 #ifndef __SSRC_WISP_TEST_SERVICE_TEST_FIXTURE_H
21 #define __SSRC_WISP_TEST_SERVICE_TEST_FIXTURE_H
31 using NS_SSRC_WISP_SERVICE::ServiceEventHandler;
32 using NS_SSRC_WISP_SERVICE::Service;
35 template<
typename ProtocolProcessor,
36 template <
typename PP,
typename...>
class EH = ServiceEventHandler>
37 class TestService :
public Service<EH<ProtocolProcessor> > {
38 typedef Service<EH<ProtocolProcessor> > super;
43 const std::string & name =
"",
44 const unsigned int message_capacity =
45 NS_SSRC_SPREAD::Message::DefaultCapacity) :
46 super(connection, name, message_capacity)
49 template<
typename Initializer>
51 const std::string & connection =
"",
52 const std::string & name =
"",
53 const unsigned int message_capacity =
54 NS_SSRC_SPREAD::Message::DefaultCapacity) :
55 super(initializer, connection, name, message_capacity)
58 using super::protocol;
62 template<
typename service_type,
typename CallStop>
64 typedef typename service_type::caller_type
super;
76 super(WISP_SPREAD_DAEMON),
79 serv.start(*loop, 300);
80 thread = make_smart_ptr<thread_ptr>(std::bind(&loop_type::start, loop));
82 while(serv.state() != protocol_processor::Started) {
83 std::this_thread::yield();
88 super::template send<CallStop>(serv.name());
99 connection(WISP_SPREAD_DAEMON), name(),
100 capacity(NS_SSRC_SPREAD::Message::DefaultCapacity)
104 template<
typename ProtocolProcessor,
106 template <
typename PP,
typename...>
class EH = ServiceEventHandler,
108 bool has_initializer =
false>
116 utility::ServiceFactory<service_type, Options, has_initializer>
121 typename service_factory::service_ptr
serv;