]> git.ipfire.org Git - thirdparty/squid.git/blame - src/tests/testStore.h
SourceFormat Enforcement
[thirdparty/squid.git] / src / tests / testStore.h
CommitLineData
4e0938ef 1/*
bde978a6 2 * Copyright (C) 1996-2015 The Squid Software Foundation and contributors
4e0938ef
AJ
3 *
4 * Squid software is distributed under GPLv2+ license and includes
5 * contributions from numerous individuals and organizations.
6 * Please see the COPYING and CONTRIBUTORS files for details.
7 */
c8f4eac4 8
9#ifndef SQUID_SRC_TEST_STORE_H
10#define SQUID_SRC_TEST_STORE_H
11
c21ad0f5 12#include "Store.h"
13
c8f4eac4 14#include <cppunit/extensions/HelperMacros.h>
15
16/*
17 * test the store framework
18 */
19
20class testStore : public CPPUNIT_NS::TestFixture
21{
22 CPPUNIT_TEST_SUITE( testStore );
23 CPPUNIT_TEST( testSetRoot );
24 CPPUNIT_TEST( testUnsetRoot );
25 CPPUNIT_TEST( testStats );
26 CPPUNIT_TEST( testMaxSize );
27 CPPUNIT_TEST_SUITE_END();
28
29public:
30
31protected:
32 void testSetRoot();
33 void testUnsetRoot();
34 void testStats();
35 void testMaxSize();
36};
37
c21ad0f5 38/* subclass of Store to allow testing of methods without having all the
39 * other components live
40 */
41
42class TestStore : public Store
43{
44
45public:
46 TestStore() : statsCalled (false) {}
47
48 bool statsCalled;
49
50 virtual int callback();
51
081edc2d 52 virtual StoreEntry* get(const cache_key*);
c21ad0f5 53
081edc2d 54 virtual void get(String, void (*)(StoreEntry*, void*), void*);
c21ad0f5 55
56 virtual void init();
57
26ac0430 58 virtual void maintain() {};
c21ad0f5 59
12e11a5c 60 virtual uint64_t maxSize() const;
c21ad0f5 61
12e11a5c 62 virtual uint64_t minSize() const;
c21ad0f5 63
d5d5493b
DK
64 virtual uint64_t currentSize() const;
65
66 virtual uint64_t currentCount() const;
67
68 virtual int64_t maxObjectSize() const;
69
93bc1434
AR
70 virtual void getStats(StoreInfoStats &) const;
71
c21ad0f5 72 virtual void stat(StoreEntry &) const; /* output stats to the provided store entry */
73
f53969cc 74 virtual void reference(StoreEntry &) {} /* Reference this object */
c21ad0f5 75
54347cbd 76 virtual bool dereference(StoreEntry &, bool) { return true; }
c21ad0f5 77
30abd221 78 virtual StoreSearch *search(String const url, HttpRequest *);
c21ad0f5 79};
80
81typedef RefCount<TestStore> TestStorePointer;
82
c8f4eac4 83#endif
84