[Libreoffice-commits] core.git: ucb/CppunitTest_ucb_webdav_neon_opts.mk ucb/Library_ucpdav1.mk ucb/Module_ucb.mk ucb/qa ucb/source
Giuseppe Castagno
giuseppe.castagno at acca-esse.eu
Thu Jul 28 06:29:51 UTC 2016
ucb/CppunitTest_ucb_webdav_neon_opts.mk | 55 ++++++
ucb/Library_ucpdav1.mk | 1
ucb/Module_ucb.mk | 1
ucb/qa/cppunit/webdav/webdav_options.cxx | 255 +++++++++++++++++++++++++++++++
ucb/source/ucp/webdav-neon/DAVTypes.cxx | 67 ++++++++
ucb/source/ucp/webdav-neon/DAVTypes.hxx | 124 +++++++++++++--
6 files changed, 491 insertions(+), 12 deletions(-)
New commits:
commit f950b49393ee6539f2a7b3c306aa4fc119f24a84
Author: Giuseppe Castagno <giuseppe.castagno at acca-esse.eu>
Date: Sat Jan 9 17:32:26 2016 +0100
tdf#101094 (1) OPTIONS: New class to store retrieved OPTIONS
This class describes the DAV options useful to LO.
Added behavioural unit tests as well.
Change-Id: I7ba0230f1a1469b12f9b3f59f21e5c2730c65b81
Reviewed-on: https://gerrit.libreoffice.org/27595
Tested-by: Jenkins <ci at libreoffice.org>
Reviewed-by: Giuseppe Castagno <giuseppe.castagno at acca-esse.eu>
diff --git a/ucb/CppunitTest_ucb_webdav_neon_opts.mk b/ucb/CppunitTest_ucb_webdav_neon_opts.mk
new file mode 100644
index 0000000..91e167b
--- /dev/null
+++ b/ucb/CppunitTest_ucb_webdav_neon_opts.mk
@@ -0,0 +1,55 @@
+# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
+#*************************************************************************
+#
+# This file is part of the LibreOffice project.
+#
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+#
+#*************************************************************************
+
+$(eval $(call gb_CppunitTest_CppunitTest,ucb_webdav_neon_opts))
+
+$(eval $(call gb_CppunitTest_use_api,ucb_webdav_neon_opts, \
+ offapi \
+ udkapi \
+))
+
+$(eval $(call gb_CppunitTest_use_libraries,ucb_webdav_neon_opts, \
+ comphelper \
+ cppu \
+ cppuhelper \
+ sal \
+ salhelper \
+ test \
+ ucbhelper \
+))
+
+$(eval $(call gb_CppunitTest_use_library_objects,ucb_webdav_neon_opts, \
+ ucpdav1 \
+))
+
+$(eval $(call gb_CppunitTest_use_externals,ucb_webdav_neon_opts,\
+ boost_headers \
+ libxml2 \
+ neon \
+ openssl \
+))
+
+$(eval $(call gb_CppunitTest_use_custom_headers,ucb_webdav_neon_opts,\
+ officecfg/registry \
+))
+
+$(eval $(call gb_CppunitTest_add_exception_objects,ucb_webdav_neon_opts, \
+ ucb/qa/cppunit/webdav/webdav_options \
+))
+
+$(eval $(call gb_CppunitTest_set_include,ucb_webdav_neon_opts,\
+ $$(INCLUDE) \
+ -I$(SRCDIR)/ucb/source/ucp/webdav-neon \
+))
+
+$(eval $(call gb_CppunitTest_use_static_libraries,ucb_webdav_neon_opts))
+
+# vim: set noet sw=4 ts=4:
diff --git a/ucb/Library_ucpdav1.mk b/ucb/Library_ucpdav1.mk
index 37f3c8f..02e3681 100644
--- a/ucb/Library_ucpdav1.mk
+++ b/ucb/Library_ucpdav1.mk
@@ -43,6 +43,7 @@ $(eval $(call gb_Library_add_exception_objects,ucpdav1,\
ucb/source/ucp/webdav-neon/DAVProperties \
ucb/source/ucp/webdav-neon/DAVResourceAccess \
ucb/source/ucp/webdav-neon/DAVSessionFactory \
+ ucb/source/ucp/webdav-neon/DAVTypes \
ucb/source/ucp/webdav-neon/LinkSequence \
ucb/source/ucp/webdav-neon/LockEntrySequence \
ucb/source/ucp/webdav-neon/LockSequence \
diff --git a/ucb/Module_ucb.mk b/ucb/Module_ucb.mk
index a69b937..e14c524 100644
--- a/ucb/Module_ucb.mk
+++ b/ucb/Module_ucb.mk
@@ -35,6 +35,7 @@ ifeq ($(WITH_WEBDAV),neon)
$(eval $(call gb_Module_add_check_targets,ucb,\
CppunitTest_ucb_webdav_local_neon \
+ CppunitTest_ucb_webdav_neon_opts \
))
endif
diff --git a/ucb/qa/cppunit/webdav/webdav_options.cxx b/ucb/qa/cppunit/webdav/webdav_options.cxx
new file mode 100644
index 0000000..dd7ad24
--- /dev/null
+++ b/ucb/qa/cppunit/webdav/webdav_options.cxx
@@ -0,0 +1,255 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#include <test/bootstrapfixture.hxx>
+#include <cppunit/plugin/TestPlugIn.h>
+#include "DAVTypes.hxx"
+
+
+namespace
+{
+
+ class webdav_opts_test: public test::BootstrapFixture
+ {
+
+ public:
+ webdav_opts_test() : BootstrapFixture( true, true ) {}
+
+ // initialise your test code values here.
+ void setUp( ) override;
+
+ void tearDown( ) override;
+
+ void DAVTypesCheckReset( webdav_ucp::DAVOptions aDavType );
+ void DAVTypesTest();
+
+ // 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_opts_test );
+ CPPUNIT_TEST( DAVTypesTest );
+ CPPUNIT_TEST_SUITE_END();
+ }; // class webdav_local_test
+
+ // initialise your test code values here.
+ void webdav_opts_test::setUp()
+ {
+ }
+
+ void webdav_opts_test::tearDown()
+ {
+ }
+
+ void webdav_opts_test::DAVTypesCheckReset( webdav_ucp::DAVOptions aDavType )
+ {
+ // check if the class is at reset state
+ // using accessors
+ CPPUNIT_ASSERT_EQUAL( false, aDavType.isResourceFound() );
+ CPPUNIT_ASSERT_EQUAL( false, aDavType.isClass1() );
+ CPPUNIT_ASSERT_EQUAL( false, aDavType.isClass2() );
+ CPPUNIT_ASSERT_EQUAL( false, aDavType.isClass3() );
+ CPPUNIT_ASSERT_EQUAL( true, aDavType.getAllowedMethods().isEmpty() );
+ CPPUNIT_ASSERT_EQUAL( false, aDavType.isLockAllowed() );
+ CPPUNIT_ASSERT_EQUAL( true, aDavType.getURL().isEmpty() );
+ CPPUNIT_ASSERT_EQUAL( true, aDavType.getRedirectedURL().isEmpty() );
+ CPPUNIT_ASSERT_EQUAL( sal_uInt32( 0 ), aDavType.getStaleTime() );
+ }
+
+ void webdav_opts_test::DAVTypesTest()
+ {
+ //our DAVOptions
+ webdav_ucp::DAVOptions aDavOpt;
+ DAVTypesCheckReset( aDavOpt );
+ aDavOpt.setResourceFound();
+ //recheck...
+ CPPUNIT_ASSERT_EQUAL( true, aDavOpt.isResourceFound() );
+ CPPUNIT_ASSERT_EQUAL( false, aDavOpt.isClass1() );
+ CPPUNIT_ASSERT_EQUAL( false, aDavOpt.isClass2() );
+ CPPUNIT_ASSERT_EQUAL( false, aDavOpt.isClass3() );
+ CPPUNIT_ASSERT_EQUAL( true, aDavOpt.getAllowedMethods().isEmpty() );
+ CPPUNIT_ASSERT_EQUAL( false, aDavOpt.isLockAllowed() );
+ CPPUNIT_ASSERT_EQUAL( true, aDavOpt.getURL().isEmpty() );
+ CPPUNIT_ASSERT_EQUAL( true, aDavOpt.getRedirectedURL().isEmpty() );
+ CPPUNIT_ASSERT_EQUAL( sal_uInt32( 0 ), aDavOpt.getStaleTime() );
+
+ aDavOpt.setResourceFound( false );
+ aDavOpt.setClass1();
+ CPPUNIT_ASSERT_EQUAL( false, aDavOpt.isResourceFound() );
+ CPPUNIT_ASSERT_EQUAL( true, aDavOpt.isClass1() );
+ CPPUNIT_ASSERT_EQUAL( false, aDavOpt.isClass2() );
+ CPPUNIT_ASSERT_EQUAL( false, aDavOpt.isClass3() );
+ CPPUNIT_ASSERT_EQUAL( true, aDavOpt.getAllowedMethods().isEmpty() );
+ CPPUNIT_ASSERT_EQUAL( false, aDavOpt.isLockAllowed() );
+ CPPUNIT_ASSERT_EQUAL( true, aDavOpt.getURL().isEmpty() );
+ CPPUNIT_ASSERT_EQUAL( true, aDavOpt.getRedirectedURL().isEmpty() );
+ CPPUNIT_ASSERT_EQUAL( sal_uInt32( 0 ), aDavOpt.getStaleTime() );
+
+ aDavOpt.setClass1( false );
+ aDavOpt.setClass2();
+ CPPUNIT_ASSERT_EQUAL( false, aDavOpt.isResourceFound() );
+ CPPUNIT_ASSERT_EQUAL( false, aDavOpt.isClass1() );
+ CPPUNIT_ASSERT_EQUAL( true, aDavOpt.isClass2() );
+ CPPUNIT_ASSERT_EQUAL( false, aDavOpt.isClass3() );
+ CPPUNIT_ASSERT_EQUAL( true, aDavOpt.getAllowedMethods().isEmpty() );
+ CPPUNIT_ASSERT_EQUAL( false, aDavOpt.isLockAllowed() );
+
+ aDavOpt.setClass2( false );
+ aDavOpt.setClass3();
+ CPPUNIT_ASSERT_EQUAL( false, aDavOpt.isResourceFound() );
+ CPPUNIT_ASSERT_EQUAL( false, aDavOpt.isClass1() );
+ CPPUNIT_ASSERT_EQUAL( false, aDavOpt.isClass2() );
+ CPPUNIT_ASSERT_EQUAL( true, aDavOpt.isClass3() );
+ CPPUNIT_ASSERT_EQUAL( true, aDavOpt.getAllowedMethods().isEmpty() );
+ CPPUNIT_ASSERT_EQUAL( false, aDavOpt.isLockAllowed() );
+ CPPUNIT_ASSERT_EQUAL( true, aDavOpt.getURL().isEmpty() );
+ CPPUNIT_ASSERT_EQUAL( true, aDavOpt.getRedirectedURL().isEmpty() );
+ CPPUNIT_ASSERT_EQUAL( sal_uInt32( 0 ), aDavOpt.getStaleTime() );
+
+ aDavOpt.setClass3( false );
+
+ CPPUNIT_ASSERT_EQUAL( false, aDavOpt.isResourceFound() );
+ CPPUNIT_ASSERT_EQUAL( false, aDavOpt.isClass1() );
+ CPPUNIT_ASSERT_EQUAL( false, aDavOpt.isClass2() );
+ CPPUNIT_ASSERT_EQUAL( false, aDavOpt.isClass3() );
+ CPPUNIT_ASSERT_EQUAL( true, aDavOpt.getAllowedMethods().isEmpty() );
+ CPPUNIT_ASSERT_EQUAL( false, aDavOpt.isLockAllowed() );
+ CPPUNIT_ASSERT_EQUAL( true, aDavOpt.getURL().isEmpty() );
+ CPPUNIT_ASSERT_EQUAL( true, aDavOpt.getRedirectedURL().isEmpty() );
+ CPPUNIT_ASSERT_EQUAL( sal_uInt32( 0 ), aDavOpt.getStaleTime() );
+
+ DAVTypesCheckReset( aDavOpt );
+ //example of allowed method for a Web resource
+ OUString aAllowedMethods = "POST,OPTIONS,GET,HEAD,TRACE";
+ aDavOpt.setAllowedMethods( aAllowedMethods );
+ // now check...
+ CPPUNIT_ASSERT_EQUAL( false, aDavOpt.isResourceFound() );
+ CPPUNIT_ASSERT_EQUAL( false, aDavOpt.isClass1() );
+ CPPUNIT_ASSERT_EQUAL( false, aDavOpt.isClass2() );
+ CPPUNIT_ASSERT_EQUAL( false, aDavOpt.isClass3() );
+ CPPUNIT_ASSERT_EQUAL( aAllowedMethods, aDavOpt.getAllowedMethods() );
+ CPPUNIT_ASSERT_EQUAL( false, aDavOpt.isLockAllowed() );
+ CPPUNIT_ASSERT_EQUAL( true, aDavOpt.getURL().isEmpty() );
+ CPPUNIT_ASSERT_EQUAL( true, aDavOpt.getRedirectedURL().isEmpty() );
+ CPPUNIT_ASSERT_EQUAL( sal_uInt32( 0 ), aDavOpt.getStaleTime() );
+
+ //example of allowed method for a WebDAV resource supporting LOCK
+ aAllowedMethods = "OPTIONS,GET,HEAD,POST,DELETE,TRACE,PROPFIND,PROPPATCH,COPY,MOVE,PUT,LOCK,UNLOCK";
+ aDavOpt.setAllowedMethods( aAllowedMethods );
+ // now check...
+ CPPUNIT_ASSERT_EQUAL( false, aDavOpt.isResourceFound() );
+ CPPUNIT_ASSERT_EQUAL( false, aDavOpt.isClass1() );
+ CPPUNIT_ASSERT_EQUAL( false, aDavOpt.isClass2() );
+ CPPUNIT_ASSERT_EQUAL( false, aDavOpt.isClass3() );
+ CPPUNIT_ASSERT_EQUAL( aAllowedMethods, aDavOpt.getAllowedMethods() );
+ CPPUNIT_ASSERT_EQUAL( true, aDavOpt.isLockAllowed() );
+ CPPUNIT_ASSERT_EQUAL( true, aDavOpt.getURL().isEmpty() );
+ CPPUNIT_ASSERT_EQUAL( true, aDavOpt.getRedirectedURL().isEmpty() );
+ CPPUNIT_ASSERT_EQUAL( sal_uInt32( 0 ), aDavOpt.getStaleTime() );
+
+ aAllowedMethods.clear();
+ aDavOpt.setAllowedMethods( aAllowedMethods );
+ aDavOpt.setStaleTime( 12345678 );
+ CPPUNIT_ASSERT_EQUAL( false, aDavOpt.isResourceFound() );
+ CPPUNIT_ASSERT_EQUAL( false, aDavOpt.isClass1() );
+ CPPUNIT_ASSERT_EQUAL( false, aDavOpt.isClass2() );
+ CPPUNIT_ASSERT_EQUAL( false, aDavOpt.isClass3() );
+ CPPUNIT_ASSERT_EQUAL( true, aDavOpt.getAllowedMethods().isEmpty() );
+ CPPUNIT_ASSERT_EQUAL( false, aDavOpt.isLockAllowed() );
+ CPPUNIT_ASSERT_EQUAL( true , aDavOpt.getURL().isEmpty() );
+ CPPUNIT_ASSERT_EQUAL( true, aDavOpt.getRedirectedURL().isEmpty() );
+ CPPUNIT_ASSERT_EQUAL( sal_uInt32( 12345678 ), aDavOpt.getStaleTime() );
+
+ aDavOpt.setStaleTime( 0 );
+
+ OUString aURL = "http://a%20fake%20url/to%20test";
+ aDavOpt.setURL( aURL );
+ CPPUNIT_ASSERT_EQUAL( false, aDavOpt.isResourceFound() );
+ CPPUNIT_ASSERT_EQUAL( false, aDavOpt.isClass1() );
+ CPPUNIT_ASSERT_EQUAL( false, aDavOpt.isClass2() );
+ CPPUNIT_ASSERT_EQUAL( false, aDavOpt.isClass3() );
+ CPPUNIT_ASSERT_EQUAL( true, aDavOpt.getAllowedMethods().isEmpty() );
+ CPPUNIT_ASSERT_EQUAL( false, aDavOpt.isLockAllowed() );
+ CPPUNIT_ASSERT_EQUAL( aURL , aDavOpt.getURL() );
+ CPPUNIT_ASSERT_EQUAL( true, aDavOpt.getRedirectedURL().isEmpty() );
+ CPPUNIT_ASSERT_EQUAL( sal_uInt32( 0 ), aDavOpt.getStaleTime() );
+
+ aURL.clear();
+ aDavOpt.setURL( aURL );
+ aURL = "http://a%20fake%20url/to%20test/another-url";
+ aDavOpt.setRedirectedURL( aURL );
+ CPPUNIT_ASSERT_EQUAL( false, aDavOpt.isResourceFound() );
+ CPPUNIT_ASSERT_EQUAL( false, aDavOpt.isClass1() );
+ CPPUNIT_ASSERT_EQUAL( false, aDavOpt.isClass2() );
+ CPPUNIT_ASSERT_EQUAL( false, aDavOpt.isClass3() );
+ CPPUNIT_ASSERT_EQUAL( true, aDavOpt.getAllowedMethods().isEmpty() );
+ CPPUNIT_ASSERT_EQUAL( false, aDavOpt.isLockAllowed() );
+ CPPUNIT_ASSERT_EQUAL( true, aDavOpt.getURL().isEmpty() );
+ CPPUNIT_ASSERT_EQUAL( aURL, aDavOpt.getRedirectedURL() );
+ CPPUNIT_ASSERT_EQUAL( sal_uInt32( 0 ), aDavOpt.getStaleTime() );
+
+ //check the reset function
+ aAllowedMethods = "OPTIONS,GET,HEAD,POST,DELETE,TRACE,PROPFIND,PROPPATCH,COPY,MOVE,PUT,LOCK,UNLOCK";
+ aURL = "http://a%20fake%20url/to%20test/another-url";
+ aDavOpt.setResourceFound();
+ aDavOpt.setClass1();
+ aDavOpt.setClass2();
+ aDavOpt.setClass3();
+ aDavOpt.setAllowedMethods( aAllowedMethods );
+ aDavOpt.setStaleTime( 1234567 );
+ aDavOpt.setURL( aURL );
+ aDavOpt.setRedirectedURL( aURL );
+
+ aDavOpt.reset();
+ DAVTypesCheckReset( aDavOpt );
+ // equality check
+ webdav_ucp::DAVOptions aDavOptTarget;
+ CPPUNIT_ASSERT_EQUAL( true , aDavOpt == aDavOptTarget );
+
+ aDavOpt.setClass1();
+ CPPUNIT_ASSERT_EQUAL( false , aDavOpt == aDavOptTarget );
+ aDavOpt.setClass1( false );
+ CPPUNIT_ASSERT_EQUAL( true , aDavOpt == aDavOptTarget );
+
+ aDavOpt.setClass2();
+ CPPUNIT_ASSERT_EQUAL( false , aDavOpt == aDavOptTarget );
+ aDavOpt.setClass2( false );
+ CPPUNIT_ASSERT_EQUAL( true , aDavOpt == aDavOptTarget );
+
+ aDavOpt.setClass3();
+ CPPUNIT_ASSERT_EQUAL( false , aDavOpt == aDavOptTarget );
+ aDavOpt.setClass3( false );
+ CPPUNIT_ASSERT_EQUAL( true , aDavOpt == aDavOptTarget );
+
+ aDavOpt.setResourceFound();
+ CPPUNIT_ASSERT_EQUAL( false , aDavOpt == aDavOptTarget );
+ aDavOpt.setResourceFound( false );
+ CPPUNIT_ASSERT_EQUAL( true , aDavOpt == aDavOptTarget );
+
+ aDavOpt.setStaleTime( 1234567 );
+ CPPUNIT_ASSERT_EQUAL( false , aDavOpt == aDavOptTarget );
+ aDavOpt.setStaleTime( 0 );
+ CPPUNIT_ASSERT_EQUAL( true , aDavOpt == aDavOptTarget );
+
+ aDavOpt.setAllowedMethods( aAllowedMethods );
+ CPPUNIT_ASSERT_EQUAL( false , aDavOpt == aDavOptTarget );
+ aAllowedMethods.clear();
+ aDavOpt.setAllowedMethods( aAllowedMethods );
+ CPPUNIT_ASSERT_EQUAL( true , aDavOpt == aDavOptTarget );
+
+ aDavOpt.setURL( aURL );
+ CPPUNIT_ASSERT_EQUAL( false , aDavOpt == aDavOptTarget );
+ }
+
+ CPPUNIT_TEST_SUITE_REGISTRATION( webdav_opts_test );
+} // namespace rtl_random
+
+CPPUNIT_PLUGIN_IMPLEMENT();
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/ucb/source/ucp/webdav-neon/DAVTypes.cxx b/ucb/source/ucp/webdav-neon/DAVTypes.cxx
new file mode 100644
index 0000000..1fbf84d
--- /dev/null
+++ b/ucb/source/ucp/webdav-neon/DAVTypes.cxx
@@ -0,0 +1,67 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+
+#include "osl/time.h"
+
+#include "DAVTypes.hxx"
+#include "../inc/urihelper.hxx"
+#include "NeonUri.hxx"
+
+using namespace webdav_ucp;
+using namespace com::sun::star;
+
+// DAVCapabilities implementation
+
+DAVOptions::DAVOptions() :
+ m_isResourceFound( false ),
+ m_isClass1( false ),
+ m_isClass2( false ),
+ m_isClass3( false ),
+ m_aAllowedMethods(),
+ m_nStaleTime( 0 ),
+ m_sURL(),
+ m_sRedirectedURL()
+{
+}
+
+
+DAVOptions::DAVOptions( const DAVOptions & rOther ) :
+ m_isResourceFound( rOther.m_isResourceFound ),
+ m_isClass1( rOther.m_isClass1 ),
+ m_isClass2( rOther.m_isClass2 ),
+ m_isClass3( rOther.m_isClass3 ),
+ m_aAllowedMethods( rOther.m_aAllowedMethods ),
+ m_nStaleTime( rOther.m_nStaleTime ),
+ m_sURL( rOther.m_sURL ),
+ m_sRedirectedURL( rOther.m_sRedirectedURL)
+{
+}
+
+
+DAVOptions::~DAVOptions()
+{
+}
+
+
+bool DAVOptions::operator==( const DAVOptions& rOpts ) const
+{
+ return
+ m_isResourceFound == rOpts.m_isResourceFound &&
+ m_isClass1 == rOpts.m_isClass1 &&
+ m_isClass2 == rOpts.m_isClass2 &&
+ m_isClass3 == rOpts.m_isClass3 &&
+ m_aAllowedMethods == rOpts.m_aAllowedMethods &&
+ m_nStaleTime == rOpts.m_nStaleTime &&
+ m_sURL == rOpts.m_sURL &&
+ m_sRedirectedURL == rOpts.m_sRedirectedURL;
+}
+
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
diff --git a/ucb/source/ucp/webdav-neon/DAVTypes.hxx b/ucb/source/ucp/webdav-neon/DAVTypes.hxx
index 6ee993a..b149987 100644
--- a/ucb/source/ucp/webdav-neon/DAVTypes.hxx
+++ b/ucb/source/ucp/webdav-neon/DAVTypes.hxx
@@ -30,28 +30,128 @@
#define INCLUDED_UCB_SOURCE_UCP_WEBDAV_NEON_DAVTYPES_HXX
#include <config_lgpl.h>
+#include <memory>
+#include <list>
+#include <map>
+#include "osl/mutex.hxx"
+#include <rtl/uri.hxx>
#include <rtl/ustring.hxx>
#include <com/sun/star/uno/Any.hxx>
namespace webdav_ucp
{
+/* Excerpt from RFC 4918
+ <https://tools.ietf.org/html/rfc4918#section-18>
-enum Depth { DAVZERO = 0, DAVONE = 1, DAVINFINITY = -1 };
+ 18.1 Class 1
-enum ProppatchOperation { PROPSET = 0, PROPREMOVE = 1 };
+ A class 1 compliant resource MUST meet all "MUST" requirements in all
+ sections of this document.
-struct ProppatchValue
-{
- ProppatchOperation operation;
- OUString name;
- css::uno::Any value;
+ Class 1 compliant resources MUST return, at minimum, the value "1" in
+ the DAV header on all responses to the OPTIONS method.
+
+ 18.2 Class 2
+
+ A class 2 compliant resource MUST meet all class 1 requirements and
+ support the LOCK method, the DAV:supportedlock property, the DAV:
+ lockdiscovery property, the Time-Out response header and the Lock-
+ Token request header. A class 2 compliant resource SHOULD also
+ support the Timeout request header and the 'owner' XML element.
+
+ Class 2 compliant resources MUST return, at minimum, the values "1"
+ and "2" in the DAV header on all responses to the OPTIONS method.
+
+ 18.3. Class 3
+
+ A resource can explicitly advertise its support for the revisions to
+ [RFC2518] made in this document. Class 1 MUST be supported as well.
+ Class 2 MAY be supported. Advertising class 3 support in addition to
+ class 1 and 2 means that the server supports all the requirements in
+ this specification. Advertising class 3 and class 1 support, but not
+ class 2, means that the server supports all the requirements in this
+ specification except possibly those that involve locking support.
+
+*/
+
+ class DAVOptions
+ {
+ private:
+ bool m_isResourceFound; // true if the resource was found, else false
+ bool m_isClass1;
+ bool m_isClass2;
+ bool m_isClass3;
+ // contains the methods allowed on this resource
+ OUString m_aAllowedMethods;
+
+ /// target time when this capability becomes stale
+ sal_uInt32 m_nStaleTime;
+ OUString m_sURL;
+ OUString m_sRedirectedURL;
+
+ public:
+ DAVOptions();
+
+ DAVOptions( const DAVOptions & rOther );
+
+ virtual ~DAVOptions();
+
+ bool isResourceFound() { return m_isResourceFound; };
+ void setResourceFound( bool ResourceFound = true ) { m_isResourceFound = ResourceFound; };
+
+ bool isClass1() { return m_isClass1; };
+ void setClass1( bool Class1 = true ) { m_isClass1 = Class1; };
+
+ bool isClass2() { return m_isClass2; };
+ void setClass2( bool Class2 = true ) { m_isClass2 = Class2; };
+
+ bool isClass3() { return m_isClass3; };
+ void setClass3( bool Class3 = true ) { m_isClass3 = Class3; };
+
+ sal_uInt32 getStaleTime() { return m_nStaleTime ; };
+ void setStaleTime( sal_uInt32 nStaleTime ) { m_nStaleTime = nStaleTime; };
+
+ OUString & getURL() { return m_sURL; };
+ void setURL( OUString & sURL ) { m_sURL = sURL; };
+
+ OUString & getRedirectedURL() { return m_sRedirectedURL; };
+ void setRedirectedURL( OUString & sRedirectedURL ) { m_sRedirectedURL = sRedirectedURL; };
+
+ void setAllowedMethods( OUString & aAllowedMethods ) { m_aAllowedMethods = aAllowedMethods; } ;
+ OUString & getAllowedMethods() { return m_aAllowedMethods; } ;
+ bool isLockAllowed() { return ( m_aAllowedMethods.indexOf( "LOCK" ) != -1 ); };
+ bool isUnlockAllowed() { return ( m_aAllowedMethods.indexOf( "UNLOCK" ) != -1 ); };
+
+ void reset() {
+ m_isResourceFound = false;
+ m_isClass1 = false;
+ m_isClass2 = false;
+ m_isClass3 = false;
+ m_aAllowedMethods.clear();
+ m_nStaleTime = 0;
+ m_sURL.clear();
+ m_sRedirectedURL.clear();
+ };
+
+ bool operator==( const DAVOptions& rOpts ) const;
+
+ };
+
+ enum Depth { DAVZERO = 0, DAVONE = 1, DAVINFINITY = -1 };
+
+ enum ProppatchOperation { PROPSET = 0, PROPREMOVE = 1 };
- ProppatchValue( const ProppatchOperation o,
- const OUString & n,
- const css::uno::Any & v )
- : operation( o ), name( n ), value( v ) {}
-};
+ struct ProppatchValue
+ {
+ ProppatchOperation operation;
+ OUString name;
+ css::uno::Any value;
+ ProppatchValue( const ProppatchOperation o,
+ const OUString & n,
+ const css::uno::Any & v )
+ : operation( o ), name( n ), value( v ) {}
+ };
} // namespace webdav_ucp
#endif // INCLUDED_UCB_SOURCE_UCP_WEBDAV_NEON_DAVTYPES_HXX
More information about the Libreoffice-commits
mailing list