Apache Mesos
gmock.hpp
Go to the documentation of this file.
1 // Licensed under the Apache License, Version 2.0 (the "License");
2 // you may not use this file except in compliance with the License.
3 // You may obtain a copy of the License at
4 //
5 // http://www.apache.org/licenses/LICENSE-2.0
6 //
7 // Unless required by applicable law or agreed to in writing, software
8 // distributed under the License is distributed on an "AS IS" BASIS,
9 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10 // See the License for the specific language governing permissions and
11 // limitations under the License
12 
13 #ifndef __PROCESS_GMOCK_HPP__
14 #define __PROCESS_GMOCK_HPP__
15 
16 #include <gmock/gmock.h>
17 
18 #include <process/dispatch.hpp>
19 #include <process/event.hpp>
20 #include <process/filter.hpp>
21 #include <process/pid.hpp>
22 
23 #include <stout/exit.hpp>
24 #include <stout/nothing.hpp>
25 #include <stout/synchronized.hpp>
26 
27 
28 #define FUTURE_MESSAGE(name, from, to) \
29  process::FutureMessage(name, from, to)
30 
31 #define DROP_MESSAGE(name, from, to) \
32  process::FutureMessage(name, from, to, true)
33 
34 // The mechanism of how we match method dispatches is done by
35 // comparing std::type_info of the member function pointers. Because
36 // of this, the method function pointer passed to either
37 // FUTURE_DISPATCH or DROP_DISPATCH must match exactly the member
38 // function that is passed to the dispatch method.
39 // TODO(tnachen): In a situation where a base class has a virtual
40 // function and that a derived class overrides, and if in unit tests
41 // we want to verify it calls the exact derived member function, we
42 // need to change how dispatch matching works. One possible way is to
43 // move the dispatch matching logic at event dequeue time, as we then
44 // have the actual Process the dispatch event is calling to.
45 #define FUTURE_DISPATCH(pid, method) \
46  process::FutureDispatch(pid, method)
47 
48 #define DROP_DISPATCH(pid, method) \
49  process::FutureDispatch(pid, method, true)
50 
51 #define DROP_MESSAGES(name, from, to) \
52  process::DropMessages(name, from, to)
53 
54 #define EXPECT_NO_FUTURE_MESSAGES(name, from, to) \
55  process::ExpectNoFutureMessages(name, from, to)
56 
57 #define DROP_DISPATCHES(pid, method) \
58  process::DropDispatches(pid, method)
59 
60 #define EXPECT_NO_FUTURE_DISPATCHES(pid, method) \
61  process::ExpectNoFutureDispatches(pid, method)
62 
63 ACTION_TEMPLATE(PromiseArg,
64  HAS_1_TEMPLATE_PARAMS(int, k),
65  AND_1_VALUE_PARAMS(promise))
66 {
67  // TODO(benh): Use a shared_ptr for promise to defend against this
68  // action getting invoked more than once (e.g., used via
69  // WillRepeatedly). We won't be able to set it a second time but at
70  // least we won't get a segmentation fault. We could also consider
71  // warning users if they attempted to set it more than once.
72  promise->set(std::get<k>(args));
73  delete promise;
74 }
75 
76 
77 template <int index, typename T>
78 PromiseArgActionP<index, process::Promise<T>*> FutureArg(
79  process::Future<T>* future)
80 {
82  *future = promise->future();
83  return PromiseArg<index>(promise);
84 }
85 
86 
87 ACTION_TEMPLATE(PromiseArgField,
88  HAS_1_TEMPLATE_PARAMS(int, k),
89  AND_2_VALUE_PARAMS(field, promise))
90 {
91  // TODO(benh): Use a shared_ptr for promise to defend against this
92  // action getting invoked more than once (e.g., used via
93  // WillRepeatedly). We won't be able to set it a second time but at
94  // least we won't get a segmentation fault. We could also consider
95  // warning users if they attempted to set it more than once.
96  promise->set(*(std::get<k>(args).*field));
97  delete promise;
98 }
99 
100 
101 template <int index, typename Field, typename T>
102 PromiseArgFieldActionP2<index, Field, process::Promise<T>*> FutureArgField(
103  Field field,
104  process::Future<T>* future)
105 {
107  *future = promise->future();
108  return PromiseArgField<index>(field, promise);
109 }
110 
111 
112 ACTION_TEMPLATE(PromiseArgNotPointerField,
113  HAS_1_TEMPLATE_PARAMS(int, k),
114  AND_2_VALUE_PARAMS(field, promise))
115 {
116  // TODO(benh): Use a shared_ptr for promise to defend against this
117  // action getting invoked more than once (e.g., used via
118  // WillRepeatedly). We won't be able to set it a second time but at
119  // least we won't get a segmentation fault. We could also consider
120  // warning users if they attempted to set it more than once.
121  promise->set(std::get<k>(args).*field);
122  delete promise;
123 }
124 
125 
126 template <int index, typename Field, typename T>
127 PromiseArgNotPointerFieldActionP2<index, Field, process::Promise<T>*>
129  Field field,
130  process::Future<T>* future)
131 {
133  *future = promise->future();
134  return PromiseArgNotPointerField<index>(field, promise);
135 }
136 
137 
138 ACTION_P2(PromiseSatisfy, promise, value)
139 {
140  promise->set(value);
141  delete promise;
142 }
143 
144 
145 template <typename T>
146 PromiseSatisfyActionP2<process::Promise<T>*, T> FutureSatisfy(
147  process::Future<T>* future,
148  T t)
149 {
151  *future = promise->future();
152  return PromiseSatisfy(promise, t);
153 }
154 
155 
156 inline PromiseSatisfyActionP2<process::Promise<Nothing>*, Nothing>
158 {
160  *future = promise->future();
161  return PromiseSatisfy(promise, Nothing());
162 }
163 
164 
165 // This action invokes an "inner" action but captures the result and
166 // stores a copy of it in a future. Note that this is implemented
167 // similarly to the IgnoreResult action, which relies on the cast
168 // operator to Action<F> which must occur (implicitly) before the
169 // expression has completed, hence we can pass the Future<R>* all the
170 // way through to our action "implementation".
171 template <typename R, typename A>
173 {
174 public:
175  explicit FutureResultAction(process::Future<R>* future, const A& action)
176  : future(future),
177  action(action) {}
178 
179  template <typename F>
180  operator ::testing::Action<F>() const
181  {
182  return ::testing::Action<F>(new Implementation<F>(future, action));
183  }
184 
185 private:
186  template <typename F>
187  class Implementation : public ::testing::ActionInterface<F>
188  {
189  public:
190  explicit Implementation(process::Future<R>* future, const A& action)
191  : action(action)
192  {
193  *future = promise.future();
194  }
195 
196  typename ::testing::ActionInterface<F>::Result Perform(
197  const typename ::testing::ActionInterface<F>::ArgumentTuple& args)
198  override
199  {
200  const typename ::testing::ActionInterface<F>::Result result =
201  action.Perform(args);
202  promise.set(result);
203  return result;
204  }
205 
206  private:
207  // Not copyable, not assignable.
208  Implementation(const Implementation&);
209  Implementation& operator=(const Implementation&);
210 
212  const ::testing::Action<F> action;
213  };
214 
215  process::Future<R>* future;
216  const A action;
217 };
218 
219 
220 template <typename R, typename A>
222  process::Future<R>* future,
223  const A& action)
224 {
225  return FutureResultAction<R, A>(future, action);
226 }
227 
228 
229 namespace process {
230 
231 class MockFilter : public Filter
232 {
233 public:
235  {
236  EXPECT_CALL(*this, filter(testing::A<const MessageEvent&>()))
237  .WillRepeatedly(testing::Return(false));
238  EXPECT_CALL(*this, filter(testing::A<const DispatchEvent&>()))
239  .WillRepeatedly(testing::Return(false));
240  EXPECT_CALL(*this, filter(testing::A<const HttpEvent&>()))
241  .WillRepeatedly(testing::Return(false));
242  EXPECT_CALL(*this, filter(testing::A<const ExitedEvent&>()))
243  .WillRepeatedly(testing::Return(false));
244  }
245 
246  MOCK_METHOD1(filter, bool(const MessageEvent&));
247  MOCK_METHOD1(filter, bool(const DispatchEvent&));
248  MOCK_METHOD1(filter, bool(const HttpEvent&));
249  MOCK_METHOD1(filter, bool(const ExitedEvent&));
250 };
251 
252 
253 // A definition of a libprocess filter to enable waiting for events
254 // (such as messages or dispatches) via in tests. This is not meant to
255 // be used directly by tests; tests should use macros like
256 // FUTURE_MESSAGE and FUTURE_DISPATCH instead.
257 class TestsFilter : public Filter
258 {
259 public:
260  TestsFilter() = default;
261 
262  bool filter(const MessageEvent& event) override { return handle(event); }
263  bool filter(const DispatchEvent& event) override { return handle(event); }
264  bool filter(const HttpEvent& event) override { return handle(event); }
265  bool filter(const ExitedEvent& event) override { return handle(event); }
266 
267  template <typename T>
268  bool handle(const T& t)
269  {
270  synchronized (mutex) {
271  return mock.filter(t);
272  }
273  }
274 
276 
277  // We use a recursive mutex here in the event that satisfying the
278  // future created in FutureMessage or FutureDispatch via the
279  // FutureArgField or FutureSatisfy actions invokes callbacks (from
280  // Future::then or Future::onAny, etc) that themselves invoke
281  // FutureDispatch or FutureMessage.
282  std::recursive_mutex mutex;
283 };
284 
285 
286 class FilterTestEventListener : public ::testing::EmptyTestEventListener
287 {
288 public:
289  // Returns the singleton instance of the listener.
291  {
292  static FilterTestEventListener* listener = new FilterTestEventListener();
293  return listener;
294  }
295 
296  // Installs and returns the filter, creating it if necessary.
298  {
299  if (!started) {
300  EXIT(EXIT_FAILURE)
301  << "To use FUTURE/DROP_MESSAGE/DISPATCH, etc. you need to do the "
302  << "following before you invoke RUN_ALL_TESTS():\n\n"
303  << "\t::testing::TestEventListeners& listeners =\n"
304  << "\t ::testing::UnitTest::GetInstance()->listeners();\n"
305  << "\tlisteners.Append(process::FilterTestEventListener::instance());";
306  }
307 
308  if (filter != nullptr) {
309  return filter;
310  }
311 
312  filter = new TestsFilter();
313 
314  // Set the filter in libprocess.
316 
317  return filter;
318  }
319 
320  void OnTestProgramStart(const ::testing::UnitTest&) override
321  {
322  started = true;
323  }
324 
325  void OnTestEnd(const ::testing::TestInfo&) override
326  {
327  if (filter != nullptr) {
328  // Remove the filter in libprocess _before_ deleting.
329  process::filter(nullptr);
330  delete filter;
331  filter = nullptr;
332  }
333  }
334 
335 private:
336  FilterTestEventListener() : filter(nullptr), started(false) {}
337 
339 
340  // Indicates if we got the OnTestProgramStart callback in order to
341  // detect if we have been properly added as a listener.
342  bool started;
343 };
344 
345 
346 MATCHER_P3(MessageMatcher, name, from, to, "")
347 {
348  const MessageEvent& event = ::std::get<0>(arg);
349  return (testing::Matcher<std::string>(name).Matches(event.message.name) &&
350  testing::Matcher<UPID>(from).Matches(event.message.from) &&
351  testing::Matcher<UPID>(to).Matches(event.message.to));
352 }
353 
354 
355 // This matches protobuf messages that are described using the
356 // standard protocol buffer "union" trick, see:
357 // https://developers.google.com/protocol-buffers/docs/techniques#union.
358 MATCHER_P4(UnionMessageMatcher, message, unionType, from, to, "")
359 {
360  const process::MessageEvent& event = ::std::get<0>(arg);
361  message_type message;
362 
363  return (testing::Matcher<std::string>(message.GetTypeName()).Matches(
364  event.message.name) &&
365  message.ParseFromString(event.message.body) &&
366  testing::Matcher<unionType_type>(unionType).Matches(message.type()) &&
367  testing::Matcher<process::UPID>(from).Matches(event.message.from) &&
368  testing::Matcher<process::UPID>(to).Matches(event.message.to));
369 }
370 
371 
372 MATCHER_P2(DispatchMatcher, pid, method, "")
373 {
374  const DispatchEvent& event = ::std::get<0>(arg);
375  return (testing::Matcher<UPID>(pid).Matches(event.pid) &&
376  event.functionType.isSome() &&
377  *event.functionType.get() == typeid(method));
378 }
379 
380 
381 MATCHER_P3(HttpMatcher, message, path, deserializer, "")
382 {
383  const HttpEvent& event = ::std::get<0>(arg);
384 
385  Try<message_type> message_ = deserializer(event.request->body);
386  if (message_.isError()) {
387  return false;
388  }
389 
390  return (testing::Matcher<std::string>(path).Matches(event.request->url.path));
391 }
392 
393 
394 // See `UnionMessageMatcher` for more details on protobuf messages using the
395 // "union" trick.
396 MATCHER_P4(UnionHttpMatcher, message, unionType, path, deserializer, "")
397 {
398  const HttpEvent& event = ::std::get<0>(arg);
399 
400  Try<message_type> message_ = deserializer(event.request->body);
401  if (message_.isError()) {
402  return false;
403  }
404 
405  return (
406  testing::Matcher<unionType_type>(unionType).Matches(message_->type()) &&
407  testing::Matcher<std::string>(path).Matches(event.request->url.path));
408 }
409 
410 
411 template <typename Message, typename Path, typename Deserializer>
413  Message message,
414  Path path,
415  Deserializer deserializer,
416  bool drop = false)
417 {
418  TestsFilter* filter = FilterTestEventListener::instance()->install();
419  Future<http::Request> future;
420  synchronized (filter->mutex) {
421  EXPECT_CALL(filter->mock, filter(testing::A<const HttpEvent&>()))
422  .With(HttpMatcher(message, path, deserializer))
423  .WillOnce(testing::DoAll(FutureArgField<0>(
425  &future),
426  testing::Return(drop)))
427  .RetiresOnSaturation(); // Don't impose any subsequent expectations.
428  }
429 
430  return future;
431 }
432 
433 
434 template <typename Message,
435  typename UnionType,
436  typename Path,
437  typename Deserializer>
439  Message message,
440  UnionType unionType,
441  Path path,
442  Deserializer deserializer,
443  bool drop = false)
444 {
445  TestsFilter* filter = FilterTestEventListener::instance()->install();
446  Future<http::Request> future;
447  synchronized (filter->mutex) {
448  EXPECT_CALL(filter->mock, filter(testing::A<const HttpEvent&>()))
449  .With(UnionHttpMatcher(message, unionType, path, deserializer))
450  .WillOnce(testing::DoAll(FutureArgField<0>(
452  &future),
453  testing::Return(drop)))
454  .RetiresOnSaturation(); // Don't impose any subsequent expectations.
455  }
456 
457  return future;
458 }
459 
460 
461 template <typename Name, typename From, typename To>
462 Future<Message> FutureMessage(Name name, From from, To to, bool drop = false)
463 {
464  TestsFilter* filter = FilterTestEventListener::instance()->install();
465  Future<Message> future;
466  synchronized (filter->mutex) {
467  EXPECT_CALL(filter->mock, filter(testing::A<const MessageEvent&>()))
468  .With(MessageMatcher(name, from, to))
469  .WillOnce(testing::DoAll(FutureArgNotPointerField<0>(
470  &MessageEvent::message,
471  &future),
472  testing::Return(drop)))
473  .RetiresOnSaturation(); // Don't impose any subsequent expectations.
474  }
475 
476  return future;
477 }
478 
479 
480 template <typename Message, typename UnionType, typename From, typename To>
482  Message message, UnionType unionType, From from, To to, bool drop = false)
483 {
485  FilterTestEventListener::instance()->install();
486 
488  synchronized (filter->mutex) {
489  EXPECT_CALL(filter->mock, filter(testing::A<const MessageEvent&>()))
490  .With(UnionMessageMatcher(message, unionType, from, to))
491  .WillOnce(testing::DoAll(FutureArgNotPointerField<0>(
492  &MessageEvent::message,
493  &future),
494  testing::Return(drop)))
495  .RetiresOnSaturation(); // Don't impose any subsequent expectations.
496  }
497 
498  return future;
499 }
500 
501 
502 template <typename PID, typename Method>
503 Future<Nothing> FutureDispatch(PID pid, Method method, bool drop = false)
504 {
505  TestsFilter* filter = FilterTestEventListener::instance()->install();
506  Future<Nothing> future;
507  synchronized (filter->mutex) {
508  EXPECT_CALL(filter->mock, filter(testing::A<const DispatchEvent&>()))
509  .With(DispatchMatcher(pid, method))
510  .WillOnce(testing::DoAll(FutureSatisfy(&future),
511  testing::Return(drop)))
512  .RetiresOnSaturation(); // Don't impose any subsequent expectations.
513  }
514 
515  return future;
516 }
517 
518 
519 template <typename Name, typename From, typename To>
520 void DropMessages(Name name, From from, To to)
521 {
522  TestsFilter* filter = FilterTestEventListener::instance()->install();
523  synchronized (filter->mutex) {
524  EXPECT_CALL(filter->mock, filter(testing::A<const MessageEvent&>()))
525  .With(MessageMatcher(name, from, to))
526  .WillRepeatedly(testing::Return(true));
527  }
528 }
529 
530 
531 template <typename Message, typename UnionType, typename From, typename To>
532 void DropUnionMessages(Message message, UnionType unionType, From from, To to)
533 {
534  TestsFilter* filter = FilterTestEventListener::instance()->install();
535  synchronized (filter->mutex) {
536  EXPECT_CALL(filter->mock, filter(testing::A<const MessageEvent&>()))
537  .With(UnionMessageMatcher(message, unionType, from, to))
538  .WillRepeatedly(testing::Return(true));
539  }
540 }
541 
542 
543 template <typename Message, typename Path, typename Deserializer>
545  Message message,
546  Path path,
547  Deserializer deserializer,
548  bool drop = false)
549 {
550  TestsFilter* filter = FilterTestEventListener::instance()->install();
551  synchronized (filter->mutex) {
552  EXPECT_CALL(filter->mock, filter(testing::A<const HttpEvent&>()))
553  .With(HttpMatcher(message, path, deserializer))
554  .WillRepeatedly(testing::Return(true));
555  }
556 }
557 
558 
559 template <typename Message,
560  typename UnionType,
561  typename Path,
562  typename Deserializer>
564  Message message,
565  UnionType unionType,
566  Path path,
567  Deserializer deserializer,
568  bool drop = false)
569 {
570  TestsFilter* filter = FilterTestEventListener::instance()->install();
571  Future<http::Request> future;
572  synchronized (filter->mutex) {
573  EXPECT_CALL(filter->mock, filter(testing::A<const HttpEvent&>()))
574  .With(UnionHttpMatcher(message, unionType, path, deserializer))
575  .WillRepeatedly(testing::Return(true));
576  }
577 }
578 
579 
580 template <typename Message, typename Path, typename Deserializer>
582  Message message,
583  Path path,
584  Deserializer deserializer,
585  bool drop = false)
586 {
587  TestsFilter* filter = FilterTestEventListener::instance()->install();
588  synchronized (filter->mutex) {
589  EXPECT_CALL(filter->mock, filter(testing::A<const HttpEvent&>()))
590  .With(HttpMatcher(message, path, deserializer))
591  .Times(0);
592  }
593 }
594 
595 
596 template <typename Message,
597  typename UnionType,
598  typename Path,
599  typename Deserializer>
601  Message message,
602  UnionType unionType,
603  Path path,
604  Deserializer deserializer,
605  bool drop = false)
606 {
607  TestsFilter* filter = FilterTestEventListener::instance()->install();
608  Future<http::Request> future;
609  synchronized (filter->mutex) {
610  EXPECT_CALL(filter->mock, filter(testing::A<const HttpEvent&>()))
611  .With(UnionHttpMatcher(message, unionType, path, deserializer))
612  .Times(0);
613  }
614 }
615 
616 
617 template <typename Name, typename From, typename To>
618 void ExpectNoFutureMessages(Name name, From from, To to)
619 {
620  TestsFilter* filter = FilterTestEventListener::instance()->install();
621  synchronized (filter->mutex) {
622  EXPECT_CALL(filter->mock, filter(testing::A<const MessageEvent&>()))
623  .With(MessageMatcher(name, from, to))
624  .Times(0);
625  }
626 }
627 
628 
629 template <typename Message, typename UnionType, typename From, typename To>
631  Message message, UnionType unionType, From from, To to)
632 {
633  TestsFilter* filter = FilterTestEventListener::instance()->install();
634  synchronized (filter->mutex) {
635  EXPECT_CALL(filter->mock, filter(testing::A<const MessageEvent&>()))
636  .With(UnionMessageMatcher(message, unionType, from, to))
637  .Times(0);
638  }
639 }
640 
641 
642 template <typename PID, typename Method>
643 void DropDispatches(PID pid, Method method)
644 {
645  TestsFilter* filter = FilterTestEventListener::instance()->install();
646  synchronized (filter->mutex) {
647  EXPECT_CALL(filter->mock, filter(testing::A<const DispatchEvent&>()))
648  .With(DispatchMatcher(pid, method))
649  .WillRepeatedly(testing::Return(true));
650  }
651 }
652 
653 
654 template <typename PID, typename Method>
655 void ExpectNoFutureDispatches(PID pid, Method method)
656 {
657  TestsFilter* filter = FilterTestEventListener::instance()->install();
658  synchronized (filter->mutex) {
659  EXPECT_CALL(filter->mock, filter(testing::A<const DispatchEvent&>()))
660  .With(DispatchMatcher(pid, method))
661  .Times(0);
662  }
663 }
664 
665 } // namespace process {
666 
667 #endif // __PROCESS_GMOCK_HPP__
Definition: filter.hpp:20
Definition: path.hpp:26
Future< process::Message > FutureUnionMessage(Message message, UnionType unionType, From from, To to, bool drop=false)
Definition: gmock.hpp:481
Definition: nothing.hpp:16
PromiseArgActionP< index, process::Promise< T > * > FutureArg(process::Future< T > *future)
Definition: gmock.hpp:78
Definition: gmock.hpp:172
Future< Response > request(const Request &request, bool streamedResponse=false)
Asynchronously sends an HTTP request to the process and returns the HTTP response once the entire res...
FutureResultAction(process::Future< R > *future, const A &action)
Definition: gmock.hpp:175
MATCHER_P3(HttpMatcher, message, path, deserializer,"")
Definition: gmock.hpp:381
Definition: check.hpp:33
MATCHER_P4(UnionHttpMatcher, message, unionType, path, deserializer,"")
Definition: gmock.hpp:396
void OnTestEnd(const ::testing::TestInfo &) override
Definition: gmock.hpp:325
bool filter(const MessageEvent &event) override
Definition: gmock.hpp:262
Definition: event.hpp:142
void ExpectNoFutureUnionMessages(Message message, UnionType unionType, From from, To to)
Definition: gmock.hpp:630
Definition: message.hpp:22
PromiseSatisfyActionP2< process::Promise< T > *, T > FutureSatisfy(process::Future< T > *future, T t)
Definition: gmock.hpp:146
Definition: event.hpp:178
#define EXIT(status)
Definition: exit.hpp:31
void DropUnionHttpRequests(Message message, UnionType unionType, Path path, Deserializer deserializer, bool drop=false)
Definition: gmock.hpp:563
MockFilter mock
Definition: gmock.hpp:275
Definition: event.hpp:214
Future< Nothing > FutureDispatch(PID pid, Method method, bool drop=false)
Definition: gmock.hpp:503
PromiseArgNotPointerFieldActionP2< index, Field, process::Promise< T > * > FutureArgNotPointerField(Field field, process::Future< T > *future)
Definition: gmock.hpp:128
void DropHttpRequests(Message message, Path path, Deserializer deserializer, bool drop=false)
Definition: gmock.hpp:544
ACTION_P2(PromiseSatisfy, promise, value)
Definition: gmock.hpp:138
PromiseArgFieldActionP2< index, Field, process::Promise< T > * > FutureArgField(Field field, process::Future< T > *future)
Definition: gmock.hpp:102
bool filter(const ExitedEvent &event) override
Definition: gmock.hpp:265
void DropUnionMessages(Message message, UnionType unionType, From from, To to)
Definition: gmock.hpp:532
TestsFilter * install()
Definition: gmock.hpp:297
MockFilter()
Definition: gmock.hpp:234
Represents a POSIX or Windows file system path and offers common path manipulations.
Definition: path.hpp:145
Definition: future.hpp:74
void OnTestProgramStart(const ::testing::UnitTest &) override
Definition: gmock.hpp:320
void DropDispatches(PID pid, Method method)
Definition: gmock.hpp:643
Protocol< PromiseRequest, PromiseResponse > promise
bool filter(const DispatchEvent &event) override
Definition: gmock.hpp:263
std::recursive_mutex mutex
Definition: gmock.hpp:282
Future< Message > FutureMessage(Name name, From from, To to, bool drop=false)
Definition: gmock.hpp:462
FutureResultAction< R, A > FutureResult(process::Future< R > *future, const A &action)
Definition: gmock.hpp:221
void ExpectNoFutureUnionHttpRequests(Message message, UnionType unionType, Path path, Deserializer deserializer, bool drop=false)
Definition: gmock.hpp:600
A "process identifier" used to uniquely identify a process when dispatching messages.
Definition: pid.hpp:279
void ExpectNoFutureMessages(Name name, From from, To to)
Definition: gmock.hpp:618
Definition: executor.hpp:48
static FilterTestEventListener * instance()
Definition: gmock.hpp:290
Future< T > future() const
Definition: future.hpp:916
Future< http::Request > FutureUnionHttpRequest(Message message, UnionType unionType, Path path, Deserializer deserializer, bool drop=false)
Definition: gmock.hpp:438
Definition: event.hpp:103
bool filter(const HttpEvent &event) override
Definition: gmock.hpp:264
Definition: gmock.hpp:231
Definition: gmock.hpp:286
void ExpectNoFutureDispatches(PID pid, Method method)
Definition: gmock.hpp:655
Definition: gmock.hpp:257
ACTION_TEMPLATE(PromiseArg, HAS_1_TEMPLATE_PARAMS(int, k), AND_1_VALUE_PARAMS(promise))
Definition: gmock.hpp:63
void ExpectNoFutureHttpRequests(Message message, Path path, Deserializer deserializer, bool drop=false)
Definition: gmock.hpp:581
Future< http::Request > FutureHttpRequest(Message message, Path path, Deserializer deserializer, bool drop=false)
Definition: gmock.hpp:412
constexpr const char * name
Definition: shell.hpp:43
MATCHER_P2(DispatchMatcher, pid, method,"")
Definition: gmock.hpp:372
void filter(Filter *filter)
bool handle(const T &t)
Definition: gmock.hpp:268
void DropMessages(Name name, From from, To to)
Definition: gmock.hpp:520
Definition: future.hpp:58