@@ -38,14 +38,14 @@ func (suite *OcppV2TestSuite) TestGetCompositeScheduleConfirmationValidation() {
3838 ChargingSchedule : chargingSchedule ,
3939 }
4040 var confirmationTable = []GenericTestEntry {
41- {smartcharging.GetCompositeScheduleResponse {Status : smartcharging .GetCompositeScheduleStatusAccepted , EvseID : 1 , Schedule : & compositeSchedule }, true },
42- {smartcharging.GetCompositeScheduleResponse {Status : smartcharging .GetCompositeScheduleStatusAccepted , EvseID : 1 , Schedule : & smartcharging.CompositeSchedule {}}, true },
43- {smartcharging.GetCompositeScheduleResponse {Status : smartcharging .GetCompositeScheduleStatusAccepted , EvseID : 1 }, true },
41+ {smartcharging.GetCompositeScheduleResponse {Status : smartcharging .GetCompositeScheduleStatusAccepted , StatusInfo : types . NewStatusInfo ( "reasoncode" , "" ) , Schedule : & compositeSchedule }, true },
42+ {smartcharging.GetCompositeScheduleResponse {Status : smartcharging .GetCompositeScheduleStatusAccepted , StatusInfo : types . NewStatusInfo ( "reasoncode" , "" ) , Schedule : & smartcharging.CompositeSchedule {}}, true },
43+ {smartcharging.GetCompositeScheduleResponse {Status : smartcharging .GetCompositeScheduleStatusAccepted , StatusInfo : types . NewStatusInfo ( "reasoncode" , "" ) }, true },
4444 {smartcharging.GetCompositeScheduleResponse {Status : smartcharging .GetCompositeScheduleStatusAccepted }, true },
4545 {smartcharging.GetCompositeScheduleResponse {}, false },
4646 {smartcharging.GetCompositeScheduleResponse {Status : "invalidGetCompositeScheduleStatus" }, false },
47- {smartcharging.GetCompositeScheduleResponse {Status : smartcharging .GetCompositeScheduleStatusAccepted , EvseID : - 1 }, false },
48- {smartcharging.GetCompositeScheduleResponse {Status : smartcharging .GetCompositeScheduleStatusAccepted , EvseID : 1 , Schedule : & smartcharging.CompositeSchedule {StartDateTime : types .NewDateTime (time .Now ()), ChargingSchedule : types .NewChargingSchedule (1 , "invalidChargingRateUnit" )}}, false },
47+ {smartcharging.GetCompositeScheduleResponse {Status : smartcharging .GetCompositeScheduleStatusAccepted , StatusInfo : types . NewStatusInfo ( "invalidreasoncodeasitslongerthan20" , "" ) }, false },
48+ {smartcharging.GetCompositeScheduleResponse {Status : smartcharging .GetCompositeScheduleStatusAccepted , StatusInfo : types . NewStatusInfo ( "" , "" ) , Schedule : & smartcharging.CompositeSchedule {StartDateTime : types .NewDateTime (time .Now ()), ChargingSchedule : types .NewChargingSchedule (1 , "invalidChargingRateUnit" )}}, false },
4949 }
5050 ExecuteGenericTestTable (t , confirmationTable )
5151}
@@ -66,12 +66,13 @@ func (suite *OcppV2TestSuite) TestGetCompositeScheduleE2EMocked() {
6666 chargingSchedule .Duration = newInt (600 )
6767 chargingSchedule .StartSchedule = types .NewDateTime (time .Now ())
6868 chargingSchedule .MinChargingRate = newFloat (6.0 )
69+ statusInfo := types .NewStatusInfo ("reasonCode" , "" )
6970 compositeSchedule := smartcharging.CompositeSchedule {StartDateTime : scheduleStart , ChargingSchedule : chargingSchedule }
7071 requestJson := fmt .Sprintf (`[2,"%v","%v",{"duration":%v,"chargingRateUnit":"%v","evseId":%v}]` ,
7172 messageId , smartcharging .GetCompositeScheduleFeatureName , duration , chargingRateUnit , evseID )
72- responseJson := fmt .Sprintf (`[3,"%v",{"status":"%v","evseId":%v ,"schedule":{"startDateTime":"%v","chargingSchedule":{"id":%v,"startSchedule":"%v","duration":%v,"chargingRateUnit":"%v","minChargingRate":%v,"chargingSchedulePeriod":[{"startPeriod":%v,"limit":%v,"numberPhases":%v}]}}}]` ,
73- messageId , status , evseID , compositeSchedule .StartDateTime .FormatTimestamp (), chargingSchedule .ID , chargingSchedule .StartSchedule .FormatTimestamp (), * chargingSchedule .Duration , chargingSchedule .ChargingRateUnit , * chargingSchedule .MinChargingRate , chargingSchedulePeriod .StartPeriod , chargingSchedulePeriod .Limit , * chargingSchedulePeriod .NumberPhases )
74- getCompositeScheduleConfirmation := smartcharging .NewGetCompositeScheduleResponse (status , evseID )
73+ responseJson := fmt .Sprintf (`[3,"%v",{"status":"%v","statusInfo":{"reasonCode":"%v"} ,"schedule":{"startDateTime":"%v","chargingSchedule":{"id":%v,"startSchedule":"%v","duration":%v,"chargingRateUnit":"%v","minChargingRate":%v,"chargingSchedulePeriod":[{"startPeriod":%v,"limit":%v,"numberPhases":%v}]}}}]` ,
74+ messageId , status , statusInfo . ReasonCode , compositeSchedule .StartDateTime .FormatTimestamp (), chargingSchedule .ID , chargingSchedule .StartSchedule .FormatTimestamp (), * chargingSchedule .Duration , chargingSchedule .ChargingRateUnit , * chargingSchedule .MinChargingRate , chargingSchedulePeriod .StartPeriod , chargingSchedulePeriod .Limit , * chargingSchedulePeriod .NumberPhases )
75+ getCompositeScheduleConfirmation := smartcharging .NewGetCompositeScheduleResponse (status )
7576 getCompositeScheduleConfirmation .Schedule = & compositeSchedule
7677 channel := NewMockWebSocket (wsId )
7778
@@ -95,7 +96,7 @@ func (suite *OcppV2TestSuite) TestGetCompositeScheduleE2EMocked() {
9596 require .Nil (t , err )
9697 require .NotNil (t , confirmation )
9798 assert .Equal (t , status , confirmation .Status )
98- assert .Equal (t , evseID , confirmation .EvseID )
99+ assert .Equal (t , statusInfo . ReasonCode , confirmation .StatusInfo . ReasonCode )
99100 require .NotNil (t , confirmation .Schedule )
100101 require .NotNil (t , confirmation .Schedule .StartDateTime )
101102 assert .Equal (t , compositeSchedule .StartDateTime .FormatTimestamp (), confirmation .Schedule .StartDateTime .FormatTimestamp ())
0 commit comments