]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
test: fix ceph_test_cls_hello test 9602/head
authorKefu Chai <kchai@redhat.com>
Thu, 9 Jun 2016 06:04:53 +0000 (14:04 +0800)
committerKefu Chai <kchai@redhat.com>
Tue, 14 Jun 2016 03:51:16 +0000 (11:51 +0800)
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>
src/test/librados_test_stub/LibradosTestStub.cc
src/test/librados_test_stub/TestClassHandler.cc
src/test/librados_test_stub/TestClassHandler.h

index d56001e2cebcda56ab02d5db6b7ca9124100fb4b..734ebaa4325fdb139aa77e7799792415bbf9ce1e 100644 (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);
+}
index bf6634dbf022c8d854dfe61a4223e436f6062912..3d3e5780a8bd97187368fe23783ce8fb81482967 100644 (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();
 }
index e25db273ae23ce9b97db58254f15a447aaf7712f..df273364d30665dfeb08bcf87d3bf86a89eb7b66 100644 (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);