Commit a04f5df45255751976f490eada14044819e95a87

Authored by Eric Menezes Noronha
1 parent 1413864d
Exists in master

correção da coleta.

cacic-teste/testcacic.cpp
@@ -9,7 +9,7 @@ CTestCacic::CTestCacic(QObject *parent) : @@ -9,7 +9,7 @@ CTestCacic::CTestCacic(QObject *parent) :
9 9
10 void CTestCacic::initTestCase() 10 void CTestCacic::initTestCase()
11 { 11 {
12 - this->OCacicComm = new CacicComm("https://teste.cacic.cc", 12 + this->OCacicComm = new CacicComm("https://teste.cacic.cc/app_dev.php",
13 "rG/HcIDVTZ3pPKCf[[MAIS]]I6aigUb7OMeij3FfC7qNaznk0rBRYb6q6kSK3eNfjgptS8BfwW5yJqCvD2ai7xlw9I6P21j6cvQUqlHmAJpCbfwR13urdRE9AhjfokMcPrH6R1/zXPGMHveLRRgKLcqWu2X96rmoQQdRq9EW1SXmYUAx1dCV[[MAIS]]3Ha61XBw5pq58q35zH8Gjt998rTi3ecV8ShXXevqyK[[MAIS]]W07xpgTjbbd6Fbs/35gPfdRRgMNFjq7Gq[[MAIS]]llFgYMJ6UcEhw8f0ZLQo2oL/eRW/CNyeBW6wG0hIo6EIdpi/Ht0/95Uwn2Og[[MAIS]]2UPXsmKKuTMeGwUvPdbEfexlinUO0[[MAIS]]j9qIa2dpjtl0Y5Fyk1Bvw2ZYRTXwgJpUHsBboWmtTFpgX3wSGOWMipE80K8ktRTVYOp[[MAIS]]4qS/SzKWXpfCuZoCncfwE0lCEoreTH[[MAIS]]MLrTkHJP2oqYMAyFyQcjC0UGr3BQGa2edSNXjG7jrTdddga/SODUiF94jgh/QBwhiZby34b__CRYPTED__", 13 "rG/HcIDVTZ3pPKCf[[MAIS]]I6aigUb7OMeij3FfC7qNaznk0rBRYb6q6kSK3eNfjgptS8BfwW5yJqCvD2ai7xlw9I6P21j6cvQUqlHmAJpCbfwR13urdRE9AhjfokMcPrH6R1/zXPGMHveLRRgKLcqWu2X96rmoQQdRq9EW1SXmYUAx1dCV[[MAIS]]3Ha61XBw5pq58q35zH8Gjt998rTi3ecV8ShXXevqyK[[MAIS]]W07xpgTjbbd6Fbs/35gPfdRRgMNFjq7Gq[[MAIS]]llFgYMJ6UcEhw8f0ZLQo2oL/eRW/CNyeBW6wG0hIo6EIdpi/Ht0/95Uwn2Og[[MAIS]]2UPXsmKKuTMeGwUvPdbEfexlinUO0[[MAIS]]j9qIa2dpjtl0Y5Fyk1Bvw2ZYRTXwgJpUHsBboWmtTFpgX3wSGOWMipE80K8ktRTVYOp[[MAIS]]4qS/SzKWXpfCuZoCncfwE0lCEoreTH[[MAIS]]MLrTkHJP2oqYMAyFyQcjC0UGr3BQGa2edSNXjG7jrTdddga/SODUiF94jgh/QBwhiZby34b__CRYPTED__",
14 "P198PVwtz5F5CfZPSUrzuaQA/QG1sTnwzl/rBnj8M7y5MglANGodG5LLD4q7oY809HuDR4g5tL64lZRBKvKPmEgWd9iAZKvT4UAm9XWN3nKKLGaznCaJohmntNGqrJP1Zd9riTHGu10mPbg/Uh3TCbBHVOICvu5sDlINlCR6A3[[MAIS]]a55RhfKNidvr5uX0kozCxr5t2DyOb5oPocEGyJKyHLQ==__CRYPTED__", 14 "P198PVwtz5F5CfZPSUrzuaQA/QG1sTnwzl/rBnj8M7y5MglANGodG5LLD4q7oY809HuDR4g5tL64lZRBKvKPmEgWd9iAZKvT4UAm9XWN3nKKLGaznCaJohmntNGqrJP1Zd9riTHGu10mPbg/Uh3TCbBHVOICvu5sDlINlCR6A3[[MAIS]]a55RhfKNidvr5uX0kozCxr5t2DyOb5oPocEGyJKyHLQ==__CRYPTED__",
15 "1", 15 "1",
@@ -24,7 +24,7 @@ void CTestCacic::initTestCase() @@ -24,7 +24,7 @@ void CTestCacic::initTestCase()
24 "2.5.1.1.256.32", 24 "2.5.1.1.256.32",
25 "2.8.1.7", 25 "2.8.1.7",
26 "2.8.1.6"); 26 "2.8.1.6");
27 - OCacicComm->setUrlSsl("https://teste.cacic.cc"); 27 + OCacicComm->setUrlSsl("https://teste.cacic.cc/app_dev.php");
28 OCacicComm->setUsuario("cacic"); 28 OCacicComm->setUsuario("cacic");
29 OCacicComm->setPassword("cacic123"); 29 OCacicComm->setPassword("cacic123");
30 this->testPath = QDir::currentPath() + "/teste"; 30 this->testPath = QDir::currentPath() + "/teste";
@@ -214,18 +214,6 @@ void CTestCacic::testRemoveRegistry() @@ -214,18 +214,6 @@ void CTestCacic::testRemoveRegistry()
214 confirmaTeste.sync(); 214 confirmaTeste.sync();
215 } 215 }
216 216
217 -  
218 -void CTestCacic::testColetaSoftware()  
219 -{  
220 - OCacicSoftware.iniciaColeta();  
221 - QVERIFY(!OCacicSoftware.toJsonObject().empty());  
222 -}  
223 -  
224 -void CTestCacic::testColetaHardware()  
225 -{  
226 - OCacicHardware.iniciaColeta();  
227 - QVERIFY(!OCacicHardware.toJsonObject().isEmpty());  
228 -}  
229 void CTestCacic::testConvertDouble() 217 void CTestCacic::testConvertDouble()
230 { 218 {
231 double number = 4.0905; 219 double number = 4.0905;
@@ -256,6 +244,19 @@ void CTestCacic::testGetConfig() @@ -256,6 +244,19 @@ void CTestCacic::testGetConfig()
256 QVERIFY(ok); 244 QVERIFY(ok);
257 } 245 }
258 246
  247 +void CTestCacic::testColetaSoftware()
  248 +{
  249 + oColeta.configuraColetas();
  250 + oColeta.run();
  251 + oColeta.waitToCollect();
  252 + QVERIFY(!oColeta.toJsonObject()["software"].toObject().isEmpty());
  253 +}
  254 +
  255 +void CTestCacic::testColetaHardware()
  256 +{
  257 + QVERIFY(!oColeta.toJsonObject()["hardware"].toObject().isEmpty());
  258 +}
  259 +
259 void CTestCacic::testLogger() 260 void CTestCacic::testLogger()
260 { 261 {
261 QLogger::QLoggerManager *logManager = QLogger::QLoggerManager::getInstance(); 262 QLogger::QLoggerManager *logManager = QLogger::QLoggerManager::getInstance();
@@ -339,7 +340,7 @@ void CTestCacic::testGetModulesValues() @@ -339,7 +340,7 @@ void CTestCacic::testGetModulesValues()
339 340
340 void CTestCacic::cleanupTestCase() 341 void CTestCacic::cleanupTestCase()
341 { 342 {
342 - OCacic.deleteFile("gpl-2.0.txt"); 343 + OCacic.deleteFile("gpl-2.0.txt");
343 OCacic.deleteFile("log01.txt"); 344 OCacic.deleteFile("log01.txt");
344 OCacic.deleteFile("./log02.txt"); 345 OCacic.deleteFile("./log02.txt");
345 OCacic.deleteFile("../log03.txt"); 346 OCacic.deleteFile("../log03.txt");
@@ -351,4 +352,5 @@ void CTestCacic::cleanupTestCase() @@ -351,4 +352,5 @@ void CTestCacic::cleanupTestCase()
351 OCacic.deleteFile("configRequest.json"); 352 OCacic.deleteFile("configRequest.json");
352 OCacic.deleteFile("teste.json"); 353 OCacic.deleteFile("teste.json");
353 OCacic.deleteFile("getConfig.json"); 354 OCacic.deleteFile("getConfig.json");
  355 + OCacic.deleteFolder("./temp");
354 } 356 }
cacic-teste/testcacic.h
@@ -71,11 +71,11 @@ private slots: @@ -71,11 +71,11 @@ private slots:
71 void testSetRegistry(); 71 void testSetRegistry();
72 void testGetValueFromRegistry(); 72 void testGetValueFromRegistry();
73 void testRemoveRegistry(); 73 void testRemoveRegistry();
74 - void testColetaSoftware();  
75 - void testColetaHardware();  
76 void testConvertDouble(); 74 void testConvertDouble();
77 void testGetTest(); 75 void testGetTest();
78 void testGetConfig(); 76 void testGetConfig();
  77 + void testColetaSoftware();
  78 + void testColetaHardware();
79 void testLogger(); 79 void testLogger();
80 void testFtpDownload(); 80 void testFtpDownload();
81 void testEnviaColeta(); 81 void testEnviaColeta();
src/cacic_comm.cpp
@@ -225,9 +225,8 @@ void CacicComm::fileDownloadFinished(QNetworkReply* reply) @@ -225,9 +225,8 @@ void CacicComm::fileDownloadFinished(QNetworkReply* reply)
225 out << reply->readAll(); 225 out << reply->readAll();
226 fileHandler->close(); 226 fileHandler->close();
227 reply->close(); 227 reply->close();
228 - } else {  
229 - qDebug() << "Falha ao baixar arquivo.";  
230 - } 228 + } else
  229 + qDebug() << "Falha ao baixar arquivo :" << reply->errorString();
231 } 230 }
232 231
233 QString CacicComm::getFtpPass() const 232 QString CacicComm::getFtpPass() const
src/ccoleta.cpp
@@ -44,8 +44,8 @@ void CColeta::run() @@ -44,8 +44,8 @@ void CColeta::run()
44 /* Versão do json de testes */ 44 /* Versão do json de testes */
45 QJsonObject coleta = oCacic.getJsonFromFile("getConfig.json"); 45 QJsonObject coleta = oCacic.getJsonFromFile("getConfig.json");
46 // qDebug() << coleta; 46 // qDebug() << coleta;
47 - QJsonObject actions = coleta["reply"].toObject()["agentcomputer"].toObject()["actions"].toObject();  
48 -// qDebug() << actions["col_hard"] << actions["col_soft"]; 47 + QJsonObject actions = coleta["agentcomputer"].toObject()["actions"].toObject();
  48 +// qDebug() << actions["col_hard"].toBool() << actions["col_soft"].toBool();
49 if( actions.contains("col_hard") && actions["col_hard"].toBool()){ 49 if( actions.contains("col_hard") && actions["col_hard"].toBool()){
50 this->hardwareIsFinish = false; 50 this->hardwareIsFinish = false;
51 emit beginHardware(); 51 emit beginHardware();
@@ -64,7 +64,7 @@ QJsonObject CColeta::toJsonObject() @@ -64,7 +64,7 @@ QJsonObject CColeta::toJsonObject()
64 { 64 {
65 QJsonObject coletaJson; 65 QJsonObject coletaJson;
66 if (this->hardwareIsFinish && this->softwareIsFinish){ 66 if (this->hardwareIsFinish && this->softwareIsFinish){
67 - coletaJson["computer"] = oComputer.toJsonObject(); 67 + coletaJson["computador"] = oComputer.toJsonObject();
68 coletaJson["software"] = oSoftware.toJsonObject(); 68 coletaJson["software"] = oSoftware.toJsonObject();
69 coletaJson["hardware"] = oHardware.toJsonObject(); 69 coletaJson["hardware"] = oHardware.toJsonObject();
70 } 70 }
src/checkmodules.cpp
@@ -7,7 +7,8 @@ CheckModules::CheckModules(const QString &amp;workingPath) @@ -7,7 +7,8 @@ CheckModules::CheckModules(const QString &amp;workingPath)
7 configFile = oCacic.getJsonFromFile(workingPath + "/getConfig.json"); 7 configFile = oCacic.getJsonFromFile(workingPath + "/getConfig.json");
8 if (!configFile.isEmpty()) { 8 if (!configFile.isEmpty()) {
9 //pega url do gerente. 9 //pega url do gerente.
10 - this->applicationUrl = configFile["agentcomputer"].toObject()["applicationUrl"].toString(); 10 + this->applicationUrl = configFile["agentcomputer"].toObject()["metodoDownload"].toObject()["url"].toString();
  11 + qDebug() << applicationUrl;
11 QJsonArray modulos; 12 QJsonArray modulos;
12 //pega o jsonarray dos módulos 13 //pega o jsonarray dos módulos
13 modulos = configFile["agentcomputer"].toObject()["modulos"].toArray(); 14 modulos = configFile["agentcomputer"].toObject()["modulos"].toArray();