1
0
Fork 0

expose registerViewImplementation to the outside world

This commit is contained in:
jsteemann 2017-03-16 13:00:33 +01:00
parent 187102f223
commit 060fe10d53
3 changed files with 9 additions and 5 deletions

View File

@ -53,7 +53,7 @@ describe ArangoDB do
doc.parsed_response['errorNum'].should eq(400)
end
it "creating a view invalid type" do
it "creating a view with invalid type" do
cmd = api
body = <<-END
{ "name": "test",

View File

@ -39,17 +39,19 @@ ViewTypesFeature::ViewTypesFeature(ApplicationServer* server)
}
void ViewTypesFeature::prepare() {
ViewCreator creator = [](LogicalView*, PhysicalView*, arangodb::velocypack::Slice const&) {
registerViewImplementation("test", [](LogicalView*, PhysicalView*, arangodb::velocypack::Slice const&) {
return std::unique_ptr<ViewImplementation>();
};
_viewCreators.emplace("test", creator);
});
}
void ViewTypesFeature::unprepare() {
_viewCreators.clear();
}
void ViewTypesFeature::registerViewImplementation(std::string const& type, ViewCreator creator) {
_viewCreators.emplace(type, creator);
}
bool ViewTypesFeature::isValidType(std::string const& type) const {
return (_viewCreators.find(type) != _viewCreators.end());
}

View File

@ -37,6 +37,8 @@ class ViewTypesFeature final
void prepare() override final;
void unprepare() override final;
void registerViewImplementation(std::string const& type, ViewCreator creator);
bool isValidType(std::string const& type) const;
ViewCreator& creator(std::string const& type) const;