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