diff options
author | Michael Stahl <michael.stahl@allotropia.de> | 2021-11-02 16:08:53 +0100 |
---|---|---|
committer | Michael Stahl <michael.stahl@allotropia.de> | 2021-11-03 09:32:06 +0100 |
commit | 5a44e3772adb281d16757cdac3120d56565a96e5 (patch) | |
tree | 80d5c447d321025c3c0ec69c19071f7011dea11a /ucb | |
parent | 17dface79321c87b2d30a53a67aeda2e9f9dfff6 (diff) |
ucb: webdav-curl: convert webdav unit tests to curl
There's no point in building the tests for neon any more, just build
them only if curl is used.
This finds a bug in CurlUri::Init() where query and fragment separators
need to be added manually.
Change-Id: I3dcd1512450522df2c2a7d223b2e29b6c0e794fb
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/124607
Tested-by: Jenkins
Reviewed-by: Michael Stahl <michael.stahl@allotropia.de>
Diffstat (limited to 'ucb')
-rw-r--r-- | ucb/CppunitTest_ucb_webdav_local_neon.mk | 5 | ||||
-rw-r--r-- | ucb/CppunitTest_ucb_webdav_neon_opts.mk | 5 | ||||
-rw-r--r-- | ucb/CppunitTest_ucb_webdav_propfindcache.mk | 5 | ||||
-rw-r--r-- | ucb/CppunitTest_ucb_webdav_res_access.mk | 5 | ||||
-rw-r--r-- | ucb/Module_ucb.mk | 2 | ||||
-rw-r--r-- | ucb/qa/cppunit/webdav/webdav_local_neon.cxx | 31 | ||||
-rw-r--r-- | ucb/qa/cppunit/webdav/webdav_options.cxx | 2 | ||||
-rw-r--r-- | ucb/qa/cppunit/webdav/webdav_propfindcache.cxx | 4 | ||||
-rw-r--r-- | ucb/qa/cppunit/webdav/webdav_resource_access.cxx | 2 | ||||
-rw-r--r-- | ucb/source/ucp/webdav-curl/CurlUri.cxx | 4 |
10 files changed, 37 insertions, 28 deletions
diff --git a/ucb/CppunitTest_ucb_webdav_local_neon.mk b/ucb/CppunitTest_ucb_webdav_local_neon.mk index 2e920f4ca03f..b9b6d5d448ef 100644 --- a/ucb/CppunitTest_ucb_webdav_local_neon.mk +++ b/ucb/CppunitTest_ucb_webdav_local_neon.mk @@ -31,8 +31,7 @@ $(eval $(call gb_CppunitTest_use_library_objects,ucb_webdav_local_neon, \ $(eval $(call gb_CppunitTest_use_externals,ucb_webdav_local_neon,\ boost_headers \ libxml2 \ - neon \ - openssl \ + curl \ )) $(eval $(call gb_CppunitTest_use_custom_headers,ucb_webdav_local_neon,\ @@ -45,7 +44,7 @@ $(eval $(call gb_CppunitTest_add_exception_objects,ucb_webdav_local_neon, \ $(eval $(call gb_CppunitTest_set_include,ucb_webdav_local_neon,\ $$(INCLUDE) \ - -I$(SRCDIR)/ucb/source/ucp/webdav-neon \ + -I$(SRCDIR)/ucb/source/ucp/webdav-curl \ )) $(eval $(call gb_CppunitTest_use_static_libraries,ucb_webdav_local_neon)) diff --git a/ucb/CppunitTest_ucb_webdav_neon_opts.mk b/ucb/CppunitTest_ucb_webdav_neon_opts.mk index df670ed7afdd..ba77a4c59a42 100644 --- a/ucb/CppunitTest_ucb_webdav_neon_opts.mk +++ b/ucb/CppunitTest_ucb_webdav_neon_opts.mk @@ -34,8 +34,7 @@ $(eval $(call gb_CppunitTest_use_library_objects,ucb_webdav_neon_opts, \ $(eval $(call gb_CppunitTest_use_externals,ucb_webdav_neon_opts,\ boost_headers \ libxml2 \ - neon \ - openssl \ + curl \ )) $(eval $(call gb_CppunitTest_use_custom_headers,ucb_webdav_neon_opts,\ @@ -48,7 +47,7 @@ $(eval $(call gb_CppunitTest_add_exception_objects,ucb_webdav_neon_opts, \ $(eval $(call gb_CppunitTest_set_include,ucb_webdav_neon_opts,\ $$(INCLUDE) \ - -I$(SRCDIR)/ucb/source/ucp/webdav-neon \ + -I$(SRCDIR)/ucb/source/ucp/webdav-curl \ )) $(eval $(call gb_CppunitTest_use_static_libraries,ucb_webdav_neon_opts)) diff --git a/ucb/CppunitTest_ucb_webdav_propfindcache.mk b/ucb/CppunitTest_ucb_webdav_propfindcache.mk index 8d4a12d32ad4..4e9ad0668829 100644 --- a/ucb/CppunitTest_ucb_webdav_propfindcache.mk +++ b/ucb/CppunitTest_ucb_webdav_propfindcache.mk @@ -34,8 +34,7 @@ $(eval $(call gb_CppunitTest_use_library_objects,ucb_webdav_propfindcache, \ $(eval $(call gb_CppunitTest_use_externals,ucb_webdav_propfindcache,\ boost_headers \ libxml2 \ - neon \ - openssl \ + curl \ )) $(eval $(call gb_CppunitTest_use_custom_headers,ucb_webdav_propfindcache,\ @@ -48,7 +47,7 @@ $(eval $(call gb_CppunitTest_add_exception_objects,ucb_webdav_propfindcache, \ $(eval $(call gb_CppunitTest_set_include,ucb_webdav_propfindcache,\ $$(INCLUDE) \ - -I$(SRCDIR)/ucb/source/ucp/webdav-neon \ + -I$(SRCDIR)/ucb/source/ucp/webdav-curl \ )) $(eval $(call gb_CppunitTest_use_static_libraries,ucb_webdav_propfindcache)) diff --git a/ucb/CppunitTest_ucb_webdav_res_access.mk b/ucb/CppunitTest_ucb_webdav_res_access.mk index fa0669987bd2..dd335a6ff065 100644 --- a/ucb/CppunitTest_ucb_webdav_res_access.mk +++ b/ucb/CppunitTest_ucb_webdav_res_access.mk @@ -34,8 +34,7 @@ $(eval $(call gb_CppunitTest_use_library_objects,ucb_webdav_res_access, \ $(eval $(call gb_CppunitTest_use_externals,ucb_webdav_res_access,\ boost_headers \ libxml2 \ - neon \ - openssl \ + curl \ )) $(eval $(call gb_CppunitTest_use_custom_headers,ucb_webdav_res_access,\ @@ -48,7 +47,7 @@ $(eval $(call gb_CppunitTest_add_exception_objects,ucb_webdav_res_access, \ $(eval $(call gb_CppunitTest_set_include,ucb_webdav_res_access,\ $$(INCLUDE) \ - -I$(SRCDIR)/ucb/source/ucp/webdav-neon \ + -I$(SRCDIR)/ucb/source/ucp/webdav-curl \ )) $(eval $(call gb_CppunitTest_use_static_libraries,ucb_webdav_res_access)) diff --git a/ucb/Module_ucb.mk b/ucb/Module_ucb.mk index dc1405e72992..6e630e9c6342 100644 --- a/ucb/Module_ucb.mk +++ b/ucb/Module_ucb.mk @@ -31,7 +31,7 @@ $(eval $(call gb_Module_add_targets,ucb,\ )) endif -ifeq ($(WITH_WEBDAV),neon) +ifeq ($(WITH_WEBDAV),curl) $(eval $(call gb_Module_add_check_targets,ucb,\ CppunitTest_ucb_webdav_local_neon \ diff --git a/ucb/qa/cppunit/webdav/webdav_local_neon.cxx b/ucb/qa/cppunit/webdav/webdav_local_neon.cxx index a88266020787..a2208ffaccad 100644 --- a/ucb/qa/cppunit/webdav/webdav_local_neon.cxx +++ b/ucb/qa/cppunit/webdav/webdav_local_neon.cxx @@ -10,9 +10,9 @@ #include <cppunit/TestFixture.h> #include <cppunit/extensions/HelperMacros.h> #include <cppunit/plugin/TestPlugIn.h> -#include <NeonUri.hxx> +#include <CurlUri.hxx> -using namespace webdav_ucp; +using namespace http_dav_ucp; namespace { @@ -21,26 +21,39 @@ namespace { public: - void NeonUriTest(); + void WebdavUriTest(); + void WebdavUriTest2(); // Change the following lines only, if you add, remove or rename // member functions of the current class, // because these macros are need by auto register mechanism. CPPUNIT_TEST_SUITE( webdav_local_test ); - CPPUNIT_TEST( NeonUriTest ); + CPPUNIT_TEST( WebdavUriTest ); + CPPUNIT_TEST( WebdavUriTest2 ); CPPUNIT_TEST_SUITE_END(); }; // class webdav_local_test - void webdav_local_test::NeonUriTest() + void webdav_local_test::WebdavUriTest() { //try URL decomposition - NeonUri aURI( "http://user%40anothername@server.biz:8040/aService/asegment/nextsegment/check.this?test=true&link=http://anotherserver.com/%3Fcheck=theapplication%26os=linuxintel%26lang=en-US%26version=5.2.0" ); + CurlUri aURI(u"http://user%40anothername@server.biz:8040/aService/asegment/nextsegment/check.this?test=true&link=http://anotherserver.com/%3Fcheck=theapplication%26os=linuxintel%26lang=en-US%26version=5.2.0" ); CPPUNIT_ASSERT_EQUAL( OUString( "http" ), aURI.GetScheme() ); CPPUNIT_ASSERT_EQUAL( OUString( "server.biz" ), aURI.GetHost() ); - CPPUNIT_ASSERT_EQUAL( OUString( "user%40anothername" ), aURI.GetUserInfo() ); - CPPUNIT_ASSERT_EQUAL( sal_Int32( 8040 ), aURI.GetPort() ); - CPPUNIT_ASSERT_EQUAL( OUString( "/aService/asegment/nextsegment/check.this?test=true&link=http://anotherserver.com/%3Fcheck=theapplication%26os=linuxintel%26lang=en-US%26version=5.2.0" ), aURI.GetPath( ) ); + CPPUNIT_ASSERT_EQUAL( OUString( "user%40anothername" ), aURI.GetUser() ); + CPPUNIT_ASSERT_EQUAL( sal_uInt16( 8040 ), aURI.GetPort() ); + CPPUNIT_ASSERT_EQUAL( OUString( "/aService/asegment/nextsegment/check.this?test=true&link=http://anotherserver.com/%3Fcheck=theapplication%26os=linuxintel%26lang=en-US%26version=5.2.0" ), aURI.GetRelativeReference() ); + } + + void webdav_local_test::WebdavUriTest2() + { + CurlUri aURI(u"https://foo:bar@server.biz:8040/aService#aaa" ); + CPPUNIT_ASSERT_EQUAL( OUString("https"), aURI.GetScheme() ); + CPPUNIT_ASSERT_EQUAL( OUString("server.biz"), aURI.GetHost() ); + CPPUNIT_ASSERT_EQUAL( OUString("foo"), aURI.GetUser() ); + CPPUNIT_ASSERT_EQUAL( OUString("bar"), aURI.GetPassword() ); + CPPUNIT_ASSERT_EQUAL( sal_uInt16( 8040 ), aURI.GetPort() ); + CPPUNIT_ASSERT_EQUAL( OUString( "/aService#aaa" ), aURI.GetRelativeReference() ); } CPPUNIT_TEST_SUITE_REGISTRATION( webdav_local_test ); diff --git a/ucb/qa/cppunit/webdav/webdav_options.cxx b/ucb/qa/cppunit/webdav/webdav_options.cxx index eee94af2a82b..7fd0e7dedd13 100644 --- a/ucb/qa/cppunit/webdav/webdav_options.cxx +++ b/ucb/qa/cppunit/webdav/webdav_options.cxx @@ -11,7 +11,7 @@ #include <cppunit/plugin/TestPlugIn.h> #include <DAVTypes.hxx> -using namespace webdav_ucp; +using namespace http_dav_ucp; namespace { diff --git a/ucb/qa/cppunit/webdav/webdav_propfindcache.cxx b/ucb/qa/cppunit/webdav/webdav_propfindcache.cxx index 03ccdbe7aae7..a9f24345e33c 100644 --- a/ucb/qa/cppunit/webdav/webdav_propfindcache.cxx +++ b/ucb/qa/cppunit/webdav/webdav_propfindcache.cxx @@ -11,7 +11,7 @@ #include <cppunit/plugin/TestPlugIn.h> #include <PropfindCache.hxx> -using namespace webdav_ucp; +using namespace http_dav_ucp; namespace { @@ -113,7 +113,7 @@ namespace // add the cache an element aPropsNames.setPropertiesNames( std::vector(aProps) ); - PropCache.addCachePropertyNames( aPropsNames ); + PropCache.addCachePropertyNames( aPropsNames, 10 ); PropertyNames aRetPropsNames; //test existence diff --git a/ucb/qa/cppunit/webdav/webdav_resource_access.cxx b/ucb/qa/cppunit/webdav/webdav_resource_access.cxx index d1a73be2d5f3..85d3e1c236a6 100644 --- a/ucb/qa/cppunit/webdav/webdav_resource_access.cxx +++ b/ucb/qa/cppunit/webdav/webdav_resource_access.cxx @@ -12,7 +12,7 @@ #include <DAVResourceAccess.hxx> #include <DAVException.hxx> -using namespace webdav_ucp; +using namespace http_dav_ucp; namespace { diff --git a/ucb/source/ucp/webdav-curl/CurlUri.cxx b/ucb/source/ucp/webdav-curl/CurlUri.cxx index 44bbd806f267..05b1892e6cf1 100644 --- a/ucb/source/ucp/webdav-curl/CurlUri.cxx +++ b/ucb/source/ucp/webdav-curl/CurlUri.cxx @@ -93,12 +93,12 @@ void CurlUri::Init() auto const oQuery(GetURLComponent(*m_pUrl, CURLUPART_QUERY, CURLUE_NO_QUERY)); if (oQuery) { - m_QueryAndFragment += *oQuery; + m_QueryAndFragment += "?" + *oQuery; } auto const oFragment(GetURLComponent(*m_pUrl, CURLUPART_FRAGMENT, CURLUE_NO_FRAGMENT)); if (oFragment) { - m_QueryAndFragment += *oFragment; + m_QueryAndFragment += "#" + *oFragment; } } |