Ejemplo n.º 1
0
int main(int argn, char** argv)
{
  dmlite_manager* manager;
  dmlite_context* context;
  
  SECTION("Instantiation");
  
  /* Load the mock plug-in */
  manager = dmlite_manager_new();
  TEST_MANAGER_CALL(manager, dmlite_manager_load_plugin, "./plugin_mock.so", "plugin_mock");
  
  /* Instantiate */
  context = dmlite_context_new(manager);
  
  /* Set credentials (mock will ignore anyway) */
  dmlite_credentials creds;
  memset(&creds, 0, sizeof(creds));
  creds.client_name = "root";
  TEST_CONTEXT_CALL(context, dmlite_setcredentials, &creds);
  
  /* Do tests */
  testGetPools(context);
  testGet(context);
  testPut(context);
  
  /* Clean-up */
  dmlite_context_free(context);
  dmlite_manager_free(manager);
  
  return TEST_FAILURES;
}
Ejemplo n.º 2
0
/**
 * Creates a structure for the server configuration
 * @param p The pool used to allocate memory
 * @param s Information about the virtual server being configured
 * @return A clean dav_ns_server_conf instance
 */
static void *dav_ns_create_server_config(apr_pool_t *p, server_rec *s)
{
  dav_ns_server_conf *conf = apr_pcalloc(p, sizeof(dav_ns_server_conf));

  /* Set defaults */
  conf->type = DAV_NS_NODE_HEAD;

  /* Create plugin manager */
  conf->manager = dmlite_manager_new();
  apr_pool_pre_cleanup_register(p, conf->manager,
                                (apr_status_t(*)(void*))dmlite_manager_free);

  return conf;
}