const std::string& username_arg,
const std::string& password_arg) :
libtest::Server(host_arg, port_arg,
- MEMCACHED_BINARY, false, is_socket_arg),
+ memcached_binary(), false, is_socket_arg),
_username(username_arg),
_password(password_arg)
{ }
Memcached(const std::string& host_arg, const in_port_t port_arg, const bool is_socket_arg) :
libtest::Server(host_arg, port_arg,
- MEMCACHED_BINARY, false, is_socket_arg)
+ memcached_binary(), false, is_socket_arg)
{
set_pid_file();
}
virtual const char *sasl() const
{
- return NULL;
+ return "-S";
+ }
+
+ bool is_sasl() const
+ {
+ return _username.size() && _password.size();
}
const std::string& password() const
return false;
}
- if (is_socket())
+ if (is_socket() or is_sasl())
{
return _app.check();
}
const char *executable()
{
- return MEMCACHED_BINARY;
+ return memcached_binary();
}
bool is_libtool()
{
char buffer[30];
snprintf(buffer, sizeof(buffer), "%d", int(arg));
- app.add_option("-p", buffer);
+ app.add_option("-p", buffer);
+
+ if(!is_sasl())
+ {
+ app.add_option("-U", buffer);
+ }
}
bool has_port_option() const
add_option("-M");
#endif
- if (sasl())
+ if (is_sasl())
{
add_option(sasl());
}
+ //add_option("-vvv");
+
return true;
}
libtest::Server *build_memcached(const std::string& hostname, const in_port_t try_port)
{
- if (HAVE_MEMCACHED_BINARY)
+ if (has_memcached())
{
return new Memcached(hostname, try_port, false);
}
libtest::Server *build_memcached_socket(const std::string& socket_file, const in_port_t try_port)
{
- if (HAVE_MEMCACHED_BINARY)
+ if (has_memcached())
{
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)
+{
+ if (has_memcached())
+ {
+ return new Memcached(hostname, try_port, false, username, password);
+ }
+
+ return NULL;
+}
+
} // namespace libtest