aboutsummaryrefslogtreecommitdiffstats
path: root/searchsummary/src/tests/juniper/testenv.h
blob: a43f4a11bec92350a968a6099bb3f7fc9c0cfbaf (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
64
65
66
67
68
69
70
// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#pragma once

/* Include most of the stuff that we might need */

#include <vespa/fastlib/text/unicodeutil.h>
#include <vespa/fastlib/text/normwordfolder.h>
#include <vespa/juniper/query.h>
#include <vespa/juniper/juniperdebug.h>
#include <vespa/juniper/rpinterface.h>
#include <vespa/juniper/queryhandle.h>
#include <vespa/juniper/queryparser.h>
#include <vespa/juniper/queryvisitor.h>
#include <vespa/juniper/result.h>
#include <vespa/juniper/config.h>
#include <vespa/juniper/queryparser.h>
#include <vespa/juniper/matchobject.h>
#include <vespa/juniper/SummaryConfig.h>
#include <vespa/juniper/Matcher.h>
#include <vespa/juniper/mcand.h>
#include <vespa/juniper/propreader.h>
#include <vespa/juniper/specialtokenregistry.h>

namespace juniper
{

class TestEnv
{
public:
    TestEnv(int argc, char **argv, const char* propfile);
    virtual ~TestEnv();
    void Usage(char* s);
private:
    std::unique_ptr<PropReader> _props;
    std::unique_ptr<Config>     _config;
    std::unique_ptr<Juniper>    _juniper;
    Fast_NormalizeWordFolder    _wordFolder;
    TestEnv(const TestEnv&);
    TestEnv& operator=(const TestEnv&);
};


class TestQuery
{
public:
    TestQuery(const char* qexp, const char* options = NULL);
    QueryParser _qparser;
    QueryHandle _qhandle;
};


class PropertyMap : public IJuniperProperties
{
private:
    std::map<std::string, std::string> _map;
public:
    PropertyMap();
    ~PropertyMap();
    PropertyMap &set(const char *name, const char *value);
    const char* GetProperty(const char* name, const char* def = NULL) override;
};


extern Config* TestConfig;
extern Juniper * _Juniper;

} // end namespace juniper

typedef juniper::TestQuery TestQuery;