~clint-fewbar/ubuntu/precise/squid3/ignore-sighup-early

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
#ifndef SQUID_SRC_TEST_STORE_H
#define SQUID_SRC_TEST_STORE_H

#include "squid.h"
#include "Store.h"

#include <cppunit/extensions/HelperMacros.h>


/*
 * test the store framework
 */

class testStore : public CPPUNIT_NS::TestFixture
{
    CPPUNIT_TEST_SUITE( testStore );
    CPPUNIT_TEST( testSetRoot );
    CPPUNIT_TEST( testUnsetRoot );
    CPPUNIT_TEST( testStats );
    CPPUNIT_TEST( testMaxSize );
    CPPUNIT_TEST_SUITE_END();

public:

protected:
    void testSetRoot();
    void testUnsetRoot();
    void testStats();
    void testMaxSize();
};


/* subclass of Store to allow testing of methods without having all the
 * other components live
 */

class TestStore : public Store
{

public:
    TestStore() : statsCalled (false) {}

    bool statsCalled;

    virtual int callback();

    virtual StoreEntry* get
    (const cache_key*);

    virtual void get
    (String, void (*)(StoreEntry*, void*), void*);

    virtual void init();

    virtual void maintain() {};

    virtual size_t maxSize() const;

    virtual size_t minSize() const;

    virtual void stat(StoreEntry &) const; /* output stats to the provided store entry */

    virtual void reference(StoreEntry &) {}	/* Reference this object */

    virtual void dereference(StoreEntry &) {}	/* Unreference this object */

    virtual void updateSize(int64_t size, int sign) {}

    virtual StoreSearch *search(String const url, HttpRequest *);
};

typedef RefCount<TestStore> TestStorePointer;


#endif