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