summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGiuseppe Castagno <giuseppe.castagno@acca-esse.eu>2016-10-01 12:35:57 +0200
committerGiuseppe Castagno <giuseppe.castagno@acca-esse.eu>2016-10-01 13:00:13 +0000
commitd751af3f84909996d44b9354ce9ed34891d374e1 (patch)
treef7694459bd338eb898958160aae05011f8c67f48
parent32c29f79cb976f8b04eb635857ef3b8eecde443e (diff)
tdf#101094 (34): Fix test and missing field value in comparision operator
Change-Id: I6be4a7861f2a978c260defd54dcbc8d124017439 Reviewed-on: https://gerrit.libreoffice.org/29431 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Giuseppe Castagno <giuseppe.castagno@acca-esse.eu>
-rw-r--r--ucb/qa/cppunit/webdav/webdav_options.cxx78
-rw-r--r--ucb/source/ucp/webdav-neon/DAVTypes.cxx1
-rw-r--r--ucb/source/ucp/webdav-neon/DAVTypes.hxx24
-rw-r--r--ucb/source/ucp/webdav-neon/NeonSession.cxx2
4 files changed, 63 insertions, 42 deletions
diff --git a/ucb/qa/cppunit/webdav/webdav_options.cxx b/ucb/qa/cppunit/webdav/webdav_options.cxx
index 924eaf9a142d..371873354743 100644
--- a/ucb/qa/cppunit/webdav/webdav_options.cxx
+++ b/ucb/qa/cppunit/webdav/webdav_options.cxx
@@ -27,7 +27,7 @@ namespace
void tearDown( ) override;
- void DAVTypesCheckReset( webdav_ucp::DAVOptions aDavType );
+ void DAVTypesCheckInit( webdav_ucp::DAVOptions aDavType );
void DAVTypesTest();
void DAVOptsCacheTests();
@@ -51,7 +51,7 @@ namespace
{
}
- void webdav_opts_test::DAVTypesCheckReset( webdav_ucp::DAVOptions aDavType )
+ void webdav_opts_test::DAVTypesCheckInit( webdav_ucp::DAVOptions aDavType )
{
// check if the class is at reset state
// using accessors
@@ -60,6 +60,7 @@ namespace
CPPUNIT_ASSERT_EQUAL( false, aDavType.isClass2() );
CPPUNIT_ASSERT_EQUAL( false, aDavType.isClass3() );
CPPUNIT_ASSERT_EQUAL( false, aDavType.isLocked() );
+ CPPUNIT_ASSERT_EQUAL( true, aDavType.isHeadAllowed() );
CPPUNIT_ASSERT_EQUAL( true, aDavType.getAllowedMethods().isEmpty() );
CPPUNIT_ASSERT_EQUAL( false, aDavType.isLockAllowed() );
CPPUNIT_ASSERT_EQUAL( true, aDavType.getURL().isEmpty() );
@@ -71,18 +72,19 @@ namespace
{
//our DAVOptions
webdav_ucp::DAVOptions aDavOpt;
- DAVTypesCheckReset( aDavOpt );
+ DAVTypesCheckInit( 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( true, aDavOpt.isHeadAllowed() );
CPPUNIT_ASSERT_EQUAL( false, aDavOpt.isLockAllowed() );
+ CPPUNIT_ASSERT_EQUAL( true, aDavOpt.getAllowedMethods().isEmpty() );
+ CPPUNIT_ASSERT_EQUAL( sal_uInt32( 0 ), aDavOpt.getStaleTime() );
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();
@@ -90,11 +92,12 @@ namespace
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( true, aDavOpt.isHeadAllowed() );
CPPUNIT_ASSERT_EQUAL( false, aDavOpt.isLockAllowed() );
+ CPPUNIT_ASSERT_EQUAL( true, aDavOpt.getAllowedMethods().isEmpty() );
+ CPPUNIT_ASSERT_EQUAL( sal_uInt32( 0 ), aDavOpt.getStaleTime() );
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();
@@ -102,8 +105,12 @@ namespace
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( true, aDavOpt.isHeadAllowed() );
CPPUNIT_ASSERT_EQUAL( false, aDavOpt.isLockAllowed() );
+ CPPUNIT_ASSERT_EQUAL( true, aDavOpt.getAllowedMethods().isEmpty() );
+ CPPUNIT_ASSERT_EQUAL( sal_uInt32( 0 ), aDavOpt.getStaleTime() );
+ CPPUNIT_ASSERT_EQUAL( true, aDavOpt.getURL().isEmpty() );
+ CPPUNIT_ASSERT_EQUAL( true, aDavOpt.getRedirectedURL().isEmpty() );
aDavOpt.setClass2( false );
aDavOpt.setClass3();
@@ -111,11 +118,12 @@ namespace
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( true, aDavOpt.isHeadAllowed() );
CPPUNIT_ASSERT_EQUAL( false, aDavOpt.isLockAllowed() );
+ CPPUNIT_ASSERT_EQUAL( true, aDavOpt.getAllowedMethods().isEmpty() );
+ CPPUNIT_ASSERT_EQUAL( sal_uInt32( 0 ), aDavOpt.getStaleTime() );
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 );
@@ -123,13 +131,14 @@ namespace
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( true, aDavOpt.isHeadAllowed() );
CPPUNIT_ASSERT_EQUAL( false, aDavOpt.isLockAllowed() );
+ CPPUNIT_ASSERT_EQUAL( true, aDavOpt.getAllowedMethods().isEmpty() );
+ CPPUNIT_ASSERT_EQUAL( sal_uInt32( 0 ), aDavOpt.getStaleTime() );
CPPUNIT_ASSERT_EQUAL( true, aDavOpt.getURL().isEmpty() );
CPPUNIT_ASSERT_EQUAL( true, aDavOpt.getRedirectedURL().isEmpty() );
- CPPUNIT_ASSERT_EQUAL( sal_uInt32( 0 ), aDavOpt.getStaleTime() );
- DAVTypesCheckReset( aDavOpt );
+ DAVTypesCheckInit( aDavOpt );
//example of allowed method for a Web resource
OUString aAllowedMethods = "POST,OPTIONS,GET,HEAD,TRACE";
aDavOpt.setAllowedMethods( aAllowedMethods );
@@ -138,11 +147,12 @@ namespace
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.isHeadAllowed() );
CPPUNIT_ASSERT_EQUAL( false, aDavOpt.isLockAllowed() );
+ CPPUNIT_ASSERT_EQUAL( aAllowedMethods, aDavOpt.getAllowedMethods() );
+ CPPUNIT_ASSERT_EQUAL( sal_uInt32( 0 ), aDavOpt.getStaleTime() );
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";
@@ -152,11 +162,12 @@ namespace
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.isHeadAllowed() );
CPPUNIT_ASSERT_EQUAL( true, aDavOpt.isLockAllowed() );
+ CPPUNIT_ASSERT_EQUAL( aAllowedMethods, aDavOpt.getAllowedMethods() );
+ CPPUNIT_ASSERT_EQUAL( sal_uInt32( 0 ), aDavOpt.getStaleTime() );
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 );
@@ -165,11 +176,12 @@ namespace
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( true, aDavOpt.isHeadAllowed() );
CPPUNIT_ASSERT_EQUAL( false, aDavOpt.isLockAllowed() );
- CPPUNIT_ASSERT_EQUAL( true , aDavOpt.getURL().isEmpty() );
- CPPUNIT_ASSERT_EQUAL( true, aDavOpt.getRedirectedURL().isEmpty() );
+ CPPUNIT_ASSERT_EQUAL( true, aDavOpt.getAllowedMethods().isEmpty() );
CPPUNIT_ASSERT_EQUAL( sal_uInt32( 12345678 ), aDavOpt.getStaleTime() );
+ CPPUNIT_ASSERT_EQUAL( true, aDavOpt.getURL().isEmpty() );
+ CPPUNIT_ASSERT_EQUAL( true, aDavOpt.getRedirectedURL().isEmpty() );
aDavOpt.setStaleTime( 0 );
@@ -179,11 +191,12 @@ namespace
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( true, aDavOpt.isHeadAllowed() );
CPPUNIT_ASSERT_EQUAL( false, aDavOpt.isLockAllowed() );
- CPPUNIT_ASSERT_EQUAL( aURL , aDavOpt.getURL() );
- CPPUNIT_ASSERT_EQUAL( true, aDavOpt.getRedirectedURL().isEmpty() );
+ CPPUNIT_ASSERT_EQUAL( true, aDavOpt.getAllowedMethods().isEmpty() );
CPPUNIT_ASSERT_EQUAL( sal_uInt32( 0 ), aDavOpt.getStaleTime() );
+ CPPUNIT_ASSERT_EQUAL( aURL, aDavOpt.getURL() );
+ CPPUNIT_ASSERT_EQUAL( true, aDavOpt.getRedirectedURL().isEmpty() );
aURL.clear();
aDavOpt.setURL( aURL );
@@ -193,28 +206,29 @@ namespace
CPPUNIT_ASSERT_EQUAL( false, aDavOpt.isClass1() );
CPPUNIT_ASSERT_EQUAL( false, aDavOpt.isClass2() );
CPPUNIT_ASSERT_EQUAL( false, aDavOpt.isClass3() );
- CPPUNIT_ASSERT_EQUAL( false, aDavOpt.isLocked() );
- CPPUNIT_ASSERT_EQUAL( true, aDavOpt.getAllowedMethods().isEmpty() );
+ CPPUNIT_ASSERT_EQUAL( true, aDavOpt.isHeadAllowed() );
CPPUNIT_ASSERT_EQUAL( false, aDavOpt.isLockAllowed() );
+ CPPUNIT_ASSERT_EQUAL( true, aDavOpt.getAllowedMethods().isEmpty() );
+ CPPUNIT_ASSERT_EQUAL( sal_uInt32( 0 ), aDavOpt.getStaleTime() );
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
+ //check the init() 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.setHeadAllowed( false );
aDavOpt.setLocked();
aDavOpt.setAllowedMethods( aAllowedMethods );
aDavOpt.setStaleTime( 1234567 );
aDavOpt.setURL( aURL );
aDavOpt.setRedirectedURL( aURL );
- aDavOpt.reset();
- DAVTypesCheckReset( aDavOpt );
+ aDavOpt.init();
+ DAVTypesCheckInit( aDavOpt );
// equality check
webdav_ucp::DAVOptions aDavOptTarget;
CPPUNIT_ASSERT_EQUAL( true , aDavOpt == aDavOptTarget );
@@ -234,6 +248,11 @@ namespace
aDavOpt.setClass3( false );
CPPUNIT_ASSERT_EQUAL( true , aDavOpt == aDavOptTarget );
+ aDavOpt.setHeadAllowed( false );
+ CPPUNIT_ASSERT_EQUAL( false , aDavOpt == aDavOptTarget );
+ aDavOpt.setHeadAllowed();
+ CPPUNIT_ASSERT_EQUAL( true , aDavOpt == aDavOptTarget );
+
aDavOpt.setLocked();
CPPUNIT_ASSERT_EQUAL( false , aDavOpt == aDavOptTarget );
aDavOpt.setLocked( false );
@@ -277,6 +296,7 @@ namespace
aDavOpt.setClass1();
aDavOpt.setClass2();
aDavOpt.setClass3();
+ aDavOpt.setHeadAllowed( false );
aDavOpt.setAllowedMethods( aAllowedMethods );
// add to cache
aDAVOptsCache.addDAVOptions( aDavOpt, 30000 );
diff --git a/ucb/source/ucp/webdav-neon/DAVTypes.cxx b/ucb/source/ucp/webdav-neon/DAVTypes.cxx
index 875699418f2c..bd723e53249f 100644
--- a/ucb/source/ucp/webdav-neon/DAVTypes.cxx
+++ b/ucb/source/ucp/webdav-neon/DAVTypes.cxx
@@ -62,6 +62,7 @@ bool DAVOptions::operator==( const DAVOptions& rOpts ) const
m_isClass2 == rOpts.m_isClass2 &&
m_isClass3 == rOpts.m_isClass3 &&
m_isLocked == rOpts.m_isLocked &&
+ m_isHeadAllowed == rOpts.m_isHeadAllowed &&
m_aAllowedMethods == rOpts.m_aAllowedMethods &&
m_nStaleTime == rOpts.m_nStaleTime &&
m_sURL == rOpts.m_sURL &&
diff --git a/ucb/source/ucp/webdav-neon/DAVTypes.hxx b/ucb/source/ucp/webdav-neon/DAVTypes.hxx
index 9d4acd1a41fb..5721619b6360 100644
--- a/ucb/source/ucp/webdav-neon/DAVTypes.hxx
+++ b/ucb/source/ucp/webdav-neon/DAVTypes.hxx
@@ -101,13 +101,13 @@ namespace webdav_ucp
virtual ~DAVOptions();
- bool isResourceFound() const { return m_isResourceFound; };
+ bool isResourceFound() { return m_isResourceFound; };
void setResourceFound( bool ResourceFound = true ) { m_isResourceFound = ResourceFound; };
- bool isClass1() const { return m_isClass1; };
+ bool isClass1() { return m_isClass1; };
void setClass1( bool Class1 = true ) { m_isClass1 = Class1; };
- bool isClass2() const { return m_isClass2; };
+ bool isClass2() { return m_isClass2; };
void setClass2( bool Class2 = true ) { m_isClass2 = Class2; };
bool isClass3() { return m_isClass3; };
@@ -119,20 +119,20 @@ namespace webdav_ucp
sal_uInt32 getStaleTime() const { return m_nStaleTime ; };
void setStaleTime( const sal_uInt32 nStaleTime ) { m_nStaleTime = nStaleTime; };
- OUString & getURL() { return m_sURL; };
- void setURL( OUString & sURL ) { m_sURL = sURL; };
+ const OUString & getURL() { return m_sURL; };
+ void setURL( const OUString & sURL ) { m_sURL = sURL; };
- OUString & getRedirectedURL() { return m_sRedirectedURL; };
- void setRedirectedURL( OUString & sRedirectedURL ) { m_sRedirectedURL = sRedirectedURL; };
+ const OUString & getRedirectedURL() { return m_sRedirectedURL; };
+ void setRedirectedURL( const OUString & sRedirectedURL ) { m_sRedirectedURL = sRedirectedURL; };
- void setAllowedMethods( OUString & aAllowedMethods ) { m_aAllowedMethods = aAllowedMethods; } ;
- OUString & getAllowedMethods() { return m_aAllowedMethods; } ;
- bool isLockAllowed() const { return ( m_aAllowedMethods.indexOf( "LOCK" ) != -1 ); };
+ void setAllowedMethods( const OUString & aAllowedMethods ) { m_aAllowedMethods = aAllowedMethods; } ;
+ const OUString & getAllowedMethods() { return m_aAllowedMethods; } ;
+ bool isLockAllowed() { return ( m_aAllowedMethods.indexOf( "LOCK" ) != -1 ); };
void setLocked( bool locked = true ) { m_isLocked = locked; } ;
- bool isLocked() const { return m_isLocked; };
+ bool isLocked() { return m_isLocked; };
- void reset() {
+ void init() {
m_isResourceFound = false;
m_isClass1 = false;
m_isClass2 = false;
diff --git a/ucb/source/ucp/webdav-neon/NeonSession.cxx b/ucb/source/ucp/webdav-neon/NeonSession.cxx
index 9c285c37d7e0..8519cb3b7ec9 100644
--- a/ucb/source/ucp/webdav-neon/NeonSession.cxx
+++ b/ucb/source/ucp/webdav-neon/NeonSession.cxx
@@ -849,7 +849,7 @@ void NeonSession::OPTIONS( const OUString & inPath,
SAL_INFO( "ucb.ucp.webdav", "OPTIONS - relative URL <" << inPath << ">" );
- rOptions.reset();
+ rOptions.init();
Init( rEnv );
int theRetVal;