From 22c82ecc4964ac3a805820c5d953c58aaf7cbde9 Mon Sep 17 00:00:00 2001 From: Edouard DUPIN Date: Mon, 2 Jan 2017 22:34:51 +0100 Subject: [PATCH] [DEV] correct launch in gateway of service and correct the test client API --- test/client/appl/main-test-client.cpp | 33 ++++++++++++++++++--------- tools/gateway/appl/main-gateway.cpp | 3 ++- tools/launcher/appl/main-launcher.cpp | 1 - 3 files changed, 24 insertions(+), 13 deletions(-) diff --git a/test/client/appl/main-test-client.cpp b/test/client/appl/main-test-client.cpp index 65b82ee..1287de1 100644 --- a/test/client/appl/main-test-client.cpp +++ b/test/client/appl/main-test-client.cpp @@ -317,12 +317,23 @@ int main(int _argc, const char *_argv[]) { elog::init(_argc, _argv); zeus::init(_argc, _argv); zeus::Client client1; + std::string fromUser = "test1"; + std::string toUser = "test1"; + std::string pass = "coucou"; for (int32_t iii=0; iii<_argc ; ++iii) { std::string data = _argv[iii]; if (etk::start_with(data, "--ip=") == true) { client1.propertyIp.set(std::string(&data[5])); } else if (etk::start_with(data, "--port=") == true) { client1.propertyPort.set(etk::string_to_uint16_t(std::string(&data[7]))); + } else if (etk::start_with(data, "--from=") == true) { + fromUser = &data[7]; + } else if (etk::start_with(data, "--to=") == true) { + toUser = &data[7]; + } else if (etk::start_with(data, "--pass=") == true) { + pass = &data[7]; + } else if (etk::start_with(data, "--tocken=") == true) { + pass = &data[9]; } else if ( data == "-h" || data == "--help") { APPL_PRINT(etk::getApplicationName() << " - help : "); @@ -336,29 +347,29 @@ int main(int _argc, const char *_argv[]) { APPL_INFO("== ZEUS test client start =="); APPL_INFO("=================================="); - if (false) { - bool ret = client1.connect("test1", "clientTest1~atria-soft.com", "QSDQSDGQSF54HSXWVCSQDJ654URTDJ654NBXCDFDGAEZ51968"); + if (fromUser == toUser) { + bool ret = client1.connect(fromUser, pass); if (ret == false) { - APPL_ERROR(" ==> NOT Connected to 'test1~atria-soft.com' with 'clientTest1~atria-soft.com'"); + APPL_ERROR(" ==> NOT Authentify with '" << toUser << "'"); return -1; } else { - APPL_INFO(" ==> Connected with 'clientTest1~atria-soft.com'"); + APPL_INFO(" ==> Authentify with '" << toUser << "'"); } - } else if (true) { - bool ret = client1.connect("test1", "coucou"); + } else if (fromUser != "") { + bool ret = client1.connect(fromUser, toUser, pass); if (ret == false) { - APPL_ERROR(" ==> NOT Authentify with 'test1~atria-soft.com'"); + APPL_ERROR(" ==> NOT Connected to '" << toUser << "' with '" << fromUser << "'"); return -1; } else { - APPL_INFO(" ==> Authentify with 'test1~atria-soft.com'"); + APPL_INFO(" ==> Connected with '" << toUser << "'"); } } else { - bool ret = client1.connect("test1"); + bool ret = client1.connect(toUser); if (ret == false) { - APPL_ERROR(" ==> NOT Connected with 'anonymous'"); + APPL_ERROR(" ==> NOT Connected with 'anonymous' to '" << toUser << "'"); return -1; } else { - APPL_INFO(" ==> Connected with 'anonymous'"); + APPL_INFO(" ==> Connected with 'anonymous' to '" << toUser << "'"); } } // Connect to ourself: diff --git a/tools/gateway/appl/main-gateway.cpp b/tools/gateway/appl/main-gateway.cpp index a225100..0f98a30 100644 --- a/tools/gateway/appl/main-gateway.cpp +++ b/tools/gateway/appl/main-gateway.cpp @@ -40,7 +40,6 @@ class PlugginAccess { SERVICE_IO_uninit_t m_SERVICE_IO_uninit; SERVICE_IO_peridic_call_t m_SERVICE_IO_peridic_call; SERVICE_IO_instanciate_t m_SERVICE_IO_instanciate; - zeus::Client m_client; public: PlugginAccess(const std::string& _name) : m_name(_name), @@ -132,6 +131,8 @@ int main(int _argc, const char *_argv[]) { std::string basePath; std::vector services; zeus::Client m_client; + // The default service port is 1985 + m_client.propertyPort.set(1985); #endif for (int32_t iii=0; iii<_argc ; ++iii) { std::string data = _argv[iii]; diff --git a/tools/launcher/appl/main-launcher.cpp b/tools/launcher/appl/main-launcher.cpp index c0082c1..c915e81 100644 --- a/tools/launcher/appl/main-launcher.cpp +++ b/tools/launcher/appl/main-launcher.cpp @@ -32,7 +32,6 @@ class PlugginAccess { SERVICE_IO_uninit_t m_SERVICE_IO_uninit; SERVICE_IO_peridic_call_t m_SERVICE_IO_peridic_call; SERVICE_IO_instanciate_t m_SERVICE_IO_instanciate; - zeus::Client m_client; public: PlugginAccess(const std::string& _name) : m_name(_name),