Commit 618b7fb69bc4dbae7c25277e2eb9724bacfa7c60
1 parent
facf4f9b
Exists in
master
Adicionado testReadConfig() para começar a mexer com o Gercol. E mudando algumas…
… coisas nos projetos para integrar o Gercol no teste.
Showing
6 changed files
with
67 additions
and
4 deletions
Show diff stats
cacic-teste/cacic-teste.pro
@@ -21,7 +21,8 @@ SOURCES += \ | @@ -21,7 +21,8 @@ SOURCES += \ | ||
21 | testcacic.cpp \ | 21 | testcacic.cpp \ |
22 | ../src/ccacic.cpp \ | 22 | ../src/ccacic.cpp \ |
23 | ../src/cacic_computer.cpp \ | 23 | ../src/cacic_computer.cpp \ |
24 | - ../src/operatingsystem.cpp | 24 | + ../src/operatingsystem.cpp \ |
25 | + ../gercols/gercols.cpp | ||
25 | 26 | ||
26 | 27 | ||
27 | HEADERS += \ | 28 | HEADERS += \ |
@@ -30,7 +31,8 @@ HEADERS += \ | @@ -30,7 +31,8 @@ HEADERS += \ | ||
30 | ../src/cacic_computer.h \ | 31 | ../src/cacic_computer.h \ |
31 | ../src/cacic_comm.h \ | 32 | ../src/cacic_comm.h \ |
32 | ../src/console.h \ | 33 | ../src/console.h \ |
33 | - ../src/operatingsystem.h | 34 | + ../src/operatingsystem.h \ |
35 | + ../gercols/gercols.cpp | ||
34 | 36 | ||
35 | INCLUDEPATH += ../src \ | 37 | INCLUDEPATH += ../src \ |
36 | ../src/crypto++/include/ | 38 | ../src/crypto++/include/ |
cacic-teste/testcacic.cpp
@@ -191,7 +191,31 @@ void CTestCacic::testJsonFromFile() | @@ -191,7 +191,31 @@ void CTestCacic::testJsonFromFile() | ||
191 | QVERIFY(OCacic.getJsonFromFile("teste.json")["teste"].toString() == "teste"); | 191 | QVERIFY(OCacic.getJsonFromFile("teste.json")["teste"].toString() == "teste"); |
192 | } | 192 | } |
193 | 193 | ||
194 | +void CTestCacic::testReadConfig() | ||
195 | +{ | ||
196 | + | ||
197 | + // Inicializa um arquivo de configuração stub | ||
198 | + // que seria parecido com o recebido do Gerente | ||
199 | + QJsonObject configJson; | ||
200 | + QJsonObject configHardware; | ||
201 | + QJsonObject configSoftware; | ||
202 | + | ||
203 | + configHardware["network_interface"] = QJsonValue::fromVariant(QString("")); | ||
204 | + configSoftware["operating_system"] = QJsonValue::fromVariant(QString("")); | ||
205 | + | ||
206 | + configJson["hardware"] = configHardware; | ||
207 | + configJson["software"] = configSoftware; | ||
208 | + | ||
209 | + OCacic.setJsonToFile(configJson,"configRequest.json"); | ||
210 | + | ||
211 | + // Leitura do arquivo de configuração | ||
212 | + OGercols.readConfig(); | ||
213 | + | ||
214 | + QVERIFY(OGercols.getConfigJson() == configJson); | ||
215 | +} | ||
216 | + | ||
194 | void CTestCacic::cleanupTestCase() | 217 | void CTestCacic::cleanupTestCase() |
195 | { | 218 | { |
219 | + OCacic.deleteFile("configRequest.json"); | ||
196 | OCacic.deleteFile("teste.json"); | 220 | OCacic.deleteFile("teste.json"); |
197 | } | 221 | } |
cacic-teste/testcacic.h
@@ -15,6 +15,7 @@ | @@ -15,6 +15,7 @@ | ||
15 | #include <QtNetwork/QtNetwork> | 15 | #include <QtNetwork/QtNetwork> |
16 | #include <QJsonObject> | 16 | #include <QJsonObject> |
17 | #include "../install-cacic/installcacic.h" | 17 | #include "../install-cacic/installcacic.h" |
18 | +#include "../gercols/gercols.h" | ||
18 | 19 | ||
19 | class CTestCacic : public QObject | 20 | class CTestCacic : public QObject |
20 | { | 21 | { |
@@ -26,6 +27,7 @@ private: | @@ -26,6 +27,7 @@ private: | ||
26 | CacicComm OCacicComm; | 27 | CacicComm OCacicComm; |
27 | CCacic OCacic; | 28 | CCacic OCacic; |
28 | CACIC_Computer OCacicComp; | 29 | CACIC_Computer OCacicComp; |
30 | + Gercols OGercols; | ||
29 | QString testPath; | 31 | QString testPath; |
30 | QString testIniPath; | 32 | QString testIniPath; |
31 | QJsonObject session; | 33 | QJsonObject session; |
@@ -59,6 +61,7 @@ private slots: | @@ -59,6 +61,7 @@ private slots: | ||
59 | void testOperatingSystemToJsonObject(); | 61 | void testOperatingSystemToJsonObject(); |
60 | void testJsonToFile(); | 62 | void testJsonToFile(); |
61 | void testJsonFromFile(); | 63 | void testJsonFromFile(); |
64 | + void testReadConfig(); | ||
62 | void cleanupTestCase(); | 65 | void cleanupTestCase(); |
63 | }; | 66 | }; |
64 | 67 |
gercols/gercols.pro
@@ -23,13 +23,17 @@ TEMPLATE = app | @@ -23,13 +23,17 @@ TEMPLATE = app | ||
23 | SOURCES += \ | 23 | SOURCES += \ |
24 | main.cpp \ | 24 | main.cpp \ |
25 | ../src/ccacic.cpp \ | 25 | ../src/ccacic.cpp \ |
26 | - ../src/cacic_computer.cpp | 26 | + ../src/cacic_computer.cpp \ |
27 | + ../src/operatingsystem.cpp \ | ||
28 | + ./gercols.cpp | ||
27 | 29 | ||
28 | 30 | ||
29 | HEADERS += \ | 31 | HEADERS += \ |
30 | ../src/ccacic.h \ | 32 | ../src/ccacic.h \ |
31 | ../src/cacic_computer.h \ | 33 | ../src/cacic_computer.h \ |
32 | - ../src/cacic_comm.h | 34 | + ../src/operatingsystem.h \ |
35 | + ../src/console.h \ | ||
36 | + ./gercols.h | ||
33 | 37 | ||
34 | INCLUDEPATH += ../src \ | 38 | INCLUDEPATH += ../src \ |
35 | ../src/crypto++/include/ | 39 | ../src/crypto++/include/ |