diff UnitTestsSources/RestApiTests.cpp @ 978:ce3106e5843f

refactoring
author Sebastien Jodogne <s.jodogne@gmail.com>
date Mon, 30 Jun 2014 16:04:58 +0200
parents c550e99c452b
children cd20e2568fc2
line wrap: on
line diff
--- a/UnitTestsSources/RestApiTests.cpp	Mon Jun 30 14:53:18 2014 +0200
+++ b/UnitTestsSources/RestApiTests.cpp	Mon Jun 30 16:04:58 2014 +0200
@@ -212,12 +212,30 @@
 }
 
 
+
+namespace
+{
+  class MyVisitor : public RestApiHierarchy::IVisitor
+  {
+  public:
+    virtual bool Visit(const RestApiHierarchy::Resource& resource,
+                       const UriComponents& uri,
+                       const HttpHandler::Arguments& components,
+                       const UriComponents& trailing)
+    {
+      return resource.Handle(*reinterpret_cast<RestApiGetCall*>(NULL));
+    }
+  };
+}
+
+
 static bool HandleGet(RestApiHierarchy& hierarchy, 
                       const std::string& uri)
 {
   UriComponents p;
   Toolbox::SplitUriComponents(p, uri);
-  return hierarchy.Handle(*reinterpret_cast<RestApiGetCall*>(NULL), p);
+  MyVisitor visitor;
+  return hierarchy.LookupResource(p, visitor);
 }