@@ -0,0 +1,3 | |||||
|
1 | Not Found | |||
|
2 | ||||
|
3 | The requested URL /AMDA/data/WSRESULT/imf(0)-1343153090-1343153092-60.txt was not found on this server. No newline at end of file |
@@ -12,6 +12,9 Q_LOGGING_CATEGORY(LOG_AmdaResultParser, "AmdaResultParser") | |||||
12 |
|
12 | |||
13 | namespace { |
|
13 | namespace { | |
14 |
|
14 | |||
|
15 | /// Message in result file when the file was not found on server | |||
|
16 | const auto FILE_NOT_FOUND_MESSAGE = QStringLiteral("Not Found"); | |||
|
17 | ||||
15 | /// Format for dates in result files |
|
18 | /// Format for dates in result files | |
16 | const auto DATE_FORMAT = QStringLiteral("yyyy-MM-ddThh:mm:ss.zzz"); |
|
19 | const auto DATE_FORMAT = QStringLiteral("yyyy-MM-ddThh:mm:ss.zzz"); | |
17 |
|
20 | |||
@@ -119,8 +122,16 std::shared_ptr<IDataSeries> AmdaResultParser::readTxt(const QString &filePath) | |||||
119 |
|
122 | |||
120 | QTextStream stream{&file}; |
|
123 | QTextStream stream{&file}; | |
121 |
|
124 | |||
122 | // Ignore first two lines (comments lines) |
|
125 | // Checks if the file was found on the server | |
123 | stream.readLine(); |
|
126 | auto firstLine = stream.readLine(); | |
|
127 | if (firstLine.compare(FILE_NOT_FOUND_MESSAGE) == 0) { | |||
|
128 | qCCritical(LOG_AmdaResultParser()) | |||
|
129 | << QObject::tr("Can't retrieve AMDA data from file %1: file was not found on server") | |||
|
130 | .arg(filePath); | |||
|
131 | return nullptr; | |||
|
132 | } | |||
|
133 | ||||
|
134 | // Ignore comments lines | |||
124 | stream.readLine(); |
|
135 | stream.readLine(); | |
125 |
|
136 | |||
126 | // Reads x-axis unit |
|
137 | // Reads x-axis unit |
@@ -155,9 +155,12 void TestAmdaResultParser::testReadTxt_data() | |||||
155 | QVector<QDateTime>{dateTime(2013, 9, 23, 9, 1, 30), dateTime(2013, 9, 23, 9, 2, 30)}, |
|
155 | QVector<QDateTime>{dateTime(2013, 9, 23, 9, 1, 30), dateTime(2013, 9, 23, 9, 2, 30)}, | |
156 | QVector<double>{-2.71850, -2.52150}}; |
|
156 | QVector<double>{-2.71850, -2.52150}}; | |
157 |
|
157 | |||
158 | // Invalid file |
|
158 | // Invalid files | |
159 |
QTest::newRow("Invalid file (unexisting file)") |
|
159 | QTest::newRow("Invalid file (unexisting file)") | |
160 | << ExpectedResults{}; |
|
160 | << QStringLiteral("UnexistingFile.txt") << ExpectedResults{}; | |
|
161 | ||||
|
162 | QTest::newRow("Invalid file (file not found on server)") | |||
|
163 | << QStringLiteral("FileNotFound.txt") << ExpectedResults{}; | |||
161 | } |
|
164 | } | |
162 |
|
165 | |||
163 | void TestAmdaResultParser::testReadTxt() |
|
166 | void TestAmdaResultParser::testReadTxt() |
General Comments 0
You need to be logged in to leave comments.
Login now