From: Leandro Lucarella Date: Mon, 1 Dec 2003 15:19:43 +0000 (+0000) Subject: Se borran los test porque estan desactualizados y ni siquiera compilan. X-Git-Tag: svn_import~121 X-Git-Url: https://git.llucax.com/z.facultad/75.42/plaqui.git/commitdiff_plain/b81da7a08ef57c3d0b9baa229eb5bd6b701fd84a?ds=sidebyside Se borran los test porque estan desactualizados y ni siquiera compilan. --- diff --git a/Server/include/plaqui/server/documentacion.h b/Server/include/plaqui/server/documentacion.h index 703c518..2b268ec 100644 --- a/Server/include/plaqui/server/documentacion.h +++ b/Server/include/plaqui/server/documentacion.h @@ -23,7 +23,7 @@ Este módulo está implementado por las clases PlaQui::Server::ControlServer y PlaQui::Server::ControlClient. - \subsection page_server_general_control_http Ventajas del protocolo HTTP. + \subsubsection page_server_general_control_http Ventajas del protocolo HTTP. Las ventajas de montar el protocolo del servidor sobre el protocolo HTTP son muchas. Las más destacables son las más obvias. diff --git a/Server/tests/client_test.cpp b/Server/tests/client_test.cpp deleted file mode 100644 index 9ff2fbb..0000000 --- a/Server/tests/client_test.cpp +++ /dev/null @@ -1,156 +0,0 @@ -// vim: set noexpandtab tabstop=4 shiftwidth=4: -//---------------------------------------------------------------------------- -// PlaQui -//---------------------------------------------------------------------------- -// This file is part of PlaQui. -// -// PlaQui is free software; you can redistribute it and/or modify it under the -// terms of the GNU General Public License as published by the Free Software -// Foundation; either version 2 of the License, or (at your option) any later -// version. -// -// PlaQui is distributed in the hope that it will be useful, but WITHOUT ANY -// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS -// FOR A PARTICULAR PURPOSE. See the GNU General Public License for more -// details. -// -// You should have received a copy of the GNU General Public License along -// with PlaQui; if not, write to the Free Software Foundation, Inc., 59 Temple -// Place, Suite 330, Boston, MA 02111-1307 USA -//---------------------------------------------------------------------------- -// Creado: jue nov 13 00:53:38 ART 2003 -// Autores: Leandro Lucarella -//---------------------------------------------------------------------------- -// -// $Id$ -// - -#include "plaqui/server/controlclient.h" -#include "plaqui/server/string.h" -#include -#include -#include - -using namespace std; -using namespace PlaQui::Server; - -ControlClient* client = NULL; - -void on_error(const Runnable::Error& code, const string& desc) { - cerr << "--------------------------------------------------------" << endl; - cerr << "Error en el cliente:" << endl; - cerr << "Código: " << code << endl; - cerr << "Descripción: " << desc << endl; - cerr << "--------------------------------------------------------" << endl; -} - -void on_finished(void) { - client = NULL; -} - -void on_connected(void) { - cout << " Conectado! :-)" << endl; -} - -void on_ok_received(const string& body) { - cout << " Respuesta recibida: OK! :-D" << endl; - cout << " Body: " << body << endl; -} - -void on_frame_received(const string& frame) { - cout << " Frame recibido! :-D" << endl; - cout << frame << endl; -} - -void on_error_received(unsigned code) { - cout << " Respuesta recibida: Error nro " << code << "! :-(" << endl; -} - -int main(int argc, char* argv[]) { - - // Termina con mas informacion si hay una excepcion no manejada. - set_terminate (__gnu_cxx::__verbose_terminate_handler); - - // Mensaje de bienvenida. - cout << "Client test. Modo de uso: " << endl; - cout << "\t" << argv[0] << " [host] [port]" << endl; - cout << "Luego se envian comandos con el siguiente formato:" << endl; - cout << "\t [] [] [...] []" << endl; - - // Parámetros. - string host = "localhost"; - if (argc > 1) { - // Obtengo host. - host = argv[1]; - } - // Obtengo puerto. - Connection::Port port = 7522; - if (argc > 2) { - to(argv[2], port); - } - - // Inicializa threads. - Glib::thread_init(); - - try { - // Corre el cliente. - client = new ControlClient(host, port); - client->signal_error().connect(SigC::slot(on_error)); - client->signal_finished().connect(SigC::slot(on_finished)); - client->signal_connected().connect(SigC::slot(on_connected)); - client->signal_ok_received().connect(SigC::slot(on_ok_received)); - client->signal_error_received().connect(SigC::slot(on_error_received)); - client->signal_frame_received().connect(SigC::slot(on_frame_received)); - client->run(); - char buf[BUFSIZ]; - while (cin.getline(buf, BUFSIZ)) { - if (!client) { - break; - } - vector v = String(buf).split(' '); - switch (v.size()) { - case 0: - client->send(Command()); - break; - case 1: - client->send(Command(v[0])); - break; - case 2: - client->send(Command(v[0], v[1])); - break; - default: - Command cmd(v[0], v[1]); - v.erase(v.begin(), v.begin() + 2); - cmd.set_args(v); - client->send(cmd); - break; - } - } - } catch (const sockerr& e) { - cerr << "Socket Error: " << e.operation() << " | serrno = " - << e.serrno() << " | errstr = " << e.errstr() << endl; - if (e.io()) { - cerr << "Es: non-blocking and interrupt io recoverable error." - << endl; - } else if (e.arg()) { - cerr << "Es: incorrect argument supplied. recoverable error." - << endl; - } else if (e.op()) { - cerr << "Es: operational error. recovery difficult." << endl; - } else if (e.conn()) { - cerr << "Es: connection error." << endl; - } else if (e.addr()) { - cerr << "Es: address error." << endl; - } else if (e.benign()) { - cerr << "Es: recoverable read/write error like EINTR etc." << endl; - } - } catch (const exception& e) { - cerr << "Error: " << e.what() << endl; - } catch (const char* e) { - cerr << "Error: " << e << endl; - } catch (...) { - cerr << "Error desconocido!" << endl; - } - - return 0; -} diff --git a/Server/tests/prueba.xml b/Server/tests/prueba.xml deleted file mode 100644 index 48fe609..0000000 --- a/Server/tests/prueba.xml +++ /dev/null @@ -1,207 +0,0 @@ - - - - 50,00 - - 255 - 0 - 0 - - - codo1 - - 0 - 32 - 64 - - - 40,00 - - bomba0 - tubo2 - - 0 - 128 - 64 - - - 40,00 - - codo1 - division3 - - 0 - 160 - 128 - - - division - - codo9 - codo4 - tubo2 - - 40,00 - 2 - 128 - 224 - - - 40,00 - - tubo5 - division3 - - 3 - 64 - 256 - - - 30,00 - - codo4 - tanque6 - - 0 - 64 - 320 - - - 150,00 - 75,00 - - 0 - 0 - 0 - - - tubo5 - exclusa18 - - 0 - 64 - 416 - - - 4,00 - - exclusa18 - drenaje8 - - 0 - 192 - 448 - - - - codo7 - - 0 - 224 - 512 - - - 20,00 - - tubo10 - division3 - - 1 - 224 - 224 - - - 25,00 - - codo12 - codo9 - - 0 - 256 - 128 - - - union - - codo12 - exclusa13 - tubo15 - - 45,00 - 0 - 320 - 64 - - - 30,00 - - tubo10 - union11 - - 3 - 256 - 64 - - - - union11 - bomba14 - - 0 - 1 - 416 - 64 - - - 15,00 - - 0 - 0 - 0 - - - exclusa13 - - 1 - 480 - 64 - - - 20,00 - - union11 - codo16 - - 0 - 352 - 128 - - - 25,00 - - drenaje17 - tubo15 - - 2 - 352 - 224 - - - - codo16 - - 3 - 416 - 256 - - - - tanque6 - codo7 - - 0 - 1 - 128 - 448 - - diff --git a/Server/tests/receiver_test.cpp b/Server/tests/receiver_test.cpp deleted file mode 100644 index f1e86b9..0000000 --- a/Server/tests/receiver_test.cpp +++ /dev/null @@ -1,97 +0,0 @@ -// vim: set noexpandtab tabstop=4 shiftwidth=4: -//---------------------------------------------------------------------------- -// PlaQui -//---------------------------------------------------------------------------- -// This file is part of PlaQui. -// -// PlaQui is free software; you can redistribute it and/or modify it under the -// terms of the GNU General Public License as published by the Free Software -// Foundation; either version 2 of the License, or (at your option) any later -// version. -// -// PlaQui is distributed in the hope that it will be useful, but WITHOUT ANY -// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS -// FOR A PARTICULAR PURPOSE. See the GNU General Public License for more -// details. -// -// You should have received a copy of the GNU General Public License along -// with PlaQui; if not, write to the Free Software Foundation, Inc., 59 Temple -// Place, Suite 330, Boston, MA 02111-1307 USA -//---------------------------------------------------------------------------- -// Creado: jue nov 13 00:53:38 ART 2003 -// Autores: Leandro Lucarella -//---------------------------------------------------------------------------- -// -// $Id$ -// - -#include "plaqui/server/receiver.h" -#include "plaqui/server/string.h" -#include -#include - -using namespace std; -using namespace PlaQui::Server; - -void on_frame_received(const string& frame) { - cout << " Frame recibido! :-D" << endl; - cout << frame << endl; -} - -int main(int argc, char* argv[]) { - - // Termina con mas informacion si hay una excepcion no manejada. - set_terminate (__gnu_cxx::__verbose_terminate_handler); - - // Mensaje de bienvenida. - cout << "Receiver test. Modo de uso: " << endl; - cout << "\t" << argv[0] << " [port] [host]" << endl; - - // Parámetros. - Connection::Port port = 7528; - if (argc > 1) { - // Obtengo puerto. - to(argv[1], port); - } - string host = "localhost"; - if (argc > 2) { - // Obtengo host. - host = argv[2]; - } - - // Inicializa threads. - Glib::thread_init(); - - try { - // Corre el cliente. - Receiver receptor(port, host); - receptor.signal_frame_received().connect(SigC::slot(on_frame_received)); - receptor.run(false); - } catch (const sockerr& e) { - cerr << "Socket Error: " << e.operation() << " | serrno = " - << e.serrno() << " | errstr = " << e.errstr() << endl; - if (e.io()) { - cerr << "Es: non-blocking and interrupt io recoverable error." - << endl; - } else if (e.arg()) { - cerr << "Es: incorrect argument supplied. recoverable error." - << endl; - } else if (e.op()) { - cerr << "Es: operational error. recovery difficult." << endl; - } else if (e.conn()) { - cerr << "Es: connection error." << endl; - } else if (e.addr()) { - cerr << "Es: address error." << endl; - } else if (e.benign()) { - cerr << "Es: recoverable read/write error like EINTR etc." << endl; - } - } catch (const exception& e) { - cerr << "Error: " << e.what() << endl; - } catch (const char* e) { - cerr << "Error: " << e << endl; - } catch (...) { - cerr << "Error desconocido!" << endl; - } - - return 0; -} diff --git a/Server/tests/server_test.cpp b/Server/tests/server_test.cpp deleted file mode 100644 index 1f505ee..0000000 --- a/Server/tests/server_test.cpp +++ /dev/null @@ -1,127 +0,0 @@ -// vim: set noexpandtab tabstop=4 shiftwidth=4: -//---------------------------------------------------------------------------- -// PlaQui -//---------------------------------------------------------------------------- -// This file is part of PlaQui. -// -// PlaQui is free software; you can redistribute it and/or modify it under the -// terms of the GNU General Public License as published by the Free Software -// Foundation; either version 2 of the License, or (at your option) any later -// version. -// -// PlaQui is distributed in the hope that it will be useful, but WITHOUT ANY -// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS -// FOR A PARTICULAR PURPOSE. See the GNU General Public License for more -// details. -// -// You should have received a copy of the GNU General Public License along -// with PlaQui; if not, write to the Free Software Foundation, Inc., 59 Temple -// Place, Suite 330, Boston, MA 02111-1307 USA -//---------------------------------------------------------------------------- -// Creado: Sat Oct 18 18:18:36 2003 -// Autores: Leandro Lucarella -//---------------------------------------------------------------------------- -// -// $Id$ -// - -#include "plaqui/server/connection.h" -#include "plaqui/server/server.h" -#include "plaqui/server/string.h" -#include -#include -#include -#include - -using namespace std; -using namespace PlaQui::Server; - -Server* server = NULL; - -void on_error(const Runnable::Error& code, const string& desc) { - cerr << "--------------------------------------------------------" << endl; - cerr << "Error en el servidor:" << endl; - cerr << "Código: " << code << endl; - cerr << "Descripción: " << desc << endl; - cerr << "--------------------------------------------------------" << endl; -} - -void on_finished(void) { - cerr << "Murió el servidor!" << endl; - server = NULL; -} - -int main(int argc, char* argv[]) { - - // Termina con mas informacion si hay una excepcion no manejada. - set_terminate (__gnu_cxx::__verbose_terminate_handler); - - // Bienvenida. - cout << "PlaQui Server. Modo de uso: " << endl; - cout << "\t" << argv[0] << " [planta] [puerto]" << endl; - - // Acepta argumentos. - string filename = "prueba.xml"; - Connection::Port port = 7522; - if (argc > 1) { - // Obtengo nombre del archivo de la planta. - filename = argv[1]; - // Si tiene 2 parámetros. - if (argc > 2) { - // Obtengo puerto. - to(argv[2], port); - } - } - - // Inicializa threads. - Glib::thread_init(); - - try { - // Crea el server (empieza a escuchar). - server = new Server(filename, port); - } catch (const sockerr& e) { - cerr << "Socket Error: " << e.operation() << " | serrno = " - << e.serrno() << " | errstr = " << e.errstr() << endl; - if (e.io()) { - cerr << "Es: non-blocking and interrupt io recoverable error." - << endl; - } else if (e.arg()) { - cerr << "Es: incorrect argument supplied. recoverable error." - << endl; - } else if (e.op()) { - cerr << "Es: operational error. recovery difficult." << endl; - } else if (e.conn()) { - cerr << "Es: connection error." << endl; - } else if (e.addr()) { - cerr << "Es: address error." << endl; - } else if (e.benign()) { - cerr << "Es: recoverable read/write error like EINTR etc." << endl; - } - return e.serrno(); - } catch (const exception& e) { - cerr << "Error: " << e.what() << endl; - return 1; - } catch (const char* e) { - cerr << "Error: " << e << endl; - return 2; - } catch (...) { - cerr << "Error desconocido!" << endl; - return 3; - } - - // Conecto señal para atender errores. - server->signal_error().connect(SigC::slot(on_error)); - - // Corre el server. - server->run(false); - - // Espera a que el server se muera. - while (server) { - Glib::usleep(1000000); - } - - // Como no detachee el server, lo tengo que eliminar a mano. - //delete server; - - return 0; -}