@@ -28,8 +28,6 struct AcquisitionRequest { | |||||
28 | QUuid m_AcqIdentifier; |
|
28 | QUuid m_AcqIdentifier; | |
29 | QUuid m_vIdentifier; |
|
29 | QUuid m_vIdentifier; | |
30 | DataProviderParameters m_DataProviderParameters; |
|
30 | DataProviderParameters m_DataProviderParameters; | |
31 | SqpRange m_RangeRequested; |
|
|||
32 | SqpRange m_CacheRangeRequested; |
|
|||
33 | int m_Size; |
|
31 | int m_Size; | |
34 | int m_Progression; |
|
32 | int m_Progression; | |
35 | std::shared_ptr<IDataProvider> m_Provider; |
|
33 | std::shared_ptr<IDataProvider> m_Provider; |
@@ -28,8 +28,8 public: | |||||
28 | explicit VariableAcquisitionWorker(QObject *parent = 0); |
|
28 | explicit VariableAcquisitionWorker(QObject *parent = 0); | |
29 | virtual ~VariableAcquisitionWorker(); |
|
29 | virtual ~VariableAcquisitionWorker(); | |
30 |
|
30 | |||
31 |
QUuid pushVariableRequest(QUuid varRequestId, QUuid vIdentifier, |
|
31 | QUuid pushVariableRequest(QUuid varRequestId, QUuid vIdentifier, | |
32 |
|
|
32 | DataProviderParameters parameters, | |
33 | std::shared_ptr<IDataProvider> provider); |
|
33 | std::shared_ptr<IDataProvider> provider); | |
34 |
|
34 | |||
35 | void abortProgressRequested(QUuid vIdentifier); |
|
35 | void abortProgressRequested(QUuid vIdentifier); | |
@@ -37,9 +37,7 public: | |||||
37 | void initialize(); |
|
37 | void initialize(); | |
38 | void finalize(); |
|
38 | void finalize(); | |
39 | signals: |
|
39 | signals: | |
40 |
void dataProvided(QUuid vIdentifier, |
|
40 | void dataProvided(QUuid vIdentifier, QVector<AcquisitionDataPacket> dataAcquired); | |
41 | const SqpRange &cacheRangeRequested, |
|
|||
42 | QVector<AcquisitionDataPacket> dataAcquired); |
|
|||
43 |
|
41 | |||
44 | void variableRequestInProgress(QUuid vIdentifier, double progress); |
|
42 | void variableRequestInProgress(QUuid vIdentifier, double progress); | |
45 |
|
43 |
@@ -112,9 +112,7 public slots: | |||||
112 | void onUpdateDateTime(std::shared_ptr<Variable> variable, const SqpRange &dateTime); |
|
112 | void onUpdateDateTime(std::shared_ptr<Variable> variable, const SqpRange &dateTime); | |
113 |
|
113 | |||
114 |
|
114 | |||
115 |
void onDataProvided(QUuid vIdentifier, |
|
115 | void onDataProvided(QUuid vIdentifier, QVector<AcquisitionDataPacket> dataAcquired); | |
116 | const SqpRange &cacheRangeRequested, |
|
|||
117 | QVector<AcquisitionDataPacket> dataAcquired); |
|
|||
118 |
|
116 | |||
119 | void onVariableRetrieveDataInProgress(QUuid identifier, double progress); |
|
117 | void onVariableRetrieveDataInProgress(QUuid identifier, double progress); | |
120 |
|
118 |
@@ -29,9 +29,6 struct VariableAcquisitionWorker::VariableAcquisitionWorkerPrivate { | |||||
29 |
|
29 | |||
30 | void removeVariableRequest(QUuid vIdentifier); |
|
30 | void removeVariableRequest(QUuid vIdentifier); | |
31 |
|
31 | |||
32 | /// Remove the current request and execute the next one if exist |
|
|||
33 | void updateToNextRequest(QUuid vIdentifier); |
|
|||
34 |
|
||||
35 | /// Remove and/or abort all AcqRequest in link with varRequestId |
|
32 | /// Remove and/or abort all AcqRequest in link with varRequestId | |
36 | void cancelVarRequest(QUuid varRequestId); |
|
33 | void cancelVarRequest(QUuid varRequestId); | |
37 | void removeAcqRequest(QUuid acqRequestId); |
|
34 | void removeAcqRequest(QUuid acqRequestId); | |
@@ -41,7 +38,7 struct VariableAcquisitionWorker::VariableAcquisitionWorkerPrivate { | |||||
41 |
|
38 | |||
42 | std::map<QUuid, QVector<AcquisitionDataPacket> > m_AcqIdentifierToAcqDataPacketVectorMap; |
|
39 | std::map<QUuid, QVector<AcquisitionDataPacket> > m_AcqIdentifierToAcqDataPacketVectorMap; | |
43 | std::map<QUuid, AcquisitionRequest> m_AcqIdentifierToAcqRequestMap; |
|
40 | std::map<QUuid, AcquisitionRequest> m_AcqIdentifierToAcqRequestMap; | |
44 |
std::map<QUuid, |
|
41 | std::map<QUuid, QUuid> m_VIdentifierToCurrrentAcqIdMap; | |
45 | VariableAcquisitionWorker *q; |
|
42 | VariableAcquisitionWorker *q; | |
46 | }; |
|
43 | }; | |
47 |
|
44 | |||
@@ -60,26 +57,23 VariableAcquisitionWorker::~VariableAcquisitionWorker() | |||||
60 |
|
57 | |||
61 |
|
58 | |||
62 | QUuid VariableAcquisitionWorker::pushVariableRequest(QUuid varRequestId, QUuid vIdentifier, |
|
59 | QUuid VariableAcquisitionWorker::pushVariableRequest(QUuid varRequestId, QUuid vIdentifier, | |
63 | SqpRange rangeRequested, |
|
|||
64 | SqpRange cacheRangeRequested, |
|
|||
65 | DataProviderParameters parameters, |
|
60 | DataProviderParameters parameters, | |
66 | std::shared_ptr<IDataProvider> provider) |
|
61 | std::shared_ptr<IDataProvider> provider) | |
67 | { |
|
62 | { | |
68 | qCDebug(LOG_VariableAcquisitionWorker()) |
|
63 | qCDebug(LOG_VariableAcquisitionWorker()) | |
69 |
<< tr("TORM VariableAcquisitionWorker::pushVariableRequest ") << |
|
64 | << tr("TORM VariableAcquisitionWorker::pushVariableRequest varRequestId: ") << varRequestId | |
|
65 | << "vId: " << vIdentifier; | |||
70 | auto varRequestIdCanceled = QUuid(); |
|
66 | auto varRequestIdCanceled = QUuid(); | |
71 |
|
67 | |||
72 | // Request creation |
|
68 | // Request creation | |
73 | auto acqRequest = AcquisitionRequest{}; |
|
69 | auto acqRequest = AcquisitionRequest{}; | |
74 | qCDebug(LOG_VariableAcquisitionWorker()) << tr("PushVariableRequest ") << vIdentifier |
|
|||
75 | << varRequestId; |
|
|||
76 | acqRequest.m_VarRequestId = varRequestId; |
|
70 | acqRequest.m_VarRequestId = varRequestId; | |
77 | acqRequest.m_vIdentifier = vIdentifier; |
|
71 | acqRequest.m_vIdentifier = vIdentifier; | |
78 | acqRequest.m_DataProviderParameters = parameters; |
|
72 | acqRequest.m_DataProviderParameters = parameters; | |
79 | acqRequest.m_RangeRequested = rangeRequested; |
|
|||
80 | acqRequest.m_CacheRangeRequested = cacheRangeRequested; |
|
|||
81 | acqRequest.m_Size = parameters.m_Times.size(); |
|
73 | acqRequest.m_Size = parameters.m_Times.size(); | |
82 | acqRequest.m_Provider = provider; |
|
74 | acqRequest.m_Provider = provider; | |
|
75 | qCInfo(LOG_VariableAcquisitionWorker()) << tr("Add acqRequest ") << acqRequest.m_AcqIdentifier | |||
|
76 | << acqRequest.m_Size; | |||
83 |
|
77 | |||
84 |
|
78 | |||
85 | // Register request |
|
79 | // Register request | |
@@ -87,32 +81,31 QUuid VariableAcquisitionWorker::pushVariableRequest(QUuid varRequestId, QUuid v | |||||
87 | impl->m_AcqIdentifierToAcqRequestMap.insert( |
|
81 | impl->m_AcqIdentifierToAcqRequestMap.insert( | |
88 | std::make_pair(acqRequest.m_AcqIdentifier, acqRequest)); |
|
82 | std::make_pair(acqRequest.m_AcqIdentifier, acqRequest)); | |
89 |
|
83 | |||
90 |
auto it = impl->m_VIdentifierToCurrrentAcqId |
|
84 | auto it = impl->m_VIdentifierToCurrrentAcqIdMap.find(vIdentifier); | |
91 |
if (it != impl->m_VIdentifierToCurrrentAcqId |
|
85 | if (it != impl->m_VIdentifierToCurrrentAcqIdMap.cend()) { | |
92 |
// A current request already exists, we can |
|
86 | // A current request already exists, we can cancel it | |
93 | auto oldAcqId = it->second.second; |
|
87 | // remove old acqIdentifier from the worker | |
|
88 | auto oldAcqId = it->second; | |||
94 | auto acqIdentifierToAcqRequestMapIt = impl->m_AcqIdentifierToAcqRequestMap.find(oldAcqId); |
|
89 | auto acqIdentifierToAcqRequestMapIt = impl->m_AcqIdentifierToAcqRequestMap.find(oldAcqId); | |
95 | if (acqIdentifierToAcqRequestMapIt != impl->m_AcqIdentifierToAcqRequestMap.cend()) { |
|
90 | if (acqIdentifierToAcqRequestMapIt != impl->m_AcqIdentifierToAcqRequestMap.cend()) { | |
96 | auto oldAcqRequest = acqIdentifierToAcqRequestMapIt->second; |
|
91 | auto oldAcqRequest = acqIdentifierToAcqRequestMapIt->second; | |
97 | varRequestIdCanceled = oldAcqRequest.m_VarRequestId; |
|
92 | varRequestIdCanceled = oldAcqRequest.m_VarRequestId; | |
98 | } |
|
93 | } | |
99 |
|
||||
100 | it->second.second = acqRequest.m_AcqIdentifier; |
|
|||
101 | impl->unlock(); |
|
94 | impl->unlock(); | |
102 |
|
||||
103 | // remove old acqIdentifier from the worker |
|
|||
104 | impl->cancelVarRequest(varRequestIdCanceled); |
|
95 | impl->cancelVarRequest(varRequestIdCanceled); | |
105 | // impl->m_AcqIdentifierToAcqRequestMap.erase(oldAcqId); |
|
|||
106 | } |
|
96 | } | |
107 | else { |
|
97 | else { | |
108 | // First request for the variable, it must be stored and executed |
|
98 | impl->unlock(); | |
109 | impl->m_VIdentifierToCurrrentAcqIdNextIdPairMap.insert( |
|
99 | } | |
110 | std::make_pair(vIdentifier, std::make_pair(acqRequest.m_AcqIdentifier, QUuid()))); |
|
100 | ||
|
101 | // Request for the variable, it must be stored and executed | |||
|
102 | impl->lockWrite(); | |||
|
103 | impl->m_VIdentifierToCurrrentAcqIdMap.insert( | |||
|
104 | std::make_pair(vIdentifier, acqRequest.m_AcqIdentifier)); | |||
111 |
|
|
105 | impl->unlock(); | |
112 |
|
106 | |||
113 |
|
|
107 | QMetaObject::invokeMethod(this, "onExecuteRequest", Qt::QueuedConnection, | |
114 |
|
|
108 | Q_ARG(QUuid, acqRequest.m_AcqIdentifier)); | |
115 | } |
|
|||
116 |
|
109 | |||
117 | return varRequestIdCanceled; |
|
110 | return varRequestIdCanceled; | |
118 | } |
|
111 | } | |
@@ -121,18 +114,15 void VariableAcquisitionWorker::abortProgressRequested(QUuid vIdentifier) | |||||
121 | { |
|
114 | { | |
122 | impl->lockRead(); |
|
115 | impl->lockRead(); | |
123 |
|
116 | |||
124 |
auto it = impl->m_VIdentifierToCurrrentAcqId |
|
117 | auto it = impl->m_VIdentifierToCurrrentAcqIdMap.find(vIdentifier); | |
125 |
if (it != impl->m_VIdentifierToCurrrentAcqId |
|
118 | if (it != impl->m_VIdentifierToCurrrentAcqIdMap.cend()) { | |
126 |
auto currentAcqId = it->second |
|
119 | auto currentAcqId = it->second; | |
127 |
|
120 | |||
128 | auto it = impl->m_AcqIdentifierToAcqRequestMap.find(currentAcqId); |
|
121 | auto it = impl->m_AcqIdentifierToAcqRequestMap.find(currentAcqId); | |
129 | if (it != impl->m_AcqIdentifierToAcqRequestMap.cend()) { |
|
122 | if (it != impl->m_AcqIdentifierToAcqRequestMap.cend()) { | |
130 | auto request = it->second; |
|
123 | auto request = it->second; | |
131 | impl->unlock(); |
|
124 | impl->unlock(); | |
132 |
|
125 | |||
133 | // Remove the current request from the worker |
|
|||
134 | impl->updateToNextRequest(vIdentifier); |
|
|||
135 |
|
||||
136 | // notify the request aborting to the provider |
|
126 | // notify the request aborting to the provider | |
137 | request.m_Provider->requestDataAborting(currentAcqId); |
|
127 | request.m_Provider->requestDataAborting(currentAcqId); | |
138 | } |
|
128 | } | |
@@ -151,22 +141,29 void VariableAcquisitionWorker::onVariableRetrieveDataInProgress(QUuid acqIdenti | |||||
151 | double progress) |
|
141 | double progress) | |
152 | { |
|
142 | { | |
153 | qCDebug(LOG_VariableAcquisitionWorker()) << tr("TORM: onVariableRetrieveDataInProgress ") |
|
143 | qCDebug(LOG_VariableAcquisitionWorker()) << tr("TORM: onVariableRetrieveDataInProgress ") | |
|
144 | << QThread::currentThread()->objectName() | |||
154 | << acqIdentifier << progress; |
|
145 | << acqIdentifier << progress; | |
155 | impl->lockRead(); |
|
146 | impl->lockRead(); | |
156 | auto aIdToARit = impl->m_AcqIdentifierToAcqRequestMap.find(acqIdentifier); |
|
147 | auto aIdToARit = impl->m_AcqIdentifierToAcqRequestMap.find(acqIdentifier); | |
157 | if (aIdToARit != impl->m_AcqIdentifierToAcqRequestMap.cend()) { |
|
148 | if (aIdToARit != impl->m_AcqIdentifierToAcqRequestMap.cend()) { | |
158 | auto currentPartSize = (aIdToARit->second.m_Size != 0) ? 100 / aIdToARit->second.m_Size : 0; |
|
149 | auto progressPartSize | |
|
150 | = (aIdToARit->second.m_Size != 0) ? 100 / aIdToARit->second.m_Size : 0; | |||
159 |
|
151 | |||
160 | auto currentPartProgress |
|
152 | auto currentPartProgress | |
161 |
= std::isnan(progress) ? 0.0 : (progress * |
|
153 | = std::isnan(progress) ? 0.0 : (progress * progressPartSize) / 100.0; | |
162 | auto currentAlreadyProgress = aIdToARit->second.m_Progression * currentPartSize; |
|
154 | ||
|
155 | // We can only give an approximation of the currentProgression since its upgrade is async. | |||
|
156 | auto currentProgression = aIdToARit->second.m_Progression; | |||
|
157 | if (currentProgression == aIdToARit->second.m_Size) { | |||
|
158 | currentProgression = aIdToARit->second.m_Size - 1; | |||
|
159 | } | |||
|
160 | ||||
|
161 | auto currentAlreadyProgress = progressPartSize * currentProgression; | |||
|
162 | ||||
163 |
|
163 | |||
164 | auto finalProgression = currentAlreadyProgress + currentPartProgress; |
|
164 | auto finalProgression = currentAlreadyProgress + currentPartProgress; | |
165 | emit variableRequestInProgress(aIdToARit->second.m_vIdentifier, finalProgression); |
|
165 | emit variableRequestInProgress(aIdToARit->second.m_vIdentifier, finalProgression); | |
166 | qCDebug(LOG_VariableAcquisitionWorker()) |
|
166 | ||
167 | << tr("TORM: onVariableRetrieveDataInProgress ") |
|
|||
168 | << QThread::currentThread()->objectName() << aIdToARit->second.m_vIdentifier |
|
|||
169 | << currentPartSize << currentAlreadyProgress << currentPartProgress << finalProgression; |
|
|||
170 | if (finalProgression == 100.0) { |
|
167 | if (finalProgression == 100.0) { | |
171 | emit variableRequestInProgress(aIdToARit->second.m_vIdentifier, 0.0); |
|
168 | emit variableRequestInProgress(aIdToARit->second.m_vIdentifier, 0.0); | |
172 | } |
|
169 | } | |
@@ -183,14 +180,10 void VariableAcquisitionWorker::onVariableAcquisitionFailed(QUuid acqIdentifier) | |||||
183 | if (it != impl->m_AcqIdentifierToAcqRequestMap.cend()) { |
|
180 | if (it != impl->m_AcqIdentifierToAcqRequestMap.cend()) { | |
184 | auto request = it->second; |
|
181 | auto request = it->second; | |
185 | impl->unlock(); |
|
182 | impl->unlock(); | |
186 | qCDebug(LOG_VariableAcquisitionWorker()) << tr("onVariableAcquisitionFailed") |
|
|||
187 | << acqIdentifier << request.m_vIdentifier |
|
|||
188 | << QThread::currentThread(); |
|
|||
189 | emit variableCanceledRequested(request.m_vIdentifier); |
|
183 | emit variableCanceledRequested(request.m_vIdentifier); | |
190 | } |
|
184 | } | |
191 | else { |
|
185 | else { | |
192 | impl->unlock(); |
|
186 | impl->unlock(); | |
193 | // TODO log no acqIdentifier recognized |
|
|||
194 | } |
|
187 | } | |
195 | } |
|
188 | } | |
196 |
|
189 | |||
@@ -228,17 +221,12 void VariableAcquisitionWorker::onVariableDataAcquired(QUuid acqIdentifier, | |||||
228 | // removed the finished request |
|
221 | // removed the finished request | |
229 | if (acqRequest.m_Size == acqRequest.m_Progression) { |
|
222 | if (acqRequest.m_Size == acqRequest.m_Progression) { | |
230 | auto varId = acqRequest.m_vIdentifier; |
|
223 | auto varId = acqRequest.m_vIdentifier; | |
231 | auto rangeRequested = acqRequest.m_RangeRequested; |
|
|||
232 | auto cacheRangeRequested = acqRequest.m_CacheRangeRequested; |
|
|||
233 | // Return the data |
|
224 | // Return the data | |
234 | aIdToADPVit = impl->m_AcqIdentifierToAcqDataPacketVectorMap.find(acqIdentifier); |
|
225 | aIdToADPVit = impl->m_AcqIdentifierToAcqDataPacketVectorMap.find(acqIdentifier); | |
235 | if (aIdToADPVit != impl->m_AcqIdentifierToAcqDataPacketVectorMap.cend()) { |
|
226 | if (aIdToADPVit != impl->m_AcqIdentifierToAcqDataPacketVectorMap.cend()) { | |
236 |
emit dataProvided(varId, |
|
227 | emit dataProvided(varId, aIdToADPVit->second); | |
237 | } |
|
228 | } | |
238 | impl->unlock(); |
|
229 | impl->unlock(); | |
239 |
|
||||
240 | // Update to the next request |
|
|||
241 | impl->updateToNextRequest(acqRequest.m_vIdentifier); |
|
|||
242 | } |
|
230 | } | |
243 | else { |
|
231 | else { | |
244 | impl->unlock(); |
|
232 | impl->unlock(); | |
@@ -260,6 +248,8 void VariableAcquisitionWorker::onExecuteRequest(QUuid acqIdentifier) | |||||
260 | auto request = it->second; |
|
248 | auto request = it->second; | |
261 | impl->unlock(); |
|
249 | impl->unlock(); | |
262 | emit variableRequestInProgress(request.m_vIdentifier, 0.1); |
|
250 | emit variableRequestInProgress(request.m_vIdentifier, 0.1); | |
|
251 | qCDebug(LOG_VariableAcquisitionWorker()) << tr("Start request 10%") << acqIdentifier | |||
|
252 | << QThread::currentThread(); | |||
263 | request.m_Provider->requestDataLoading(acqIdentifier, request.m_DataProviderParameters); |
|
253 | request.m_Provider->requestDataLoading(acqIdentifier, request.m_DataProviderParameters); | |
264 | } |
|
254 | } | |
265 | else { |
|
255 | else { | |
@@ -290,61 +280,30 void VariableAcquisitionWorker::VariableAcquisitionWorkerPrivate::removeVariable | |||||
290 | QUuid vIdentifier) |
|
280 | QUuid vIdentifier) | |
291 | { |
|
281 | { | |
292 | lockWrite(); |
|
282 | lockWrite(); | |
293 |
auto it = m_VIdentifierToCurrrentAcqId |
|
283 | auto it = m_VIdentifierToCurrrentAcqIdMap.find(vIdentifier); | |
294 |
|
284 | |||
295 |
if (it != m_VIdentifierToCurrrentAcqId |
|
285 | if (it != m_VIdentifierToCurrrentAcqIdMap.cend()) { | |
296 | // A current request already exists, we can replace the next one |
|
286 | // A current request already exists, we can replace the next one | |
297 |
|
287 | |||
298 | m_AcqIdentifierToAcqRequestMap.erase(it->second.first); |
|
288 | qCDebug(LOG_VariableAcquisitionWorker()) | |
299 | m_AcqIdentifierToAcqDataPacketVectorMap.erase(it->second.first); |
|
289 | << "VariableAcquisitionWorkerPrivate::removeVariableRequest " | |
300 |
|
290 | << QThread::currentThread()->objectName() << it->second; | ||
301 |
m_AcqIdentifierToAcqRequestMap.erase(it->second |
|
291 | m_AcqIdentifierToAcqRequestMap.erase(it->second); | |
302 |
m_AcqIdentifierToAcqDataPacketVectorMap.erase(it->second |
|
292 | m_AcqIdentifierToAcqDataPacketVectorMap.erase(it->second); | |
303 | } |
|
|||
304 | m_VIdentifierToCurrrentAcqIdNextIdPairMap.erase(vIdentifier); |
|
|||
305 | unlock(); |
|
|||
306 | } |
|
293 | } | |
307 |
|
294 | |||
308 | void VariableAcquisitionWorker::VariableAcquisitionWorkerPrivate::updateToNextRequest( |
|
295 | // stop any progression | |
309 | QUuid vIdentifier) |
|
296 | emit q->variableRequestInProgress(vIdentifier, 0.0); | |
310 | { |
|
297 | ||
311 | lockRead(); |
|
298 | m_VIdentifierToCurrrentAcqIdMap.erase(vIdentifier); | |
312 | auto it = m_VIdentifierToCurrrentAcqIdNextIdPairMap.find(vIdentifier); |
|
|||
313 | if (it != m_VIdentifierToCurrrentAcqIdNextIdPairMap.cend()) { |
|
|||
314 | if (it->second.second.isNull()) { |
|
|||
315 | unlock(); |
|
|||
316 | // There is no next request, we can remove the variable request |
|
|||
317 | removeVariableRequest(vIdentifier); |
|
|||
318 | } |
|
|||
319 | else { |
|
|||
320 | auto acqIdentifierToRemove = it->second.first; |
|
|||
321 | // Move the next request to the current request |
|
|||
322 | auto nextRequestId = it->second.second; |
|
|||
323 | it->second.first = nextRequestId; |
|
|||
324 | it->second.second = QUuid(); |
|
|||
325 | unlock(); |
|
|||
326 | // Remove AcquisitionRequest and results; |
|
|||
327 | lockWrite(); |
|
|||
328 | m_AcqIdentifierToAcqRequestMap.erase(acqIdentifierToRemove); |
|
|||
329 | m_AcqIdentifierToAcqDataPacketVectorMap.erase(acqIdentifierToRemove); |
|
|||
330 | unlock(); |
|
|||
331 | // Execute the current request |
|
|||
332 | QMetaObject::invokeMethod(q, "onExecuteRequest", Qt::QueuedConnection, |
|
|||
333 | Q_ARG(QUuid, nextRequestId)); |
|
|||
334 | } |
|
|||
335 | } |
|
|||
336 | else { |
|
|||
337 |
|
|
299 | unlock(); | |
338 | qCCritical(LOG_VariableAcquisitionWorker()) |
|
|||
339 | << tr("Impossible to execute the acquisition on an unfound variable "); |
|
|||
340 | } |
|
|||
341 | } |
|
300 | } | |
342 |
|
301 | |||
343 | void VariableAcquisitionWorker::VariableAcquisitionWorkerPrivate::cancelVarRequest( |
|
302 | void VariableAcquisitionWorker::VariableAcquisitionWorkerPrivate::cancelVarRequest( | |
344 | QUuid varRequestId) |
|
303 | QUuid varRequestId) | |
345 | { |
|
304 | { | |
346 | qCDebug(LOG_VariableAcquisitionWorker()) |
|
305 | qCDebug(LOG_VariableAcquisitionWorker()) | |
347 |
<< "VariableAcquisitionWorkerPrivate::cancelVarRequest |
|
306 | << "VariableAcquisitionWorkerPrivate::cancelVarRequest start"; | |
348 | lockRead(); |
|
307 | lockRead(); | |
349 | // get all AcqIdentifier in link with varRequestId |
|
308 | // get all AcqIdentifier in link with varRequestId | |
350 | QVector<QUuid> acqIdsToRm; |
|
309 | QVector<QUuid> acqIdsToRm; | |
@@ -377,22 +336,15 void VariableAcquisitionWorker::VariableAcquisitionWorkerPrivate::removeAcqReque | |||||
377 | vIdentifier = acqIt->second.m_vIdentifier; |
|
336 | vIdentifier = acqIt->second.m_vIdentifier; | |
378 | provider = acqIt->second.m_Provider; |
|
337 | provider = acqIt->second.m_Provider; | |
379 |
|
338 | |||
380 |
auto it = m_VIdentifierToCurrrentAcqId |
|
339 | auto it = m_VIdentifierToCurrrentAcqIdMap.find(vIdentifier); | |
381 |
if (it != m_VIdentifierToCurrrentAcqId |
|
340 | if (it != m_VIdentifierToCurrrentAcqIdMap.cend()) { | |
382 |
if (it->second |
|
341 | if (it->second == acqRequestId) { | |
383 | // acqRequest is currently running -> let's aborting it |
|
342 | // acqRequest is currently running -> let's aborting it | |
384 | unlock(); |
|
343 | unlock(); | |
385 |
|
344 | |||
386 | // Remove the current request from the worker |
|
|||
387 | updateToNextRequest(vIdentifier); |
|
|||
388 |
|
||||
389 | // notify the request aborting to the provider |
|
345 | // notify the request aborting to the provider | |
390 | provider->requestDataAborting(acqRequestId); |
|
346 | provider->requestDataAborting(acqRequestId); | |
391 | } |
|
347 | } | |
392 | else if (it->second.second == acqRequestId) { |
|
|||
393 | it->second.second = QUuid(); |
|
|||
394 | unlock(); |
|
|||
395 | } |
|
|||
396 | else { |
|
348 | else { | |
397 | unlock(); |
|
349 | unlock(); | |
398 | } |
|
350 | } | |
@@ -409,6 +361,7 void VariableAcquisitionWorker::VariableAcquisitionWorkerPrivate::removeAcqReque | |||||
409 |
|
361 | |||
410 | m_AcqIdentifierToAcqDataPacketVectorMap.erase(acqRequestId); |
|
362 | m_AcqIdentifierToAcqDataPacketVectorMap.erase(acqRequestId); | |
411 | m_AcqIdentifierToAcqRequestMap.erase(acqRequestId); |
|
363 | m_AcqIdentifierToAcqRequestMap.erase(acqRequestId); | |
|
364 | m_VIdentifierToCurrrentAcqIdMap.erase(vIdentifier); | |||
412 |
|
365 | |||
413 | unlock(); |
|
366 | unlock(); | |
414 | qCDebug(LOG_VariableAcquisitionWorker()) |
|
367 | qCDebug(LOG_VariableAcquisitionWorker()) |
@@ -368,11 +368,6 VariableController::createVariable(const QString &name, const QVariantHash &meta | |||||
368 |
|
368 | |||
369 | this->onRequestDataLoading(QVector<std::shared_ptr<Variable> >{newVariable}, range, false); |
|
369 | this->onRequestDataLoading(QVector<std::shared_ptr<Variable> >{newVariable}, range, false); | |
370 |
|
370 | |||
371 | // auto varRequestId = QUuid::createUuid(); |
|
|||
372 | // qCInfo(LOG_VariableController()) << "createVariable: " << varId << varRequestId; |
|
|||
373 | // impl->processRequest(newVariable, range, varRequestId); |
|
|||
374 | // impl->updateVariableRequest(varRequestId); |
|
|||
375 |
|
||||
376 | emit variableAdded(newVariable); |
|
371 | emit variableAdded(newVariable); | |
377 |
|
372 | |||
378 | return newVariable; |
|
373 | return newVariable; | |
@@ -390,20 +385,6 void VariableController::onDateTimeOnSelection(const SqpRange &dateTime) | |||||
390 | auto selectedRows = impl->m_VariableSelectionModel->selectedRows(); |
|
385 | auto selectedRows = impl->m_VariableSelectionModel->selectedRows(); | |
391 |
|
386 | |||
392 | // NOTE we only permit the time modification for one variable |
|
387 | // NOTE we only permit the time modification for one variable | |
393 | // DEPRECATED |
|
|||
394 | // auto variables = QVector<std::shared_ptr<Variable> >{}; |
|
|||
395 | // for (const auto &selectedRow : qAsConst(selectedRows)) { |
|
|||
396 | // if (auto selectedVariable = |
|
|||
397 | // impl->m_VariableModel->variable(selectedRow.row())) { |
|
|||
398 | // variables << selectedVariable; |
|
|||
399 |
|
||||
400 | // // notify that rescale operation has to be done |
|
|||
401 | // emit rangeChanged(selectedVariable, dateTime); |
|
|||
402 | // } |
|
|||
403 | // } |
|
|||
404 | // if (!variables.isEmpty()) { |
|
|||
405 | // this->onRequestDataLoading(variables, dateTime, synchro); |
|
|||
406 | // } |
|
|||
407 | if (selectedRows.size() == 1) { |
|
388 | if (selectedRows.size() == 1) { | |
408 |
|
389 | |||
409 | if (auto selectedVariable |
|
390 | if (auto selectedVariable | |
@@ -441,8 +422,7 void VariableController::onUpdateDateTime(std::shared_ptr<Variable> variable, | |||||
441 | this->onRequestDataLoading(QVector<std::shared_ptr<Variable> >{variable}, dateTime, synchro); |
|
422 | this->onRequestDataLoading(QVector<std::shared_ptr<Variable> >{variable}, dateTime, synchro); | |
442 | } |
|
423 | } | |
443 |
|
424 | |||
444 |
void VariableController::onDataProvided(QUuid vIdentifier, |
|
425 | void VariableController::onDataProvided(QUuid vIdentifier, | |
445 | const SqpRange &cacheRangeRequested, |
|
|||
446 | QVector<AcquisitionDataPacket> dataAcquired) |
|
426 | QVector<AcquisitionDataPacket> dataAcquired) | |
447 | { |
|
427 | { | |
448 | qCDebug(LOG_VariableController()) << tr("onDataProvided") << QThread::currentThread(); |
|
428 | qCDebug(LOG_VariableController()) << tr("onDataProvided") << QThread::currentThread(); | |
@@ -459,6 +439,8 void VariableController::onVariableRetrieveDataInProgress(QUuid identifier, doub | |||||
459 | << "TORM: variableController::onVariableRetrieveDataInProgress" |
|
439 | << "TORM: variableController::onVariableRetrieveDataInProgress" | |
460 | << QThread::currentThread()->objectName() << progress; |
|
440 | << QThread::currentThread()->objectName() << progress; | |
461 | if (auto var = impl->findVariable(identifier)) { |
|
441 | if (auto var = impl->findVariable(identifier)) { | |
|
442 | qCDebug(LOG_VariableController()) | |||
|
443 | << "TORM: variableController::onVariableRetrieveDataInProgress FOUND"; | |||
462 | impl->m_VariableModel->setDataProgress(var, progress); |
|
444 | impl->m_VariableModel->setDataProgress(var, progress); | |
463 | } |
|
445 | } | |
464 | else { |
|
446 | else { | |
@@ -590,7 +572,7 void VariableController::onRequestDataLoading(QVector<std::shared_ptr<Variable> | |||||
590 | } |
|
572 | } | |
591 | impl->m_VarGroupIdToVarIds.insert(std::make_pair(varRequestId, varIds)); |
|
573 | impl->m_VarGroupIdToVarIds.insert(std::make_pair(varRequestId, varIds)); | |
592 | for (const auto &var : variables) { |
|
574 | for (const auto &var : variables) { | |
593 |
qCDebug(LOG_VariableController()) << " |
|
575 | qCDebug(LOG_VariableController()) << "onRequestDataLoading: for" << varRequestId | |
594 | << varIds.size(); |
|
576 | << varIds.size(); | |
595 | impl->processRequest(var, range, varRequestId); |
|
577 | impl->processRequest(var, range, varRequestId); | |
596 | } |
|
578 | } | |
@@ -609,6 +591,8 void VariableController::onRequestDataLoading(QVector<std::shared_ptr<Variable> | |||||
609 | for (auto vId : vSyncIds) { |
|
591 | for (auto vId : vSyncIds) { | |
610 | varIds.push_back(vId); |
|
592 | varIds.push_back(vId); | |
611 | } |
|
593 | } | |
|
594 | qCDebug(LOG_VariableController()) << "onRequestDataLoading sync: for" << varRequestId | |||
|
595 | << varIds.size(); | |||
612 | impl->m_VarGroupIdToVarIds.insert(std::make_pair(varRequestId, varIds)); |
|
596 | impl->m_VarGroupIdToVarIds.insert(std::make_pair(varRequestId, varIds)); | |
613 |
|
597 | |||
614 | for (auto vId : vSyncIds) { |
|
598 | for (auto vId : vSyncIds) { | |
@@ -850,8 +834,6 void VariableController::VariableControllerPrivate::updateVariables(QUuid varReq | |||||
850 | auto &varIds = varGroupIdToVarIdsIt->second; |
|
834 | auto &varIds = varGroupIdToVarIdsIt->second; | |
851 | auto varIdsEnd = varIds.end(); |
|
835 | auto varIdsEnd = varIds.end(); | |
852 | bool processVariableUpdate = true; |
|
836 | bool processVariableUpdate = true; | |
853 | qCDebug(LOG_VariableController()) << "VariableControllerPrivate::updateVariables" |
|
|||
854 | << varRequestId << varIds.size(); |
|
|||
855 | for (auto varIdsIt = varIds.begin(); (varIdsIt != varIdsEnd) && processVariableUpdate; |
|
837 | for (auto varIdsIt = varIds.begin(); (varIdsIt != varIdsEnd) && processVariableUpdate; | |
856 | ++varIdsIt) { |
|
838 | ++varIdsIt) { | |
857 | auto itVarHandler = m_VarIdToVarRequestHandler.find(*varIdsIt); |
|
839 | auto itVarHandler = m_VarIdToVarRequestHandler.find(*varIdsIt); | |
@@ -861,7 +843,6 void VariableController::VariableControllerPrivate::updateVariables(QUuid varReq | |||||
861 | } |
|
843 | } | |
862 |
|
844 | |||
863 | if (processVariableUpdate) { |
|
845 | if (processVariableUpdate) { | |
864 | qCDebug(LOG_VariableController()) << "Final update OK for the var request" << varIds.size(); |
|
|||
865 | for (auto varIdsIt = varIds.begin(); varIdsIt != varIdsEnd; ++varIdsIt) { |
|
846 | for (auto varIdsIt = varIds.begin(); varIdsIt != varIdsEnd; ++varIdsIt) { | |
866 | auto itVarHandler = m_VarIdToVarRequestHandler.find(*varIdsIt); |
|
847 | auto itVarHandler = m_VarIdToVarRequestHandler.find(*varIdsIt); | |
867 | if (itVarHandler != m_VarIdToVarRequestHandler.cend()) { |
|
848 | if (itVarHandler != m_VarIdToVarRequestHandler.cend()) { | |
@@ -880,7 +861,6 void VariableController::VariableControllerPrivate::updateVariables(QUuid varReq | |||||
880 | << var->nbPoints(); |
|
861 | << var->nbPoints(); | |
881 |
|
862 | |||
882 | emit var->updated(); |
|
863 | emit var->updated(); | |
883 | qCDebug(LOG_VariableController()) << tr("Update OK"); |
|
|||
884 | } |
|
864 | } | |
885 | else { |
|
865 | else { | |
886 | qCCritical(LOG_VariableController()) |
|
866 | qCCritical(LOG_VariableController()) | |
@@ -912,13 +892,22 void VariableController::VariableControllerPrivate::updateVariableRequest(QUuid | |||||
912 |
|
892 | |||
913 | auto &varIds = varGroupIdToVarIdsIt->second; |
|
893 | auto &varIds = varGroupIdToVarIdsIt->second; | |
914 | auto varIdsEnd = varIds.end(); |
|
894 | auto varIdsEnd = varIds.end(); | |
|
895 | ||||
|
896 | // First pass all canUpdate of handler to false | |||
915 | for (auto varIdsIt = varIds.begin(); (varIdsIt != varIdsEnd); ++varIdsIt) { |
|
897 | for (auto varIdsIt = varIds.begin(); (varIdsIt != varIdsEnd); ++varIdsIt) { | |
916 | auto itVarHandler = m_VarIdToVarRequestHandler.find(*varIdsIt); |
|
898 | auto itVarHandler = m_VarIdToVarRequestHandler.find(*varIdsIt); | |
917 | if (itVarHandler != m_VarIdToVarRequestHandler.cend()) { |
|
899 | if (itVarHandler != m_VarIdToVarRequestHandler.cend()) { | |
918 |
|
900 | |||
919 | auto varHandler = itVarHandler->second.get(); |
|
901 | auto varHandler = itVarHandler->second.get(); | |
920 | varHandler->m_CanUpdate = false; |
|
902 | varHandler->m_CanUpdate = false; | |
|
903 | } | |||
|
904 | } | |||
|
905 | // Second update requests of handler | |||
|
906 | for (auto varIdsIt = varIds.begin(); (varIdsIt != varIdsEnd); ++varIdsIt) { | |||
|
907 | auto itVarHandler = m_VarIdToVarRequestHandler.find(*varIdsIt); | |||
|
908 | if (itVarHandler != m_VarIdToVarRequestHandler.cend()) { | |||
921 |
|
909 | |||
|
910 | auto varHandler = itVarHandler->second.get(); | |||
922 |
|
911 | |||
923 | switch (varHandler->m_State) { |
|
912 | switch (varHandler->m_State) { | |
924 | case VariableRequestHandlerState::OFF: { |
|
913 | case VariableRequestHandlerState::OFF: { | |
@@ -961,6 +950,17 void VariableController::VariableControllerPrivate::cancelVariableRequest(QUuid | |||||
961 |
|
950 | |||
962 | auto &varIds = varGroupIdToVarIdsIt->second; |
|
951 | auto &varIds = varGroupIdToVarIdsIt->second; | |
963 | auto varIdsEnd = varIds.end(); |
|
952 | auto varIdsEnd = varIds.end(); | |
|
953 | ||||
|
954 | // First pass all canUpdate of handler to false | |||
|
955 | for (auto varIdsIt = varIds.begin(); (varIdsIt != varIdsEnd); ++varIdsIt) { | |||
|
956 | auto itVarHandler = m_VarIdToVarRequestHandler.find(*varIdsIt); | |||
|
957 | if (itVarHandler != m_VarIdToVarRequestHandler.cend()) { | |||
|
958 | ||||
|
959 | auto varHandler = itVarHandler->second.get(); | |||
|
960 | varHandler->m_CanUpdate = false; | |||
|
961 | } | |||
|
962 | } | |||
|
963 | ||||
964 | for (auto varIdsIt = varIds.begin(); (varIdsIt != varIdsEnd); ++varIdsIt) { |
|
964 | for (auto varIdsIt = varIds.begin(); (varIdsIt != varIdsEnd); ++varIdsIt) { | |
965 | auto itVarHandler = m_VarIdToVarRequestHandler.find(*varIdsIt); |
|
965 | auto itVarHandler = m_VarIdToVarRequestHandler.find(*varIdsIt); | |
966 | if (itVarHandler != m_VarIdToVarRequestHandler.cend()) { |
|
966 | if (itVarHandler != m_VarIdToVarRequestHandler.cend()) { | |
@@ -983,7 +983,6 void VariableController::VariableControllerPrivate::cancelVariableRequest(QUuid | |||||
983 | itVarHandler->first); |
|
983 | itVarHandler->first); | |
984 | } |
|
984 | } | |
985 | m_VariableModel->setDataProgress(var, 0.0); |
|
985 | m_VariableModel->setDataProgress(var, 0.0); | |
986 | varHandler->m_CanUpdate = false; |
|
|||
987 | varHandler->m_State = VariableRequestHandlerState::OFF; |
|
986 | varHandler->m_State = VariableRequestHandlerState::OFF; | |
988 | varHandler->m_RunningVarRequest = VariableRequest{}; |
|
987 | varHandler->m_RunningVarRequest = VariableRequest{}; | |
989 | } |
|
988 | } | |
@@ -1002,7 +1001,6 void VariableController::VariableControllerPrivate::cancelVariableRequest(QUuid | |||||
1002 | itVarHandler->first); |
|
1001 | itVarHandler->first); | |
1003 | } |
|
1002 | } | |
1004 | m_VariableModel->setDataProgress(var, 0.0); |
|
1003 | m_VariableModel->setDataProgress(var, 0.0); | |
1005 | varHandler->m_CanUpdate = false; |
|
|||
1006 | varHandler->m_State = VariableRequestHandlerState::RUNNING; |
|
1004 | varHandler->m_State = VariableRequestHandlerState::RUNNING; | |
1007 | varHandler->m_RunningVarRequest = varHandler->m_PendingVarRequest; |
|
1005 | varHandler->m_RunningVarRequest = varHandler->m_PendingVarRequest; | |
1008 | varHandler->m_PendingVarRequest = VariableRequest{}; |
|
1006 | varHandler->m_PendingVarRequest = VariableRequest{}; | |
@@ -1034,8 +1032,6 void VariableController::VariableControllerPrivate::cancelVariableRequest(QUuid | |||||
1034 | void VariableController::VariableControllerPrivate::executeVarRequest(std::shared_ptr<Variable> var, |
|
1032 | void VariableController::VariableControllerPrivate::executeVarRequest(std::shared_ptr<Variable> var, | |
1035 | VariableRequest &varRequest) |
|
1033 | VariableRequest &varRequest) | |
1036 | { |
|
1034 | { | |
1037 | qCDebug(LOG_VariableController()) << tr("TORM: executeVarRequest"); |
|
|||
1038 |
|
||||
1039 | auto varIdIt = m_VariableToIdentifierMap.find(var); |
|
1035 | auto varIdIt = m_VariableToIdentifierMap.find(var); | |
1040 | if (varIdIt == m_VariableToIdentifierMap.cend()) { |
|
1036 | if (varIdIt == m_VariableToIdentifierMap.cend()) { | |
1041 | qCWarning(LOG_VariableController()) << tr( |
|
1037 | qCWarning(LOG_VariableController()) << tr( | |
@@ -1059,8 +1055,7 void VariableController::VariableControllerPrivate::executeVarRequest(std::share | |||||
1059 | qCDebug(LOG_VariableController()) << "executeVarRequest " << varRequest.m_RangeRequested |
|
1055 | qCDebug(LOG_VariableController()) << "executeVarRequest " << varRequest.m_RangeRequested | |
1060 | << varRequest.m_CacheRangeRequested; |
|
1056 | << varRequest.m_CacheRangeRequested; | |
1061 | m_VariableAcquisitionWorker->pushVariableRequest( |
|
1057 | m_VariableAcquisitionWorker->pushVariableRequest( | |
1062 |
varRequest.m_VariableGroupId, varId, |
|
1058 | varRequest.m_VariableGroupId, varId, | |
1063 | varRequest.m_CacheRangeRequested, |
|
|||
1064 | DataProviderParameters{std::move(notInCacheRangeList), var->metadata()}, |
|
1059 | DataProviderParameters{std::move(notInCacheRangeList), var->metadata()}, | |
1065 | varProvider); |
|
1060 | varProvider); | |
1066 | } |
|
1061 | } | |
@@ -1074,6 +1069,8 void VariableController::VariableControllerPrivate::executeVarRequest(std::share | |||||
1074 | } |
|
1069 | } | |
1075 | } |
|
1070 | } | |
1076 | else { |
|
1071 | else { | |
|
1072 | qCDebug(LOG_VariableController()) << "All already in the cache " | |||
|
1073 | << varRequest.m_RangeRequested; | |||
1077 | acceptVariableRequest(varId, |
|
1074 | acceptVariableRequest(varId, | |
1078 | var->dataSeries()->subDataSeries(varRequest.m_CacheRangeRequested)); |
|
1075 | var->dataSeries()->subDataSeries(varRequest.m_CacheRangeRequested)); | |
1079 | } |
|
1076 | } |
1 | NO CONTENT: modified file |
|
NO CONTENT: modified file |
@@ -135,12 +135,16 void AmdaProvider::onReplyDownloadProgress(QUuid acqIdentifier, | |||||
135 | finalProgress = finalProgress / fraq; |
|
135 | finalProgress = finalProgress / fraq; | |
136 | } |
|
136 | } | |
137 |
|
137 | |||
138 |
qCDebug(LOG_AmdaProvider()) << tr(" |
|
138 | qCDebug(LOG_AmdaProvider()) << tr("final progress: ") | |
|
139 | << QThread::currentThread()->objectName() << acqIdentifier | |||
|
140 | << fraq << finalProgress; | |||
139 | emit dataProvidedProgress(acqIdentifier, finalProgress); |
|
141 | emit dataProvidedProgress(acqIdentifier, finalProgress); | |
140 | } |
|
142 | } | |
141 | else { |
|
143 | else { | |
142 | // This case can happened when a progression is send after the request has been finished. |
|
144 | // This case can happened when a progression is send after the request has been finished. | |
143 | // Generaly the case when aborting a request |
|
145 | // Generaly the case when aborting a request | |
|
146 | qCDebug(LOG_AmdaProvider()) << tr("Acquisition request not found: final progress: 100 : ") | |||
|
147 | << QThread::currentThread()->objectName() << acqIdentifier; | |||
144 | emit dataProvidedProgress(acqIdentifier, 100.0); |
|
148 | emit dataProvidedProgress(acqIdentifier, 100.0); | |
145 | } |
|
149 | } | |
146 | } |
|
150 | } | |
@@ -169,7 +173,6 void AmdaProvider::retrieveData(QUuid token, const SqpRange &dateTime, const QVa | |||||
169 | QVariantHash urlProperties{{AMDA_SERVER_KEY, data.value(AMDA_SERVER_KEY)}}; |
|
173 | QVariantHash urlProperties{{AMDA_SERVER_KEY, data.value(AMDA_SERVER_KEY)}}; | |
170 | auto url = QUrl{QString{AMDA_URL_FORMAT}.arg(AmdaServer::instance().url(urlProperties), |
|
174 | auto url = QUrl{QString{AMDA_URL_FORMAT}.arg(AmdaServer::instance().url(urlProperties), | |
171 | startDate, endDate, productId)}; |
|
175 | startDate, endDate, productId)}; | |
172 | qCInfo(LOG_AmdaProvider()) << tr("TORM AmdaProvider::retrieveData url:") << url; |
|
|||
173 | auto tempFile = std::make_shared<QTemporaryFile>(); |
|
176 | auto tempFile = std::make_shared<QTemporaryFile>(); | |
174 |
|
177 | |||
175 | // LAMBDA |
|
178 | // LAMBDA | |
@@ -211,8 +214,8 void AmdaProvider::retrieveData(QUuid token, const SqpRange &dateTime, const QVa | |||||
211 | if (reply->error() == QNetworkReply::NoError) { |
|
214 | if (reply->error() == QNetworkReply::NoError) { | |
212 | auto downloadFileUrl = QUrl{QString{reply->readAll()}.trimmed()}; |
|
215 | auto downloadFileUrl = QUrl{QString{reply->readAll()}.trimmed()}; | |
213 |
|
216 | |||
214 | qCInfo(LOG_AmdaProvider()) |
|
217 | qCDebug(LOG_AmdaProvider()) << tr("AmdaProvider::retrieveData downloadFileUrl:") | |
215 | << tr("TORM AmdaProvider::retrieveData downloadFileUrl:") << downloadFileUrl; |
|
218 | << downloadFileUrl; | |
216 | // Executes request for downloading file // |
|
219 | // Executes request for downloading file // | |
217 |
|
220 | |||
218 | // Creates destination file |
|
221 | // Creates destination file | |
@@ -238,7 +241,6 void AmdaProvider::retrieveData(QUuid token, const SqpRange &dateTime, const QVa | |||||
238 | // //////////////// // |
|
241 | // //////////////// // | |
239 |
|
242 | |||
240 | auto request = std::make_shared<QNetworkRequest>(url); |
|
243 | auto request = std::make_shared<QNetworkRequest>(url); | |
241 | qCDebug(LOG_AmdaProvider()) << tr("First Request creation") << request.get(); |
|
|||
242 | updateRequestProgress(token, request, 0.0); |
|
244 | updateRequestProgress(token, request, 0.0); | |
243 |
|
245 | |||
244 | emit requestConstructed(request, token, httpFinishedLambda); |
|
246 | emit requestConstructed(request, token, httpFinishedLambda); | |
@@ -247,7 +249,6 void AmdaProvider::retrieveData(QUuid token, const SqpRange &dateTime, const QVa | |||||
247 | void AmdaProvider::updateRequestProgress(QUuid acqIdentifier, |
|
249 | void AmdaProvider::updateRequestProgress(QUuid acqIdentifier, | |
248 | std::shared_ptr<QNetworkRequest> request, double progress) |
|
250 | std::shared_ptr<QNetworkRequest> request, double progress) | |
249 | { |
|
251 | { | |
250 | qCDebug(LOG_AmdaProvider()) << tr("updateRequestProgress request") << request.get(); |
|
|||
251 | auto acqIdToRequestProgressMapIt = m_AcqIdToRequestProgressMap.find(acqIdentifier); |
|
252 | auto acqIdToRequestProgressMapIt = m_AcqIdToRequestProgressMap.find(acqIdentifier); | |
252 | if (acqIdToRequestProgressMapIt != m_AcqIdToRequestProgressMap.end()) { |
|
253 | if (acqIdToRequestProgressMapIt != m_AcqIdToRequestProgressMap.end()) { | |
253 | auto &requestProgressMap = acqIdToRequestProgressMapIt->second; |
|
254 | auto &requestProgressMap = acqIdToRequestProgressMapIt->second; |
@@ -13,6 +13,7 const QString PROVIDER_PROPERTY = QStringLiteral("provider"); | |||||
13 | const QString OPERATION_DELAY_BOUNDS_PROPERTY = QStringLiteral("operationDelays"); |
|
13 | const QString OPERATION_DELAY_BOUNDS_PROPERTY = QStringLiteral("operationDelays"); | |
14 | const QString VALIDATORS_PROPERTY = QStringLiteral("validators"); |
|
14 | const QString VALIDATORS_PROPERTY = QStringLiteral("validators"); | |
15 | const QString VALIDATION_FREQUENCY_BOUNDS_PROPERTY = QStringLiteral("validationFrequencyBounds"); |
|
15 | const QString VALIDATION_FREQUENCY_BOUNDS_PROPERTY = QStringLiteral("validationFrequencyBounds"); | |
|
16 | const QString CUSTOM_OPERATIONS_PROPERTY = QStringLiteral("customOperations"); | |||
16 |
|
17 | |||
17 | // //////////// // |
|
18 | // //////////// // | |
18 | // FuzzingState // |
|
19 | // FuzzingState // |
@@ -62,6 +62,9 extern const QString VALIDATORS_PROPERTY; | |||||
62 | /// Min/max number of operations to execute before calling validation of the current test's state |
|
62 | /// Min/max number of operations to execute before calling validation of the current test's state | |
63 | extern const QString VALIDATION_FREQUENCY_BOUNDS_PROPERTY; |
|
63 | extern const QString VALIDATION_FREQUENCY_BOUNDS_PROPERTY; | |
64 |
|
64 | |||
|
65 | /// Custom operations to execute instead of random operations | |||
|
66 | extern const QString CUSTOM_OPERATIONS_PROPERTY; | |||
|
67 | ||||
65 | // /////// // |
|
68 | // /////// // | |
66 | // Structs // |
|
69 | // Structs // | |
67 | // /////// // |
|
70 | // /////// // |
@@ -178,7 +178,7 struct SynchronizeOperation : public IFuzzingOperation { | |||||
178 | fuzzingState.synchronizeVariable(variableId, syncGroupId); |
|
178 | fuzzingState.synchronizeVariable(variableId, syncGroupId); | |
179 |
|
179 | |||
180 | variableController.onRequestDataLoading({variableState.m_Variable}, variableState.m_Range, |
|
180 | variableController.onRequestDataLoading({variableState.m_Variable}, variableState.m_Range, | |
181 |
|
|
181 | true); | |
182 | } |
|
182 | } | |
183 | }; |
|
183 | }; | |
184 |
|
184 |
@@ -57,6 +57,12 struct OperationProperty { | |||||
57 | using VariableOperation = std::pair<VariableId, std::shared_ptr<IFuzzingOperation> >; |
|
57 | using VariableOperation = std::pair<VariableId, std::shared_ptr<IFuzzingOperation> >; | |
58 | using VariablesOperations = std::vector<VariableOperation>; |
|
58 | using VariablesOperations = std::vector<VariableOperation>; | |
59 |
|
59 | |||
|
60 | struct CustomVariableOperation { | |||
|
61 | VariableOperation m_VariableOperation{}; | |||
|
62 | bool m_WaitAcquisition{false}; | |||
|
63 | }; | |||
|
64 | using CustomVariablesOperations = std::vector<CustomVariableOperation>; | |||
|
65 | ||||
60 | using OperationsTypes = std::map<FuzzingOperationType, OperationProperty>; |
|
66 | using OperationsTypes = std::map<FuzzingOperationType, OperationProperty>; | |
61 | using OperationsPool = std::map<std::shared_ptr<IFuzzingOperation>, OperationProperty>; |
|
67 | using OperationsPool = std::map<std::shared_ptr<IFuzzingOperation>, OperationProperty>; | |
62 |
|
68 | |||
@@ -67,30 +73,150 using Validators = std::vector<std::shared_ptr<IFuzzingValidator> >; | |||||
67 | // ///////// // |
|
73 | // ///////// // | |
68 |
|
74 | |||
69 | // Defaults values used when the associated properties have not been set for the test |
|
75 | // Defaults values used when the associated properties have not been set for the test | |
70 |
const auto ACQUISITION_TIMEOUT_DEFAULT_VALUE = |
|
76 | const auto ACQUISITION_TIMEOUT_DEFAULT_VALUE = 100000; | |
71 |
const auto NB_MAX_OPERATIONS_DEFAULT_VALUE = 1 |
|
77 | const auto NB_MAX_OPERATIONS_DEFAULT_VALUE = 160; | |
72 |
const auto NB_MAX_SYNC_GROUPS_DEFAULT_VALUE = |
|
78 | const auto NB_MAX_SYNC_GROUPS_DEFAULT_VALUE = 8; | |
73 |
const auto NB_MAX_VARIABLES_DEFAULT_VALUE = |
|
79 | const auto NB_MAX_VARIABLES_DEFAULT_VALUE = 30; | |
74 | const auto AVAILABLE_OPERATIONS_DEFAULT_VALUE = QVariant::fromValue( |
|
80 | const auto AVAILABLE_OPERATIONS_DEFAULT_VALUE = QVariant::fromValue( | |
75 |
OperationsTypes{{FuzzingOperationType::CREATE, { |
|
81 | OperationsTypes{{FuzzingOperationType::CREATE, {40000., true}}, | |
76 |
{FuzzingOperationType::DELETE, {0. |
|
82 | {FuzzingOperationType::DELETE, {0.0}}, // Delete operation is less frequent | |
77 | {FuzzingOperationType::PAN_LEFT, {1.}}, |
|
83 | {FuzzingOperationType::PAN_LEFT, {1.}}, | |
78 | {FuzzingOperationType::PAN_RIGHT, {1.}}, |
|
84 | {FuzzingOperationType::PAN_RIGHT, {1.}}, | |
79 | {FuzzingOperationType::ZOOM_IN, {1.}}, |
|
85 | {FuzzingOperationType::ZOOM_IN, {1.}}, | |
80 | {FuzzingOperationType::ZOOM_OUT, {1.}}, |
|
86 | {FuzzingOperationType::ZOOM_OUT, {1.}}, | |
81 |
{FuzzingOperationType::SYNCHRONIZE, { |
|
87 | {FuzzingOperationType::SYNCHRONIZE, {500.0}}, | |
82 |
{FuzzingOperationType::DESYNCHRONIZE, {0. |
|
88 | {FuzzingOperationType::DESYNCHRONIZE, {0.0}}}); | |
83 | const auto CACHE_TOLERANCE_DEFAULT_VALUE = 0.2; |
|
89 | const auto CACHE_TOLERANCE_DEFAULT_VALUE = 0.2; | |
84 |
|
90 | |||
85 | /// Min/max delays between each operation (in ms) |
|
91 | /// Min/max delays between each operation (in ms) | |
86 |
const auto OPERATION_DELAY_BOUNDS_DEFAULT_VALUE = QVariant::fromValue(std::make_pair( |
|
92 | const auto OPERATION_DELAY_BOUNDS_DEFAULT_VALUE = QVariant::fromValue(std::make_pair(20, 3000)); | |
87 |
|
93 | |||
88 | /// Validators for the tests (executed in the order in which they're defined) |
|
94 | /// Validators for the tests (executed in the order in which they're defined) | |
89 | const auto VALIDATORS_DEFAULT_VALUE = QVariant::fromValue( |
|
95 | const auto VALIDATORS_DEFAULT_VALUE = QVariant::fromValue( | |
90 | ValidatorsTypes{{FuzzingValidatorType::RANGE, FuzzingValidatorType::DATA}}); |
|
96 | ValidatorsTypes{{FuzzingValidatorType::RANGE, FuzzingValidatorType::DATA}}); | |
91 |
|
97 | |||
92 | /// Min/max number of operations to execute before calling validation |
|
98 | /// Min/max number of operations to execute before calling validation | |
93 |
const auto VALIDATION_FREQUENCY_BOUNDS_DEFAULT_VALUE = QVariant::fromValue(std::make_pair( |
|
99 | const auto VALIDATION_FREQUENCY_BOUNDS_DEFAULT_VALUE = QVariant::fromValue(std::make_pair(2, 10)); | |
|
100 | ||||
|
101 | ||||
|
102 | // /////// ////// | |||
|
103 | // CUSTOM CASE // | |||
|
104 | // /////// ////// | |||
|
105 | ||||
|
106 | auto op = [](auto type){ | |||
|
107 | return FuzzingOperationFactory::create(type); | |||
|
108 | }; | |||
|
109 | ||||
|
110 | ||||
|
111 | const QVariant CUSTOM_CASE_ONE =QVariant::fromValue(CustomVariablesOperations{{{0, op(FuzzingOperationType::CREATE)}, true}, | |||
|
112 | {{0, op(FuzzingOperationType::SYNCHRONIZE)}}, | |||
|
113 | {{1, op(FuzzingOperationType::CREATE)}, true}, | |||
|
114 | {{1, op(FuzzingOperationType::SYNCHRONIZE)}}, | |||
|
115 | {{0, op(FuzzingOperationType::PAN_LEFT)}}, | |||
|
116 | {{1, op(FuzzingOperationType::PAN_RIGHT)}}, | |||
|
117 | {{0, op(FuzzingOperationType::PAN_LEFT)}}, | |||
|
118 | {{1, op(FuzzingOperationType::PAN_RIGHT)}}, | |||
|
119 | {{0, op(FuzzingOperationType::PAN_LEFT)}}, | |||
|
120 | {{1, op(FuzzingOperationType::PAN_RIGHT)}}, | |||
|
121 | {{0, op(FuzzingOperationType::PAN_LEFT)}}, | |||
|
122 | {{1, op(FuzzingOperationType::PAN_RIGHT)}}, | |||
|
123 | {{0, op(FuzzingOperationType::PAN_LEFT)}}, | |||
|
124 | {{1, op(FuzzingOperationType::PAN_RIGHT)}}, | |||
|
125 | {{0, op(FuzzingOperationType::PAN_RIGHT)}}, | |||
|
126 | {{1, op(FuzzingOperationType::PAN_LEFT)}}, | |||
|
127 | {{0, op(FuzzingOperationType::PAN_RIGHT)}}, | |||
|
128 | {{1, op(FuzzingOperationType::PAN_RIGHT)}}, | |||
|
129 | {{0, op(FuzzingOperationType::PAN_LEFT)}}, | |||
|
130 | {{1, op(FuzzingOperationType::PAN_RIGHT)}}, | |||
|
131 | {{0, op(FuzzingOperationType::PAN_LEFT)}}, | |||
|
132 | {{1, op(FuzzingOperationType::PAN_RIGHT)}}, | |||
|
133 | {{0, op(FuzzingOperationType::PAN_LEFT)}}, | |||
|
134 | {{1, op(FuzzingOperationType::PAN_RIGHT)}}, | |||
|
135 | {{0, op(FuzzingOperationType::PAN_LEFT)}}, | |||
|
136 | {{1, op(FuzzingOperationType::PAN_RIGHT)}}, | |||
|
137 | {{0, op(FuzzingOperationType::PAN_LEFT)}}, | |||
|
138 | {{1, op(FuzzingOperationType::PAN_LEFT)}}, | |||
|
139 | {{0, op(FuzzingOperationType::PAN_LEFT)}}, | |||
|
140 | {{1, op(FuzzingOperationType::PAN_LEFT)}}, | |||
|
141 | {{0, op(FuzzingOperationType::PAN_RIGHT)}}, | |||
|
142 | {{1, op(FuzzingOperationType::PAN_LEFT)}}, | |||
|
143 | {{0, op(FuzzingOperationType::PAN_RIGHT)}}, | |||
|
144 | {{1, op(FuzzingOperationType::PAN_RIGHT)}}, | |||
|
145 | {{0, op(FuzzingOperationType::PAN_LEFT)}}, | |||
|
146 | {{1, op(FuzzingOperationType::PAN_RIGHT)}}, | |||
|
147 | {{0, op(FuzzingOperationType::PAN_LEFT)}}, | |||
|
148 | {{1, op(FuzzingOperationType::PAN_RIGHT)}}, | |||
|
149 | {{0, op(FuzzingOperationType::PAN_LEFT)}}, | |||
|
150 | {{1, op(FuzzingOperationType::PAN_RIGHT)}}, | |||
|
151 | {{0, op(FuzzingOperationType::PAN_LEFT)}}, | |||
|
152 | {{1, op(FuzzingOperationType::PAN_RIGHT)}}, | |||
|
153 | {{0, op(FuzzingOperationType::PAN_LEFT)}}, | |||
|
154 | {{1, op(FuzzingOperationType::PAN_RIGHT)}}, | |||
|
155 | {{0, op(FuzzingOperationType::PAN_LEFT)}}, | |||
|
156 | {{1, op(FuzzingOperationType::PAN_RIGHT)}}, | |||
|
157 | {{0, op(FuzzingOperationType::PAN_RIGHT)}}, | |||
|
158 | {{1, op(FuzzingOperationType::PAN_LEFT)}}, | |||
|
159 | {{0, op(FuzzingOperationType::PAN_RIGHT)}}, | |||
|
160 | {{1, op(FuzzingOperationType::PAN_RIGHT)}}, | |||
|
161 | {{0, op(FuzzingOperationType::PAN_LEFT)}}, | |||
|
162 | {{1, op(FuzzingOperationType::PAN_RIGHT)}}, | |||
|
163 | {{0, op(FuzzingOperationType::PAN_LEFT)}}, | |||
|
164 | {{1, op(FuzzingOperationType::PAN_RIGHT)}}, | |||
|
165 | {{0, op(FuzzingOperationType::PAN_RIGHT)}}, | |||
|
166 | {{1, op(FuzzingOperationType::PAN_RIGHT)}}, | |||
|
167 | {{0, op(FuzzingOperationType::PAN_LEFT)}}, | |||
|
168 | {{1, op(FuzzingOperationType::PAN_RIGHT)}}, | |||
|
169 | {{0, op(FuzzingOperationType::PAN_LEFT)}}, | |||
|
170 | {{1, op(FuzzingOperationType::PAN_RIGHT)}}, | |||
|
171 | {{0, op(FuzzingOperationType::PAN_LEFT)}}, | |||
|
172 | {{1, op(FuzzingOperationType::PAN_RIGHT)}}, | |||
|
173 | {{0, op(FuzzingOperationType::PAN_RIGHT)}}, | |||
|
174 | {{1, op(FuzzingOperationType::PAN_LEFT)}}, | |||
|
175 | {{0, op(FuzzingOperationType::PAN_RIGHT)}}, | |||
|
176 | {{1, op(FuzzingOperationType::PAN_RIGHT)}}, | |||
|
177 | {{0, op(FuzzingOperationType::PAN_LEFT)}}, | |||
|
178 | {{1, op(FuzzingOperationType::PAN_RIGHT)}}, | |||
|
179 | {{0, op(FuzzingOperationType::PAN_LEFT)}}, | |||
|
180 | {{1, op(FuzzingOperationType::PAN_RIGHT)}}, | |||
|
181 | {{0, op(FuzzingOperationType::PAN_LEFT)}}, | |||
|
182 | {{1, op(FuzzingOperationType::PAN_RIGHT)}}, | |||
|
183 | {{0, op(FuzzingOperationType::PAN_LEFT)}}, | |||
|
184 | {{1, op(FuzzingOperationType::PAN_RIGHT)}}, | |||
|
185 | {{0, op(FuzzingOperationType::PAN_LEFT)}}, | |||
|
186 | {{1, op(FuzzingOperationType::PAN_RIGHT)}}, | |||
|
187 | {{0, op(FuzzingOperationType::PAN_LEFT)}}, | |||
|
188 | {{1, op(FuzzingOperationType::PAN_RIGHT)}}, | |||
|
189 | {{0, op(FuzzingOperationType::PAN_RIGHT)}}, | |||
|
190 | {{1, op(FuzzingOperationType::PAN_LEFT)}}, | |||
|
191 | {{0, op(FuzzingOperationType::PAN_RIGHT)}}, | |||
|
192 | {{1, op(FuzzingOperationType::PAN_RIGHT)}}, | |||
|
193 | {{0, op(FuzzingOperationType::PAN_RIGHT)}}, | |||
|
194 | {{1, op(FuzzingOperationType::PAN_RIGHT)}}, | |||
|
195 | {{0, op(FuzzingOperationType::PAN_LEFT)}}, | |||
|
196 | {{1, op(FuzzingOperationType::PAN_RIGHT)}}, | |||
|
197 | {{0, op(FuzzingOperationType::PAN_LEFT)}}, | |||
|
198 | {{1, op(FuzzingOperationType::PAN_RIGHT)}}, | |||
|
199 | {{0, op(FuzzingOperationType::PAN_LEFT)}}, | |||
|
200 | {{1, op(FuzzingOperationType::PAN_RIGHT)}}, | |||
|
201 | {{0, op(FuzzingOperationType::PAN_LEFT)}}, | |||
|
202 | {{1, op(FuzzingOperationType::PAN_RIGHT)}}, | |||
|
203 | {{0, op(FuzzingOperationType::PAN_LEFT)}}, | |||
|
204 | {{1, op(FuzzingOperationType::PAN_RIGHT)}}, | |||
|
205 | {{0, op(FuzzingOperationType::PAN_RIGHT)}}, | |||
|
206 | {{1, op(FuzzingOperationType::PAN_LEFT)}}, | |||
|
207 | {{0, op(FuzzingOperationType::PAN_RIGHT)}}, | |||
|
208 | {{1, op(FuzzingOperationType::PAN_RIGHT)}}, | |||
|
209 | {{0, op(FuzzingOperationType::PAN_LEFT)}}, | |||
|
210 | {{1, op(FuzzingOperationType::PAN_RIGHT)}}, | |||
|
211 | }); | |||
|
212 | ||||
|
213 | const QVariant CUSTOM_CASE_TWO =QVariant::fromValue(CustomVariablesOperations{{{0, op(FuzzingOperationType::CREATE)}, true}, | |||
|
214 | {{0, op(FuzzingOperationType::SYNCHRONIZE)}}, | |||
|
215 | {{1, op(FuzzingOperationType::CREATE)}, true}, | |||
|
216 | {{1, op(FuzzingOperationType::SYNCHRONIZE)}}, | |||
|
217 | {{1, op(FuzzingOperationType::ZOOM_OUT)}}, | |||
|
218 | {{1, op(FuzzingOperationType::ZOOM_IN)}}, | |||
|
219 | }); | |||
94 |
|
220 | |||
95 | // /////// // |
|
221 | // /////// // | |
96 | // Methods // |
|
222 | // Methods // | |
@@ -193,9 +319,6 public: | |||||
193 |
|
319 | |||
194 | void execute() |
|
320 | void execute() | |
195 | { |
|
321 | { | |
196 | qCInfo(LOG_TestAmdaFuzzing()).noquote() << "Running" << nbMaxOperations() << "operations on" |
|
|||
197 | << nbMaxVariables() << "variable(s)..."; |
|
|||
198 |
|
||||
199 |
|
322 | |||
200 | // Inits the count of the number of operations before the next validation |
|
323 | // Inits the count of the number of operations before the next validation | |
201 | int nextValidationCounter = 0; |
|
324 | int nextValidationCounter = 0; | |
@@ -207,28 +330,52 public: | |||||
207 | }; |
|
330 | }; | |
208 | updateValidationCounter(); |
|
331 | updateValidationCounter(); | |
209 |
|
332 | |||
|
333 | // Get custom operations | |||
|
334 | auto customOperations = m_Properties.value(CUSTOM_OPERATIONS_PROPERTY).value<CustomVariablesOperations>(); | |||
|
335 | auto isCustomTest = !customOperations.empty(); | |||
|
336 | ||||
|
337 | auto nbOperations = isCustomTest ? customOperations.size() : nbMaxOperations(); | |||
|
338 | ||||
|
339 | qCInfo(LOG_TestAmdaFuzzing()).noquote() << "Running" << nbOperations << "operations on" | |||
|
340 | << nbMaxVariables() << "variable(s)..."; | |||
|
341 | ||||
210 | auto canExecute = true; |
|
342 | auto canExecute = true; | |
211 |
for (auto i = 0; i < nb |
|
343 | for (auto i = 0; i < nbOperations && canExecute; ++i) { | |
|
344 | VariableOperation variableOperation{}; | |||
|
345 | auto forceWait = false; | |||
|
346 | ||||
|
347 | if(isCustomTest){ | |||
|
348 | auto customOperation = customOperations.front(); | |||
|
349 | variableOperation = customOperation.m_VariableOperation; | |||
|
350 | customOperations.erase(customOperations.begin()); | |||
|
351 | ||||
|
352 | canExecute = variableOperation.second->canExecute(variableOperation.first, m_FuzzingState); | |||
|
353 | forceWait = customOperation.m_WaitAcquisition; | |||
|
354 | } else { | |||
212 | // Retrieves all operations that can be executed in the current context |
|
355 | // Retrieves all operations that can be executed in the current context | |
213 | VariablesOperations variableOperations{}; |
|
356 | VariablesOperations variableOperations{}; | |
214 | Weights weights{}; |
|
357 | Weights weights{}; | |
215 | std::tie(variableOperations, weights) |
|
358 | std::tie(variableOperations, weights) | |
216 | = availableOperations(m_FuzzingState, operationsPool()); |
|
359 | = availableOperations(m_FuzzingState, operationsPool()); | |
217 |
|
360 | |||
|
361 | // Of the operations available, chooses a random operation and executes it | |||
|
362 | variableOperation | |||
|
363 | = RandomGenerator::instance().randomChoice(variableOperations, weights); | |||
218 | canExecute = !variableOperations.empty(); |
|
364 | canExecute = !variableOperations.empty(); | |
|
365 | forceWait = operationsPool().at(variableOperation.second).m_WaitAcquisition; | |||
|
366 | } | |||
|
367 | ||||
219 | if (canExecute) { |
|
368 | if (canExecute) { | |
220 | --nextValidationCounter; |
|
369 | --nextValidationCounter; | |
221 |
|
370 | |||
222 | // Of the operations available, chooses a random operation and executes it |
|
|||
223 | auto variableOperation |
|
|||
224 | = RandomGenerator::instance().randomChoice(variableOperations, weights); |
|
|||
225 |
|
||||
226 | auto variableId = variableOperation.first; |
|
371 | auto variableId = variableOperation.first; | |
227 | auto fuzzingOperation = variableOperation.second; |
|
372 | auto fuzzingOperation = variableOperation.second; | |
228 |
|
373 | |||
229 | auto waitAcquisition = nextValidationCounter == 0 |
|
374 | auto waitAcquisition = nextValidationCounter == 0 | |
230 |
|| |
|
375 | || forceWait; | |
231 |
|
376 | |||
|
377 | qCInfo(LOG_TestAmdaFuzzing()).noquote() << "Operation :" << i +1 << " on" | |||
|
378 | << nbOperations; | |||
232 | fuzzingOperation->execute(variableId, m_FuzzingState, m_VariableController, |
|
379 | fuzzingOperation->execute(variableId, m_FuzzingState, m_VariableController, | |
233 | m_Properties); |
|
380 | m_Properties); | |
234 |
|
381 | |||
@@ -293,6 +440,7 private: | |||||
293 | } // namespace |
|
440 | } // namespace | |
294 |
|
441 | |||
295 | Q_DECLARE_METATYPE(OperationsTypes) |
|
442 | Q_DECLARE_METATYPE(OperationsTypes) | |
|
443 | Q_DECLARE_METATYPE(CustomVariablesOperations) | |||
296 |
|
444 | |||
297 | class TestAmdaFuzzing : public QObject { |
|
445 | class TestAmdaFuzzing : public QObject { | |
298 | Q_OBJECT |
|
446 | Q_OBJECT | |
@@ -306,7 +454,7 private slots: | |||||
306 | void TestAmdaFuzzing::testFuzzing_data() |
|
454 | void TestAmdaFuzzing::testFuzzing_data() | |
307 | { |
|
455 | { | |
308 | // Note: Comment this line to run fuzzing tests |
|
456 | // Note: Comment this line to run fuzzing tests | |
309 | QSKIP("Fuzzing tests are disabled by default"); |
|
457 | // QSKIP("Fuzzing tests are disabled by default"); | |
310 |
|
458 | |||
311 | // ////////////// // |
|
459 | // ////////////// // | |
312 | // Test structure // |
|
460 | // Test structure // | |
@@ -318,17 +466,34 void TestAmdaFuzzing::testFuzzing_data() | |||||
318 | // Test cases // |
|
466 | // Test cases // | |
319 | // ////////// // |
|
467 | // ////////// // | |
320 |
|
468 | |||
321 |
auto maxRange = SqpRange::fromDateTime({2017, 1, |
|
469 | auto maxRange = SqpRange::fromDateTime({2017, 1, 5}, {8, 0}, {2017, 1, 5}, {16, 0}); | |
322 |
MetadataPool metadataPool{{{"dataType", "vector"}, {"xml:id", " |
|
470 | MetadataPool metadataPool{{{"dataType", "vector"}, {"xml:id", "c1_b"}}}; | |
323 |
|
471 | |||
324 | // Note: we don't use auto here as we want to pass std::shared_ptr<IDataProvider> as is in the |
|
472 | // Note: we don't use auto here as we want to pass std::shared_ptr<IDataProvider> as is in the | |
325 | // QVariant |
|
473 | // QVariant | |
326 | std::shared_ptr<IDataProvider> provider = std::make_shared<AmdaProvider>(); |
|
474 | std::shared_ptr<IDataProvider> provider = std::make_shared<AmdaProvider>(); | |
327 |
|
475 | |||
|
476 | ||||
|
477 | // Case Custom one : Only lot of pan on two variables synchronized | |||
|
478 | // QTest::newRow("fuzzingTestPan") << Properties{ | |||
|
479 | // {MAX_RANGE_PROPERTY, QVariant::fromValue(maxRange)}, | |||
|
480 | // {METADATA_POOL_PROPERTY, QVariant::fromValue(metadataPool)}, | |||
|
481 | // {PROVIDER_PROPERTY, QVariant::fromValue(provider)}, | |||
|
482 | // {CUSTOM_OPERATIONS_PROPERTY, CUSTOM_CASE_ONE}}; | |||
|
483 | ||||
|
484 | // QTest::newRow("fuzzingTestZoom") << Properties{ | |||
|
485 | // {MAX_RANGE_PROPERTY, QVariant::fromValue(maxRange)}, | |||
|
486 | // {METADATA_POOL_PROPERTY, QVariant::fromValue(metadataPool)}, | |||
|
487 | // {PROVIDER_PROPERTY, QVariant::fromValue(provider)}, | |||
|
488 | // {CUSTOM_OPERATIONS_PROPERTY, CUSTOM_CASE_TWO}}; | |||
|
489 | ||||
|
490 | ||||
|
491 | //// Fuzzing | |||
328 | QTest::newRow("fuzzingTest") << Properties{ |
|
492 | QTest::newRow("fuzzingTest") << Properties{ | |
329 |
|
|
493 | {MAX_RANGE_PROPERTY, QVariant::fromValue(maxRange)}, | |
330 |
|
|
494 | {METADATA_POOL_PROPERTY, QVariant::fromValue(metadataPool)}, | |
331 |
|
|
495 | {PROVIDER_PROPERTY, QVariant::fromValue(provider)}}; | |
|
496 | ||||
332 | } |
|
497 | } | |
333 |
|
498 | |||
334 | void TestAmdaFuzzing::testFuzzing() |
|
499 | void TestAmdaFuzzing::testFuzzing() |
General Comments 0
You need to be logged in to leave comments.
Login now