]>
git.ipfire.org Git - thirdparty/squid.git/blob - src/tests/testCacheManager.cc
2 #include "CacheManager.h"
4 #include "mgr/Action.h"
6 #include "testCacheManager.h"
8 #include <cppunit/TestAssert.h>
10 CPPUNIT_TEST_SUITE_REGISTRATION( testCacheManager
);
12 /* init memory pools */
14 void testCacheManager::setUp()
20 * Test creating a CacheManager
23 testCacheManager::testCreate()
25 CacheManager::GetInstance(); //it's a singleton..
28 /* an action to register */
30 dummy_action(StoreEntry
* sentry
)
36 * registering an action makes it findable.
39 testCacheManager::testRegister()
41 CacheManager
*manager
=CacheManager::GetInstance();
42 CPPUNIT_ASSERT(manager
!= NULL
);
44 manager
->registerProfile("sample", "my sample", &dummy_action
, false, false);
45 Mgr::Action::Pointer action
= manager
->createNamedAction("sample");
46 CPPUNIT_ASSERT(action
!= NULL
);
48 const Mgr::ActionProfile::Pointer profile
= action
->command().profile
;
49 CPPUNIT_ASSERT(profile
!= NULL
);
50 CPPUNIT_ASSERT(profile
->creator
!= NULL
);
51 CPPUNIT_ASSERT_EQUAL(false, profile
->isPwReq
);
52 CPPUNIT_ASSERT_EQUAL(false, profile
->isAtomic
);
53 CPPUNIT_ASSERT_EQUAL(String("sample"), String(action
->name()));
55 StoreEntry
*sentry
=new StoreEntry();
56 sentry
->flags
=0x25; //arbitrary test value
57 action
->run(sentry
, false);
58 CPPUNIT_ASSERT_EQUAL(1,(int)sentry
->flags
);