summaryrefslogtreecommitdiffstats
path: root/searchcorespi/src/tests/plugin/plugin_test.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'searchcorespi/src/tests/plugin/plugin_test.cpp')
-rw-r--r--searchcorespi/src/tests/plugin/plugin_test.cpp32
1 files changed, 32 insertions, 0 deletions
diff --git a/searchcorespi/src/tests/plugin/plugin_test.cpp b/searchcorespi/src/tests/plugin/plugin_test.cpp
new file mode 100644
index 00000000000..34692b4ed7b
--- /dev/null
+++ b/searchcorespi/src/tests/plugin/plugin_test.cpp
@@ -0,0 +1,32 @@
+// Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
+#include <vespa/fastos/fastos.h>
+#include <vespa/vespalib/testkit/testapp.h>
+#include <vespa/searchcorespi/plugin/factoryloader.h>
+#include <vespa/log/log.h>
+LOG_SETUP("factory_test");
+
+using namespace searchcorespi;
+
+namespace {
+TEST("require that plugins can be loaded.") {
+ FactoryLoader fl;
+ IIndexManagerFactory::UP f = fl.create("searchcorespi_tplugin");
+ ASSERT_TRUE(f.get());
+}
+
+TEST("require that non-existent plugin causes failure") {
+ FactoryLoader fl;
+ EXPECT_EXCEPTION(fl.create("no-such-plugin"),
+ vespalib::IllegalArgumentException,
+ "cannot open shared object file");
+}
+
+TEST("require that missing factory function causes failure") {
+ FactoryLoader fl;
+ EXPECT_EXCEPTION(fl.create("searchcorespi_illegal-plugin"),
+ vespalib::IllegalArgumentException,
+ "Failed locating symbol 'createIndexManagerFactory'");
+}
+} // namespace
+
+TEST_MAIN() { TEST_RUN_ALL(); }