34 #include "../../test/webdav.h" |
34 #include "../../test/webdav.h" |
35 #include "../../public/nsapi.h" |
35 #include "../../public/nsapi.h" |
36 #include "../../public/webdav.h" |
36 #include "../../public/webdav.h" |
37 #include "../../webdav/webdav.h" |
37 #include "../../webdav/webdav.h" |
38 |
38 |
39 #include <ucx/string.h> |
39 #include <cx/string.h> |
40 #include <ucx/utils.h> |
40 #include <cx/utils.h> |
41 #include <ucx/buffer.h> |
41 #include <cx/buffer.h> |
42 |
42 |
43 #include "pgtest.h" |
43 #include "pgtest.h" |
44 #include "vfs.h" |
44 #include "vfs.h" |
45 #include "webdav.h" |
45 #include "webdav.h" |
46 |
46 |
47 #include <libpq-fe.h> |
47 #include <libpq-fe.h> |
48 |
48 |
49 #define xstreq(a,b) xmlStrEqual(BAD_CAST a, BAD_CAST b) |
49 #define xstreq(a,b) xmlStrEqual(BAD_CAST a, BAD_CAST b) |
|
50 |
|
51 #define MAP_GET(map, key) cxMapGet(map, cx_hash_key_str(key)) |
|
52 #define MAP_PUT(map, key, value) cxMapPut(map, cx_hash_key_str(key), value) |
50 |
53 |
51 static char *pg_connstr = "postgresql://localhost/test1"; |
54 static char *pg_connstr = "postgresql://localhost/test1"; |
52 static int abort_pg_tests = 0; |
55 static int abort_pg_tests = 0; |
53 static PGconn *test_connection; |
56 static PGconn *test_connection; |
54 static ResourceData resdata; |
57 static ResourceData resdata; |
116 } |
119 } |
117 } |
120 } |
118 |
121 |
119 static void parse_response_tag(TestMultistatus *ms, xmlNode *node) { |
122 static void parse_response_tag(TestMultistatus *ms, xmlNode *node) { |
120 // thanks to dav for some of this code |
123 // thanks to dav for some of this code |
121 UcxAllocator *a = ms->mp->allocator; |
124 CxAllocator *a = (CxAllocator*)ms->mp->allocator; |
122 node = node->children; |
125 node = node->children; |
123 |
126 |
124 sstr_t href = {NULL, 0}; |
127 cxmutstr href = {NULL, 0}; |
125 UcxMap *properties = ucx_map_new_a(ms->mp->allocator, 16); |
128 CxMap *properties = cxHashMapCreate(a, 16); |
126 |
129 |
127 while(node) { |
130 while(node) { |
128 if(node->type == XML_ELEMENT_NODE) { |
131 if(node->type == XML_ELEMENT_NODE) { |
129 if(xstreq(node->name, "href")) { |
132 if(xstreq(node->name, "href")) { |
130 xmlNode *href_node = node->children; |
133 xmlNode *href_node = node->children; |
131 if(href_node->type != XML_TEXT_NODE) { |
134 if(href_node->type != XML_TEXT_NODE) { |
132 return; |
135 return; |
133 } |
136 } |
134 href = sstrdup_a(ms->mp->allocator, scstr((const char*)href_node->content)); |
137 href = cx_strdup_a(a, cx_str((const char*)href_node->content)); |
135 } else if(xstreq(node->name, "propstat")) { |
138 } else if(xstreq(node->name, "propstat")) { |
136 xmlNode *n = node->children; |
139 xmlNode *n = node->children; |
137 xmlNode *prop_node = NULL; |
140 xmlNode *prop_node = NULL; |
138 int status_code = 0; |
141 int status_code = 0; |
139 while(n) { |
142 while(n) { |
143 } else if(xstreq(n->name, "status")) { |
146 } else if(xstreq(n->name, "status")) { |
144 xmlNode *status_node = n->children; |
147 xmlNode *status_node = n->children; |
145 if(status_node->type != XML_TEXT_NODE) { |
148 if(status_node->type != XML_TEXT_NODE) { |
146 return; |
149 return; |
147 } |
150 } |
148 sstr_t status_str = sstr((char*)status_node->content); |
151 cxmutstr status_str = cx_mutstr((char*)status_node->content); |
149 if(status_str.length < 13) { |
152 if(status_str.length < 13) { |
150 return; |
153 return; |
151 } |
154 } |
152 status_str = sstrsubsl(status_str, 9, 3); |
155 status_str = cx_strsubsl_m(status_str, 9, 3); |
153 sstr_t status_s = sstrdup(status_str); |
156 cxmutstr status_s = cx_strdup(cx_strcast(status_str)); |
154 status_code = atoi(status_s.ptr); |
157 status_code = atoi(status_s.ptr); |
155 free(status_s.ptr); |
158 free(status_s.ptr); |
156 } |
159 } |
157 } |
160 } |
158 n = n->next; |
161 n = n->next; |
159 } |
162 } |
160 |
163 |
161 n = prop_node->children; |
164 n = prop_node->children; |
162 while(n) { |
165 while(n) { |
163 if(n->type == XML_ELEMENT_NODE) { |
166 if(n->type == XML_ELEMENT_NODE) { |
164 TestProperty *property = ucx_mempool_calloc(ms->mp, 1, sizeof(TestProperty)); |
167 TestProperty *property = cxCalloc(ms->mp->allocator, 1, sizeof(TestProperty)); |
165 if(n->ns) { |
168 if(n->ns) { |
166 property->prefix = n->ns->prefix ? sstrdup_a(a, scstr((const char*)n->ns->prefix)).ptr : NULL; |
169 property->prefix = n->ns->prefix ? cx_strdup_a(a, cx_str((const char*)n->ns->prefix)).ptr : NULL; |
167 property->namespace = n->ns->href ? sstrdup_a(a, scstr((const char*)n->ns->href)).ptr : NULL; |
170 property->namespace = n->ns->href ? cx_strdup_a(a, cx_str((const char*)n->ns->href)).ptr : NULL; |
168 } |
171 } |
169 property->name = sstrdup_a(a, scstr((const char*)n->name)).ptr; |
172 property->name = cx_strdup_a(a, cx_str((const char*)n->name)).ptr; |
170 property->node = n; |
173 property->node = n; |
171 property->status = status_code; |
174 property->status = status_code; |
172 xmlNode *value = n->children; |
175 xmlNode *value = n->children; |
173 if(value && value->type == XML_TEXT_NODE) { |
176 if(value && value->type == XML_TEXT_NODE) { |
174 property->value = sstrdup_a(a, scstr((const char*)value->content)).ptr; |
177 property->value = cx_strdup_a(a, cx_str((const char*)value->content)).ptr; |
175 } |
178 } |
176 if(property->namespace && property->name) { |
179 if(property->namespace && property->name) { |
177 sstr_t pname = sstrcat(2, sstr(property->namespace), sstr(property->name)); |
180 cxmutstr pname = cx_strcat(2, cx_str(property->namespace), cx_str(property->name)); |
178 ucx_map_sstr_put(properties, pname, property); |
181 cxMapPut(properties, cx_hash_key(pname.ptr, pname.length), property); |
179 free(pname.ptr); |
182 free(pname.ptr); |
180 } |
183 } |
181 } |
184 } |
182 n = n->next; |
185 n = n->next; |
183 } |
186 } |
184 } |
187 } |
185 } |
188 } |
186 node = node->next; |
189 node = node->next; |
187 } |
190 } |
188 |
191 |
189 TestResponse *resp =almalloc(a, sizeof(TestResponse)); |
192 TestResponse *resp = cxMalloc(a, sizeof(TestResponse)); |
190 resp->href = href.ptr; |
193 resp->href = href.ptr; |
191 resp->properties = properties; |
194 resp->properties = properties; |
192 |
195 |
193 ucx_map_sstr_put(ms->responses, href, resp); |
196 cxMapPut(ms->responses, cx_hash_key(href.ptr, href.length), resp); |
194 } |
197 } |
195 |
198 |
196 TestMultistatus* test_parse_multistatus(const char *space, size_t size) { |
199 TestMultistatus* test_parse_multistatus(const char *space, size_t size) { |
197 xmlDoc *doc = xmlReadMemory(space, size, NULL, NULL, 0); |
200 xmlDoc *doc = xmlReadMemory(space, size, NULL, NULL, 0); |
198 if(!doc) { |
201 if(!doc) { |
199 return NULL; |
202 return NULL; |
200 } |
203 } |
201 |
204 |
202 UcxMempool *mp = ucx_mempool_new(64); |
205 CxMempool *mp = cxBasicMempoolCreate(64); |
203 TestMultistatus *ms = ucx_mempool_malloc(mp, sizeof(TestMultistatus)); |
206 TestMultistatus *ms = cxMalloc(mp->allocator, sizeof(TestMultistatus)); |
204 ms->doc = doc; |
207 ms->doc = doc; |
205 ms->mp = mp; |
208 ms->mp = mp; |
206 ms->responses = ucx_map_new_a(mp->allocator, 8); |
209 ms->responses = cxHashMapCreate((CxAllocator*)mp->allocator, 8); |
207 |
210 |
208 // parse response |
211 // parse response |
209 xmlNode *xml_root = xmlDocGetRootElement(doc); |
212 xmlNode *xml_root = xmlDocGetRootElement(doc); |
210 xmlNode *node = xml_root->children; |
213 xmlNode *node = xml_root->children; |
211 while(node) { |
214 while(node) { |
639 UCX_TEST_ASSERT(ret == REQ_PROCEED, "webdav_propfind (1) failed"); |
642 UCX_TEST_ASSERT(ret == REQ_PROCEED, "webdav_propfind (1) failed"); |
640 |
643 |
641 TestMultistatus *ms = test_parse_multistatus(st->buf->space, st->buf->size); |
644 TestMultistatus *ms = test_parse_multistatus(st->buf->space, st->buf->size); |
642 UCX_TEST_ASSERT(ms, "propfind1: response is not valid xml"); |
645 UCX_TEST_ASSERT(ms, "propfind1: response is not valid xml"); |
643 |
646 |
644 TestResponse *r1 = ucx_map_cstr_get(ms->responses, "/propfind/"); |
647 TestResponse *r1 = MAP_GET(ms->responses, "/propfind/"); |
645 UCX_TEST_ASSERT(r1, "propfind1: missing /propfind/ response"); |
648 UCX_TEST_ASSERT(r1, "propfind1: missing /propfind/ response"); |
646 |
649 |
647 UCX_TEST_ASSERT(ms->responses->count == 1, "propfind1: wrong response count"); |
650 UCX_TEST_ASSERT(ms->responses->size == 1, "propfind1: wrong response count"); |
648 |
651 |
649 TestProperty *p = ucx_map_cstr_get(r1->properties, "DAV:resourcetype"); |
652 TestProperty *p = MAP_GET(r1->properties, "DAV:resourcetype"); |
650 UCX_TEST_ASSERT(p, "propfind1: missing property 'resourcetype'"); |
653 UCX_TEST_ASSERT(p, "propfind1: missing property 'resourcetype'"); |
651 UCX_TEST_ASSERT(p->status == 200, "propfind1: wrong status code for property 'resourcetype'"); |
654 UCX_TEST_ASSERT(p->status == 200, "propfind1: wrong status code for property 'resourcetype'"); |
652 |
655 |
653 p = ucx_map_cstr_get(r1->properties, "DAV:getlastmodified"); |
656 p = MAP_GET(r1->properties, "DAV:getlastmodified"); |
654 UCX_TEST_ASSERT(p, "propfind1: missing property 'getlastmodified'"); |
657 UCX_TEST_ASSERT(p, "propfind1: missing property 'getlastmodified'"); |
655 UCX_TEST_ASSERT(p->status == 200, "propfind1: wrong status code for property 'getlastmodified'"); |
658 UCX_TEST_ASSERT(p->status == 200, "propfind1: wrong status code for property 'getlastmodified'"); |
656 |
659 |
657 testutil_destroy_session(sn); |
660 testutil_destroy_session(sn); |
658 test_multistatus_destroy(ms); |
661 test_multistatus_destroy(ms); |
671 UCX_TEST_ASSERT(ret == REQ_PROCEED, "webdav_propfind (2) failed"); |
674 UCX_TEST_ASSERT(ret == REQ_PROCEED, "webdav_propfind (2) failed"); |
672 |
675 |
673 ms = test_parse_multistatus(st->buf->space, st->buf->size); |
676 ms = test_parse_multistatus(st->buf->space, st->buf->size); |
674 UCX_TEST_ASSERT(ms, "propfind2: response is not valid xml"); |
677 UCX_TEST_ASSERT(ms, "propfind2: response is not valid xml"); |
675 |
678 |
676 r1 = ucx_map_cstr_get(ms->responses, "/propfind/"); |
679 r1 = MAP_GET(ms->responses, "/propfind/"); |
677 UCX_TEST_ASSERT(r1, "propfind2: missing /propfind/ response"); |
680 UCX_TEST_ASSERT(r1, "propfind2: missing /propfind/ response"); |
678 |
681 |
679 UCX_TEST_ASSERT(ms->responses->count == 5, "propfind2: wrong response count"); |
682 UCX_TEST_ASSERT(ms->responses->size == 5, "propfind2: wrong response count"); |
680 |
683 |
681 r1 = ucx_map_cstr_get(ms->responses, "/propfind/res2"); |
684 r1 = MAP_GET(ms->responses, "/propfind/res2"); |
682 UCX_TEST_ASSERT(r1, "propfind2: missing /propfind/res2 response"); |
685 UCX_TEST_ASSERT(r1, "propfind2: missing /propfind/res2 response"); |
683 |
686 |
684 p = ucx_map_cstr_get(r1->properties, "http://example.com/test"); |
687 p = MAP_GET(r1->properties, "http://example.com/test"); |
685 UCX_TEST_ASSERT(p, "propfind2: missing property 'test'"); |
688 UCX_TEST_ASSERT(p, "propfind2: missing property 'test'"); |
686 UCX_TEST_ASSERT(p->status == 200, "propfind2: wrong status code for property 'test'"); |
689 UCX_TEST_ASSERT(p->status == 200, "propfind2: wrong status code for property 'test'"); |
687 UCX_TEST_ASSERT(!strcmp(p->value, "res2test"), "propfind2: wrong property value"); |
690 UCX_TEST_ASSERT(!strcmp(p->value, "res2test"), "propfind2: wrong property value"); |
688 |
691 |
689 |
692 |
705 UCX_TEST_ASSERT(ret == REQ_PROCEED, "webdav_propfind (3) failed"); |
708 UCX_TEST_ASSERT(ret == REQ_PROCEED, "webdav_propfind (3) failed"); |
706 |
709 |
707 ms = test_parse_multistatus(st->buf->space, st->buf->size); |
710 ms = test_parse_multistatus(st->buf->space, st->buf->size); |
708 UCX_TEST_ASSERT(ms, "propfind3: response is not valid xml"); |
711 UCX_TEST_ASSERT(ms, "propfind3: response is not valid xml"); |
709 |
712 |
710 r1 = ucx_map_cstr_get(ms->responses, "/propfind/"); |
713 r1 = MAP_GET(ms->responses, "/propfind/"); |
711 UCX_TEST_ASSERT(r1, "propfind3: missing /propfind/ response"); |
714 UCX_TEST_ASSERT(r1, "propfind3: missing /propfind/ response"); |
712 |
715 |
713 UCX_TEST_ASSERT(ms->responses->count == 6, "propfind3: wrong response count"); |
716 UCX_TEST_ASSERT(ms->responses->size == 6, "propfind3: wrong response count"); |
714 |
717 |
715 |
718 |
716 r1 = ucx_map_cstr_get(ms->responses, "/propfind/res1"); |
719 r1 = MAP_GET(ms->responses, "/propfind/res1"); |
717 UCX_TEST_ASSERT(r1, "propfind3: missing /propfind/sub/res1 response"); |
720 UCX_TEST_ASSERT(r1, "propfind3: missing /propfind/sub/res1 response"); |
718 |
721 |
719 p = ucx_map_cstr_get(r1->properties, "http://example.com/test"); |
722 p = MAP_GET(r1->properties, "http://example.com/test"); |
720 UCX_TEST_ASSERT(p, "propfind3: missing property 'test'"); |
723 UCX_TEST_ASSERT(p, "propfind3: missing property 'test'"); |
721 UCX_TEST_ASSERT(p->status == 200, "propfind3: wrong status code for property 'test'"); |
724 UCX_TEST_ASSERT(p->status == 200, "propfind3: wrong status code for property 'test'"); |
722 UCX_TEST_ASSERT(!strcmp(p->value, "testvalue"), "propfind3: wrong property value"); |
725 UCX_TEST_ASSERT(!strcmp(p->value, "testvalue"), "propfind3: wrong property value"); |
723 |
726 |
724 p = ucx_map_cstr_get(r1->properties, "http://example.com/prop2"); |
727 p = MAP_GET(r1->properties, "http://example.com/prop2"); |
725 UCX_TEST_ASSERT(p, "propfind3: missing property 'prop2'"); |
728 UCX_TEST_ASSERT(p, "propfind3: missing property 'prop2'"); |
726 UCX_TEST_ASSERT(p->status == 200, "propfind3: wrong status code for property 'prop2'"); |
729 UCX_TEST_ASSERT(p->status == 200, "propfind3: wrong status code for property 'prop2'"); |
727 UCX_TEST_ASSERT(!strcmp(p->value, "value2"), "propfind3: wrong property value"); |
730 UCX_TEST_ASSERT(!strcmp(p->value, "value2"), "propfind3: wrong property value"); |
728 |
731 |
729 |
732 |
730 r1 = ucx_map_cstr_get(ms->responses, "/propfind/sub/res4"); |
733 r1 = MAP_GET(ms->responses, "/propfind/sub/res4"); |
731 UCX_TEST_ASSERT(r1, "propfind3: missing /propfind/sub/res4 response"); |
734 UCX_TEST_ASSERT(r1, "propfind3: missing /propfind/sub/res4 response"); |
732 |
735 |
733 testutil_destroy_session(sn); |
736 testutil_destroy_session(sn); |
734 test_multistatus_destroy(ms); |
737 test_multistatus_destroy(ms); |
735 testutil_iostream_destroy(st); |
738 testutil_iostream_destroy(st); |
768 UCX_TEST_ASSERT(ret == REQ_PROCEED, "webdav_propfind (1) failed"); |
771 UCX_TEST_ASSERT(ret == REQ_PROCEED, "webdav_propfind (1) failed"); |
769 |
772 |
770 TestMultistatus *ms = test_parse_multistatus(st->buf->space, st->buf->size); |
773 TestMultistatus *ms = test_parse_multistatus(st->buf->space, st->buf->size); |
771 UCX_TEST_ASSERT(ms, "propfind1: response is not valid xml"); |
774 UCX_TEST_ASSERT(ms, "propfind1: response is not valid xml"); |
772 |
775 |
773 r1 = ucx_map_cstr_get(ms->responses, "/propfind/"); |
776 r1 = MAP_GET(ms->responses, "/propfind/"); |
774 UCX_TEST_ASSERT(r1, "propfind1: missing /propfind/ response"); |
777 UCX_TEST_ASSERT(r1, "propfind1: missing /propfind/ response"); |
775 UCX_TEST_ASSERT(ms->responses->count == 1, "propfind1: wrong response count"); |
778 UCX_TEST_ASSERT(ms->responses->size == 1, "propfind1: wrong response count"); |
776 |
779 |
777 p = ucx_map_cstr_get(r1->properties, "DAV:resourcetype"); |
780 p = MAP_GET(r1->properties, "DAV:resourcetype"); |
778 UCX_TEST_ASSERT(r1, "propfind1: missing resourcetype property"); |
781 UCX_TEST_ASSERT(r1, "propfind1: missing resourcetype property"); |
779 |
782 |
780 testutil_destroy_session(sn); |
783 testutil_destroy_session(sn); |
781 test_multistatus_destroy(ms); |
784 test_multistatus_destroy(ms); |
782 testutil_iostream_destroy(st); |
785 testutil_iostream_destroy(st); |
793 UCX_TEST_ASSERT(ret == REQ_PROCEED, "webdav_propfind (2) failed"); |
796 UCX_TEST_ASSERT(ret == REQ_PROCEED, "webdav_propfind (2) failed"); |
794 |
797 |
795 ms = test_parse_multistatus(st->buf->space, st->buf->size); |
798 ms = test_parse_multistatus(st->buf->space, st->buf->size); |
796 UCX_TEST_ASSERT(ms, "propfind2: response is not valid xml"); |
799 UCX_TEST_ASSERT(ms, "propfind2: response is not valid xml"); |
797 |
800 |
798 r1 = ucx_map_cstr_get(ms->responses, "/propfind/"); |
801 r1 = MAP_GET(ms->responses, "/propfind/"); |
799 UCX_TEST_ASSERT(r1, "propfind2: missing /propfind/ response"); |
802 UCX_TEST_ASSERT(r1, "propfind2: missing /propfind/ response"); |
800 UCX_TEST_ASSERT(ms->responses->count == 5, "propfind2: wrong response count"); |
803 UCX_TEST_ASSERT(ms->responses->size == 5, "propfind2: wrong response count"); |
801 |
804 |
802 r1 = ucx_map_cstr_get(ms->responses, "/propfind/res1"); |
805 r1 = MAP_GET(ms->responses, "/propfind/res1"); |
803 UCX_TEST_ASSERT(r1, "propfind2: missing /propfind/res1 response"); |
806 UCX_TEST_ASSERT(r1, "propfind2: missing /propfind/res1 response"); |
804 |
807 |
805 p = ucx_map_cstr_get(r1->properties, "DAV:resourcetype"); |
808 p = MAP_GET(r1->properties, "DAV:resourcetype"); |
806 UCX_TEST_ASSERT(r1, "propfind2: missing resourcetype property"); |
809 UCX_TEST_ASSERT(r1, "propfind2: missing resourcetype property"); |
807 p = ucx_map_cstr_get(r1->properties, "http://example.com/test"); |
810 p = MAP_GET(r1->properties, "http://example.com/test"); |
808 UCX_TEST_ASSERT(r1, "propfind2: missing test property"); |
811 UCX_TEST_ASSERT(r1, "propfind2: missing test property"); |
809 p = ucx_map_cstr_get(r1->properties, "http://example.com/prop2"); |
812 p = MAP_GET(r1->properties, "http://example.com/prop2"); |
810 UCX_TEST_ASSERT(r1, "propfind2: missing prop2 property"); |
813 UCX_TEST_ASSERT(r1, "propfind2: missing prop2 property"); |
811 |
814 |
812 UCX_TEST_ASSERT(ucx_map_cstr_get(ms->responses, "/propfind/res2"), "propfind2: missing /propfind/res2 response"); |
815 UCX_TEST_ASSERT(MAP_GET(ms->responses, "/propfind/res2"), "propfind2: missing /propfind/res2 response"); |
813 UCX_TEST_ASSERT(ucx_map_cstr_get(ms->responses, "/propfind/res3"), "propfind2: missing /propfind/res3 response"); |
816 UCX_TEST_ASSERT(MAP_GET(ms->responses, "/propfind/res3"), "propfind2: missing /propfind/res3 response"); |
814 UCX_TEST_ASSERT(ucx_map_cstr_get(ms->responses, "/propfind/sub/"), "propfind2: missing /propfind/sub response"); |
817 UCX_TEST_ASSERT(MAP_GET(ms->responses, "/propfind/sub/"), "propfind2: missing /propfind/sub response"); |
815 |
818 |
816 testutil_destroy_session(sn); |
819 testutil_destroy_session(sn); |
817 test_multistatus_destroy(ms); |
820 test_multistatus_destroy(ms); |
818 testutil_iostream_destroy(st); |
821 testutil_iostream_destroy(st); |
819 |
822 |
827 UCX_TEST_ASSERT(ret == REQ_PROCEED, "webdav_propfind (2) failed"); |
830 UCX_TEST_ASSERT(ret == REQ_PROCEED, "webdav_propfind (2) failed"); |
828 |
831 |
829 ms = test_parse_multistatus(st->buf->space, st->buf->size); |
832 ms = test_parse_multistatus(st->buf->space, st->buf->size); |
830 UCX_TEST_ASSERT(ms, "propfind3: response is not valid xml"); |
833 UCX_TEST_ASSERT(ms, "propfind3: response is not valid xml"); |
831 |
834 |
832 r1 = ucx_map_cstr_get(ms->responses, "/propfind/"); |
835 r1 = MAP_GET(ms->responses, "/propfind/"); |
833 UCX_TEST_ASSERT(r1, "propfind3: missing /propfind/ response"); |
836 UCX_TEST_ASSERT(r1, "propfind3: missing /propfind/ response"); |
834 UCX_TEST_ASSERT(ms->responses->count == 6, "propfind3: wrong response count"); |
837 UCX_TEST_ASSERT(ms->responses->size == 6, "propfind3: wrong response count"); |
835 |
838 |
836 r1 = ucx_map_cstr_get(ms->responses, "/propfind/res1"); |
839 r1 = MAP_GET(ms->responses, "/propfind/res1"); |
837 UCX_TEST_ASSERT(r1, "propfind3: missing /propfind/res1 response"); |
840 UCX_TEST_ASSERT(r1, "propfind3: missing /propfind/res1 response"); |
838 |
841 |
839 p = ucx_map_cstr_get(r1->properties, "DAV:resourcetype"); |
842 p = MAP_GET(r1->properties, "DAV:resourcetype"); |
840 UCX_TEST_ASSERT(r1, "propfind3: missing resourcetype property"); |
843 UCX_TEST_ASSERT(r1, "propfind3: missing resourcetype property"); |
841 p = ucx_map_cstr_get(r1->properties, "http://example.com/test"); |
844 p = MAP_GET(r1->properties, "http://example.com/test"); |
842 UCX_TEST_ASSERT(r1, "propfind3: missing test property"); |
845 UCX_TEST_ASSERT(r1, "propfind3: missing test property"); |
843 p = ucx_map_cstr_get(r1->properties, "http://example.com/prop2"); |
846 p = MAP_GET(r1->properties, "http://example.com/prop2"); |
844 UCX_TEST_ASSERT(r1, "propfind3: missing prop2 property"); |
847 UCX_TEST_ASSERT(r1, "propfind3: missing prop2 property"); |
845 |
848 |
846 UCX_TEST_ASSERT(ucx_map_cstr_get(ms->responses, "/propfind/res2"), "propfind3: missing /propfind/res2 response"); |
849 UCX_TEST_ASSERT(MAP_GET(ms->responses, "/propfind/res2"), "propfind3: missing /propfind/res2 response"); |
847 UCX_TEST_ASSERT(ucx_map_cstr_get(ms->responses, "/propfind/res3"), "propfind3: missing /propfind/res3 response"); |
850 UCX_TEST_ASSERT(MAP_GET(ms->responses, "/propfind/res3"), "propfind3: missing /propfind/res3 response"); |
848 UCX_TEST_ASSERT(ucx_map_cstr_get(ms->responses, "/propfind/sub/"), "propfind3: missing /propfind/sub response"); |
851 UCX_TEST_ASSERT(MAP_GET(ms->responses, "/propfind/sub/"), "propfind3: missing /propfind/sub response"); |
849 UCX_TEST_ASSERT(ucx_map_cstr_get(ms->responses, "/propfind/sub/res4"), "propfind3: missing /propfind/sub/res4 response"); |
852 UCX_TEST_ASSERT(MAP_GET(ms->responses, "/propfind/sub/res4"), "propfind3: missing /propfind/sub/res4 response"); |
850 |
853 |
851 testutil_destroy_session(sn); |
854 testutil_destroy_session(sn); |
852 test_multistatus_destroy(ms); |
855 test_multistatus_destroy(ms); |
853 testutil_iostream_destroy(st); |
856 testutil_iostream_destroy(st); |
854 |
857 |