diff options
Diffstat (limited to 'src/test/librbd/mock/MockExclusiveLock.h')
-rw-r--r-- | src/test/librbd/mock/MockExclusiveLock.h | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/src/test/librbd/mock/MockExclusiveLock.h b/src/test/librbd/mock/MockExclusiveLock.h new file mode 100644 index 00000000..efb4fa4e --- /dev/null +++ b/src/test/librbd/mock/MockExclusiveLock.h @@ -0,0 +1,41 @@ +// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- +// vim: ts=8 sw=2 smarttab + +#ifndef CEPH_TEST_LIBRBD_MOCK_EXCLUSIVE_LOCK_H +#define CEPH_TEST_LIBRBD_MOCK_EXCLUSIVE_LOCK_H + +#include "include/int_types.h" +#include "include/rados/librados.hpp" +#include "librbd/exclusive_lock/Policy.h" +#include "gmock/gmock.h" + +class Context; + +namespace librbd { + +struct MockExclusiveLock { + MOCK_CONST_METHOD0(is_lock_owner, bool()); + + MOCK_METHOD2(init, void(uint64_t features, Context*)); + MOCK_METHOD1(shut_down, void(Context*)); + + MOCK_METHOD1(reacquire_lock, void(Context*)); + MOCK_METHOD1(try_acquire_lock, void(Context*)); + + MOCK_METHOD1(block_requests, void(int)); + MOCK_METHOD0(unblock_requests, void()); + + MOCK_METHOD1(acquire_lock, void(Context *)); + MOCK_METHOD1(release_lock, void(Context *)); + + MOCK_METHOD2(accept_request, bool(exclusive_lock::OperationRequestType, + int *)); + MOCK_METHOD0(accept_ops, bool()); + MOCK_METHOD0(get_unlocked_op_error, int()); + + MOCK_METHOD1(start_op, Context*(int*)); +}; + +} // namespace librbd + +#endif // CEPH_TEST_LIBRBD_MOCK_EXCLUSIVE_LOCK_H |