]> git.ipfire.org Git - thirdparty/squid.git/blame - src/tests/testStore.h
Renamed squid.h to squid-old.h and config.h to squid.h
[thirdparty/squid.git] / src / tests / testStore.h
CommitLineData
c8f4eac4 1
2#ifndef SQUID_SRC_TEST_STORE_H
3#define SQUID_SRC_TEST_STORE_H
4
f7f3304a 5#include "squid-old.h"
c21ad0f5 6#include "Store.h"
7
c8f4eac4 8#include <cppunit/extensions/HelperMacros.h>
9
c21ad0f5 10
c8f4eac4 11/*
12 * test the store framework
13 */
14
15class 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
24public:
25
26protected:
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
38class TestStore : public Store
39{
40
41public:
42 TestStore() : statsCalled (false) {}
43
44 bool statsCalled;
45
46 virtual int callback();
47
081edc2d 48 virtual StoreEntry* get(const cache_key*);
c21ad0f5 49
081edc2d 50 virtual void get(String, void (*)(StoreEntry*, void*), void*);
c21ad0f5 51
52 virtual void init();
53
26ac0430 54 virtual void maintain() {};
c21ad0f5 55
12e11a5c 56 virtual uint64_t maxSize() const;
c21ad0f5 57
12e11a5c 58 virtual uint64_t minSize() const;
c21ad0f5 59
d5d5493b
DK
60 virtual uint64_t currentSize() const;
61
62 virtual uint64_t currentCount() const;
63
64 virtual int64_t maxObjectSize() const;
65
93bc1434
AR
66 virtual void getStats(StoreInfoStats &) const;
67
c21ad0f5 68 virtual void stat(StoreEntry &) const; /* output stats to the provided store entry */
69
26ac0430 70 virtual void reference(StoreEntry &) {} /* Reference this object */
c21ad0f5 71
4c973beb 72 virtual bool dereference(StoreEntry &) { return true; }
c21ad0f5 73
30abd221 74 virtual StoreSearch *search(String const url, HttpRequest *);
c21ad0f5 75};
76
77typedef RefCount<TestStore> TestStorePointer;
78
79
c8f4eac4 80#endif
81