1 #include "../../src/plugin_router/plugin_router_factory.h"
3 #include <fruit/fruit.h>
4 #include <gtest/gtest.h>
7 #include <boost/array.hpp>
8 #include <boost/asio.hpp>
13 #include <unordered_map>
15 #include "../../src/plugin_router/binary_plugin_router.h"
16 #include "../../src/plugin_router/json_plugin_router.h"
17 #include "../../src/plugin_router/string_plugin_router.h"
19 using fruit::Component;
20 using fruit::createComponent;
21 using fruit::Injector;
24 TEST(TestSuite, create_binary_plugin_with_factory) {
25 std::shared_ptr<rapidjson::Document> config(
new rapidjson::Document);
27 "[{\"plugin_name\":\"binary_loopback::BinaryLoopback\",\"param\":"
35 auto source = pluginFactory->
Create(
"127.0.0.1", 50000,
"binary", config);
36 auto result = source->TryStart();
39 ASSERT_TRUE(result.is_success);
43 TEST(TestSuite, create_json_plugin_with_factory) {
44 std::shared_ptr<rapidjson::Document> config(
new rapidjson::Document);
46 "[{\"plugin_name\":\"json_loopback::JsonLoopback\",\"param\":"
54 auto source = pluginFactory->
Create(
"127.0.0.1", 50000,
"json", config);
55 auto result = source->TryStart();
58 ASSERT_TRUE(result.is_success);
62 TEST(TestSuite, create_string_plugin_with_factory) {
63 std::shared_ptr<rapidjson::Document> config(
new rapidjson::Document);
65 "[{\"plugin_name\":\"string_loopback::StringLoopback\",\"param\":"
73 auto source = pluginFactory->
Create(
"127.0.0.1", 50000,
"string", config);
74 auto result = source->TryStart();
77 ASSERT_TRUE(result.is_success);