]>
Commit | Line | Data |
---|---|---|
c8f4eac4 | 1 | |
2 | #ifndef SQUID_SRC_TEST_STORE_H | |
3 | #define SQUID_SRC_TEST_STORE_H | |
4 | ||
c21ad0f5 | 5 | #include "squid.h" |
6 | #include "Store.h" | |
7 | ||
c8f4eac4 | 8 | #include <cppunit/extensions/HelperMacros.h> |
9 | ||
c21ad0f5 | 10 | |
c8f4eac4 | 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 | ||
c21ad0f5 | 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 | |
26ac0430 | 49 | (const cache_key*); |
c21ad0f5 | 50 | |
51 | virtual void get | |
26ac0430 | 52 | (String, void (*)(StoreEntry*, void*), void*); |
c21ad0f5 | 53 | |
54 | virtual void init(); | |
55 | ||
26ac0430 | 56 | virtual void maintain() {}; |
c21ad0f5 | 57 | |
12e11a5c | 58 | virtual uint64_t maxSize() const; |
c21ad0f5 | 59 | |
12e11a5c | 60 | virtual uint64_t minSize() const; |
c21ad0f5 | 61 | |
62 | virtual void stat(StoreEntry &) const; /* output stats to the provided store entry */ | |
63 | ||
26ac0430 | 64 | virtual void reference(StoreEntry &) {} /* Reference this object */ |
c21ad0f5 | 65 | |
4c973beb | 66 | virtual bool dereference(StoreEntry &) { return true; } |
c21ad0f5 | 67 | |
30abd221 | 68 | virtual StoreSearch *search(String const url, HttpRequest *); |
c21ad0f5 | 69 | }; |
70 | ||
71 | typedef RefCount<TestStore> TestStorePointer; | |
72 | ||
73 | ||
c8f4eac4 | 74 | #endif |
75 |