summaryrefslogtreecommitdiff
path: root/ucb/qa
diff options
context:
space:
mode:
authorGiuseppe Castagno <giuseppe.castagno@acca-esse.eu>2016-09-22 17:06:43 +0200
committerGiuseppe Castagno <giuseppe.castagno@acca-esse.eu>2016-09-26 11:03:15 +0000
commitac060f97cc937787b4079e435c5b312f6894c277 (patch)
tree29fae3eedee22f7cd3347207a4201fd8328a833b /ucb/qa
parent9373913086dcf16421bbe6cac49bb1444155c1de (diff)
tdf#102499 (2): Refactor the WebDAV resource access retry
Change-Id: Ia29560d54a61f1238f3b4e945d78308a3a68c483 Reviewed-on: https://gerrit.libreoffice.org/29269 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Giuseppe Castagno <giuseppe.castagno@acca-esse.eu>
Diffstat (limited to 'ucb/qa')
-rw-r--r--ucb/qa/cppunit/webdav/webdav_resource_access.cxx28
1 files changed, 23 insertions, 5 deletions
diff --git a/ucb/qa/cppunit/webdav/webdav_resource_access.cxx b/ucb/qa/cppunit/webdav/webdav_resource_access.cxx
index 4097d9e4b73a..e2794e220c8c 100644
--- a/ucb/qa/cppunit/webdav/webdav_resource_access.cxx
+++ b/ucb/qa/cppunit/webdav/webdav_resource_access.cxx
@@ -65,15 +65,33 @@ namespace
const DAVException aTheException(DAVException::DAV_HTTP_ERROR, "http error code", i );
CPPUNIT_ASSERT_EQUAL( false , ResourceAccess.handleException( aTheException, 1 ) );
}
+
// http error code from 500 (SC_INTERNAL_SERVER_ERROR) up should force a retry
- // except: SC_NOT_IMPLEMENTED
+ // except in special value
+ // 1999 as high limit is just a current (2016-09-25) choice.
+ // RFC poses no limit to the max value of response status code
for (auto i = SC_INTERNAL_SERVER_ERROR; i < 2000; i++)
{
const DAVException aTheException(DAVException::DAV_HTTP_ERROR, "http error code", i );
- if( i != SC_NOT_IMPLEMENTED )
- CPPUNIT_ASSERT_EQUAL( true , ResourceAccess.handleException( aTheException, 1 ) );
- else
- CPPUNIT_ASSERT_EQUAL( false , ResourceAccess.handleException( aTheException, 1 ) );
+ switch ( i )
+ {
+ // the HTTP response status codes that can be retried
+ case SC_BAD_GATEWAY:
+ case SC_GATEWAY_TIMEOUT:
+ case SC_SERVICE_UNAVAILABLE:
+ case SC_INSUFFICIENT_STORAGE:
+ CPPUNIT_ASSERT_EQUAL( true , ResourceAccess.handleException( aTheException, 1 ) );
+ break;
+ // default is NOT retry
+ default:
+ CPPUNIT_ASSERT_EQUAL( false , ResourceAccess.handleException( aTheException, 1 ) );
+ }
+ }
+
+ // check the retry request
+ {
+ const DAVException aTheException(DAVException::DAV_HTTP_RETRY, "the-host-name", 8080 );
+ CPPUNIT_ASSERT_EQUAL( true , ResourceAccess.handleException( aTheException, 1 ) );
}
}