]>
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 | |
49 | (const cache_key*); | |
50 | ||
51 | virtual void get | |
86c0aed6 | 52 | (string, void (*)(StoreEntry*, void*), void*); |
c21ad0f5 | 53 | |
54 | virtual void init(); | |
55 | ||
56 | virtual void maintain() {}; | |
57 | ||
58 | virtual size_t maxSize() const; | |
59 | ||
60 | virtual size_t minSize() const; | |
61 | ||
62 | virtual void stat(StoreEntry &) const; /* output stats to the provided store entry */ | |
63 | ||
64 | virtual void reference(StoreEntry &){} /* Reference this object */ | |
65 | ||
66 | virtual void dereference(StoreEntry &){} /* Unreference this object */ | |
67 | ||
68 | virtual void updateSize(size_t size, int sign) {} | |
69 | ||
86c0aed6 | 70 | virtual StoreSearch *search(string const url, HttpRequest *); |
c21ad0f5 | 71 | }; |
72 | ||
73 | typedef RefCount<TestStore> TestStorePointer; | |
74 | ||
75 | ||
c8f4eac4 | 76 | #endif |
77 |