Commit f530971ad96b42b93adca4c8de5902ccd35e2216
1 parent
f0cbb68e
Exists in
master
Alterando gercols para ler de arquivo real.
Showing
7 changed files
with
33 additions
and
28 deletions
Show diff stats
cacic-teste/testcacic.cpp
... | ... | @@ -132,10 +132,10 @@ void CTestCacic::testSslConnection() |
132 | 132 | bool ok; |
133 | 133 | QJsonObject json = OCacicComm->comm("", &ok, QJsonObject(), true); |
134 | 134 | QJsonValue jsonvalue = (!json["codestatus"].isNull()) ? |
135 | - json["codestatus"] : | |
136 | - QJsonValue::fromVariant(-1); | |
137 | - // qDebug() << jsonvalue.toDouble(); | |
138 | - QVERIFY(jsonvalue.toDouble() == 200 || jsonvalue.toDouble() == 302); | |
135 | + json["codestatus"] : | |
136 | + QJsonValue::fromVariant("-1"); | |
137 | +// qDebug()<< jsonvalue.toDouble(); | |
138 | + QVERIFY(jsonvalue.toString() == "200" || jsonvalue.toString() == "302"); | |
139 | 139 | } |
140 | 140 | |
141 | 141 | void CTestCacic::testEnCrypt(){ |
... | ... | @@ -240,8 +240,9 @@ void CTestCacic::testGetTest() |
240 | 240 | bool ok; |
241 | 241 | QJsonObject envio; |
242 | 242 | envio["computador"] = OCacicComp.toJsonObject(); |
243 | + qDebug() << envio; | |
243 | 244 | OCacicComm->setUrlGerente("http://teste.cacic.cc"); |
244 | - OCacicComm->comm("/ws/neo/getTest", &ok, envio); | |
245 | + OCacicComm->comm("/ws/neo/getTest", &ok, envio, true); | |
245 | 246 | QVERIFY(ok); |
246 | 247 | } |
247 | 248 | ... | ... |
gercols/gercols.cpp
... | ... | @@ -3,19 +3,19 @@ |
3 | 3 | Gercols::Gercols(QObject *parent) |
4 | 4 | { |
5 | 5 | |
6 | - /* Cria um json de configuração para teste. | |
7 | - *************************************************************************/ | |
8 | - QJsonObject configTeste; | |
9 | - QJsonObject configComputer; | |
10 | - configComputer["operating_system"] = QJsonValue::fromVariant(QString("")); | |
11 | - configComputer["user"] = QJsonValue::fromVariant(QString("")); | |
12 | - configComputer["network_interface"] = QJsonValue::fromVariant(QString("")); | |
13 | - configTeste["computer"] = configComputer; | |
14 | - configTeste["hardware"] = QJsonValue::fromVariant(QString("")); | |
15 | - configTeste["software"] = QJsonValue::fromVariant(QString("")); | |
16 | - | |
17 | - oCacic.setJsonToFile(configTeste,"configReq.json"); | |
18 | - /*************************************************************************/ | |
6 | +// Cria um json de configuração para teste. | |
7 | +// *************************************************************************/ | |
8 | +// QJsonObject configTeste; | |
9 | +// QJsonObject configComputer; | |
10 | +// configComputer["operating_system"] = QJsonValue::fromVariant(QString("")); | |
11 | +// configComputer["user"] = QJsonValue::fromVariant(QString("")); | |
12 | +// configComputer["network_interface"] = QJsonValue::fromVariant(QString("")); | |
13 | +// configTeste["computer"] = configComputer; | |
14 | +// configTeste["hardware"] = QJsonValue::fromVariant(QString("")); | |
15 | +// configTeste["software"] = QJsonValue::fromVariant(QString("")); | |
16 | + | |
17 | +// oCacic.setJsonToFile(configTeste,"configReq.json"); | |
18 | +// /************************************************************************ | |
19 | 19 | |
20 | 20 | oColeta = new CColeta; |
21 | 21 | //Pega chave do registro, que será pega na instalação. |
... | ... | @@ -35,7 +35,7 @@ void Gercols::run() |
35 | 35 | |
36 | 36 | /* Json de teste sendo excluído |
37 | 37 | */ |
38 | - oCacic.deleteFile("configReq.json"); | |
38 | +// oCacic.deleteFile("configReq.json"); | |
39 | 39 | /***********************************/ |
40 | 40 | |
41 | 41 | oColeta->waitToCollect(); | ... | ... |
install-cacic/installcacic.cpp
... | ... | @@ -93,8 +93,9 @@ void InstallCacic::run(QStringList argv, int argc) { |
93 | 93 | } |
94 | 94 | |
95 | 95 | } else |
96 | - std::cout << "Nao foi possivel realizar o login.\n " | |
97 | - << jsonLogin["error"].toString().toStdString() << "\n"; | |
96 | + std::cout << "Nao foi possivel realizar o login.\n" | |
97 | + << " Código: " << jsonLogin["codestatus"].toString().toStdString() << "\n" | |
98 | + << " " << jsonLogin["error"].toString().toStdString() << "\n"; | |
98 | 99 | } else if ((param.contains("default")) && (param["default"] == "uninstall")){ |
99 | 100 | oCacic.deleteFolder("c:/cacic"); |
100 | 101 | oCacic.removeRegistry("Lightbase", "Cacic"); | ... | ... |
install-cacic/installcacic.h
src/cacic_comm.cpp
... | ... | @@ -68,7 +68,7 @@ QJsonObject CacicComm::comm(QString route, bool *ok, const QJsonObject &json, bo |
68 | 68 | } |
69 | 69 | eventLoop.exec(); // sai do looping chamando o "finished()". |
70 | 70 | |
71 | - jsonObj.insert("codestatus", QJsonValue::fromVariant(reply->attribute(QNetworkRequest::HttpStatusCodeAttribute))); | |
71 | + jsonObj.insert("codestatus", QJsonValue::fromVariant(reply->attribute(QNetworkRequest::HttpStatusCodeAttribute).toString())); | |
72 | 72 | |
73 | 73 | if (reply->error() == QNetworkReply::NoError) { |
74 | 74 | //se não houver erro, grava o retorno; | ... | ... |
src/cacic_software.cpp
... | ... | @@ -102,9 +102,9 @@ QJsonObject cacic_software::coletaArch() |
102 | 102 | packageJson["url"] = urlString.mid(1); |
103 | 103 | } |
104 | 104 | if(line.contains("Installed size")) |
105 | - packageJson["installed_size"] = line.split(":")[1].mid(1); | |
105 | + packageJson["installedSize"] = line.split(":")[1].mid(1); | |
106 | 106 | if(line.contains("Install Date")) |
107 | - packageJson["install_date"] = line.split(":")[1].mid(1); | |
107 | + packageJson["installDate"] = line.split(":")[1].mid(1); | |
108 | 108 | } |
109 | 109 | softwaresJson[packageName] = packageJson; |
110 | 110 | } | ... | ... |
src/ccoleta.cpp
... | ... | @@ -43,14 +43,16 @@ bool CColeta::waitToCollect() |
43 | 43 | void CColeta::run() |
44 | 44 | { |
45 | 45 | /* Versão do json de testes */ |
46 | - QJsonObject coleta = oCacic.getJsonFromFile("configReq.json"); | |
47 | - | |
48 | - if( coleta.contains("hardware") ){ | |
46 | + QJsonObject coleta = oCacic.getJsonFromFile("getConfig.json"); | |
47 | + qDebug() << coleta; | |
48 | + QJsonObject actions = coleta["reply"].toObject()["agentecomputer"].toObject()["actions"].toObject(); | |
49 | + if( actions.contains("col_hard") ){ | |
49 | 50 | this->hardwareIsFinish = false; |
50 | 51 | emit beginHardware(); |
51 | 52 | } else |
52 | 53 | this->hardwareIsFinish = true; |
53 | - if ( coleta.contains("software") ){ | |
54 | + | |
55 | + if ( actions.contains("col_soft") ){ | |
54 | 56 | this->softwareIsFinish = false; |
55 | 57 | emit beginSoftware(); |
56 | 58 | } else | ... | ... |