src/server/plugins/postgresql/pgtest.h

Sun, 14 Aug 2022 12:43:14 +0200

author
Olaf Wintermann <olaf.wintermann@gmail.com>
date
Sun, 14 Aug 2022 12:43:14 +0200
branch
webdav
changeset 375
32b8017f5308
parent 374
77506ec632a4
child 415
d938228c382e
permissions
-rw-r--r--

build pg propfind query from components

289
285d483db2fb add first pg vfs tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1 /*
285d483db2fb add first pg vfs tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
2 * To change this license header, choose License Headers in Project Properties.
285d483db2fb add first pg vfs tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
3 * To change this template file, choose Tools | Templates
285d483db2fb add first pg vfs tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
4 * and open the template in the editor.
285d483db2fb add first pg vfs tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
5 */
285d483db2fb add first pg vfs tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
6
285d483db2fb add first pg vfs tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
7 /*
285d483db2fb add first pg vfs tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
8 * File: pgtest.h
285d483db2fb add first pg vfs tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
9 * Author: olaf
285d483db2fb add first pg vfs tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
10 *
285d483db2fb add first pg vfs tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
11 * Created on 16. April 2022, 14:37
285d483db2fb add first pg vfs tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
12 */
285d483db2fb add first pg vfs tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
13
285d483db2fb add first pg vfs tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
14 #ifndef PGTEST_H
285d483db2fb add first pg vfs tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
15 #define PGTEST_H
285d483db2fb add first pg vfs tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
16
285d483db2fb add first pg vfs tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
17 #include <ucx/test.h>
313
3ad0b65ec838 test pg propfind response
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 311
diff changeset
18 #include <ucx/map.h>
3ad0b65ec838 test pg propfind response
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 311
diff changeset
19 #include <libxml/tree.h>
289
285d483db2fb add first pg vfs tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
20
285d483db2fb add first pg vfs tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
21 #ifdef __cplusplus
285d483db2fb add first pg vfs tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
22 extern "C" {
285d483db2fb add first pg vfs tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
23 #endif
285d483db2fb add first pg vfs tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
24
313
3ad0b65ec838 test pg propfind response
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 311
diff changeset
25 typedef struct TestMultistatus {
3ad0b65ec838 test pg propfind response
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 311
diff changeset
26 UcxMempool *mp;
3ad0b65ec838 test pg propfind response
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 311
diff changeset
27 xmlDoc *doc;
3ad0b65ec838 test pg propfind response
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 311
diff changeset
28 UcxMap *responses;
3ad0b65ec838 test pg propfind response
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 311
diff changeset
29 } TestMultistatus;
3ad0b65ec838 test pg propfind response
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 311
diff changeset
30
3ad0b65ec838 test pg propfind response
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 311
diff changeset
31 typedef struct TestResponse {
3ad0b65ec838 test pg propfind response
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 311
diff changeset
32 char *href;
3ad0b65ec838 test pg propfind response
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 311
diff changeset
33 UcxMap *properties;
3ad0b65ec838 test pg propfind response
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 311
diff changeset
34 } TestResponse;
3ad0b65ec838 test pg propfind response
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 311
diff changeset
35
3ad0b65ec838 test pg propfind response
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 311
diff changeset
36 typedef struct TestProperty {
3ad0b65ec838 test pg propfind response
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 311
diff changeset
37 char *prefix;
3ad0b65ec838 test pg propfind response
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 311
diff changeset
38 char *namespace;
3ad0b65ec838 test pg propfind response
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 311
diff changeset
39 char *name;
3ad0b65ec838 test pg propfind response
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 311
diff changeset
40 char *lang;
3ad0b65ec838 test pg propfind response
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 311
diff changeset
41 char *value;
3ad0b65ec838 test pg propfind response
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 311
diff changeset
42 xmlNode *node;
3ad0b65ec838 test pg propfind response
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 311
diff changeset
43 int status;
3ad0b65ec838 test pg propfind response
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 311
diff changeset
44 } TestProperty;
3ad0b65ec838 test pg propfind response
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 311
diff changeset
45
3ad0b65ec838 test pg propfind response
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 311
diff changeset
46 TestMultistatus* test_parse_multistatus(const char *space, size_t size);
3ad0b65ec838 test pg propfind response
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 311
diff changeset
47 void test_multistatus_destroy(TestMultistatus *ms);
3ad0b65ec838 test pg propfind response
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 311
diff changeset
48
289
285d483db2fb add first pg vfs tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
49 UCX_TEST(test_pg_conn);
285d483db2fb add first pg vfs tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
50
374
77506ec632a4 use configured root node from PgRepository in pg vfs/webdav
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 324
diff changeset
51 UCX_TEST(test_pg_lookup_root);
77506ec632a4 use configured root node from PgRepository in pg vfs/webdav
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 324
diff changeset
52
289
285d483db2fb add first pg vfs tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
53 UCX_TEST(test_pg_vfs_open);
285d483db2fb add first pg vfs tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
54 UCX_TEST(test_pg_vfs_io);
290
efc10acf539f implement pg vfs mkdir
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 289
diff changeset
55 UCX_TEST(test_pg_vfs_stat);
efc10acf539f implement pg vfs mkdir
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 289
diff changeset
56 UCX_TEST(test_pg_vfs_mkdir);
294
277a5896a2ec implement pg unlink
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 290
diff changeset
57 UCX_TEST(test_pg_vfs_unlink);
296
78e92337fa4e implement pg rmdir
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 294
diff changeset
58 UCX_TEST(test_pg_vfs_rmdir);
289
285d483db2fb add first pg vfs tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
59
306
e03737cea6e2 add semi functional pg propfind handler
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 296
diff changeset
60 UCX_TEST(test_pg_webdav_create_from_resdata);
e03737cea6e2 add semi functional pg propfind handler
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 296
diff changeset
61 UCX_TEST(test_pg_prepare_tests);
e03737cea6e2 add semi functional pg propfind handler
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 296
diff changeset
62 UCX_TEST(test_pg_webdav_propfind);
316
4090fc1b1c52 add tests for propfind allprop
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 315
diff changeset
63 UCX_TEST(test_pg_webdav_propfind_allprop);
318
60870dbac94f add basic pg proppatch implementation
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 316
diff changeset
64 UCX_TEST(test_pg_webdav_proppatch_set);
306
e03737cea6e2 add semi functional pg propfind handler
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 296
diff changeset
65
e03737cea6e2 add semi functional pg propfind handler
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 296
diff changeset
66
e03737cea6e2 add semi functional pg propfind handler
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 296
diff changeset
67 /* --------------------------- PROPFIND --------------------------- */
e03737cea6e2 add semi functional pg propfind handler
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 296
diff changeset
68
e03737cea6e2 add semi functional pg propfind handler
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 296
diff changeset
69 #define PG_TEST_PROPFIND1 "<?xml version=\"1.0\" encoding=\"utf-8\" ?> \
315
b608b7aa43a6 fix sql query for selecting specific properties
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 313
diff changeset
70 <D:propfind xmlns:D=\"DAV:\" xmlns:X=\"http://example.com/\" > \
306
e03737cea6e2 add semi functional pg propfind handler
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 296
diff changeset
71 <D:prop> \
e03737cea6e2 add semi functional pg propfind handler
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 296
diff changeset
72 <D:displayname/> \
e03737cea6e2 add semi functional pg propfind handler
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 296
diff changeset
73 <D:getcontentlength/> \
e03737cea6e2 add semi functional pg propfind handler
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 296
diff changeset
74 <D:getcontenttype/> \
e03737cea6e2 add semi functional pg propfind handler
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 296
diff changeset
75 <D:getlastmodified/> \
311
e676ed461b5b implement pg getlastmodified propfind (and prepare creationdate)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 306
diff changeset
76 <D:creationdate/> \
306
e03737cea6e2 add semi functional pg propfind handler
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 296
diff changeset
77 <D:resourcetype/> \
e03737cea6e2 add semi functional pg propfind handler
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 296
diff changeset
78 <D:getetag/> \
e03737cea6e2 add semi functional pg propfind handler
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 296
diff changeset
79 </D:prop> \
e03737cea6e2 add semi functional pg propfind handler
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 296
diff changeset
80 </D:propfind>"
e03737cea6e2 add semi functional pg propfind handler
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 296
diff changeset
81
315
b608b7aa43a6 fix sql query for selecting specific properties
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 313
diff changeset
82 #define PG_TEST_PROPFIND2 "<?xml version=\"1.0\" encoding=\"utf-8\" ?> \
b608b7aa43a6 fix sql query for selecting specific properties
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 313
diff changeset
83 <D:propfind xmlns:D=\"DAV:\" xmlns:X=\"http://example.com/\" > \
b608b7aa43a6 fix sql query for selecting specific properties
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 313
diff changeset
84 <D:prop> \
b608b7aa43a6 fix sql query for selecting specific properties
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 313
diff changeset
85 <D:displayname/> \
b608b7aa43a6 fix sql query for selecting specific properties
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 313
diff changeset
86 <D:getcontentlength/> \
b608b7aa43a6 fix sql query for selecting specific properties
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 313
diff changeset
87 <D:getcontenttype/> \
b608b7aa43a6 fix sql query for selecting specific properties
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 313
diff changeset
88 <D:getlastmodified/> \
b608b7aa43a6 fix sql query for selecting specific properties
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 313
diff changeset
89 <D:creationdate/> \
b608b7aa43a6 fix sql query for selecting specific properties
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 313
diff changeset
90 <D:resourcetype/> \
b608b7aa43a6 fix sql query for selecting specific properties
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 313
diff changeset
91 <D:getetag/> \
b608b7aa43a6 fix sql query for selecting specific properties
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 313
diff changeset
92 <X:test /> \
b608b7aa43a6 fix sql query for selecting specific properties
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 313
diff changeset
93 <X:prop2 /> \
b608b7aa43a6 fix sql query for selecting specific properties
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 313
diff changeset
94 </D:prop> \
b608b7aa43a6 fix sql query for selecting specific properties
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 313
diff changeset
95 </D:propfind>"
b608b7aa43a6 fix sql query for selecting specific properties
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 313
diff changeset
96
316
4090fc1b1c52 add tests for propfind allprop
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 315
diff changeset
97 #define PG_TEST_ALLPROP "<?xml version=\"1.0\" encoding=\"utf-8\" ?> \
4090fc1b1c52 add tests for propfind allprop
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 315
diff changeset
98 <D:propfind xmlns:D=\"DAV:\" xmlns:X=\"http://example.com/\" > \
4090fc1b1c52 add tests for propfind allprop
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 315
diff changeset
99 <D:allprop/> \
4090fc1b1c52 add tests for propfind allprop
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 315
diff changeset
100 </D:propfind>"
4090fc1b1c52 add tests for propfind allprop
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 315
diff changeset
101
318
60870dbac94f add basic pg proppatch implementation
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 316
diff changeset
102 #define PG_TEST_PROPPATCH1 "<?xml version=\"1.0\" encoding=\"utf-8\" ?> \
60870dbac94f add basic pg proppatch implementation
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 316
diff changeset
103 <D:propertyupdate xmlns:D=\"DAV:\" xmlns:X=\"http://example.com/\"> \
60870dbac94f add basic pg proppatch implementation
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 316
diff changeset
104 <D:set> \
60870dbac94f add basic pg proppatch implementation
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 316
diff changeset
105 <D:prop><X:test>test</X:test><X:author>name</X:author></D:prop> \
60870dbac94f add basic pg proppatch implementation
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 316
diff changeset
106 </D:set> \
60870dbac94f add basic pg proppatch implementation
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 316
diff changeset
107 </D:propertyupdate>"
306
e03737cea6e2 add semi functional pg propfind handler
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 296
diff changeset
108
324
44cf877b3d9f add support for xml properties in propfind/proppatch requests (pg)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 318
diff changeset
109 #define PG_TEST_PROPPATCH2 "<?xml version=\"1.0\" encoding=\"utf-8\" ?> \
44cf877b3d9f add support for xml properties in propfind/proppatch requests (pg)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 318
diff changeset
110 <D:propertyupdate xmlns:D=\"DAV:\" xmlns:X=\"http://example.com/\" xmlns:XA=\"http://example.com/a/\"> \
44cf877b3d9f add support for xml properties in propfind/proppatch requests (pg)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 318
diff changeset
111 <D:set> \
44cf877b3d9f add support for xml properties in propfind/proppatch requests (pg)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 318
diff changeset
112 <D:prop>\
44cf877b3d9f add support for xml properties in propfind/proppatch requests (pg)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 318
diff changeset
113 <XA:xtest>\
44cf877b3d9f add support for xml properties in propfind/proppatch requests (pg)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 318
diff changeset
114 <XA:elm>value</XA:elm>\
44cf877b3d9f add support for xml properties in propfind/proppatch requests (pg)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 318
diff changeset
115 <X:ex>example</X:ex>\
44cf877b3d9f add support for xml properties in propfind/proppatch requests (pg)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 318
diff changeset
116 <Z:nstest xmlns:Z=\"http://example.com/z\">\
44cf877b3d9f add support for xml properties in propfind/proppatch requests (pg)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 318
diff changeset
117 <Y:nstest2 xmlns:Y=\"http://example.com/y\"></Y:nstest2>\
44cf877b3d9f add support for xml properties in propfind/proppatch requests (pg)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 318
diff changeset
118 </Z:nstest>\
44cf877b3d9f add support for xml properties in propfind/proppatch requests (pg)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 318
diff changeset
119 </XA:xtest>\
44cf877b3d9f add support for xml properties in propfind/proppatch requests (pg)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 318
diff changeset
120 </D:prop> \
44cf877b3d9f add support for xml properties in propfind/proppatch requests (pg)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 318
diff changeset
121 </D:set> \
44cf877b3d9f add support for xml properties in propfind/proppatch requests (pg)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 318
diff changeset
122 </D:propertyupdate>"
44cf877b3d9f add support for xml properties in propfind/proppatch requests (pg)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 318
diff changeset
123
289
285d483db2fb add first pg vfs tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
124 #ifdef __cplusplus
285d483db2fb add first pg vfs tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
125 }
285d483db2fb add first pg vfs tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
126 #endif
285d483db2fb add first pg vfs tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
127
285d483db2fb add first pg vfs tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
128 #endif /* PGTEST_H */
285d483db2fb add first pg vfs tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
129

mercurial