blob: f85d6e0b87204d7080f94299cae641003929d03e (
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
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
|
// Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#include "memfiletestutils.h"
#include <vespa/persistence/conformancetest/conformancetest.h>
#include <vespa/storageframework/defaultimplementation/memory/simplememorylogic.h>
namespace storage {
namespace memfile {
struct ProviderConformanceTest : public spi::ConformanceTest {
struct Factory : public PersistenceFactory {
framework::defaultimplementation::ComponentRegisterImpl _compRegister;
framework::defaultimplementation::RealClock _clock;
framework::defaultimplementation::MemoryManager _memoryManager;
std::unique_ptr<MemFileCache> cache;
Factory()
: _compRegister(),
_clock(),
_memoryManager(
framework::defaultimplementation::AllocationLogic::UP(
new framework::defaultimplementation::SimpleMemoryLogic(
_clock, 1024 * 1024 * 1024)))
{
_compRegister.setClock(_clock);
_compRegister.setMemoryManager(_memoryManager);
}
spi::PersistenceProvider::UP
getPersistenceImplementation(const document::DocumentTypeRepo::SP& repo,
const document::DocumenttypesConfig&) override
{
system("rm -rf vdsroot");
system("mkdir -p vdsroot/disks/d0");
vdstestlib::DirConfig config(getStandardConfig(true));
MemFilePersistenceProvider::UP result(
new MemFilePersistenceProvider(
_compRegister,
config.getConfigId()));
result->setDocumentRepo(*repo);
return spi::PersistenceProvider::UP(result.release());
}
bool
supportsRevert() const
{
return true;
}
};
ProviderConformanceTest()
: spi::ConformanceTest(PersistenceFactory::UP(new Factory)) {}
CPPUNIT_TEST_SUITE(ProviderConformanceTest);
DEFINE_CONFORMANCE_TESTS();
CPPUNIT_TEST_SUITE_END();
};
CPPUNIT_TEST_SUITE_REGISTRATION(ProviderConformanceTest);
} // memfile
} // storage
|