[Libreoffice-commits] core.git: ucb/qa ucb/source

2021-11-26 Thread Michael Stahl (via logerrit)
 ucb/qa/cppunit/webdav/webdav_local_neon.cxx |   34 
 ucb/source/ucp/webdav-curl/CurlUri.cxx  |   39 +---
 2 files changed, 58 insertions(+), 15 deletions(-)

New commits:
commit b03e070420606d407df2ec5e9dfa7043ecc46177
Author: Michael Stahl 
AuthorDate: Fri Nov 26 16:29:08 2021 +0100
Commit: Michael Stahl 
CommitDate: Fri Nov 26 19:26:42 2021 +0100

ucb: webdav-curl: fix CurlUri::CloneWithRelativeRefPathAbsolute()

Change-Id: Idf1d75817009286cd79a00c0ba154cea70e2ffda
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/125908
Tested-by: Jenkins
Reviewed-by: Michael Stahl 

diff --git a/ucb/qa/cppunit/webdav/webdav_local_neon.cxx 
b/ucb/qa/cppunit/webdav/webdav_local_neon.cxx
index 08a384dee36b..bde7652b9ffa 100644
--- a/ucb/qa/cppunit/webdav/webdav_local_neon.cxx
+++ b/ucb/qa/cppunit/webdav/webdav_local_neon.cxx
@@ -43,6 +43,22 @@ namespace
 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=http://anotherserver.com/%3Fcheck=theapplication%26os=linuxintel%26lang=en-US%26version=5.2.0;
 ), aURI.GetRelativeReference() );
