2020-03-15 20:48:45 +00:00
|
|
|
#include "mock_config_builder.hpp"
|
|
|
|
|
|
|
|
extern "C"
|
|
|
|
{
|
|
|
|
using webfused_test::IConfigBuilder;
|
|
|
|
|
|
|
|
static void
|
2020-03-16 20:50:31 +00:00
|
|
|
wfd_MockConfigBuilder_set_server_vhostname(
|
2020-03-15 20:48:45 +00:00
|
|
|
void * data,
|
|
|
|
char const * vhost_name)
|
|
|
|
{
|
|
|
|
auto * builder = reinterpret_cast<IConfigBuilder*>(data);
|
|
|
|
builder->setServerVhostname(vhost_name);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2020-03-16 20:50:31 +00:00
|
|
|
wfd_MockConfigBuilder_set_server_port(
|
2020-03-15 20:48:45 +00:00
|
|
|
void * data,
|
|
|
|
int port)
|
|
|
|
{
|
|
|
|
auto * builder = reinterpret_cast<IConfigBuilder*>(data);
|
|
|
|
builder->setServerPort(port);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2020-03-16 20:50:31 +00:00
|
|
|
wfd_MockConfigBuilder_set_server_key(
|
2020-03-15 20:48:45 +00:00
|
|
|
void * data,
|
|
|
|
char const * key_path)
|
|
|
|
{
|
|
|
|
auto * builder = reinterpret_cast<IConfigBuilder*>(data);
|
|
|
|
builder->setServerKey(key_path);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2020-03-16 20:50:31 +00:00
|
|
|
wfd_MockConfigBuilder_set_server_cert(
|
2020-03-15 20:48:45 +00:00
|
|
|
void * data,
|
|
|
|
char const * cert_path)
|
|
|
|
{
|
|
|
|
auto * builder = reinterpret_cast<IConfigBuilder*>(data);
|
|
|
|
builder->setServerCert(cert_path);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2020-03-16 20:50:31 +00:00
|
|
|
wfd_MockConfigBuilder_set_server_document_root(
|
2020-03-15 20:48:45 +00:00
|
|
|
void * data,
|
|
|
|
char const * document_root)
|
|
|
|
{
|
|
|
|
auto * builder = reinterpret_cast<IConfigBuilder*>(data);
|
|
|
|
builder->setServerDocumentRoot(document_root);
|
|
|
|
}
|
|
|
|
|
2020-03-16 20:50:31 +00:00
|
|
|
static bool
|
|
|
|
wfd_MockConfigBuilder_add_auth_provider(
|
|
|
|
void * data,
|
2020-03-18 09:17:17 +00:00
|
|
|
char const * provider,
|
|
|
|
struct wfd_settings * settings)
|
2020-03-16 20:50:31 +00:00
|
|
|
{
|
|
|
|
auto * builder = reinterpret_cast<IConfigBuilder*>(data);
|
2020-03-18 09:17:17 +00:00
|
|
|
return builder->addAuthProvider(provider, settings);
|
2020-03-17 20:51:04 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static bool
|
|
|
|
wfd_MockConfigBuilder_add_filesystem(
|
|
|
|
void * data,
|
|
|
|
char const * name,
|
|
|
|
char const * mountpoint)
|
|
|
|
{
|
|
|
|
auto * builder = reinterpret_cast<IConfigBuilder*>(data);
|
|
|
|
return builder->addFilesystem(name, mountpoint);
|
2020-03-16 20:50:31 +00:00
|
|
|
}
|
|
|
|
|
2020-03-18 16:33:31 +00:00
|
|
|
static bool
|
|
|
|
wfd_MockConfigBuilder_set_logger(
|
|
|
|
void * data,
|
|
|
|
char const * provider,
|
|
|
|
int level,
|
|
|
|
struct wfd_settings * settings)
|
|
|
|
{
|
|
|
|
auto * builder = reinterpret_cast<IConfigBuilder*>(data);
|
|
|
|
return builder->setLogger(provider, level, settings);
|
|
|
|
}
|
|
|
|
|
2020-03-19 11:42:47 +00:00
|
|
|
static void
|
|
|
|
wfd_MockConfigBuilder_set_user(
|
|
|
|
void * data,
|
|
|
|
char const * user,
|
|
|
|
char const * group)
|
|
|
|
{
|
|
|
|
auto * builder = reinterpret_cast<IConfigBuilder*>(data);
|
|
|
|
return builder->setUser(user, group);
|
|
|
|
}
|
2020-03-16 20:50:31 +00:00
|
|
|
|
2020-03-15 20:48:45 +00:00
|
|
|
static const wfd_config_builder_vtable wfd_MockConfigBuilder_vtable =
|
|
|
|
{
|
2020-03-16 20:50:31 +00:00
|
|
|
&wfd_MockConfigBuilder_set_server_vhostname,
|
|
|
|
&wfd_MockConfigBuilder_set_server_port,
|
|
|
|
&wfd_MockConfigBuilder_set_server_key,
|
|
|
|
&wfd_MockConfigBuilder_set_server_cert,
|
|
|
|
&wfd_MockConfigBuilder_set_server_document_root,
|
2020-03-17 20:51:04 +00:00
|
|
|
&wfd_MockConfigBuilder_add_auth_provider,
|
2020-03-18 16:33:31 +00:00
|
|
|
&wfd_MockConfigBuilder_add_filesystem,
|
2020-03-19 11:42:47 +00:00
|
|
|
&wfd_MockConfigBuilder_set_logger,
|
|
|
|
&wfd_MockConfigBuilder_set_user
|
2020-03-15 20:48:45 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
namespace webfused_test
|
|
|
|
{
|
|
|
|
struct wfd_config_builder MockConfigBuilder::getBuilder()
|
|
|
|
{
|
|
|
|
IConfigBuilder * config_builder = this;
|
|
|
|
|
|
|
|
wfd_config_builder builder = {
|
|
|
|
&wfd_MockConfigBuilder_vtable,
|
|
|
|
reinterpret_cast<void*>(config_builder)
|
|
|
|
};
|
|
|
|
|
|
|
|
return builder;
|
|
|
|
}
|
|
|
|
}
|