]> git.ipfire.org Git - thirdparty/squid.git/blame - src/tests/testStore.h
SourceFormat Enforcement
[thirdparty/squid.git] / src / tests / testStore.h
CommitLineData
4e0938ef 1/*
4ac4a490 2 * Copyright (C) 1996-2017 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"
2745fea5 13#include "store/Controlled.h"
c21ad0f5 14
c8f4eac4 15#include <cppunit/extensions/HelperMacros.h>
16
17/*
18 * test the store framework
19 */
20
21class testStore : public CPPUNIT_NS::TestFixture
22{
23 CPPUNIT_TEST_SUITE( testStore );
24 CPPUNIT_TEST( testSetRoot );
25 CPPUNIT_TEST( testUnsetRoot );
26 CPPUNIT_TEST( testStats );
27 CPPUNIT_TEST( testMaxSize );
28 CPPUNIT_TEST_SUITE_END();
29
30public:
31
32protected:
33 void testSetRoot();
34 void testUnsetRoot();
35 void testStats();
36 void testMaxSize();
37};
38
2745fea5
AR
39/// allows testing of methods without having all the other components live
40class TestStore : public Store::Controller
c21ad0f5 41{
42
43public:
44 TestStore() : statsCalled (false) {}
45
46 bool statsCalled;
47
48 virtual int callback();
49
081edc2d 50 virtual StoreEntry* get(const cache_key*);
c21ad0f5 51
081edc2d 52 virtual void get(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
d5d5493b
DK
62 virtual uint64_t currentSize() const;
63
64 virtual uint64_t currentCount() const;
65
66 virtual int64_t maxObjectSize() const;
67
93bc1434
AR
68 virtual void getStats(StoreInfoStats &) const;
69
c21ad0f5 70 virtual void stat(StoreEntry &) const; /* output stats to the provided store entry */
71
f53969cc 72 virtual void reference(StoreEntry &) {} /* Reference this object */
c21ad0f5 73
2745fea5 74 virtual bool dereference(StoreEntry &) { return true; }
c21ad0f5 75
2745fea5 76 virtual StoreSearch *search();
c21ad0f5 77};
78
79typedef RefCount<TestStore> TestStorePointer;
80
c8f4eac4 81#endif
82