diff options
author | Dan Goodliffe <dan@randomdan.homeip.net> | 2016-09-16 23:36:16 +0100 |
---|---|---|
committer | Dan Goodliffe <dan@randomdan.homeip.net> | 2016-09-16 23:36:16 +0100 |
commit | e9ff72d4db1cf37166ebf136b8fd97a4e4124adb (patch) | |
tree | 348e57ade4818bc5dffe1013df75351f4fad64ab | |
parent | If a mashup member isn't a defined operation, assume it is a local variable f... (diff) | |
download | icespider-e9ff72d4db1cf37166ebf136b8fd97a4e4124adb.tar.bz2 icespider-e9ff72d4db1cf37166ebf136b8fd97a4e4124adb.tar.xz icespider-e9ff72d4db1cf37166ebf136b8fd97a4e4124adb.zip |
Remove previous serializer before adding replacement
-rw-r--r-- | icespider/core/irouteHandler.cpp | 1 | ||||
-rw-r--r-- | icespider/unittests/testApp.cpp | 4 | ||||
-rw-r--r-- | icespider/unittests/testCompile.cpp | 4 | ||||
-rw-r--r-- | icespider/unittests/testRoutes.json | 13 |
4 files changed, 18 insertions, 4 deletions
diff --git a/icespider/core/irouteHandler.cpp b/icespider/core/irouteHandler.cpp index e096e9c..9d33a6b 100644 --- a/icespider/core/irouteHandler.cpp +++ b/icespider/core/irouteHandler.cpp @@ -43,6 +43,7 @@ namespace IceSpider { void IRouteHandler::addRouteSerializer(const MimeType & ct, StreamSerializerFactoryPtr ssfp) { + routeSerializers.erase(ct); routeSerializers.insert({ ct, ssfp }); } diff --git a/icespider/unittests/testApp.cpp b/icespider/unittests/testApp.cpp index eec91a6..5db7cfd 100644 --- a/icespider/unittests/testApp.cpp +++ b/icespider/unittests/testApp.cpp @@ -26,7 +26,7 @@ void forceEarlyChangeDir() BOOST_AUTO_TEST_CASE( testLoadConfiguration ) { - BOOST_REQUIRE_EQUAL(8, AdHoc::PluginManager::getDefault()->getAll<IceSpider::RouteHandlerFactory>().size()); + BOOST_REQUIRE_EQUAL(9, AdHoc::PluginManager::getDefault()->getAll<IceSpider::RouteHandlerFactory>().size()); } class TestRequest : public IHttpRequest { @@ -90,7 +90,7 @@ BOOST_AUTO_TEST_CASE( testCoreSettings ) BOOST_REQUIRE_EQUAL(6, routes.size()); BOOST_REQUIRE_EQUAL(5, routes[HttpMethod::GET].size()); BOOST_REQUIRE_EQUAL(1, routes[HttpMethod::GET][0].size()); - BOOST_REQUIRE_EQUAL(0, routes[HttpMethod::GET][1].size()); + BOOST_REQUIRE_EQUAL(1, routes[HttpMethod::GET][1].size()); BOOST_REQUIRE_EQUAL(1, routes[HttpMethod::GET][2].size()); BOOST_REQUIRE_EQUAL(2, routes[HttpMethod::GET][3].size()); BOOST_REQUIRE_EQUAL(2, routes[HttpMethod::GET][4].size()); diff --git a/icespider/unittests/testCompile.cpp b/icespider/unittests/testCompile.cpp index 130b762..425821f 100644 --- a/icespider/unittests/testCompile.cpp +++ b/icespider/unittests/testCompile.cpp @@ -36,7 +36,7 @@ BOOST_AUTO_TEST_CASE( testLoadConfiguration ) rc.applyDefaults(cfg, u); BOOST_REQUIRE_EQUAL("common", cfg->name); - BOOST_REQUIRE_EQUAL(8, cfg->routes.size()); + BOOST_REQUIRE_EQUAL(9, cfg->routes.size()); BOOST_REQUIRE_EQUAL("index", cfg->routes[0]->name); BOOST_REQUIRE_EQUAL("/", cfg->routes[0]->path); @@ -132,7 +132,7 @@ BOOST_AUTO_TEST_CASE( testLoad ) BOOST_TEST_INFO(dlerror()); BOOST_REQUIRE(lib); - BOOST_REQUIRE_EQUAL(8, AdHoc::PluginManager::getDefault()->getAll<IceSpider::RouteHandlerFactory>().size()); + BOOST_REQUIRE_EQUAL(9, AdHoc::PluginManager::getDefault()->getAll<IceSpider::RouteHandlerFactory>().size()); // smoke test (block ensure dlclose dones't cause segfault) { auto route = AdHoc::PluginManager::getDefault()->get<IceSpider::RouteHandlerFactory>("common::index"); diff --git a/icespider/unittests/testRoutes.json b/icespider/unittests/testRoutes.json index a7b3f82..d2d713a 100644 --- a/icespider/unittests/testRoutes.json +++ b/icespider/unittests/testRoutes.json @@ -102,6 +102,19 @@ } } } + }, + { + "name": "override", + "path": "/override", + "method": "GET", + "outputSerializers": [ + { + "contentType": "application/xml", + "serializer": "IceSpider.XsltStreamSerializer", + "params": [ "\"xslt/transform.xslt\"" ] + } + ], + "operation": "TestIceSpider.TestApi.index" } ], "slices": [ |