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 9  
10 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 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 14 "P198PVwtz5F5CfZPSUrzuaQA/QG1sTnwzl/rBnj8M7y5MglANGodG5LLD4q7oY809HuDR4g5tL64lZRBKvKPmEgWd9iAZKvT4UAm9XWN3nKKLGaznCaJohmntNGqrJP1Zd9riTHGu10mPbg/Uh3TCbBHVOICvu5sDlINlCR6A3[[MAIS]]a55RhfKNidvr5uX0kozCxr5t2DyOb5oPocEGyJKyHLQ==__CRYPTED__",
15 15 "1",
... ... @@ -24,7 +24,7 @@ void CTestCacic::initTestCase()
24 24 "2.5.1.1.256.32",
25 25 "2.8.1.7",
26 26 "2.8.1.6");
27   - OCacicComm->setUrlSsl("https://teste.cacic.cc");
  27 + OCacicComm->setUrlSsl("https://teste.cacic.cc/app_dev.php");
28 28 OCacicComm->setUsuario("cacic");
29 29 OCacicComm->setPassword("cacic123");
30 30 this->testPath = QDir::currentPath() + "/teste";
... ... @@ -214,18 +214,6 @@ void CTestCacic::testRemoveRegistry()
214 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 217 void CTestCacic::testConvertDouble()
230 218 {
231 219 double number = 4.0905;
... ... @@ -256,6 +244,19 @@ void CTestCacic::testGetConfig()
256 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 260 void CTestCacic::testLogger()
260 261 {
261 262 QLogger::QLoggerManager *logManager = QLogger::QLoggerManager::getInstance();
... ... @@ -339,7 +340,7 @@ void CTestCacic::testGetModulesValues()
339 340  
340 341 void CTestCacic::cleanupTestCase()
341 342 {
342   - OCacic.deleteFile("gpl-2.0.txt");
  343 + OCacic.deleteFile("gpl-2.0.txt");
343 344 OCacic.deleteFile("log01.txt");
344 345 OCacic.deleteFile("./log02.txt");
345 346 OCacic.deleteFile("../log03.txt");
... ... @@ -351,4 +352,5 @@ void CTestCacic::cleanupTestCase()
351 352 OCacic.deleteFile("configRequest.json");
352 353 OCacic.deleteFile("teste.json");
353 354 OCacic.deleteFile("getConfig.json");
  355 + OCacic.deleteFolder("./temp");
354 356 }
... ...
cacic-teste/testcacic.h
... ... @@ -71,11 +71,11 @@ private slots:
71 71 void testSetRegistry();
72 72 void testGetValueFromRegistry();
73 73 void testRemoveRegistry();
74   - void testColetaSoftware();
75   - void testColetaHardware();
76 74 void testConvertDouble();
77 75 void testGetTest();
78 76 void testGetConfig();
  77 + void testColetaSoftware();
  78 + void testColetaHardware();
79 79 void testLogger();
80 80 void testFtpDownload();
81 81 void testEnviaColeta();
... ...
src/cacic_comm.cpp
... ... @@ -225,9 +225,8 @@ void CacicComm::fileDownloadFinished(QNetworkReply* reply)
225 225 out << reply->readAll();
226 226 fileHandler->close();
227 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 232 QString CacicComm::getFtpPass() const
... ...
src/ccoleta.cpp
... ... @@ -44,8 +44,8 @@ void CColeta::run()
44 44 /* Versão do json de testes */
45 45 QJsonObject coleta = oCacic.getJsonFromFile("getConfig.json");
46 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 49 if( actions.contains("col_hard") && actions["col_hard"].toBool()){
50 50 this->hardwareIsFinish = false;
51 51 emit beginHardware();
... ... @@ -64,7 +64,7 @@ QJsonObject CColeta::toJsonObject()
64 64 {
65 65 QJsonObject coletaJson;
66 66 if (this->hardwareIsFinish && this->softwareIsFinish){
67   - coletaJson["computer"] = oComputer.toJsonObject();
  67 + coletaJson["computador"] = oComputer.toJsonObject();
68 68 coletaJson["software"] = oSoftware.toJsonObject();
69 69 coletaJson["hardware"] = oHardware.toJsonObject();
70 70 }
... ...
src/checkmodules.cpp
... ... @@ -7,7 +7,8 @@ CheckModules::CheckModules(const QString &amp;workingPath)
7 7 configFile = oCacic.getJsonFromFile(workingPath + "/getConfig.json");
8 8 if (!configFile.isEmpty()) {
9 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 12 QJsonArray modulos;
12 13 //pega o jsonarray dos módulos
13 14 modulos = configFile["agentcomputer"].toObject()["modulos"].toArray();
... ...