summaryrefslogtreecommitdiffstats
path: root/searchcorespi/src/tests/plugin/factoryregistry_test.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'searchcorespi/src/tests/plugin/factoryregistry_test.cpp')
-rw-r--r--searchcorespi/src/tests/plugin/factoryregistry_test.cpp59
1 files changed, 0 insertions, 59 deletions
diff --git a/searchcorespi/src/tests/plugin/factoryregistry_test.cpp b/searchcorespi/src/tests/plugin/factoryregistry_test.cpp
deleted file mode 100644
index 10a1c95f191..00000000000
--- a/searchcorespi/src/tests/plugin/factoryregistry_test.cpp
+++ /dev/null
@@ -1,59 +0,0 @@
-// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
-
-#include <vespa/searchcorespi/plugin/factoryregistry.h>
-#include <vespa/searchcorespi/plugin/iindexmanagerfactory.h>
-#include <vespa/vespalib/stllike/string.h>
-#include <vespa/vespalib/testkit/testapp.h>
-#include <vespa/vespalib/util/exceptions.h>
-
-using vespalib::string;
-using namespace searchcorespi;
-
-namespace {
-
-struct MyFactory : IIndexManagerFactory {
-
- virtual IIndexManager::UP createIndexManager(const IndexManagerConfig &,
- const index::IndexMaintainerConfig &,
- const index::IndexMaintainerContext &) override {
- return IIndexManager::UP();
- }
- virtual config::ConfigKeySet getConfigKeys(
- const string &,
- const search::index::Schema &,
- const config::ConfigInstance &) override {
- return config::ConfigKeySet();
- }
-};
-
-const string name = "factory";
-
-TEST("require that factories can be added and removed") {
- FactoryRegistry registry;
- EXPECT_FALSE(registry.isRegistered(name));
- registry.add(name, IIndexManagerFactory::SP(new MyFactory));
- EXPECT_TRUE(registry.get(name).get());
- EXPECT_TRUE(registry.isRegistered(name));
- registry.remove(name);
- EXPECT_EXCEPTION(registry.get(name), vespalib::IllegalArgumentException,
- "No factory is registered with the name");
-}
-
-TEST("require that two factories with the same name cannot be added") {
- FactoryRegistry registry;
- registry.add(name, IIndexManagerFactory::SP(new MyFactory));
- EXPECT_EXCEPTION(
- registry.add(name, IIndexManagerFactory::SP(new MyFactory)),
- vespalib::IllegalArgumentException,
- "A factory is already registered with the same name");
-}
-
-TEST("require that a non-existent factory cannot be removed") {
- FactoryRegistry registry;
- EXPECT_EXCEPTION(registry.remove(name), vespalib::IllegalArgumentException,
- "No factory is registered with the name");
-}
-
-} // namespace
-
-TEST_MAIN() { TEST_RUN_ALL(); }