src/server/plugins/postgresql/pgtest.h

Fri, 01 Nov 2024 12:25:52 +0100

author
Olaf Wintermann <olaf.wintermann@gmail.com>
date
Fri, 01 Nov 2024 12:25:52 +0100
changeset 562
69fc4ecc5f60
parent 505
d41fc7f37aed
permissions
-rw-r--r--

fix pgext uses a wrong field number, if the column has the same name as a resource or property column

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
415
d938228c382e switch from ucx 2 to 3
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 374
diff changeset
17 #include "../../test/test.h"
d938228c382e switch from ucx 2 to 3
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 374
diff changeset
18 #include <cx/map.h>
505
d41fc7f37aed remove basic_mempool.h usage
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 415
diff changeset
19 #include <cx/mempool.h>
313
3ad0b65ec838 test pg propfind response
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 311
diff changeset
20 #include <libxml/tree.h>
289
285d483db2fb add first pg vfs tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
21
285d483db2fb add first pg vfs tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
22 #ifdef __cplusplus
285d483db2fb add first pg vfs tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
23 extern "C" {
285d483db2fb add first pg vfs tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
24 #endif
285d483db2fb add first pg vfs tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
25
313
3ad0b65ec838 test pg propfind response
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 311
diff changeset
26 typedef struct TestMultistatus {
415
d938228c382e switch from ucx 2 to 3
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 374
diff changeset
27 CxMempool *mp;
313
3ad0b65ec838 test pg propfind response
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 311
diff changeset
28 xmlDoc *doc;
415
d938228c382e switch from ucx 2 to 3
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 374
diff changeset
29 CxMap *responses;
313
3ad0b65ec838 test pg propfind response
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 311
diff changeset
30 } TestMultistatus;
3ad0b65ec838 test pg propfind response
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 311
diff changeset
31
3ad0b65ec838 test pg propfind response
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 311
diff changeset
32 typedef struct TestResponse {
3ad0b65ec838 test pg propfind response
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 311
diff changeset
33 char *href;
415
d938228c382e switch from ucx 2 to 3
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 374
diff changeset
34 CxMap *properties;
313
3ad0b65ec838 test pg propfind response
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 311
diff changeset
35 } TestResponse;
3ad0b65ec838 test pg propfind response
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 311
diff changeset
36
3ad0b65ec838 test pg propfind response
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 311
diff changeset
37 typedef struct TestProperty {
3ad0b65ec838 test pg propfind response
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 311
diff changeset
38 char *prefix;
3ad0b65ec838 test pg propfind response
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 311
diff changeset
39 char *namespace;
3ad0b65ec838 test pg propfind response
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 311
diff changeset
40 char *name;
3ad0b65ec838 test pg propfind response
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 311
diff changeset
41 char *lang;
3ad0b65ec838 test pg propfind response
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 311
diff changeset
42 char *value;
3ad0b65ec838 test pg propfind response
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 311
diff changeset
43 xmlNode *node;
3ad0b65ec838 test pg propfind response
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 311
diff changeset
44 int status;
3ad0b65ec838 test pg propfind response
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 311
diff changeset
45 } TestProperty;
3ad0b65ec838 test pg propfind response
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 311
diff changeset
46
3ad0b65ec838 test pg propfind response
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 311
diff changeset
47 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
48 void test_multistatus_destroy(TestMultistatus *ms);
3ad0b65ec838 test pg propfind response
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 311
diff changeset
49
289
285d483db2fb add first pg vfs tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
50 UCX_TEST(test_pg_conn);
285d483db2fb add first pg vfs tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
51
374
77506ec632a4 use configured root node from PgRepository in pg vfs/webdav
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 324
diff changeset
52 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
53
289
285d483db2fb add first pg vfs tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
54 UCX_TEST(test_pg_vfs_open);
285d483db2fb add first pg vfs tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
55 UCX_TEST(test_pg_vfs_io);
290
efc10acf539f implement pg vfs mkdir
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 289
diff changeset
56 UCX_TEST(test_pg_vfs_stat);
efc10acf539f implement pg vfs mkdir
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 289
diff changeset
57 UCX_TEST(test_pg_vfs_mkdir);
294
277a5896a2ec implement pg unlink
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 290
diff changeset
58 UCX_TEST(test_pg_vfs_unlink);
296
78e92337fa4e implement pg rmdir
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 294
diff changeset
59 UCX_TEST(test_pg_vfs_rmdir);
289
285d483db2fb add first pg vfs tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
60
306
e03737cea6e2 add semi functional pg propfind handler
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 296
diff changeset
61 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
62 UCX_TEST(test_pg_prepare_tests);
e03737cea6e2 add semi functional pg propfind handler
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 296
diff changeset
63 UCX_TEST(test_pg_webdav_propfind);
316
4090fc1b1c52 add tests for propfind allprop
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 315
diff changeset
64 UCX_TEST(test_pg_webdav_propfind_allprop);
318
60870dbac94f add basic pg proppatch implementation
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 316
diff changeset
65 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
66
e03737cea6e2 add semi functional pg propfind handler
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 296
diff changeset
67
e03737cea6e2 add semi functional pg propfind handler
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 296
diff changeset
68 /* --------------------------- PROPFIND --------------------------- */
e03737cea6e2 add semi functional pg propfind handler
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 296
diff changeset
69
e03737cea6e2 add semi functional pg propfind handler
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 296
diff changeset
70 #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
71 <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
72 <D:prop> \
e03737cea6e2 add semi functional pg propfind handler
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 296
diff changeset
73 <D:displayname/> \
e03737cea6e2 add semi functional pg propfind handler
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 296
diff changeset
74 <D:getcontentlength/> \
e03737cea6e2 add semi functional pg propfind handler
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 296
diff changeset
75 <D:getcontenttype/> \
e03737cea6e2 add semi functional pg propfind handler
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 296
diff changeset
76 <D:getlastmodified/> \
311
e676ed461b5b implement pg getlastmodified propfind (and prepare creationdate)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 306
diff changeset
77 <D:creationdate/> \
306
e03737cea6e2 add semi functional pg propfind handler
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 296
diff changeset
78 <D:resourcetype/> \
e03737cea6e2 add semi functional pg propfind handler
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 296
diff changeset
79 <D:getetag/> \
e03737cea6e2 add semi functional pg propfind handler
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 296
diff changeset
80 </D:prop> \
e03737cea6e2 add semi functional pg propfind handler
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 296
diff changeset
81 </D:propfind>"
e03737cea6e2 add semi functional pg propfind handler
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 296
diff changeset
82
315
b608b7aa43a6 fix sql query for selecting specific properties
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 313
diff changeset
83 #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
84 <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
85 <D:prop> \
b608b7aa43a6 fix sql query for selecting specific properties
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 313
diff changeset
86 <D:displayname/> \
b608b7aa43a6 fix sql query for selecting specific properties
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 313
diff changeset
87 <D:getcontentlength/> \
b608b7aa43a6 fix sql query for selecting specific properties
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 313
diff changeset
88 <D:getcontenttype/> \
b608b7aa43a6 fix sql query for selecting specific properties
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 313
diff changeset
89 <D:getlastmodified/> \
b608b7aa43a6 fix sql query for selecting specific properties
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 313
diff changeset
90 <D:creationdate/> \
b608b7aa43a6 fix sql query for selecting specific properties
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 313
diff changeset
91 <D:resourcetype/> \
b608b7aa43a6 fix sql query for selecting specific properties
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 313
diff changeset
92 <D:getetag/> \
b608b7aa43a6 fix sql query for selecting specific properties
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 313
diff changeset
93 <X:test /> \
b608b7aa43a6 fix sql query for selecting specific properties
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 313
diff changeset
94 <X:prop2 /> \
b608b7aa43a6 fix sql query for selecting specific properties
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 313
diff changeset
95 </D:prop> \
b608b7aa43a6 fix sql query for selecting specific properties
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 313
diff changeset
96 </D:propfind>"
b608b7aa43a6 fix sql query for selecting specific properties
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 313
diff changeset
97
316
4090fc1b1c52 add tests for propfind allprop
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 315
diff changeset
98 #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
99 <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
100 <D:allprop/> \
4090fc1b1c52 add tests for propfind allprop
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 315
diff changeset
101 </D:propfind>"
4090fc1b1c52 add tests for propfind allprop
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 315
diff changeset
102
318
60870dbac94f add basic pg proppatch implementation
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 316
diff changeset
103 #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
104 <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
105 <D:set> \
60870dbac94f add basic pg proppatch implementation
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 316
diff changeset
106 <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
107 </D:set> \
60870dbac94f add basic pg proppatch implementation
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 316
diff changeset
108 </D:propertyupdate>"
306
e03737cea6e2 add semi functional pg propfind handler
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 296
diff changeset
109
324
44cf877b3d9f add support for xml properties in propfind/proppatch requests (pg)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 318
diff changeset
110 #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
111 <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
112 <D:set> \
44cf877b3d9f add support for xml properties in propfind/proppatch requests (pg)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 318
diff changeset
113 <D:prop>\
44cf877b3d9f add support for xml properties in propfind/proppatch requests (pg)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 318
diff changeset
114 <XA:xtest>\
44cf877b3d9f add support for xml properties in propfind/proppatch requests (pg)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 318
diff changeset
115 <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
116 <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
117 <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
118 <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
119 </Z:nstest>\
44cf877b3d9f add support for xml properties in propfind/proppatch requests (pg)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 318
diff changeset
120 </XA:xtest>\
44cf877b3d9f add support for xml properties in propfind/proppatch requests (pg)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 318
diff changeset
121 </D:prop> \
44cf877b3d9f add support for xml properties in propfind/proppatch requests (pg)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 318
diff changeset
122 </D:set> \
44cf877b3d9f add support for xml properties in propfind/proppatch requests (pg)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 318
diff changeset
123 </D:propertyupdate>"
44cf877b3d9f add support for xml properties in propfind/proppatch requests (pg)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 318
diff changeset
124
289
285d483db2fb add first pg vfs tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
125 #ifdef __cplusplus
285d483db2fb add first pg vfs tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
126 }
285d483db2fb add first pg vfs tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
127 #endif
285d483db2fb add first pg vfs tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
128
285d483db2fb add first pg vfs tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
129 #endif /* PGTEST_H */
285d483db2fb add first pg vfs tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
130

mercurial