Commit c8dde088 authored by Pavel Vainerman's avatar Pavel Vainerman

(UHttp): встроил вывод информации о входах/выходах, переменных и т.п.

в codegen, произвёл рефакторинг названий функций связанных с http API, на httpXXX(...).
parent 03ea5933
...@@ -254,6 +254,10 @@ ...@@ -254,6 +254,10 @@
// ------------------------------------------------------------ // ------------------------------------------------------------
std::string help() noexcept; std::string help() noexcept;
// HTTP API
virtual nlohmann::json httpGet( const Poco::URI::QueryParameters& p ) override;
virtual nlohmann::json httpDumpIO();
</xsl:template> </xsl:template>
<xsl:template name="COMMON-HEAD-PROTECTED"> <xsl:template name="COMMON-HEAD-PROTECTED">
...@@ -266,6 +270,7 @@ ...@@ -266,6 +270,7 @@
virtual void sigterm( int signo ) override; virtual void sigterm( int signo ) override;
virtual bool activateObject() override; virtual bool activateObject() override;
virtual std::string getMonitInfo(){ return ""; } /*!&lt; пользовательская информация выводимая в getInfo() */ virtual std::string getMonitInfo(){ return ""; } /*!&lt; пользовательская информация выводимая в getInfo() */
virtual void httpGetUserData( nlohmann::json&amp; jdata ){} /*!&lt; для пользовательских данных в httpGet() */
// Выполнение очередного шага программы // Выполнение очередного шага программы
virtual void step(){} virtual void step(){}
...@@ -531,6 +536,53 @@ UniSetTypes::SimpleInfo* <xsl:value-of select="$CLASSNAME"/>_SK::getInfo( CORBA: ...@@ -531,6 +536,53 @@ UniSetTypes::SimpleInfo* <xsl:value-of select="$CLASSNAME"/>_SK::getInfo( CORBA:
return i._retn(); return i._retn();
} }
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
nlohmann::json <xsl:value-of select="$CLASSNAME"/>_SK::httpGet( const Poco::URI::QueryParameters&amp; params )
{
<xsl:if test="not(normalize-space($BASECLASS)='')">nlohmann::json json = <xsl:value-of select="$BASECLASS"/>::httpGet(params);</xsl:if>
<xsl:if test="normalize-space($BASECLASS)=''">nlohmann::json json = UniSetObject::httpGet(params);</xsl:if>
std::string myid(to_string(getId()));
auto&amp; jdata = json[myid];
if( logserv )
{
jdata["LogServer"] = {
{"host",logserv_host},
{"port",logserv_port},
{"state",( logserv->isRunning() ? "RUNNIG" : "FAILED" )}
};
// logserv->getShortInfo()
}
else
jdata["LogServer"] = {};
jdata["io"] = httpDumpIO();
auto timers = getTimersList();
auto&amp; jtm = jdata["Timers"];
jtm["count"] = timers.size();
for( const auto&amp; t: timers )
{
std::string tid(to_string(t.id));
auto&amp; jt = jtm[tid];
jt["id"] = t.id;
jt["name"] = getTimerName(t.id);
jt["msec"] = t.tmr.getInterval();
jt["timeleft"] = t.curTimeMS;
jt["tick"] = ( t.curTick>=0 ? t.curTick : -1 );
}
auto vlist = vmon.getList();
auto&amp; jvmon = jdata["Variables"];
for( const auto&amp; v: vlist )
jvmon[v.first] = v.second;
httpGetUserData(jdata);
return std::move(json);
}
// -----------------------------------------------------------------------------
<xsl:if test="normalize-space($TESTMODE)!=''"> <xsl:if test="normalize-space($TESTMODE)!=''">
bool <xsl:value-of select="$CLASSNAME"/>_SK::checkTestMode() const noexcept bool <xsl:value-of select="$CLASSNAME"/>_SK::checkTestMode() const noexcept
{ {
...@@ -1281,6 +1333,38 @@ void <xsl:value-of select="$CLASSNAME"/>_SK::testMode( bool _state ) ...@@ -1281,6 +1333,38 @@ void <xsl:value-of select="$CLASSNAME"/>_SK::testMode( bool _state )
</xsl:for-each> </xsl:for-each>
} }
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
nlohmann::json <xsl:value-of select="$CLASSNAME"/>_SK::httpDumpIO()
{
nlohmann::json jdata;
auto&amp; j_in = jdata["in"];
<xsl:for-each select="//smap/item">
<xsl:sort select="@name" order="ascending" data-type="text"/>
<xsl:if test="normalize-space(@vartype)='in'">
j_in["<xsl:call-template name="setprefix"/><xsl:value-of select="@name"/>"] = {
{"id",<xsl:value-of select="@name"/>},
{"name",ORepHelpers::getShortName( uniset_conf()->oind->getMapName(<xsl:value-of select="@name"/>))},
{"value",<xsl:call-template name="setprefix"/><xsl:value-of select="@name"/>}
};
</xsl:if>
</xsl:for-each>
auto&amp; j_out = jdata["out"];
<xsl:for-each select="//smap/item">
<xsl:sort select="@name" order="ascending" data-type="text"/>
<xsl:if test="normalize-space(@vartype)='out'">
j_out["<xsl:call-template name="setprefix"/><xsl:value-of select="@name"/>"] = {
{"id",<xsl:value-of select="@name"/>},
{"name",ORepHelpers::getShortName( uniset_conf()->oind->getMapName(<xsl:value-of select="@name"/>))},
{"value",<xsl:call-template name="setprefix"/><xsl:value-of select="@name"/>}
};
</xsl:if>
</xsl:for-each>
return std::move(jdata);
}
// ----------------------------------------------------------------------------
std::string <xsl:value-of select="$CLASSNAME"/>_SK::dumpIO() std::string <xsl:value-of select="$CLASSNAME"/>_SK::dumpIO()
{ {
ostringstream s; ostringstream s;
...@@ -1632,6 +1716,37 @@ bool <xsl:value-of select="$CLASSNAME"/>_SK::setMsg( UniSetTypes::ObjectId _code ...@@ -1632,6 +1716,37 @@ bool <xsl:value-of select="$CLASSNAME"/>_SK::setMsg( UniSetTypes::ObjectId _code
return false; return false;
} }
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
nlohmann::json <xsl:value-of select="$CLASSNAME"/>_SK::httpDumpIO()
{
nlohmann::json jdata;
auto&amp; j_in = jdata["in"];
auto&amp; j_out = jdata["out"];
<xsl:for-each select="//sensors/item/consumers/consumer">
<xsl:sort select="../../@name" order="ascending" data-type="text"/>
<xsl:if test="normalize-space(../../@msg)!='1'">
<xsl:if test="normalize-space(@name)=$OID">
<xsl:if test="normalize-space(@vartype)='in'">
j_in["<xsl:call-template name="setprefix"/><xsl:value-of select="../../@name"/>"] = {
{"id",<xsl:value-of select="../../@id"/>},
{"name", "<xsl:value-of select="../../@name"/>"},
{"value",<xsl:call-template name="setprefix"/><xsl:value-of select="../../@name"/>}
};
</xsl:if>
<xsl:if test="normalize-space(@vartype)='out'">
j_out["<xsl:call-template name="setprefix"/><xsl:value-of select="../../@name"/>"] = {
{"id",<xsl:value-of select="../../@id"/>},
{"name", "<xsl:value-of select="../../@name"/>"},
{"value",<xsl:call-template name="setprefix"/><xsl:value-of select="../../@name"/>}
};
</xsl:if>
</xsl:if>
</xsl:if>
</xsl:for-each>
return std::move(jdata);
}
// -----------------------------------------------------------------------------
std::string <xsl:value-of select="$CLASSNAME"/>_SK::dumpIO() std::string <xsl:value-of select="$CLASSNAME"/>_SK::dumpIO()
{ {
ostringstream s; ostringstream s;
......
...@@ -83,6 +83,14 @@ void TestGen::sigterm( int signo ) ...@@ -83,6 +83,14 @@ void TestGen::sigterm( int signo )
TestGen_SK::sigterm(signo); TestGen_SK::sigterm(signo);
} }
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
void TestGen::httpGetUserData( nlohmann::json& jdata )
{
jdata["myMode"] = "RUNNING";
jdata["myVar"] = 42;
jdata["myFloatVar"] = 42.42;
jdata["myMessage"] = "This is text fot test httpGetUserData";
}
// -----------------------------------------------------------------------------
void TestGen::sysCommand( const UniSetTypes::SystemMessage* sm ) void TestGen::sysCommand( const UniSetTypes::SystemMessage* sm )
{ {
if( sm->command == SystemMessage::StartUp ) if( sm->command == SystemMessage::StartUp )
......
...@@ -19,6 +19,7 @@ class TestGen: ...@@ -19,6 +19,7 @@ class TestGen:
virtual void timerInfo( const UniSetTypes::TimerMessage* tm ) override; virtual void timerInfo( const UniSetTypes::TimerMessage* tm ) override;
virtual void sysCommand( const UniSetTypes::SystemMessage* sm ) override; virtual void sysCommand( const UniSetTypes::SystemMessage* sm ) override;
virtual void sigterm( int signo ) override; virtual void sigterm( int signo ) override;
virtual void httpGetUserData( nlohmann::json& jdata ) override;
private: private:
bool bool_var = { false }; bool bool_var = { false };
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
ulimit -Sc 1000000 ulimit -Sc 1000000
uniset2-start.sh -f ./test --name TestProc --confile test.xml --ulog-add-levels system,warn,crit \ uniset2-start.sh -f ./test --name TestProc --confile test.xml --ulog-add-levels system,warn,crit \
--test-sm-ready-timeout 15000 --test-run-logserver --test-logserver-host 192.192.192.192 --test-sm-ready-timeout 15000 --test-run-logserver --test-logserver-host 192.192.192.192 $*
#--test-log-add-levels any $* #--test-log-add-levels any $*
#info,warn,crit,system,level9 > 1.log #info,warn,crit,system,level9 > 1.log
......
...@@ -100,7 +100,7 @@ class IOController: ...@@ -100,7 +100,7 @@ class IOController:
// http API // http API
// virtual nlohmann::json getData( const Poco::URI::QueryParameters& p ) override; // virtual nlohmann::json getData( const Poco::URI::QueryParameters& p ) override;
virtual nlohmann::json httpHelp( const Poco::URI::QueryParameters& p ) override; virtual nlohmann::json httpHelp( const Poco::URI::QueryParameters& p ) override;
virtual nlohmann::json request( const std::string& req, const Poco::URI::QueryParameters& p ) override; virtual nlohmann::json httpRequest( const std::string& req, const Poco::URI::QueryParameters& p ) override;
public: public:
......
...@@ -273,7 +273,7 @@ class IONotifyController: ...@@ -273,7 +273,7 @@ class IONotifyController:
// http API // http API
virtual nlohmann::json httpHelp( const Poco::URI::QueryParameters& p ) override; virtual nlohmann::json httpHelp( const Poco::URI::QueryParameters& p ) override;
nlohmann::json request( const string& req, const Poco::URI::QueryParameters& p ); nlohmann::json httpRequest( const string& req, const Poco::URI::QueryParameters& p );
protected: protected:
IONotifyController(); IONotifyController();
......
...@@ -59,11 +59,11 @@ namespace UniSetTypes ...@@ -59,11 +59,11 @@ namespace UniSetTypes
virtual ~IHttpRequest(){} virtual ~IHttpRequest(){}
// throw SystemError // throw SystemError
virtual nlohmann::json getData( const Poco::URI::QueryParameters& p ) = 0; virtual nlohmann::json httpGet( const Poco::URI::QueryParameters& p ) = 0;
virtual nlohmann::json httpHelp( const Poco::URI::QueryParameters& p ) = 0; virtual nlohmann::json httpHelp( const Poco::URI::QueryParameters& p ) = 0;
// не обязательная функция. // не обязательная функция.
virtual nlohmann::json request( const std::string& req, const Poco::URI::QueryParameters& p ); virtual nlohmann::json httpRequest( const std::string& req, const Poco::URI::QueryParameters& p );
}; };
// ------------------------------------------------------------------------- // -------------------------------------------------------------------------
/*! интерфейс для обработки запросов к объектам */ /*! интерфейс для обработки запросов к объектам */
...@@ -74,12 +74,12 @@ namespace UniSetTypes ...@@ -74,12 +74,12 @@ namespace UniSetTypes
virtual ~IHttpRequestRegistry(){} virtual ~IHttpRequestRegistry(){}
// throw SystemError, NameNotFound // throw SystemError, NameNotFound
virtual nlohmann::json getDataByName( const std::string& name, const Poco::URI::QueryParameters& p ) = 0; virtual nlohmann::json httpGetByName( const std::string& name, const Poco::URI::QueryParameters& p ) = 0;
// throw SystemError // throw SystemError
virtual nlohmann::json getObjectsList( const Poco::URI::QueryParameters& p ) = 0; virtual nlohmann::json httpGetObjectsList( const Poco::URI::QueryParameters& p ) = 0;
virtual nlohmann::json helpByName( const std::string& name, const Poco::URI::QueryParameters& p ) = 0; virtual nlohmann::json httpHelpByName( const std::string& name, const Poco::URI::QueryParameters& p ) = 0;
virtual nlohmann::json requestByName( const std::string& name, const std::string& req, const Poco::URI::QueryParameters& p ) = 0; virtual nlohmann::json httpRequestByName( const std::string& name, const std::string& req, const Poco::URI::QueryParameters& p ) = 0;
}; };
// ------------------------------------------------------------------------- // -------------------------------------------------------------------------
......
...@@ -86,10 +86,10 @@ class UniSetActivator: ...@@ -86,10 +86,10 @@ class UniSetActivator:
} }
// Поддрежка REST API (IHttpRequestRegistry) // Поддрежка REST API (IHttpRequestRegistry)
virtual nlohmann::json getDataByName( const std::string& name , const Poco::URI::QueryParameters& p ) override; virtual nlohmann::json httpGetByName( const std::string& name , const Poco::URI::QueryParameters& p ) override;
virtual nlohmann::json getObjectsList( const Poco::URI::QueryParameters& p ) override; virtual nlohmann::json httpGetObjectsList( const Poco::URI::QueryParameters& p ) override;
virtual nlohmann::json helpByName( const std::string& name, const Poco::URI::QueryParameters& p ) override; virtual nlohmann::json httpHelpByName( const std::string& name, const Poco::URI::QueryParameters& p ) override;
virtual nlohmann::json requestByName( const std::string& name, const std::string& req, const Poco::URI::QueryParameters& p ) override; virtual nlohmann::json httpRequestByName( const std::string& name, const std::string& req, const Poco::URI::QueryParameters& p ) override;
protected: protected:
......
...@@ -102,7 +102,7 @@ class UniSetObject: ...@@ -102,7 +102,7 @@ class UniSetObject:
virtual void push( const UniSetTypes::TransportMessage& msg ) override; virtual void push( const UniSetTypes::TransportMessage& msg ) override;
// HTTP API // HTTP API
virtual nlohmann::json getData( const Poco::URI::QueryParameters& p ) override; virtual nlohmann::json httpGet( const Poco::URI::QueryParameters& p ) override;
virtual nlohmann::json httpHelp( const Poco::URI::QueryParameters& p ) override; virtual nlohmann::json httpHelp( const Poco::URI::QueryParameters& p ) override;
// -------------- вспомогательные -------------- // -------------- вспомогательные --------------
......
...@@ -107,22 +107,22 @@ void UHttpRequestHandler::handleRequest( Poco::Net::HTTPServerRequest& req, Poco ...@@ -107,22 +107,22 @@ void UHttpRequestHandler::handleRequest( Poco::Net::HTTPServerRequest& req, Poco
} }
else if( objectName == "list" ) else if( objectName == "list" )
{ {
auto json = registry->getObjectsList(qp); auto json = registry->httpGetObjectsList(qp);
out << json.dump(); out << json.dump();
} }
else if( seg.size() == 4 && seg[3] == "help" ) // /api/version/ObjectName/help else if( seg.size() == 4 && seg[3] == "help" ) // /api/version/ObjectName/help
{ {
auto json = registry->helpByName(objectName, qp); auto json = registry->httpHelpByName(objectName, qp);
out << json.dump(); out << json.dump();
} }
else if( seg.size() >= 4 ) // /api/version/ObjectName/xxx.. else if( seg.size() >= 4 ) // /api/version/ObjectName/xxx..
{ {
auto json = registry->requestByName(objectName, seg[3], qp); auto json = registry->httpRequestByName(objectName, seg[3], qp);
out << json.dump(); out << json.dump();
} }
else else
{ {
auto json = registry->getDataByName(objectName, qp); auto json = registry->httpGetByName(objectName, qp);
out << json.dump(); out << json.dump();
} }
} }
...@@ -153,7 +153,7 @@ HTTPRequestHandler* UHttpRequestHandlerFactory::createRequestHandler( const HTTP ...@@ -153,7 +153,7 @@ HTTPRequestHandler* UHttpRequestHandlerFactory::createRequestHandler( const HTTP
return new UHttpRequestHandler(registry); return new UHttpRequestHandler(registry);
} }
// ------------------------------------------------------------------------- // -------------------------------------------------------------------------
nlohmann::json IHttpRequest::request( const string& req, const Poco::URI::QueryParameters& p ) nlohmann::json IHttpRequest::httpRequest( const string& req, const Poco::URI::QueryParameters& p )
{ {
std::ostringstream err; std::ostringstream err;
err << "(IHttpRequest::Request): " << req << " not supported"; err << "(IHttpRequest::Request): " << req << " not supported";
......
...@@ -861,14 +861,14 @@ UniSetActivator::TerminateEvent_Signal UniSetActivator::signal_terminate_event() ...@@ -861,14 +861,14 @@ UniSetActivator::TerminateEvent_Signal UniSetActivator::signal_terminate_event()
return s_term; return s_term;
} }
// ------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------
nlohmann::json UniSetActivator::getDataByName( const string& name, const Poco::URI::QueryParameters& p ) nlohmann::json UniSetActivator::httpGetByName( const string& name, const Poco::URI::QueryParameters& p )
{ {
if( name == myname ) if( name == myname )
return getData(p); return httpGet(p);
auto obj = deepFindObject(name); auto obj = deepFindObject(name);
if( obj ) if( obj )
return obj->getData(p); return obj->httpGet(p);
ostringstream err; ostringstream err;
err << "Object '" << name << "' not found"; err << "Object '" << name << "' not found";
...@@ -876,7 +876,7 @@ nlohmann::json UniSetActivator::getDataByName( const string& name, const Poco::U ...@@ -876,7 +876,7 @@ nlohmann::json UniSetActivator::getDataByName( const string& name, const Poco::U
throw UniSetTypes::NameNotFound(err.str()); throw UniSetTypes::NameNotFound(err.str());
} }
// ------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------
nlohmann::json UniSetActivator::getObjectsList( const Poco::URI::QueryParameters& p ) nlohmann::json UniSetActivator::httpGetObjectsList( const Poco::URI::QueryParameters& p )
{ {
nlohmann::json jdata; nlohmann::json jdata;
...@@ -893,7 +893,7 @@ nlohmann::json UniSetActivator::getObjectsList( const Poco::URI::QueryParameters ...@@ -893,7 +893,7 @@ nlohmann::json UniSetActivator::getObjectsList( const Poco::URI::QueryParameters
return jdata; return jdata;
} }
// ------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------
nlohmann::json UniSetActivator::helpByName( const string& name, const Poco::URI::QueryParameters& p ) nlohmann::json UniSetActivator::httpHelpByName( const string& name, const Poco::URI::QueryParameters& p )
{ {
if( name == myname ) if( name == myname )
return httpHelp(p); return httpHelp(p);
...@@ -907,14 +907,14 @@ nlohmann::json UniSetActivator::helpByName( const string& name, const Poco::URI: ...@@ -907,14 +907,14 @@ nlohmann::json UniSetActivator::helpByName( const string& name, const Poco::URI:
throw UniSetTypes::NameNotFound(err.str()); throw UniSetTypes::NameNotFound(err.str());
} }
// ------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------
nlohmann::json UniSetActivator::requestByName( const string& name, const std::string& req, const Poco::URI::QueryParameters& p) nlohmann::json UniSetActivator::httpRequestByName( const string& name, const std::string& req, const Poco::URI::QueryParameters& p)
{ {
if( name == myname ) if( name == myname )
return request(req,p); return httpRequest(req,p);
auto obj = deepFindObject(name); auto obj = deepFindObject(name);
if( obj ) if( obj )
return obj->request(req,p); return obj->httpRequest(req,p);
ostringstream err; ostringstream err;
err << "Object '" << name << "' not found"; err << "Object '" << name << "' not found";
......
...@@ -379,9 +379,13 @@ void UniSetObject::push( const TransportMessage& tm ) ...@@ -379,9 +379,13 @@ void UniSetObject::push( const TransportMessage& tm )
termWaiting(); termWaiting();
} }
// ------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------
nlohmann::json UniSetObject::getData( const Poco::URI::QueryParameters& p ) nlohmann::json UniSetObject::httpGet( const Poco::URI::QueryParameters& p )
{ {
nlohmann::json jdata; nlohmann::json jret;
std::string myid(to_string(getId()));
auto& jdata = jret[myid];
jdata["name"] = myname; jdata["name"] = myname;
jdata["id"] = getId(); jdata["id"] = getId();
jdata["msgCount"] = countMessages(); jdata["msgCount"] = countMessages();
...@@ -390,9 +394,7 @@ nlohmann::json UniSetObject::getData( const Poco::URI::QueryParameters& p ) ...@@ -390,9 +394,7 @@ nlohmann::json UniSetObject::getData( const Poco::URI::QueryParameters& p )
jdata["isActive"] = isActive(); jdata["isActive"] = isActive();
jdata["objectType"] = getType(); jdata["objectType"] = getType();
nlohmann::json ret; return jret;
ret[myname] = jdata;
return ret;
} }
// ------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------
nlohmann::json UniSetObject::httpHelp( const Poco::URI::QueryParameters& p ) nlohmann::json UniSetObject::httpHelp( const Poco::URI::QueryParameters& p )
......
...@@ -860,7 +860,7 @@ nlohmann::json IOController::httpHelp( const Poco::URI::QueryParameters& p ) ...@@ -860,7 +860,7 @@ nlohmann::json IOController::httpHelp( const Poco::URI::QueryParameters& p )
return jdata; return jdata;
} }
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
nlohmann::json IOController::request( const string& req, const Poco::URI::QueryParameters& p ) nlohmann::json IOController::httpRequest( const string& req, const Poco::URI::QueryParameters& p )
{ {
if( req == "get" ) if( req == "get" )
return request_get(req,p); return request_get(req,p);
...@@ -868,7 +868,7 @@ nlohmann::json IOController::request( const string& req, const Poco::URI::QueryP ...@@ -868,7 +868,7 @@ nlohmann::json IOController::request( const string& req, const Poco::URI::QueryP
if( req == "sensors" ) if( req == "sensors" )
return request_sensors(req,p); return request_sensors(req,p);
return UniSetManager::request(req,p); return UniSetManager::httpRequest(req,p);
} }
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
nlohmann::json IOController::request_get( const string& req, const Poco::URI::QueryParameters& p ) nlohmann::json IOController::request_get( const string& req, const Poco::URI::QueryParameters& p )
......
...@@ -1092,12 +1092,12 @@ nlohmann::json IONotifyController::httpHelp(const Poco::URI::QueryParameters& p) ...@@ -1092,12 +1092,12 @@ nlohmann::json IONotifyController::httpHelp(const Poco::URI::QueryParameters& p)
return std::move(jdata); return std::move(jdata);
} }
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
nlohmann::json IONotifyController::request( const string& req, const Poco::URI::QueryParameters& p ) nlohmann::json IONotifyController::httpRequest( const string& req, const Poco::URI::QueryParameters& p )
{ {
if( req == "consumers" ) if( req == "consumers" )
return request_consumers(req,p); return request_consumers(req,p);
return IOController::request(req,p); return IOController::httpRequest(req,p);
} }
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
nlohmann::json IONotifyController::request_consumers(const string& req, const Poco::URI::QueryParameters& p) nlohmann::json IONotifyController::request_consumers(const string& req, const Poco::URI::QueryParameters& p)
......
...@@ -12,7 +12,7 @@ class UTestSupplier: ...@@ -12,7 +12,7 @@ class UTestSupplier:
UTestSupplier(){} UTestSupplier(){}
virtual ~UTestSupplier(){} virtual ~UTestSupplier(){}
virtual nlohmann::json getData( const Poco::URI::QueryParameters& params ) override virtual nlohmann::json httpGet( const Poco::URI::QueryParameters& params ) override
{ {
nlohmann::json j; nlohmann::json j;
...@@ -34,7 +34,7 @@ class UTestSupplier: ...@@ -34,7 +34,7 @@ class UTestSupplier:
return j; return j;
} }
virtual nlohmann::json request( const std::string& req, const Poco::URI::QueryParameters& p ) override virtual nlohmann::json httpRequest( const std::string& req, const Poco::URI::QueryParameters& p ) override
{ {
nlohmann::json j; nlohmann::json j;
j[req] = "OK"; j[req] = "OK";
...@@ -50,14 +50,14 @@ class UTestRequestRegistry: ...@@ -50,14 +50,14 @@ class UTestRequestRegistry:
virtual ~UTestRequestRegistry(){} virtual ~UTestRequestRegistry(){}
virtual nlohmann::json getDataByName( const std::string& name, const Poco::URI::QueryParameters& p ) override virtual nlohmann::json httpGetByName( const std::string& name, const Poco::URI::QueryParameters& p ) override
{ {
nlohmann::json j = sup.getData(p); nlohmann::json j = sup.httpGet(p);
j["name"] = name; j["name"] = name;
return j; return j;
} }
virtual nlohmann::json getObjectsList( const Poco::URI::QueryParameters& p ) override virtual nlohmann::json httpGetObjectsList( const Poco::URI::QueryParameters& p ) override
{ {
nlohmann::json j; nlohmann::json j;
j.push_back("TestObject"); j.push_back("TestObject");
...@@ -66,7 +66,7 @@ class UTestRequestRegistry: ...@@ -66,7 +66,7 @@ class UTestRequestRegistry:
return j; return j;
} }
virtual nlohmann::json helpByName( const std::string& name, const Poco::URI::QueryParameters& p ) override virtual nlohmann::json httpHelpByName( const std::string& name, const Poco::URI::QueryParameters& p ) override
{ {
nlohmann::json j; nlohmann::json j;
j["TestObject"]["help"] = { j["TestObject"]["help"] = {
...@@ -77,7 +77,7 @@ class UTestRequestRegistry: ...@@ -77,7 +77,7 @@ class UTestRequestRegistry:
return j; return j;
} }
virtual nlohmann::json requestByName( const std::string& name, const std::string& req, const Poco::URI::QueryParameters& p ) override virtual nlohmann::json httpRequestByName( const std::string& name, const std::string& req, const Poco::URI::QueryParameters& p ) override
{ {
nlohmann::json j; nlohmann::json j;
j[name][req] = "OK"; j[name][req] = "OK";
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment