Version 6.4.0.0.beta1, tag libreoffice-6.4.0.0.beta1
[LibreOffice.git] / ucb / qa / cppunit / webdav / webdav_options.cxx
blobef0cc1b969fc72b7875dfd71641a11fbb4783a12
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 */
10 #include <test/bootstrapfixture.hxx>
11 #include <cppunit/plugin/TestPlugIn.h>
12 #include <DAVTypes.hxx>
14 using namespace webdav_ucp;
16 namespace
19 class webdav_opts_test: public test::BootstrapFixture
22 public:
23 webdav_opts_test() : BootstrapFixture( true, true ) {}
25 // initialise your test code values here.
26 void setUp( ) override;
28 void tearDown( ) override;
30 void DAVTypesCheckInit( DAVOptions const & aDavType );
31 void DAVTypesTest();
33 void DAVOptsCacheTests();
35 // Change the following lines only, if you add, remove or rename
36 // member functions of the current class,
37 // because these macros are need by auto register mechanism.
39 CPPUNIT_TEST_SUITE( webdav_opts_test );
40 CPPUNIT_TEST( DAVTypesTest );
41 CPPUNIT_TEST( DAVOptsCacheTests );
42 CPPUNIT_TEST_SUITE_END();
43 }; // class webdav_local_test
45 // initialise your test code values here.
46 void webdav_opts_test::setUp()
50 void webdav_opts_test::tearDown()
54 void webdav_opts_test::DAVTypesCheckInit( DAVOptions const & aDavType )
56 // check if the class is at reset state
57 // using accessors
58 CPPUNIT_ASSERT_EQUAL( false, aDavType.isClass1() );
59 CPPUNIT_ASSERT_EQUAL( false, aDavType.isClass2() );
60 CPPUNIT_ASSERT_EQUAL( false, aDavType.isClass3() );
61 CPPUNIT_ASSERT_EQUAL( false, aDavType.isLocked() );
62 CPPUNIT_ASSERT_EQUAL( true, aDavType.isHeadAllowed() );
63 CPPUNIT_ASSERT_EQUAL( true, aDavType.getAllowedMethods().isEmpty() );
64 CPPUNIT_ASSERT_EQUAL( false, aDavType.isLockAllowed() );
65 CPPUNIT_ASSERT_EQUAL( true, aDavType.getURL().isEmpty() );
66 CPPUNIT_ASSERT_EQUAL( true, aDavType.getRedirectedURL().isEmpty() );
67 CPPUNIT_ASSERT_EQUAL( sal_uInt32( 0 ), aDavType.getStaleTime() );
68 CPPUNIT_ASSERT_EQUAL( sal_uInt32( 0 ), aDavType.getRequestedTimeLife() );
69 CPPUNIT_ASSERT_EQUAL( sal_uInt16( 0 ), aDavType.getHttpResponseStatusCode() );
70 CPPUNIT_ASSERT_EQUAL( true, aDavType.getHttpResponseStatusText().isEmpty() );
73 void webdav_opts_test::DAVTypesTest()
75 //our DAVOptions
76 DAVOptions aDavOpt;
77 DAVTypesCheckInit( aDavOpt );
79 aDavOpt.setClass1();
80 CPPUNIT_ASSERT_EQUAL( true, aDavOpt.isClass1() );
81 CPPUNIT_ASSERT_EQUAL( false, aDavOpt.isClass2() );
82 CPPUNIT_ASSERT_EQUAL( false, aDavOpt.isClass3() );
83 CPPUNIT_ASSERT_EQUAL( true, aDavOpt.isHeadAllowed() );
84 CPPUNIT_ASSERT_EQUAL( false, aDavOpt.isLockAllowed() );
85 CPPUNIT_ASSERT_EQUAL( true, aDavOpt.getAllowedMethods().isEmpty() );
86 CPPUNIT_ASSERT_EQUAL( sal_uInt32( 0 ), aDavOpt.getStaleTime() );
87 CPPUNIT_ASSERT_EQUAL( sal_uInt32( 0 ), aDavOpt.getRequestedTimeLife() );
88 CPPUNIT_ASSERT_EQUAL( true, aDavOpt.getURL().isEmpty() );
89 CPPUNIT_ASSERT_EQUAL( true, aDavOpt.getRedirectedURL().isEmpty() );
90 CPPUNIT_ASSERT_EQUAL( sal_uInt16( 0 ), aDavOpt.getHttpResponseStatusCode() );
91 CPPUNIT_ASSERT_EQUAL( true, aDavOpt.getHttpResponseStatusText().isEmpty() );
93 aDavOpt.setClass1( false );
94 aDavOpt.setClass2();
95 CPPUNIT_ASSERT_EQUAL( false, aDavOpt.isClass1() );
96 CPPUNIT_ASSERT_EQUAL( true, aDavOpt.isClass2() );
97 CPPUNIT_ASSERT_EQUAL( false, aDavOpt.isClass3() );
98 CPPUNIT_ASSERT_EQUAL( true, aDavOpt.isHeadAllowed() );
99 CPPUNIT_ASSERT_EQUAL( false, aDavOpt.isLockAllowed() );
100 CPPUNIT_ASSERT_EQUAL( true, aDavOpt.getAllowedMethods().isEmpty() );
101 CPPUNIT_ASSERT_EQUAL( sal_uInt32( 0 ), aDavOpt.getStaleTime() );
102 CPPUNIT_ASSERT_EQUAL( sal_uInt32( 0 ), aDavOpt.getRequestedTimeLife() );
103 CPPUNIT_ASSERT_EQUAL( true, aDavOpt.getURL().isEmpty() );
104 CPPUNIT_ASSERT_EQUAL( true, aDavOpt.getRedirectedURL().isEmpty() );
105 CPPUNIT_ASSERT_EQUAL( sal_uInt16( 0 ), aDavOpt.getHttpResponseStatusCode() );
106 CPPUNIT_ASSERT_EQUAL( true, aDavOpt.getHttpResponseStatusText().isEmpty() );
108 aDavOpt.setClass2( false );
109 aDavOpt.setClass3();
110 CPPUNIT_ASSERT_EQUAL( false, aDavOpt.isClass1() );
111 CPPUNIT_ASSERT_EQUAL( false, aDavOpt.isClass2() );
112 CPPUNIT_ASSERT_EQUAL( true, aDavOpt.isClass3() );
113 CPPUNIT_ASSERT_EQUAL( true, aDavOpt.isHeadAllowed() );
114 CPPUNIT_ASSERT_EQUAL( false, aDavOpt.isLockAllowed() );
115 CPPUNIT_ASSERT_EQUAL( true, aDavOpt.getAllowedMethods().isEmpty() );
116 CPPUNIT_ASSERT_EQUAL( sal_uInt32( 0 ), aDavOpt.getStaleTime() );
117 CPPUNIT_ASSERT_EQUAL( sal_uInt32( 0 ), aDavOpt.getRequestedTimeLife() );
118 CPPUNIT_ASSERT_EQUAL( true, aDavOpt.getURL().isEmpty() );
119 CPPUNIT_ASSERT_EQUAL( true, aDavOpt.getRedirectedURL().isEmpty() );
120 CPPUNIT_ASSERT_EQUAL( sal_uInt16( 0 ), aDavOpt.getHttpResponseStatusCode() );
121 CPPUNIT_ASSERT_EQUAL( true, aDavOpt.getHttpResponseStatusText().isEmpty() );
123 aDavOpt.setClass3( false );
125 CPPUNIT_ASSERT_EQUAL( false, aDavOpt.isClass1() );
126 CPPUNIT_ASSERT_EQUAL( false, aDavOpt.isClass2() );
127 CPPUNIT_ASSERT_EQUAL( false, aDavOpt.isClass3() );
128 CPPUNIT_ASSERT_EQUAL( true, aDavOpt.isHeadAllowed() );
129 CPPUNIT_ASSERT_EQUAL( false, aDavOpt.isLockAllowed() );
130 CPPUNIT_ASSERT_EQUAL( true, aDavOpt.getAllowedMethods().isEmpty() );
131 CPPUNIT_ASSERT_EQUAL( sal_uInt32( 0 ), aDavOpt.getStaleTime() );
132 CPPUNIT_ASSERT_EQUAL( sal_uInt32( 0 ), aDavOpt.getRequestedTimeLife() );
133 CPPUNIT_ASSERT_EQUAL( true, aDavOpt.getURL().isEmpty() );
134 CPPUNIT_ASSERT_EQUAL( true, aDavOpt.getRedirectedURL().isEmpty() );
135 CPPUNIT_ASSERT_EQUAL( sal_uInt16( 0 ), aDavOpt.getHttpResponseStatusCode() );
136 CPPUNIT_ASSERT_EQUAL( true, aDavOpt.getHttpResponseStatusText().isEmpty() );
138 DAVTypesCheckInit( aDavOpt );
139 //example of allowed method for a Web resource
140 OUString aAllowedMethods = "POST,OPTIONS,GET,HEAD,TRACE";
141 aDavOpt.setAllowedMethods( aAllowedMethods );
142 // now check...
143 CPPUNIT_ASSERT_EQUAL( false, aDavOpt.isClass1() );
144 CPPUNIT_ASSERT_EQUAL( false, aDavOpt.isClass2() );
145 CPPUNIT_ASSERT_EQUAL( false, aDavOpt.isClass3() );
146 CPPUNIT_ASSERT_EQUAL( true, aDavOpt.isHeadAllowed() );
147 CPPUNIT_ASSERT_EQUAL( false, aDavOpt.isLockAllowed() );
148 CPPUNIT_ASSERT_EQUAL( aAllowedMethods, aDavOpt.getAllowedMethods() );
149 CPPUNIT_ASSERT_EQUAL( sal_uInt32( 0 ), aDavOpt.getStaleTime() );
150 CPPUNIT_ASSERT_EQUAL( sal_uInt32( 0 ), aDavOpt.getRequestedTimeLife() );
151 CPPUNIT_ASSERT_EQUAL( true, aDavOpt.getURL().isEmpty() );
152 CPPUNIT_ASSERT_EQUAL( true, aDavOpt.getRedirectedURL().isEmpty() );
153 CPPUNIT_ASSERT_EQUAL( sal_uInt16( 0 ), aDavOpt.getHttpResponseStatusCode() );
154 CPPUNIT_ASSERT_EQUAL( true, aDavOpt.getHttpResponseStatusText().isEmpty() );
156 //example of allowed method for a WebDAV resource supporting LOCK
157 aAllowedMethods = "OPTIONS,GET,HEAD,POST,DELETE,TRACE,PROPFIND,PROPPATCH,COPY,MOVE,PUT,LOCK,UNLOCK";
158 aDavOpt.setAllowedMethods( aAllowedMethods );
159 // now check...
160 CPPUNIT_ASSERT_EQUAL( false, aDavOpt.isClass1() );
161 CPPUNIT_ASSERT_EQUAL( false, aDavOpt.isClass2() );
162 CPPUNIT_ASSERT_EQUAL( false, aDavOpt.isClass3() );
163 CPPUNIT_ASSERT_EQUAL( true, aDavOpt.isHeadAllowed() );
164 CPPUNIT_ASSERT_EQUAL( true, aDavOpt.isLockAllowed() );
165 CPPUNIT_ASSERT_EQUAL( aAllowedMethods, aDavOpt.getAllowedMethods() );
166 CPPUNIT_ASSERT_EQUAL( sal_uInt32( 0 ), aDavOpt.getStaleTime() );
167 CPPUNIT_ASSERT_EQUAL( sal_uInt32( 0 ), aDavOpt.getRequestedTimeLife() );
168 CPPUNIT_ASSERT_EQUAL( true, aDavOpt.getURL().isEmpty() );
169 CPPUNIT_ASSERT_EQUAL( true, aDavOpt.getRedirectedURL().isEmpty() );
170 CPPUNIT_ASSERT_EQUAL( sal_uInt16( 0 ), aDavOpt.getHttpResponseStatusCode() );
171 CPPUNIT_ASSERT_EQUAL( true, aDavOpt.getHttpResponseStatusText().isEmpty() );
173 aAllowedMethods.clear();
174 aDavOpt.setAllowedMethods( aAllowedMethods );
175 aDavOpt.setStaleTime( 12345678 );
176 CPPUNIT_ASSERT_EQUAL( false, aDavOpt.isClass1() );
177 CPPUNIT_ASSERT_EQUAL( false, aDavOpt.isClass2() );
178 CPPUNIT_ASSERT_EQUAL( false, aDavOpt.isClass3() );
179 CPPUNIT_ASSERT_EQUAL( true, aDavOpt.isHeadAllowed() );
180 CPPUNIT_ASSERT_EQUAL( false, aDavOpt.isLockAllowed() );
181 CPPUNIT_ASSERT_EQUAL( true, aDavOpt.getAllowedMethods().isEmpty() );
182 CPPUNIT_ASSERT_EQUAL( sal_uInt32( 12345678 ), aDavOpt.getStaleTime() );
183 CPPUNIT_ASSERT_EQUAL( sal_uInt32( 0 ), aDavOpt.getRequestedTimeLife() );
184 CPPUNIT_ASSERT_EQUAL( true, aDavOpt.getURL().isEmpty() );
185 CPPUNIT_ASSERT_EQUAL( true, aDavOpt.getRedirectedURL().isEmpty() );
186 CPPUNIT_ASSERT_EQUAL( sal_uInt16( 0 ), aDavOpt.getHttpResponseStatusCode() );
187 CPPUNIT_ASSERT_EQUAL( true, aDavOpt.getHttpResponseStatusText().isEmpty() );
189 aDavOpt.setStaleTime( 0 );
191 aDavOpt.setRequestedTimeLife( 300 );
192 CPPUNIT_ASSERT_EQUAL( false, aDavOpt.isClass1() );
193 CPPUNIT_ASSERT_EQUAL( false, aDavOpt.isClass2() );
194 CPPUNIT_ASSERT_EQUAL( false, aDavOpt.isClass3() );
195 CPPUNIT_ASSERT_EQUAL( true, aDavOpt.isHeadAllowed() );
196 CPPUNIT_ASSERT_EQUAL( false, aDavOpt.isLockAllowed() );
197 CPPUNIT_ASSERT_EQUAL( true, aDavOpt.getAllowedMethods().isEmpty() );
198 CPPUNIT_ASSERT_EQUAL( sal_uInt32( 0 ), aDavOpt.getStaleTime() );
199 CPPUNIT_ASSERT_EQUAL( sal_uInt32( 300 ), aDavOpt.getRequestedTimeLife() );
200 CPPUNIT_ASSERT_EQUAL( true, aDavOpt.getURL().isEmpty() );
201 CPPUNIT_ASSERT_EQUAL( true, aDavOpt.getRedirectedURL().isEmpty() );
202 CPPUNIT_ASSERT_EQUAL( sal_uInt16( 0 ), aDavOpt.getHttpResponseStatusCode() );
203 CPPUNIT_ASSERT_EQUAL( true, aDavOpt.getHttpResponseStatusText().isEmpty() );
205 aDavOpt.setRequestedTimeLife( 0 );
207 OUString aHTTPResponseStatusText = "522 Origin Connection Time-out";
208 aDavOpt.setHttpResponseStatusCode( 522 );
209 aDavOpt.setHttpResponseStatusText( aHTTPResponseStatusText );
210 CPPUNIT_ASSERT_EQUAL( false, aDavOpt.isClass1() );
211 CPPUNIT_ASSERT_EQUAL( false, aDavOpt.isClass2() );
212 CPPUNIT_ASSERT_EQUAL( false, aDavOpt.isClass3() );
213 CPPUNIT_ASSERT_EQUAL( true, aDavOpt.getAllowedMethods().isEmpty() );
214 CPPUNIT_ASSERT_EQUAL( false, aDavOpt.isLockAllowed() );
215 CPPUNIT_ASSERT_EQUAL( true , aDavOpt.getURL().isEmpty() );
216 CPPUNIT_ASSERT_EQUAL( true, aDavOpt.getRedirectedURL().isEmpty() );
217 CPPUNIT_ASSERT_EQUAL( sal_uInt32( 0 ), aDavOpt.getStaleTime() );
218 CPPUNIT_ASSERT_EQUAL( sal_uInt32( 0 ), aDavOpt.getRequestedTimeLife() );
219 CPPUNIT_ASSERT_EQUAL( sal_uInt16( 522 ), aDavOpt.getHttpResponseStatusCode() );
220 CPPUNIT_ASSERT_EQUAL( aHTTPResponseStatusText, aDavOpt.getHttpResponseStatusText() );
222 aDavOpt.setHttpResponseStatusCode( 0 );
223 aHTTPResponseStatusText.clear();
224 aDavOpt.setHttpResponseStatusText( aHTTPResponseStatusText );
226 OUString aURL = "http://my.server.org/a%20fake%20url/to%20test";
227 aDavOpt.setURL( aURL );
228 CPPUNIT_ASSERT_EQUAL( false, aDavOpt.isClass1() );
229 CPPUNIT_ASSERT_EQUAL( false, aDavOpt.isClass2() );
230 CPPUNIT_ASSERT_EQUAL( false, aDavOpt.isClass3() );
231 CPPUNIT_ASSERT_EQUAL( true, aDavOpt.isHeadAllowed() );
232 CPPUNIT_ASSERT_EQUAL( false, aDavOpt.isLockAllowed() );
233 CPPUNIT_ASSERT_EQUAL( true, aDavOpt.getAllowedMethods().isEmpty() );
234 CPPUNIT_ASSERT_EQUAL( sal_uInt32( 0 ), aDavOpt.getStaleTime() );
235 CPPUNIT_ASSERT_EQUAL( sal_uInt32( 0 ), aDavOpt.getRequestedTimeLife() );
236 CPPUNIT_ASSERT_EQUAL( aURL, aDavOpt.getURL() );
237 CPPUNIT_ASSERT_EQUAL( true, aDavOpt.getRedirectedURL().isEmpty() );
238 CPPUNIT_ASSERT_EQUAL( sal_uInt16( 0 ), aDavOpt.getHttpResponseStatusCode() );
239 CPPUNIT_ASSERT_EQUAL( true, aDavOpt.getHttpResponseStatusText().isEmpty() );
241 aURL.clear();
242 aDavOpt.setURL( aURL );
243 aURL = "http://my.server.org/a%20fake%20url/to%20test/another-url";
244 aDavOpt.setRedirectedURL( aURL );
245 CPPUNIT_ASSERT_EQUAL( false, aDavOpt.isClass1() );
246 CPPUNIT_ASSERT_EQUAL( false, aDavOpt.isClass2() );
247 CPPUNIT_ASSERT_EQUAL( false, aDavOpt.isClass3() );
248 CPPUNIT_ASSERT_EQUAL( true, aDavOpt.isHeadAllowed() );
249 CPPUNIT_ASSERT_EQUAL( false, aDavOpt.isLockAllowed() );
250 CPPUNIT_ASSERT_EQUAL( true, aDavOpt.getAllowedMethods().isEmpty() );
251 CPPUNIT_ASSERT_EQUAL( sal_uInt32( 0 ), aDavOpt.getStaleTime() );
252 CPPUNIT_ASSERT_EQUAL( sal_uInt32( 0 ), aDavOpt.getRequestedTimeLife() );
253 CPPUNIT_ASSERT_EQUAL( true, aDavOpt.getURL().isEmpty() );
254 CPPUNIT_ASSERT_EQUAL( aURL, aDavOpt.getRedirectedURL() );
255 CPPUNIT_ASSERT_EQUAL( sal_uInt16( 0 ), aDavOpt.getHttpResponseStatusCode() );
256 CPPUNIT_ASSERT_EQUAL( true, aDavOpt.getHttpResponseStatusText().isEmpty() );
258 //check the init() function
259 aAllowedMethods = "OPTIONS,GET,HEAD,POST,DELETE,TRACE,PROPFIND,PROPPATCH,COPY,MOVE,PUT,LOCK,UNLOCK";
260 aURL = "http://my.server.org/a%20fake%20url/to%20test/another-url";
261 aHTTPResponseStatusText = "404 Not Found";
262 aDavOpt.setClass1();
263 aDavOpt.setClass2();
264 aDavOpt.setClass3();
265 aDavOpt.setHeadAllowed( false );
266 aDavOpt.setLocked();
267 aDavOpt.setAllowedMethods( aAllowedMethods );
268 aDavOpt.setStaleTime( 1234567 );
269 aDavOpt.setRequestedTimeLife( 300 );
270 aDavOpt.setURL( aURL );
271 aDavOpt.setRedirectedURL( aURL );
272 aDavOpt.setHttpResponseStatusCode( 404 );
273 aDavOpt.setHttpResponseStatusText( aHTTPResponseStatusText );
275 aDavOpt.init();
276 DAVTypesCheckInit( aDavOpt );
277 // equality check
278 DAVOptions aDavOptTarget;
279 CPPUNIT_ASSERT_EQUAL( true , aDavOpt == aDavOptTarget );
281 aDavOpt.setClass1();
282 CPPUNIT_ASSERT_EQUAL( false , aDavOpt == aDavOptTarget );
283 aDavOpt.setClass1( false );
284 CPPUNIT_ASSERT_EQUAL( true , aDavOpt == aDavOptTarget );
286 aDavOpt.setClass2();
287 CPPUNIT_ASSERT_EQUAL( false , aDavOpt == aDavOptTarget );
288 aDavOpt.setClass2( false );
289 CPPUNIT_ASSERT_EQUAL( true , aDavOpt == aDavOptTarget );
291 aDavOpt.setClass3();
292 CPPUNIT_ASSERT_EQUAL( false , aDavOpt == aDavOptTarget );
293 aDavOpt.setClass3( false );
294 CPPUNIT_ASSERT_EQUAL( true , aDavOpt == aDavOptTarget );
296 aDavOpt.setHeadAllowed( false );
297 CPPUNIT_ASSERT_EQUAL( false , aDavOpt == aDavOptTarget );
298 aDavOpt.setHeadAllowed();
299 CPPUNIT_ASSERT_EQUAL( true , aDavOpt == aDavOptTarget );
301 aDavOpt.setLocked();
302 CPPUNIT_ASSERT_EQUAL( false , aDavOpt == aDavOptTarget );
303 aDavOpt.setLocked( false );
304 CPPUNIT_ASSERT_EQUAL( true , aDavOpt == aDavOptTarget );
306 aDavOpt.setStaleTime( 1234567 );
307 CPPUNIT_ASSERT_EQUAL( false , aDavOpt == aDavOptTarget );
308 aDavOpt.setStaleTime( 0 );
309 CPPUNIT_ASSERT_EQUAL( true , aDavOpt == aDavOptTarget );
311 aDavOpt.setRequestedTimeLife( 1234567 );
312 CPPUNIT_ASSERT_EQUAL( false , aDavOpt == aDavOptTarget );
313 aDavOpt.setRequestedTimeLife( 0 );
314 CPPUNIT_ASSERT_EQUAL( true , aDavOpt == aDavOptTarget );
316 aDavOpt.setHttpResponseStatusCode( 404 );
317 CPPUNIT_ASSERT_EQUAL( false , aDavOpt == aDavOptTarget );
318 aDavOpt.setHttpResponseStatusCode( 0 );
319 CPPUNIT_ASSERT_EQUAL( true , aDavOpt == aDavOptTarget );
321 aDavOpt.setAllowedMethods( aAllowedMethods );
322 CPPUNIT_ASSERT_EQUAL( false , aDavOpt == aDavOptTarget );
323 aAllowedMethods.clear();
324 aDavOpt.setAllowedMethods( aAllowedMethods );
325 CPPUNIT_ASSERT_EQUAL( true , aDavOpt == aDavOptTarget );
327 aDavOpt.setURL( aURL );
328 CPPUNIT_ASSERT_EQUAL( false , aDavOpt == aDavOptTarget );
329 aURL.clear();
330 aDavOpt.setURL( aURL );
331 CPPUNIT_ASSERT_EQUAL( true , aDavOpt == aDavOptTarget );
333 aDavOpt.setHttpResponseStatusText( aHTTPResponseStatusText );
334 CPPUNIT_ASSERT_EQUAL( false , aDavOpt == aDavOptTarget );
335 aHTTPResponseStatusText.clear();
336 aDavOpt.setHttpResponseStatusText( aHTTPResponseStatusText );
337 CPPUNIT_ASSERT_EQUAL( true , aDavOpt == aDavOptTarget );
341 void webdav_opts_test::DAVOptsCacheTests()
343 // define a local cache to test
344 DAVOptionsCache aDAVOptsCache;
345 // the value to cache
346 DAVOptions aDavOpt;
347 // the returned value to test
348 DAVOptions aDavOptCached;
349 // init the values
350 OUString aAllowedMethods = "OPTIONS,GET,HEAD,POST,DELETE,TRACE,PROPFIND,PROPPATCH,COPY,MOVE,PUT,LOCK,UNLOCK";
351 OUString aURL = "http://my.server.org/a%20fake%20url/to%20test/another-url";
352 OUString aRedirectedURL = "http://my.server.org/a%20fake%20url/to%20test/another-url/redirected";
353 aDavOpt.setURL( aURL );
354 aDavOpt.setRedirectedURL( aRedirectedURL );
355 aDavOpt.setClass1();
356 aDavOpt.setClass2();
357 aDavOpt.setClass3();
358 aDavOpt.setHeadAllowed( false );
359 aDavOpt.setAllowedMethods( aAllowedMethods );
360 // add to cache
361 aDAVOptsCache.addDAVOptions( aDavOpt, 30000 );
362 CPPUNIT_ASSERT_EQUAL( true ,aDAVOptsCache.getDAVOptions( aURL, aDavOptCached ) );
363 CPPUNIT_ASSERT_EQUAL( true , aDavOpt == aDavOptCached );
366 CPPUNIT_TEST_SUITE_REGISTRATION( webdav_opts_test );
367 } // namespace rtl_random
369 CPPUNIT_PLUGIN_IMPLEMENT();
371 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */