2020-05-08 12:43:46 +02:00
|
|
|
#include <iostream>
|
|
|
|
#include <cstdlib>
|
|
|
|
|
|
|
|
#include "conexion.h"
|
|
|
|
#include "conexion_ssl.h"
|
|
|
|
#include "config_reader.h"
|
|
|
|
#include "tests.h"
|
2020-05-31 19:24:35 +02:00
|
|
|
#include "msql_acces.h"
|
2020-05-08 12:43:46 +02:00
|
|
|
|
|
|
|
#define file_config "config"
|
|
|
|
CPPUNIT_TEST_SUITE_REGISTRATION( test_basic );
|
|
|
|
int main()
|
|
|
|
{
|
2020-05-31 19:24:35 +02:00
|
|
|
//msql_acces data;
|
|
|
|
//data.create_user("otro", "otro", true);
|
|
|
|
|
2020-05-08 12:43:46 +02:00
|
|
|
//inicio de los tests
|
|
|
|
CPPUNIT_NS::TestResult testresult;
|
|
|
|
CPPUNIT_NS::TestResultCollector collectedresults;
|
|
|
|
testresult.addListener (&collectedresults);
|
|
|
|
CPPUNIT_NS::BriefTestProgressListener progress;
|
|
|
|
testresult.addListener (&progress);
|
|
|
|
CPPUNIT_NS::TestRunner testrunner;
|
|
|
|
testrunner.addTest (CPPUNIT_NS::TestFactoryRegistry::getRegistry().makeTest ());
|
|
|
|
testrunner.run(testresult);
|
|
|
|
CPPUNIT_NS::CompilerOutputter compileroutputter(&collectedresults, std::cerr);
|
|
|
|
compileroutputter.write ();
|
|
|
|
|
|
|
|
config_reader conf = config_reader(file_config);
|
|
|
|
string option;
|
|
|
|
if(conf.get_param("security",option)){
|
|
|
|
conexion *con=nullptr;
|
|
|
|
if(option=="yes"){
|
|
|
|
con = new conexion_ssl(conf);
|
|
|
|
}else if(option=="no"){
|
|
|
|
con = new conexion(conf);
|
|
|
|
}else{
|
|
|
|
perror("unknow option in security option");
|
|
|
|
}
|
|
|
|
con->start_server();
|
|
|
|
}else{
|
|
|
|
perror("no define security option");
|
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
}
|