Correct style, use of newer YATL.
[awesomized/libmemcached] / libtest / memcached.cc
index d2ce941ea54147a3cc1ea630f4c18bc5c4e91aae..24bc3b8d18352da7d19656678e1cd6ef79d62a57 100644 (file)
  *
  */
 
-#include "mem_config.h"
+#include "libtest/yatlcon.h"
 
-#include <libtest/common.h>
-
-#include <libmemcached-1.0/memcached.h>
-#include <libmemcachedutil-1.0/util.h>
+#include "libtest/common.h"
 
 #include <cassert>
 #include <cerrno>
@@ -89,7 +86,7 @@ public:
 
   virtual const char *sasl() const
   {
-    return "-S";
+    return NULL;
   }
 
   const std::string& password() const
@@ -191,13 +188,13 @@ public:
     return true;
   }
 
-  bool build(size_t argc, const char *argv[]);
+  bool build();
 };
 
 
 #include <sstream>
 
-bool Memcached::build(size_t argc, const char *argv[])
+bool Memcached::build()
 {
   if (getuid() == 0 or geteuid() == 0)
   {
@@ -205,43 +202,38 @@ bool Memcached::build(size_t argc, const char *argv[])
   }
 
   add_option("-l", "localhost");
-#ifndef TARGET_OS_OSX
+#ifdef __APPLE__
+#else
   add_option("-m", "128");
   add_option("-M");
 #endif
 
-  if (_username.size())
+  if (sasl())
   {
     add_option(sasl());
   }
 
-  for (size_t x= 0 ; x < argc ; x++)
-  {
-    add_option(argv[x]);
-  }
-
   return true;
 }
 
 libtest::Server *build_memcached(const std::string& hostname, const in_port_t try_port)
 {
-  return new Memcached(hostname, try_port, false);
-}
+  if (HAVE_MEMCACHED_BINARY)
+  {
+    return new Memcached(hostname, try_port, false);
+  }
 
-libtest::Server *build_memcached_socket(const std::string& socket_file, const in_port_t try_port)
-{
-  return new Memcached(socket_file, try_port, true);
+  return NULL;
 }
 
-libtest::Server *build_memcached_sasl(const std::string& hostname, const in_port_t try_port, const std::string& username, const std::string &password)
+libtest::Server *build_memcached_socket(const std::string& socket_file, const in_port_t try_port)
 {
-  if (username.empty())
+  if (HAVE_MEMCACHED_BINARY)
   {
-    return new Memcached(hostname, try_port, false,  "memcached", "memcached");
+    return new Memcached(socket_file, try_port, true);
   }
 
-  return new Memcached(hostname, try_port, false,  username, password);
+  return NULL;
 }
 
 } // namespace libtest
-