summaryrefslogtreecommitdiff
path: root/ucb/qa
diff options
context:
space:
mode:
authorGiuseppe Castagno <giuseppe.castagno@acca-esse.eu>2016-01-10 10:05:02 +0100
committerGiuseppe Castagno <giuseppe.castagno@acca-esse.eu>2016-07-29 11:45:01 +0000
commitb641d83bb9f8adba1a487ca0e04d7151f96c3eea (patch)
treed07c2cfa3796d1c36441d666df4fac92197c3e28 /ucb/qa
parent389d4d414291879b9097658080e405a06dc0c1fc (diff)
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 <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_options.cxx28
1 files changed, 28 insertions, 0 deletions
diff --git a/ucb/qa/cppunit/webdav/webdav_options.cxx b/ucb/qa/cppunit/webdav/webdav_options.cxx
index dd7ad24f8755..7c0ec7b54ddc 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, 30000 );
+ CPPUNIT_ASSERT_EQUAL( true ,aDAVOptsCache.getDAVOptions( aURL, aDavOptCached ) );
+ CPPUNIT_ASSERT_EQUAL( true , aDavOpt == aDavOptCached );
+ }
+
CPPUNIT_TEST_SUITE_REGISTRATION( webdav_opts_test );
} // namespace rtl_random