]>
git.ipfire.org Git - thirdparty/squid.git/blob - src/tests/testStore.h
2 * Copyright (C) 1996-2017 The Squid Software Foundation and contributors
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.
9 #ifndef SQUID_SRC_TEST_STORE_H
10 #define SQUID_SRC_TEST_STORE_H
13 #include "store/Controlled.h"
15 #include <cppunit/extensions/HelperMacros.h>
18 * test the store framework
21 class testStore
: public CPPUNIT_NS::TestFixture
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();
39 /// allows testing of methods without having all the other components live
40 class TestStore
: public Store::Controller
44 TestStore() : statsCalled (false) {}
48 virtual int callback();
50 virtual StoreEntry
* get(const cache_key
*);
52 virtual void get(String
, void (*)(StoreEntry
*, void*), void*);
56 virtual void maintain() {};
58 virtual uint64_t maxSize() const;
60 virtual uint64_t minSize() const;
62 virtual uint64_t currentSize() const;
64 virtual uint64_t currentCount() const;
66 virtual int64_t maxObjectSize() const;
68 virtual void getStats(StoreInfoStats
&) const;
70 virtual void stat(StoreEntry
&) const; /* output stats to the provided store entry */
72 virtual void reference(StoreEntry
&) {} /* Reference this object */
74 virtual bool dereference(StoreEntry
&) { return true; }
76 virtual StoreSearch
*search();
79 typedef RefCount
<TestStore
> TestStorePointer
;