+
+CurlUri uri2(aURI.CloneWithRelativeRefPathAbsolute(u"/foo/bar"));
+CPPUNIT_ASSERT_EQUAL( OUString("http"), uri2.GetScheme() );
+CPPUNIT_ASSERT_EQUAL( OUString("server.biz"), uri2.GetHost() );
+CPPUNIT_ASSERT_EQUAL( OUString("user%40anothername"), uri2.GetUser() );
+CPPUNIT_ASSERT_EQUAL( sal_uInt16(8040), uri2.GetPort() );
+CPPUNIT_ASSERT_EQUAL( OUString("/foo/bar"), 
uri2.GetRelativeReference() );
+CPPUNIT_ASSERT_EQUAL( 
OUString("http://user%40anothern...@server.biz:8040/foo/bar;), uri2.GetURI() );
+
+CurlUri 
uri3(aURI.CloneWithRelativeRefPathAbsolute(u"?query#fragment"));
+CPPUNIT_ASSERT_EQUAL( OUString("http"), uri3.GetScheme() );
+CPPUNIT_ASSERT_EQUAL( OUString("server.biz"), uri3.GetHost() );
+CPPUNIT_ASSERT_EQUAL( OUString("user%40anothername"), uri3.GetUser() );
+CPPUNIT_ASSERT_EQUAL( sal_uInt16(8040), uri3.GetPort() );
+CPPUNIT_ASSERT_EQUAL( OUString("?query#fragment"), 
uri3.GetRelativeReference() );
+CPPUNIT_ASSERT_EQUAL( 
OUString("http://user%40anothern...@server.biz:8040/?query#fragment;), 
uri3.GetURI() );
 }
 
 void webdav_local_test::WebdavUriTest2()
@@ -54,6 +70,24 @@ namespace
 CPPUNIT_ASSERT_EQUAL( OUString("bar"), aURI.GetPassword() );
 CPPUNIT_ASSERT_EQUAL( sal_uInt16( 8040 ), aURI.GetPort() );
 CPPUNIT_ASSERT_EQUAL( OUString( "/aService#aaa" ), 
aURI.GetRelativeReference() );
+
+CurlUri uri2(aURI.CloneWithRelativeRefPathAbsolute(u"/foo/bar"));
+CPPUNIT_ASSERT_EQUAL( OUString("https"), uri2.GetScheme() );
+CPPUNIT_ASSERT_EQUAL( OUString("server.biz"), uri2.GetHost() );
+CPPUNIT_ASSERT_EQUAL( OUString("foo"), uri2.GetUser() );
+CPPUNIT_ASSERT_EQUAL( OUString("bar"), uri2.GetPassword() );
+CPPUNIT_ASSERT_EQUAL( sal_uInt16( 8040 ), uri2.GetPort() );
+CPPUNIT_ASSERT_EQUAL( OUString("/foo/bar"), 
uri2.GetRelativeReference() );
+CPPUNIT_ASSERT_EQUAL( 
OUString("https://foo:b...@server.biz:8040/foo/bar;), uri2.GetURI() );
+
+CurlUri uri3(aURI.CloneWithRelativeRefPathAbsolute(u"?query"));
+CPPUNIT_ASSERT_EQUAL( OUString("https"), uri3.GetScheme() );
+CPPUNIT_ASSERT_EQUAL( OUString("server.biz"), uri3.GetHost() );
+CPPUNIT_ASSERT_EQUAL( OUString("foo"), uri3.GetUser() );
+CPPUNIT_ASSERT_EQUAL( OUString("bar"), uri3.GetPassword() );
+CPPUNIT_ASSERT_EQUAL( sal_uInt16(8040), uri3.GetPort() );
+CPPUNIT_ASSERT_EQUAL( OUString("?query"), uri3.GetRelativeReference() 
);
+CPPUNIT_ASSERT_EQUAL( 
OUString("https://foo:b...@server.biz:8040/?query;), uri3.GetURI() );
 }
 
 CPPUNIT_TEST_SUITE_REGISTRATION( webdav_local_test );
diff --git a/ucb/source/ucp/webdav-curl/CurlUri.cxx 
b/ucb/source/ucp/webdav-curl/CurlUri.cxx
index 533a77606f47..035c12a132ef 100644
--- a/ucb/source/ucp/webdav-curl/CurlUri.cxx
+++ b/ucb/source/ucp/webdav-curl/CurlUri.cxx
@@ -243,33 +243,42 @@ CurlUri 
CurlUri::CloneWithRelativeRefPathAbsolute(OUString const& rRelativeRef)
 sal_Int32 indexEnd(rRelativeRef.getLength());
 auto const indexQuery(rRelativeRef.indexOf('?'));
 auto const indexFragment(rRelativeRef.indexOf('#'));
+CURLUcode uc;
 if (indexFragment != -1)
 {
-OUString const fragment(rRelativeRef.copy(indexFragment));
+OUString const fragment(rRelativeRef.copy(indexFragment + 1));
 indexEnd = indexFragment;
 OString const utf8Fragment(OUStringToOString(fragment, 
RTL_TEXTENCODING_UTF8));
-auto const uc = curl_url_set(pUrl.get(), CURLUPART_QUERY, 
utf8Fragment.getStr(), 0);
-if (uc != 

[Libreoffice-commits] core.git: ucb/qa ucb/source

2021-10-11 Thread Noel Grandin (via logerrit)
 ucb/qa/cppunit/webdav/webdav_propfindcache.cxx   |4 +-
 ucb/source/ucp/cmis/cmis_repo_content.cxx|6 +--
 ucb/source/ucp/cmis/cmis_repo_content.hxx|2 -
 ucb/source/ucp/file/filnot.cxx   |   12 +++---
 ucb/source/ucp/file/filnot.hxx   |6 +--
 ucb/source/ucp/ftp/ftpcontent.cxx|6 +--
 ucb/source/ucp/ftp/ftpresultsetfactory.hxx   |2 -
 ucb/source/ucp/webdav-neon/DAVRequestEnvironment.hxx |4 +-
 ucb/source/ucp/webdav-neon/DAVResourceAccess.cxx |   38 +--
 ucb/source/ucp/webdav-neon/PropfindCache.hxx |2 -
 ucb/source/ucp/webdav-neon/webdavcontentcaps.cxx |2 -
 11 files changed, 42 insertions(+), 42 deletions(-)

New commits:
commit 819a4064ba03f230a4b2936662adbe56f478f8db
Author: Noel Grandin 
AuthorDate: Sun Oct 10 20:39:37 2021 +0200
Commit: Noel Grandin 
CommitDate: Mon Oct 11 12:42:53 2021 +0200

loplugin:moveparam in ucb

Change-Id: I61a7910f3ef15b251b1763b7c56848ccbb22fe91
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/123352
Tested-by: Jenkins
Reviewed-by: Noel Grandin 

diff --git a/ucb/qa/cppunit/webdav/webdav_propfindcache.cxx 
b/ucb/qa/cppunit/webdav/webdav_propfindcache.cxx
index 29ccf8a462be..03ccdbe7aae7 100644
--- a/ucb/qa/cppunit/webdav/webdav_propfindcache.cxx
+++ b/ucb/qa/cppunit/webdav/webdav_propfindcache.cxx
@@ -78,7 +78,7 @@ namespace
 std::vector< DAVResourceInfo > aProps { aSingleInfo };
 std::vector< DAVResourceInfo > aRetProp;
 
-aPropsNames.setPropertiesNames( aProps );
+aPropsNames.setPropertiesNames( std::vector(aProps) );
 aRetProp = aPropsNames.getPropertiesNames();
 CPPUNIT_ASSERT_EQUAL( true, ( aProps == aRetProp ) );
 
@@ -112,7 +112,7 @@ namespace
 std::vector< DAVResourceInfo > aProps { aSingleInfo };
 
 // add the cache an element
-aPropsNames.setPropertiesNames( aProps );
+aPropsNames.setPropertiesNames( std::vector(aProps) );
 PropCache.addCachePropertyNames( aPropsNames );
 
 PropertyNames aRetPropsNames;
diff --git a/ucb/source/ucp/cmis/cmis_repo_content.cxx 
b/ucb/source/ucp/cmis/cmis_repo_content.cxx
index fc5472bafce2..c55b670526b8 100644
--- a/ucb/source/ucp/cmis/cmis_repo_content.cxx
+++ b/ucb/source/ucp/cmis/cmis_repo_content.cxx
@@ -50,11 +50,11 @@ namespace cmis
 {
 RepoContent::RepoContent( const uno::Reference< uno::XComponentContext >& 
rxContext,
 ContentProvider *pProvider, const uno::Reference< 
ucb::XContentIdentifier >& Identifier,
-std::vector< libcmis::RepositoryPtr > const & aRepos )
+std::vector< libcmis::RepositoryPtr > && aRepos )
 : ContentImplHelper( rxContext, pProvider, Identifier ),
 m_pProvider( pProvider ),
 m_aURL( Identifier->getContentIdentifier( ) ),
-m_aRepositories( aRepos )
+m_aRepositories( std::move(aRepos) )
 {
 // Split the URL into bits
 OUString sURL = m_xIdentifier->getContentIdentifier( );
@@ -399,7 +399,7 @@ namespace cmis
 aUrl.setObjectPath( STD_TO_OUSTR( rRepo->getId( ) ) );
 
 uno::Reference< ucb::XContentIdentifier > xId = new 
ucbhelper::ContentIdentifier( aUrl.asString( ) );
-uno::Reference< ucb::XContent > xContent = new RepoContent( 
m_xContext, m_pProvider, xId, m_aRepositories );
+uno::Reference< ucb::XContent > xContent = new RepoContent( 
m_xContext, m_pProvider, xId, std::vector(m_aRepositories) );
 
 result.push_back( xContent );
 }
diff --git a/ucb/source/ucp/cmis/cmis_repo_content.hxx 
b/ucb/source/ucp/cmis/cmis_repo_content.hxx
index 00fc4e244960..efd13d7d8cbf 100644
--- a/ucb/source/ucp/cmis/cmis_repo_content.hxx
+++ b/ucb/source/ucp/cmis/cmis_repo_content.hxx
@@ -75,7 +75,7 @@ public:
 RepoContent( const css::uno::Reference<
 css::uno::XComponentContext >& rxContext, ContentProvider *pProvider,
 const css::uno::Reference< css::ucb::XContentIdentifier >& Identifier,
-std::vector< libcmis::RepositoryPtr > const & aRepos = std::vector< 
libcmis::RepositoryPtr > ( ) );
+std::vector< libcmis::RepositoryPtr > && aRepos = std::vector< 
libcmis::RepositoryPtr > ( ) );
 
 virtual ~RepoContent() override;
 
diff --git a/ucb/source/ucp/file/filnot.cxx b/ucb/source/ucp/file/filnot.cxx
index f63f83f9e515..728d48eea6ec 100644
--- a/ucb/source/ucp/file/filnot.cxx
+++ b/ucb/source/ucp/file/filnot.cxx
@@ -34,11 +34,11 @@ using namespace com::sun::star::ucb;
 ContentEventNotifier::ContentEventNotifier( TaskManager* pMyShell,
 const uno::Reference< XContent >& 
xCreatorContent,
 const uno::Reference< 
XContentIdentifier >& xCreatorId,
-const std::vector< uno::Reference< 
uno::XInterface > 

[Libreoffice-commits] core.git: ucb/qa ucb/source

2020-06-05 Thread Stephan Bergmann (via logerrit)
 ucb/qa/cppunit/webdav/webdav_options.cxx |6 ++
 ucb/source/ucp/cmis/auth_provider.cxx|   13 ++---
 2 files changed, 8 insertions(+), 11 deletions(-)

New commits:
commit f5aa422422476d4cf944660a3e03e24ffe918f19
Author: Stephan Bergmann 
AuthorDate: Fri Jun 5 12:55:56 2020 +0200
Commit: Stephan Bergmann 
CommitDate: Fri Jun 5 16:01:01 2020 +0200

Upcoming loplugin:elidestringvar: ucb

Change-Id: I25535b844b6fa12679908427997713dadf819d74
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/95588
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann 

diff --git a/ucb/qa/cppunit/webdav/webdav_options.cxx 
b/ucb/qa/cppunit/webdav/webdav_options.cxx
index ef0cc1b969fc..eee94af2a82b 100644
--- a/ucb/qa/cppunit/webdav/webdav_options.cxx
+++ b/ucb/qa/cppunit/webdav/webdav_options.cxx
@@ -347,16 +347,14 @@ namespace
 // the returned value to test
 DAVOptions aDavOptCached;
 // init the values
-OUString aAllowedMethods = 
"OPTIONS,GET,HEAD,POST,DELETE,TRACE,PROPFIND,PROPPATCH,COPY,MOVE,PUT,LOCK,UNLOCK";
 OUString aURL = 
"http://my.server.org/a%20fake%20url/to%20test/another-url;;
-OUString aRedirectedURL = 
"http://my.server.org/a%20fake%20url/to%20test/another-url/redirected;;
 aDavOpt.setURL( aURL );
-aDavOpt.setRedirectedURL( aRedirectedURL );
+aDavOpt.setRedirectedURL( 
"http://my.server.org/a%20fake%20url/to%20test/another-url/redirected; );
 aDavOpt.setClass1();
 aDavOpt.setClass2();
 aDavOpt.setClass3();
 aDavOpt.setHeadAllowed( false );
-aDavOpt.setAllowedMethods( aAllowedMethods );
+aDavOpt.setAllowedMethods( 
"OPTIONS,GET,HEAD,POST,DELETE,TRACE,PROPFIND,PROPPATCH,COPY,MOVE,PUT,LOCK,UNLOCK"
 );
 // add to cache
 aDAVOptsCache.addDAVOptions( aDavOpt, 3 );
 CPPUNIT_ASSERT_EQUAL( true ,aDAVOptsCache.getDAVOptions( aURL, 
aDavOptCached ) );
diff --git a/ucb/source/ucp/cmis/auth_provider.cxx 
b/ucb/source/ucp/cmis/auth_provider.cxx
index c6d5b28bcb56..f9eb99db2553 100644
--- a/ucb/source/ucp/cmis/auth_provider.cxx
+++ b/ucb/source/ucp/cmis/auth_provider.cxx
@@ -80,10 +80,6 @@ namespace cmis
 const char* /*username*/,
 const char* /*password*/ )
 {
-OUString instructions = "Open the following link in your browser and "
-"paste the code from the URL you have been redirected to in the "
-"box below. For example:\n"
-
"https://login.live.com/oauth20_desktop.srf?code=YOUR_CODE=1033;;
 OUString url_oustr( url, strlen( url ), RTL_TEXTENCODING_UTF8 );
 const css::uno::Reference<
 css::ucb::XCommandEnvironment> xEnv = getXEnv( );
@@ -97,7 +93,11 @@ namespace cmis
 {
 rtl::Reference< ucbhelper::AuthenticationFallbackRequest > 
xRequest
 = new ucbhelper::AuthenticationFallbackRequest (
-instructions, url_oustr );
+"Open the following link in your browser and "
+"paste the code from the URL you have been 
redirected to in the "
+"box below. For example:\n"
+
"https://login.live.com/oauth20_desktop.srf?code=YOUR_CODE=1033;,
+url_oustr );
 
 xIH->handle( xRequest.get() );
 
@@ -125,7 +125,6 @@ namespace cmis
 const char* /*username*/,
 const char* /*password*/ )
 {
-OUString instructions = "PIN:";
 const css::uno::Reference<
 css::ucb::XCommandEnvironment> xEnv = getXEnv( );
 
@@ -138,7 +137,7 @@ namespace cmis
 {
 rtl::Reference< ucbhelper::AuthenticationFallbackRequest > 
xRequest
 = new ucbhelper::AuthenticationFallbackRequest (
-instructions, "" );
+"PIN:", "" );
 
 xIH->handle( xRequest.get() );
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: ucb/qa ucb/source

2016-10-26 Thread Stephan Bergmann
 ucb/qa/cppunit/webdav/webdav_options.cxx |4 ++--
 ucb/source/ucp/webdav-neon/DAVTypes.hxx  |   26 +-
 2 files changed, 15 insertions(+), 15 deletions(-)

New commits:
commit 95cfef300eb1a32d700479d2cefddc3fc4d0b37c
Author: Stephan Bergmann 
Date:   Wed Oct 26 13:57:05 2016 +0200

const-ness fixes

Change-Id: I83858c0cbca0fc493ac506e2b839e43310f3bb2f

diff --git a/ucb/qa/cppunit/webdav/webdav_options.cxx 
b/ucb/qa/cppunit/webdav/webdav_options.cxx
index b1a71ba..9bdc1c5 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 DAVTypesCheckInit( webdav_ucp::DAVOptions& aDavType );
+void DAVTypesCheckInit( webdav_ucp::DAVOptions const & aDavType );
 void DAVTypesTest();
 
 void DAVOptsCacheTests();
@@ -51,7 +51,7 @@ namespace
 {
 }
 
-void webdav_opts_test::DAVTypesCheckInit( webdav_ucp::DAVOptions& aDavType 
)
+void webdav_opts_test::DAVTypesCheckInit( webdav_ucp::DAVOptions const & 
aDavType )
 {
 // check if the class is at reset state
 // using accessors
diff --git a/ucb/source/ucp/webdav-neon/DAVTypes.hxx 
b/ucb/source/ucp/webdav-neon/DAVTypes.hxx
index 2356ab1..68ac37e 100644
--- a/ucb/source/ucp/webdav-neon/DAVTypes.hxx
+++ b/ucb/source/ucp/webdav-neon/DAVTypes.hxx
@@ -105,41 +105,41 @@ namespace webdav_ucp
 
 virtual ~DAVOptions();
 
-bool isClass1() { return m_isClass1; };
+bool isClass1() const { return m_isClass1; };
 void setClass1( bool Class1 = true ) { m_isClass1 = Class1; };
 
-bool isClass2() { return m_isClass2; };
+bool isClass2() const { return m_isClass2; };
 void setClass2( bool Class2 = true ) { m_isClass2 = Class2; };
 
-bool isClass3() { return m_isClass3; };
+bool isClass3() const { return m_isClass3; };
 void setClass3( bool Class3 = true ) { m_isClass3 = Class3; };
 
-bool isHeadAllowed() { return m_isHeadAllowed; };
+bool isHeadAllowed() const { return m_isHeadAllowed; };
 void setHeadAllowed( bool HeadAllowed = true ) { m_isHeadAllowed = 
HeadAllowed; };
 
-sal_uInt32 getStaleTime() { return m_nStaleTime ; };
+sal_uInt32 getStaleTime() const { return m_nStaleTime ; };
 void setStaleTime( const sal_uInt32 nStaleTime ) { m_nStaleTime = 
nStaleTime; };
 
-sal_uInt32 getRequestedTimeLife() { return m_nRequestedTimeLife; };
+sal_uInt32 getRequestedTimeLife() const { return m_nRequestedTimeLife; 
};
 void setRequestedTimeLife( const sal_uInt32 nRequestedTimeLife ) { 
m_nRequestedTimeLife = nRequestedTimeLife; };
 
-const OUString & getURL() { return m_sURL; };
+const OUString & getURL() const { return m_sURL; };
 void setURL( const OUString & sURL ) { m_sURL = sURL; };
 
-const OUString & getRedirectedURL() { return m_sRedirectedURL; };
+const OUString & getRedirectedURL() const { return m_sRedirectedURL; };
 void setRedirectedURL( const OUString & sRedirectedURL ) { 
m_sRedirectedURL = sRedirectedURL; };
 
 void  setAllowedMethods( const OUString & aAllowedMethods ) { 
m_aAllowedMethods = aAllowedMethods; } ;
-const OUString & getAllowedMethods() { return m_aAllowedMethods; } ;
-bool isLockAllowed() { return ( m_aAllowedMethods.indexOf( "LOCK" ) != 
-1 ); };
+const OUString & getAllowedMethods() const { return m_aAllowedMethods; 
} ;
+bool isLockAllowed() const { return ( m_aAllowedMethods.indexOf( 
"LOCK" ) != -1 ); };
 
 void setLocked( bool locked = true ) { m_isLocked = locked; } ;
-bool isLocked() { return m_isLocked; };
+bool isLocked() const { return m_isLocked; };
 
-sal_uInt16 getHttpResponseStatusCode() { return 
m_nHttpResponseStatusCode; };
+sal_uInt16 getHttpResponseStatusCode() const { return 
m_nHttpResponseStatusCode; };
 void setHttpResponseStatusCode( const sal_uInt16 
nHttpResponseStatusCode ) { m_nHttpResponseStatusCode = 
nHttpResponseStatusCode; };
 
-const OUString & getHttpResponseStatusText() { return 
m_sHttpResponseStatusText; };
+const OUString & getHttpResponseStatusText() const { return 
m_sHttpResponseStatusText; };
 void setHttpResponseStatusText( const OUString & 
rHttpResponseStatusText ) { m_sHttpResponseStatusText = 
rHttpResponseStatusText; };
 
 void init() {
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: ucb/qa ucb/source

2016-10-12 Thread Giuseppe Castagno
 ucb/qa/cppunit/webdav/webdav_options.cxx |   33 +++
 ucb/source/ucp/webdav-neon/DAVTypes.cxx  |   46 +++
 ucb/source/ucp/webdav-neon/DAVTypes.hxx  |7 ++--
 ucb/source/ucp/webdav-neon/webdavcontent.cxx |6 +--
 4 files changed, 54 insertions(+), 38 deletions(-)

New commits:
commit 1ca68d386bc0345240bf288bec023faaba2e07af
Author: Giuseppe Castagno 
Date:   Tue Oct 11 15:21:23 2016 +0200

tdf#102499 (6): Cache OPTIONS if not present or if lifetime different

Add the OPTIONS information and response status code into the cache:
- if the OPTIONS information is already cached, update the cache only
  if the lifetime is different;
- if the OPTIONS information is not cached, cache it.

Add some new functions in DAVOptions to support the change and remove
a function no longer used.

Change-Id: I2f28f0ee793ec7d898caa61cc0a4962334e6e068
Reviewed-on: https://gerrit.libreoffice.org/29733
Tested-by: Jenkins 
Reviewed-by: Giuseppe Castagno 

diff --git a/ucb/qa/cppunit/webdav/webdav_options.cxx 
b/ucb/qa/cppunit/webdav/webdav_options.cxx
index 0dad7f8..ce3aba7 100644
--- a/ucb/qa/cppunit/webdav/webdav_options.cxx
+++ b/ucb/qa/cppunit/webdav/webdav_options.cxx
@@ -65,6 +65,7 @@ namespace
 CPPUNIT_ASSERT_EQUAL( true, aDavType.getURL().isEmpty() );
 CPPUNIT_ASSERT_EQUAL( true, aDavType.getRedirectedURL().isEmpty() );
 CPPUNIT_ASSERT_EQUAL( sal_uInt32( 0 ), aDavType.getStaleTime() );
+CPPUNIT_ASSERT_EQUAL( sal_uInt32( 0 ), aDavType.getRequestedTimeLife() 
);
 CPPUNIT_ASSERT_EQUAL( sal_uInt16( 0 ), 
aDavType.getHttpResponseStatusCode() );
 CPPUNIT_ASSERT_EQUAL( true, 
aDavType.getHttpResponseStatusText().isEmpty() );
 }
@@ -83,6 +84,7 @@ namespace
 CPPUNIT_ASSERT_EQUAL( false, aDavOpt.isLockAllowed() );
 CPPUNIT_ASSERT_EQUAL( true, aDavOpt.getAllowedMethods().isEmpty() );
 CPPUNIT_ASSERT_EQUAL( sal_uInt32( 0 ), aDavOpt.getStaleTime() );
+CPPUNIT_ASSERT_EQUAL( sal_uInt32( 0 ), aDavOpt.getRequestedTimeLife() 
);
 CPPUNIT_ASSERT_EQUAL( true, aDavOpt.getURL().isEmpty() );
 CPPUNIT_ASSERT_EQUAL( true, aDavOpt.getRedirectedURL().isEmpty() );
 CPPUNIT_ASSERT_EQUAL( sal_uInt16( 0 ), 
aDavOpt.getHttpResponseStatusCode() );
@@ -97,6 +99,7 @@ namespace
 CPPUNIT_ASSERT_EQUAL( false, aDavOpt.isLockAllowed() );
 CPPUNIT_ASSERT_EQUAL( true, aDavOpt.getAllowedMethods().isEmpty() );
 CPPUNIT_ASSERT_EQUAL( sal_uInt32( 0 ), aDavOpt.getStaleTime() );
+CPPUNIT_ASSERT_EQUAL( sal_uInt32( 0 ), aDavOpt.getRequestedTimeLife() 
);
 CPPUNIT_ASSERT_EQUAL( true, aDavOpt.getURL().isEmpty() );
 CPPUNIT_ASSERT_EQUAL( true, aDavOpt.getRedirectedURL().isEmpty() );
 CPPUNIT_ASSERT_EQUAL( sal_uInt16( 0 ), 
aDavOpt.getHttpResponseStatusCode() );
@@ -111,6 +114,7 @@ namespace
 CPPUNIT_ASSERT_EQUAL( false, aDavOpt.isLockAllowed() );
 CPPUNIT_ASSERT_EQUAL( true, aDavOpt.getAllowedMethods().isEmpty() );
 CPPUNIT_ASSERT_EQUAL( sal_uInt32( 0 ), aDavOpt.getStaleTime() );
+CPPUNIT_ASSERT_EQUAL( sal_uInt32( 0 ), aDavOpt.getRequestedTimeLife() 
);
 CPPUNIT_ASSERT_EQUAL( true, aDavOpt.getURL().isEmpty() );
 CPPUNIT_ASSERT_EQUAL( true, aDavOpt.getRedirectedURL().isEmpty() );
 CPPUNIT_ASSERT_EQUAL( sal_uInt16( 0 ), 
aDavOpt.getHttpResponseStatusCode() );
@@ -125,6 +129,7 @@ namespace
 CPPUNIT_ASSERT_EQUAL( false, aDavOpt.isLockAllowed() );
 CPPUNIT_ASSERT_EQUAL( true, aDavOpt.getAllowedMethods().isEmpty() );
 CPPUNIT_ASSERT_EQUAL( sal_uInt32( 0 ), aDavOpt.getStaleTime() );
+CPPUNIT_ASSERT_EQUAL( sal_uInt32( 0 ), aDavOpt.getRequestedTimeLife() 
);
 CPPUNIT_ASSERT_EQUAL( true, aDavOpt.getURL().isEmpty() );
 CPPUNIT_ASSERT_EQUAL( true, aDavOpt.getRedirectedURL().isEmpty() );
 CPPUNIT_ASSERT_EQUAL( sal_uInt16( 0 ), 
aDavOpt.getHttpResponseStatusCode() );
@@ -142,6 +147,7 @@ namespace
 CPPUNIT_ASSERT_EQUAL( false, aDavOpt.isLockAllowed() );
 CPPUNIT_ASSERT_EQUAL( aAllowedMethods, aDavOpt.getAllowedMethods() );
 CPPUNIT_ASSERT_EQUAL( sal_uInt32( 0 ), aDavOpt.getStaleTime() );
+CPPUNIT_ASSERT_EQUAL( sal_uInt32( 0 ), aDavOpt.getRequestedTimeLife() 
);
 CPPUNIT_ASSERT_EQUAL( true, aDavOpt.getURL().isEmpty() );
 CPPUNIT_ASSERT_EQUAL( true, aDavOpt.getRedirectedURL().isEmpty() );
 CPPUNIT_ASSERT_EQUAL( sal_uInt16( 0 ), 
aDavOpt.getHttpResponseStatusCode() );
@@ -158,6 +164,7 @@ namespace
 CPPUNIT_ASSERT_EQUAL( true, aDavOpt.isLockAllowed() );
 CPPUNIT_ASSERT_EQUAL( aAllowedMethods, aDavOpt.getAllowedMethods() );
 CPPUNIT_ASSERT_EQUAL( sal_uInt32( 0 ), aDavOpt.getStaleTime() );
+CPPUNIT_ASSERT_EQUAL( sal_uInt32( 0 ), 

[Libreoffice-commits] core.git: ucb/qa ucb/source

2016-10-05 Thread Giuseppe Castagno
 ucb/qa/cppunit/webdav/webdav_options.cxx |   84 ++---
 ucb/source/ucp/webdav-neon/DAVTypes.cxx  |   30 +--
 ucb/source/ucp/webdav-neon/DAVTypes.hxx  |   38 ++--
 ucb/source/ucp/webdav-neon/NeonSession.cxx   |3 
 ucb/source/ucp/webdav-neon/webdavcontent.cxx |  241 +--
 5 files changed, 214 insertions(+), 182 deletions(-)

New commits:
commit f423a9d695814b1babf5f2c3f42821190adc7e53
Author: Giuseppe Castagno 
Date:   Sun Sep 25 17:48:27 2016 +0200

tdf#102499 (3): Change caching model for HTTP response status code

Instead of caching only a single status flag, now both the HTTP
response status code and the message accompanying it are cached.

Change-Id: If7352f6b0cb7c7dab6af3cede96647308baa5ce2
Reviewed-on: https://gerrit.libreoffice.org/29538
Tested-by: Jenkins 
Reviewed-by: Giuseppe Castagno 

diff --git a/ucb/qa/cppunit/webdav/webdav_options.cxx 
b/ucb/qa/cppunit/webdav/webdav_options.cxx
index 3718733..0dad7f8 100644
--- a/ucb/qa/cppunit/webdav/webdav_options.cxx
+++ b/ucb/qa/cppunit/webdav/webdav_options.cxx
@@ -55,7 +55,6 @@ namespace
 {
 // 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() );
@@ -66,6 +65,8 @@ namespace
 CPPUNIT_ASSERT_EQUAL( true, aDavType.getURL().isEmpty() );
 CPPUNIT_ASSERT_EQUAL( true, aDavType.getRedirectedURL().isEmpty() );
 CPPUNIT_ASSERT_EQUAL( sal_uInt32( 0 ), aDavType.getStaleTime() );
+CPPUNIT_ASSERT_EQUAL( sal_uInt16( 0 ), 
aDavType.getHttpResponseStatusCode() );
+CPPUNIT_ASSERT_EQUAL( true, 
aDavType.getHttpResponseStatusText().isEmpty() );
 }
 
 void webdav_opts_test::DAVTypesTest()
@@ -73,22 +74,8 @@ namespace
 //our DAVOptions
 webdav_ucp::DAVOptions 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.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.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() );
@@ -98,10 +85,11 @@ namespace
 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_uInt16( 0 ), 
aDavOpt.getHttpResponseStatusCode() );
+CPPUNIT_ASSERT_EQUAL( true, 
aDavOpt.getHttpResponseStatusText().isEmpty() );
 
 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() );
@@ -111,10 +99,11 @@ namespace
 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_uInt16( 0 ), 
aDavOpt.getHttpResponseStatusCode() );
+CPPUNIT_ASSERT_EQUAL( true, 
aDavOpt.getHttpResponseStatusText().isEmpty() );
 
 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() );
@@ -124,10 +113,11 @@ namespace
 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_uInt16( 0 ), 

[Libreoffice-commits] core.git: ucb/qa ucb/source

2016-10-01 Thread Giuseppe Castagno
 ucb/qa/cppunit/webdav/webdav_options.cxx   |   78 ++---
 ucb/source/ucp/webdav-neon/DAVTypes.cxx|1 
 ucb/source/ucp/webdav-neon/DAVTypes.hxx|   24 
 ucb/source/ucp/webdav-neon/NeonSession.cxx |2 
 4 files changed, 63 insertions(+), 42 deletions(-)

New commits:
commit d751af3f84909996d44b9354ce9ed34891d374e1
Author: Giuseppe Castagno 
Date:   Sat Oct 1 12:35:57 2016 +0200

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 
Reviewed-by: Giuseppe Castagno 

diff --git a/ucb/qa/cppunit/webdav/webdav_options.cxx 
b/ucb/qa/cppunit/webdav/webdav_options.cxx
index 924eaf9..3718733 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() );
 

[Libreoffice-commits] core.git: ucb/qa ucb/source

2016-07-29 Thread Giuseppe Castagno
 ucb/qa/cppunit/webdav/webdav_options.cxx |8 
 ucb/source/ucp/webdav-neon/DAVTypes.cxx  |3 +++
 ucb/source/ucp/webdav-neon/DAVTypes.hxx  |7 +++
 ucb/source/ucp/webdav-neon/NeonSession.cxx   |   12 
 ucb/source/ucp/webdav-neon/webdavcontent.cxx |   26 +-
 5 files changed, 55 insertions(+), 1 deletion(-)

New commits:
commit dfb714183f31d8a235797ef1ad3c517966ed4985
Author: Giuseppe Castagno 
Date:   Sun Jul 24 12:12:35 2016 +0200

tdf#101094 (13) OPTIONS: Options cache removal: LOCK, UNLOCK

Change-Id: Ib5e52973252b3af7b0fbe440806eb1e669670299
Reviewed-on: https://gerrit.libreoffice.org/27686
Tested-by: Jenkins 
Reviewed-by: Giuseppe Castagno 

diff --git a/ucb/qa/cppunit/webdav/webdav_options.cxx 
b/ucb/qa/cppunit/webdav/webdav_options.cxx
index 7c0ec7b..6c89623 100644
--- a/ucb/qa/cppunit/webdav/webdav_options.cxx
+++ b/ucb/qa/cppunit/webdav/webdav_options.cxx
@@ -58,6 +58,7 @@ namespace
 CPPUNIT_ASSERT_EQUAL( false, aDavType.isClass1() );
 CPPUNIT_ASSERT_EQUAL( false, aDavType.isClass2() );
 CPPUNIT_ASSERT_EQUAL( false, aDavType.isClass3() );
+CPPUNIT_ASSERT_EQUAL( false, aDavType.isLocked() );
 CPPUNIT_ASSERT_EQUAL( true, aDavType.getAllowedMethods().isEmpty() );
 CPPUNIT_ASSERT_EQUAL( false, aDavType.isLockAllowed() );
 CPPUNIT_ASSERT_EQUAL( true, aDavType.getURL().isEmpty() );
@@ -191,6 +192,7 @@ 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( false, aDavOpt.isLockAllowed() );
 CPPUNIT_ASSERT_EQUAL( true, aDavOpt.getURL().isEmpty() );
@@ -204,6 +206,7 @@ namespace
 aDavOpt.setClass1();
 aDavOpt.setClass2();
 aDavOpt.setClass3();
+aDavOpt.setLocked();
 aDavOpt.setAllowedMethods( aAllowedMethods );
 aDavOpt.setStaleTime( 1234567 );
 aDavOpt.setURL( aURL );
@@ -230,6 +233,11 @@ namespace
 aDavOpt.setClass3( false );
 CPPUNIT_ASSERT_EQUAL( true , aDavOpt == aDavOptTarget );
 
+aDavOpt.setLocked();
+CPPUNIT_ASSERT_EQUAL( false , aDavOpt == aDavOptTarget );
+aDavOpt.setLocked( false );
+CPPUNIT_ASSERT_EQUAL( true , aDavOpt == aDavOptTarget );
+
 aDavOpt.setResourceFound();
 CPPUNIT_ASSERT_EQUAL( false , aDavOpt == aDavOptTarget );
 aDavOpt.setResourceFound( false );
diff --git a/ucb/source/ucp/webdav-neon/DAVTypes.cxx 
b/ucb/source/ucp/webdav-neon/DAVTypes.cxx
index c0eb4ea..2f4feb3 100644
--- a/ucb/source/ucp/webdav-neon/DAVTypes.cxx
+++ b/ucb/source/ucp/webdav-neon/DAVTypes.cxx
@@ -24,6 +24,7 @@ DAVOptions::DAVOptions() :
 m_isClass1( false ),
 m_isClass2( false ),
 m_isClass3( false ),
+m_isLocked( false ),
 m_aAllowedMethods(),
 m_nStaleTime( 0 ),
 m_sURL(),
@@ -37,6 +38,7 @@ DAVOptions::DAVOptions( const DAVOptions & rOther ) :
 m_isClass1( rOther.m_isClass1 ),
 m_isClass2( rOther.m_isClass2 ),
 m_isClass3( rOther.m_isClass3 ),
+m_isLocked( rOther.m_isLocked ),
 m_aAllowedMethods( rOther.m_aAllowedMethods ),
 m_nStaleTime( rOther.m_nStaleTime ),
 m_sURL( rOther.m_sURL ),
@@ -57,6 +59,7 @@ bool DAVOptions::operator==( const DAVOptions& rOpts ) const
 m_isClass1 == rOpts.m_isClass1 &&
 m_isClass2 == rOpts.m_isClass2 &&
 m_isClass3 == rOpts.m_isClass3 &&
+m_isLocked == rOpts.m_isLocked &&
 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 f9bbb1f..6dbdd20 100644
--- a/ucb/source/ucp/webdav-neon/DAVTypes.hxx
+++ b/ucb/source/ucp/webdav-neon/DAVTypes.hxx
@@ -81,6 +81,9 @@ namespace webdav_ucp
 boolm_isClass1;
 boolm_isClass2;
 boolm_isClass3;
+// Internally used to maintain locked stated of the resource, only
+// if it's a Class 2 resource
+boolm_isLocked;
 // contains the methods allowed on this resource
 OUStringm_aAllowedMethods;
 
@@ -122,11 +125,15 @@ namespace webdav_ucp
 bool isLockAllowed() { return ( m_aAllowedMethods.indexOf( "LOCK" ) != 
-1 ); };
 bool isUnlockAllowed() { return ( m_aAllowedMethods.indexOf( "UNLOCK" 
) != -1 ); };
 
+void setLocked( bool locked = true ) { m_isLocked = locked; } ;
+bool isLocked() { return m_isLocked; };
+
 void reset() {
 m_isResourceFound = false;
 m_isClass1 = false;
 

[Libreoffice-commits] core.git: ucb/qa ucb/source

2016-07-29 Thread Giuseppe Castagno
 ucb/qa/cppunit/webdav/webdav_options.cxx |   28 ++
 ucb/source/ucp/webdav-neon/DAVTypes.cxx  |   80 ++-
 ucb/source/ucp/webdav-neon/DAVTypes.hxx  |   24 +
 3 files changed, 131 insertions(+), 1 deletion(-)

New commits:
commit b641d83bb9f8adba1a487ca0e04d7151f96c3eea
Author: Giuseppe Castagno 
Date:   Sun Jan 10 10:05:02 2016 +0100

tdf#101094 (10) OPTIONS: Add a simple options cache class

Added behavioral unit tests as well.

Change-Id: I30f84c8f814d3460a421428ebe0d2fbc32c5c433
Reviewed-on: https://gerrit.libreoffice.org/27668
Tested-by: Jenkins 
Reviewed-by: Giuseppe Castagno 

diff --git a/ucb/qa/cppunit/webdav/webdav_options.cxx 
b/ucb/qa/cppunit/webdav/webdav_options.cxx
index dd7ad24..7c0ec7b 100644
--- a/ucb/qa/cppunit/webdav/webdav_options.cxx
+++ b/ucb/qa/cppunit/webdav/webdav_options.cxx
@@ -29,12 +29,15 @@ namespace
 void DAVTypesCheckReset( webdav_ucp::DAVOptions aDavType );
 void DAVTypesTest();
 
+void DAVOptsCacheTests();
+
 // 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( DAVOptsCacheTests );
 CPPUNIT_TEST_SUITE_END();
 };  // class webdav_local_test
 
@@ -247,6 +250,31 @@ namespace
 CPPUNIT_ASSERT_EQUAL( false , aDavOpt == aDavOptTarget );
 }
 
+void webdav_opts_test::DAVOptsCacheTests()
+{
+// define a local cache to test
+webdav_ucp::DAVOptionsCache aDAVOptsCache;
+// the value to cache
+webdav_ucp::DAVOptions aDavOpt;
+// the returned value to test
+webdav_ucp::DAVOptions aDavOptCached;
+// init the values
+OUString aAllowedMethods = 
"OPTIONS,GET,HEAD,POST,DELETE,TRACE,PROPFIND,PROPPATCH,COPY,MOVE,PUT,LOCK,UNLOCK";
+OUString aURL = "http://a%20fake%20url/to%20test/another-url;;
+OUString aRedirectedURL = 
"http://a%20fake%20url/to%20test/another-url/redirected;;
+aDavOpt.setURL( aURL );
+aDavOpt.setRedirectedURL( aRedirectedURL );
+aDavOpt.setResourceFound();
+aDavOpt.setClass1();
+aDavOpt.setClass2();
+aDavOpt.setClass3();
+aDavOpt.setAllowedMethods( aAllowedMethods );
+// add to cache
+aDAVOptsCache.addDAVOptions( aDavOpt, 3 );
+CPPUNIT_ASSERT_EQUAL( true ,aDAVOptsCache.getDAVOptions( aURL, 
aDavOptCached ) );
+CPPUNIT_ASSERT_EQUAL( true , aDavOpt == aDavOptCached );
+}
+
 CPPUNIT_TEST_SUITE_REGISTRATION( webdav_opts_test );
 }   // namespace rtl_random
 
diff --git a/ucb/source/ucp/webdav-neon/DAVTypes.cxx 
b/ucb/source/ucp/webdav-neon/DAVTypes.cxx
index 1fbf84d..c0eb4ea 100644
--- a/ucb/source/ucp/webdav-neon/DAVTypes.cxx
+++ b/ucb/source/ucp/webdav-neon/DAVTypes.cxx
@@ -17,7 +17,7 @@
 using namespace webdav_ucp;
 using namespace com::sun::star;
 
-// DAVCapabilities implementation
+// DAVOptions implementation
 
 DAVOptions::DAVOptions() :
 m_isResourceFound( false ),
@@ -64,4 +64,82 @@ bool DAVOptions::operator==( const DAVOptions& rOpts ) const
 }
 
 
+// DAVOptionsCache implementation
+
+DAVOptionsCache::DAVOptionsCache()
+{
+}
+
+
+DAVOptionsCache::~DAVOptionsCache()
+{
+}
+
+
+bool DAVOptionsCache::getDAVOptions( const OUString & rURL, DAVOptions & 
rDAVOptions )
+{
+osl::MutexGuard aGuard( m_aMutex );
+OUString aEncodedUrl( ucb_impl::urihelper::encodeURI( NeonUri::unescape( 
rURL ) ) );
+normalizeURLLastChar( aEncodedUrl );
+
+// search the URL in the static map
+DAVOptionsMap::iterator it;
+it = m_aTheCache.find( aEncodedUrl );
+if ( it == m_aTheCache.end() )
+return false;
+else
+{
+// check if the capabilities are stale, before restoring
+TimeValue t1;
+osl_getSystemTime(  );
+if ( (*it).second.getStaleTime() < t1.Seconds )
+{
+// if stale, remove from cache, do not restore
+removeDAVOptions( rURL );
+return false;
+// return false instead
+}
+rDAVOptions = (*it).second;
+return true;
+}
+}
+
+
+void DAVOptionsCache::removeDAVOptions( const OUString & rURL )
+{
+osl::MutexGuard aGuard( m_aMutex );
+OUString aEncodedUrl( ucb_impl::urihelper::encodeURI( NeonUri::unescape( 
rURL ) ) );
+normalizeURLLastChar( aEncodedUrl );
+
+DAVOptionsMap::iterator it;
+it = m_aTheCache.find( aEncodedUrl );
+if ( it != m_aTheCache.end() )
+{
+m_aTheCache.erase( it );
+}
+}
+
+
+void DAVOptionsCache::addDAVOptions( DAVOptions & rDAVOptions, const 
sal_uInt32 nLifeTime )
+{
+osl::MutexGuard