src/server/plugins/postgresql/pgtest.h

Mon, 02 May 2022 20:20:37 +0200

author
Olaf Wintermann <olaf.wintermann@gmail.com>
date
Mon, 02 May 2022 20:20:37 +0200
branch
webdav
changeset 326
814b94f820db
parent 324
44cf877b3d9f
child 374
77506ec632a4
permissions
-rw-r--r--

send response in webdav_delete

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
285d483db2fb add first pg vfs tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
51 UCX_TEST(test_pg_vfs_open);
285d483db2fb add first pg vfs tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
52 UCX_TEST(test_pg_vfs_io);
290
efc10acf539f implement pg vfs mkdir
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 289
diff changeset
53 UCX_TEST(test_pg_vfs_stat);
efc10acf539f implement pg vfs mkdir
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 289
diff changeset
54 UCX_TEST(test_pg_vfs_mkdir);
294
277a5896a2ec implement pg unlink
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 290
diff changeset
55 UCX_TEST(test_pg_vfs_unlink);
296
78e92337fa4e implement pg rmdir
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 294
diff changeset
56 UCX_TEST(test_pg_vfs_rmdir);
289
285d483db2fb add first pg vfs tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
57
306
e03737cea6e2 add semi functional pg propfind handler
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 296
diff changeset
58 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
59 UCX_TEST(test_pg_prepare_tests);
e03737cea6e2 add semi functional pg propfind handler
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 296
diff changeset
60 UCX_TEST(test_pg_webdav_propfind);
316
4090fc1b1c52 add tests for propfind allprop
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 315
diff changeset
61 UCX_TEST(test_pg_webdav_propfind_allprop);
318
60870dbac94f add basic pg proppatch implementation
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 316
diff changeset
62 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
63
e03737cea6e2 add semi functional pg propfind handler
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 296
diff changeset
64
e03737cea6e2 add semi functional pg propfind handler
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 296
diff changeset
65 /* --------------------------- PROPFIND --------------------------- */
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 #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
68 <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
69 <D:prop> \
e03737cea6e2 add semi functional pg propfind handler
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 296
diff changeset
70 <D:displayname/> \
e03737cea6e2 add semi functional pg propfind handler
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 296
diff changeset
71 <D:getcontentlength/> \
e03737cea6e2 add semi functional pg propfind handler
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 296
diff changeset
72 <D:getcontenttype/> \
e03737cea6e2 add semi functional pg propfind handler
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 296
diff changeset
73 <D:getlastmodified/> \
311
e676ed461b5b implement pg getlastmodified propfind (and prepare creationdate)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 306
diff changeset
74 <D:creationdate/> \
306
e03737cea6e2 add semi functional pg propfind handler
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 296
diff changeset
75 <D:resourcetype/> \
e03737cea6e2 add semi functional pg propfind handler
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 296
diff changeset
76 <D:getetag/> \
e03737cea6e2 add semi functional pg propfind handler
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 296
diff changeset
77 </D:prop> \
e03737cea6e2 add semi functional pg propfind handler
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 296
diff changeset
78 </D:propfind>"
e03737cea6e2 add semi functional pg propfind handler
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 296
diff changeset
79
315
b608b7aa43a6 fix sql query for selecting specific properties
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 313
diff changeset
80 #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
81 <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
82 <D:prop> \
b608b7aa43a6 fix sql query for selecting specific properties
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 313
diff changeset
83 <D:displayname/> \
b608b7aa43a6 fix sql query for selecting specific properties
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 313
diff changeset
84 <D:getcontentlength/> \
b608b7aa43a6 fix sql query for selecting specific properties
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 313
diff changeset
85 <D:getcontenttype/> \
b608b7aa43a6 fix sql query for selecting specific properties
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 313
diff changeset
86 <D:getlastmodified/> \
b608b7aa43a6 fix sql query for selecting specific properties
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 313
diff changeset
87 <D:creationdate/> \
b608b7aa43a6 fix sql query for selecting specific properties
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 313
diff changeset
88 <D:resourcetype/> \
b608b7aa43a6 fix sql query for selecting specific properties
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 313
diff changeset
89 <D:getetag/> \
b608b7aa43a6 fix sql query for selecting specific properties
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 313
diff changeset
90 <X:test /> \
b608b7aa43a6 fix sql query for selecting specific properties
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 313
diff changeset
91 <X:prop2 /> \
b608b7aa43a6 fix sql query for selecting specific properties
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 313
diff changeset
92 </D:prop> \
b608b7aa43a6 fix sql query for selecting specific properties
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 313
diff changeset
93 </D:propfind>"
b608b7aa43a6 fix sql query for selecting specific properties
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 313
diff changeset
94
316
4090fc1b1c52 add tests for propfind allprop
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 315
diff changeset
95 #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
96 <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
97 <D:allprop/> \
4090fc1b1c52 add tests for propfind allprop
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 315
diff changeset
98 </D:propfind>"
4090fc1b1c52 add tests for propfind allprop
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 315
diff changeset
99
318
60870dbac94f add basic pg proppatch implementation
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 316
diff changeset
100 #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
101 <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
102 <D:set> \
60870dbac94f add basic pg proppatch implementation
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 316
diff changeset
103 <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
104 </D:set> \
60870dbac94f add basic pg proppatch implementation
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 316
diff changeset
105 </D:propertyupdate>"
306
e03737cea6e2 add semi functional pg propfind handler
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 296
diff changeset
106
324
44cf877b3d9f add support for xml properties in propfind/proppatch requests (pg)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 318
diff changeset
107 #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
108 <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
109 <D:set> \
44cf877b3d9f add support for xml properties in propfind/proppatch requests (pg)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 318
diff changeset
110 <D:prop>\
44cf877b3d9f add support for xml properties in propfind/proppatch requests (pg)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 318
diff changeset
111 <XA:xtest>\
44cf877b3d9f add support for xml properties in propfind/proppatch requests (pg)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 318
diff changeset
112 <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
113 <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
114 <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
115 <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
116 </Z:nstest>\
44cf877b3d9f add support for xml properties in propfind/proppatch requests (pg)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 318
diff changeset
117 </XA:xtest>\
44cf877b3d9f add support for xml properties in propfind/proppatch requests (pg)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 318
diff changeset
118 </D:prop> \
44cf877b3d9f add support for xml properties in propfind/proppatch requests (pg)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 318
diff changeset
119 </D:set> \
44cf877b3d9f add support for xml properties in propfind/proppatch requests (pg)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 318
diff changeset
120 </D:propertyupdate>"
44cf877b3d9f add support for xml properties in propfind/proppatch requests (pg)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 318
diff changeset
121
289
285d483db2fb add first pg vfs tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
122 #ifdef __cplusplus
285d483db2fb add first pg vfs tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
123 }
285d483db2fb add first pg vfs tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
124 #endif
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 /* PGTEST_H */
285d483db2fb add first pg vfs tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
127

mercurial