@@ -207,36 +207,53 @@ TEST_CASE( "Reservation" ) {
207207
208208 // if connector 0 is reserved, accept at most one further reservation
209209 REQUIRE ( rService->updateReservation (1000 , 0 , expiryDate, idTag, parentIdTag) );
210- REQUIRE ( rService->updateReservation (1001 , 1 , expiryDate, idTag, parentIdTag) );
211- REQUIRE ( !rService->updateReservation (1002 , 2 , expiryDate, idTag, parentIdTag) );
212- REQUIRE ( model.getConnector (2 )->getStatus () == ChargePointStatus_Available );
210+ // first available connector reserved by connector 0 reservation
211+ REQUIRE ( !rService->updateReservation (1001 , 1 , expiryDate, idTag, parentIdTag) );
212+ REQUIRE ( rService->updateReservation (1002 , 2 , expiryDate, idTag, parentIdTag) );
213+
214+ loop ();
215+ REQUIRE ( model.getConnector (1 )->getStatus () == ChargePointStatus_Reserved );
216+ REQUIRE ( model.getConnector (2 )->getStatus () == ChargePointStatus_Reserved );
213217
214218 // reset reservations
215219 rService->getReservationById (1000 )->clear ();
216- rService->getReservationById (1001 )->clear ();
220+ rService->getReservationById (1002 )->clear ();
217221 REQUIRE ( model.getConnector (1 )->getStatus () == ChargePointStatus_Available );
222+ REQUIRE ( model.getConnector (2 )->getStatus () == ChargePointStatus_Available );
218223
219224 // if connector 0 is reserved, ensure that at least one physical connector remains available for the idTag of the reservation
220225 REQUIRE ( rService->updateReservation (1000 , 0 , expiryDate, idTag, parentIdTag) );
221226
222- beginTransaction (" other idTag" , 1 );
227+ beginTransaction (" other idTag" , 2 );
228+ loop ();
229+ REQUIRE ( model.getConnector (2 )->getStatus () == ChargePointStatus_Charging );
230+
231+ endTransaction (nullptr , nullptr , 2 );
223232 loop ();
224- REQUIRE ( model.getConnector (1 )->getStatus () == ChargePointStatus_Charging );
233+
234+ REQUIRE ( model.getConnector (2 )->getStatus () == ChargePointStatus_Available );
235+ model.getConnector (2 )->setAvailabilityVolatile (false );
236+ REQUIRE ( model.getConnector (2 )->getStatus () == ChargePointStatus_Unavailable );
225237
226238 bool checkTxRejected = false ;
227239 setTxNotificationOutput ([&checkTxRejected] (Transaction*, TxNotification txNotification) {
228240 if (txNotification == TxNotification_ReservationConflict) {
229241 checkTxRejected = true ;
230242 }
231- }, 2 );
243+ }, 1 );
232244
233- beginTransaction (" other idTag 2" , 2 );
245+ beginTransaction (" other idTag 2" , 1 );
234246 loop ();
235247 REQUIRE ( checkTxRejected );
236- REQUIRE ( model.getConnector (2 )->getStatus () == ChargePointStatus_Available );
248+ REQUIRE ( model.getConnector (1 )->getStatus () == ChargePointStatus_Reserved );
249+
250+ beginTransaction (" mIdTag" , 1 );
251+ loop ();
237252
253+ REQUIRE ( model.getConnector (1 )->getStatus () == ChargePointStatus_Charging );
238254
239255 endTransaction (nullptr , nullptr , 1 );
256+ model.getConnector (2 )->setAvailabilityVolatile (true );
240257 loop ();
241258 }
242259
0 commit comments