From 4187f49f406d03235fe04d23ba613b5c42a3ed9f Mon Sep 17 00:00:00 2001 From: Damien Date: Mon, 26 May 2025 14:09:40 +1100 Subject: [PATCH 1/3] Overall upgrade - go 1.24 - mockery as go tool (and used with `go generate`), updates to its latest v2 version (v3 requires migration) - latest version of libraries - latest version of testing docker images - gofmt --- docker-compose.test.yaml | 8 +- go.mod | 59 +++++-- go.sum | 145 ++++++++++++++---- ocpp1.6/certificates/delete_certificate.go | 2 +- .../get_installed_certificates.go | 2 +- ocpp1.6/certificates/install_certificate.go | 2 +- ocpp1.6/core/boot_notification.go | 5 +- ocpp1.6/core/change_availability.go | 5 +- ocpp1.6/core/change_configuration.go | 5 +- ocpp1.6/core/clear_cache.go | 5 +- ocpp1.6/core/data_transfer.go | 5 +- ocpp1.6/core/heartbeat.go | 5 +- ocpp1.6/core/reset.go | 2 +- ocpp1.6/core/status_notification.go | 5 +- ocpp1.6/core/stop_transaction.go | 2 +- ocpp1.6/core/unlock_connector.go | 5 +- .../extended_trigger_message.go | 2 +- .../diagnostics_status_notification.go | 5 +- .../firmware/firmware_status_notification.go | 5 +- ocpp1.6/localauth/send_local_list.go | 5 +- ocpp1.6/logging/get_log.go | 2 +- ocpp1.6/logging/log_status_notification.go | 2 +- ocpp1.6/remotetrigger/trigger_message.go | 2 +- ocpp1.6/reservation/cancel_reservation.go | 5 +- ocpp1.6/reservation/reserve_now.go | 5 +- .../securefirmware/signed_update_firmware.go | 2 +- ...ed_update_firmware_status_notitfication.go | 2 +- ocpp1.6/security/certificate_signed.go | 2 +- .../smartcharging/clear_charging_profile.go | 2 +- .../smartcharging/get_composite_schedule.go | 2 +- ocpp1.6/smartcharging/set_charging_profile.go | 2 +- ocpp1.6/types/security_extension.go | 2 +- ocpp1.6/types/types.go | 2 +- .../mock_certificates_charge_point_handler.go | 2 +- .../mocks/mock_core_central_system_handler.go | 2 +- .../mocks/mock_core_charge_point_handler.go | 2 +- ...ed_trigger_message_charge_point_handler.go | 2 +- .../mock_firmware_central_system_handler.go | 2 +- .../mock_firmware_charge_point_handler.go | 2 +- ..._local_auth_list_central_system_handler.go | 2 +- ...ck_local_auth_list_charge_point_handler.go | 2 +- .../mock_logging_central_system_handler.go | 2 +- .../mock_logging_charge_point_handler.go | 2 +- ocpp1.6_test/mocks/mock_ocpp16.go | 2 +- ...k_remote_trigger_central_system_handler.go | 2 +- ...ock_remote_trigger_charge_point_handler.go | 2 +- ...mock_reservation_central_system_handler.go | 2 +- .../mock_reservation_charge_point_handler.go | 2 +- ...ck_secure_firmware_CentralSystemHandler.go | 2 +- ...mock_secure_firmware_ChargePointHandler.go | 2 +- .../mock_security_central_system_handler.go | 2 +- .../mock_security_charge_point_handler.go | 2 +- ...k_smart_charging_central_system_handler.go | 2 +- ...ock_smart_charging_charge_point_handler.go | 2 +- ocpp2.0.1/authorization/authorize.go | 2 +- ocpp2.0.1/authorization/clear_cache.go | 2 +- ocpp2.0.1/availability/change_availability.go | 2 +- ocpp2.0.1/availability/heartbeat.go | 2 +- ocpp2.0.1/availability/status_notification.go | 2 +- ocpp2.0.1/data/data_transfer.go | 2 +- .../diagnostics/clear_variable_monitoring.go | 2 +- ocpp2.0.1/diagnostics/customer_information.go | 2 +- ocpp2.0.1/diagnostics/get_log.go | 2 +- .../diagnostics/get_monitoring_report.go | 2 +- .../diagnostics/log_status_notification.go | 2 +- ocpp2.0.1/diagnostics/notify_event.go | 2 +- ocpp2.0.1/diagnostics/set_monitoring_base.go | 2 +- .../diagnostics/set_variable_monitoring.go | 2 +- ocpp2.0.1/diagnostics/types.go | 2 +- ocpp2.0.1/display/clear_display_message.go | 2 +- ocpp2.0.1/display/set_display_message.go | 2 +- ocpp2.0.1/display/types.go | 2 +- .../firmware/firmware_status_notification.go | 2 +- .../publish_firmware_status_notification.go | 2 +- ocpp2.0.1/firmware/unpublish_firmware.go | 2 +- ocpp2.0.1/firmware/update_firmware.go | 2 +- ocpp2.0.1/iso15118/delete_certificate.go | 2 +- ocpp2.0.1/iso15118/get_15118ev_certificate.go | 2 +- .../iso15118/get_installed_certificate_ids.go | 2 +- ocpp2.0.1/iso15118/install_certificate.go | 2 +- ocpp2.0.1/localauth/send_local_list.go | 2 +- ocpp2.0.1/provisioning/boot_notification.go | 2 +- ocpp2.0.1/provisioning/get_base_report.go | 2 +- ocpp2.0.1/provisioning/get_report.go | 2 +- ocpp2.0.1/provisioning/get_variables.go | 2 +- ocpp2.0.1/provisioning/notify_report.go | 2 +- ocpp2.0.1/provisioning/reset.go | 2 +- ocpp2.0.1/provisioning/set_network_profile.go | 2 +- ocpp2.0.1/provisioning/set_variables.go | 2 +- .../request_start_transaction.go | 2 +- ocpp2.0.1/remotecontrol/trigger_message.go | 2 +- ocpp2.0.1/remotecontrol/unlock_connector.go | 2 +- ocpp2.0.1/reservation/cancel_reservation.go | 2 +- .../reservation/reservation_status_update.go | 2 +- ocpp2.0.1/reservation/reserve_now.go | 2 +- ocpp2.0.1/security/certificate_signed.go | 2 +- .../smartcharging/clear_charging_profile.go | 2 +- .../smartcharging/get_charging_profiles.go | 2 +- .../smartcharging/get_composite_schedule.go | 2 +- .../smartcharging/notify_ev_charging_needs.go | 2 +- .../smartcharging/set_charging_profile.go | 2 +- ocpp2.0.1/transactions/transaction_event.go | 2 +- ocpp2.0.1/types/types.go | 2 +- ocppj/client.go | 2 +- ocppj/dispatcher_test.go | 6 +- ocppj/mocks/mock_CanceledRequestHandler.go | 2 +- ocppj/mocks/mock_ClientDispatcher.go | 2 +- ocppj/mocks/mock_ClientHandler.go | 2 +- ocppj/mocks/mock_ClientState.go | 2 +- ocppj/mocks/mock_ErrorHandler.go | 2 +- ocppj/mocks/mock_InvalidMessageHook.go | 2 +- ocppj/mocks/mock_Message.go | 2 +- ocppj/mocks/mock_RequestHandler.go | 2 +- ocppj/mocks/mock_RequestQueue.go | 2 +- ocppj/mocks/mock_ResponseHandler.go | 2 +- ocppj/mocks/mock_ServerDispatcher.go | 2 +- ocppj/mocks/mock_ServerQueueMap.go | 2 +- ocppj/mocks/mock_ServerState.go | 2 +- ocppj/mocks/mock_dialector.go | 2 +- ocppj/ocppj.go | 2 +- ocppj/ocppj_test.go | 2 +- ocppj/server.go | 2 +- ws/mocks/mock_Channel.go | 2 +- ws/mocks/mock_CheckClientHandler.go | 2 +- ws/mocks/mock_Client.go | 2 +- ws/mocks/mock_ClientOpt.go | 2 +- ws/mocks/mock_ConnectedHandler.go | 2 +- ws/mocks/mock_DisconnectedHandler.go | 2 +- ws/mocks/mock_ErrorHandler.go | 2 +- ws/mocks/mock_MessageHandler.go | 2 +- ws/mocks/mock_Server.go | 2 +- ws/mocks/mock_ServerOpt.go | 2 +- 132 files changed, 321 insertions(+), 192 deletions(-) diff --git a/docker-compose.test.yaml b/docker-compose.test.yaml index 7c220bbd..41008379 100644 --- a/docker-compose.test.yaml +++ b/docker-compose.test.yaml @@ -1,14 +1,14 @@ version: "3.9" services: toxiproxy: - image: ghcr.io/shopify/toxiproxy:2.11.0 + image: ghcr.io/shopify/toxiproxy:2.12.0 hostname: toxiproxy unit_test: # The tests might require permissions to write to coverage out files. # If you encounter issues with permissions, you can try running the container as root. user: root - image: cimg/go:1.22.5 + image: cimg/go:1.24.3 working_dir: /etc/ocpp-go volumes: - .:/etc/ocpp-go:rw @@ -23,7 +23,7 @@ services: sed '1d;$d' ocpp201.out >> coverage.out integration_test: - image: cimg/go:1.22.5 + image: cimg/go:1.24.3 # The tests might require permissions to write to coverage out files. # If you encounter issues with permissions, you can try running the container as root. user: root @@ -40,4 +40,4 @@ services: - -c - go test ./ws -v -covermode=count -coverprofile=integration_coverage.out volumes: - - .:/etc/ocpp-go:rw \ No newline at end of file + - .:/etc/ocpp-go:rw diff --git a/go.mod b/go.mod index e09ef029..6ca82fd2 100644 --- a/go.mod +++ b/go.mod @@ -1,21 +1,58 @@ module github.com/lorenzodonini/ocpp-go -go 1.16 +go 1.24 require ( github.com/Shopify/toxiproxy v2.1.4+incompatible github.com/caarlos0/env/v11 v11.3.1 - github.com/go-playground/locales v0.12.1 // indirect - github.com/go-playground/universal-translator v0.16.0 + github.com/go-playground/universal-translator v0.18.1 + github.com/go-playground/validator/v10 v10.26.0 github.com/gorilla/mux v1.8.1 github.com/gorilla/websocket v1.5.3 - github.com/kr/pretty v0.1.0 // indirect - github.com/leodido/go-urn v1.1.0 // indirect github.com/relvacode/iso8601 v1.6.0 - github.com/sirupsen/logrus v1.4.2 - github.com/stretchr/testify v1.8.0 - golang.org/x/sys v0.0.0-20220804214406-8e32c043e418 // indirect - gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15 // indirect - gopkg.in/go-playground/assert.v1 v1.2.1 // indirect - gopkg.in/go-playground/validator.v9 v9.30.0 + github.com/sirupsen/logrus v1.9.3 + github.com/stretchr/testify v1.10.0 ) + +require ( + github.com/chigopher/pathlib v0.19.1 // indirect + github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect + github.com/fsnotify/fsnotify v1.9.0 // indirect + github.com/gabriel-vasile/mimetype v1.4.9 // indirect + github.com/go-playground/locales v0.14.1 // indirect + github.com/go-viper/mapstructure/v2 v2.2.1 // indirect + github.com/huandu/xstrings v1.5.0 // indirect + github.com/iancoleman/strcase v0.3.0 // indirect + github.com/inconshreveable/mousetrap v1.1.0 // indirect + github.com/jinzhu/copier v0.4.0 // indirect + github.com/leodido/go-urn v1.4.0 // indirect + github.com/mattn/go-colorable v0.1.14 // indirect + github.com/mattn/go-isatty v0.0.20 // indirect + github.com/mitchellh/go-homedir v1.1.0 // indirect + github.com/mitchellh/mapstructure v1.5.0 // indirect + github.com/pelletier/go-toml/v2 v2.2.4 // indirect + github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect + github.com/rs/zerolog v1.34.0 // indirect + github.com/sagikazarmark/locafero v0.9.0 // indirect + github.com/sourcegraph/conc v0.3.0 // indirect + github.com/spf13/afero v1.14.0 // indirect + github.com/spf13/cast v1.8.0 // indirect + github.com/spf13/cobra v1.9.1 // indirect + github.com/spf13/pflag v1.0.6 // indirect + github.com/spf13/viper v1.20.1 // indirect + github.com/stretchr/objx v0.5.2 // indirect + github.com/subosito/gotenv v1.6.0 // indirect + github.com/vektra/mockery/v2 v2.53.4 // indirect + go.uber.org/multierr v1.11.0 // indirect + golang.org/x/crypto v0.38.0 // indirect + golang.org/x/mod v0.24.0 // indirect + golang.org/x/net v0.40.0 // indirect + golang.org/x/sync v0.14.0 // indirect + golang.org/x/sys v0.33.0 // indirect + golang.org/x/term v0.32.0 // indirect + golang.org/x/text v0.25.0 // indirect + golang.org/x/tools v0.33.0 // indirect + gopkg.in/yaml.v3 v3.0.1 // indirect +) + +tool github.com/vektra/mockery/v2 diff --git a/go.sum b/go.sum index 526046d2..3d3bff6e 100644 --- a/go.sum +++ b/go.sum @@ -2,50 +2,129 @@ github.com/Shopify/toxiproxy v2.1.4+incompatible h1:TKdv8HiTLgE5wdJuEML90aBgNWso github.com/Shopify/toxiproxy v2.1.4+incompatible/go.mod h1:OXgGpZ6Cli1/URJOF1DMxUHB2q5Ap20/P/eIdh4G0pI= github.com/caarlos0/env/v11 v11.3.1 h1:cArPWC15hWmEt+gWk7YBi7lEXTXCvpaSdCiZE2X5mCA= github.com/caarlos0/env/v11 v11.3.1/go.mod h1:qupehSf/Y0TUTsxKywqRt/vJjN5nz6vauiYEUUr8P4U= +github.com/chigopher/pathlib v0.19.1 h1:RoLlUJc0CqBGwq239cilyhxPNLXTK+HXoASGyGznx5A= +github.com/chigopher/pathlib v0.19.1/go.mod h1:tzC1dZLW8o33UQpWkNkhvPwL5n4yyFRFm/jL1YGWFvY= +github.com/coreos/go-systemd/v22 v22.5.0/go.mod h1:Y58oyj3AT4RCenI/lSvhwexgC+NSVTIJ3seZv2GcEnc= +github.com/cpuguy83/go-md2man/v2 v2.0.6/go.mod h1:oOW0eioCTA6cOiMLiUPZOpcVxMig6NIQQ7OS05n1F4g= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/go-playground/locales v0.12.1 h1:2FITxuFt/xuCNP1Acdhv62OzaCiviiE4kotfhkmOqEc= -github.com/go-playground/locales v0.12.1/go.mod h1:IUMDtCfWo/w/mtMfIE/IG2K+Ey3ygWanZIBtBW0W2TM= -github.com/go-playground/universal-translator v0.16.0 h1:X++omBR/4cE2MNg91AoC3rmGrCjJ8eAeUP/K/EKx4DM= -github.com/go-playground/universal-translator v0.16.0/go.mod h1:1AnU7NaIRDWWzGEKwgtJRd2xk99HeFyHw3yid4rvQIY= +github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM= +github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/frankban/quicktest v1.14.6 h1:7Xjx+VpznH+oBnejlPUj8oUpdxnVs4f8XU8WnHkI4W8= +github.com/frankban/quicktest v1.14.6/go.mod h1:4ptaffx2x8+WTWXmUCuVU6aPUX1/Mz7zb5vbUoiM6w0= +github.com/fsnotify/fsnotify v1.9.0 h1:2Ml+OJNzbYCTzsxtv8vKSFD9PbJjmhYF14k/jKC7S9k= +github.com/fsnotify/fsnotify v1.9.0/go.mod h1:8jBTzvmWwFyi3Pb8djgCCO5IBqzKJ/Jwo8TRcHyHii0= +github.com/gabriel-vasile/mimetype v1.4.9 h1:5k+WDwEsD9eTLL8Tz3L0VnmVh9QxGjRmjBvAG7U/oYY= +github.com/gabriel-vasile/mimetype v1.4.9/go.mod h1:WnSQhFKJuBlRyLiKohA/2DtIlPFAbguNaG7QCHcyGok= +github.com/go-playground/assert/v2 v2.2.0 h1:JvknZsQTYeFEAhQwI4qEt9cyV5ONwRHC+lYKSsYSR8s= +github.com/go-playground/assert/v2 v2.2.0/go.mod h1:VDjEfimB/XKnb+ZQfWdccd7VUvScMdVu0Titje2rxJ4= +github.com/go-playground/locales v0.14.1 h1:EWaQ/wswjilfKLTECiXz7Rh+3BjFhfDFKv/oXslEjJA= +github.com/go-playground/locales v0.14.1/go.mod h1:hxrqLVvrK65+Rwrd5Fc6F2O76J/NuW9t0sjnWqG1slY= +github.com/go-playground/universal-translator v0.18.1 h1:Bcnm0ZwsGyWbCzImXv+pAJnYK9S473LQFuzCbDbfSFY= +github.com/go-playground/universal-translator v0.18.1/go.mod h1:xekY+UJKNuX9WP91TpwSH2VMlDf28Uj24BCp08ZFTUY= +github.com/go-playground/validator/v10 v10.26.0 h1:SP05Nqhjcvz81uJaRfEV0YBSSSGMc/iMaVtFbr3Sw2k= +github.com/go-playground/validator/v10 v10.26.0/go.mod h1:I5QpIEbmr8On7W0TktmJAumgzX4CA1XNl4ZmDuVHKKo= +github.com/go-viper/mapstructure/v2 v2.2.1 h1:ZAaOCxANMuZx5RCeg0mBdEZk7DZasvvZIxtHqx8aGss= +github.com/go-viper/mapstructure/v2 v2.2.1/go.mod h1:oJDH3BJKyqBA2TXFhDsKDGDTlndYOZ6rGS0BRZIxGhM= +github.com/godbus/dbus/v5 v5.0.4/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA= +github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= +github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= github.com/gorilla/mux v1.8.1 h1:TuBL49tXwgrFYWhqrNgrUNEY92u81SPhu7sTdzQEiWY= github.com/gorilla/mux v1.8.1/go.mod h1:AKf9I4AEqPTmMytcMc0KkNouC66V3BtZ4qD5fmWSiMQ= github.com/gorilla/websocket v1.5.3 h1:saDtZ6Pbx/0u+bgYQ3q96pZgCzfhKXGPqt7kZ72aNNg= github.com/gorilla/websocket v1.5.3/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= -github.com/konsorten/go-windows-terminal-sequences v1.0.1 h1:mweAR1A6xJ3oS2pRaGiHgQ4OO8tzTaLawm8vnODuwDk= -github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= -github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI= -github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= -github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= -github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE= -github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= -github.com/leodido/go-urn v1.1.0 h1:Sm1gr51B1kKyfD2BlRcLSiEkffoG96g6TPv6eRoEiB8= -github.com/leodido/go-urn v1.1.0/go.mod h1:+cyI34gQWZcE1eQU7NVgKkkzdXDQHr1dBMtdAPozLkw= -github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= +github.com/huandu/xstrings v1.5.0 h1:2ag3IFq9ZDANvthTwTiqSSZLjDc+BedvHPAp5tJy2TI= +github.com/huandu/xstrings v1.5.0/go.mod h1:y5/lhBue+AyNmUVz9RLU9xbLR0o4KIIExikq4ovT0aE= +github.com/iancoleman/strcase v0.3.0 h1:nTXanmYxhfFAMjZL34Ov6gkzEsSJZ5DbhxWjvSASxEI= +github.com/iancoleman/strcase v0.3.0/go.mod h1:iwCmte+B7n89clKwxIoIXy/HfoL7AsD47ZCWhYzw7ho= +github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2s0bqwp9tc8= +github.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw= +github.com/jinzhu/copier v0.4.0 h1:w3ciUoD19shMCRargcpm0cm91ytaBhDvuRpz1ODO/U8= +github.com/jinzhu/copier v0.4.0/go.mod h1:DfbEm0FYsaqBcKcFuvmOZb218JkPGtvSHsKg8S8hyyg= +github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= +github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk= +github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= +github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= +github.com/leodido/go-urn v1.4.0 h1:WT9HwE9SGECu3lg4d/dIA+jxlljEa1/ffXKmRjqdmIQ= +github.com/leodido/go-urn v1.4.0/go.mod h1:bvxc+MVxLKB4z00jd1z+Dvzr47oO32F/QSNjSBOlFxI= +github.com/mattn/go-colorable v0.1.13/go.mod h1:7S9/ev0klgBDR4GtXTXX8a3vIGJpMovkB8vQcUbaXHg= +github.com/mattn/go-colorable v0.1.14 h1:9A9LHSqF/7dyVVX6g0U9cwm9pG3kP9gSzcuIPHPsaIE= +github.com/mattn/go-colorable v0.1.14/go.mod h1:6LmQG8QLFO4G5z1gPvYEzlUgJ2wF+stgPZH1UqBm1s8= +github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM= +github.com/mattn/go-isatty v0.0.19/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y= +github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY= +github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y= +github.com/mitchellh/go-homedir v1.1.0 h1:lukF9ziXFxDFPkA1vsr5zpc1XuPDn/wFntq5mG+4E0Y= +github.com/mitchellh/go-homedir v1.1.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0= +github.com/mitchellh/mapstructure v1.5.0 h1:jeMsZIYE/09sWLaz43PL7Gy6RuMjD2eJVyuac5Z2hdY= +github.com/mitchellh/mapstructure v1.5.0/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= +github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e h1:fD57ERR4JtEqsWbfPhv4DMiApHyliiK5xCTNVSPiaAs= +github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno= +github.com/pelletier/go-toml/v2 v2.2.4 h1:mye9XuhQ6gvn5h28+VilKrrPoQVanw5PMw/TB0t5Ec4= +github.com/pelletier/go-toml/v2 v2.2.4/go.mod h1:2gIqNv+qfxSVS7cM2xJQKtLSTLUE9V8t9Stt+h56mCY= +github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U= +github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/relvacode/iso8601 v1.6.0 h1:eFXUhMJN3Gz8Rcq82f9DTMW0svjtAVuIEULglM7QHTU= github.com/relvacode/iso8601 v1.6.0/go.mod h1:FlNp+jz+TXpyRqgmM7tnzHHzBnz776kmAH2h3sZCn0I= -github.com/sirupsen/logrus v1.4.2 h1:SPIRibHv4MatM3XXNO2BJeFLZwZ2LvZgfQ5+UNI2im4= -github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE= +github.com/rogpeppe/go-internal v1.9.0 h1:73kH8U+JUqXU8lRuOHeVHaa/SZPifC7BkcraZVejAe8= +github.com/rogpeppe/go-internal v1.9.0/go.mod h1:WtVeX8xhTBvf0smdhujwtBcq4Qrzq/fJaraNFVN+nFs= +github.com/rs/xid v1.6.0/go.mod h1:7XoLgs4eV+QndskICGsho+ADou8ySMSjJKDIan90Nz0= +github.com/rs/zerolog v1.34.0 h1:k43nTLIwcTVQAncfCw4KZ2VY6ukYoZaBPNOE8txlOeY= +github.com/rs/zerolog v1.34.0/go.mod h1:bJsvje4Z08ROH4Nhs5iH600c3IkWhwp44iRc54W6wYQ= +github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= +github.com/sagikazarmark/locafero v0.9.0 h1:GbgQGNtTrEmddYDSAH9QLRyfAHY12md+8YFTqyMTC9k= +github.com/sagikazarmark/locafero v0.9.0/go.mod h1:UBUyz37V+EdMS3hDF3QWIiVr/2dPrx49OMO0Bn0hJqk= +github.com/sirupsen/logrus v1.9.3 h1:dueUQJ1C2q9oE3F7wvmSGAaVtTmUizReu6fjN8uqzbQ= +github.com/sirupsen/logrus v1.9.3/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ= +github.com/sourcegraph/conc v0.3.0 h1:OQTbbt6P72L20UqAkXXuLOj79LfEanQ+YQFNpLA9ySo= +github.com/sourcegraph/conc v0.3.0/go.mod h1:Sdozi7LEKbFPqYX2/J+iBAM6HpqSLTASQIKqDmF7Mt0= +github.com/spf13/afero v1.14.0 h1:9tH6MapGnn/j0eb0yIXiLjERO8RB6xIVZRDCX7PtqWA= +github.com/spf13/afero v1.14.0/go.mod h1:acJQ8t0ohCGuMN3O+Pv0V0hgMxNYDlvdk+VTfyZmbYo= +github.com/spf13/cast v1.8.0 h1:gEN9K4b8Xws4EX0+a0reLmhq8moKn7ntRlQYgjPeCDk= +github.com/spf13/cast v1.8.0/go.mod h1:ancEpBxwJDODSW/UG4rDrAqiKolqNNh2DX3mk86cAdo= +github.com/spf13/cobra v1.9.1 h1:CXSaggrXdbHK9CF+8ywj8Amf7PBRmPCOJugH954Nnlo= +github.com/spf13/cobra v1.9.1/go.mod h1:nDyEzZ8ogv936Cinf6g1RU9MRY64Ir93oCnqb9wxYW0= +github.com/spf13/pflag v1.0.6 h1:jFzHGLGAlb3ruxLB8MhbI6A8+AQX/2eW4qeyNZXNp2o= +github.com/spf13/pflag v1.0.6/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= +github.com/spf13/viper v1.20.1 h1:ZMi+z/lvLyPSCoNtFCpqjy0S4kPbirhpTMwl8BkW9X4= +github.com/spf13/viper v1.20.1/go.mod h1:P9Mdzt1zoHIG8m2eZQinpiBjo6kCmZSKBClNNqjJvu4= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/objx v0.4.0 h1:M2gUjqZET1qApGOWNSnZ49BAIMX4F/1plDv3+l31EJ4= -github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= -github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= -github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -github.com/stretchr/testify v1.8.0 h1:pSgiaMZlXftHpm5L7V1+rVB+AZJydKsMxsQBIJw4PKk= -github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= -golang.org/x/sys v0.0.0-20190422165155-953cdadca894/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20220804214406-8e32c043e418 h1:9vYwv7OjYaky/tlAeD7C4oC9EsPTlaFl1H2jS++V+ME= -golang.org/x/sys v0.0.0-20220804214406-8e32c043e418/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +github.com/stretchr/objx v0.5.2 h1:xuMeJ0Sdp5ZMRXx/aWO6RZxdr3beISkG5/G/aIRr3pY= +github.com/stretchr/objx v0.5.2/go.mod h1:FRsXN1f5AsAjCGJKqEizvkpNtU+EGNCLh3NxZ/8L+MA= +github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +github.com/stretchr/testify v1.10.0 h1:Xv5erBjTwe/5IxqUQTdXv5kgmIvbHo3QQyRwhJsOfJA= +github.com/stretchr/testify v1.10.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= +github.com/subosito/gotenv v1.6.0 h1:9NlTDc1FTs4qu0DDq7AEtTPNw6SVm7uBMsUCUjABIf8= +github.com/subosito/gotenv v1.6.0/go.mod h1:Dk4QP5c2W3ibzajGcXpNraDfq2IrhjMIvMSWPKKo0FU= +github.com/vektra/mockery/v2 v2.53.4 h1:abBWJLUQppM7T/VsLasBwgl7XXQRWH6lC3bnbJpOCLk= +github.com/vektra/mockery/v2 v2.53.4/go.mod h1:hIFFb3CvzPdDJJiU7J4zLRblUMv7OuezWsHPmswriwo= +go.uber.org/multierr v1.11.0 h1:blXXJkSxSSfBVBlC76pxqeO+LN3aDfLQo+309xJstO0= +go.uber.org/multierr v1.11.0/go.mod h1:20+QtiLqy0Nd6FdQB9TLXag12DsQkrbs3htMFfDN80Y= +golang.org/x/crypto v0.38.0 h1:jt+WWG8IZlBnVbomuhg2Mdq0+BBQaHbtqHEFEigjUV8= +golang.org/x/crypto v0.38.0/go.mod h1:MvrbAqul58NNYPKnOra203SB9vpuZW0e+RRZV+Ggqjw= +golang.org/x/mod v0.24.0 h1:ZfthKaKaT4NrhGVZHO1/WDTwGES4De8KtWO0SIbNJMU= +golang.org/x/mod v0.24.0/go.mod h1:IXM97Txy2VM4PJ3gI61r1YEk/gAj6zAHN3AdZt6S9Ww= +golang.org/x/net v0.40.0 h1:79Xs7wF06Gbdcg4kdCCIQArK11Z1hr5POQ6+fIYHNuY= +golang.org/x/net v0.40.0/go.mod h1:y0hY0exeL2Pku80/zKK7tpntoX23cqL3Oa6njdgRtds= +golang.org/x/sync v0.14.0 h1:woo0S4Yywslg6hp4eUFjTVOyKt0RookbpAHG4c1HmhQ= +golang.org/x/sync v0.14.0/go.mod h1:1dzgHSNfp02xaA81J2MS99Qcpr2w7fw1gpm99rleRqA= +golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.12.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.33.0 h1:q3i8TbbEz+JRD9ywIRlyRAQbM0qF7hu24q3teo2hbuw= +golang.org/x/sys v0.33.0/go.mod h1:BJP2sWEmIv4KK5OTEluFJCKSidICx8ciO85XgH3Ak8k= +golang.org/x/term v0.32.0 h1:DR4lr0TjUs3epypdhTOkMmuF5CDFJ/8pOnbzMZPQ7bg= +golang.org/x/term v0.32.0/go.mod h1:uZG1FhGx848Sqfsq4/DlJr3xGGsYMu/L5GW4abiaEPQ= +golang.org/x/text v0.25.0 h1:qVyWApTSYLk/drJRO5mDlNYskwQznZmkpV2c8q9zls4= +golang.org/x/text v0.25.0/go.mod h1:WEdwpYrmk1qmdHvhkSTNPm3app7v4rsT8F2UD6+VHIA= +golang.org/x/tools v0.33.0 h1:4qz2S3zmRxbGIhDIAgjxvFutSvH5EfnsYrRBj0UI0bc= +golang.org/x/tools v0.33.0/go.mod h1:CIJMaWEY88juyUfo7UbgPqbC8rU2OqfAV1h2Qp0oMYI= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15 h1:YR8cESwS4TdDjEe65xsg0ogRM/Nc3DYOhEAlW+xobZo= -gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/go-playground/assert.v1 v1.2.1 h1:xoYuJVE7KT85PYWrN730RguIQO0ePzVRfFMXadIrXTM= -gopkg.in/go-playground/assert.v1 v1.2.1/go.mod h1:9RXL0bg/zibRAgZUYszZSwO/z8Y/a8bDuhia5mkpMnE= -gopkg.in/go-playground/validator.v9 v9.30.0 h1:Wk0Z37oBmKj9/n+tPyBHZmeL19LaCoK3Qq48VwYENss= -gopkg.in/go-playground/validator.v9 v9.30.0/go.mod h1:+c9/zcJMFNgbLvly1L1V+PpxWdVbfP1avr/N00E2vyQ= +gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f h1:BLraFXnmrev5lT+xlilqcH8XK9/i0At2xKjWk4p6zsU= +gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/ocpp1.6/certificates/delete_certificate.go b/ocpp1.6/certificates/delete_certificate.go index 25f6c5c8..3bc9cb5c 100644 --- a/ocpp1.6/certificates/delete_certificate.go +++ b/ocpp1.6/certificates/delete_certificate.go @@ -3,7 +3,7 @@ package certificates import ( "reflect" - "gopkg.in/go-playground/validator.v9" + "github.com/go-playground/validator/v10" "github.com/lorenzodonini/ocpp-go/ocpp1.6/types" ) diff --git a/ocpp1.6/certificates/get_installed_certificates.go b/ocpp1.6/certificates/get_installed_certificates.go index fd494a2f..fa68be4a 100644 --- a/ocpp1.6/certificates/get_installed_certificates.go +++ b/ocpp1.6/certificates/get_installed_certificates.go @@ -3,8 +3,8 @@ package certificates import ( "reflect" + "github.com/go-playground/validator/v10" "github.com/lorenzodonini/ocpp-go/ocpp1.6/types" - "gopkg.in/go-playground/validator.v9" ) // -------------------- Get Installed Certificate IDs (CSMS -> CS) -------------------- diff --git a/ocpp1.6/certificates/install_certificate.go b/ocpp1.6/certificates/install_certificate.go index 9f972827..021da00f 100644 --- a/ocpp1.6/certificates/install_certificate.go +++ b/ocpp1.6/certificates/install_certificate.go @@ -3,8 +3,8 @@ package certificates import ( "reflect" + "github.com/go-playground/validator/v10" "github.com/lorenzodonini/ocpp-go/ocpp1.6/types" - "gopkg.in/go-playground/validator.v9" ) // -------------------- Install Certificate (CSMS -> CS) -------------------- diff --git a/ocpp1.6/core/boot_notification.go b/ocpp1.6/core/boot_notification.go index b3e63b05..003e0fd0 100644 --- a/ocpp1.6/core/boot_notification.go +++ b/ocpp1.6/core/boot_notification.go @@ -1,9 +1,10 @@ package core import ( - "github.com/lorenzodonini/ocpp-go/ocpp1.6/types" - "gopkg.in/go-playground/validator.v9" "reflect" + + "github.com/go-playground/validator/v10" + "github.com/lorenzodonini/ocpp-go/ocpp1.6/types" ) // -------------------- Boot Notification (CP -> CS) -------------------- diff --git a/ocpp1.6/core/change_availability.go b/ocpp1.6/core/change_availability.go index b0ce5be8..1c5c336b 100644 --- a/ocpp1.6/core/change_availability.go +++ b/ocpp1.6/core/change_availability.go @@ -1,9 +1,10 @@ package core import ( - "github.com/lorenzodonini/ocpp-go/ocpp1.6/types" - "gopkg.in/go-playground/validator.v9" "reflect" + + "github.com/go-playground/validator/v10" + "github.com/lorenzodonini/ocpp-go/ocpp1.6/types" ) // -------------------- Change Availability (CS -> CP) -------------------- diff --git a/ocpp1.6/core/change_configuration.go b/ocpp1.6/core/change_configuration.go index a0e250fd..00f33551 100644 --- a/ocpp1.6/core/change_configuration.go +++ b/ocpp1.6/core/change_configuration.go @@ -1,9 +1,10 @@ package core import ( - "github.com/lorenzodonini/ocpp-go/ocpp1.6/types" - "gopkg.in/go-playground/validator.v9" "reflect" + + "github.com/go-playground/validator/v10" + "github.com/lorenzodonini/ocpp-go/ocpp1.6/types" ) // -------------------- Change Configuration (CS -> CP) -------------------- diff --git a/ocpp1.6/core/clear_cache.go b/ocpp1.6/core/clear_cache.go index 4d6204ad..e1941375 100644 --- a/ocpp1.6/core/clear_cache.go +++ b/ocpp1.6/core/clear_cache.go @@ -1,9 +1,10 @@ package core import ( - "github.com/lorenzodonini/ocpp-go/ocpp1.6/types" - "gopkg.in/go-playground/validator.v9" "reflect" + + "github.com/go-playground/validator/v10" + "github.com/lorenzodonini/ocpp-go/ocpp1.6/types" ) // -------------------- Clear Cache (CS -> CP) -------------------- diff --git a/ocpp1.6/core/data_transfer.go b/ocpp1.6/core/data_transfer.go index bca7358a..6378f9d9 100644 --- a/ocpp1.6/core/data_transfer.go +++ b/ocpp1.6/core/data_transfer.go @@ -1,9 +1,10 @@ package core import ( - "github.com/lorenzodonini/ocpp-go/ocpp1.6/types" - "gopkg.in/go-playground/validator.v9" "reflect" + + "github.com/go-playground/validator/v10" + "github.com/lorenzodonini/ocpp-go/ocpp1.6/types" ) // -------------------- Data Transfer (CP -> CS / CS -> CP) -------------------- diff --git a/ocpp1.6/core/heartbeat.go b/ocpp1.6/core/heartbeat.go index a49406cb..252365fc 100644 --- a/ocpp1.6/core/heartbeat.go +++ b/ocpp1.6/core/heartbeat.go @@ -1,9 +1,10 @@ package core import ( - "github.com/lorenzodonini/ocpp-go/ocpp1.6/types" - "gopkg.in/go-playground/validator.v9" "reflect" + + "github.com/go-playground/validator/v10" + "github.com/lorenzodonini/ocpp-go/ocpp1.6/types" ) // -------------------- Heartbeat (CP -> CS) -------------------- diff --git a/ocpp1.6/core/reset.go b/ocpp1.6/core/reset.go index 7ef0770d..7bc34759 100644 --- a/ocpp1.6/core/reset.go +++ b/ocpp1.6/core/reset.go @@ -3,8 +3,8 @@ package core import ( "reflect" + "github.com/go-playground/validator/v10" "github.com/lorenzodonini/ocpp-go/ocpp1.6/types" - "gopkg.in/go-playground/validator.v9" ) // -------------------- Reset (CS -> CP) -------------------- diff --git a/ocpp1.6/core/status_notification.go b/ocpp1.6/core/status_notification.go index 130d3913..55ff4ee2 100644 --- a/ocpp1.6/core/status_notification.go +++ b/ocpp1.6/core/status_notification.go @@ -1,9 +1,10 @@ package core import ( - "github.com/lorenzodonini/ocpp-go/ocpp1.6/types" - "gopkg.in/go-playground/validator.v9" "reflect" + + "github.com/go-playground/validator/v10" + "github.com/lorenzodonini/ocpp-go/ocpp1.6/types" ) // -------------------- Status Notification (CP -> CS) -------------------- diff --git a/ocpp1.6/core/stop_transaction.go b/ocpp1.6/core/stop_transaction.go index 1e97f482..96b8263d 100644 --- a/ocpp1.6/core/stop_transaction.go +++ b/ocpp1.6/core/stop_transaction.go @@ -3,8 +3,8 @@ package core import ( "reflect" + "github.com/go-playground/validator/v10" "github.com/lorenzodonini/ocpp-go/ocpp1.6/types" - "gopkg.in/go-playground/validator.v9" ) // -------------------- Stop Transaction (CP -> CS) -------------------- diff --git a/ocpp1.6/core/unlock_connector.go b/ocpp1.6/core/unlock_connector.go index 165da681..abd84e66 100644 --- a/ocpp1.6/core/unlock_connector.go +++ b/ocpp1.6/core/unlock_connector.go @@ -1,9 +1,10 @@ package core import ( - "github.com/lorenzodonini/ocpp-go/ocpp1.6/types" - "gopkg.in/go-playground/validator.v9" "reflect" + + "github.com/go-playground/validator/v10" + "github.com/lorenzodonini/ocpp-go/ocpp1.6/types" ) // -------------------- Unlock Connector (CS -> CP) -------------------- diff --git a/ocpp1.6/extendedtriggermessage/extended_trigger_message.go b/ocpp1.6/extendedtriggermessage/extended_trigger_message.go index 683a3cdd..5c3d6aef 100644 --- a/ocpp1.6/extendedtriggermessage/extended_trigger_message.go +++ b/ocpp1.6/extendedtriggermessage/extended_trigger_message.go @@ -3,8 +3,8 @@ package extendedtriggermessage import ( "reflect" + "github.com/go-playground/validator/v10" "github.com/lorenzodonini/ocpp-go/ocpp1.6/types" - "gopkg.in/go-playground/validator.v9" ) const ExtendedTriggerMessageFeatureName = "ExtendedTriggerMessage" diff --git a/ocpp1.6/firmware/diagnostics_status_notification.go b/ocpp1.6/firmware/diagnostics_status_notification.go index 5dcfb81f..b57fd639 100644 --- a/ocpp1.6/firmware/diagnostics_status_notification.go +++ b/ocpp1.6/firmware/diagnostics_status_notification.go @@ -1,9 +1,10 @@ package firmware import ( - "github.com/lorenzodonini/ocpp-go/ocpp1.6/types" - "gopkg.in/go-playground/validator.v9" "reflect" + + "github.com/go-playground/validator/v10" + "github.com/lorenzodonini/ocpp-go/ocpp1.6/types" ) // -------------------- Diagnostics Status Notification (CP -> CS) -------------------- diff --git a/ocpp1.6/firmware/firmware_status_notification.go b/ocpp1.6/firmware/firmware_status_notification.go index 06e6b2ed..67d853fe 100644 --- a/ocpp1.6/firmware/firmware_status_notification.go +++ b/ocpp1.6/firmware/firmware_status_notification.go @@ -1,9 +1,10 @@ package firmware import ( - "github.com/lorenzodonini/ocpp-go/ocpp1.6/types" - "gopkg.in/go-playground/validator.v9" "reflect" + + "github.com/go-playground/validator/v10" + "github.com/lorenzodonini/ocpp-go/ocpp1.6/types" ) // -------------------- Firmware Status Notification (CP -> CS) -------------------- diff --git a/ocpp1.6/localauth/send_local_list.go b/ocpp1.6/localauth/send_local_list.go index d1107ebf..79352043 100644 --- a/ocpp1.6/localauth/send_local_list.go +++ b/ocpp1.6/localauth/send_local_list.go @@ -1,9 +1,10 @@ package localauth import ( - "github.com/lorenzodonini/ocpp-go/ocpp1.6/types" - "gopkg.in/go-playground/validator.v9" "reflect" + + "github.com/go-playground/validator/v10" + "github.com/lorenzodonini/ocpp-go/ocpp1.6/types" ) // -------------------- Send Local List (CS -> CP) -------------------- diff --git a/ocpp1.6/logging/get_log.go b/ocpp1.6/logging/get_log.go index 0878c0bc..22675092 100644 --- a/ocpp1.6/logging/get_log.go +++ b/ocpp1.6/logging/get_log.go @@ -3,8 +3,8 @@ package logging import ( "reflect" + "github.com/go-playground/validator/v10" "github.com/lorenzodonini/ocpp-go/ocpp1.6/types" - "gopkg.in/go-playground/validator.v9" ) // -------------------- Get Log (CSMS -> CS) -------------------- diff --git a/ocpp1.6/logging/log_status_notification.go b/ocpp1.6/logging/log_status_notification.go index d9d62470..082b9196 100644 --- a/ocpp1.6/logging/log_status_notification.go +++ b/ocpp1.6/logging/log_status_notification.go @@ -3,8 +3,8 @@ package logging import ( "reflect" + "github.com/go-playground/validator/v10" "github.com/lorenzodonini/ocpp-go/ocpp2.0.1/types" - "gopkg.in/go-playground/validator.v9" ) // -------------------- Log Status Notification (CS -> CSMS) -------------------- diff --git a/ocpp1.6/remotetrigger/trigger_message.go b/ocpp1.6/remotetrigger/trigger_message.go index 35379da0..a1870d6b 100644 --- a/ocpp1.6/remotetrigger/trigger_message.go +++ b/ocpp1.6/remotetrigger/trigger_message.go @@ -3,10 +3,10 @@ package remotetrigger import ( "reflect" + "github.com/go-playground/validator/v10" "github.com/lorenzodonini/ocpp-go/ocpp1.6/core" "github.com/lorenzodonini/ocpp-go/ocpp1.6/firmware" "github.com/lorenzodonini/ocpp-go/ocpp1.6/types" - "gopkg.in/go-playground/validator.v9" ) // -------------------- Trigger Message (CS -> CP) -------------------- diff --git a/ocpp1.6/reservation/cancel_reservation.go b/ocpp1.6/reservation/cancel_reservation.go index c6f14a8c..987c64c0 100644 --- a/ocpp1.6/reservation/cancel_reservation.go +++ b/ocpp1.6/reservation/cancel_reservation.go @@ -1,9 +1,10 @@ package reservation import ( - "github.com/lorenzodonini/ocpp-go/ocpp1.6/types" - "gopkg.in/go-playground/validator.v9" "reflect" + + "github.com/go-playground/validator/v10" + "github.com/lorenzodonini/ocpp-go/ocpp1.6/types" ) // -------------------- Cancel Reservation (CS -> CP) -------------------- diff --git a/ocpp1.6/reservation/reserve_now.go b/ocpp1.6/reservation/reserve_now.go index 6bceadd2..adaeb358 100644 --- a/ocpp1.6/reservation/reserve_now.go +++ b/ocpp1.6/reservation/reserve_now.go @@ -1,9 +1,10 @@ package reservation import ( - "github.com/lorenzodonini/ocpp-go/ocpp1.6/types" - "gopkg.in/go-playground/validator.v9" "reflect" + + "github.com/go-playground/validator/v10" + "github.com/lorenzodonini/ocpp-go/ocpp1.6/types" ) // -------------------- Reserve Now (CS -> CP) -------------------- diff --git a/ocpp1.6/securefirmware/signed_update_firmware.go b/ocpp1.6/securefirmware/signed_update_firmware.go index d688d016..8522a663 100644 --- a/ocpp1.6/securefirmware/signed_update_firmware.go +++ b/ocpp1.6/securefirmware/signed_update_firmware.go @@ -3,8 +3,8 @@ package securefirmware import ( "reflect" + "github.com/go-playground/validator/v10" "github.com/lorenzodonini/ocpp-go/ocpp1.6/types" - "gopkg.in/go-playground/validator.v9" ) const SignedUpdateFirmwareFeatureName = "SignedUpdateFirmware" diff --git a/ocpp1.6/securefirmware/signed_update_firmware_status_notitfication.go b/ocpp1.6/securefirmware/signed_update_firmware_status_notitfication.go index b4d063e5..b4ec319b 100644 --- a/ocpp1.6/securefirmware/signed_update_firmware_status_notitfication.go +++ b/ocpp1.6/securefirmware/signed_update_firmware_status_notitfication.go @@ -3,7 +3,7 @@ package securefirmware import ( "reflect" - "gopkg.in/go-playground/validator.v9" + "github.com/go-playground/validator/v10" "github.com/lorenzodonini/ocpp-go/ocpp1.6/types" ) diff --git a/ocpp1.6/security/certificate_signed.go b/ocpp1.6/security/certificate_signed.go index 51832dee..45271cfe 100644 --- a/ocpp1.6/security/certificate_signed.go +++ b/ocpp1.6/security/certificate_signed.go @@ -3,7 +3,7 @@ package security import ( "reflect" - "gopkg.in/go-playground/validator.v9" + "github.com/go-playground/validator/v10" "github.com/lorenzodonini/ocpp-go/ocpp1.6/types" ) diff --git a/ocpp1.6/smartcharging/clear_charging_profile.go b/ocpp1.6/smartcharging/clear_charging_profile.go index 7a7a3ef1..332e6159 100644 --- a/ocpp1.6/smartcharging/clear_charging_profile.go +++ b/ocpp1.6/smartcharging/clear_charging_profile.go @@ -3,8 +3,8 @@ package smartcharging import ( "reflect" + "github.com/go-playground/validator/v10" "github.com/lorenzodonini/ocpp-go/ocpp1.6/types" - "gopkg.in/go-playground/validator.v9" ) // -------------------- Clear Charging Profile (CS -> CP) -------------------- diff --git a/ocpp1.6/smartcharging/get_composite_schedule.go b/ocpp1.6/smartcharging/get_composite_schedule.go index 7d64f614..d50cdcf0 100644 --- a/ocpp1.6/smartcharging/get_composite_schedule.go +++ b/ocpp1.6/smartcharging/get_composite_schedule.go @@ -3,8 +3,8 @@ package smartcharging import ( "reflect" + "github.com/go-playground/validator/v10" "github.com/lorenzodonini/ocpp-go/ocpp1.6/types" - "gopkg.in/go-playground/validator.v9" ) // -------------------- Get Composite Schedule (CS -> CP) -------------------- diff --git a/ocpp1.6/smartcharging/set_charging_profile.go b/ocpp1.6/smartcharging/set_charging_profile.go index 4694d32a..4272310f 100644 --- a/ocpp1.6/smartcharging/set_charging_profile.go +++ b/ocpp1.6/smartcharging/set_charging_profile.go @@ -3,8 +3,8 @@ package smartcharging import ( "reflect" + "github.com/go-playground/validator/v10" "github.com/lorenzodonini/ocpp-go/ocpp1.6/types" - "gopkg.in/go-playground/validator.v9" ) // -------------------- Set Charging Profile (CS -> CP) -------------------- diff --git a/ocpp1.6/types/security_extension.go b/ocpp1.6/types/security_extension.go index 94ba3eb9..58845729 100644 --- a/ocpp1.6/types/security_extension.go +++ b/ocpp1.6/types/security_extension.go @@ -1,6 +1,6 @@ package types -import "gopkg.in/go-playground/validator.v9" +import "github.com/go-playground/validator/v10" // Indicates the type of the signed certificate that is returned. // When omitted the certificate is used for both the 15118 connection (if implemented) and the Charging Station to CSMS connection. diff --git a/ocpp1.6/types/types.go b/ocpp1.6/types/types.go index bb3cd501..1d952db9 100644 --- a/ocpp1.6/types/types.go +++ b/ocpp1.6/types/types.go @@ -2,8 +2,8 @@ package types import ( + "github.com/go-playground/validator/v10" "github.com/lorenzodonini/ocpp-go/ocppj" - "gopkg.in/go-playground/validator.v9" ) const ( diff --git a/ocpp1.6_test/mocks/mock_certificates_charge_point_handler.go b/ocpp1.6_test/mocks/mock_certificates_charge_point_handler.go index 363c4fde..c16f7d1c 100644 --- a/ocpp1.6_test/mocks/mock_certificates_charge_point_handler.go +++ b/ocpp1.6_test/mocks/mock_certificates_charge_point_handler.go @@ -1,4 +1,4 @@ -// Code generated by mockery v2.51.0. DO NOT EDIT. +// Code generated by mockery v2.53.4. DO NOT EDIT. package mocks diff --git a/ocpp1.6_test/mocks/mock_core_central_system_handler.go b/ocpp1.6_test/mocks/mock_core_central_system_handler.go index 6aa1d683..e1376337 100644 --- a/ocpp1.6_test/mocks/mock_core_central_system_handler.go +++ b/ocpp1.6_test/mocks/mock_core_central_system_handler.go @@ -1,4 +1,4 @@ -// Code generated by mockery v2.51.0. DO NOT EDIT. +// Code generated by mockery v2.53.4. DO NOT EDIT. package mocks diff --git a/ocpp1.6_test/mocks/mock_core_charge_point_handler.go b/ocpp1.6_test/mocks/mock_core_charge_point_handler.go index 492865ef..bfd8059b 100644 --- a/ocpp1.6_test/mocks/mock_core_charge_point_handler.go +++ b/ocpp1.6_test/mocks/mock_core_charge_point_handler.go @@ -1,4 +1,4 @@ -// Code generated by mockery v2.51.0. DO NOT EDIT. +// Code generated by mockery v2.53.4. DO NOT EDIT. package mocks diff --git a/ocpp1.6_test/mocks/mock_extended_trigger_message_charge_point_handler.go b/ocpp1.6_test/mocks/mock_extended_trigger_message_charge_point_handler.go index 606a3412..4e7561b8 100644 --- a/ocpp1.6_test/mocks/mock_extended_trigger_message_charge_point_handler.go +++ b/ocpp1.6_test/mocks/mock_extended_trigger_message_charge_point_handler.go @@ -1,4 +1,4 @@ -// Code generated by mockery v2.51.0. DO NOT EDIT. +// Code generated by mockery v2.53.4. DO NOT EDIT. package mocks diff --git a/ocpp1.6_test/mocks/mock_firmware_central_system_handler.go b/ocpp1.6_test/mocks/mock_firmware_central_system_handler.go index 46583764..96038eb4 100644 --- a/ocpp1.6_test/mocks/mock_firmware_central_system_handler.go +++ b/ocpp1.6_test/mocks/mock_firmware_central_system_handler.go @@ -1,4 +1,4 @@ -// Code generated by mockery v2.51.0. DO NOT EDIT. +// Code generated by mockery v2.53.4. DO NOT EDIT. package mocks diff --git a/ocpp1.6_test/mocks/mock_firmware_charge_point_handler.go b/ocpp1.6_test/mocks/mock_firmware_charge_point_handler.go index 13f874ee..1d4d40a8 100644 --- a/ocpp1.6_test/mocks/mock_firmware_charge_point_handler.go +++ b/ocpp1.6_test/mocks/mock_firmware_charge_point_handler.go @@ -1,4 +1,4 @@ -// Code generated by mockery v2.51.0. DO NOT EDIT. +// Code generated by mockery v2.53.4. DO NOT EDIT. package mocks diff --git a/ocpp1.6_test/mocks/mock_local_auth_list_central_system_handler.go b/ocpp1.6_test/mocks/mock_local_auth_list_central_system_handler.go index 6da113c5..8c050258 100644 --- a/ocpp1.6_test/mocks/mock_local_auth_list_central_system_handler.go +++ b/ocpp1.6_test/mocks/mock_local_auth_list_central_system_handler.go @@ -1,4 +1,4 @@ -// Code generated by mockery v2.51.0. DO NOT EDIT. +// Code generated by mockery v2.53.4. DO NOT EDIT. package mocks diff --git a/ocpp1.6_test/mocks/mock_local_auth_list_charge_point_handler.go b/ocpp1.6_test/mocks/mock_local_auth_list_charge_point_handler.go index b7a552d6..c8311890 100644 --- a/ocpp1.6_test/mocks/mock_local_auth_list_charge_point_handler.go +++ b/ocpp1.6_test/mocks/mock_local_auth_list_charge_point_handler.go @@ -1,4 +1,4 @@ -// Code generated by mockery v2.51.0. DO NOT EDIT. +// Code generated by mockery v2.53.4. DO NOT EDIT. package mocks diff --git a/ocpp1.6_test/mocks/mock_logging_central_system_handler.go b/ocpp1.6_test/mocks/mock_logging_central_system_handler.go index f8b0ed68..fa68a1a5 100644 --- a/ocpp1.6_test/mocks/mock_logging_central_system_handler.go +++ b/ocpp1.6_test/mocks/mock_logging_central_system_handler.go @@ -1,4 +1,4 @@ -// Code generated by mockery v2.51.0. DO NOT EDIT. +// Code generated by mockery v2.53.4. DO NOT EDIT. package mocks diff --git a/ocpp1.6_test/mocks/mock_logging_charge_point_handler.go b/ocpp1.6_test/mocks/mock_logging_charge_point_handler.go index f26f5227..5c2e719f 100644 --- a/ocpp1.6_test/mocks/mock_logging_charge_point_handler.go +++ b/ocpp1.6_test/mocks/mock_logging_charge_point_handler.go @@ -1,4 +1,4 @@ -// Code generated by mockery v2.51.0. DO NOT EDIT. +// Code generated by mockery v2.53.4. DO NOT EDIT. package mocks diff --git a/ocpp1.6_test/mocks/mock_ocpp16.go b/ocpp1.6_test/mocks/mock_ocpp16.go index 330eecee..e4b6b203 100644 --- a/ocpp1.6_test/mocks/mock_ocpp16.go +++ b/ocpp1.6_test/mocks/mock_ocpp16.go @@ -1,4 +1,4 @@ -// Code generated by mockery v2.51.0. DO NOT EDIT. +// Code generated by mockery v2.53.4. DO NOT EDIT. package mocks diff --git a/ocpp1.6_test/mocks/mock_remote_trigger_central_system_handler.go b/ocpp1.6_test/mocks/mock_remote_trigger_central_system_handler.go index 1d95ec5e..133aae0d 100644 --- a/ocpp1.6_test/mocks/mock_remote_trigger_central_system_handler.go +++ b/ocpp1.6_test/mocks/mock_remote_trigger_central_system_handler.go @@ -1,4 +1,4 @@ -// Code generated by mockery v2.51.0. DO NOT EDIT. +// Code generated by mockery v2.53.4. DO NOT EDIT. package mocks diff --git a/ocpp1.6_test/mocks/mock_remote_trigger_charge_point_handler.go b/ocpp1.6_test/mocks/mock_remote_trigger_charge_point_handler.go index ae0d35d1..21c400ea 100644 --- a/ocpp1.6_test/mocks/mock_remote_trigger_charge_point_handler.go +++ b/ocpp1.6_test/mocks/mock_remote_trigger_charge_point_handler.go @@ -1,4 +1,4 @@ -// Code generated by mockery v2.51.0. DO NOT EDIT. +// Code generated by mockery v2.53.4. DO NOT EDIT. package mocks diff --git a/ocpp1.6_test/mocks/mock_reservation_central_system_handler.go b/ocpp1.6_test/mocks/mock_reservation_central_system_handler.go index 7ce97b06..32423b0a 100644 --- a/ocpp1.6_test/mocks/mock_reservation_central_system_handler.go +++ b/ocpp1.6_test/mocks/mock_reservation_central_system_handler.go @@ -1,4 +1,4 @@ -// Code generated by mockery v2.51.0. DO NOT EDIT. +// Code generated by mockery v2.53.4. DO NOT EDIT. package mocks diff --git a/ocpp1.6_test/mocks/mock_reservation_charge_point_handler.go b/ocpp1.6_test/mocks/mock_reservation_charge_point_handler.go index 2800b719..d2bdb50b 100644 --- a/ocpp1.6_test/mocks/mock_reservation_charge_point_handler.go +++ b/ocpp1.6_test/mocks/mock_reservation_charge_point_handler.go @@ -1,4 +1,4 @@ -// Code generated by mockery v2.51.0. DO NOT EDIT. +// Code generated by mockery v2.53.4. DO NOT EDIT. package mocks diff --git a/ocpp1.6_test/mocks/mock_secure_firmware_CentralSystemHandler.go b/ocpp1.6_test/mocks/mock_secure_firmware_CentralSystemHandler.go index a8540226..fe963c58 100644 --- a/ocpp1.6_test/mocks/mock_secure_firmware_CentralSystemHandler.go +++ b/ocpp1.6_test/mocks/mock_secure_firmware_CentralSystemHandler.go @@ -1,4 +1,4 @@ -// Code generated by mockery v2.51.0. DO NOT EDIT. +// Code generated by mockery v2.53.4. DO NOT EDIT. package mocks diff --git a/ocpp1.6_test/mocks/mock_secure_firmware_ChargePointHandler.go b/ocpp1.6_test/mocks/mock_secure_firmware_ChargePointHandler.go index fbede0a3..2cf6e099 100644 --- a/ocpp1.6_test/mocks/mock_secure_firmware_ChargePointHandler.go +++ b/ocpp1.6_test/mocks/mock_secure_firmware_ChargePointHandler.go @@ -1,4 +1,4 @@ -// Code generated by mockery v2.51.0. DO NOT EDIT. +// Code generated by mockery v2.53.4. DO NOT EDIT. package mocks diff --git a/ocpp1.6_test/mocks/mock_security_central_system_handler.go b/ocpp1.6_test/mocks/mock_security_central_system_handler.go index 3728fadc..f450ce54 100644 --- a/ocpp1.6_test/mocks/mock_security_central_system_handler.go +++ b/ocpp1.6_test/mocks/mock_security_central_system_handler.go @@ -1,4 +1,4 @@ -// Code generated by mockery v2.51.0. DO NOT EDIT. +// Code generated by mockery v2.53.4. DO NOT EDIT. package mocks diff --git a/ocpp1.6_test/mocks/mock_security_charge_point_handler.go b/ocpp1.6_test/mocks/mock_security_charge_point_handler.go index 012adec9..f065339d 100644 --- a/ocpp1.6_test/mocks/mock_security_charge_point_handler.go +++ b/ocpp1.6_test/mocks/mock_security_charge_point_handler.go @@ -1,4 +1,4 @@ -// Code generated by mockery v2.51.0. DO NOT EDIT. +// Code generated by mockery v2.53.4. DO NOT EDIT. package mocks diff --git a/ocpp1.6_test/mocks/mock_smart_charging_central_system_handler.go b/ocpp1.6_test/mocks/mock_smart_charging_central_system_handler.go index 1a5ebb75..6fea4368 100644 --- a/ocpp1.6_test/mocks/mock_smart_charging_central_system_handler.go +++ b/ocpp1.6_test/mocks/mock_smart_charging_central_system_handler.go @@ -1,4 +1,4 @@ -// Code generated by mockery v2.51.0. DO NOT EDIT. +// Code generated by mockery v2.53.4. DO NOT EDIT. package mocks diff --git a/ocpp1.6_test/mocks/mock_smart_charging_charge_point_handler.go b/ocpp1.6_test/mocks/mock_smart_charging_charge_point_handler.go index 61ee69cd..17b48403 100644 --- a/ocpp1.6_test/mocks/mock_smart_charging_charge_point_handler.go +++ b/ocpp1.6_test/mocks/mock_smart_charging_charge_point_handler.go @@ -1,4 +1,4 @@ -// Code generated by mockery v2.51.0. DO NOT EDIT. +// Code generated by mockery v2.53.4. DO NOT EDIT. package mocks diff --git a/ocpp2.0.1/authorization/authorize.go b/ocpp2.0.1/authorization/authorize.go index d04c97f3..86bff76e 100644 --- a/ocpp2.0.1/authorization/authorize.go +++ b/ocpp2.0.1/authorization/authorize.go @@ -3,7 +3,7 @@ package authorization import ( "reflect" - "gopkg.in/go-playground/validator.v9" + "github.com/go-playground/validator/v10" "github.com/lorenzodonini/ocpp-go/ocpp2.0.1/types" ) diff --git a/ocpp2.0.1/authorization/clear_cache.go b/ocpp2.0.1/authorization/clear_cache.go index 334d9d2f..5da5d406 100644 --- a/ocpp2.0.1/authorization/clear_cache.go +++ b/ocpp2.0.1/authorization/clear_cache.go @@ -3,7 +3,7 @@ package authorization import ( "reflect" - "gopkg.in/go-playground/validator.v9" + "github.com/go-playground/validator/v10" "github.com/lorenzodonini/ocpp-go/ocpp2.0.1/types" ) diff --git a/ocpp2.0.1/availability/change_availability.go b/ocpp2.0.1/availability/change_availability.go index 997434c1..ab2b2b81 100644 --- a/ocpp2.0.1/availability/change_availability.go +++ b/ocpp2.0.1/availability/change_availability.go @@ -3,7 +3,7 @@ package availability import ( "reflect" - "gopkg.in/go-playground/validator.v9" + "github.com/go-playground/validator/v10" "github.com/lorenzodonini/ocpp-go/ocpp2.0.1/types" ) diff --git a/ocpp2.0.1/availability/heartbeat.go b/ocpp2.0.1/availability/heartbeat.go index f372478d..19c37d48 100644 --- a/ocpp2.0.1/availability/heartbeat.go +++ b/ocpp2.0.1/availability/heartbeat.go @@ -3,8 +3,8 @@ package availability import ( "reflect" + "github.com/go-playground/validator/v10" "github.com/lorenzodonini/ocpp-go/ocpp2.0.1/types" - "gopkg.in/go-playground/validator.v9" ) // -------------------- Heartbeat (CS -> CSMS) -------------------- diff --git a/ocpp2.0.1/availability/status_notification.go b/ocpp2.0.1/availability/status_notification.go index 9f4ae232..6dbd47b4 100644 --- a/ocpp2.0.1/availability/status_notification.go +++ b/ocpp2.0.1/availability/status_notification.go @@ -3,8 +3,8 @@ package availability import ( "reflect" + "github.com/go-playground/validator/v10" "github.com/lorenzodonini/ocpp-go/ocpp2.0.1/types" - "gopkg.in/go-playground/validator.v9" ) // -------------------- Status Notification (CS -> CSMS) -------------------- diff --git a/ocpp2.0.1/data/data_transfer.go b/ocpp2.0.1/data/data_transfer.go index e82d18ed..75df7d1a 100644 --- a/ocpp2.0.1/data/data_transfer.go +++ b/ocpp2.0.1/data/data_transfer.go @@ -3,7 +3,7 @@ package data import ( "reflect" - "gopkg.in/go-playground/validator.v9" + "github.com/go-playground/validator/v10" "github.com/lorenzodonini/ocpp-go/ocpp2.0.1/types" ) diff --git a/ocpp2.0.1/diagnostics/clear_variable_monitoring.go b/ocpp2.0.1/diagnostics/clear_variable_monitoring.go index ecec3149..fdeb13ab 100644 --- a/ocpp2.0.1/diagnostics/clear_variable_monitoring.go +++ b/ocpp2.0.1/diagnostics/clear_variable_monitoring.go @@ -3,8 +3,8 @@ package diagnostics import ( "reflect" + "github.com/go-playground/validator/v10" "github.com/lorenzodonini/ocpp-go/ocpp2.0.1/types" - "gopkg.in/go-playground/validator.v9" ) // -------------------- Clear Variable Monitoring (CSMS -> CS) -------------------- diff --git a/ocpp2.0.1/diagnostics/customer_information.go b/ocpp2.0.1/diagnostics/customer_information.go index 97e3cc56..7fac7a68 100644 --- a/ocpp2.0.1/diagnostics/customer_information.go +++ b/ocpp2.0.1/diagnostics/customer_information.go @@ -3,7 +3,7 @@ package diagnostics import ( "reflect" - "gopkg.in/go-playground/validator.v9" + "github.com/go-playground/validator/v10" "github.com/lorenzodonini/ocpp-go/ocpp2.0.1/types" ) diff --git a/ocpp2.0.1/diagnostics/get_log.go b/ocpp2.0.1/diagnostics/get_log.go index 5b9fc4ea..14e7d8a3 100644 --- a/ocpp2.0.1/diagnostics/get_log.go +++ b/ocpp2.0.1/diagnostics/get_log.go @@ -3,8 +3,8 @@ package diagnostics import ( "reflect" + "github.com/go-playground/validator/v10" "github.com/lorenzodonini/ocpp-go/ocpp2.0.1/types" - "gopkg.in/go-playground/validator.v9" ) // -------------------- Get Log (CSMS -> CS) -------------------- diff --git a/ocpp2.0.1/diagnostics/get_monitoring_report.go b/ocpp2.0.1/diagnostics/get_monitoring_report.go index 98379b96..98f22b14 100644 --- a/ocpp2.0.1/diagnostics/get_monitoring_report.go +++ b/ocpp2.0.1/diagnostics/get_monitoring_report.go @@ -3,8 +3,8 @@ package diagnostics import ( "reflect" + "github.com/go-playground/validator/v10" "github.com/lorenzodonini/ocpp-go/ocpp2.0.1/types" - "gopkg.in/go-playground/validator.v9" ) // -------------------- Get Monitoring Report (CSMS -> CS) -------------------- diff --git a/ocpp2.0.1/diagnostics/log_status_notification.go b/ocpp2.0.1/diagnostics/log_status_notification.go index d3a949d0..4009ec4f 100644 --- a/ocpp2.0.1/diagnostics/log_status_notification.go +++ b/ocpp2.0.1/diagnostics/log_status_notification.go @@ -3,8 +3,8 @@ package diagnostics import ( "reflect" + "github.com/go-playground/validator/v10" "github.com/lorenzodonini/ocpp-go/ocpp2.0.1/types" - "gopkg.in/go-playground/validator.v9" ) // -------------------- Log Status Notification (CS -> CSMS) -------------------- diff --git a/ocpp2.0.1/diagnostics/notify_event.go b/ocpp2.0.1/diagnostics/notify_event.go index 3e9127d5..c61e105a 100644 --- a/ocpp2.0.1/diagnostics/notify_event.go +++ b/ocpp2.0.1/diagnostics/notify_event.go @@ -3,8 +3,8 @@ package diagnostics import ( "reflect" + "github.com/go-playground/validator/v10" "github.com/lorenzodonini/ocpp-go/ocpp2.0.1/types" - "gopkg.in/go-playground/validator.v9" ) // -------------------- Notify Event (CS -> CSMS) -------------------- diff --git a/ocpp2.0.1/diagnostics/set_monitoring_base.go b/ocpp2.0.1/diagnostics/set_monitoring_base.go index 49096bbd..e62f98ae 100644 --- a/ocpp2.0.1/diagnostics/set_monitoring_base.go +++ b/ocpp2.0.1/diagnostics/set_monitoring_base.go @@ -3,8 +3,8 @@ package diagnostics import ( "reflect" + "github.com/go-playground/validator/v10" "github.com/lorenzodonini/ocpp-go/ocpp2.0.1/types" - "gopkg.in/go-playground/validator.v9" ) // -------------------- Set Monitoring Base (CSMS -> CS) -------------------- diff --git a/ocpp2.0.1/diagnostics/set_variable_monitoring.go b/ocpp2.0.1/diagnostics/set_variable_monitoring.go index 14acf9c2..6bf5d690 100644 --- a/ocpp2.0.1/diagnostics/set_variable_monitoring.go +++ b/ocpp2.0.1/diagnostics/set_variable_monitoring.go @@ -3,8 +3,8 @@ package diagnostics import ( "reflect" + "github.com/go-playground/validator/v10" "github.com/lorenzodonini/ocpp-go/ocpp2.0.1/types" - "gopkg.in/go-playground/validator.v9" ) // -------------------- Set Variable Monitoring (CSMS -> CS) -------------------- diff --git a/ocpp2.0.1/diagnostics/types.go b/ocpp2.0.1/diagnostics/types.go index 3d94fb1a..c4c6c73a 100644 --- a/ocpp2.0.1/diagnostics/types.go +++ b/ocpp2.0.1/diagnostics/types.go @@ -1,8 +1,8 @@ package diagnostics import ( + "github.com/go-playground/validator/v10" "github.com/lorenzodonini/ocpp-go/ocpp2.0.1/types" - "gopkg.in/go-playground/validator.v9" ) // MonitorType specifies the type of this monitor. diff --git a/ocpp2.0.1/display/clear_display_message.go b/ocpp2.0.1/display/clear_display_message.go index f0057122..b56433f8 100644 --- a/ocpp2.0.1/display/clear_display_message.go +++ b/ocpp2.0.1/display/clear_display_message.go @@ -3,7 +3,7 @@ package display import ( "reflect" - "gopkg.in/go-playground/validator.v9" + "github.com/go-playground/validator/v10" "github.com/lorenzodonini/ocpp-go/ocpp2.0.1/types" ) diff --git a/ocpp2.0.1/display/set_display_message.go b/ocpp2.0.1/display/set_display_message.go index 8f78510e..59b9f94e 100644 --- a/ocpp2.0.1/display/set_display_message.go +++ b/ocpp2.0.1/display/set_display_message.go @@ -3,8 +3,8 @@ package display import ( "reflect" + "github.com/go-playground/validator/v10" "github.com/lorenzodonini/ocpp-go/ocpp2.0.1/types" - "gopkg.in/go-playground/validator.v9" ) // -------------------- Clear Display (CSMS -> CS) -------------------- diff --git a/ocpp2.0.1/display/types.go b/ocpp2.0.1/display/types.go index 250fa1c8..dccb1c1c 100644 --- a/ocpp2.0.1/display/types.go +++ b/ocpp2.0.1/display/types.go @@ -1,8 +1,8 @@ package display import ( + "github.com/go-playground/validator/v10" "github.com/lorenzodonini/ocpp-go/ocpp2.0.1/types" - "gopkg.in/go-playground/validator.v9" ) // Priority with which a message should be displayed on a Charging Station. diff --git a/ocpp2.0.1/firmware/firmware_status_notification.go b/ocpp2.0.1/firmware/firmware_status_notification.go index d18d1857..16b9686f 100644 --- a/ocpp2.0.1/firmware/firmware_status_notification.go +++ b/ocpp2.0.1/firmware/firmware_status_notification.go @@ -3,7 +3,7 @@ package firmware import ( "reflect" - "gopkg.in/go-playground/validator.v9" + "github.com/go-playground/validator/v10" "github.com/lorenzodonini/ocpp-go/ocpp2.0.1/types" ) diff --git a/ocpp2.0.1/firmware/publish_firmware_status_notification.go b/ocpp2.0.1/firmware/publish_firmware_status_notification.go index 3535dbf7..9769f8b4 100644 --- a/ocpp2.0.1/firmware/publish_firmware_status_notification.go +++ b/ocpp2.0.1/firmware/publish_firmware_status_notification.go @@ -3,8 +3,8 @@ package firmware import ( "reflect" + "github.com/go-playground/validator/v10" "github.com/lorenzodonini/ocpp-go/ocpp2.0.1/types" - "gopkg.in/go-playground/validator.v9" ) // -------------------- Publish Firmware Status Notification (CS -> CSMS) -------------------- diff --git a/ocpp2.0.1/firmware/unpublish_firmware.go b/ocpp2.0.1/firmware/unpublish_firmware.go index b4820814..3a025c39 100644 --- a/ocpp2.0.1/firmware/unpublish_firmware.go +++ b/ocpp2.0.1/firmware/unpublish_firmware.go @@ -3,7 +3,7 @@ package firmware import ( "reflect" - "gopkg.in/go-playground/validator.v9" + "github.com/go-playground/validator/v10" "github.com/lorenzodonini/ocpp-go/ocpp2.0.1/types" ) diff --git a/ocpp2.0.1/firmware/update_firmware.go b/ocpp2.0.1/firmware/update_firmware.go index eedea312..7f41c591 100644 --- a/ocpp2.0.1/firmware/update_firmware.go +++ b/ocpp2.0.1/firmware/update_firmware.go @@ -3,7 +3,7 @@ package firmware import ( "reflect" - "gopkg.in/go-playground/validator.v9" + "github.com/go-playground/validator/v10" "github.com/lorenzodonini/ocpp-go/ocpp2.0.1/types" ) diff --git a/ocpp2.0.1/iso15118/delete_certificate.go b/ocpp2.0.1/iso15118/delete_certificate.go index f2de20af..06348688 100644 --- a/ocpp2.0.1/iso15118/delete_certificate.go +++ b/ocpp2.0.1/iso15118/delete_certificate.go @@ -3,7 +3,7 @@ package iso15118 import ( "reflect" - "gopkg.in/go-playground/validator.v9" + "github.com/go-playground/validator/v10" "github.com/lorenzodonini/ocpp-go/ocpp2.0.1/types" ) diff --git a/ocpp2.0.1/iso15118/get_15118ev_certificate.go b/ocpp2.0.1/iso15118/get_15118ev_certificate.go index 9eb53c37..6ba1630a 100644 --- a/ocpp2.0.1/iso15118/get_15118ev_certificate.go +++ b/ocpp2.0.1/iso15118/get_15118ev_certificate.go @@ -3,7 +3,7 @@ package iso15118 import ( "reflect" - "gopkg.in/go-playground/validator.v9" + "github.com/go-playground/validator/v10" "github.com/lorenzodonini/ocpp-go/ocpp2.0.1/types" ) diff --git a/ocpp2.0.1/iso15118/get_installed_certificate_ids.go b/ocpp2.0.1/iso15118/get_installed_certificate_ids.go index 58271d02..4c34a421 100644 --- a/ocpp2.0.1/iso15118/get_installed_certificate_ids.go +++ b/ocpp2.0.1/iso15118/get_installed_certificate_ids.go @@ -3,8 +3,8 @@ package iso15118 import ( "reflect" + "github.com/go-playground/validator/v10" "github.com/lorenzodonini/ocpp-go/ocpp2.0.1/types" - "gopkg.in/go-playground/validator.v9" ) // -------------------- Get Installed Certificate IDs (CSMS -> CS) -------------------- diff --git a/ocpp2.0.1/iso15118/install_certificate.go b/ocpp2.0.1/iso15118/install_certificate.go index 7ce446b6..e345ca2d 100644 --- a/ocpp2.0.1/iso15118/install_certificate.go +++ b/ocpp2.0.1/iso15118/install_certificate.go @@ -3,7 +3,7 @@ package iso15118 import ( "reflect" - "gopkg.in/go-playground/validator.v9" + "github.com/go-playground/validator/v10" "github.com/lorenzodonini/ocpp-go/ocpp2.0.1/types" ) diff --git a/ocpp2.0.1/localauth/send_local_list.go b/ocpp2.0.1/localauth/send_local_list.go index 06550bb8..0e006ba1 100644 --- a/ocpp2.0.1/localauth/send_local_list.go +++ b/ocpp2.0.1/localauth/send_local_list.go @@ -3,8 +3,8 @@ package localauth import ( "reflect" + "github.com/go-playground/validator/v10" "github.com/lorenzodonini/ocpp-go/ocpp2.0.1/types" - "gopkg.in/go-playground/validator.v9" ) // -------------------- Send Local List (CSMS -> CS) -------------------- diff --git a/ocpp2.0.1/provisioning/boot_notification.go b/ocpp2.0.1/provisioning/boot_notification.go index 9bdb276d..4bffd751 100644 --- a/ocpp2.0.1/provisioning/boot_notification.go +++ b/ocpp2.0.1/provisioning/boot_notification.go @@ -3,7 +3,7 @@ package provisioning import ( "reflect" - "gopkg.in/go-playground/validator.v9" + "github.com/go-playground/validator/v10" "github.com/lorenzodonini/ocpp-go/ocpp2.0.1/types" ) diff --git a/ocpp2.0.1/provisioning/get_base_report.go b/ocpp2.0.1/provisioning/get_base_report.go index 3217ca33..d83aff2e 100644 --- a/ocpp2.0.1/provisioning/get_base_report.go +++ b/ocpp2.0.1/provisioning/get_base_report.go @@ -3,7 +3,7 @@ package provisioning import ( "reflect" - "gopkg.in/go-playground/validator.v9" + "github.com/go-playground/validator/v10" "github.com/lorenzodonini/ocpp-go/ocpp2.0.1/types" ) diff --git a/ocpp2.0.1/provisioning/get_report.go b/ocpp2.0.1/provisioning/get_report.go index 873334ac..71424eb8 100644 --- a/ocpp2.0.1/provisioning/get_report.go +++ b/ocpp2.0.1/provisioning/get_report.go @@ -3,8 +3,8 @@ package provisioning import ( "reflect" + "github.com/go-playground/validator/v10" "github.com/lorenzodonini/ocpp-go/ocpp2.0.1/types" - "gopkg.in/go-playground/validator.v9" ) // -------------------- Get Report (CSMS -> CS) -------------------- diff --git a/ocpp2.0.1/provisioning/get_variables.go b/ocpp2.0.1/provisioning/get_variables.go index 26df1c2c..df885da3 100644 --- a/ocpp2.0.1/provisioning/get_variables.go +++ b/ocpp2.0.1/provisioning/get_variables.go @@ -3,8 +3,8 @@ package provisioning import ( "reflect" + "github.com/go-playground/validator/v10" "github.com/lorenzodonini/ocpp-go/ocpp2.0.1/types" - "gopkg.in/go-playground/validator.v9" ) // -------------------- Get Variable (CSMS -> CS) -------------------- diff --git a/ocpp2.0.1/provisioning/notify_report.go b/ocpp2.0.1/provisioning/notify_report.go index 665160e5..aca42e54 100644 --- a/ocpp2.0.1/provisioning/notify_report.go +++ b/ocpp2.0.1/provisioning/notify_report.go @@ -3,8 +3,8 @@ package provisioning import ( "reflect" + "github.com/go-playground/validator/v10" "github.com/lorenzodonini/ocpp-go/ocpp2.0.1/types" - "gopkg.in/go-playground/validator.v9" ) // -------------------- Notify Report (CS -> CSMS) -------------------- diff --git a/ocpp2.0.1/provisioning/reset.go b/ocpp2.0.1/provisioning/reset.go index 86d3bc66..e92d1b1c 100644 --- a/ocpp2.0.1/provisioning/reset.go +++ b/ocpp2.0.1/provisioning/reset.go @@ -3,8 +3,8 @@ package provisioning import ( "reflect" + "github.com/go-playground/validator/v10" "github.com/lorenzodonini/ocpp-go/ocpp2.0.1/types" - "gopkg.in/go-playground/validator.v9" ) // -------------------- Reset (CSMS -> CS) -------------------- diff --git a/ocpp2.0.1/provisioning/set_network_profile.go b/ocpp2.0.1/provisioning/set_network_profile.go index 867d7bf1..4a030ca1 100644 --- a/ocpp2.0.1/provisioning/set_network_profile.go +++ b/ocpp2.0.1/provisioning/set_network_profile.go @@ -3,8 +3,8 @@ package provisioning import ( "reflect" + "github.com/go-playground/validator/v10" "github.com/lorenzodonini/ocpp-go/ocpp2.0.1/types" - "gopkg.in/go-playground/validator.v9" ) // -------------------- Set Network Profile (CSMS -> CS) -------------------- diff --git a/ocpp2.0.1/provisioning/set_variables.go b/ocpp2.0.1/provisioning/set_variables.go index dfc100de..5010191f 100644 --- a/ocpp2.0.1/provisioning/set_variables.go +++ b/ocpp2.0.1/provisioning/set_variables.go @@ -3,8 +3,8 @@ package provisioning import ( "reflect" + "github.com/go-playground/validator/v10" "github.com/lorenzodonini/ocpp-go/ocpp2.0.1/types" - "gopkg.in/go-playground/validator.v9" ) // -------------------- Get Variable (CSMS -> CS) -------------------- diff --git a/ocpp2.0.1/remotecontrol/request_start_transaction.go b/ocpp2.0.1/remotecontrol/request_start_transaction.go index cbf92bd0..bdfd112a 100644 --- a/ocpp2.0.1/remotecontrol/request_start_transaction.go +++ b/ocpp2.0.1/remotecontrol/request_start_transaction.go @@ -3,8 +3,8 @@ package remotecontrol import ( "reflect" + "github.com/go-playground/validator/v10" "github.com/lorenzodonini/ocpp-go/ocpp2.0.1/types" - "gopkg.in/go-playground/validator.v9" ) // -------------------- Request Start Transaction (CSMS -> CS) -------------------- diff --git a/ocpp2.0.1/remotecontrol/trigger_message.go b/ocpp2.0.1/remotecontrol/trigger_message.go index ead9347c..20fc3de2 100644 --- a/ocpp2.0.1/remotecontrol/trigger_message.go +++ b/ocpp2.0.1/remotecontrol/trigger_message.go @@ -3,8 +3,8 @@ package remotecontrol import ( "reflect" + "github.com/go-playground/validator/v10" "github.com/lorenzodonini/ocpp-go/ocpp2.0.1/types" - "gopkg.in/go-playground/validator.v9" ) // -------------------- Trigger Message (CSMS -> CS) -------------------- diff --git a/ocpp2.0.1/remotecontrol/unlock_connector.go b/ocpp2.0.1/remotecontrol/unlock_connector.go index 07035285..ff508fd6 100644 --- a/ocpp2.0.1/remotecontrol/unlock_connector.go +++ b/ocpp2.0.1/remotecontrol/unlock_connector.go @@ -3,7 +3,7 @@ package remotecontrol import ( "reflect" - "gopkg.in/go-playground/validator.v9" + "github.com/go-playground/validator/v10" "github.com/lorenzodonini/ocpp-go/ocpp2.0.1/types" ) diff --git a/ocpp2.0.1/reservation/cancel_reservation.go b/ocpp2.0.1/reservation/cancel_reservation.go index e865ccea..46e34f19 100644 --- a/ocpp2.0.1/reservation/cancel_reservation.go +++ b/ocpp2.0.1/reservation/cancel_reservation.go @@ -3,7 +3,7 @@ package reservation import ( "reflect" - "gopkg.in/go-playground/validator.v9" + "github.com/go-playground/validator/v10" "github.com/lorenzodonini/ocpp-go/ocpp2.0.1/types" ) diff --git a/ocpp2.0.1/reservation/reservation_status_update.go b/ocpp2.0.1/reservation/reservation_status_update.go index aa9e7275..2d07824d 100644 --- a/ocpp2.0.1/reservation/reservation_status_update.go +++ b/ocpp2.0.1/reservation/reservation_status_update.go @@ -3,8 +3,8 @@ package reservation import ( "reflect" + "github.com/go-playground/validator/v10" "github.com/lorenzodonini/ocpp-go/ocpp2.0.1/types" - "gopkg.in/go-playground/validator.v9" ) // -------------------- Reservation Status Update (CS -> CSMS) -------------------- diff --git a/ocpp2.0.1/reservation/reserve_now.go b/ocpp2.0.1/reservation/reserve_now.go index bdac41fc..82cb823b 100644 --- a/ocpp2.0.1/reservation/reserve_now.go +++ b/ocpp2.0.1/reservation/reserve_now.go @@ -3,8 +3,8 @@ package reservation import ( "reflect" + "github.com/go-playground/validator/v10" "github.com/lorenzodonini/ocpp-go/ocpp2.0.1/types" - "gopkg.in/go-playground/validator.v9" ) // -------------------- Reserve Now (CSMS -> CS) -------------------- diff --git a/ocpp2.0.1/security/certificate_signed.go b/ocpp2.0.1/security/certificate_signed.go index 7bf62a79..5fc0ccc6 100644 --- a/ocpp2.0.1/security/certificate_signed.go +++ b/ocpp2.0.1/security/certificate_signed.go @@ -3,7 +3,7 @@ package security import ( "reflect" - "gopkg.in/go-playground/validator.v9" + "github.com/go-playground/validator/v10" "github.com/lorenzodonini/ocpp-go/ocpp2.0.1/types" ) diff --git a/ocpp2.0.1/smartcharging/clear_charging_profile.go b/ocpp2.0.1/smartcharging/clear_charging_profile.go index a366d132..48c52e19 100644 --- a/ocpp2.0.1/smartcharging/clear_charging_profile.go +++ b/ocpp2.0.1/smartcharging/clear_charging_profile.go @@ -3,7 +3,7 @@ package smartcharging import ( "reflect" - "gopkg.in/go-playground/validator.v9" + "github.com/go-playground/validator/v10" "github.com/lorenzodonini/ocpp-go/ocpp2.0.1/types" ) diff --git a/ocpp2.0.1/smartcharging/get_charging_profiles.go b/ocpp2.0.1/smartcharging/get_charging_profiles.go index 5f78e526..9f4dd6f4 100644 --- a/ocpp2.0.1/smartcharging/get_charging_profiles.go +++ b/ocpp2.0.1/smartcharging/get_charging_profiles.go @@ -3,7 +3,7 @@ package smartcharging import ( "reflect" - "gopkg.in/go-playground/validator.v9" + "github.com/go-playground/validator/v10" "github.com/lorenzodonini/ocpp-go/ocpp2.0.1/types" ) diff --git a/ocpp2.0.1/smartcharging/get_composite_schedule.go b/ocpp2.0.1/smartcharging/get_composite_schedule.go index 0827b85a..25b1e6a6 100644 --- a/ocpp2.0.1/smartcharging/get_composite_schedule.go +++ b/ocpp2.0.1/smartcharging/get_composite_schedule.go @@ -3,8 +3,8 @@ package smartcharging import ( "reflect" + "github.com/go-playground/validator/v10" "github.com/lorenzodonini/ocpp-go/ocpp2.0.1/types" - "gopkg.in/go-playground/validator.v9" ) // -------------------- Get Composite Schedule (CSMS -> CS) -------------------- diff --git a/ocpp2.0.1/smartcharging/notify_ev_charging_needs.go b/ocpp2.0.1/smartcharging/notify_ev_charging_needs.go index a83e7faf..dac1240f 100644 --- a/ocpp2.0.1/smartcharging/notify_ev_charging_needs.go +++ b/ocpp2.0.1/smartcharging/notify_ev_charging_needs.go @@ -3,8 +3,8 @@ package smartcharging import ( "reflect" + "github.com/go-playground/validator/v10" "github.com/lorenzodonini/ocpp-go/ocpp2.0.1/types" - "gopkg.in/go-playground/validator.v9" ) // -------------------- Notify EV Charging Needs (CS -> CSMS) -------------------- diff --git a/ocpp2.0.1/smartcharging/set_charging_profile.go b/ocpp2.0.1/smartcharging/set_charging_profile.go index c1adcf86..d9c6f5a7 100644 --- a/ocpp2.0.1/smartcharging/set_charging_profile.go +++ b/ocpp2.0.1/smartcharging/set_charging_profile.go @@ -3,8 +3,8 @@ package smartcharging import ( "reflect" + "github.com/go-playground/validator/v10" "github.com/lorenzodonini/ocpp-go/ocpp2.0.1/types" - "gopkg.in/go-playground/validator.v9" ) // -------------------- Set Charging Profile (CSMS -> CS) -------------------- diff --git a/ocpp2.0.1/transactions/transaction_event.go b/ocpp2.0.1/transactions/transaction_event.go index e759d179..5a4a91cb 100644 --- a/ocpp2.0.1/transactions/transaction_event.go +++ b/ocpp2.0.1/transactions/transaction_event.go @@ -3,8 +3,8 @@ package transactions import ( "reflect" + "github.com/go-playground/validator/v10" "github.com/lorenzodonini/ocpp-go/ocpp2.0.1/types" - "gopkg.in/go-playground/validator.v9" ) // -------------------- Transaction Event (CS -> CSMS) -------------------- diff --git a/ocpp2.0.1/types/types.go b/ocpp2.0.1/types/types.go index 017bf1c2..0fc875fe 100644 --- a/ocpp2.0.1/types/types.go +++ b/ocpp2.0.1/types/types.go @@ -2,7 +2,7 @@ package types import ( - "gopkg.in/go-playground/validator.v9" + "github.com/go-playground/validator/v10" "github.com/lorenzodonini/ocpp-go/ocppj" ) diff --git a/ocppj/client.go b/ocppj/client.go index ff2fc18c..49f5186c 100644 --- a/ocppj/client.go +++ b/ocppj/client.go @@ -4,7 +4,7 @@ import ( "errors" "fmt" - "gopkg.in/go-playground/validator.v9" + "github.com/go-playground/validator/v10" "github.com/lorenzodonini/ocpp-go/ocpp" "github.com/lorenzodonini/ocpp-go/ws" diff --git a/ocppj/dispatcher_test.go b/ocppj/dispatcher_test.go index a33d5162..7b100c5d 100644 --- a/ocppj/dispatcher_test.go +++ b/ocppj/dispatcher_test.go @@ -1,7 +1,7 @@ package ocppj_test import ( - "fmt" + "errors" "sync" "time" @@ -95,7 +95,7 @@ func (s *ServerDispatcherTestSuite) TestServerRequestCanceled() { id, _ := args.Get(0).(string) assert.Equal(t, clientID, id) <-writeC - }).Return(fmt.Errorf(errMsg)) + }).Return(errors.New(errMsg)) // Create mock request req := newMockRequest("somevalue") call, err := s.endpoint.CreateCall(req) @@ -293,7 +293,7 @@ func (c *ClientDispatcherTestSuite) TestClientRequestCanceled() { errMsg := "mockError" c.websocketClient.On("Write", mock.Anything).Run(func(args mock.Arguments) { <-writeC - }).Return(fmt.Errorf(errMsg)) + }).Return(errors.New(errMsg)) // Create mock request req := newMockRequest("somevalue") call, err := c.endpoint.CreateCall(req) diff --git a/ocppj/mocks/mock_CanceledRequestHandler.go b/ocppj/mocks/mock_CanceledRequestHandler.go index be1be073..0e38e85f 100644 --- a/ocppj/mocks/mock_CanceledRequestHandler.go +++ b/ocppj/mocks/mock_CanceledRequestHandler.go @@ -1,4 +1,4 @@ -// Code generated by mockery v2.51.0. DO NOT EDIT. +// Code generated by mockery v2.53.4. DO NOT EDIT. package mocks diff --git a/ocppj/mocks/mock_ClientDispatcher.go b/ocppj/mocks/mock_ClientDispatcher.go index 0dd86eff..395aff88 100644 --- a/ocppj/mocks/mock_ClientDispatcher.go +++ b/ocppj/mocks/mock_ClientDispatcher.go @@ -1,4 +1,4 @@ -// Code generated by mockery v2.51.0. DO NOT EDIT. +// Code generated by mockery v2.53.4. DO NOT EDIT. package mocks diff --git a/ocppj/mocks/mock_ClientHandler.go b/ocppj/mocks/mock_ClientHandler.go index f08a868f..236bc6f7 100644 --- a/ocppj/mocks/mock_ClientHandler.go +++ b/ocppj/mocks/mock_ClientHandler.go @@ -1,4 +1,4 @@ -// Code generated by mockery v2.51.0. DO NOT EDIT. +// Code generated by mockery v2.53.4. DO NOT EDIT. package mocks diff --git a/ocppj/mocks/mock_ClientState.go b/ocppj/mocks/mock_ClientState.go index d07d228c..48f3eac4 100644 --- a/ocppj/mocks/mock_ClientState.go +++ b/ocppj/mocks/mock_ClientState.go @@ -1,4 +1,4 @@ -// Code generated by mockery v2.51.0. DO NOT EDIT. +// Code generated by mockery v2.53.4. DO NOT EDIT. package mocks diff --git a/ocppj/mocks/mock_ErrorHandler.go b/ocppj/mocks/mock_ErrorHandler.go index 3d956910..394b4e9d 100644 --- a/ocppj/mocks/mock_ErrorHandler.go +++ b/ocppj/mocks/mock_ErrorHandler.go @@ -1,4 +1,4 @@ -// Code generated by mockery v2.51.0. DO NOT EDIT. +// Code generated by mockery v2.53.4. DO NOT EDIT. package mocks diff --git a/ocppj/mocks/mock_InvalidMessageHook.go b/ocppj/mocks/mock_InvalidMessageHook.go index 1e82f54e..3540afa7 100644 --- a/ocppj/mocks/mock_InvalidMessageHook.go +++ b/ocppj/mocks/mock_InvalidMessageHook.go @@ -1,4 +1,4 @@ -// Code generated by mockery v2.51.0. DO NOT EDIT. +// Code generated by mockery v2.53.4. DO NOT EDIT. package mocks diff --git a/ocppj/mocks/mock_Message.go b/ocppj/mocks/mock_Message.go index d741881a..9e6b3de1 100644 --- a/ocppj/mocks/mock_Message.go +++ b/ocppj/mocks/mock_Message.go @@ -1,4 +1,4 @@ -// Code generated by mockery v2.51.0. DO NOT EDIT. +// Code generated by mockery v2.53.4. DO NOT EDIT. package mocks diff --git a/ocppj/mocks/mock_RequestHandler.go b/ocppj/mocks/mock_RequestHandler.go index 5753bfe8..f49886d6 100644 --- a/ocppj/mocks/mock_RequestHandler.go +++ b/ocppj/mocks/mock_RequestHandler.go @@ -1,4 +1,4 @@ -// Code generated by mockery v2.51.0. DO NOT EDIT. +// Code generated by mockery v2.53.4. DO NOT EDIT. package mocks diff --git a/ocppj/mocks/mock_RequestQueue.go b/ocppj/mocks/mock_RequestQueue.go index 298a42de..9ee6c42e 100644 --- a/ocppj/mocks/mock_RequestQueue.go +++ b/ocppj/mocks/mock_RequestQueue.go @@ -1,4 +1,4 @@ -// Code generated by mockery v2.51.0. DO NOT EDIT. +// Code generated by mockery v2.53.4. DO NOT EDIT. package mocks diff --git a/ocppj/mocks/mock_ResponseHandler.go b/ocppj/mocks/mock_ResponseHandler.go index 038f3a96..d1777a47 100644 --- a/ocppj/mocks/mock_ResponseHandler.go +++ b/ocppj/mocks/mock_ResponseHandler.go @@ -1,4 +1,4 @@ -// Code generated by mockery v2.51.0. DO NOT EDIT. +// Code generated by mockery v2.53.4. DO NOT EDIT. package mocks diff --git a/ocppj/mocks/mock_ServerDispatcher.go b/ocppj/mocks/mock_ServerDispatcher.go index 85d0f206..5c11636c 100644 --- a/ocppj/mocks/mock_ServerDispatcher.go +++ b/ocppj/mocks/mock_ServerDispatcher.go @@ -1,4 +1,4 @@ -// Code generated by mockery v2.51.0. DO NOT EDIT. +// Code generated by mockery v2.53.4. DO NOT EDIT. package mocks diff --git a/ocppj/mocks/mock_ServerQueueMap.go b/ocppj/mocks/mock_ServerQueueMap.go index d44b8cf7..ffe36837 100644 --- a/ocppj/mocks/mock_ServerQueueMap.go +++ b/ocppj/mocks/mock_ServerQueueMap.go @@ -1,4 +1,4 @@ -// Code generated by mockery v2.51.0. DO NOT EDIT. +// Code generated by mockery v2.53.4. DO NOT EDIT. package mocks diff --git a/ocppj/mocks/mock_ServerState.go b/ocppj/mocks/mock_ServerState.go index db612eee..cd0f4ddc 100644 --- a/ocppj/mocks/mock_ServerState.go +++ b/ocppj/mocks/mock_ServerState.go @@ -1,4 +1,4 @@ -// Code generated by mockery v2.51.0. DO NOT EDIT. +// Code generated by mockery v2.53.4. DO NOT EDIT. package mocks diff --git a/ocppj/mocks/mock_dialector.go b/ocppj/mocks/mock_dialector.go index 0d12e982..fcfc5543 100644 --- a/ocppj/mocks/mock_dialector.go +++ b/ocppj/mocks/mock_dialector.go @@ -1,4 +1,4 @@ -// Code generated by mockery v2.51.0. DO NOT EDIT. +// Code generated by mockery v2.53.4. DO NOT EDIT. package mocks diff --git a/ocppj/ocppj.go b/ocppj/ocppj.go index 3591f95e..9728866f 100644 --- a/ocppj/ocppj.go +++ b/ocppj/ocppj.go @@ -10,7 +10,7 @@ import ( "github.com/lorenzodonini/ocpp-go/logging" - "gopkg.in/go-playground/validator.v9" + "github.com/go-playground/validator/v10" "github.com/lorenzodonini/ocpp-go/ocpp" ) diff --git a/ocppj/ocppj_test.go b/ocppj/ocppj_test.go index cae20e56..fcd727bf 100644 --- a/ocppj/ocppj_test.go +++ b/ocppj/ocppj_test.go @@ -11,6 +11,7 @@ import ( "github.com/lorenzodonini/ocpp-go/logging" + "github.com/go-playground/validator/v10" "github.com/lorenzodonini/ocpp-go/ocpp" "github.com/lorenzodonini/ocpp-go/ocppj" "github.com/lorenzodonini/ocpp-go/ws" @@ -18,7 +19,6 @@ import ( "github.com/stretchr/testify/mock" "github.com/stretchr/testify/require" "github.com/stretchr/testify/suite" - "gopkg.in/go-playground/validator.v9" ) // ---------------------- MOCK WEBSOCKET ---------------------- diff --git a/ocppj/server.go b/ocppj/server.go index 2b0365da..b6f02d0c 100644 --- a/ocppj/server.go +++ b/ocppj/server.go @@ -4,7 +4,7 @@ import ( "errors" "fmt" - "gopkg.in/go-playground/validator.v9" + "github.com/go-playground/validator/v10" "github.com/lorenzodonini/ocpp-go/ocpp" "github.com/lorenzodonini/ocpp-go/ws" diff --git a/ws/mocks/mock_Channel.go b/ws/mocks/mock_Channel.go index cf5d228e..c88e2723 100644 --- a/ws/mocks/mock_Channel.go +++ b/ws/mocks/mock_Channel.go @@ -1,4 +1,4 @@ -// Code generated by mockery v2.51.0. DO NOT EDIT. +// Code generated by mockery v2.53.4. DO NOT EDIT. package mocks diff --git a/ws/mocks/mock_CheckClientHandler.go b/ws/mocks/mock_CheckClientHandler.go index 56e1d614..aa6f257b 100644 --- a/ws/mocks/mock_CheckClientHandler.go +++ b/ws/mocks/mock_CheckClientHandler.go @@ -1,4 +1,4 @@ -// Code generated by mockery v2.51.0. DO NOT EDIT. +// Code generated by mockery v2.53.4. DO NOT EDIT. package mocks diff --git a/ws/mocks/mock_Client.go b/ws/mocks/mock_Client.go index 3d0dc510..d69b347c 100644 --- a/ws/mocks/mock_Client.go +++ b/ws/mocks/mock_Client.go @@ -1,4 +1,4 @@ -// Code generated by mockery v2.51.0. DO NOT EDIT. +// Code generated by mockery v2.53.4. DO NOT EDIT. package mocks diff --git a/ws/mocks/mock_ClientOpt.go b/ws/mocks/mock_ClientOpt.go index 2272797c..b04b15b3 100644 --- a/ws/mocks/mock_ClientOpt.go +++ b/ws/mocks/mock_ClientOpt.go @@ -1,4 +1,4 @@ -// Code generated by mockery v2.51.0. DO NOT EDIT. +// Code generated by mockery v2.53.4. DO NOT EDIT. package mocks diff --git a/ws/mocks/mock_ConnectedHandler.go b/ws/mocks/mock_ConnectedHandler.go index 51c89a66..31777563 100644 --- a/ws/mocks/mock_ConnectedHandler.go +++ b/ws/mocks/mock_ConnectedHandler.go @@ -1,4 +1,4 @@ -// Code generated by mockery v2.51.0. DO NOT EDIT. +// Code generated by mockery v2.53.4. DO NOT EDIT. package mocks diff --git a/ws/mocks/mock_DisconnectedHandler.go b/ws/mocks/mock_DisconnectedHandler.go index a2026741..ad43a3e4 100644 --- a/ws/mocks/mock_DisconnectedHandler.go +++ b/ws/mocks/mock_DisconnectedHandler.go @@ -1,4 +1,4 @@ -// Code generated by mockery v2.51.0. DO NOT EDIT. +// Code generated by mockery v2.53.4. DO NOT EDIT. package mocks diff --git a/ws/mocks/mock_ErrorHandler.go b/ws/mocks/mock_ErrorHandler.go index 2f289861..3b398b4f 100644 --- a/ws/mocks/mock_ErrorHandler.go +++ b/ws/mocks/mock_ErrorHandler.go @@ -1,4 +1,4 @@ -// Code generated by mockery v2.51.0. DO NOT EDIT. +// Code generated by mockery v2.53.4. DO NOT EDIT. package mocks diff --git a/ws/mocks/mock_MessageHandler.go b/ws/mocks/mock_MessageHandler.go index 7f1000c5..6d312375 100644 --- a/ws/mocks/mock_MessageHandler.go +++ b/ws/mocks/mock_MessageHandler.go @@ -1,4 +1,4 @@ -// Code generated by mockery v2.51.0. DO NOT EDIT. +// Code generated by mockery v2.53.4. DO NOT EDIT. package mocks diff --git a/ws/mocks/mock_Server.go b/ws/mocks/mock_Server.go index f8ffe9aa..f726557f 100644 --- a/ws/mocks/mock_Server.go +++ b/ws/mocks/mock_Server.go @@ -1,4 +1,4 @@ -// Code generated by mockery v2.51.0. DO NOT EDIT. +// Code generated by mockery v2.53.4. DO NOT EDIT. package mocks diff --git a/ws/mocks/mock_ServerOpt.go b/ws/mocks/mock_ServerOpt.go index 8c1ce686..83575906 100644 --- a/ws/mocks/mock_ServerOpt.go +++ b/ws/mocks/mock_ServerOpt.go @@ -1,4 +1,4 @@ -// Code generated by mockery v2.51.0. DO NOT EDIT. +// Code generated by mockery v2.53.4. DO NOT EDIT. package mocks From ac33c9061ce0b3f46d154ab265f778f75e393e04 Mon Sep 17 00:00:00 2001 From: Damien Date: Tue, 17 Jun 2025 15:17:55 +1100 Subject: [PATCH 2/3] mocks: used mockery tool, exposed Server and Client implementation so generated mocks are valid --- mockery.go | 3 + ws/client.go | 50 +-- ws/mocks/mock_ClientOpt.go | 15 +- ws/mocks/mock_ServerOpt.go | 15 +- ws/mocks/mock_WsClient.go | 550 --------------------------------- ws/mocks/mock_WsServer.go | 607 ------------------------------------- ws/network_test.go | 4 +- ws/server.go | 56 ++-- ws/websocket_test.go | 28 +- 9 files changed, 90 insertions(+), 1238 deletions(-) create mode 100644 mockery.go delete mode 100644 ws/mocks/mock_WsClient.go delete mode 100644 ws/mocks/mock_WsServer.go diff --git a/mockery.go b/mockery.go new file mode 100644 index 00000000..deecb4d7 --- /dev/null +++ b/mockery.go @@ -0,0 +1,3 @@ +package ocppgo + +//go:generate go tool mockery diff --git a/ws/client.go b/ws/client.go index 1d224c80..65f2277b 100644 --- a/ws/client.go +++ b/ws/client.go @@ -120,10 +120,10 @@ type Client interface { SetHeaderValue(key string, value string) } -// client is the default implementation of a Websocket client. +// ClientImpl is the default implementation of a Websocket ClientImpl. // -// Use the NewClient function to create a new client. -type client struct { +// Use the NewClient function to create a new ClientImpl. +type ClientImpl struct { webSocket *webSocket url url.URL messageHandler func(data []byte) error @@ -137,12 +137,12 @@ type client struct { } // ClientOpt is a function that can be used to set options on a client during creation. -type ClientOpt func(c *client) +type ClientOpt func(c *ClientImpl) // WithClientTLSConfig sets the TLS configuration for the client. // If the passed tlsConfig is nil, the client will not use TLS. func WithClientTLSConfig(tlsConfig *tls.Config) ClientOpt { - return func(c *client) { + return func(c *ClientImpl) { if tlsConfig != nil { c.dialOptions = append(c.dialOptions, func(dialer *websocket.Dialer) { dialer.TLSClientConfig = tlsConfig @@ -178,7 +178,7 @@ func WithClientTLSConfig(tlsConfig *tls.Config) ClientOpt { // // InsecureSkipVerify: true func NewClient(opts ...ClientOpt) Client { - c := &client{ + c := &ClientImpl{ dialOptions: []func(*websocket.Dialer){}, timeoutConfig: NewClientTimeoutConfig(), reconnectC: make(chan struct{}, 1), @@ -190,30 +190,30 @@ func NewClient(opts ...ClientOpt) Client { return c } -func (c *client) SetMessageHandler(handler func(data []byte) error) { +func (c *ClientImpl) SetMessageHandler(handler func(data []byte) error) { c.messageHandler = handler } -func (c *client) SetTimeoutConfig(config ClientTimeoutConfig) { +func (c *ClientImpl) SetTimeoutConfig(config ClientTimeoutConfig) { c.timeoutConfig = config } -func (c *client) SetDisconnectedHandler(handler func(err error)) { +func (c *ClientImpl) SetDisconnectedHandler(handler func(err error)) { c.onDisconnected = handler } -func (c *client) SetReconnectedHandler(handler func()) { +func (c *ClientImpl) SetReconnectedHandler(handler func()) { c.onReconnected = handler } -func (c *client) AddOption(option interface{}) { +func (c *ClientImpl) AddOption(option interface{}) { dialOption, ok := option.(func(*websocket.Dialer)) if ok { c.dialOptions = append(c.dialOptions, dialOption) } } -func (c *client) SetRequestedSubProtocol(subProto string) { +func (c *ClientImpl) SetRequestedSubProtocol(subProto string) { opt := func(dialer *websocket.Dialer) { alreadyExists := false for _, proto := range dialer.Subprotocols { @@ -229,22 +229,22 @@ func (c *client) SetRequestedSubProtocol(subProto string) { c.AddOption(opt) } -func (c *client) SetBasicAuth(username string, password string) { +func (c *ClientImpl) SetBasicAuth(username string, password string) { c.header.Set("Authorization", "Basic "+base64.StdEncoding.EncodeToString([]byte(username+":"+password))) } -func (c *client) SetHeaderValue(key string, value string) { +func (c *ClientImpl) SetHeaderValue(key string, value string) { c.header.Set(key, value) } -func (c *client) getReadTimeout() time.Time { +func (c *ClientImpl) getReadTimeout() time.Time { if c.timeoutConfig.PongWait == 0 { return time.Time{} } return time.Now().Add(c.timeoutConfig.PongWait) } -func (c *client) handleReconnection() { +func (c *ClientImpl) handleReconnection() { log.Info("started automatic reconnection handler") delay := c.timeoutConfig.RetryBackOffWaitMinimum + time.Duration(rand.Intn(c.timeoutConfig.RetryBackOffRandomRange+1))*time.Second reconnectionAttempts := 1 @@ -278,14 +278,14 @@ func (c *client) handleReconnection() { } } -func (c *client) IsConnected() bool { +func (c *ClientImpl) IsConnected() bool { if c.webSocket == nil { return false } return c.webSocket.IsConnected() } -func (c *client) Write(data []byte) error { +func (c *ClientImpl) Write(data []byte) error { if !c.IsConnected() { return fmt.Errorf("client is currently not connected, cannot send data") } @@ -293,7 +293,7 @@ func (c *client) Write(data []byte) error { return c.webSocket.Write(data) } -func (c *client) StartWithRetries(urlStr string) { +func (c *ClientImpl) StartWithRetries(urlStr string) { err := c.Start(urlStr) if err != nil { log.Info("Connection error:", err) @@ -301,7 +301,7 @@ func (c *client) StartWithRetries(urlStr string) { } } -func (c *client) Start(urlStr string) error { +func (c *ClientImpl) Start(urlStr string) error { u, err := url.Parse(urlStr) if err != nil { return err @@ -363,7 +363,7 @@ func (c *client) Start(urlStr string) error { return nil } -func (c *client) Stop() { +func (c *ClientImpl) Stop() { log.Infof("closing connection to server") if c.IsConnected() { // Attempt to gracefully shut down the connection @@ -395,7 +395,7 @@ func (c *client) Stop() { // Connection will close asynchronously and invoke the onDisconnected handler } -func (c *client) Errors() <-chan error { +func (c *ClientImpl) Errors() <-chan error { if c.errC == nil { c.errC = make(chan error, 1) } @@ -403,14 +403,14 @@ func (c *client) Errors() <-chan error { } // --------- Internal callbacks webSocket -> client --------- -func (c *client) handleMessage(_ Channel, data []byte) error { +func (c *ClientImpl) handleMessage(_ Channel, data []byte) error { if c.messageHandler != nil { return c.messageHandler(data) } return fmt.Errorf("no message handler set") } -func (c *client) handleDisconnect(_ Channel, err error) { +func (c *ClientImpl) handleDisconnect(_ Channel, err error) { if c.onDisconnected != nil { // Notify upper layer of disconnect c.onDisconnected(err) @@ -421,7 +421,7 @@ func (c *client) handleDisconnect(_ Channel, err error) { } } -func (c *client) error(err error) { +func (c *ClientImpl) error(err error) { log.Error(err) if c.errC != nil { c.errC <- err diff --git a/ws/mocks/mock_ClientOpt.go b/ws/mocks/mock_ClientOpt.go index b04b15b3..06b0149b 100644 --- a/ws/mocks/mock_ClientOpt.go +++ b/ws/mocks/mock_ClientOpt.go @@ -2,7 +2,10 @@ package mocks -import mock "github.com/stretchr/testify/mock" +import ( + ws "github.com/lorenzodonini/ocpp-go/ws" + mock "github.com/stretchr/testify/mock" +) // MockClientOpt is an autogenerated mock type for the ClientOpt type type MockClientOpt struct { @@ -18,7 +21,7 @@ func (_m *MockClientOpt) EXPECT() *MockClientOpt_Expecter { } // Execute provides a mock function with given fields: c -func (_m *MockClientOpt) Execute(c *ws.client) { +func (_m *MockClientOpt) Execute(c *ws.ClientImpl) { _m.Called(c) } @@ -28,14 +31,14 @@ type MockClientOpt_Execute_Call struct { } // Execute is a helper method to define mock.On call -// - c *ws.client +// - c *ws.ClientImpl func (_e *MockClientOpt_Expecter) Execute(c interface{}) *MockClientOpt_Execute_Call { return &MockClientOpt_Execute_Call{Call: _e.mock.On("Execute", c)} } -func (_c *MockClientOpt_Execute_Call) Run(run func(c *ws.client)) *MockClientOpt_Execute_Call { +func (_c *MockClientOpt_Execute_Call) Run(run func(c *ws.ClientImpl)) *MockClientOpt_Execute_Call { _c.Call.Run(func(args mock.Arguments) { - run(args[0].(*ws.client)) + run(args[0].(*ws.ClientImpl)) }) return _c } @@ -45,7 +48,7 @@ func (_c *MockClientOpt_Execute_Call) Return() *MockClientOpt_Execute_Call { return _c } -func (_c *MockClientOpt_Execute_Call) RunAndReturn(run func(*ws.client)) *MockClientOpt_Execute_Call { +func (_c *MockClientOpt_Execute_Call) RunAndReturn(run func(*ws.ClientImpl)) *MockClientOpt_Execute_Call { _c.Run(run) return _c } diff --git a/ws/mocks/mock_ServerOpt.go b/ws/mocks/mock_ServerOpt.go index 83575906..66be735b 100644 --- a/ws/mocks/mock_ServerOpt.go +++ b/ws/mocks/mock_ServerOpt.go @@ -2,7 +2,10 @@ package mocks -import mock "github.com/stretchr/testify/mock" +import ( + ws "github.com/lorenzodonini/ocpp-go/ws" + mock "github.com/stretchr/testify/mock" +) // MockServerOpt is an autogenerated mock type for the ServerOpt type type MockServerOpt struct { @@ -18,7 +21,7 @@ func (_m *MockServerOpt) EXPECT() *MockServerOpt_Expecter { } // Execute provides a mock function with given fields: s -func (_m *MockServerOpt) Execute(s *ws.server) { +func (_m *MockServerOpt) Execute(s *ws.ServerImpl) { _m.Called(s) } @@ -28,14 +31,14 @@ type MockServerOpt_Execute_Call struct { } // Execute is a helper method to define mock.On call -// - s *ws.server +// - s *ws.ServerImpl func (_e *MockServerOpt_Expecter) Execute(s interface{}) *MockServerOpt_Execute_Call { return &MockServerOpt_Execute_Call{Call: _e.mock.On("Execute", s)} } -func (_c *MockServerOpt_Execute_Call) Run(run func(s *ws.server)) *MockServerOpt_Execute_Call { +func (_c *MockServerOpt_Execute_Call) Run(run func(s *ws.ServerImpl)) *MockServerOpt_Execute_Call { _c.Call.Run(func(args mock.Arguments) { - run(args[0].(*ws.server)) + run(args[0].(*ws.ServerImpl)) }) return _c } @@ -45,7 +48,7 @@ func (_c *MockServerOpt_Execute_Call) Return() *MockServerOpt_Execute_Call { return _c } -func (_c *MockServerOpt_Execute_Call) RunAndReturn(run func(*ws.server)) *MockServerOpt_Execute_Call { +func (_c *MockServerOpt_Execute_Call) RunAndReturn(run func(*ws.ServerImpl)) *MockServerOpt_Execute_Call { _c.Run(run) return _c } diff --git a/ws/mocks/mock_WsClient.go b/ws/mocks/mock_WsClient.go deleted file mode 100644 index 40a32fb9..00000000 --- a/ws/mocks/mock_WsClient.go +++ /dev/null @@ -1,550 +0,0 @@ -// Code generated by mockery v2.51.0. DO NOT EDIT. - -package mocks - -import ( - ws "github.com/lorenzodonini/ocpp-go/ws" - mock "github.com/stretchr/testify/mock" -) - -// MockWsClient is an autogenerated mock type for the WsClient type -type MockWsClient struct { - mock.Mock -} - -type MockWsClient_Expecter struct { - mock *mock.Mock -} - -func (_m *MockWsClient) EXPECT() *MockWsClient_Expecter { - return &MockWsClient_Expecter{mock: &_m.Mock} -} - -// AddOption provides a mock function with given fields: option -func (_m *MockWsClient) AddOption(option interface{}) { - _m.Called(option) -} - -// MockWsClient_AddOption_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'AddOption' -type MockWsClient_AddOption_Call struct { - *mock.Call -} - -// AddOption is a helper method to define mock.On call -// - option interface{} -func (_e *MockWsClient_Expecter) AddOption(option interface{}) *MockWsClient_AddOption_Call { - return &MockWsClient_AddOption_Call{Call: _e.mock.On("AddOption", option)} -} - -func (_c *MockWsClient_AddOption_Call) Run(run func(option interface{})) *MockWsClient_AddOption_Call { - _c.Call.Run(func(args mock.Arguments) { - run(args[0].(interface{})) - }) - return _c -} - -func (_c *MockWsClient_AddOption_Call) Return() *MockWsClient_AddOption_Call { - _c.Call.Return() - return _c -} - -func (_c *MockWsClient_AddOption_Call) RunAndReturn(run func(interface{})) *MockWsClient_AddOption_Call { - _c.Run(run) - return _c -} - -// Errors provides a mock function with no fields -func (_m *MockWsClient) Errors() <-chan error { - ret := _m.Called() - - if len(ret) == 0 { - panic("no return value specified for Errors") - } - - var r0 <-chan error - if rf, ok := ret.Get(0).(func() <-chan error); ok { - r0 = rf() - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(<-chan error) - } - } - - return r0 -} - -// MockWsClient_Errors_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Errors' -type MockWsClient_Errors_Call struct { - *mock.Call -} - -// Errors is a helper method to define mock.On call -func (_e *MockWsClient_Expecter) Errors() *MockWsClient_Errors_Call { - return &MockWsClient_Errors_Call{Call: _e.mock.On("Errors")} -} - -func (_c *MockWsClient_Errors_Call) Run(run func()) *MockWsClient_Errors_Call { - _c.Call.Run(func(args mock.Arguments) { - run() - }) - return _c -} - -func (_c *MockWsClient_Errors_Call) Return(_a0 <-chan error) *MockWsClient_Errors_Call { - _c.Call.Return(_a0) - return _c -} - -func (_c *MockWsClient_Errors_Call) RunAndReturn(run func() <-chan error) *MockWsClient_Errors_Call { - _c.Call.Return(run) - return _c -} - -// IsConnected provides a mock function with no fields -func (_m *MockWsClient) IsConnected() bool { - ret := _m.Called() - - if len(ret) == 0 { - panic("no return value specified for IsConnected") - } - - var r0 bool - if rf, ok := ret.Get(0).(func() bool); ok { - r0 = rf() - } else { - r0 = ret.Get(0).(bool) - } - - return r0 -} - -// MockWsClient_IsConnected_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'IsConnected' -type MockWsClient_IsConnected_Call struct { - *mock.Call -} - -// IsConnected is a helper method to define mock.On call -func (_e *MockWsClient_Expecter) IsConnected() *MockWsClient_IsConnected_Call { - return &MockWsClient_IsConnected_Call{Call: _e.mock.On("IsConnected")} -} - -func (_c *MockWsClient_IsConnected_Call) Run(run func()) *MockWsClient_IsConnected_Call { - _c.Call.Run(func(args mock.Arguments) { - run() - }) - return _c -} - -func (_c *MockWsClient_IsConnected_Call) Return(_a0 bool) *MockWsClient_IsConnected_Call { - _c.Call.Return(_a0) - return _c -} - -func (_c *MockWsClient_IsConnected_Call) RunAndReturn(run func() bool) *MockWsClient_IsConnected_Call { - _c.Call.Return(run) - return _c -} - -// SetBasicAuth provides a mock function with given fields: username, password -func (_m *MockWsClient) SetBasicAuth(username string, password string) { - _m.Called(username, password) -} - -// MockWsClient_SetBasicAuth_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'SetBasicAuth' -type MockWsClient_SetBasicAuth_Call struct { - *mock.Call -} - -// SetBasicAuth is a helper method to define mock.On call -// - username string -// - password string -func (_e *MockWsClient_Expecter) SetBasicAuth(username interface{}, password interface{}) *MockWsClient_SetBasicAuth_Call { - return &MockWsClient_SetBasicAuth_Call{Call: _e.mock.On("SetBasicAuth", username, password)} -} - -func (_c *MockWsClient_SetBasicAuth_Call) Run(run func(username string, password string)) *MockWsClient_SetBasicAuth_Call { - _c.Call.Run(func(args mock.Arguments) { - run(args[0].(string), args[1].(string)) - }) - return _c -} - -func (_c *MockWsClient_SetBasicAuth_Call) Return() *MockWsClient_SetBasicAuth_Call { - _c.Call.Return() - return _c -} - -func (_c *MockWsClient_SetBasicAuth_Call) RunAndReturn(run func(string, string)) *MockWsClient_SetBasicAuth_Call { - _c.Run(run) - return _c -} - -// SetDisconnectedHandler provides a mock function with given fields: handler -func (_m *MockWsClient) SetDisconnectedHandler(handler func(error)) { - _m.Called(handler) -} - -// MockWsClient_SetDisconnectedHandler_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'SetDisconnectedHandler' -type MockWsClient_SetDisconnectedHandler_Call struct { - *mock.Call -} - -// SetDisconnectedHandler is a helper method to define mock.On call -// - handler func(error) -func (_e *MockWsClient_Expecter) SetDisconnectedHandler(handler interface{}) *MockWsClient_SetDisconnectedHandler_Call { - return &MockWsClient_SetDisconnectedHandler_Call{Call: _e.mock.On("SetDisconnectedHandler", handler)} -} - -func (_c *MockWsClient_SetDisconnectedHandler_Call) Run(run func(handler func(error))) *MockWsClient_SetDisconnectedHandler_Call { - _c.Call.Run(func(args mock.Arguments) { - run(args[0].(func(error))) - }) - return _c -} - -func (_c *MockWsClient_SetDisconnectedHandler_Call) Return() *MockWsClient_SetDisconnectedHandler_Call { - _c.Call.Return() - return _c -} - -func (_c *MockWsClient_SetDisconnectedHandler_Call) RunAndReturn(run func(func(error))) *MockWsClient_SetDisconnectedHandler_Call { - _c.Run(run) - return _c -} - -// SetHeaderValue provides a mock function with given fields: key, value -func (_m *MockWsClient) SetHeaderValue(key string, value string) { - _m.Called(key, value) -} - -// MockWsClient_SetHeaderValue_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'SetHeaderValue' -type MockWsClient_SetHeaderValue_Call struct { - *mock.Call -} - -// SetHeaderValue is a helper method to define mock.On call -// - key string -// - value string -func (_e *MockWsClient_Expecter) SetHeaderValue(key interface{}, value interface{}) *MockWsClient_SetHeaderValue_Call { - return &MockWsClient_SetHeaderValue_Call{Call: _e.mock.On("SetHeaderValue", key, value)} -} - -func (_c *MockWsClient_SetHeaderValue_Call) Run(run func(key string, value string)) *MockWsClient_SetHeaderValue_Call { - _c.Call.Run(func(args mock.Arguments) { - run(args[0].(string), args[1].(string)) - }) - return _c -} - -func (_c *MockWsClient_SetHeaderValue_Call) Return() *MockWsClient_SetHeaderValue_Call { - _c.Call.Return() - return _c -} - -func (_c *MockWsClient_SetHeaderValue_Call) RunAndReturn(run func(string, string)) *MockWsClient_SetHeaderValue_Call { - _c.Run(run) - return _c -} - -// SetMessageHandler provides a mock function with given fields: handler -func (_m *MockWsClient) SetMessageHandler(handler func([]byte) error) { - _m.Called(handler) -} - -// MockWsClient_SetMessageHandler_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'SetMessageHandler' -type MockWsClient_SetMessageHandler_Call struct { - *mock.Call -} - -// SetMessageHandler is a helper method to define mock.On call -// - handler func([]byte) error -func (_e *MockWsClient_Expecter) SetMessageHandler(handler interface{}) *MockWsClient_SetMessageHandler_Call { - return &MockWsClient_SetMessageHandler_Call{Call: _e.mock.On("SetMessageHandler", handler)} -} - -func (_c *MockWsClient_SetMessageHandler_Call) Run(run func(handler func([]byte) error)) *MockWsClient_SetMessageHandler_Call { - _c.Call.Run(func(args mock.Arguments) { - run(args[0].(func([]byte) error)) - }) - return _c -} - -func (_c *MockWsClient_SetMessageHandler_Call) Return() *MockWsClient_SetMessageHandler_Call { - _c.Call.Return() - return _c -} - -func (_c *MockWsClient_SetMessageHandler_Call) RunAndReturn(run func(func([]byte) error)) *MockWsClient_SetMessageHandler_Call { - _c.Run(run) - return _c -} - -// SetReconnectedHandler provides a mock function with given fields: handler -func (_m *MockWsClient) SetReconnectedHandler(handler func()) { - _m.Called(handler) -} - -// MockWsClient_SetReconnectedHandler_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'SetReconnectedHandler' -type MockWsClient_SetReconnectedHandler_Call struct { - *mock.Call -} - -// SetReconnectedHandler is a helper method to define mock.On call -// - handler func() -func (_e *MockWsClient_Expecter) SetReconnectedHandler(handler interface{}) *MockWsClient_SetReconnectedHandler_Call { - return &MockWsClient_SetReconnectedHandler_Call{Call: _e.mock.On("SetReconnectedHandler", handler)} -} - -func (_c *MockWsClient_SetReconnectedHandler_Call) Run(run func(handler func())) *MockWsClient_SetReconnectedHandler_Call { - _c.Call.Run(func(args mock.Arguments) { - run(args[0].(func())) - }) - return _c -} - -func (_c *MockWsClient_SetReconnectedHandler_Call) Return() *MockWsClient_SetReconnectedHandler_Call { - _c.Call.Return() - return _c -} - -func (_c *MockWsClient_SetReconnectedHandler_Call) RunAndReturn(run func(func())) *MockWsClient_SetReconnectedHandler_Call { - _c.Run(run) - return _c -} - -// SetRequestedSubProtocol provides a mock function with given fields: subProto -func (_m *MockWsClient) SetRequestedSubProtocol(subProto string) { - _m.Called(subProto) -} - -// MockWsClient_SetRequestedSubProtocol_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'SetRequestedSubProtocol' -type MockWsClient_SetRequestedSubProtocol_Call struct { - *mock.Call -} - -// SetRequestedSubProtocol is a helper method to define mock.On call -// - subProto string -func (_e *MockWsClient_Expecter) SetRequestedSubProtocol(subProto interface{}) *MockWsClient_SetRequestedSubProtocol_Call { - return &MockWsClient_SetRequestedSubProtocol_Call{Call: _e.mock.On("SetRequestedSubProtocol", subProto)} -} - -func (_c *MockWsClient_SetRequestedSubProtocol_Call) Run(run func(subProto string)) *MockWsClient_SetRequestedSubProtocol_Call { - _c.Call.Run(func(args mock.Arguments) { - run(args[0].(string)) - }) - return _c -} - -func (_c *MockWsClient_SetRequestedSubProtocol_Call) Return() *MockWsClient_SetRequestedSubProtocol_Call { - _c.Call.Return() - return _c -} - -func (_c *MockWsClient_SetRequestedSubProtocol_Call) RunAndReturn(run func(string)) *MockWsClient_SetRequestedSubProtocol_Call { - _c.Run(run) - return _c -} - -// SetTimeoutConfig provides a mock function with given fields: config -func (_m *MockWsClient) SetTimeoutConfig(config ws.ClientTimeoutConfig) { - _m.Called(config) -} - -// MockWsClient_SetTimeoutConfig_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'SetTimeoutConfig' -type MockWsClient_SetTimeoutConfig_Call struct { - *mock.Call -} - -// SetTimeoutConfig is a helper method to define mock.On call -// - config ws.ClientTimeoutConfig -func (_e *MockWsClient_Expecter) SetTimeoutConfig(config interface{}) *MockWsClient_SetTimeoutConfig_Call { - return &MockWsClient_SetTimeoutConfig_Call{Call: _e.mock.On("SetTimeoutConfig", config)} -} - -func (_c *MockWsClient_SetTimeoutConfig_Call) Run(run func(config ws.ClientTimeoutConfig)) *MockWsClient_SetTimeoutConfig_Call { - _c.Call.Run(func(args mock.Arguments) { - run(args[0].(ws.ClientTimeoutConfig)) - }) - return _c -} - -func (_c *MockWsClient_SetTimeoutConfig_Call) Return() *MockWsClient_SetTimeoutConfig_Call { - _c.Call.Return() - return _c -} - -func (_c *MockWsClient_SetTimeoutConfig_Call) RunAndReturn(run func(ws.ClientTimeoutConfig)) *MockWsClient_SetTimeoutConfig_Call { - _c.Run(run) - return _c -} - -// Start provides a mock function with given fields: url -func (_m *MockWsClient) Start(url string) error { - ret := _m.Called(url) - - if len(ret) == 0 { - panic("no return value specified for Start") - } - - var r0 error - if rf, ok := ret.Get(0).(func(string) error); ok { - r0 = rf(url) - } else { - r0 = ret.Error(0) - } - - return r0 -} - -// MockWsClient_Start_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Start' -type MockWsClient_Start_Call struct { - *mock.Call -} - -// Start is a helper method to define mock.On call -// - url string -func (_e *MockWsClient_Expecter) Start(url interface{}) *MockWsClient_Start_Call { - return &MockWsClient_Start_Call{Call: _e.mock.On("Start", url)} -} - -func (_c *MockWsClient_Start_Call) Run(run func(url string)) *MockWsClient_Start_Call { - _c.Call.Run(func(args mock.Arguments) { - run(args[0].(string)) - }) - return _c -} - -func (_c *MockWsClient_Start_Call) Return(_a0 error) *MockWsClient_Start_Call { - _c.Call.Return(_a0) - return _c -} - -func (_c *MockWsClient_Start_Call) RunAndReturn(run func(string) error) *MockWsClient_Start_Call { - _c.Call.Return(run) - return _c -} - -// StartWithRetries provides a mock function with given fields: url -func (_m *MockWsClient) StartWithRetries(url string) { - _m.Called(url) -} - -// MockWsClient_StartWithRetries_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'StartWithRetries' -type MockWsClient_StartWithRetries_Call struct { - *mock.Call -} - -// StartWithRetries is a helper method to define mock.On call -// - url string -func (_e *MockWsClient_Expecter) StartWithRetries(url interface{}) *MockWsClient_StartWithRetries_Call { - return &MockWsClient_StartWithRetries_Call{Call: _e.mock.On("StartWithRetries", url)} -} - -func (_c *MockWsClient_StartWithRetries_Call) Run(run func(url string)) *MockWsClient_StartWithRetries_Call { - _c.Call.Run(func(args mock.Arguments) { - run(args[0].(string)) - }) - return _c -} - -func (_c *MockWsClient_StartWithRetries_Call) Return() *MockWsClient_StartWithRetries_Call { - _c.Call.Return() - return _c -} - -func (_c *MockWsClient_StartWithRetries_Call) RunAndReturn(run func(string)) *MockWsClient_StartWithRetries_Call { - _c.Run(run) - return _c -} - -// Stop provides a mock function with no fields -func (_m *MockWsClient) Stop() { - _m.Called() -} - -// MockWsClient_Stop_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Stop' -type MockWsClient_Stop_Call struct { - *mock.Call -} - -// Stop is a helper method to define mock.On call -func (_e *MockWsClient_Expecter) Stop() *MockWsClient_Stop_Call { - return &MockWsClient_Stop_Call{Call: _e.mock.On("Stop")} -} - -func (_c *MockWsClient_Stop_Call) Run(run func()) *MockWsClient_Stop_Call { - _c.Call.Run(func(args mock.Arguments) { - run() - }) - return _c -} - -func (_c *MockWsClient_Stop_Call) Return() *MockWsClient_Stop_Call { - _c.Call.Return() - return _c -} - -func (_c *MockWsClient_Stop_Call) RunAndReturn(run func()) *MockWsClient_Stop_Call { - _c.Run(run) - return _c -} - -// Write provides a mock function with given fields: data -func (_m *MockWsClient) Write(data []byte) error { - ret := _m.Called(data) - - if len(ret) == 0 { - panic("no return value specified for Write") - } - - var r0 error - if rf, ok := ret.Get(0).(func([]byte) error); ok { - r0 = rf(data) - } else { - r0 = ret.Error(0) - } - - return r0 -} - -// MockWsClient_Write_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Write' -type MockWsClient_Write_Call struct { - *mock.Call -} - -// Write is a helper method to define mock.On call -// - data []byte -func (_e *MockWsClient_Expecter) Write(data interface{}) *MockWsClient_Write_Call { - return &MockWsClient_Write_Call{Call: _e.mock.On("Write", data)} -} - -func (_c *MockWsClient_Write_Call) Run(run func(data []byte)) *MockWsClient_Write_Call { - _c.Call.Run(func(args mock.Arguments) { - run(args[0].([]byte)) - }) - return _c -} - -func (_c *MockWsClient_Write_Call) Return(_a0 error) *MockWsClient_Write_Call { - _c.Call.Return(_a0) - return _c -} - -func (_c *MockWsClient_Write_Call) RunAndReturn(run func([]byte) error) *MockWsClient_Write_Call { - _c.Call.Return(run) - return _c -} - -// NewMockWsClient creates a new instance of MockWsClient. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. -// The first argument is typically a *testing.T value. -func NewMockWsClient(t interface { - mock.TestingT - Cleanup(func()) -}) *MockWsClient { - mock := &MockWsClient{} - mock.Mock.Test(t) - - t.Cleanup(func() { mock.AssertExpectations(t) }) - - return mock -} diff --git a/ws/mocks/mock_WsServer.go b/ws/mocks/mock_WsServer.go deleted file mode 100644 index c382b211..00000000 --- a/ws/mocks/mock_WsServer.go +++ /dev/null @@ -1,607 +0,0 @@ -// Code generated by mockery v2.51.0. DO NOT EDIT. - -package mocks - -import ( - net "net" - http "net/http" - - mock "github.com/stretchr/testify/mock" - - websocket "github.com/gorilla/websocket" - - ws "github.com/lorenzodonini/ocpp-go/ws" -) - -// MockWsServer is an autogenerated mock type for the WsServer type -type MockWsServer struct { - mock.Mock -} - -type MockWsServer_Expecter struct { - mock *mock.Mock -} - -func (_m *MockWsServer) EXPECT() *MockWsServer_Expecter { - return &MockWsServer_Expecter{mock: &_m.Mock} -} - -// AddSupportedSubprotocol provides a mock function with given fields: subProto -func (_m *MockWsServer) AddSupportedSubprotocol(subProto string) { - _m.Called(subProto) -} - -// MockWsServer_AddSupportedSubprotocol_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'AddSupportedSubprotocol' -type MockWsServer_AddSupportedSubprotocol_Call struct { - *mock.Call -} - -// AddSupportedSubprotocol is a helper method to define mock.On call -// - subProto string -func (_e *MockWsServer_Expecter) AddSupportedSubprotocol(subProto interface{}) *MockWsServer_AddSupportedSubprotocol_Call { - return &MockWsServer_AddSupportedSubprotocol_Call{Call: _e.mock.On("AddSupportedSubprotocol", subProto)} -} - -func (_c *MockWsServer_AddSupportedSubprotocol_Call) Run(run func(subProto string)) *MockWsServer_AddSupportedSubprotocol_Call { - _c.Call.Run(func(args mock.Arguments) { - run(args[0].(string)) - }) - return _c -} - -func (_c *MockWsServer_AddSupportedSubprotocol_Call) Return() *MockWsServer_AddSupportedSubprotocol_Call { - _c.Call.Return() - return _c -} - -func (_c *MockWsServer_AddSupportedSubprotocol_Call) RunAndReturn(run func(string)) *MockWsServer_AddSupportedSubprotocol_Call { - _c.Run(run) - return _c -} - -// Addr provides a mock function with no fields -func (_m *MockWsServer) Addr() *net.TCPAddr { - ret := _m.Called() - - if len(ret) == 0 { - panic("no return value specified for Addr") - } - - var r0 *net.TCPAddr - if rf, ok := ret.Get(0).(func() *net.TCPAddr); ok { - r0 = rf() - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*net.TCPAddr) - } - } - - return r0 -} - -// MockWsServer_Addr_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Addr' -type MockWsServer_Addr_Call struct { - *mock.Call -} - -// Addr is a helper method to define mock.On call -func (_e *MockWsServer_Expecter) Addr() *MockWsServer_Addr_Call { - return &MockWsServer_Addr_Call{Call: _e.mock.On("Addr")} -} - -func (_c *MockWsServer_Addr_Call) Run(run func()) *MockWsServer_Addr_Call { - _c.Call.Run(func(args mock.Arguments) { - run() - }) - return _c -} - -func (_c *MockWsServer_Addr_Call) Return(_a0 *net.TCPAddr) *MockWsServer_Addr_Call { - _c.Call.Return(_a0) - return _c -} - -func (_c *MockWsServer_Addr_Call) RunAndReturn(run func() *net.TCPAddr) *MockWsServer_Addr_Call { - _c.Call.Return(run) - return _c -} - -// Connections provides a mock function with given fields: websocketId -func (_m *MockWsServer) Connections(websocketId string) *ws.WebSocket { - ret := _m.Called(websocketId) - - if len(ret) == 0 { - panic("no return value specified for Connections") - } - - var r0 *ws.WebSocket - if rf, ok := ret.Get(0).(func(string) *ws.WebSocket); ok { - r0 = rf(websocketId) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*ws.WebSocket) - } - } - - return r0 -} - -// MockWsServer_Connections_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Connections' -type MockWsServer_Connections_Call struct { - *mock.Call -} - -// Connections is a helper method to define mock.On call -// - websocketId string -func (_e *MockWsServer_Expecter) Connections(websocketId interface{}) *MockWsServer_Connections_Call { - return &MockWsServer_Connections_Call{Call: _e.mock.On("Connections", websocketId)} -} - -func (_c *MockWsServer_Connections_Call) Run(run func(websocketId string)) *MockWsServer_Connections_Call { - _c.Call.Run(func(args mock.Arguments) { - run(args[0].(string)) - }) - return _c -} - -func (_c *MockWsServer_Connections_Call) Return(_a0 *ws.WebSocket) *MockWsServer_Connections_Call { - _c.Call.Return(_a0) - return _c -} - -func (_c *MockWsServer_Connections_Call) RunAndReturn(run func(string) *ws.WebSocket) *MockWsServer_Connections_Call { - _c.Call.Return(run) - return _c -} - -// Errors provides a mock function with no fields -func (_m *MockWsServer) Errors() <-chan error { - ret := _m.Called() - - if len(ret) == 0 { - panic("no return value specified for Errors") - } - - var r0 <-chan error - if rf, ok := ret.Get(0).(func() <-chan error); ok { - r0 = rf() - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(<-chan error) - } - } - - return r0 -} - -// MockWsServer_Errors_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Errors' -type MockWsServer_Errors_Call struct { - *mock.Call -} - -// Errors is a helper method to define mock.On call -func (_e *MockWsServer_Expecter) Errors() *MockWsServer_Errors_Call { - return &MockWsServer_Errors_Call{Call: _e.mock.On("Errors")} -} - -func (_c *MockWsServer_Errors_Call) Run(run func()) *MockWsServer_Errors_Call { - _c.Call.Run(func(args mock.Arguments) { - run() - }) - return _c -} - -func (_c *MockWsServer_Errors_Call) Return(_a0 <-chan error) *MockWsServer_Errors_Call { - _c.Call.Return(_a0) - return _c -} - -func (_c *MockWsServer_Errors_Call) RunAndReturn(run func() <-chan error) *MockWsServer_Errors_Call { - _c.Call.Return(run) - return _c -} - -// SetBasicAuthHandler provides a mock function with given fields: handler -func (_m *MockWsServer) SetBasicAuthHandler(handler func(string, string) bool) { - _m.Called(handler) -} - -// MockWsServer_SetBasicAuthHandler_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'SetBasicAuthHandler' -type MockWsServer_SetBasicAuthHandler_Call struct { - *mock.Call -} - -// SetBasicAuthHandler is a helper method to define mock.On call -// - handler func(string , string) bool -func (_e *MockWsServer_Expecter) SetBasicAuthHandler(handler interface{}) *MockWsServer_SetBasicAuthHandler_Call { - return &MockWsServer_SetBasicAuthHandler_Call{Call: _e.mock.On("SetBasicAuthHandler", handler)} -} - -func (_c *MockWsServer_SetBasicAuthHandler_Call) Run(run func(handler func(string, string) bool)) *MockWsServer_SetBasicAuthHandler_Call { - _c.Call.Run(func(args mock.Arguments) { - run(args[0].(func(string, string) bool)) - }) - return _c -} - -func (_c *MockWsServer_SetBasicAuthHandler_Call) Return() *MockWsServer_SetBasicAuthHandler_Call { - _c.Call.Return() - return _c -} - -func (_c *MockWsServer_SetBasicAuthHandler_Call) RunAndReturn(run func(func(string, string) bool)) *MockWsServer_SetBasicAuthHandler_Call { - _c.Run(run) - return _c -} - -// SetCheckClientHandler provides a mock function with given fields: handler -func (_m *MockWsServer) SetCheckClientHandler(handler func(string, *http.Request) bool) { - _m.Called(handler) -} - -// MockWsServer_SetCheckClientHandler_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'SetCheckClientHandler' -type MockWsServer_SetCheckClientHandler_Call struct { - *mock.Call -} - -// SetCheckClientHandler is a helper method to define mock.On call -// - handler func(string , *http.Request) bool -func (_e *MockWsServer_Expecter) SetCheckClientHandler(handler interface{}) *MockWsServer_SetCheckClientHandler_Call { - return &MockWsServer_SetCheckClientHandler_Call{Call: _e.mock.On("SetCheckClientHandler", handler)} -} - -func (_c *MockWsServer_SetCheckClientHandler_Call) Run(run func(handler func(string, *http.Request) bool)) *MockWsServer_SetCheckClientHandler_Call { - _c.Call.Run(func(args mock.Arguments) { - run(args[0].(func(string, *http.Request) bool)) - }) - return _c -} - -func (_c *MockWsServer_SetCheckClientHandler_Call) Return() *MockWsServer_SetCheckClientHandler_Call { - _c.Call.Return() - return _c -} - -func (_c *MockWsServer_SetCheckClientHandler_Call) RunAndReturn(run func(func(string, *http.Request) bool)) *MockWsServer_SetCheckClientHandler_Call { - _c.Run(run) - return _c -} - -// SetCheckOriginHandler provides a mock function with given fields: handler -func (_m *MockWsServer) SetCheckOriginHandler(handler func(*http.Request) bool) { - _m.Called(handler) -} - -// MockWsServer_SetCheckOriginHandler_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'SetCheckOriginHandler' -type MockWsServer_SetCheckOriginHandler_Call struct { - *mock.Call -} - -// SetCheckOriginHandler is a helper method to define mock.On call -// - handler func(*http.Request) bool -func (_e *MockWsServer_Expecter) SetCheckOriginHandler(handler interface{}) *MockWsServer_SetCheckOriginHandler_Call { - return &MockWsServer_SetCheckOriginHandler_Call{Call: _e.mock.On("SetCheckOriginHandler", handler)} -} - -func (_c *MockWsServer_SetCheckOriginHandler_Call) Run(run func(handler func(*http.Request) bool)) *MockWsServer_SetCheckOriginHandler_Call { - _c.Call.Run(func(args mock.Arguments) { - run(args[0].(func(*http.Request) bool)) - }) - return _c -} - -func (_c *MockWsServer_SetCheckOriginHandler_Call) Return() *MockWsServer_SetCheckOriginHandler_Call { - _c.Call.Return() - return _c -} - -func (_c *MockWsServer_SetCheckOriginHandler_Call) RunAndReturn(run func(func(*http.Request) bool)) *MockWsServer_SetCheckOriginHandler_Call { - _c.Run(run) - return _c -} - -// SetDisconnectedClientHandler provides a mock function with given fields: handler -func (_m *MockWsServer) SetDisconnectedClientHandler(handler func(ws.Channel)) { - _m.Called(handler) -} - -// MockWsServer_SetDisconnectedClientHandler_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'SetDisconnectedClientHandler' -type MockWsServer_SetDisconnectedClientHandler_Call struct { - *mock.Call -} - -// SetDisconnectedClientHandler is a helper method to define mock.On call -// - handler func(ws.Channel) -func (_e *MockWsServer_Expecter) SetDisconnectedClientHandler(handler interface{}) *MockWsServer_SetDisconnectedClientHandler_Call { - return &MockWsServer_SetDisconnectedClientHandler_Call{Call: _e.mock.On("SetDisconnectedClientHandler", handler)} -} - -func (_c *MockWsServer_SetDisconnectedClientHandler_Call) Run(run func(handler func(ws.Channel))) *MockWsServer_SetDisconnectedClientHandler_Call { - _c.Call.Run(func(args mock.Arguments) { - run(args[0].(func(ws.Channel))) - }) - return _c -} - -func (_c *MockWsServer_SetDisconnectedClientHandler_Call) Return() *MockWsServer_SetDisconnectedClientHandler_Call { - _c.Call.Return() - return _c -} - -func (_c *MockWsServer_SetDisconnectedClientHandler_Call) RunAndReturn(run func(func(ws.Channel))) *MockWsServer_SetDisconnectedClientHandler_Call { - _c.Run(run) - return _c -} - -// SetMessageHandler provides a mock function with given fields: handler -func (_m *MockWsServer) SetMessageHandler(handler func(ws.Channel, []byte) error) { - _m.Called(handler) -} - -// MockWsServer_SetMessageHandler_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'SetMessageHandler' -type MockWsServer_SetMessageHandler_Call struct { - *mock.Call -} - -// SetMessageHandler is a helper method to define mock.On call -// - handler func(ws.Channel , []byte) error -func (_e *MockWsServer_Expecter) SetMessageHandler(handler interface{}) *MockWsServer_SetMessageHandler_Call { - return &MockWsServer_SetMessageHandler_Call{Call: _e.mock.On("SetMessageHandler", handler)} -} - -func (_c *MockWsServer_SetMessageHandler_Call) Run(run func(handler func(ws.Channel, []byte) error)) *MockWsServer_SetMessageHandler_Call { - _c.Call.Run(func(args mock.Arguments) { - run(args[0].(func(ws.Channel, []byte) error)) - }) - return _c -} - -func (_c *MockWsServer_SetMessageHandler_Call) Return() *MockWsServer_SetMessageHandler_Call { - _c.Call.Return() - return _c -} - -func (_c *MockWsServer_SetMessageHandler_Call) RunAndReturn(run func(func(ws.Channel, []byte) error)) *MockWsServer_SetMessageHandler_Call { - _c.Run(run) - return _c -} - -// SetNewClientHandler provides a mock function with given fields: handler -func (_m *MockWsServer) SetNewClientHandler(handler func(ws.Channel)) { - _m.Called(handler) -} - -// MockWsServer_SetNewClientHandler_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'SetNewClientHandler' -type MockWsServer_SetNewClientHandler_Call struct { - *mock.Call -} - -// SetNewClientHandler is a helper method to define mock.On call -// - handler func(ws.Channel) -func (_e *MockWsServer_Expecter) SetNewClientHandler(handler interface{}) *MockWsServer_SetNewClientHandler_Call { - return &MockWsServer_SetNewClientHandler_Call{Call: _e.mock.On("SetNewClientHandler", handler)} -} - -func (_c *MockWsServer_SetNewClientHandler_Call) Run(run func(handler func(ws.Channel))) *MockWsServer_SetNewClientHandler_Call { - _c.Call.Run(func(args mock.Arguments) { - run(args[0].(func(ws.Channel))) - }) - return _c -} - -func (_c *MockWsServer_SetNewClientHandler_Call) Return() *MockWsServer_SetNewClientHandler_Call { - _c.Call.Return() - return _c -} - -func (_c *MockWsServer_SetNewClientHandler_Call) RunAndReturn(run func(func(ws.Channel))) *MockWsServer_SetNewClientHandler_Call { - _c.Run(run) - return _c -} - -// SetTimeoutConfig provides a mock function with given fields: config -func (_m *MockWsServer) SetTimeoutConfig(config ws.ServerTimeoutConfig) { - _m.Called(config) -} - -// MockWsServer_SetTimeoutConfig_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'SetTimeoutConfig' -type MockWsServer_SetTimeoutConfig_Call struct { - *mock.Call -} - -// SetTimeoutConfig is a helper method to define mock.On call -// - config ws.ServerTimeoutConfig -func (_e *MockWsServer_Expecter) SetTimeoutConfig(config interface{}) *MockWsServer_SetTimeoutConfig_Call { - return &MockWsServer_SetTimeoutConfig_Call{Call: _e.mock.On("SetTimeoutConfig", config)} -} - -func (_c *MockWsServer_SetTimeoutConfig_Call) Run(run func(config ws.ServerTimeoutConfig)) *MockWsServer_SetTimeoutConfig_Call { - _c.Call.Run(func(args mock.Arguments) { - run(args[0].(ws.ServerTimeoutConfig)) - }) - return _c -} - -func (_c *MockWsServer_SetTimeoutConfig_Call) Return() *MockWsServer_SetTimeoutConfig_Call { - _c.Call.Return() - return _c -} - -func (_c *MockWsServer_SetTimeoutConfig_Call) RunAndReturn(run func(ws.ServerTimeoutConfig)) *MockWsServer_SetTimeoutConfig_Call { - _c.Run(run) - return _c -} - -// Start provides a mock function with given fields: port, listenPath -func (_m *MockWsServer) Start(port int, listenPath string) { - _m.Called(port, listenPath) -} - -// MockWsServer_Start_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Start' -type MockWsServer_Start_Call struct { - *mock.Call -} - -// Start is a helper method to define mock.On call -// - port int -// - listenPath string -func (_e *MockWsServer_Expecter) Start(port interface{}, listenPath interface{}) *MockWsServer_Start_Call { - return &MockWsServer_Start_Call{Call: _e.mock.On("Start", port, listenPath)} -} - -func (_c *MockWsServer_Start_Call) Run(run func(port int, listenPath string)) *MockWsServer_Start_Call { - _c.Call.Run(func(args mock.Arguments) { - run(args[0].(int), args[1].(string)) - }) - return _c -} - -func (_c *MockWsServer_Start_Call) Return() *MockWsServer_Start_Call { - _c.Call.Return() - return _c -} - -func (_c *MockWsServer_Start_Call) RunAndReturn(run func(int, string)) *MockWsServer_Start_Call { - _c.Run(run) - return _c -} - -// Stop provides a mock function with no fields -func (_m *MockWsServer) Stop() { - _m.Called() -} - -// MockWsServer_Stop_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Stop' -type MockWsServer_Stop_Call struct { - *mock.Call -} - -// Stop is a helper method to define mock.On call -func (_e *MockWsServer_Expecter) Stop() *MockWsServer_Stop_Call { - return &MockWsServer_Stop_Call{Call: _e.mock.On("Stop")} -} - -func (_c *MockWsServer_Stop_Call) Run(run func()) *MockWsServer_Stop_Call { - _c.Call.Run(func(args mock.Arguments) { - run() - }) - return _c -} - -func (_c *MockWsServer_Stop_Call) Return() *MockWsServer_Stop_Call { - _c.Call.Return() - return _c -} - -func (_c *MockWsServer_Stop_Call) RunAndReturn(run func()) *MockWsServer_Stop_Call { - _c.Run(run) - return _c -} - -// StopConnection provides a mock function with given fields: id, closeError -func (_m *MockWsServer) StopConnection(id string, closeError websocket.CloseError) error { - ret := _m.Called(id, closeError) - - if len(ret) == 0 { - panic("no return value specified for StopConnection") - } - - var r0 error - if rf, ok := ret.Get(0).(func(string, websocket.CloseError) error); ok { - r0 = rf(id, closeError) - } else { - r0 = ret.Error(0) - } - - return r0 -} - -// MockWsServer_StopConnection_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'StopConnection' -type MockWsServer_StopConnection_Call struct { - *mock.Call -} - -// StopConnection is a helper method to define mock.On call -// - id string -// - closeError websocket.CloseError -func (_e *MockWsServer_Expecter) StopConnection(id interface{}, closeError interface{}) *MockWsServer_StopConnection_Call { - return &MockWsServer_StopConnection_Call{Call: _e.mock.On("StopConnection", id, closeError)} -} - -func (_c *MockWsServer_StopConnection_Call) Run(run func(id string, closeError websocket.CloseError)) *MockWsServer_StopConnection_Call { - _c.Call.Run(func(args mock.Arguments) { - run(args[0].(string), args[1].(websocket.CloseError)) - }) - return _c -} - -func (_c *MockWsServer_StopConnection_Call) Return(_a0 error) *MockWsServer_StopConnection_Call { - _c.Call.Return(_a0) - return _c -} - -func (_c *MockWsServer_StopConnection_Call) RunAndReturn(run func(string, websocket.CloseError) error) *MockWsServer_StopConnection_Call { - _c.Call.Return(run) - return _c -} - -// Write provides a mock function with given fields: webSocketId, data -func (_m *MockWsServer) Write(webSocketId string, data []byte) error { - ret := _m.Called(webSocketId, data) - - if len(ret) == 0 { - panic("no return value specified for Write") - } - - var r0 error - if rf, ok := ret.Get(0).(func(string, []byte) error); ok { - r0 = rf(webSocketId, data) - } else { - r0 = ret.Error(0) - } - - return r0 -} - -// MockWsServer_Write_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Write' -type MockWsServer_Write_Call struct { - *mock.Call -} - -// Write is a helper method to define mock.On call -// - webSocketId string -// - data []byte -func (_e *MockWsServer_Expecter) Write(webSocketId interface{}, data interface{}) *MockWsServer_Write_Call { - return &MockWsServer_Write_Call{Call: _e.mock.On("Write", webSocketId, data)} -} - -func (_c *MockWsServer_Write_Call) Run(run func(webSocketId string, data []byte)) *MockWsServer_Write_Call { - _c.Call.Run(func(args mock.Arguments) { - run(args[0].(string), args[1].([]byte)) - }) - return _c -} - -func (_c *MockWsServer_Write_Call) Return(_a0 error) *MockWsServer_Write_Call { - _c.Call.Return(_a0) - return _c -} - -func (_c *MockWsServer_Write_Call) RunAndReturn(run func(string, []byte) error) *MockWsServer_Write_Call { - _c.Call.Return(run) - return _c -} - -// NewMockWsServer creates a new instance of MockWsServer. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. -// The first argument is typically a *testing.T value. -func NewMockWsServer(t interface { - mock.TestingT - Cleanup(func()) -}) *MockWsServer { - mock := &MockWsServer{} - mock.Mock.Test(t) - - t.Cleanup(func() { mock.AssertExpectations(t) }) - - return mock -} diff --git a/ws/network_test.go b/ws/network_test.go index 5cfc639a..db88efd3 100644 --- a/ws/network_test.go +++ b/ws/network_test.go @@ -28,8 +28,8 @@ type NetworkTestSuite struct { suite.Suite proxy *toxiproxy.Proxy proxyPort int - server *server - client *client + server *ServerImpl + client *ClientImpl } func (s *NetworkTestSuite) SetupSuite() { diff --git a/ws/server.go b/ws/server.go index 7aaf03b2..a4b0c5bd 100644 --- a/ws/server.go +++ b/ws/server.go @@ -126,10 +126,10 @@ type Server interface { GetChannel(websocketId string) (Channel, bool) } -// Default implementation of a Websocket server. +// Default implementation of a Websocket ServerImpl. // -// Use the NewServer function to create a new server. -type server struct { +// Use the NewServer function to create a new ServerImpl. +type ServerImpl struct { connections map[string]*webSocket httpServer *http.Server messageHandler func(ws Channel, data []byte) error @@ -149,12 +149,12 @@ type server struct { } // ServerOpt is a function that can be used to set options on a server during creation. -type ServerOpt func(s *server) +type ServerOpt func(s *ServerImpl) // WithServerTLSConfig sets the TLS configuration for the server. // If the passed tlsConfig is nil, the client will not use TLS. func WithServerTLSConfig(certificatePath string, certificateKey string, tlsConfig *tls.Config) ServerOpt { - return func(s *server) { + return func(s *ServerImpl) { s.tlsCertificatePath = certificatePath s.tlsCertificateKey = certificateKey if tlsConfig != nil { @@ -182,7 +182,7 @@ func WithServerTLSConfig(certificatePath string, certificateKey string, tlsConfi // When TLS is correctly configured, the server will automatically use it for all created websocket channels. func NewServer(opts ...ServerOpt) Server { router := mux.NewRouter() - s := &server{ + s := &ServerImpl{ httpServer: &http.Server{}, timeoutConfig: NewServerTimeoutConfig(), upgrader: websocket.Upgrader{Subprotocols: []string{}}, @@ -198,27 +198,27 @@ func NewServer(opts ...ServerOpt) Server { return s } -func (s *server) SetMessageHandler(handler MessageHandler) { +func (s *ServerImpl) SetMessageHandler(handler MessageHandler) { s.messageHandler = handler } -func (s *server) SetCheckClientHandler(handler CheckClientHandler) { +func (s *ServerImpl) SetCheckClientHandler(handler CheckClientHandler) { s.checkClientHandler = handler } -func (s *server) SetNewClientHandler(handler ConnectedHandler) { +func (s *ServerImpl) SetNewClientHandler(handler ConnectedHandler) { s.newClientHandler = handler } -func (s *server) SetDisconnectedClientHandler(handler func(ws Channel)) { +func (s *ServerImpl) SetDisconnectedClientHandler(handler func(ws Channel)) { s.disconnectedHandler = handler } -func (s *server) SetTimeoutConfig(config ServerTimeoutConfig) { +func (s *ServerImpl) SetTimeoutConfig(config ServerTimeoutConfig) { s.timeoutConfig = config } -func (s *server) AddSupportedSubprotocol(subProto string) { +func (s *ServerImpl) AddSupportedSubprotocol(subProto string) { for _, sub := range s.upgrader.Subprotocols { if sub == subProto { // Don't add duplicates @@ -228,41 +228,41 @@ func (s *server) AddSupportedSubprotocol(subProto string) { s.upgrader.Subprotocols = append(s.upgrader.Subprotocols, subProto) } -func (s *server) SetChargePointIdResolver(resolver func(r *http.Request) (string, error)) { +func (s *ServerImpl) SetChargePointIdResolver(resolver func(r *http.Request) (string, error)) { s.chargePointIdResolver = resolver } -func (s *server) SetBasicAuthHandler(handler func(username string, password string) bool) { +func (s *ServerImpl) SetBasicAuthHandler(handler func(username string, password string) bool) { s.basicAuthHandler = handler } -func (s *server) SetCheckOriginHandler(handler func(r *http.Request) bool) { +func (s *ServerImpl) SetCheckOriginHandler(handler func(r *http.Request) bool) { s.upgrader.CheckOrigin = handler } -func (s *server) error(err error) { +func (s *ServerImpl) error(err error) { log.Error(err) if s.errC != nil { s.errC <- err } } -func (s *server) Errors() <-chan error { +func (s *ServerImpl) Errors() <-chan error { if s.errC == nil { s.errC = make(chan error, 1) } return s.errC } -func (s *server) Addr() *net.TCPAddr { +func (s *ServerImpl) Addr() *net.TCPAddr { return s.addr } -func (s *server) AddHttpHandler(listenPath string, handler func(w http.ResponseWriter, r *http.Request)) { +func (s *ServerImpl) AddHttpHandler(listenPath string, handler func(w http.ResponseWriter, r *http.Request)) { s.httpHandler.HandleFunc(listenPath, handler) } -func (s *server) Start(port int, listenPath string) { +func (s *ServerImpl) Start(port int, listenPath string) { s.connMutex.Lock() s.connections = make(map[string]*webSocket) s.connMutex.Unlock() @@ -302,7 +302,7 @@ func (s *server) Start(port int, listenPath string) { } } -func (s *server) Stop() { +func (s *ServerImpl) Stop() { log.Info("stopping websocket server") err := s.httpServer.Shutdown(context.TODO()) if err != nil { @@ -315,7 +315,7 @@ func (s *server) Stop() { } } -func (s *server) StopConnection(id string, closeError websocket.CloseError) error { +func (s *ServerImpl) StopConnection(id string, closeError websocket.CloseError) error { s.connMutex.RLock() w, ok := s.connections[id] s.connMutex.RUnlock() @@ -327,14 +327,14 @@ func (s *server) StopConnection(id string, closeError websocket.CloseError) erro return w.Close(closeError) } -func (s *server) GetChannel(websocketId string) (Channel, bool) { +func (s *ServerImpl) GetChannel(websocketId string) (Channel, bool) { s.connMutex.RLock() defer s.connMutex.RUnlock() c, ok := s.connections[websocketId] return c, ok } -func (s *server) stopConnections() { +func (s *ServerImpl) stopConnections() { s.connMutex.RLock() defer s.connMutex.RUnlock() for _, conn := range s.connections { @@ -342,7 +342,7 @@ func (s *server) stopConnections() { } } -func (s *server) Write(webSocketId string, data []byte) error { +func (s *ServerImpl) Write(webSocketId string, data []byte) error { s.connMutex.RLock() defer s.connMutex.RUnlock() w, ok := s.connections[webSocketId] @@ -353,7 +353,7 @@ func (s *server) Write(webSocketId string, data []byte) error { return w.Write(data) } -func (s *server) wsHandler(w http.ResponseWriter, r *http.Request) { +func (s *ServerImpl) wsHandler(w http.ResponseWriter, r *http.Request) { responseHeader := http.Header{} id, err := s.chargePointIdResolver(r) if err != nil { @@ -463,14 +463,14 @@ out: } // --------- Internal callbacks webSocket -> server --------- -func (s *server) handleMessage(w Channel, data []byte) error { +func (s *ServerImpl) handleMessage(w Channel, data []byte) error { if s.messageHandler != nil { return s.messageHandler(w, data) } return fmt.Errorf("no message handler set") } -func (s *server) handleDisconnect(w Channel, _ error) { +func (s *ServerImpl) handleDisconnect(w Channel, _ error) { // server never attempts to auto-reconnect to client. Resources are simply freed up s.connMutex.Lock() delete(s.connections, w.ID()) diff --git a/ws/websocket_test.go b/ws/websocket_test.go index 7cde5c1c..a20216bd 100644 --- a/ws/websocket_test.go +++ b/ws/websocket_test.go @@ -38,9 +38,9 @@ const ( defaultSubProtocol = "ocpp1.6" ) -func newWebsocketServer(t *testing.T, onMessage func(data []byte) ([]byte, error)) *server { +func newWebsocketServer(t *testing.T, onMessage func(data []byte) ([]byte, error)) *ServerImpl { wsServer := NewServer() - innerS, ok := wsServer.(*server) + innerS, ok := wsServer.(*ServerImpl) require.True(t, ok) innerS.SetMessageHandler(func(ws Channel, data []byte) error { assert.NotNil(t, ws) @@ -58,9 +58,9 @@ func newWebsocketServer(t *testing.T, onMessage func(data []byte) ([]byte, error return innerS } -func newWebsocketClient(t *testing.T, onMessage func(data []byte) ([]byte, error)) *client { +func newWebsocketClient(t *testing.T, onMessage func(data []byte) ([]byte, error)) *ClientImpl { wsClient := NewClient() - innerC, ok := wsClient.(*client) + innerC, ok := wsClient.(*ClientImpl) require.True(t, ok) innerC.SetRequestedSubProtocol(defaultSubProtocol) innerC.SetMessageHandler(func(data []byte) error { @@ -80,8 +80,8 @@ func newWebsocketClient(t *testing.T, onMessage func(data []byte) ([]byte, error type WebSocketSuite struct { suite.Suite - client *client - server *server + client *ClientImpl + server *ServerImpl } func (s *WebSocketSuite) SetupTest() { @@ -356,7 +356,7 @@ func (s *WebSocketSuite) TestWebsocketChargePointIdResolverFailure() { } func (s *WebSocketSuite) TestWebsocketBootRetries() { - verifyConnection := func(client *client, connected bool) { + verifyConnection := func(client *ClientImpl, connected bool) { maxAttempts := 20 for i := 0; i <= maxAttempts; i++ { if client.IsConnected() != connected { @@ -746,7 +746,7 @@ func (s *WebSocketSuite) TestValidBasicAuth() { // Create TLS server with self-signed certificate tlsServer := NewServer(WithServerTLSConfig(certFilename, keyFilename, nil)) - s.server, ok = tlsServer.(*server) + s.server, ok = tlsServer.(*ServerImpl) s.True(ok) // Add basic auth handler s.server.SetBasicAuthHandler(func(username string, password string) bool { @@ -771,7 +771,7 @@ func (s *WebSocketSuite) TestValidBasicAuth() { tlsClient := NewClient(WithClientTLSConfig(&tls.Config{ RootCAs: certPool, })) - s.client, ok = tlsClient.(*client) + s.client, ok = tlsClient.(*ClientImpl) s.True(ok) s.client.SetRequestedSubProtocol(defaultSubProtocol) // Add basic auth @@ -801,7 +801,7 @@ func (s *WebSocketSuite) TestInvalidBasicAuth() { // Create TLS server with self-signed certificate tlsServer := NewServer(WithServerTLSConfig(certFilename, keyFilename, nil)) - s.server, ok = tlsServer.(*server) + s.server, ok = tlsServer.(*ServerImpl) s.True(ok) // Add basic auth handler s.server.SetBasicAuthHandler(func(username string, password string) bool { @@ -996,7 +996,7 @@ func (s *WebSocketSuite) TestValidClientTLSCertificate() { ClientCAs: certPool, ClientAuth: tls.RequireAndVerifyClientCert, })) - s.server, ok = tlsServer.(*server) + s.server, ok = tlsServer.(*ServerImpl) s.True(ok) // Add basic auth handler connected := make(chan struct{}) @@ -1019,7 +1019,7 @@ func (s *WebSocketSuite) TestValidClientTLSCertificate() { RootCAs: certPool, Certificates: []tls.Certificate{loadedCert}, })) - s.client, ok = tlsClient.(*client) + s.client, ok = tlsClient.(*ClientImpl) s.True(ok) s.client.SetRequestedSubProtocol(defaultSubProtocol) // Test connection @@ -1062,7 +1062,7 @@ func (s *WebSocketSuite) TestInvalidClientTLSCertificate() { ClientCAs: certPool, // Contains server certificate as allowed client CA ClientAuth: tls.RequireAndVerifyClientCert, // Requires client certificate signed by allowed CA (server) })) - s.server, ok = tlsServer.(*server) + s.server, ok = tlsServer.(*ServerImpl) s.True(ok) // Add basic auth handler s.server.SetNewClientHandler(func(ws Channel) { @@ -1085,7 +1085,7 @@ func (s *WebSocketSuite) TestInvalidClientTLSCertificate() { RootCAs: certPool, // Contains server certificate as allowed server CA Certificates: []tls.Certificate{loadedCert}, // Contains self-signed client certificate. Will be rejected by server })) - s.client, ok = tlsClient.(*client) + s.client, ok = tlsClient.(*ClientImpl) s.True(ok) s.client.SetRequestedSubProtocol(defaultSubProtocol) // Test connection From 170390070fc0ddbb90b0b62a538090e22d709874 Mon Sep 17 00:00:00 2001 From: Damien Date: Tue, 17 Jun 2025 15:18:06 +1100 Subject: [PATCH 3/3] deps: update --- go.mod | 16 ++++++++-------- go.sum | 32 ++++++++++++++++---------------- 2 files changed, 24 insertions(+), 24 deletions(-) diff --git a/go.mod b/go.mod index 6ca82fd2..c4834324 100644 --- a/go.mod +++ b/go.mod @@ -20,7 +20,7 @@ require ( github.com/fsnotify/fsnotify v1.9.0 // indirect github.com/gabriel-vasile/mimetype v1.4.9 // indirect github.com/go-playground/locales v0.14.1 // indirect - github.com/go-viper/mapstructure/v2 v2.2.1 // indirect + github.com/go-viper/mapstructure/v2 v2.3.0 // indirect github.com/huandu/xstrings v1.5.0 // indirect github.com/iancoleman/strcase v0.3.0 // indirect github.com/inconshreveable/mousetrap v1.1.0 // indirect @@ -36,7 +36,7 @@ require ( github.com/sagikazarmark/locafero v0.9.0 // indirect github.com/sourcegraph/conc v0.3.0 // indirect github.com/spf13/afero v1.14.0 // indirect - github.com/spf13/cast v1.8.0 // indirect + github.com/spf13/cast v1.9.2 // indirect github.com/spf13/cobra v1.9.1 // indirect github.com/spf13/pflag v1.0.6 // indirect github.com/spf13/viper v1.20.1 // indirect @@ -44,14 +44,14 @@ require ( github.com/subosito/gotenv v1.6.0 // indirect github.com/vektra/mockery/v2 v2.53.4 // indirect go.uber.org/multierr v1.11.0 // indirect - golang.org/x/crypto v0.38.0 // indirect - golang.org/x/mod v0.24.0 // indirect - golang.org/x/net v0.40.0 // indirect - golang.org/x/sync v0.14.0 // indirect + golang.org/x/crypto v0.39.0 // indirect + golang.org/x/mod v0.25.0 // indirect + golang.org/x/net v0.41.0 // indirect + golang.org/x/sync v0.15.0 // indirect golang.org/x/sys v0.33.0 // indirect golang.org/x/term v0.32.0 // indirect - golang.org/x/text v0.25.0 // indirect - golang.org/x/tools v0.33.0 // indirect + golang.org/x/text v0.26.0 // indirect + golang.org/x/tools v0.34.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/go.sum b/go.sum index 3d3bff6e..a0a1965d 100644 --- a/go.sum +++ b/go.sum @@ -24,8 +24,8 @@ github.com/go-playground/universal-translator v0.18.1 h1:Bcnm0ZwsGyWbCzImXv+pAJn github.com/go-playground/universal-translator v0.18.1/go.mod h1:xekY+UJKNuX9WP91TpwSH2VMlDf28Uj24BCp08ZFTUY= github.com/go-playground/validator/v10 v10.26.0 h1:SP05Nqhjcvz81uJaRfEV0YBSSSGMc/iMaVtFbr3Sw2k= github.com/go-playground/validator/v10 v10.26.0/go.mod h1:I5QpIEbmr8On7W0TktmJAumgzX4CA1XNl4ZmDuVHKKo= -github.com/go-viper/mapstructure/v2 v2.2.1 h1:ZAaOCxANMuZx5RCeg0mBdEZk7DZasvvZIxtHqx8aGss= -github.com/go-viper/mapstructure/v2 v2.2.1/go.mod h1:oJDH3BJKyqBA2TXFhDsKDGDTlndYOZ6rGS0BRZIxGhM= +github.com/go-viper/mapstructure/v2 v2.3.0 h1:27XbWsHIqhbdR5TIC911OfYvgSaW93HM+dX7970Q7jk= +github.com/go-viper/mapstructure/v2 v2.3.0/go.mod h1:oJDH3BJKyqBA2TXFhDsKDGDTlndYOZ6rGS0BRZIxGhM= github.com/godbus/dbus/v5 v5.0.4/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA= github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= @@ -82,8 +82,8 @@ github.com/sourcegraph/conc v0.3.0 h1:OQTbbt6P72L20UqAkXXuLOj79LfEanQ+YQFNpLA9yS github.com/sourcegraph/conc v0.3.0/go.mod h1:Sdozi7LEKbFPqYX2/J+iBAM6HpqSLTASQIKqDmF7Mt0= github.com/spf13/afero v1.14.0 h1:9tH6MapGnn/j0eb0yIXiLjERO8RB6xIVZRDCX7PtqWA= github.com/spf13/afero v1.14.0/go.mod h1:acJQ8t0ohCGuMN3O+Pv0V0hgMxNYDlvdk+VTfyZmbYo= -github.com/spf13/cast v1.8.0 h1:gEN9K4b8Xws4EX0+a0reLmhq8moKn7ntRlQYgjPeCDk= -github.com/spf13/cast v1.8.0/go.mod h1:ancEpBxwJDODSW/UG4rDrAqiKolqNNh2DX3mk86cAdo= +github.com/spf13/cast v1.9.2 h1:SsGfm7M8QOFtEzumm7UZrZdLLquNdzFYfIbEXntcFbE= +github.com/spf13/cast v1.9.2/go.mod h1:jNfB8QC9IA6ZuY2ZjDp0KtFO2LZZlg4S/7bzP6qqeHo= github.com/spf13/cobra v1.9.1 h1:CXSaggrXdbHK9CF+8ywj8Amf7PBRmPCOJugH954Nnlo= github.com/spf13/cobra v1.9.1/go.mod h1:nDyEzZ8ogv936Cinf6g1RU9MRY64Ir93oCnqb9wxYW0= github.com/spf13/pflag v1.0.6 h1:jFzHGLGAlb3ruxLB8MhbI6A8+AQX/2eW4qeyNZXNp2o= @@ -102,14 +102,14 @@ github.com/vektra/mockery/v2 v2.53.4 h1:abBWJLUQppM7T/VsLasBwgl7XXQRWH6lC3bnbJpO github.com/vektra/mockery/v2 v2.53.4/go.mod h1:hIFFb3CvzPdDJJiU7J4zLRblUMv7OuezWsHPmswriwo= go.uber.org/multierr v1.11.0 h1:blXXJkSxSSfBVBlC76pxqeO+LN3aDfLQo+309xJstO0= go.uber.org/multierr v1.11.0/go.mod h1:20+QtiLqy0Nd6FdQB9TLXag12DsQkrbs3htMFfDN80Y= -golang.org/x/crypto v0.38.0 h1:jt+WWG8IZlBnVbomuhg2Mdq0+BBQaHbtqHEFEigjUV8= -golang.org/x/crypto v0.38.0/go.mod h1:MvrbAqul58NNYPKnOra203SB9vpuZW0e+RRZV+Ggqjw= -golang.org/x/mod v0.24.0 h1:ZfthKaKaT4NrhGVZHO1/WDTwGES4De8KtWO0SIbNJMU= -golang.org/x/mod v0.24.0/go.mod h1:IXM97Txy2VM4PJ3gI61r1YEk/gAj6zAHN3AdZt6S9Ww= -golang.org/x/net v0.40.0 h1:79Xs7wF06Gbdcg4kdCCIQArK11Z1hr5POQ6+fIYHNuY= -golang.org/x/net v0.40.0/go.mod h1:y0hY0exeL2Pku80/zKK7tpntoX23cqL3Oa6njdgRtds= -golang.org/x/sync v0.14.0 h1:woo0S4Yywslg6hp4eUFjTVOyKt0RookbpAHG4c1HmhQ= -golang.org/x/sync v0.14.0/go.mod h1:1dzgHSNfp02xaA81J2MS99Qcpr2w7fw1gpm99rleRqA= +golang.org/x/crypto v0.39.0 h1:SHs+kF4LP+f+p14esP5jAoDpHU8Gu/v9lFRK6IT5imM= +golang.org/x/crypto v0.39.0/go.mod h1:L+Xg3Wf6HoL4Bn4238Z6ft6KfEpN0tJGo53AAPC632U= +golang.org/x/mod v0.25.0 h1:n7a+ZbQKQA/Ysbyb0/6IbB1H/X41mKgbhfv7AfG/44w= +golang.org/x/mod v0.25.0/go.mod h1:IXM97Txy2VM4PJ3gI61r1YEk/gAj6zAHN3AdZt6S9Ww= +golang.org/x/net v0.41.0 h1:vBTly1HeNPEn3wtREYfy4GZ/NECgw2Cnl+nK6Nz3uvw= +golang.org/x/net v0.41.0/go.mod h1:B/K4NNqkfmg07DQYrbwvSluqCJOOXwUjeb/5lOisjbA= +golang.org/x/sync v0.15.0 h1:KWH3jNZsfyT6xfAfKiz6MRNmd46ByHDYaZ7KSkCtdW8= +golang.org/x/sync v0.15.0/go.mod h1:1dzgHSNfp02xaA81J2MS99Qcpr2w7fw1gpm99rleRqA= golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= @@ -118,10 +118,10 @@ golang.org/x/sys v0.33.0 h1:q3i8TbbEz+JRD9ywIRlyRAQbM0qF7hu24q3teo2hbuw= golang.org/x/sys v0.33.0/go.mod h1:BJP2sWEmIv4KK5OTEluFJCKSidICx8ciO85XgH3Ak8k= golang.org/x/term v0.32.0 h1:DR4lr0TjUs3epypdhTOkMmuF5CDFJ/8pOnbzMZPQ7bg= golang.org/x/term v0.32.0/go.mod h1:uZG1FhGx848Sqfsq4/DlJr3xGGsYMu/L5GW4abiaEPQ= -golang.org/x/text v0.25.0 h1:qVyWApTSYLk/drJRO5mDlNYskwQznZmkpV2c8q9zls4= -golang.org/x/text v0.25.0/go.mod h1:WEdwpYrmk1qmdHvhkSTNPm3app7v4rsT8F2UD6+VHIA= -golang.org/x/tools v0.33.0 h1:4qz2S3zmRxbGIhDIAgjxvFutSvH5EfnsYrRBj0UI0bc= -golang.org/x/tools v0.33.0/go.mod h1:CIJMaWEY88juyUfo7UbgPqbC8rU2OqfAV1h2Qp0oMYI= +golang.org/x/text v0.26.0 h1:P42AVeLghgTYr4+xUnTRKDMqpar+PtX7KWuNQL21L8M= +golang.org/x/text v0.26.0/go.mod h1:QK15LZJUUQVJxhz7wXgxSy/CJaTFjd0G+YLonydOVQA= +golang.org/x/tools v0.34.0 h1:qIpSLOxeCYGg9TrcJokLBG4KFA6d795g0xkBkiESGlo= +golang.org/x/tools v0.34.0/go.mod h1:pAP9OwEaY1CAW3HOmg3hLZC5Z0CCmzjAF2UQMSqNARg= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f h1:BLraFXnmrev5lT+xlilqcH8XK9/i0At2xKjWk4p6zsU= gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=