diff options
| author | Dan Goodliffe <dan@randomdan.homeip.net> | 2016-06-26 14:44:49 +0100 | 
|---|---|---|
| committer | Dan Goodliffe <dan@randomdan.homeip.net> | 2016-06-26 14:44:49 +0100 | 
| commit | b602b73aa31f7261c18da30621bce71434021df9 (patch) | |
| tree | b829402cba07309f1c6436c4dfdc9f5134f61dc8 | |
| parent | Allow control of --dll-export and --ice (diff) | |
| download | icespider-b602b73aa31f7261c18da30621bce71434021df9.tar.bz2 icespider-b602b73aa31f7261c18da30621bce71434021df9.tar.xz icespider-b602b73aa31f7261c18da30621bce71434021df9.zip | |
Tidy up
| -rw-r--r-- | icespider/common/Jamfile.jam | 1 | ||||
| -rw-r--r-- | icespider/common/http.ice | 15 | ||||
| -rw-r--r-- | icespider/common/pathparts.cpp | 1 | ||||
| -rw-r--r-- | icespider/common/routes.ice | 20 | ||||
| -rw-r--r-- | icespider/compile/Jamfile.jam | 1 | ||||
| -rw-r--r-- | icespider/compile/routeCompiler.cpp | 32 | ||||
| -rw-r--r-- | icespider/compile/routeCompiler.h | 12 | ||||
| -rw-r--r-- | icespider/core/core.cpp | 4 | ||||
| -rw-r--r-- | icespider/core/ihttpRequest.h | 11 | ||||
| -rw-r--r-- | icespider/core/irouteHandler.cpp | 2 | ||||
| -rw-r--r-- | icespider/core/irouteHandler.h | 4 | ||||
| -rw-r--r-- | icespider/fcgi/cgiRequest.cpp | 2 | ||||
| -rw-r--r-- | icespider/fcgi/cgiRequest.h | 2 | ||||
| -rw-r--r-- | icespider/fcgi/cgiRequestBase.cpp | 20 | ||||
| -rw-r--r-- | icespider/fcgi/cgiRequestBase.h | 17 | ||||
| -rw-r--r-- | icespider/fcgi/fcgiRequest.cpp | 2 | ||||
| -rw-r--r-- | icespider/fcgi/fcgiRequest.h | 2 | ||||
| -rw-r--r-- | icespider/fcgi/main.cpp | 2 | ||||
| -rw-r--r-- | icespider/unittests/testApp.cpp | 10 | ||||
| -rw-r--r-- | icespider/unittests/testCompile.cpp | 18 | 
20 files changed, 102 insertions, 76 deletions
| diff --git a/icespider/common/Jamfile.jam b/icespider/common/Jamfile.jam index c06ff0c..8eceefb 100644 --- a/icespider/common/Jamfile.jam +++ b/icespider/common/Jamfile.jam @@ -4,6 +4,7 @@ lib icespider-common :  	[ glob-tree *.ice *.cpp : bin ]  	:  	<library>adhocutil +	<allow-ice>yes  	<library>..//pthread  	<library>..//Ice  	<library>..//IceUtil diff --git a/icespider/common/http.ice b/icespider/common/http.ice new file mode 100644 index 0000000..33c0543 --- /dev/null +++ b/icespider/common/http.ice @@ -0,0 +1,15 @@ +#ifndef ICESPIDER_HTTP_ICE +#define ICESPIDER_HTTP_ICE + +module IceSpider { +	enum HttpMethod { +		GET, HEAD, POST, PUT, DELETE, OPTIONS +	}; + +	enum ParameterSource { +		URL, Body, QueryString, Header +	}; +}; + +#endif + diff --git a/icespider/common/pathparts.cpp b/icespider/common/pathparts.cpp index d7581b3..21fa253 100644 --- a/icespider/common/pathparts.cpp +++ b/icespider/common/pathparts.cpp @@ -30,7 +30,6 @@ namespace IceSpider {  	PathLiteral::PathLiteral(const std::string & p) :  		value(p)  	{ -		  	}  	bool diff --git a/icespider/common/routes.ice b/icespider/common/routes.ice index 0e64692..5d1a2c9 100644 --- a/icespider/common/routes.ice +++ b/icespider/common/routes.ice @@ -1,10 +1,9 @@ -module UserIceSpider { -	enum HttpMethod { -		GET, HEAD, POST, PUT, DELETE, OPTIONS -	}; -	enum ParameterSource { -		URL, Body, QueryString, Header -	}; +#ifndef ICESPIDER_ROUTES_ICE +#define ICESPIDER_ROUTES_ICE + +#include "http.ice" + +module IceSpider {  	class Parameter {  		string name;  		ParameterSource source = URL; @@ -16,7 +15,9 @@ module UserIceSpider {  		["slicer:ignore"]  		bool hasUserSource;  	}; +  	sequence<Parameter> Parameters; +  	class Route {  		string name;  		string path; @@ -24,8 +25,11 @@ module UserIceSpider {  		string operation;  		Parameters params;  	}; +  	sequence<Route> Routes; +  	sequence<string> Slices; +  	class RouteConfiguration {  		string name;  		Routes routes; @@ -33,3 +37,5 @@ module UserIceSpider {  	};  }; +#endif + diff --git a/icespider/compile/Jamfile.jam b/icespider/compile/Jamfile.jam index 9e0636a..9b07429 100644 --- a/icespider/compile/Jamfile.jam +++ b/icespider/compile/Jamfile.jam @@ -11,6 +11,7 @@ lib icespider-compile :  	[ glob ../common/*.ice ]  	:  	<slicer>pure +	<allow-ice>yes  	<library>slicer  	<library>adhocutil  	<library>slicer-json diff --git a/icespider/compile/routeCompiler.cpp b/icespider/compile/routeCompiler.cpp index 8064946..6f5ded0 100644 --- a/icespider/compile/routeCompiler.cpp +++ b/icespider/compile/routeCompiler.cpp @@ -31,11 +31,11 @@ namespace IceSpider {  			searchPath.push_back(boost::filesystem::current_path());  		} -		UserIceSpider::RouteConfigurationPtr +		RouteConfigurationPtr  		RouteCompiler::loadConfiguration(const boost::filesystem::path & input) const  		{  			auto deserializer = Slicer::DeserializerPtr(Slicer::FileDeserializerFactory::createNew(input.extension().string(), input)); -			return Slicer::DeserializeAnyWith<UserIceSpider::RouteConfigurationPtr>(deserializer); +			return Slicer::DeserializeAnyWith<RouteConfigurationPtr>(deserializer);  		}  		Ice::StringSeq operator+(Ice::StringSeq ss, const std::string & s) @@ -45,7 +45,7 @@ namespace IceSpider {  		}  		Slice::OperationPtr -		RouteCompiler::findOperation(UserIceSpider::RoutePtr r, const Slice::ContainerPtr & c, const Ice::StringSeq & ns) +		RouteCompiler::findOperation(RoutePtr r, const Slice::ContainerPtr & c, const Ice::StringSeq & ns)  		{  			for (const auto & cls : c->classes()) {  				auto fqcn = ns + cls->name(); @@ -64,7 +64,7 @@ namespace IceSpider {  		}  		Slice::OperationPtr -		RouteCompiler::findOperation(UserIceSpider::RoutePtr r, const Units & us) +		RouteCompiler::findOperation(RoutePtr r, const Units & us)  		{  			for (const auto & u : us) {  				auto op = findOperation(r, u.second); @@ -74,7 +74,7 @@ namespace IceSpider {  		}  		void -		RouteCompiler::applyDefaults(UserIceSpider::RouteConfigurationPtr c, const Units & u) const +		RouteCompiler::applyDefaults(RouteConfigurationPtr c, const Units & u) const  		{  			for (const auto & r : c->routes) {  				auto o = findOperation(r, u); @@ -87,12 +87,12 @@ namespace IceSpider {  						if (!d->key) d->key = d->name;  					}  					else { -						r->params.push_back(new UserIceSpider::Parameter(p->name(), UserIceSpider::ParameterSource::URL, p->name(), false, IceUtil::Optional<std::string>(), false)); +						r->params.push_back(new Parameter(p->name(), ParameterSource::URL, p->name(), false, IceUtil::Optional<std::string>(), false));  						defined = --r->params.end();  					}  					auto d = *defined; -					if (d->source == UserIceSpider::ParameterSource::URL) { -						IceSpider::Path path(r->path); +					if (d->source == ParameterSource::URL) { +						Path path(r->path);  						d->hasUserSource = std::find_if(path.parts.begin(), path.parts.end(), [d](const auto & pp) {  							if (auto par = dynamic_cast<PathParameter *>(pp.get())) {  								return par->name == d->key; @@ -129,7 +129,7 @@ namespace IceSpider {  		}  		RouteCompiler::Units -		RouteCompiler::loadUnits(UserIceSpider::RouteConfigurationPtr c) const +		RouteCompiler::loadUnits(RouteConfigurationPtr c) const  		{  			RouteCompiler::Units units;  			AdHoc::ScopeExit uDestroy; @@ -193,7 +193,7 @@ namespace IceSpider {  		}  		void -		RouteCompiler::processConfiguration(FILE * output, UserIceSpider::RouteConfigurationPtr c, const Units & units) const +		RouteCompiler::processConfiguration(FILE * output, RouteConfigurationPtr c, const Units & units) const  		{  			fprintf(output, "// This source files was generated by IceSpider.\n");  			fprintbf(output, "// Configuration name: %s\n\n", c->name); @@ -222,12 +222,12 @@ namespace IceSpider {  				fprintbf(1, output, "class %s : public IceSpider::IRouteHandler {\n", r->name);  				fprintbf(2, output, "public:\n");  				fprintbf(3, output, "%s() :\n", r->name); -				fprintbf(4, output, "IceSpider::IRouteHandler(UserIceSpider::HttpMethod::%s, \"%s\")", methodName, r->path); +				fprintbf(4, output, "IceSpider::IRouteHandler(IceSpider::HttpMethod::%s, \"%s\")", methodName, r->path);  				for (const auto & p : r->params) {  					if (p->hasUserSource) {  						fprintf(output, ",\n"); -						if (p->source == UserIceSpider::ParameterSource::URL) { -							IceSpider::Path path(r->path); +						if (p->source == ParameterSource::URL) { +							Path path(r->path);  							unsigned int idx = -1;  							for (const auto & pp : path.parts) {  								if (auto par = dynamic_cast<PathParameter *>(pp.get())) { @@ -259,9 +259,9 @@ namespace IceSpider {  						auto ip = *std::find_if(o->parameters().begin(), o->parameters().end(), [p](const auto & ip) { return ip->name() == p->name; });  						fprintbf(4, output, "auto _p_%s(request->get%sParam<%s>(_p%c_%s)",  										 p->name, getEnumString(p->source), Slice::typeToString(ip->type()), -										 p->source == UserIceSpider::ParameterSource::URL ? 'i' : 'n', +										 p->source == ParameterSource::URL ? 'i' : 'n',  										 p->name); -						if (!p->isOptional && p->source != UserIceSpider::ParameterSource::URL) { +						if (!p->isOptional && p->source != ParameterSource::URL) {  							fprintbf(0, output, " /\n");  							if (p->defaultExpr) {  								fprintbf(5, output, " [this]() { return _pd_%s; }", @@ -305,7 +305,7 @@ namespace IceSpider {  				fprintbf(2, output, "private:\n");  				for (const auto & p : r->params) {  					if (p->hasUserSource) { -						if (p->source == UserIceSpider::ParameterSource::URL) { +						if (p->source == ParameterSource::URL) {  							fprintbf(3, output, "const unsigned int _pi_%s;\n", p->name);  						}  						else { diff --git a/icespider/compile/routeCompiler.h b/icespider/compile/routeCompiler.h index 9d17675..af5912e 100644 --- a/icespider/compile/routeCompiler.h +++ b/icespider/compile/routeCompiler.h @@ -16,18 +16,18 @@ namespace IceSpider {  				RouteCompiler(); -				UserIceSpider::RouteConfigurationPtr loadConfiguration(const boost::filesystem::path &) const; -				Units loadUnits(UserIceSpider::RouteConfigurationPtr) const; +				RouteConfigurationPtr loadConfiguration(const boost::filesystem::path &) const; +				Units loadUnits(RouteConfigurationPtr) const; -				void applyDefaults(UserIceSpider::RouteConfigurationPtr, const Units & u) const; +				void applyDefaults(RouteConfigurationPtr, const Units & u) const;  				void compile(const boost::filesystem::path & input, const boost::filesystem::path & output) const;  				std::vector<boost::filesystem::path> searchPath;  			private: -				void processConfiguration(FILE * output, UserIceSpider::RouteConfigurationPtr, const Units &) const; -				static Slice::OperationPtr findOperation(UserIceSpider::RoutePtr, const Units &); -				static Slice::OperationPtr findOperation(UserIceSpider::RoutePtr, const Slice::ContainerPtr &, const Ice::StringSeq & = Ice::StringSeq()); +				void processConfiguration(FILE * output, RouteConfigurationPtr, const Units &) const; +				static Slice::OperationPtr findOperation(RoutePtr, const Units &); +				static Slice::OperationPtr findOperation(RoutePtr, const Slice::ContainerPtr &, const Ice::StringSeq & = Ice::StringSeq());  		};  	}  } diff --git a/icespider/core/core.cpp b/icespider/core/core.cpp index 35af72f..42aa7c7 100644 --- a/icespider/core/core.cpp +++ b/icespider/core/core.cpp @@ -5,7 +5,7 @@ namespace IceSpider {  	Core::Core(int argc, char ** argv)  	{  		// Big enough to map all the request methods (an empty of zero lenght routes as default) -		routes.resize(UserIceSpider::HttpMethod::OPTIONS + 1, {{ }}); +		routes.resize(HttpMethod::OPTIONS + 1, {{ }});  		// Initialize routes  		for (const auto & rp : AdHoc::PluginManager::getDefault()->getAll<IRouteHandler>()) {  			auto r = rp->implementation(); @@ -41,7 +41,7 @@ namespace IceSpider {  	const IRouteHandler *  	Core::findRoute(const IHttpRequest * request) const  	{ -		auto & pathparts = request->getRequestPath(); +		const auto & pathparts = request->getRequestPath();  		const auto & mroutes = routes[request->getRequestMethod()];  		if (pathparts.size() >= mroutes.size()) {  			// Not found error diff --git a/icespider/core/ihttpRequest.h b/icespider/core/ihttpRequest.h index c52ee46..cdc2161 100644 --- a/icespider/core/ihttpRequest.h +++ b/icespider/core/ihttpRequest.h @@ -12,17 +12,20 @@  namespace IceSpider {  	class Core; +	typedef std::vector<std::string> PathElements; +	typedef IceUtil::Optional<std::string> OptionalString; +  	class DLL_PUBLIC IHttpRequest {  		public:  			IHttpRequest(const Core *);  			Ice::Context getContext() const; -			virtual const std::vector<std::string> & getRequestPath() const = 0; -			virtual UserIceSpider::HttpMethod getRequestMethod() const = 0; +			virtual const PathElements & getRequestPath() const = 0; +			virtual HttpMethod getRequestMethod() const = 0;  			const std::string & getURLParam(unsigned int) const; -			virtual IceUtil::Optional<std::string> getQueryStringParam(const std::string &) const = 0; -			virtual IceUtil::Optional<std::string> getHeaderParam(const std::string &) const = 0; +			virtual OptionalString getQueryStringParam(const std::string &) const = 0; +			virtual OptionalString getHeaderParam(const std::string &) const = 0;  			virtual Slicer::DeserializerPtr getDeserializer() const;  			virtual Slicer::SerializerPtr getSerializer() const;  			virtual std::istream & getInputStream() const = 0; diff --git a/icespider/core/irouteHandler.cpp b/icespider/core/irouteHandler.cpp index 3007772..4d78397 100644 --- a/icespider/core/irouteHandler.cpp +++ b/icespider/core/irouteHandler.cpp @@ -5,7 +5,7 @@  INSTANTIATEPLUGINOF(IceSpider::IRouteHandler);  namespace IceSpider { -	IRouteHandler::IRouteHandler(UserIceSpider::HttpMethod m, const std::string & p) : +	IRouteHandler::IRouteHandler(HttpMethod m, const std::string & p) :  		Path(p),  		method(m)  	{ diff --git a/icespider/core/irouteHandler.h b/icespider/core/irouteHandler.h index 969ca86..1334bee 100644 --- a/icespider/core/irouteHandler.h +++ b/icespider/core/irouteHandler.h @@ -12,10 +12,10 @@  namespace IceSpider {  	class DLL_PUBLIC IRouteHandler : public AdHoc::AbstractPluginImplementation, public Path {  		public: -			IRouteHandler(UserIceSpider::HttpMethod, const std::string & path); +			IRouteHandler(HttpMethod, const std::string & path);  			virtual void execute(IHttpRequest * request) const = 0; -			const UserIceSpider::HttpMethod method; +			const HttpMethod method;  		protected:  			template <typename T, typename K> diff --git a/icespider/fcgi/cgiRequest.cpp b/icespider/fcgi/cgiRequest.cpp index abc3bea..ac61edc 100644 --- a/icespider/fcgi/cgiRequest.cpp +++ b/icespider/fcgi/cgiRequest.cpp @@ -1,7 +1,7 @@  #include "cgiRequest.h"  namespace IceSpider { -	CgiRequest::CgiRequest(IceSpider::Core * c, int argc, char ** argv, char ** env) : +	CgiRequest::CgiRequest(Core * c, int argc, char ** argv, char ** env) :  		CgiRequestBase(c, env)  	{  		for (; argc > 0;) { diff --git a/icespider/fcgi/cgiRequest.h b/icespider/fcgi/cgiRequest.h index 9af58bb..1e48e98 100644 --- a/icespider/fcgi/cgiRequest.h +++ b/icespider/fcgi/cgiRequest.h @@ -6,7 +6,7 @@  namespace IceSpider {  	class CgiRequest : public CgiRequestBase {  		public: -			CgiRequest(IceSpider::Core * c, int argc, char ** argv, char ** env); +			CgiRequest(Core * c, int argc, char ** argv, char ** env);  			std::istream & getInputStream() const override;  			std::ostream & getOutputStream() const override; diff --git a/icespider/fcgi/cgiRequestBase.cpp b/icespider/fcgi/cgiRequestBase.cpp index ec9836b..2af4b04 100644 --- a/icespider/fcgi/cgiRequestBase.cpp +++ b/icespider/fcgi/cgiRequestBase.cpp @@ -7,8 +7,8 @@  namespace ba = boost::algorithm;  namespace IceSpider { -	CgiRequestBase::CgiRequestBase(IceSpider::Core * c, char ** env) : -		IceSpider::IHttpRequest(c) +	CgiRequestBase::CgiRequestBase(Core * c, char ** env) : +		IHttpRequest(c)  	{  		for(char * const * e = env; *e; ++e) {  			addenv(*e); @@ -33,7 +33,7 @@ namespace IceSpider {  			[this]() -> std::string { throw std::runtime_error("Couldn't determine request path"); })  			.substr(1);  		if (!path.empty()) { -			ba::split(pathmap, path, ba::is_any_of("/"), ba::token_compress_off); +			ba::split(pathElements, path, ba::is_any_of("/"), ba::token_compress_off);  		}  		auto qs = envmap.find("QUERY_STRING"); @@ -58,7 +58,7 @@ namespace IceSpider {  		}  	} -	IceUtil::Optional<std::string> +	OptionalString  	CgiRequestBase::optionalLookup(const std::string & key, const VarMap & vm)  	{  		auto i = vm.find(key.c_str()); @@ -68,25 +68,25 @@ namespace IceSpider {  		return std::string(std::get<0>(i->second), std::get<1>(i->second));  	} -	const std::vector<std::string> & +	const PathElements &  	CgiRequestBase::getRequestPath() const  	{ -		return pathmap; +		return pathElements;  	} -	UserIceSpider::HttpMethod +	HttpMethod  	CgiRequestBase::getRequestMethod() const  	{ -		return UserIceSpider::HttpMethod::GET; +		return HttpMethod::GET;  	} -	IceUtil::Optional<std::string> +	OptionalString  	CgiRequestBase::getQueryStringParam(const std::string & key) const  	{  		return optionalLookup(key, qsmap);  	} -	IceUtil::Optional<std::string> +	OptionalString  	CgiRequestBase::getHeaderParam(const std::string & key) const  	{  		return optionalLookup(("HTTP_" + boost::algorithm::to_upper_copy(key)).c_str(), envmap); diff --git a/icespider/fcgi/cgiRequestBase.h b/icespider/fcgi/cgiRequestBase.h index 8f5b613..b8dcd1f 100644 --- a/icespider/fcgi/cgiRequestBase.h +++ b/icespider/fcgi/cgiRequestBase.h @@ -7,7 +7,7 @@  #include <tuple>  namespace IceSpider { -	class CgiRequestBase : public IceSpider::IHttpRequest { +	class CgiRequestBase : public IHttpRequest {  		protected:  			struct cmp_str {  				bool operator()(char const *a, char const *b) const; @@ -15,22 +15,21 @@ namespace IceSpider {  			typedef std::tuple<char *, char *> Env;  			typedef std::map<const char *, Env, cmp_str> VarMap; -			typedef std::vector<std::string> UrlMap; -			CgiRequestBase(IceSpider::Core * c, char ** env); +			CgiRequestBase(Core * c, char ** env);  			void addenv(char *);  			void initialize(); -			const std::vector<std::string> & getRequestPath() const override; -			UserIceSpider::HttpMethod getRequestMethod() const override; -			IceUtil::Optional<std::string> getQueryStringParam(const std::string & key) const override; -			IceUtil::Optional<std::string> getHeaderParam(const std::string & key) const override; +			const PathElements & getRequestPath() const override; +			HttpMethod getRequestMethod() const override; +			OptionalString getQueryStringParam(const std::string & key) const override; +			OptionalString getHeaderParam(const std::string & key) const override; -			static IceUtil::Optional<std::string> optionalLookup(const std::string & key, const VarMap &); +			static OptionalString optionalLookup(const std::string & key, const VarMap &);  			VarMap envmap;  			VarMap qsmap; -			UrlMap pathmap; +			PathElements pathElements;  	};  } diff --git a/icespider/fcgi/fcgiRequest.cpp b/icespider/fcgi/fcgiRequest.cpp index 484f12f..0d2ff75 100644 --- a/icespider/fcgi/fcgiRequest.cpp +++ b/icespider/fcgi/fcgiRequest.cpp @@ -1,7 +1,7 @@  #include "fcgiRequest.h"  namespace IceSpider { -	FcgiRequest::FcgiRequest(IceSpider::Core * c, FCGX_Request * r) : +	FcgiRequest::FcgiRequest(Core * c, FCGX_Request * r) :  		CgiRequestBase(c, r->envp),  		inputbuf(r->in),  		input(&inputbuf), diff --git a/icespider/fcgi/fcgiRequest.h b/icespider/fcgi/fcgiRequest.h index ec5b65b..0bc2e41 100644 --- a/icespider/fcgi/fcgiRequest.h +++ b/icespider/fcgi/fcgiRequest.h @@ -7,7 +7,7 @@  namespace IceSpider {  	class FcgiRequest : public CgiRequestBase {  		public: -			FcgiRequest(IceSpider::Core * c, FCGX_Request * r); +			FcgiRequest(Core * c, FCGX_Request * r);  			std::istream & getInputStream() const override;  			std::ostream & getOutputStream() const override; diff --git a/icespider/fcgi/main.cpp b/icespider/fcgi/main.cpp index 7245ef9..d92dc91 100644 --- a/icespider/fcgi/main.cpp +++ b/icespider/fcgi/main.cpp @@ -8,7 +8,7 @@ DLL_PUBLIC  int  main(int argc, char ** argv, char ** env)  { -	IceSpider::Core core(argc, argv); +	Core core(argc, argv);  	if (!FCGX_IsCGI()) {  		FCGX_Request request; diff --git a/icespider/unittests/testApp.cpp b/icespider/unittests/testApp.cpp index cf14c81..896b623 100644 --- a/icespider/unittests/testApp.cpp +++ b/icespider/unittests/testApp.cpp @@ -10,14 +10,14 @@  #include <boost/algorithm/string/split.hpp>  #include <boost/algorithm/string/classification.hpp> -using namespace UserIceSpider; +using namespace IceSpider;  BOOST_AUTO_TEST_CASE( testLoadConfiguration )  { -	BOOST_REQUIRE_EQUAL(6, AdHoc::PluginManager::getDefault()->getAll<IceSpider::IRouteHandler>().size()); +	BOOST_REQUIRE_EQUAL(6, AdHoc::PluginManager::getDefault()->getAll<IRouteHandler>().size());  } -BOOST_FIXTURE_TEST_SUITE(c, IceSpider::Core); +BOOST_FIXTURE_TEST_SUITE(c, Core);  BOOST_AUTO_TEST_CASE( testCoreSettings )  { @@ -38,9 +38,9 @@ BOOST_AUTO_TEST_CASE( testCoreSettings )  	BOOST_REQUIRE_EQUAL(1, routes[HttpMethod::OPTIONS].size());  } -class TestRequest : public IceSpider::IHttpRequest { +class TestRequest : public IHttpRequest {  	public: -		TestRequest(const IceSpider::Core * c, HttpMethod m, const std::string & p) : +		TestRequest(const Core * c, HttpMethod m, const std::string & p) :  			IHttpRequest(c),  			method(m)  		{ diff --git a/icespider/unittests/testCompile.cpp b/icespider/unittests/testCompile.cpp index 26fc458..8adc19f 100644 --- a/icespider/unittests/testCompile.cpp +++ b/icespider/unittests/testCompile.cpp @@ -8,6 +8,8 @@  #include "../core/irouteHandler.h"  #include <boost/algorithm/string/join.hpp> +using namespace IceSpider; +  class CoreFixture {  	protected:  		CoreFixture() : @@ -21,7 +23,7 @@ BOOST_FIXTURE_TEST_SUITE(cf, CoreFixture)  BOOST_AUTO_TEST_CASE( testLoadConfiguration )  { -	IceSpider::Compile::RouteCompiler rc; +	Compile::RouteCompiler rc;  	rc.searchPath.push_back(rootDir);  	auto cfg = rc.loadConfiguration(rootDir / "testRoutes.json");  	auto u = rc.loadUnits(cfg); @@ -32,7 +34,7 @@ BOOST_AUTO_TEST_CASE( testLoadConfiguration )  	BOOST_REQUIRE_EQUAL("index", cfg->routes[0]->name);  	BOOST_REQUIRE_EQUAL("/", cfg->routes[0]->path); -	BOOST_REQUIRE_EQUAL(UserIceSpider::HttpMethod::GET, cfg->routes[0]->method); +	BOOST_REQUIRE_EQUAL(HttpMethod::GET, cfg->routes[0]->method);  	BOOST_REQUIRE_EQUAL("TestIceSpider.TestApi.index", cfg->routes[0]->operation);  	BOOST_REQUIRE_EQUAL(0, cfg->routes[0]->params.size()); @@ -41,11 +43,11 @@ BOOST_AUTO_TEST_CASE( testLoadConfiguration )  	BOOST_REQUIRE_EQUAL(2, cfg->routes[1]->params.size());  	BOOST_REQUIRE_EQUAL("del", cfg->routes[2]->name); -	BOOST_REQUIRE_EQUAL(UserIceSpider::HttpMethod::DELETE, cfg->routes[2]->method); +	BOOST_REQUIRE_EQUAL(HttpMethod::DELETE, cfg->routes[2]->method);  	BOOST_REQUIRE_EQUAL(1, cfg->routes[2]->params.size());  	BOOST_REQUIRE_EQUAL("update", cfg->routes[3]->name); -	BOOST_REQUIRE_EQUAL(UserIceSpider::HttpMethod::POST, cfg->routes[3]->method); +	BOOST_REQUIRE_EQUAL(HttpMethod::POST, cfg->routes[3]->method);  	BOOST_REQUIRE_EQUAL(2, cfg->routes[3]->params.size());  	BOOST_REQUIRE_EQUAL(1, cfg->slices.size()); @@ -54,7 +56,7 @@ BOOST_AUTO_TEST_CASE( testLoadConfiguration )  BOOST_AUTO_TEST_CASE( testCompile )  { -	IceSpider::Compile::RouteCompiler rc; +	Compile::RouteCompiler rc;  	rc.searchPath.push_back(rootDir);  	auto input = rootDir / "testRoutes.json";  	auto output = binDir / "testRoutes.cpp"; @@ -68,7 +70,7 @@ BOOST_AUTO_TEST_CASE( testCompile )  		"-I", "/usr/include/slicer",  		"-I", (rootDir.parent_path() / "core").string(),  		"-I", (rootDir.parent_path() / "common").string(), -		"-I", (rootDir.parent_path() / "common" / "bin" / modeDir).string(), +		"-I", (rootDir.parent_path() / "common" / "bin" / modeDir / "allow-ice-yes").string(),  		"-I", libGenDir.string(),  		"-o", outputso.string(),  		output.string(), @@ -85,10 +87,10 @@ BOOST_AUTO_TEST_CASE( testLoad )  	BOOST_TEST_INFO(dlerror());  	BOOST_REQUIRE(lib); -	BOOST_REQUIRE_EQUAL(6, AdHoc::PluginManager::getDefault()->getAll<IceSpider::IRouteHandler>().size()); +	BOOST_REQUIRE_EQUAL(6, AdHoc::PluginManager::getDefault()->getAll<IRouteHandler>().size());  	// smoke test (block ensure dlclose dones't cause segfault)  	{ -		auto route = AdHoc::PluginManager::getDefault()->get<IceSpider::IRouteHandler>("common::index"); +		auto route = AdHoc::PluginManager::getDefault()->get<IRouteHandler>("common::index");  		BOOST_REQUIRE(route);  	} | 
