summaryrefslogtreecommitdiffstats
path: root/persistence/src/tests/proxy/external_providerproxy_conformancetest.cpp
blob: adf7a84dbd40eb25bf2ca06430125bb5c89b2386 (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
// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.

#include "proxyfactory.h"
#include <vespa/vespalib/testkit/test_kit.h>
#include <vespa/document/repo/documenttyperepo.h>
#include <vespa/persistence/conformancetest/conformancetest.h>
#include <vespa/persistence/proxy/providerproxy.h>
#include <vespa/persistence/proxy/providerstub.h>

using namespace storage::spi;
typedef document::DocumentTypeRepo Repo;
typedef ConformanceTest::PersistenceFactory Factory;

namespace {

struct ConformanceFixture : public ConformanceTest {
    ConformanceFixture(Factory::UP f) : ConformanceTest(std::move(f)) { setUp(); }
    ~ConformanceFixture() { tearDown(); }
};

Factory::UP getFactory() {
    return Factory::UP(new ProxyFactory());
}

#define CONVERT_TEST(testFunction, makeFactory)                                             \
namespace ns_ ## testFunction {                                                             \
TEST_F(TEST_STR(testFunction) " " TEST_STR(makeFactory), ConformanceFixture(makeFactory)) { \
    f.testFunction();                                                                       \
}                                                                                           \
} // namespace testFunction

#undef CPPUNIT_TEST
#define CPPUNIT_TEST(testFunction) CONVERT_TEST(testFunction, MAKE_FACTORY)

#define MAKE_FACTORY getFactory()
DEFINE_CONFORMANCE_TESTS();

}  // namespace

TEST_MAIN() {
    TEST_RUN_ALL();
}