test: fix ceph_test_cls_hello test

cls_register_cxx_filter() is exercised by cls_hello, so add the missing
stub for cls_register_cxx_filter() call.

Signed-off-by: Kefu Chai <kchai@redhat.com>
This commit is contained in:
Kefu Chai 2016-06-09 14:04:53 +08:00
parent 2378709134
commit 64271f0345
3 changed files with 27 additions and 0 deletions

View File

@ -1216,3 +1216,12 @@ int cls_register_cxx_method(cls_handle_t hclass, const char *method,
librados::TestClassHandler *cls = get_class_handler();
return cls->create_method(hclass, method, class_call, handle);
}
int cls_register_cxx_filter(cls_handle_t hclass,
const std::string &filter_name,
cls_cxx_filter_factory_t fn,
cls_filter_handle_t *)
{
librados::TestClassHandler *cls = get_class_handler();
return cls->create_filter(hclass, filter_name, fn);
}

View File

@ -120,6 +120,18 @@ TestClassHandler::SharedMethodContext TestClassHandler::get_method_context(
return ctx;
}
int TestClassHandler::create_filter(cls_handle_t hclass,
const std::string& name,
cls_cxx_filter_factory_t fn)
{
Class *cls = reinterpret_cast<Class*>(hclass);
if (cls->filters.find(name) != cls->filters.end()) {
return -EEXIST;
}
cls->filters[name] = fn;
return 0;
}
TestClassHandler::MethodContext::~MethodContext() {
io_ctx_impl->put();
}

View File

@ -36,9 +36,11 @@ public:
};
typedef boost::shared_ptr<Method> SharedMethod;
typedef std::map<std::string, SharedMethod> Methods;
typedef std::map<std::string, cls_cxx_filter_factory_t> Filters;
struct Class {
Methods methods;
Filters filters;
};
typedef boost::shared_ptr<Class> SharedClass;
@ -54,6 +56,9 @@ public:
const std::string &oid,
const SnapContext &snapc);
int create_filter(cls_handle_t hclass, const std::string& filter_name,
cls_cxx_filter_factory_t fn);
private:
typedef std::map<std::string, SharedClass> Classes;
@ -61,6 +66,7 @@ private:
Classes m_classes;
ClassHandles m_class_handles;
Filters m_filters;
void open_class(const std::string& name, const std::string& path);