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

« back to all changes in this revision

Viewing changes to src/tests/testCacheManager.cc

  • Committer: Bazaar Package Importer
  • Author(s): Luigi Gangitano
  • Date: 2009-09-24 14:51:06 UTC
  • mfrom: (1.1.12 upstream)
  • mto: (20.2.1 sid)
  • mto: This revision was merged to the branch mainline in revision 21.
  • Revision ID: james.westby@ubuntu.com-20090924145106-38jgrzmj0d73pha5
Tags: 3.1.0.13-1
* Upload to experimental

* New upstream release
  - Fixes Follow-X-Forwarded-For support (Closes: #523943)
  - Adds IPv6 support (Closes: #432351)

* debian/rules
  - Removed obsolete configuration options
  - Enable db and radius basic authentication modules

* debian/patches/01-cf.data.debian
  - Adapted to new upstream version

* debian/patches/02-makefile-defaults
  - Adapted to new upstream version

* debian/{squid.postinst,squid.rc,README.Debian,watch}
  - Updated references to squid 3.1

* debian/squid3.install
  - Install CSS file for error pages
  - Install manual pages for new authentication modules

* debian/squid3-common.install
  - Install documented version of configuration file in /usr/share/doc/squid3

Show diffs side-by-side

added added

removed removed

Lines of Context:
6
6
#include "Mem.h"
7
7
#include "testCacheManager.h"
8
8
#include "CacheManager.h"
 
9
#include "Store.h"
9
10
 
10
11
 
11
12
CPPUNIT_TEST_SUITE_REGISTRATION( testCacheManager );
34
35
void
35
36
testCacheManager::testCreate()
36
37
{
37
 
    CacheManager();
 
38
    CacheManager::GetInstance(); //it's a singleton..
38
39
}
39
40
 
40
41
/* an action to register */
41
42
static void
42
43
dummy_action(StoreEntry * sentry)
43
 
{}
 
44
{
 
45
    sentry->flags=1;
 
46
}
44
47
 
45
48
/*
46
49
 * registering an action makes it findable.
48
51
void
49
52
testCacheManager::testRegister()
50
53
{
51
 
    CacheManager manager;
52
 
    manager.registerAction("sample", "my sample", &dummy_action, false, false);
53
 
    CacheManagerAction *anAction = manager.findAction("sample");
54
 
    CPPUNIT_ASSERT_EQUAL(String("sample"), String(anAction->action));
55
 
    CPPUNIT_ASSERT_EQUAL(String("my sample"), String(anAction->desc));
56
 
    CPPUNIT_ASSERT_EQUAL(&dummy_action, anAction->handler);
 
54
    CacheManager *manager=CacheManager::GetInstance();
 
55
 
 
56
    manager->registerAction("sample", "my sample", &dummy_action, false, false);
 
57
    CacheManagerAction *anAction = manager->findAction("sample");
 
58
 
57
59
    CPPUNIT_ASSERT_EQUAL(0, (int)anAction->flags.pw_req);
58
60
    CPPUNIT_ASSERT_EQUAL(0, (int)anAction->flags.atomic);
 
61
    CPPUNIT_ASSERT_EQUAL(String("sample"), String(anAction->action));
 
62
 
 
63
    StoreEntry *sentry=new StoreEntry();
 
64
    sentry->flags=0x25; //arbitrary test value
 
65
    anAction->run(sentry);
 
66
    CPPUNIT_ASSERT_EQUAL(1,(int)sentry->flags);
59
67
}