]> git.ipfire.org Git - thirdparty/squid.git/blob - src/tests/testStore.h
Enable source-formatting tools to collapse multiple whitelines in the source to one.
[thirdparty/squid.git] / src / tests / testStore.h
1
2 #ifndef SQUID_SRC_TEST_STORE_H
3 #define SQUID_SRC_TEST_STORE_H
4
5 #include "Store.h"
6
7 #include <cppunit/extensions/HelperMacros.h>
8
9
10 /*
11 * test the store framework
12 */
13
14 class testStore : public CPPUNIT_NS::TestFixture
15 {
16 CPPUNIT_TEST_SUITE( testStore );
17 CPPUNIT_TEST( testSetRoot );
18 CPPUNIT_TEST( testUnsetRoot );
19 CPPUNIT_TEST( testStats );
20 CPPUNIT_TEST( testMaxSize );
21 CPPUNIT_TEST_SUITE_END();
22
23 public:
24
25 protected:
26 void testSetRoot();
27 void testUnsetRoot();
28 void testStats();
29 void testMaxSize();
30 };
31
32
33 /* subclass of Store to allow testing of methods without having all the
34 * other components live
35 */
36
37 class TestStore : public Store
38 {
39
40 public:
41 TestStore() : statsCalled (false) {}
42
43 bool statsCalled;
44
45 virtual int callback();
46
47 virtual StoreEntry* get(const cache_key*);
48
49 virtual void get(String, void (*)(StoreEntry*, void*), void*);
50
51 virtual void init();
52
53 virtual void maintain() {};
54
55 virtual uint64_t maxSize() const;
56
57 virtual uint64_t minSize() const;
58
59 virtual uint64_t currentSize() const;
60
61 virtual uint64_t currentCount() const;
62
63 virtual int64_t maxObjectSize() const;
64
65 virtual void getStats(StoreInfoStats &) const;
66
67 virtual void stat(StoreEntry &) const; /* output stats to the provided store entry */
68
69 virtual void reference(StoreEntry &) {} /* Reference this object */
70
71 virtual bool dereference(StoreEntry &) { return true; }
72
73 virtual StoreSearch *search(String const url, HttpRequest *);
74 };
75
76 typedef RefCount<TestStore> TestStorePointer;
77
78
79 #endif
80