src/server/plugins/postgresql/pgtest.h

Wed, 31 May 2023 12:43:30 +0200

author
Olaf Wintermann <olaf.wintermann@gmail.com>
date
Wed, 31 May 2023 12:43:30 +0200
changeset 494
f7f624cfe80a
parent 415
d938228c382e
child 505
d41fc7f37aed
permissions
-rw-r--r--

fix missing connection ssl_error initialization

/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

/* 
 * File:   pgtest.h
 * Author: olaf
 *
 * Created on 16. April 2022, 14:37
 */

#ifndef PGTEST_H
#define PGTEST_H

#include "../../test/test.h"
#include <cx/map.h>
#include <cx/basic_mempool.h>
#include <libxml/tree.h>

#ifdef __cplusplus
extern "C" {
#endif

typedef struct TestMultistatus {
    CxMempool *mp;
    xmlDoc *doc;
    CxMap *responses;
} TestMultistatus;
    
typedef struct TestResponse {
    char *href;
    CxMap *properties;
} TestResponse;

typedef struct TestProperty {
    char *prefix;
    char *namespace;
    char *name;
    char *lang;
    char *value;
    xmlNode *node;
    int status;
} TestProperty;

TestMultistatus* test_parse_multistatus(const char *space, size_t size);
void test_multistatus_destroy(TestMultistatus *ms);

UCX_TEST(test_pg_conn);

UCX_TEST(test_pg_lookup_root);

UCX_TEST(test_pg_vfs_open);
UCX_TEST(test_pg_vfs_io);
UCX_TEST(test_pg_vfs_stat);
UCX_TEST(test_pg_vfs_mkdir);
UCX_TEST(test_pg_vfs_unlink);
UCX_TEST(test_pg_vfs_rmdir);

UCX_TEST(test_pg_webdav_create_from_resdata);
UCX_TEST(test_pg_prepare_tests);
UCX_TEST(test_pg_webdav_propfind);
UCX_TEST(test_pg_webdav_propfind_allprop);
UCX_TEST(test_pg_webdav_proppatch_set);


/* --------------------------- PROPFIND --------------------------- */

#define PG_TEST_PROPFIND1 "<?xml version=\"1.0\" encoding=\"utf-8\" ?> \
        <D:propfind xmlns:D=\"DAV:\" xmlns:X=\"http://example.com/\" > \
            <D:prop> \
                <D:displayname/> \
                <D:getcontentlength/> \
                <D:getcontenttype/> \
                <D:getlastmodified/> \
                <D:creationdate/> \
                <D:resourcetype/> \
                <D:getetag/> \
            </D:prop> \
        </D:propfind>"

#define PG_TEST_PROPFIND2 "<?xml version=\"1.0\" encoding=\"utf-8\" ?> \
        <D:propfind xmlns:D=\"DAV:\" xmlns:X=\"http://example.com/\" > \
            <D:prop> \
                <D:displayname/> \
                <D:getcontentlength/> \
                <D:getcontenttype/> \
                <D:getlastmodified/> \
                <D:creationdate/> \
                <D:resourcetype/> \
                <D:getetag/> \
                <X:test /> \
                <X:prop2 /> \
            </D:prop> \
        </D:propfind>"

#define PG_TEST_ALLPROP "<?xml version=\"1.0\" encoding=\"utf-8\" ?> \
        <D:propfind xmlns:D=\"DAV:\" xmlns:X=\"http://example.com/\" > \
            <D:allprop/> \
        </D:propfind>"

#define PG_TEST_PROPPATCH1 "<?xml version=\"1.0\" encoding=\"utf-8\" ?> \
        <D:propertyupdate xmlns:D=\"DAV:\" xmlns:X=\"http://example.com/\"> \
            <D:set> \
                <D:prop><X:test>test</X:test><X:author>name</X:author></D:prop> \
            </D:set> \
        </D:propertyupdate>"

#define PG_TEST_PROPPATCH2 "<?xml version=\"1.0\" encoding=\"utf-8\" ?> \
        <D:propertyupdate xmlns:D=\"DAV:\" xmlns:X=\"http://example.com/\" xmlns:XA=\"http://example.com/a/\"> \
            <D:set> \
                <D:prop>\
                    <XA:xtest>\
                        <XA:elm>value</XA:elm>\
                        <X:ex>example</X:ex>\
                        <Z:nstest xmlns:Z=\"http://example.com/z\">\
                            <Y:nstest2 xmlns:Y=\"http://example.com/y\"></Y:nstest2>\
                        </Z:nstest>\
                    </XA:xtest>\
                </D:prop> \
            </D:set> \
        </D:propertyupdate>"

#ifdef __cplusplus
}
#endif

#endif /* PGTEST_H */

mercurial