blob: d228dace1edaacdec84cf8815a1a4ea96fdf47d8 (
plain) (
blame)
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
|
// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
/**
* \class storage::TestComponentRegister
* \ingroup component
*
* \brief Simple instance to use for testing.
*
* For testing we just want to set up a simple component register with the basic
* services that tests need, and that all tests need the same instance of.
*
* This instance should be the same for all using it. So don't add set functions
* that can possibly alter it while running.
*/
#pragma once
#include "componentregisterimpl.h"
#include <vespa/storageframework/defaultimplementation/thread/threadpoolimpl.h>
#include <vespa/storageframework/defaultimplementation/clock/fakeclock.h>
namespace storage::framework::defaultimplementation {
class TestComponentRegister {
ComponentRegisterImpl::UP _compReg;
FakeClock _clock;
ThreadPoolImpl _threadPool;
public:
explicit TestComponentRegister(ComponentRegisterImpl::UP compReg);
virtual ~TestComponentRegister();
virtual ComponentRegisterImpl& getComponentRegister() { return *_compReg; }
FakeClock& getClock() { return _clock; }
ThreadPoolImpl& getThreadPoolImpl() { return _threadPool; }
FastOS_ThreadPool& getThreadPool() { return _threadPool.getThreadPool(); }
};
}
|